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
24#include "ApplicationInfo.h"
27#include <unity/shell/application/ApplicationManagerInterface.h>
30using namespace unity::shell::application;
32class ApplicationManager : public ApplicationManagerInterface {
36 Q_ENUMS(FormFactorHint)
37 Q_ENUMS(FavoriteApplication)
40 Q_PROPERTY(bool empty READ isEmpty NOTIFY emptyChanged)
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 ApplicationManager(QObject *parent = NULL);
50 virtual ~ApplicationManager();
52 static ApplicationManager *singleton();
55 RoleSurface = RoleFocused+1,
60 Dash, Default, Indicators, Notifications, Greeter, Launcher, OnScreenKeyboard,
64 MainStage, IntegrationStage, ShareStage, ContentPickingStage,
65 SideStage, ConfigurationStage
68 DesktopFormFactor, PhoneFormFactor, TabletFormFactor
70 enum FavoriteApplication {
71 CameraApplication, GalleryApplication, BrowserApplication, ShareApplication,
72 PhoneApplication, DialerApplication, MessagingApplication, AddressbookApplication
78 Q_DECLARE_FLAGS(ExecFlags, Flag)
80 int sideStageWidth() const;
81 StageHint stageHint() const;
82 FormFactorHint formFactorHint() const;
84 bool fake() { return true; }
86 // QAbstractItemModel methods.
87 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
88 QVariant data(const QModelIndex& index, int role) const override;
89 Q_INVOKABLE ApplicationInfo *get(int index) const override;
90 Q_INVOKABLE ApplicationInfo *findApplication(const QString &appId) const override;
92 Q_INVOKABLE void move(int from, int to);
94 // Application control methods
95 Q_INVOKABLE bool requestFocusApplication(const QString &appId) override;
96 Q_INVOKABLE bool focusApplication(const QString &appId) override;
97 Q_INVOKABLE void unfocusCurrentApplication() override;
98 Q_INVOKABLE ApplicationInfo *startApplication(const QString &appId, const QStringList &arguments = QStringList()) override;
99 Q_INVOKABLE ApplicationInfo *startApplication(const QString &appId, ExecFlags flags, const QStringList &arguments = QStringList());
100 Q_INVOKABLE bool stopApplication(const QString &appId) override;
102 QString focusedApplicationId() const override;
103 bool suspended() const;
104 void setSuspended(bool suspended);
107 Q_INVOKABLE QStringList availableApplications();
108 Q_INVOKABLE ApplicationInfo* add(QString appId);
110 QModelIndex findIndex(ApplicationInfo* application);
112 bool isEmpty() const;
115 void focusRequested(FavoriteApplication favoriteApplication);
116 void focusRequested(const QString &appId);
117 void emptyChanged(bool empty);
120 void onWindowCreatedTimerTimeout();
123 void add(ApplicationInfo *application);
124 void remove(ApplicationInfo* application);
125 void buildListOfAvailableApplications();
126 void onWindowCreated();
128 QList<ApplicationInfo*> m_runningApplications;
129 QList<ApplicationInfo*> m_availableApplications;
130 QTimer m_windowCreatedTimer;
132 static ApplicationManager *the_application_manager;
135Q_DECLARE_OPERATORS_FOR_FLAGS(ApplicationManager::ExecFlags)
137Q_DECLARE_METATYPE(ApplicationManager*)
139#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