merge threading to develop #21
| @ -39,11 +39,14 @@ private: | |||||||
|  |  | ||||||
|      WINDOW *detailview; |      WINDOW *detailview; | ||||||
|      WINDOW *overview; |      WINDOW *overview; | ||||||
|  |      WINDOW *systemview; | ||||||
|  |  | ||||||
|  |  | ||||||
|     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 *createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart,string sModelFamily, string sModelName, string sCapacity, bool bSelected); |     static WINDOW *createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart,string sModelFamily, string sModelName, string sCapacity, bool bSelected); | ||||||
|  |     static WINDOW *createSystemStats(int iXSize, int iYSize, int iYStart); | ||||||
|  |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | |||||||
| @ -54,7 +54,6 @@ void TUI::initTUI() | |||||||
|  |  | ||||||
| void TUI::updateTUI(vector <Drive>* pvecDrives, int32_t i32SelectedEntry) | void TUI::updateTUI(vector <Drive>* pvecDrives, int32_t i32SelectedEntry) | ||||||
| { | { | ||||||
|  |  | ||||||
|     int stdscrX, stdscrY; |     int stdscrX, stdscrY; | ||||||
|     getmaxyx(stdscr, stdscrY, stdscrX); |     getmaxyx(stdscr, stdscrY, stdscrX); | ||||||
|  |  | ||||||
| @ -66,6 +65,9 @@ void TUI::updateTUI(vector <Drive>* pvecDrives, int32_t i32SelectedEntry) | |||||||
|     overview=createOverViewWindow((int)(stdscrX/3), (stdscrY-15)); |     overview=createOverViewWindow((int)(stdscrX/3), (stdscrY-15)); | ||||||
|     wrefresh(overview); |     wrefresh(overview); | ||||||
|  |  | ||||||
|  |     systemview=createSystemStats((int)(stdscrX/3), 10, (stdscrY-11)); | ||||||
|  |     wrefresh(systemview); | ||||||
|  |  | ||||||
|     vector <Drive>::iterator it; |     vector <Drive>::iterator it; | ||||||
|     for (it = pvecDrives->begin(); it != pvecDrives->end(); ++it) |     for (it = pvecDrives->begin(); it != pvecDrives->end(); ++it) | ||||||
|         { |         { | ||||||
| @ -120,7 +122,6 @@ enum TUI::UserInput TUI::readUserInput() | |||||||
|     return TUI::UserInput::Undefined; |     return TUI::UserInput::Undefined; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void TUI::centerTitle(WINDOW *pwin, const char * title) | void TUI::centerTitle(WINDOW *pwin, const char * title) | ||||||
| { | { | ||||||
|     int x, maxX, stringSize; |     int x, maxX, stringSize; | ||||||
| @ -142,18 +143,7 @@ WINDOW* TUI::createOverViewWindow( int iXSize, int iYSize) | |||||||
|     wbkgd(newWindow, COLOR_PAIR(COLOR_AREA_OVERVIEW)); |     wbkgd(newWindow, COLOR_PAIR(COLOR_AREA_OVERVIEW)); | ||||||
|     box(newWindow, ACS_VLINE, ACS_HLINE); |     box(newWindow, ACS_VLINE, ACS_HLINE); | ||||||
|  |  | ||||||
|     time_t rawtime; |     centerTitle(newWindow, "Detected Drives"); | ||||||
|     struct tm * timeinfo; |  | ||||||
|     char buffer[80]; |  | ||||||
|  |  | ||||||
|     time (&rawtime); |  | ||||||
|     timeinfo = localtime(&rawtime); |  | ||||||
|  |  | ||||||
|     strftime(buffer,sizeof(buffer),"%d-%m-%Y %H:%M:%S",timeinfo); |  | ||||||
|     std::string str(buffer); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     centerTitle(newWindow, str.c_str()); |  | ||||||
|  |  | ||||||
|     keypad(newWindow, TRUE); |     keypad(newWindow, TRUE); | ||||||
|     return newWindow; |     return newWindow; | ||||||
| @ -229,8 +219,6 @@ WINDOW* TUI::createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart, | |||||||
|     WINDOW *newWindow; |     WINDOW *newWindow; | ||||||
|     newWindow = newwin(iYSize, iXSize, iYStart, iXStart); |     newWindow = newwin(iYSize, iXSize, iYStart, iXStart); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     if(!bSelected) |     if(!bSelected) | ||||||
|         { |         { | ||||||
|             // entry is NOT selected |             // entry is NOT selected | ||||||
| @ -254,3 +242,27 @@ WINDOW* TUI::createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart, | |||||||
|  |  | ||||||
|     return newWindow; |     return newWindow; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | WINDOW* TUI::createSystemStats(int iXSize, int iYSize, int iYStart){ | ||||||
|  |  | ||||||
|  | WINDOW *newWindow; | ||||||
|  |     newWindow = newwin(iYSize, iXSize, iYStart, 2); | ||||||
|  |  | ||||||
|  |     wbkgd(newWindow, COLOR_PAIR(COLOR_AREA_OVERVIEW)); | ||||||
|  |     box(newWindow, ACS_VLINE, ACS_HLINE); | ||||||
|  |  | ||||||
|  |     centerTitle(newWindow, "System"); | ||||||
|  |  | ||||||
|  |     time_t rawtime; | ||||||
|  |     struct tm * timeinfo; | ||||||
|  |     char buffer[80]; | ||||||
|  |     time (&rawtime); | ||||||
|  |     timeinfo = localtime(&rawtime); | ||||||
|  |     strftime(buffer,sizeof(buffer),"Date: %d-%m-%Y   Time: %H:%M",timeinfo); | ||||||
|  |     string time(buffer); | ||||||
|  |  | ||||||
|  |     mvwaddstr(newWindow,2, 2, time.c_str()); | ||||||
|  |      | ||||||
|  |     keypad(newWindow, TRUE); | ||||||
|  |     return newWindow; | ||||||
|  | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user