2 * Copyright (C) 2013-2014 Canonical, Ltd.
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.
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.
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/>.
21#include <QQmlComponent>
27#include <unity/shell/application/ApplicationInfoInterface.h>
29// A pretty dumb file. Just a container for properties.
30// Implemented in C++ instead of QML just because of the enumerations
33using namespace unity::shell::application;
35class ApplicationInfo : public ApplicationInfoInterface {
38 Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen NOTIFY fullscreenChanged)
39 Q_PROPERTY(Stage stage READ stage WRITE setStage NOTIFY stageChanged)
40 Q_PROPERTY(MirSurfaceItem* surface READ surface NOTIFY surfaceChanged)
41 Q_PROPERTY(QQmlListProperty<MirSurfaceItem> promptSurfaces READ promptSurfaces NOTIFY promptSurfacesChanged DESIGNABLE false)
43 // Only exists in this fake implementation
45 // QML component used to represent its image/screenhot
46 Q_PROPERTY(QString imageQml READ imageQml WRITE setImageQml NOTIFY imageQmlChanged)
48 // QML component used to represent the application window
49 Q_PROPERTY(QString windowQml READ windowQml WRITE setWindowQml NOTIFY windowQmlChanged)
52 ApplicationInfo(QObject *parent = NULL);
53 ApplicationInfo(const QString &appId, QObject *parent = NULL);
56 #define IMPLEMENT_PROPERTY(name, Name, type) \
58 type name() const { return m_##name; } \
59 void set##Name(const type& value) \
61 if (m_##name != value) { \
63 Q_EMIT name##Changed(value); \
67 void name##Changed(const type&); \
71 IMPLEMENT_PROPERTY(appId, AppId, QString)
72 IMPLEMENT_PROPERTY(name, Name, QString)
73 IMPLEMENT_PROPERTY(comment, Comment, QString)
74 IMPLEMENT_PROPERTY(icon, Icon, QUrl)
75 IMPLEMENT_PROPERTY(stage, Stage, Stage)
76 IMPLEMENT_PROPERTY(state, State, State)
77 IMPLEMENT_PROPERTY(focused, Focused, bool)
78 IMPLEMENT_PROPERTY(fullscreen, Fullscreen, bool)
79 IMPLEMENT_PROPERTY(imageQml, ImageQml, QString)
80 IMPLEMENT_PROPERTY(windowQml, WindowQml, QString)
81 IMPLEMENT_PROPERTY(screenshot, Screenshot, QUrl)
83 #undef IMPLEMENT_PROPERTY
86 void setSurface(MirSurfaceItem* surface);
87 MirSurfaceItem* surface() const { return m_surface; }
89 void removeSurface(MirSurfaceItem* surface);
91 void addPromptSurface(MirSurfaceItem* surface);
92 QList<MirSurfaceItem*> promptSurfaceList() const;
93 QQmlListProperty<MirSurfaceItem> promptSurfaces();
96 void surfaceChanged(MirSurfaceItem*);
97 void promptSurfacesChanged();
100 void onStateChanged(State state);
102 void createSurface();
105 static int promptSurfaceCount(QQmlListProperty<MirSurfaceItem> *prop);
106 static MirSurfaceItem* promptSurfaceAt(QQmlListProperty<MirSurfaceItem> *prop, int index);
108 QQuickItem *m_parentItem;
109 MirSurfaceItem* m_surface;
110 QList<MirSurfaceItem*> m_promptSurfaces;
113Q_DECLARE_METATYPE(ApplicationInfo*)
114Q_DECLARE_METATYPE(QQmlListProperty<MirSurfaceItem>)
116#endif // APPLICATION_H
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list