changed vector to list; again
This commit is contained in:
18
src/tui.cpp
18
src/tui.cpp
@ -50,7 +50,7 @@ void TUI::initTUI()
|
||||
Logger::logThis()->info("UI successfully initialized");
|
||||
}
|
||||
|
||||
void TUI::updateTUI(vector <Drive>* pvecDrives, uint8_t u8SelectedEntry)
|
||||
void TUI::updateTUI(list <Drive>* plistDrives, uint8_t u8SelectedEntry)
|
||||
{
|
||||
mxUIrefresh.lock();
|
||||
uint16_t u16StdscrX, u16StdscrY;
|
||||
@ -69,8 +69,9 @@ void TUI::updateTUI(vector <Drive>* pvecDrives, uint8_t u8SelectedEntry)
|
||||
|
||||
delwin(detailview);
|
||||
|
||||
vector <Drive>::iterator it;
|
||||
for (it = pvecDrives->begin(); it != pvecDrives->end(); ++it)
|
||||
list <Drive>::iterator it;
|
||||
uint8_t u8Index = 0U;
|
||||
for (it = plistDrives->begin(); it != plistDrives->end(); ++it)
|
||||
{
|
||||
string sModelFamily = it->getModelFamily();
|
||||
string sModelName = it->getModelName();
|
||||
@ -79,10 +80,10 @@ void TUI::updateTUI(vector <Drive>* pvecDrives, uint8_t u8SelectedEntry)
|
||||
|
||||
bool bSelectedEntry = false;
|
||||
|
||||
if(u8SelectedEntry == (it - pvecDrives->begin()))
|
||||
if(u8SelectedEntry == u8Index)
|
||||
{
|
||||
bSelectedEntry = true; //mark this drive in entries list
|
||||
displaySelectedDrive(pvecDrives->at(u8SelectedEntry), u16StdscrX, u16StdscrY);
|
||||
displaySelectedDrive(*it, u16StdscrX, u16StdscrY);
|
||||
|
||||
if((it->getPowerOnHours() >= WORSE_HOURS) || (it->getPowerCycles() >= WORSE_POWERUP) || (it->getErrorCount() > 0))
|
||||
{
|
||||
@ -133,11 +134,12 @@ void TUI::updateTUI(vector <Drive>* pvecDrives, uint8_t u8SelectedEntry)
|
||||
break;
|
||||
}
|
||||
|
||||
WINDOW * tmp = createEntryWindow( ((int)(u16StdscrX/3) - 2), 5, 3, (5* (it - pvecDrives->begin()) )+3, sModelFamily, sModelName, sCapacity, sState, bSelectedEntry);
|
||||
WINDOW * tmp = createEntryWindow( ((int)(u16StdscrX/3) - 2), 5, 3, (5* (u8Index) )+3, sModelFamily, sModelName, sCapacity, sState, bSelectedEntry);
|
||||
wrefresh(tmp);
|
||||
u8Index++;
|
||||
}//end loop though drives
|
||||
|
||||
if(pvecDrives->size() == 0)
|
||||
if(plistDrives->size() == 0)
|
||||
{
|
||||
//no selected drive present
|
||||
Logger::logThis()->warning("no selected drive present");
|
||||
@ -148,7 +150,7 @@ void TUI::updateTUI(vector <Drive>* pvecDrives, uint8_t u8SelectedEntry)
|
||||
menustate.bDelete = false;
|
||||
menustate.bShred = false;
|
||||
|
||||
menuview=createMenuView(((u16StdscrX)-(int)(u16StdscrX/3)-7), 10, (int)(u16StdscrX/3)+5,(u16StdscrY-11), menustate);
|
||||
menuview=createMenuView(((int)(u16StdscrX/3)-10 ), 10, (int)(u16StdscrX/3)+5,(u16StdscrY-11), menustate);
|
||||
wrefresh(menuview);
|
||||
|
||||
detailview=overwriteDetailViewWindow(((u16StdscrX)-(int)(u16StdscrX/3)-7), (u16StdscrY-15), (int)(u16StdscrX/3)+5);
|
||||
|
Reference in New Issue
Block a user