My Project
ApplicationInfoInterface.h
1 /*
2  * Copyright 2013,2015,2016 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 #include <QSize>
26 
27 namespace unity
28 {
29 namespace shell
30 {
31 namespace application
32 {
33 
41 class UNITY_API ApplicationInfoInterface: public QObject
42 {
43  Q_OBJECT
44 
45  Q_ENUMS(Stage)
46  Q_ENUMS(State)
47  Q_ENUMS(RequestedState)
48 
49 
55  Q_PROPERTY(QString appId READ appId CONSTANT)
56 
62  Q_PROPERTY(QString name READ name NOTIFY nameChanged)
63 
70  Q_PROPERTY(QString comment READ comment NOTIFY commentChanged)
71 
77  Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged)
78 
84  Q_PROPERTY(Stage stage READ stage WRITE setStage NOTIFY stageChanged)
85 
91  Q_PROPERTY(State state READ state NOTIFY stateChanged)
92 
96  Q_PROPERTY(RequestedState requestedState READ requestedState WRITE setRequestedState NOTIFY requestedStateChanged)
97 
103  Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged)
104 
114  Q_PROPERTY(QString splashTitle READ splashTitle CONSTANT)
115 
126  Q_PROPERTY(QUrl splashImage READ splashImage CONSTANT)
127 
144  Q_PROPERTY(bool splashShowHeader READ splashShowHeader CONSTANT)
145 
155  Q_PROPERTY(QColor splashColor READ splashColor CONSTANT)
156 
168  Q_PROPERTY(QColor splashColorHeader READ splashColorHeader CONSTANT)
169 
181  Q_PROPERTY(QColor splashColorFooter READ splashColorFooter CONSTANT)
182 
187  Q_PROPERTY(Qt::ScreenOrientations supportedOrientations READ supportedOrientations CONSTANT)
188 
201  Q_PROPERTY(bool rotatesWindowContents READ rotatesWindowContents CONSTANT)
202 
206  Q_PROPERTY(bool isTouchApp READ isTouchApp CONSTANT)
207 
213  Q_PROPERTY(bool exemptFromLifecycle READ exemptFromLifecycle WRITE setExemptFromLifecycle NOTIFY exemptFromLifecycleChanged)
214 
218  Q_PROPERTY(QSize initialSurfaceSize READ initialSurfaceSize WRITE setInitialSurfaceSize NOTIFY initialSurfaceSizeChanged)
219 
220 protected:
222  ApplicationInfoInterface(const QString &appId, QObject* parent = 0): QObject(parent) { Q_UNUSED(appId) }
224 
225 public:
234  enum Stage {
235  MainStage,
236  SideStage
237  };
238 
251  enum State {
252  Starting,
253  Running,
254  Suspended,
255  Stopped
256  };
257 
266  RequestedRunning = Running,
267  RequestedSuspended = Suspended
268  };
269 
271  virtual ~ApplicationInfoInterface() {}
272 
273  virtual QString appId() const = 0;
274  virtual QString name() const = 0;
275  virtual QString comment() const = 0;
276  virtual QUrl icon() const = 0;
277  virtual Stage stage() const = 0;
278  virtual void setStage(Stage) = 0;
279  virtual State state() const = 0;
280  virtual RequestedState requestedState() const = 0;
281  virtual void setRequestedState(RequestedState) = 0;
282  virtual bool focused() const = 0;
283  virtual QString splashTitle() const = 0;
284  virtual QUrl splashImage() const = 0;
285  virtual bool splashShowHeader() const = 0;
286  virtual QColor splashColor() const = 0;
287  virtual QColor splashColorHeader() const = 0;
288  virtual QColor splashColorFooter() const = 0;
289  virtual Qt::ScreenOrientations supportedOrientations() const = 0;
290  virtual bool rotatesWindowContents() const = 0;
291  virtual bool isTouchApp() const = 0;
292  virtual bool exemptFromLifecycle() const = 0;
293  virtual void setExemptFromLifecycle(bool) = 0;
294  virtual QSize initialSurfaceSize() const = 0;
295  virtual void setInitialSurfaceSize(const QSize &size) = 0;
297 
298 Q_SIGNALS:
300  void nameChanged(const QString &name);
301  void commentChanged(const QString &comment);
302  void iconChanged(const QUrl &icon);
303  void stageChanged(Stage stage);
304  void stateChanged(State state);
305  void requestedStateChanged(RequestedState value);
306  void focusedChanged(bool focused);
307  void exemptFromLifecycleChanged(bool exemptFromLifecycle);
308  void initialSurfaceSizeChanged(const QSize &size);
310 };
311 
312 } // namespace application
313 } // namespace shell
314 } // namespace unity
315 
316 #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:265
Stage
A enum that defines a stage.
Definition: ApplicationInfoInterface.h:234
State
An application&#39;s state.
Definition: ApplicationInfoInterface.h:251
A class that holds information about applications.
Definition: ApplicationInfoInterface.h:41