|
|
|
@ -40,16 +40,13 @@ void TUI::initTUI()
|
|
|
|
|
curs_set(0);
|
|
|
|
|
noecho();
|
|
|
|
|
cbreak();
|
|
|
|
|
init_color(COLOR_GRAY, 173, 170, 173);
|
|
|
|
|
|
|
|
|
|
init_pair(COLOR_AREA_STDSCR,COLOR_WHITE, COLOR_BLUE);
|
|
|
|
|
wbkgd(stdscr, COLOR_PAIR(COLOR_AREA_STDSCR));
|
|
|
|
|
|
|
|
|
|
init_pair(COLOR_AREA_ENTRY, COLOR_BLACK, COLOR_GRAY);
|
|
|
|
|
init_pair(COLOR_AREA_ENTRY_SELECTED, COLOR_BLACK, COLOR_WHITE);
|
|
|
|
|
init_pair(COLOR_AREA_OVERVIEW, COLOR_BLACK, COLOR_GRAY);
|
|
|
|
|
init_pair(COLOR_AREA_OVERVIEW, COLOR_BLACK, COLOR_GRAY);
|
|
|
|
|
|
|
|
|
|
init_pair(COLOR_AREA_ENTRY, COLOR_BLACK, COLOR_WHITE);
|
|
|
|
|
init_pair(COLOR_AREA_ENTRY_SELECTED, COLOR_BLACK, COLOR_RED);
|
|
|
|
|
init_pair(COLOR_AREA_OVERVIEW, COLOR_BLACK, COLOR_WHITE);
|
|
|
|
|
init_pair(COLOR_AREA_DETAIL, COLOR_BLACK, COLOR_WHITE);
|
|
|
|
|
|
|
|
|
|
mvprintw(0, 2, "reHDD - HDD refurbishing tool - GPL 3.0 ");
|
|
|
|
|
|
|
|
|
@ -81,8 +78,8 @@ void TUI::updateTUI(vector <Drive>* pvecDrives, int32_t i32SelectedEntry)
|
|
|
|
|
if(i32SelectedEntry == (it - pvecDrives->begin()))
|
|
|
|
|
{
|
|
|
|
|
bSelectedEntry = true;
|
|
|
|
|
detailview=createDetailViewWindow(((stdscrX)-(int)(stdscrX/3)-7), (stdscrY-3), (int)(stdscrX/3)+5, pvecDrives->at((it - pvecDrives->begin())));
|
|
|
|
|
wrefresh(detailview);
|
|
|
|
|
detailview=createDetailViewWindow(((stdscrX)-(int)(stdscrX/3)-7), (stdscrY-3), (int)(stdscrX/3)+5, pvecDrives->at((it - pvecDrives->begin())));
|
|
|
|
|
wrefresh(detailview);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WINDOW * tmp = createEntryWindow( ((int)(stdscrX/3) - 2), 5, 3, (5* (it - pvecDrives->begin()) )+3, sModelFamily, sModelName, sCapacity, bSelectedEntry);
|
|
|
|
@ -166,32 +163,62 @@ WINDOW* TUI::createDetailViewWindow( int iXSize, int iYSize, int iXStart, Drive
|
|
|
|
|
{
|
|
|
|
|
WINDOW *newWindow;
|
|
|
|
|
newWindow = newwin(iYSize, iXSize, 2, iXStart);
|
|
|
|
|
|
|
|
|
|
wbkgd(newWindow, COLOR_PAIR(COLOR_AREA_OVERVIEW));
|
|
|
|
|
wbkgd(newWindow, COLOR_PAIR(COLOR_AREA_DETAIL));
|
|
|
|
|
box(newWindow, ACS_VLINE, ACS_HLINE);
|
|
|
|
|
string title = "Selected Drive: " + drive.getModelName() + " " + drive.sCapacityToText();
|
|
|
|
|
centerTitle(newWindow, title.c_str());
|
|
|
|
|
|
|
|
|
|
string sPath = "Path: " +drive.getPath();
|
|
|
|
|
string sModelFamlily = "ModelFamily: " + drive.getModelFamily();
|
|
|
|
|
string sModelName = "ModelName: " + drive.getModelName();
|
|
|
|
|
string sCapacity = "Capacity: " + drive.sCapacityToText();
|
|
|
|
|
string sSerial = "Serial: " + drive.getSerial();
|
|
|
|
|
string sPowerOnHours = "PowerOnHours: " + drive.sPowerOnHoursToText();
|
|
|
|
|
string sPowerCycle = "PowerCycle: " + drive.sPowerCyclesToText();
|
|
|
|
|
string sErrorCount = "ErrorCount: " + drive.sErrorCountToText();
|
|
|
|
|
|
|
|
|
|
uint16_t u16Line = 2;
|
|
|
|
|
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, sPath.c_str());
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, sModelFamlily.c_str());
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, sModelName.c_str());
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, sCapacity.c_str());
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, sSerial.c_str());
|
|
|
|
|
|
|
|
|
|
string sPath = "Path: " +drive.getPath();
|
|
|
|
|
string sModelFamlily = "ModelFamily: " + drive.getModelFamily();
|
|
|
|
|
string sModelName = "ModelName: " + drive.getModelName();
|
|
|
|
|
string sCapacity = "Capacity: " + drive.sCapacityToText();
|
|
|
|
|
string sSerial = "Serial: " + drive.getSerial();
|
|
|
|
|
string sPowerOnHours = "PowerOnHours: " + drive.sPowerOnHoursToText();
|
|
|
|
|
string sPowerCycle = "PowerCycle: " + drive.sPowerCyclesToText();
|
|
|
|
|
string sErrorCount = "ErrorCount: " + drive.sErrorCountToText();
|
|
|
|
|
attroff(COLOR_PAIR(COLOR_AREA_DETAIL));
|
|
|
|
|
|
|
|
|
|
mvwaddstr(newWindow,2, 3, sPath.c_str());
|
|
|
|
|
mvwaddstr(newWindow,3, 3, sModelFamlily.c_str());
|
|
|
|
|
mvwaddstr(newWindow,4, 3, sModelName.c_str());
|
|
|
|
|
mvwaddstr(newWindow,5, 3, sCapacity.c_str());
|
|
|
|
|
mvwaddstr(newWindow,6, 3, sSerial.c_str());
|
|
|
|
|
mvwaddstr(newWindow,7, 3, sPowerOnHours.c_str());
|
|
|
|
|
mvwaddstr(newWindow,8, 3, sPowerCycle.c_str());
|
|
|
|
|
mvwaddstr(newWindow,9, 3, sErrorCount.c_str());
|
|
|
|
|
if(drive.getPowerOnHours() >= WORSE_HOURS)
|
|
|
|
|
{
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, "------------> WARNING: OPERATING HOURS <-----------");
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, sPowerOnHours.c_str());
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, "---------------------------------------------------");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, sPowerOnHours.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(drive.getPowerCycles() >= WORSE_POWERUP)
|
|
|
|
|
{
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, "------------> WARNING: POWER-ON <------------------");
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, sPowerCycle.c_str());
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, "---------------------------------------------------");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, sPowerCycle.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(drive.getErrorCount() > 0)
|
|
|
|
|
{
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, "------------> WARNING: S.M.A.R.T ERROR <-----------");
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, sErrorCount.c_str());
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, "---------------------------------------------------");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mvwaddstr(newWindow,u16Line++, 3, sErrorCount.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keypad(newWindow, TRUE);
|
|
|
|
|
return newWindow;
|
|
|
|
|