forked from localhorst/reHDD
added user input via keys
This commit is contained in:
@ -54,6 +54,7 @@ void reHDD::app_logic(void)
|
||||
FD_SET(fdWhipe[0], &selectSet);
|
||||
|
||||
thread thDevices(ThreadScannDevices); //start thread that scanns for drives
|
||||
thread thUserInput(ThreadUserInput); //start thread that reads user input
|
||||
|
||||
while(1) {
|
||||
|
||||
@ -76,6 +77,7 @@ void reHDD::app_logic(void)
|
||||
}
|
||||
} //endless loop
|
||||
thDevices.join();
|
||||
thUserInput.join();
|
||||
}
|
||||
|
||||
void reHDD::ThreadScannDevices() {
|
||||
@ -92,6 +94,42 @@ void reHDD::ThreadScannDevices() {
|
||||
}
|
||||
}
|
||||
|
||||
void reHDD::ThreadUserInput() {
|
||||
while(true) {
|
||||
|
||||
// cout << TUI::readUserInput() << endl;
|
||||
switch (TUI::readUserInput())
|
||||
{
|
||||
case TUI::UserInput::DownKey:
|
||||
/* code */
|
||||
//cout << "Down" << endl;
|
||||
break;
|
||||
case TUI::UserInput::UpKey:
|
||||
//cout << "Up" << endl;
|
||||
break;
|
||||
case TUI::UserInput::Undefined:
|
||||
//cout << "Undefined" << endl;
|
||||
break;
|
||||
case TUI::UserInput::Abort:
|
||||
//cout << "Abort" << endl;
|
||||
break;
|
||||
case TUI::UserInput::Delete:
|
||||
//cout << "Delete" << endl;
|
||||
break;
|
||||
case TUI::UserInput::Shred:
|
||||
//cout << "Shred" << endl;
|
||||
break;
|
||||
case TUI::UserInput::Enter:
|
||||
//cout << "Enter" << endl;
|
||||
break;
|
||||
case TUI::UserInput::ESC:
|
||||
//cout << "ESC" << endl;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void reHDD::filterNewDrives(vector <Drive>* pvecOldDrives, vector <Drive>* pvecNewDrives) {
|
||||
|
||||
@ -116,11 +154,9 @@ void reHDD::filterNewDrives(vector <Drive>* pvecOldDrives, vector <Drive>* pvecN
|
||||
}
|
||||
|
||||
pvecOldDrives->clear();
|
||||
|
||||
for (long unsigned int i=0; i<pvecNewDrives->size(); i++) {
|
||||
pvecOldDrives->push_back((*pvecNewDrives)[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user