format labels in entries
This commit is contained in:
parent
685e359217
commit
743464efc1
|
@ -52,7 +52,7 @@ private:
|
||||||
WINDOW* dialog;
|
WINDOW* dialog;
|
||||||
WINDOW* smartWarning;
|
WINDOW* smartWarning;
|
||||||
|
|
||||||
static void centerTitle(WINDOW *pwin, const char * title);
|
static void centerTitle(WINDOW* pwin, const char* title);
|
||||||
static WINDOW *createOverViewWindow( int iXSize, int iYSize);
|
static WINDOW *createOverViewWindow( int iXSize, int iYSize);
|
||||||
static WINDOW *createDetailViewWindow( int iXSize, int iYSize, int iXStart, Drive drive);
|
static WINDOW *createDetailViewWindow( int iXSize, int iYSize, int iXStart, Drive drive);
|
||||||
static WINDOW *overwriteDetailViewWindow( int iXSize, int iYSize, int iXStart);
|
static WINDOW *overwriteDetailViewWindow( int iXSize, int iYSize, int iXStart);
|
||||||
|
@ -67,6 +67,6 @@ private:
|
||||||
void displaySelectedDrive(Drive drive, int stdscrX, int stdscrY);
|
void displaySelectedDrive(Drive drive, int stdscrX, int stdscrY);
|
||||||
string formatTimeDuration(time_t u32Duration);
|
string formatTimeDuration(time_t u32Duration);
|
||||||
string formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes);
|
string formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes);
|
||||||
|
static void vTruncateText(string* psText, uint16_t u16MaxLenght);
|
||||||
};
|
};
|
||||||
#endif // TUI_H_
|
#endif // TUI_H_
|
55
src/tui.cpp
55
src/tui.cpp
|
@ -66,6 +66,7 @@ void TUI::updateTUI(list <Drive>* plistDrives, uint8_t u8SelectedEntry)
|
||||||
overview=createOverViewWindow((int)(u16StdscrX *(float)(3.0/7.0)), (u16StdscrY-1));
|
overview=createOverViewWindow((int)(u16StdscrX *(float)(3.0/7.0)), (u16StdscrY-1));
|
||||||
wrefresh(overview);
|
wrefresh(overview);
|
||||||
|
|
||||||
|
//system stat window is 2/7 of the x-size
|
||||||
systemview=createSystemStats(((int)(u16StdscrX *(float)(2.0/7.0)))-6, 12, (int)(u16StdscrX *(float)(5.0/7.0)+4), (u16StdscrY-13 ));
|
systemview=createSystemStats(((int)(u16StdscrX *(float)(2.0/7.0)))-6, 12, (int)(u16StdscrX *(float)(5.0/7.0)+4), (u16StdscrY-13 ));
|
||||||
wrefresh(systemview);
|
wrefresh(systemview);
|
||||||
|
|
||||||
|
@ -356,16 +357,43 @@ WINDOW* TUI::createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart,
|
||||||
|
|
||||||
box(newWindow, ACS_VLINE, ACS_HLINE);
|
box(newWindow, ACS_VLINE, ACS_HLINE);
|
||||||
|
|
||||||
|
//index number
|
||||||
mvwaddstr(newWindow,1, 1, to_string(iListIndex).c_str());
|
mvwaddstr(newWindow,1, 1, to_string(iListIndex).c_str());
|
||||||
|
|
||||||
mvwaddstr(newWindow,1, 5, sModelFamily.c_str());
|
/*
|
||||||
mvwaddstr(newWindow,2, 5, sSerial.c_str());
|
70 chars in x-axis
|
||||||
//mvwaddstr(newWindow,3, 5, sCapacity.c_str());
|
|
||||||
//mvwaddstr(newWindow,3, 5+sCapacity.length()+3, sTemp.c_str());
|
|
||||||
|
|
||||||
mvwaddstr(newWindow,1, iXSize-sSpeed.length()-5, sSpeed.c_str());
|
line:01
|
||||||
mvwaddstr(newWindow,2, iXSize-sState.length()-5, sState.c_str());
|
0: space
|
||||||
// mvwaddstr(newWindow,3, iXSize-sTime.length()-5, sTime.c_str());
|
1: index number
|
||||||
|
2: space
|
||||||
|
3-35: ModelFamily
|
||||||
|
36: space
|
||||||
|
37-43: Capacity
|
||||||
|
44: space
|
||||||
|
45-49: Temp
|
||||||
|
|
||||||
|
line:02
|
||||||
|
0-2: space
|
||||||
|
3-19: Serial
|
||||||
|
20: space
|
||||||
|
21-30: Speed
|
||||||
|
33: space
|
||||||
|
34-45: Time
|
||||||
|
46: space
|
||||||
|
47-70: State (but right side aligned)
|
||||||
|
*/
|
||||||
|
|
||||||
|
vTruncateText(&sModelFamily, 32);
|
||||||
|
mvwaddstr(newWindow, 1, 3, sModelFamily.c_str());
|
||||||
|
mvwaddstr(newWindow, 1, 37, sCapacity.c_str());
|
||||||
|
mvwaddstr(newWindow, 1, 45, sTemp.c_str());
|
||||||
|
|
||||||
|
vTruncateText(&sSerial, 16);
|
||||||
|
mvwaddstr(newWindow, 2, 3, sSerial.c_str());
|
||||||
|
mvwaddstr(newWindow, 2, 21, sSpeed.c_str());
|
||||||
|
mvwaddstr(newWindow, 2, 34, sTime.c_str());
|
||||||
|
mvwaddstr(newWindow,2, iXSize - sState.length() - 2, sState.c_str());
|
||||||
|
|
||||||
return newWindow;
|
return newWindow;
|
||||||
}
|
}
|
||||||
|
@ -421,7 +449,7 @@ WINDOW* TUI::createMenuView(int iXSize, int iYSize, int iXStart, int iYStart, st
|
||||||
|
|
||||||
centerTitle(newWindow, "Controls");
|
centerTitle(newWindow, "Controls");
|
||||||
|
|
||||||
uint16_t u16Line = 2;
|
uint16_t u16Line = 4;
|
||||||
|
|
||||||
if(menustate.bAbort)
|
if(menustate.bAbort)
|
||||||
{
|
{
|
||||||
|
@ -558,6 +586,15 @@ string TUI::formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes)
|
||||||
return out.str();
|
return out.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TUI::vTruncateText(string* psText, uint16_t u16MaxLenght)
|
||||||
|
{
|
||||||
|
if (psText->length() > u16MaxLenght)
|
||||||
|
{
|
||||||
|
psText->resize(u16MaxLenght-3);
|
||||||
|
*psText = *psText + "...";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TUI::displaySelectedDrive(Drive drive, int stdscrX, int stdscrY)
|
void TUI::displaySelectedDrive(Drive drive, int stdscrX, int stdscrY)
|
||||||
{
|
{
|
||||||
struct MenuState menustate;
|
struct MenuState menustate;
|
||||||
|
@ -597,8 +634,6 @@ void TUI::displaySelectedDrive(Drive drive, int stdscrX, int stdscrY)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
detailview=createDetailViewWindow((stdscrX)-((int)(stdscrX *(float)(3.0/7.0)))-7, (stdscrY-15), (int)(stdscrX *(float)(3.0/7.0)+5), drive);
|
detailview=createDetailViewWindow((stdscrX)-((int)(stdscrX *(float)(3.0/7.0)))-7, (stdscrY-15), (int)(stdscrX *(float)(3.0/7.0)+5), drive);
|
||||||
wrefresh(detailview);
|
wrefresh(detailview);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue