on a142f21 help sign in
unity8/tests/mocks/Unity/Application/ApplicationInfo.h
132 lines 4.1 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 "SurfaceManager.h"
21#include "MirSurfaceItemModel.h"
23#include <QObject>
25class QQuickItem;
26class MirSurfaceItem;
28// unity-api
29#include <unity/shell/application/ApplicationInfoInterface.h>
31using namespace unity::shell::application;
33class ApplicationInfo : public ApplicationInfoInterface {
34 Q_OBJECT
36 Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen NOTIFY fullscreenChanged)
37 Q_PROPERTY(Session* session READ session NOTIFY sessionChanged)
39 // Only exists in this fake implementation
41 // whether the test code will explicitly control the creation of the application surface
42 Q_PROPERTY(bool manualSurfaceCreation READ manualSurfaceCreation WRITE setManualSurfaceCreation NOTIFY manualSurfaceCreationChanged)
44public:
45 ApplicationInfo(QObject *parent = nullptr);
46 ApplicationInfo(const QString &appId, QObject *parent = nullptr);
47 ~ApplicationInfo();
49 RequestedState requestedState() const override;
50 void setRequestedState(RequestedState) override;
52 void setIconId(const QString &iconId);
53 void setScreenshotId(const QString &screenshotId);
55 void setAppId(const QString &value) { m_appId = value; }
56 QString appId() const override { return m_appId; }
58 void setName(const QString &value);
59 QString name() const override { return m_name; }
61 QString comment() const override { return QString(); }
63 QUrl icon() const override { return m_icon; }
65 void setStage(Stage value);
66 Stage stage() const override { return m_stage; }
68 Q_INVOKABLE void setState(State value);
69 State state() const override { return m_state; }
71 void setFocused(bool value);
72 bool focused() const override { return m_focused; }
74 QString splashTitle() const override { return QString(); }
75 QUrl splashImage() const override { return QUrl(); }
76 bool splashShowHeader() const override { return false; }
77 QColor splashColor() const override { return QColor(0,0,0,0); }
78 QColor splashColorHeader() const override { return QColor(0,0,0,0); }
79 QColor splashColorFooter() const override { return QColor(0,0,0,0); }
81 QString screenshot() const { return m_screenshotFileName; }
83 void setFullscreen(bool value);
84 bool fullscreen() const { return m_fullscreen; }
86 Qt::ScreenOrientations supportedOrientations() const override;
87 void setSupportedOrientations(Qt::ScreenOrientations orientations);
89 bool rotatesWindowContents() const override;
90 void setRotatesWindowContents(bool value);
92 bool manualSurfaceCreation() const { return m_manualSurfaceCreation; }
93 void setManualSurfaceCreation(bool value);
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();
107private Q_SLOTS:
108 void onSessionSurfaceChanged(MirSurfaceItem*);
110private:
111 void setIcon(const QUrl &value);
113 QString m_screenshotFileName;
115 QString m_appId;
116 QString m_name;
117 QUrl m_icon;
118 Stage m_stage;
119 State m_state;
120 bool m_focused;
121 bool m_fullscreen;
122 Session* m_session;
123 Qt::ScreenOrientations m_supportedOrientations;
124 bool m_rotatesWindowContents;
125 RequestedState m_requestedState;
127 bool m_manualSurfaceCreation;
128};
130Q_DECLARE_METATYPE(ApplicationInfo*)
132#endif // APPLICATION_H