on 5aa86fa help sign in
unity8/tests/mocks/Unity/Application/ApplicationInfo.h
134 lines 4.2 kB history raw
1/*
2 * Copyright (C) 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 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 General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17#ifndef APPLICATION_H
18#define APPLICATION_H
20#include <QObject>
22class MirSurface;
23class Session;
25// unity-api
26#include <unity/shell/application/ApplicationInfoInterface.h>
28using namespace unity::shell::application;
30class ApplicationInfo : public ApplicationInfoInterface {
31 Q_OBJECT
33 Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen NOTIFY fullscreenChanged)
34 Q_PROPERTY(Session* session READ session NOTIFY sessionChanged)
36 // Only exists in this fake implementation
38 // whether the test code will explicitly control the creation of the application surface
39 Q_PROPERTY(bool manualSurfaceCreation READ manualSurfaceCreation WRITE setManualSurfaceCreation NOTIFY manualSurfaceCreationChanged)
41public:
42 ApplicationInfo(QObject *parent = nullptr);
43 ApplicationInfo(const QString &appId, QObject *parent = nullptr);
44 ~ApplicationInfo();
46 RequestedState requestedState() const override;
47 void setRequestedState(RequestedState) override;
49 void setIconId(const QString &iconId);
50 void setScreenshotId(const QString &screenshotId);
52 void setAppId(const QString &value) { m_appId = value; }
53 QString appId() const override { return m_appId; }
55 void setName(const QString &value);
56 QString name() const override { return m_name; }
58 QString comment() const override { return QString(); }
60 QUrl icon() const override { return m_icon; }
62 void setStage(Stage value);
63 Stage stage() const override { return m_stage; }
65 Q_INVOKABLE void setState(State value);
66 State state() const override { return m_state; }
68 void setFocused(bool value);
69 bool focused() const override { return m_focused; }
71 QString splashTitle() const override { return QString(); }
72 QUrl splashImage() const override { return QUrl(); }
73 bool splashShowHeader() const override { return false; }
74 QColor splashColor() const override { return QColor(0,0,0,0); }
75 QColor splashColorHeader() const override { return QColor(0,0,0,0); }
76 QColor splashColorFooter() const override { return QColor(0,0,0,0); }
78 QString screenshot() const { return m_screenshotFileName; }
80 void setFullscreen(bool value);
81 bool fullscreen() const { return m_fullscreen; }
83 Qt::ScreenOrientations supportedOrientations() const override;
84 void setSupportedOrientations(Qt::ScreenOrientations orientations);
86 bool rotatesWindowContents() const override;
87 void setRotatesWindowContents(bool value);
89 bool manualSurfaceCreation() const { return m_manualSurfaceCreation; }
90 void setManualSurfaceCreation(bool value);
92 bool isTouchApp() const override;
93 void setIsTouchApp(bool isTouchApp); // only in mock
95public:
96 void setSession(Session* session);
97 Session* session() const { return m_session; }
99Q_SIGNALS:
100 void sessionChanged(Session*);
101 void fullscreenChanged(bool value);
102 void manualSurfaceCreationChanged(bool value);
104public Q_SLOTS:
105 Q_INVOKABLE void createSession();
106 Q_INVOKABLE void destroySession();
108private Q_SLOTS:
109 void onSessionSurfaceChanged(MirSurface*);
111private:
112 void setIcon(const QUrl &value);
114 QString m_screenshotFileName;
116 QString m_appId;
117 QString m_name;
118 QUrl m_icon;
119 Stage m_stage;
120 State m_state;
121 bool m_focused;
122 bool m_fullscreen;
123 Session* m_session;
124 Qt::ScreenOrientations m_supportedOrientations;
125 bool m_rotatesWindowContents;
126 RequestedState m_requestedState;
127 bool m_isTouchApp;
129 bool m_manualSurfaceCreation;
130};
132Q_DECLARE_METATYPE(ApplicationInfo*)
134#endif // APPLICATION_H