My Project
ApplicationInfoInterface.h
1 /*
2  * Copyright 2013,2015 Canonical Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef UNITY_SHELL_APPLICATION_APPLICATIONINFOINTERFACE_H
18 #define UNITY_SHELL_APPLICATION_APPLICATIONINFOINTERFACE_H
19 
20 #include <unity/SymbolExport.h>
21 
22 #include <QtCore/QObject>
23 #include <QtCore/QUrl>
24 #include <QColor>
25 
26 namespace unity
27 {
28 namespace shell
29 {
30 namespace application
31 {
32 
40 class UNITY_API ApplicationInfoInterface: public QObject
41 {
42  Q_OBJECT
43 
44  Q_ENUMS(Stage)
45  Q_ENUMS(State)
46  Q_ENUMS(RequestedState)
47 
48 
54  Q_PROPERTY(QString appId READ appId CONSTANT)
55 
61  Q_PROPERTY(QString name READ name NOTIFY nameChanged)
62 
69  Q_PROPERTY(QString comment READ comment NOTIFY commentChanged)
70 
76  Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged)
77 
83  Q_PROPERTY(Stage stage READ stage NOTIFY stageChanged)
84 
90  Q_PROPERTY(State state READ state NOTIFY stateChanged)
91 
95  Q_PROPERTY(RequestedState requestedState READ requestedState WRITE setRequestedState NOTIFY requestedStateChanged)
96 
102  Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged)
103 
113  Q_PROPERTY(QString splashTitle READ splashTitle CONSTANT)
114 
125  Q_PROPERTY(QUrl splashImage READ splashImage CONSTANT)
126 
143  Q_PROPERTY(bool splashShowHeader READ splashShowHeader CONSTANT)
144 
154  Q_PROPERTY(QColor splashColor READ splashColor CONSTANT)
155 
167  Q_PROPERTY(QColor splashColorHeader READ splashColorHeader CONSTANT)
168 
180  Q_PROPERTY(QColor splashColorFooter READ splashColorFooter CONSTANT)
181 
186  Q_PROPERTY(Qt::ScreenOrientations supportedOrientations READ supportedOrientations CONSTANT)
187 
200  Q_PROPERTY(bool rotatesWindowContents READ rotatesWindowContents CONSTANT)
201 
202 protected:
204  ApplicationInfoInterface(const QString &appId, QObject* parent = 0): QObject(parent) { Q_UNUSED(appId) }
206 
207 public:
216  enum Stage {
217  MainStage,
218  SideStage
219  };
220 
233  enum State {
234  Starting,
235  Running,
236  Suspended,
237  Stopped
238  };
239 
248  RequestedRunning = Running,
249  RequestedSuspended = Suspended
250  };
251 
253  virtual ~ApplicationInfoInterface() {}
254 
255  virtual QString appId() const = 0;
256  virtual QString name() const = 0;
257  virtual QString comment() const = 0;
258  virtual QUrl icon() const = 0;
259  virtual Stage stage() const = 0;
260  virtual State state() const = 0;
261  virtual RequestedState requestedState() const = 0;
262  virtual void setRequestedState(RequestedState) = 0;
263  virtual bool focused() const = 0;
264  virtual QString splashTitle() const = 0;
265  virtual QUrl splashImage() const = 0;
266  virtual bool splashShowHeader() const = 0;
267  virtual QColor splashColor() const = 0;
268  virtual QColor splashColorHeader() const = 0;
269  virtual QColor splashColorFooter() const = 0;
270  virtual Qt::ScreenOrientations supportedOrientations() const = 0;
271  virtual bool rotatesWindowContents() const = 0;
273 
274 Q_SIGNALS:
276  void nameChanged(const QString &name);
277  void commentChanged(const QString &comment);
278  void iconChanged(const QUrl &icon);
279  void stageChanged(Stage stage);
280  void stateChanged(State state);
281  void requestedStateChanged(RequestedState value);
282  void focusedChanged(bool focused);
284 };
285 
286 } // namespace application
287 } // namespace shell
288 } // namespace unity
289 
290 #endif // UNITY_SHELL_APPLICATIONMANAGER_APPLICATIONINFOINTERFACE_H
Top-level namespace for all things Unity-related.
Definition: Version.h:37
RequestedState
The desired state of an application.
Definition: ApplicationInfoInterface.h:247
Stage
A enum that defines a stage.
Definition: ApplicationInfoInterface.h:216
State
An application's state.
Definition: ApplicationInfoInterface.h:233
A class that holds information about applications.
Definition: ApplicationInfoInterface.h:40