added feature to start shredding for all drives

This commit is contained in:
2022-08-20 16:09:40 +02:00
parent 9863c5591e
commit e3aefb24ee
7 changed files with 55 additions and 21 deletions

View File

@ -97,7 +97,6 @@ void TUI::updateTUI(list <Drive>* plistDrives, uint8_t u8SelectedEntry)
stringstream stream;
switch (it->state)
{
case Drive::SHRED_ACTIVE:
@ -204,6 +203,9 @@ enum TUI::UserInput TUI::readUserInput()
case 's':
return TUI::UserInput::Shred;
break;
case 'S':
return TUI::UserInput::ShredAll;
break;
default:
return TUI::UserInput::Undefined;
break;
@ -386,19 +388,19 @@ WINDOW* TUI::createMenuView(int iXSize, int iYSize, int iXStart, int iYStart, st
if(menustate.bAbort)
{
string sLineTmp = "Press A for Abort";
string sLineTmp = "Press a for Abort";
mvwaddstr(newWindow,u16Line++, (iXSize/2)-(sLineTmp.size()/2), sLineTmp.c_str());
u16Line++;
}
if(menustate.bShred)
{
string sLineTmp = "Press S for Shred ";
string sLineTmp = "Press s for Shred (S for all drives)";
mvwaddstr(newWindow,u16Line++, (iXSize/2)-(sLineTmp.size()/2), sLineTmp.c_str());
u16Line++;
}
if(menustate.bDelete)
{
string sLineTmp = "Press D for Delete";
string sLineTmp = "Press d for Delete";
mvwaddstr(newWindow,u16Line++, (iXSize/2)-(sLineTmp.size()/2), sLineTmp.c_str());
}
@ -508,7 +510,8 @@ string TUI::formatTimeDuration(time_t u32Duration)
return out.str();
}
string TUI::formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes){
string TUI::formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes)
{
std::ostringstream out;
double dDeltaSec = ((double)((u32ShredTimeDelta)/1000000000.0)); //convert nano in sec
double speed = ((ulWrittenBytes/1000000.0)/dDeltaSec);