File: gui.h

package info (click to toggle)
shutdown-qapps 1.7.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 1,640 kB
  • sloc: cpp: 3,967; makefile: 10; sh: 1
file content (116 lines) | stat: -rw-r--r-- 3,600 bytes parent folder | download
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* qshutdown, a program to shutdown/reboot/suspend/hibernate the system
 * Copyright (C) 2010-2019 Christian Metscher <hakaishi@web.de>

 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef GUI_H
#define GUI_H

#include "ui_gui.h"
#include <QtGlobal>
#include <QSystemTrayIcon>
#include <QDesktopWidget>
#include <QTextDocumentFragment>
#include <QDesktopServices>

#ifndef Q_OS_WIN32
  #include <QtDBus>
#endif

#define SERVICE_NAME  "org.qshutdown"
#define OBJECT_NAME "/org/qshutdown"

class Preferences;
class Info;
class Calendar;
class PassWord;
class Editor;
class About;

class Gui : public QMainWindow, public Ui::Gui {
     Q_OBJECT // important for creating own singals and slots
 
    public:
     Gui();
     ~Gui();
     void loadSettings();
     void center();
     QString information;
 
    private:
     bool            timeRunning;
     bool            aWeeklyTimeWasSet;
     QPushButton     *minim;
     QTimer          *timer, *ti;
     QDateTime       localDatetime, futureDateTime;
     QTime           elapsedTime, oldTime;
     QIcon           icon;
     QSystemTrayIcon *TIcon;
     QMenu           *menu;
     QActionGroup    *power_actions;
     QAction         *shutdown_action, *reboot_action,
                     *suspend_action, *hibernate_action;
     QAction         *minimize_restore_action, *quit_action,
                     *reset_action, *info_action, *log_action, *pref_action;
     int             i; //number of seconds left
     int             oldComboBoxIndex;
     double          bigI; //for more precise display
     const static int n = 10; //to check if i==0 was skipped
     QFont           *font1, *font2, *font3;
     double          logFileSize;
     Preferences     *pref;
     Info            *infoBox;
     Calendar        *cal;
     PassWord        *checkPassword;
     Editor          *editor;
     About           *about;
     //QLabel          *parentalLockL, *customL;

     // defining signals and slots
 
    private slots:
     void tray_actions();
     void warnings_on();
     void iconActivated(QSystemTrayIcon::ActivationReason reason);
     void showW();
     void updateT();
     bool Time();
     void power_action(int action);
     void power(QAction *action);
     void reset();
     void finished_();
     void beforeQuit();
     void setInfoText();
     void getFonts();
     void showCalendarBox();
     void saveOldTime(QTime time);
     void saveOldComboBoxIndex(int i);
     void setDate();
     void lockEverything(bool actual);
     void updateLock();
     void showEditor();
     void staticProportions(bool var);
     void saveLog();
     void hideTrayIcon(bool dontShowTray);
    public slots:
     Q_SCRIPTABLE void showRunningProgram();
     Q_SCRIPTABLE void set();
    protected:
     void keyPressEvent(QKeyEvent* kEvent);
     virtual void closeEvent(QCloseEvent* window_close);
     virtual void showEvent(QShowEvent* window_show);
     virtual void hideEvent(QHideEvent* window_hide);
};

#endif //GUI_H