forked from localhorst/reHDD
Restore terminal state on termination
This commit is contained in:
@ -51,6 +51,8 @@ public:
|
|||||||
|
|
||||||
static enum UserInput readUserInput();
|
static enum UserInput readUserInput();
|
||||||
|
|
||||||
|
static void terminateTUI();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static string sCpuUsage;
|
static string sCpuUsage;
|
||||||
static string sRamUsage;
|
static string sRamUsage;
|
||||||
|
@ -198,9 +198,10 @@ void reHDD::ThreadUserInput()
|
|||||||
ui->updateTUI(&listDrives, u8SelectedEntry);
|
ui->updateTUI(&listDrives, u8SelectedEntry);
|
||||||
break;
|
break;
|
||||||
case TUI::UserInput::Terminate:
|
case TUI::UserInput::Terminate:
|
||||||
cout << "Terminate" << endl;
|
// cout << "Terminate" << endl;
|
||||||
stopShredAllDrives(&listDrives);
|
stopShredAllDrives(&listDrives);
|
||||||
sleep(5); // sleep 5 sec
|
sleep(5); // sleep 5 sec
|
||||||
|
ui->terminateTUI();
|
||||||
std::exit(1); // Terminates main, doesn't wait for threads
|
std::exit(1); // Terminates main, doesn't wait for threads
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -250,6 +250,11 @@ enum TUI::UserInput TUI::readUserInput()
|
|||||||
return TUI::UserInput::Undefined;
|
return TUI::UserInput::Undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TUI::terminateTUI()
|
||||||
|
{
|
||||||
|
endwin();
|
||||||
|
}
|
||||||
|
|
||||||
void TUI::centerTitle(WINDOW *pwin, const char *title)
|
void TUI::centerTitle(WINDOW *pwin, const char *title)
|
||||||
{
|
{
|
||||||
int x, maxX, stringSize;
|
int x, maxX, stringSize;
|
||||||
|
Reference in New Issue
Block a user