-
Notifications
You must be signed in to change notification settings - Fork 0
/
settingmenu.cpp
42 lines (38 loc) · 889 Bytes
/
settingmenu.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "settingmenu.h"
static int choice = 0;
SettingMenu::SettingMenu(QWidget *parent) : QMenu(parent)
{
monitor_off = addAction("Monitor Off(Default)");
shutdown = addAction("ShutDown");
}
void SettingMenu::monitorOff()
{
choice = 0;
}
void SettingMenu::shutDown()
{
choice = 1;
}
void SettingMenu::timeOver()
{
switch (choice) {
// monitor off
case 0:
// this command will close your monitor.But it needs xinput.
system("ls");
system("xset dpms force off");
break;
;
case 1:
/*
* This command will close your computer.On Arch linux,
* it works well. But in kali or centOS, it needs root.
* Because those operating systems under Debian need root
* to execute this command.
*/
system("shutdown 0");
break;
default:
break;
}
}