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/>.
17#ifndef APPLICATION_MANAGER_H
18#define APPLICATION_MANAGER_H
23#include "ApplicationInfo.h"
26#include <unity/shell/application/ApplicationManagerInterface.h>
29using namespace unity::shell::application;
31class ApplicationManager : public ApplicationManagerInterface {
35 Q_ENUMS(FormFactorHint)
36 Q_ENUMS(FavoriteApplication)
39 Q_PROPERTY(int keyboardHeight READ keyboardHeight NOTIFY keyboardHeightChanged)
40 Q_PROPERTY(bool keyboardVisible READ keyboardVisible NOTIFY keyboardVisibleChanged)
42 Q_PROPERTY(int sideStageWidth READ sideStageWidth)
43 Q_PROPERTY(StageHint stageHint READ stageHint)
44 Q_PROPERTY(FormFactorHint formFactorHint READ formFactorHint)
46 Q_PROPERTY(bool fake READ fake CONSTANT)
49 // This can be used to place some controls to right, like make tryPhoneStage for example
50 Q_PROPERTY(int rightMargin READ rightMargin WRITE setRightMargin)
53 ApplicationManager(QObject *parent = NULL);
54 virtual ~ApplicationManager();
57 RoleSurface = RoleScreenshot+1,
61 Dash, Default, Indicators, Notifications, Greeter, Launcher, OnScreenKeyboard,
65 MainStage, IntegrationStage, ShareStage, ContentPickingStage,
66 SideStage, ConfigurationStage
69 DesktopFormFactor, PhoneFormFactor, TabletFormFactor
71 enum FavoriteApplication {
72 CameraApplication, GalleryApplication, BrowserApplication, ShareApplication,
73 PhoneApplication, DialerApplication, MessagingApplication, AddressbookApplication
79 Q_DECLARE_FLAGS(ExecFlags, Flag)
81 int keyboardHeight() const;
82 bool keyboardVisible() const;
83 int sideStageWidth() const;
84 StageHint stageHint() const;
85 FormFactorHint formFactorHint() const;
87 bool fake() { return true; }
89 // QAbstractItemModel methods.
90 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
91 QVariant data(const QModelIndex& index, int role) const override;
92 Q_INVOKABLE ApplicationInfo *get(int index) const override;
93 Q_INVOKABLE ApplicationInfo *findApplication(const QString &appId) const override;
95 Q_INVOKABLE void move(int from, int to);
97 // Application control methods
98 Q_INVOKABLE bool requestFocusApplication(const QString &appId) override;
99 Q_INVOKABLE bool focusApplication(const QString &appId) override;
100 Q_INVOKABLE void unfocusCurrentApplication() override;
101 Q_INVOKABLE ApplicationInfo *startApplication(const QString &appId, const QStringList &arguments = QStringList()) override;
102 Q_INVOKABLE ApplicationInfo *startApplication(const QString &appId, ExecFlags flags, const QStringList &arguments = QStringList());
103 Q_INVOKABLE bool stopApplication(const QString &appId) override;
104 Q_INVOKABLE bool updateScreenshot(const QString &appId) override;
106 QString focusedApplicationId() const override;
107 bool suspended() const;
108 void setSuspended(bool suspended);
111 Q_INVOKABLE QStringList availableApplications();
112 int rightMargin() const;
113 void setRightMargin(int rightMargin);
115 QModelIndex findIndex(ApplicationInfo* application);
118 void keyboardHeightChanged();
119 void keyboardVisibleChanged();
120 void focusRequested(FavoriteApplication favoriteApplication);
121 void focusRequested(const QString &appId);
124 void add(ApplicationInfo *application);
125 void remove(ApplicationInfo* application);
126 void showApplicationWindow(ApplicationInfo *application);
127 void buildListOfAvailableApplications();
128 void generateQmlStrings(ApplicationInfo *application);
129 void createMainStageComponent();
130 void createMainStage();
131 void createSideStageComponent();
132 void createSideStage();
133 int m_keyboardHeight;
134 bool m_keyboardVisible;
136 QList<ApplicationInfo*> m_runningApplications;
137 QList<ApplicationInfo*> m_availableApplications;
138 QQmlComponent *m_mainStageComponent;
139 QQuickItem *m_mainStage;
140 QQmlComponent *m_sideStageComponent;
141 QQuickItem *m_sideStage;
146Q_DECLARE_OPERATORS_FOR_FLAGS(ApplicationManager::ExecFlags)
148Q_DECLARE_METATYPE(ApplicationManager*)
150#endif // APPLICATION_MANAGER_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