parse percentage from shred cmd

This commit is contained in:
2020-08-22 21:48:34 +02:00
parent df4ed53693
commit e4b3923f6d
7 changed files with 94 additions and 106 deletions

View File

@ -9,7 +9,7 @@
static int fdSearchDrives[2];//File descriptor for pipe that informs if new drives are found
static int fdWhipe[2];//File descriptor for pipe that informs if a wipe thread signals
static int fdShred[2];//File descriptor for pipe that informs if a wipe thread signals
static std::mutex mxScannDrives;
@ -48,11 +48,11 @@ void reHDD::app_logic(void)
ui->initTUI();
pipe(fdSearchDrives);
pipe(fdWhipe);
pipe(fdShred);
FD_ZERO(&selectSet);
FD_SET(fdSearchDrives[0], &selectSet);
FD_SET(fdWhipe[0], &selectSet);
FD_SET(fdShred[0], &selectSet);
thread thDevices(ThreadScannDevices); //start thread that scanns for drives
thread thUserInput(ThreadUserInput); //start thread that reads user input
@ -73,11 +73,11 @@ void reHDD::app_logic(void)
ui->updateTUI(&vecDrives, i32SelectedEntry);
}
else if (FD_ISSET(fdWhipe[0], &selectSet))
else if (FD_ISSET(fdShred[0], &selectSet))
{
cout << "Whipe signal" << endl;
//update percantage & state
//update ui
cout << "shred signal" << endl;
//TODO update percantage & state
//TODO update ui
}
} //endless loop
thDevices.join();
@ -377,7 +377,9 @@ void reHDD::handleEnter()
{
SELECTED_DRIVE.state = Drive::TaskState::SHRED_ACTIVE;
//task for drive is running --> don´t show more task options
//TODO start shredding
Shred::shredDrive(&vecDrives.at(i32SelectedEntry));
}
if(SELECTED_DRIVE.state == Drive::TaskState::DELETE_SELECTED)