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 
34 class MirSurfaceListInterface;
35 
43 class UNITY_API ApplicationInfoInterface: public QObject
44 {
45  Q_OBJECT
46 
47  Q_ENUMS(Stage)
48  Q_ENUMS(State)
49  Q_ENUMS(RequestedState)
50 
51 
57  Q_PROPERTY(QString appId READ appId CONSTANT)
58 
64  Q_PROPERTY(QString name READ name NOTIFY nameChanged)
65 
72  Q_PROPERTY(QString comment READ comment NOTIFY commentChanged)
73 
79  Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged)
80 
86  Q_PROPERTY(State state READ state NOTIFY stateChanged)
87 
91  Q_PROPERTY(RequestedState requestedState READ requestedState WRITE setRequestedState NOTIFY requestedStateChanged)
92 
98  Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged)
99 
109  Q_PROPERTY(QString splashTitle READ splashTitle CONSTANT)
110 
121  Q_PROPERTY(QUrl splashImage READ splashImage CONSTANT)
122 
139  Q_PROPERTY(bool splashShowHeader READ splashShowHeader CONSTANT)
140 
150  Q_PROPERTY(QColor splashColor READ splashColor CONSTANT)
151 
163  Q_PROPERTY(QColor splashColorHeader READ splashColorHeader CONSTANT)
164 
176  Q_PROPERTY(QColor splashColorFooter READ splashColorFooter CONSTANT)
177 
182  Q_PROPERTY(Qt::ScreenOrientations supportedOrientations READ supportedOrientations CONSTANT)
183 
196  Q_PROPERTY(bool rotatesWindowContents READ rotatesWindowContents CONSTANT)
197 
201  Q_PROPERTY(bool isTouchApp READ isTouchApp CONSTANT)
202 
208  Q_PROPERTY(bool exemptFromLifecycle READ exemptFromLifecycle WRITE setExemptFromLifecycle NOTIFY exemptFromLifecycleChanged)
209 
213  Q_PROPERTY(QSize initialSurfaceSize READ initialSurfaceSize WRITE setInitialSurfaceSize NOTIFY initialSurfaceSizeChanged)
214 
218  Q_PROPERTY(unity::shell::application::MirSurfaceListInterface* surfaceList READ surfaceList CONSTANT)
219 
223  Q_PROPERTY(unity::shell::application::MirSurfaceListInterface* promptSurfaceList READ promptSurfaceList CONSTANT)
224 
233  Q_PROPERTY(int surfaceCount READ surfaceCount NOTIFY surfaceCountChanged)
234 
235 protected:
237  ApplicationInfoInterface(const QString &appId, QObject* parent = 0): QObject(parent) { Q_UNUSED(appId) }
239 
240 public:
249  enum Stage {
250  MainStage,
251  SideStage
252  };
253 
266  enum State {
267  Starting,
268  Running,
269  Suspended,
270  Stopped
271  };
272 
281  RequestedRunning = Running,
282  RequestedSuspended = Suspended
283  };
284 
288  virtual void close() = 0;
289 
291  virtual ~ApplicationInfoInterface() {}
292 
293  virtual QString appId() const = 0;
294  virtual QString name() const = 0;
295  virtual QString comment() const = 0;
296  virtual QUrl icon() const = 0;
297  virtual State state() const = 0;
298  virtual RequestedState requestedState() const = 0;
299  virtual void setRequestedState(RequestedState) = 0;
300  virtual bool focused() const = 0;
301  virtual QString splashTitle() const = 0;
302  virtual QUrl splashImage() const = 0;
303  virtual bool splashShowHeader() const = 0;
304  virtual QColor splashColor() const = 0;
305  virtual QColor splashColorHeader() const = 0;
306  virtual QColor splashColorFooter() const = 0;
307  virtual Qt::ScreenOrientations supportedOrientations() const = 0;
308  virtual bool rotatesWindowContents() const = 0;
309  virtual bool isTouchApp() const = 0;
310  virtual bool exemptFromLifecycle() const = 0;
311  virtual void setExemptFromLifecycle(bool) = 0;
312  virtual QSize initialSurfaceSize() const = 0;
313  virtual void setInitialSurfaceSize(const QSize &size) = 0;
314  virtual MirSurfaceListInterface* surfaceList() const = 0;
315  virtual MirSurfaceListInterface* promptSurfaceList() const = 0;
316  virtual int surfaceCount() const = 0;
318 
319 Q_SIGNALS:
321  void nameChanged(const QString &name);
322  void commentChanged(const QString &comment);
323  void iconChanged(const QUrl &icon);
324  void stateChanged(State state);
325  void requestedStateChanged(RequestedState value);
326  void focusedChanged(bool focused);
327  void exemptFromLifecycleChanged(bool exemptFromLifecycle);
328  void initialSurfaceSizeChanged(const QSize &size);
329  void surfaceCountChanged(int surfaceCount);
331 
335  void focusRequested();
336 };
337 
338 } // namespace application
339 } // namespace shell
340 } // namespace unity
341 
343 
344 #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:280
Interface for a list model of MirSurfaces.
Definition: MirSurfaceListInterface.h:31
Stage
A enum that defines a stage.
Definition: ApplicationInfoInterface.h:249
State
An application&#39;s state.
Definition: ApplicationInfoInterface.h:266
A class that holds information about applications.
Definition: ApplicationInfoInterface.h:43