Merge lp:~dandrader/unity-api/app-state-handling into lp:unity-api

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Gerry Boland
Approved revision: no longer in the source branch.
Merged at revision: 179
Proposed branch: lp:~dandrader/unity-api/app-state-handling
Merge into: lp:unity-api
Diff against target: 311 lines (+48/-71)
9 files modified
debian/changelog (+10/-2)
include/unity/shell/application/ApplicationInfoInterface.h (+21/-4)
include/unity/shell/application/ApplicationManagerInterface.h (+0/-29)
include/unity/shell/application/CMakeLists.txt (+1/-1)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp (+9/-0)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h (+3/-4)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp (+1/-21)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h (+1/-7)
test/qmltest/unity/shell/application/tst_Application.qml (+2/-3)
To merge this branch: bzr merge lp:~dandrader/unity-api/app-state-handling
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+258643@code.launchpad.net

Commit message

Let users of the API suspend & resume individual apps at will

API Changes:
- Removed ApplicationManagerInterface.forceDashActive
- Removed ApplicationManagerInterface.suspended
- Added ApplicationInfoInterface.requestedState

Description of the change

Needed for having unity8 handling the application lifecycle (suspending&resuming apps) explicitly instead of having it tied to application focus.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

+ Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
FYI: on Thursday at UOS, we had a session on desktop app lifecycle stuff. There we decided that there will be more states than running/suspended. For the desktop we will want a "throttled" state, i.e. application has throttled CPU usage.

It will be up to unity8 to have that policy, so qtmir needs to export that capability.

In that case, we would prefer a property supporting an enum: Running/Suspended/Throttled

Could you change this property to have Running/Suspended states, with a view to supporting more in future?

review: Needs Fixing
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> + Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
> FYI: on Thursday at UOS, we had a session on desktop app lifecycle stuff.
> There we decided that there will be more states than running/suspended. For
> the desktop we will want a "throttled" state, i.e. application has throttled
> CPU usage.
>
> It will be up to unity8 to have that policy, so qtmir needs to export that
> capability.
>
> In that case, we would prefer a property supporting an enum:
> Running/Suspended/Throttled
>
> Could you change this property to have Running/Suspended states, with a view
> to supporting more in future?

Done.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

+ * @brief The aplication's requested state
typo. Also "state" is vague in this context, would elaborate slightly to "application's requested running state"

+ virtual void setRequestedState(RequestedState) = 0;
+ void requestedStateChanged(RequestedState value);
"const RequestedState" would do no harm, and would help compiler slightly

Looks good otherwise. Thanks for the API change

review: Needs Fixing
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

On 11/05/15 08:07, Gerry Boland wrote:
> Review: Needs Fixing
>
> + * @brief The aplication's requested state
> typo. Also "state" is vague in this context, would elaborate slightly to "application's requested running state"

Done.

>
> + virtual void setRequestedState(RequestedState) = 0;
> + void requestedStateChanged(RequestedState value);
> "const RequestedState" would do no harm, and would help compiler slightly

I does do some harm by making the signature longer, and the benefit of
having a "const int" parameter (as merely a hint to the reader) is
arguable in my opinion. Would like a third vote on this.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> > + virtual void setRequestedState(RequestedState) = 0;
> > + void requestedStateChanged(RequestedState value);
> > "const RequestedState" would do no harm, and would help compiler slightly
>
> I does do some harm by making the signature longer, and the benefit of
> having a "const int" parameter (as merely a hint to the reader) is
> arguable in my opinion. Would like a third vote on this.

As Gerry said earlier, we are in Bikeshed land here, but as you asked for a third opinion, I'm -1 for const int and agree with Daniel here.

Revision history for this message
Gerry Boland (gerboland) wrote :

LGTM

review: Approve
173. By Daniel d'Andrada

Add supportedOrientations and rotatesWindowContents to ApplicationInfo
Approved by: PS Jenkins bot, Gerry Boland

174. By CI Train Bot Account

Releasing 7.97+15.10.20150611-0ubuntu1

175. By Daniel d'Andrada

Changes to application lifecycle APIs

* Removed ApplicationManagerInterface.forceDashActive
* Removed ApplicationManagerInterface.suspended
* Added ApplicationInfoInterface.requestedState

Revision history for this message
Gerry Boland (gerboland) wrote :

ACK

review: Approve
176. By Daniel d'Andrada

Merge trunk

[ Mirco Müller (MacSlow) ]
* added alerting/setAlerting API to LauncherModel and LauncherItem interfaces
[ Michi Henning ]
* Remove dependency on gcc 4.9. (LP: #1452342)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2015-07-24 09:53:02 +0000
+++ debian/changelog 2015-08-03 14:07:35 +0000
@@ -1,3 +1,11 @@
1unity-api (7.99) UNRELEASED; urgency=medium
2
3 * Remove ApplicationManagerInterface.forceDashActive
4 * Remove ApplicationManagerInterface.suspended
5 * Add ApplicationInfoInterface.requestedState
6
7 -- Daniel d'Andrada <daniel.dandrada@canonical.com> Mon, 15 Jun 2015 13:53:07 -0300
8
1unity-api (7.98+15.10.20150724-0ubuntu1) wily; urgency=medium9unity-api (7.98+15.10.20150724-0ubuntu1) wily; urgency=medium
210
3 [ Mirco Müller (MacSlow) ]11 [ Mirco Müller (MacSlow) ]
@@ -123,7 +131,7 @@
123131
124 [ Michal Hruby ]132 [ Michal Hruby ]
125 * Added header links CategoriesInterface and performQuery() to133 * Added header links CategoriesInterface and performQuery() to
126 ScopeInterface 134 ScopeInterface
127135
128 [ Michi Henning ]136 [ Michi Henning ]
129 * A few minor fixes to the doc comments for comparison operators.137 * A few minor fixes to the doc comments for comparison operators.
@@ -488,7 +496,7 @@
488496
489unity-api (7.80.1) saucy; urgency=low497unity-api (7.80.1) saucy; urgency=low
490498
491 * This project forked from lp:unity/phablet. Updating the versioning to 499 * This project forked from lp:unity/phablet. Updating the versioning to
492 reflect that.500 reflect that.
493501
494 -- Sergio Schvezov <sergio.schvezov@canonical.com> Tue, 04 Jun 2013 16:06:54 -0300502 -- Sergio Schvezov <sergio.schvezov@canonical.com> Tue, 04 Jun 2013 16:06:54 -0300
495503
=== modified file 'include/unity/shell/application/ApplicationInfoInterface.h'
--- include/unity/shell/application/ApplicationInfoInterface.h 2015-04-16 16:13:09 +0000
+++ include/unity/shell/application/ApplicationInfoInterface.h 2015-08-03 14:07:35 +0000
@@ -12,10 +12,6 @@
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Michael Zanetti <michael.zanetti@canonical.com>
18 * Daniel d'Andrada <daniel.dandrada@canonical.com>
19 */15 */
2016
21#ifndef UNITY_SHELL_APPLICATION_APPLICATIONINFOINTERFACE_H17#ifndef UNITY_SHELL_APPLICATION_APPLICATIONINFOINTERFACE_H
@@ -47,6 +43,7 @@
4743
48 Q_ENUMS(Stage)44 Q_ENUMS(Stage)
49 Q_ENUMS(State)45 Q_ENUMS(State)
46 Q_ENUMS(RequestedState)
5047
51 /**48 /**
52 * @brief The appId of the application.49 * @brief The appId of the application.
@@ -93,6 +90,11 @@
93 Q_PROPERTY(State state READ state NOTIFY stateChanged)90 Q_PROPERTY(State state READ state NOTIFY stateChanged)
9491
95 /**92 /**
93 * @brief The application's requested running state
94 */
95 Q_PROPERTY(RequestedState requestedState READ requestedState WRITE setRequestedState NOTIFY requestedStateChanged)
96
97 /**
96 * @brief The application's focus state.98 * @brief The application's focus state.
97 *99 *
98 * Holds the current application focus state. True if focused, false otherwise.100 * Holds the current application focus state. True if focused, false otherwise.
@@ -235,6 +237,18 @@
235 Stopped237 Stopped
236 };238 };
237239
240 /**
241 * @brief The desired state of an application
242 *
243 * RequestedRunning: If state is Suspended or Stopped, the application will be resumed
244 * or restarted, respectively.
245 * RequestedSuspended: If state is Running, the application will be suspended.
246 */
247 enum RequestedState {
248 RequestedRunning = Running,
249 RequestedSuspended = Suspended
250 };
251
238 /// @cond252 /// @cond
239 virtual ~ApplicationInfoInterface() {}253 virtual ~ApplicationInfoInterface() {}
240254
@@ -244,6 +258,8 @@
244 virtual QUrl icon() const = 0;258 virtual QUrl icon() const = 0;
245 virtual Stage stage() const = 0;259 virtual Stage stage() const = 0;
246 virtual State state() const = 0;260 virtual State state() const = 0;
261 virtual RequestedState requestedState() const = 0;
262 virtual void setRequestedState(RequestedState) = 0;
247 virtual bool focused() const = 0;263 virtual bool focused() const = 0;
248 virtual QString splashTitle() const = 0;264 virtual QString splashTitle() const = 0;
249 virtual QUrl splashImage() const = 0;265 virtual QUrl splashImage() const = 0;
@@ -262,6 +278,7 @@
262 void iconChanged(const QUrl &icon);278 void iconChanged(const QUrl &icon);
263 void stageChanged(Stage stage);279 void stageChanged(Stage stage);
264 void stateChanged(State state);280 void stateChanged(State state);
281 void requestedStateChanged(RequestedState value);
265 void focusedChanged(bool focused);282 void focusedChanged(bool focused);
266 /// @endcond283 /// @endcond
267};284};
268285
=== modified file 'include/unity/shell/application/ApplicationManagerInterface.h'
--- include/unity/shell/application/ApplicationManagerInterface.h 2014-09-29 13:39:01 +0000
+++ include/unity/shell/application/ApplicationManagerInterface.h 2015-08-03 14:07:35 +0000
@@ -59,20 +59,6 @@
59 */59 */
60 Q_PROPERTY(QString focusedApplicationId READ focusedApplicationId NOTIFY focusedApplicationIdChanged)60 Q_PROPERTY(QString focusedApplicationId READ focusedApplicationId NOTIFY focusedApplicationIdChanged)
6161
62 /**
63 * @brief The suspended state of the ApplicationManager.
64 *
65 * If this is set to true, all apps (regardless if focused or not) will be suspended.
66 */
67 Q_PROPERTY(bool suspended READ suspended WRITE setSuspended NOTIFY suspendedChanged)
68
69 /**
70 * @brief Activate the dash, regardless of its focused state.
71 *
72 * If this is set to true, the dash will not be put to suspend or will be woken up from suspend.
73 */
74 Q_PROPERTY(bool forceDashActive READ forceDashActive WRITE setForceDashActive NOTIFY forceDashActiveChanged)
75
76protected:62protected:
77 /// @cond63 /// @cond
78 ApplicationManagerInterface(QObject* parent = 0): QAbstractListModel(parent)64 ApplicationManagerInterface(QObject* parent = 0): QAbstractListModel(parent)
@@ -122,11 +108,6 @@
122108
123 virtual QString focusedApplicationId() const = 0;109 virtual QString focusedApplicationId() const = 0;
124110
125 virtual bool suspended() const = 0;
126 virtual void setSuspended(bool suspended) = 0;
127
128 virtual bool forceDashActive() const = 0;
129 virtual void setForceDashActive(bool forceDashActive) = 0;
130 /// @endcond111 /// @endcond
131112
132 /**113 /**
@@ -212,16 +193,6 @@
212 void focusedApplicationIdChanged();193 void focusedApplicationIdChanged();
213194
214 /**195 /**
215 * @brief Will be emitted when the suspended state of the ApplicationManager changes.
216 */
217 void suspendedChanged();
218
219 /**
220 * @brief Will be emitted when the forceDashActive property changes.
221 */
222 void forceDashActiveChanged();
223
224 /**
225 * @brief Will be emitted when an application was added to the model.196 * @brief Will be emitted when an application was added to the model.
226 *197 *
227 * @param appId The appId of the application that was added.198 * @param appId The appId of the application that was added.
228199
=== modified file 'include/unity/shell/application/CMakeLists.txt'
--- include/unity/shell/application/CMakeLists.txt 2014-11-05 12:55:55 +0000
+++ include/unity/shell/application/CMakeLists.txt 2015-08-03 14:07:35 +0000
@@ -7,7 +7,7 @@
77
8set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)8set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)
99
10set(VERSION 6)10set(VERSION 7)
11set(PKGCONFIG_NAME "unity-shell-application")11set(PKGCONFIG_NAME "unity-shell-application")
12set(PKGCONFIG_DESCRIPTION "Unity shell Application APIs")12set(PKGCONFIG_DESCRIPTION "Unity shell Application APIs")
13set(PKGCONFIG_REQUIRES "Qt5Core")13set(PKGCONFIG_REQUIRES "Qt5Core")
1414
=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp'
--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2014-11-05 12:55:55 +0000
+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2015-08-03 14:07:35 +0000
@@ -126,6 +126,15 @@
126 return QColor(0,0,0,0);126 return QColor(0,0,0,0);
127}127}
128128
129ApplicationInfoInterface::RequestedState MockApplicationInfo::requestedState() const
130{
131 return RequestedRunning;
132}
133
134void MockApplicationInfo::setRequestedState(RequestedState)
135{
136}
137
129Qt::ScreenOrientations MockApplicationInfo::supportedOrientations() const138Qt::ScreenOrientations MockApplicationInfo::supportedOrientations() const
130{139{
131 return Qt::PortraitOrientation | Qt::LandscapeOrientation;140 return Qt::PortraitOrientation | Qt::LandscapeOrientation;
132141
=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h'
--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2014-11-05 12:55:55 +0000
+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2015-08-03 14:07:35 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright 2013 Canonical Ltd.2 * Copyright 2013,2015 Canonical Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by5 * it under the terms of the GNU Lesser General Public License as published by
@@ -12,9 +12,6 @@
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Michael Zanetti <michael.zanetti@canonical.com>
18 */15 */
1916
20#ifndef MOCKAPPLICATIONINFO_H17#ifndef MOCKAPPLICATIONINFO_H
@@ -52,6 +49,8 @@
52 QColor splashColor() const override;49 QColor splashColor() const override;
53 QColor splashColorHeader() const override;50 QColor splashColorHeader() const override;
54 QColor splashColorFooter() const override;51 QColor splashColorFooter() const override;
52 RequestedState requestedState() const override;
53 void setRequestedState(RequestedState) override;
5554
56 Qt::ScreenOrientations supportedOrientations() const override;55 Qt::ScreenOrientations supportedOrientations() const override;
57 bool rotatesWindowContents() const override;56 bool rotatesWindowContents() const override;
5857
=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp'
--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2014-09-29 10:58:06 +0000
+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2015-08-03 14:07:35 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright 2013 Canonical Ltd.2 * Copyright 2013,2015 Canonical Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by5 * it under the terms of the GNU Lesser General Public License as published by
@@ -98,26 +98,6 @@
98 return (first) ? first->appId() : QString();98 return (first) ? first->appId() : QString();
99}99}
100100
101bool MockApplicationManager::suspended() const
102{
103 return false;
104}
105
106void MockApplicationManager::setSuspended(bool suspended)
107{
108 Q_UNUSED(suspended)
109}
110
111bool MockApplicationManager::forceDashActive() const
112{
113 return false;
114}
115
116void MockApplicationManager::setForceDashActive(bool forceDashActive)
117{
118 Q_UNUSED(forceDashActive)
119}
120
121bool MockApplicationManager::requestFocusApplication(const QString &appId)101bool MockApplicationManager::requestFocusApplication(const QString &appId)
122{102{
123 Q_UNUSED(appId)103 Q_UNUSED(appId)
124104
=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h'
--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2014-09-29 10:58:06 +0000
+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2015-08-03 14:07:35 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright 2013 Canonical Ltd.2 * Copyright 2013,2015 Canonical Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by5 * it under the terms of the GNU Lesser General Public License as published by
@@ -40,12 +40,6 @@
4040
41 QString focusedApplicationId() const;41 QString focusedApplicationId() const;
4242
43 bool suspended() const;
44 void setSuspended(bool suspended);
45
46 bool forceDashActive() const override;
47 void setForceDashActive(bool forceDashActive) override;
48
49 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *get(const int index) const;43 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *get(const int index) const;
5044
51 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const;45 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const;
5246
=== modified file 'test/qmltest/unity/shell/application/tst_Application.qml'
--- test/qmltest/unity/shell/application/tst_Application.qml 2014-11-05 12:55:55 +0000
+++ test/qmltest/unity/shell/application/tst_Application.qml 2015-08-03 14:07:35 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright 2013 Canonical Ltd.2 * Copyright 2013,2015 Canonical Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by5 * it under the terms of the GNU Lesser General Public License as published by
@@ -124,8 +124,6 @@
124 return [124 return [
125 { tag: "ApplicationManager.count", property: "count", type: "number" },125 { tag: "ApplicationManager.count", property: "count", type: "number" },
126 { tag: "ApplicationManager.focusedApplicationId", property: "focusedApplicationId", type: "string" },126 { tag: "ApplicationManager.focusedApplicationId", property: "focusedApplicationId", type: "string" },
127 { tag: "ApplicationManager.suspended", property: "suspended", type: "boolean" },
128 { tag: "ApplicationManager.forceDashActive", property: "forceDashActive", type: "boolean" },
129 ];127 ];
130 }128 }
131129
@@ -143,6 +141,7 @@
143 { tag: "ApplicationInfo.properties[icon]", property: "icon", type: "object" },141 { tag: "ApplicationInfo.properties[icon]", property: "icon", type: "object" },
144 { tag: "ApplicationInfo.properties[stage]", property: "stage", type: "number" },142 { tag: "ApplicationInfo.properties[stage]", property: "stage", type: "number" },
145 { tag: "ApplicationInfo.properties[state]", property: "state", type: "number" },143 { tag: "ApplicationInfo.properties[state]", property: "state", type: "number" },
144 { tag: "ApplicationInfo.properties[requestedState]", property: "requestedState", type: "number" },
146 { tag: "ApplicationInfo.properties[focused]", property: "focused", type: "boolean" },145 { tag: "ApplicationInfo.properties[focused]", property: "focused", type: "boolean" },
147 { tag: "ApplicationInfo.properties[splashTitle]", constant: "splashTitle", type: "string" },146 { tag: "ApplicationInfo.properties[splashTitle]", constant: "splashTitle", type: "string" },
148 { tag: "ApplicationInfo.properties[splashImage]", constant: "splashImage", type: "url" },147 { tag: "ApplicationInfo.properties[splashImage]", constant: "splashImage", type: "url" },

Subscribers

People subscribed via source and target branches

to all changes: