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 LOMIRI_SHELL_APPLICATION_APPLICATIONINFOINTERFACE_H
18 #define LOMIRI_SHELL_APPLICATION_APPLICATIONINFOINTERFACE_H
19 
20 #include <lomiri/SymbolExport.h>
21 
22 #include <QtCore/QObject>
23 #include <QtCore/QUrl>
24 #include <QColor>
25 #include <QSize>
26 
27 namespace lomiri
28 {
29 namespace shell
30 {
31 namespace application
32 {
33 
34 class MirSurfaceListInterface;
35 
43 class LOMIRI_API ApplicationInfoInterface: public QObject
44 {
45  Q_OBJECT
46 
53  Q_PROPERTY(QString appId READ appId CONSTANT)
54 
55 
60  Q_PROPERTY(QString name READ name NOTIFY nameChanged)
61 
68  Q_PROPERTY(QString comment READ comment NOTIFY commentChanged)
69 
75  Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged)
76 
82  Q_PROPERTY(State state READ state NOTIFY stateChanged)
83 
87  Q_PROPERTY(RequestedState requestedState READ requestedState WRITE setRequestedState NOTIFY requestedStateChanged)
88 
94  Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged)
95 
102  Q_PROPERTY(bool showSplash READ showSplash CONSTANT)
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 
205  Q_PROPERTY(bool isTouchApp READ isTouchApp CONSTANT)
206 
212  Q_PROPERTY(bool exemptFromLifecycle READ exemptFromLifecycle WRITE setExemptFromLifecycle NOTIFY exemptFromLifecycleChanged)
213 
217  Q_PROPERTY(QSize initialSurfaceSize READ initialSurfaceSize WRITE setInitialSurfaceSize NOTIFY initialSurfaceSizeChanged)
218 
222  Q_PROPERTY(lomiri::shell::application::MirSurfaceListInterface* surfaceList READ surfaceList CONSTANT)
223 
227  Q_PROPERTY(lomiri::shell::application::MirSurfaceListInterface* promptSurfaceList READ promptSurfaceList CONSTANT)
228 
237  Q_PROPERTY(int surfaceCount READ surfaceCount NOTIFY surfaceCountChanged)
238 
245  Q_PROPERTY(bool serverSideDecoration READ serverSideDecoration NOTIFY serverSideDecorationChanged)
246 
247 protected:
249  ApplicationInfoInterface(const QString &appId, QObject* parent = 0): QObject(parent) { Q_UNUSED(appId) }
251 
252 public:
261  enum Stage {
262  MainStage,
263  SideStage
264  };
265  Q_ENUM(Stage)
266 
267 
279  enum State {
280  Starting,
281  Running,
282  Suspended,
283  Stopped
284  };
285  Q_ENUM(State)
286 
287 
295  RequestedRunning = Running,
296  RequestedSuspended = Suspended
297  };
298  Q_ENUM(RequestedState)
299 
300 
303  virtual void close() = 0;
304 
306  virtual ~ApplicationInfoInterface() {}
307 
308  virtual QString appId() const = 0;
309  virtual QString name() const = 0;
310  virtual QString comment() const = 0;
311  virtual QUrl icon() const = 0;
312  virtual State state() const = 0;
313  virtual RequestedState requestedState() const = 0;
314  virtual void setRequestedState(RequestedState) = 0;
315  virtual bool focused() const = 0;
316  virtual bool showSplash() const = 0;
317  virtual QString splashTitle() const = 0;
318  virtual QUrl splashImage() const = 0;
319  virtual bool splashShowHeader() const = 0;
320  virtual QColor splashColor() const = 0;
321  virtual QColor splashColorHeader() const = 0;
322  virtual QColor splashColorFooter() const = 0;
323  virtual Qt::ScreenOrientations supportedOrientations() const = 0;
324  virtual bool rotatesWindowContents() const = 0;
325  virtual bool isTouchApp() const = 0;
326  virtual bool exemptFromLifecycle() const = 0;
327  virtual void setExemptFromLifecycle(bool) = 0;
328  virtual QSize initialSurfaceSize() const = 0;
329  virtual void setInitialSurfaceSize(const QSize &size) = 0;
330  virtual MirSurfaceListInterface* surfaceList() const = 0;
331  virtual MirSurfaceListInterface* promptSurfaceList() const = 0;
332  virtual int surfaceCount() const = 0;
333  virtual bool serverSideDecoration() const = 0;
335 
336 Q_SIGNALS:
338  void nameChanged(const QString &name);
339  void commentChanged(const QString &comment);
340  void iconChanged(const QUrl &icon);
341  void stateChanged(State state);
342  void requestedStateChanged(RequestedState value);
343  void focusedChanged(bool focused);
344  void exemptFromLifecycleChanged(bool exemptFromLifecycle);
345  void initialSurfaceSizeChanged(const QSize &size);
346  void surfaceCountChanged(int surfaceCount);
347  void serverSideDecorationChanged(bool ssd);
349 
353  void focusRequested();
354 };
355 
356 } // namespace application
357 } // namespace shell
358 } // namespace lomiri
359 
361 
362 #endif // LOMIRI_SHELL_APPLICATIONMANAGER_APPLICATIONINFOINTERFACE_H
lomiri::shell::application::ApplicationInfoInterface::Stage
Stage
A enum that defines a stage.
Definition: ApplicationInfoInterface.h:261
lomiri::shell::application::ApplicationInfoInterface
A class that holds information about applications.
Definition: ApplicationInfoInterface.h:43
lomiri::shell::application::ApplicationInfoInterface::State
State
An application's state.
Definition: ApplicationInfoInterface.h:279
lomiri::shell::application::MirSurfaceListInterface
Interface for a list model of MirSurfaces.
Definition: MirSurfaceListInterface.h:31
lomiri
Top-level namespace for all things Lomiri-related.
Definition: Version.h:37
lomiri::shell::application::ApplicationInfoInterface::RequestedState
RequestedState
The desired state of an application.
Definition: ApplicationInfoInterface.h:294