-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapplication.h
133 lines (99 loc) · 3.1 KB
/
application.h
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2013 <copyright holder> <email>
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 2 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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef LXPANEL_APPLICATION_H
#define LXPANEL_APPLICATION_H
#include <QApplication>
#include <QVector>
#include <QTranslator>
#include "appletmanager.h"
#include "desktopsettings.h"
#include <glib.h>
#include <libfm-qt/libfmqt.h>
namespace Lxpanel {
class Panel;
class AppletInfo;
class RunDialog;
class XEventFilter {
public:
virtual bool x11EventFilter(XEvent * event) = 0;
};
class Application : public QApplication {
Q_OBJECT
public:
Application(int& argc, char** argv, int flags = ApplicationFlags);
virtual ~Application();
void init();
// configuration profile
QString profile() {
return profile_;
}
// command used to launch file manager
QString fileManager() {
return fileManager_;
}
// command used to logout desktop session
QString logoutCommand() {
return logoutCommand_;
}
// command used to lauch a terminal emulator
QString terminalCommand() {
return terminalCommand_;
}
const QVector<Panel*>& panels() const {
return panels_;
}
AppletManager& appletManager() {
return appletManager_;
}
void addXEventFilter(XEventFilter* filter) {
xeventFilters_.append(filter);
}
void removeXEventFilter(XEventFilter* filter) {
xeventFilters_.removeOne(filter);
}
void run();
protected:
bool handleCommandLineArgs();
bool loadSettings();
bool saveSettings();
bool loadConfigFile(QString path);
bool loadPanels();
void addPanel(Panel* panel);
void removePanel(Panel* panel);
virtual bool x11EventFilter(XEvent* event);
static gboolean onUnixSignal(Application* pThis);
private Q_SLOTS:
void onScreenResized(int screen);
void onScreenCountChanged(int newCount);
void onRunDialogFinished();
private:
QString profile_;
QString fileManager_; // command used to launch file manager
QString logoutCommand_; // command used to logout desktop session
QString terminalCommand_; // command used to lauch a terminal emulator
QString iconTheme_;
Xdg::DesktopSettings desktopSettings_;
AppletManager appletManager_;
QVector<Panel*> panels_; // all desktop panels
Fm::LibFmQt libfmQt_;
QList<XEventFilter*> xeventFilters_;
bool isPrimaryInstance;
QTranslator translator;
QTranslator qtTranslator;
RunDialog* runDialog_;
};
}
#endif // LXPANEL_APPLICATION_H