Merge lp:~mzanetti/unity-api/surfaceCount-property into lp:unity-api
- surfaceCount-property
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Albert Astals Cid |
Approved revision: | 237 |
Merged at revision: | 236 |
Proposed branch: | lp:~mzanetti/unity-api/surfaceCount-property |
Merge into: | lp:unity-api |
Diff against target: |
256 lines (+56/-8) 13 files modified
debian/changelog (+6/-0) include/unity/shell/application/ApplicationInfoInterface.h (+14/-2) include/unity/shell/application/CMakeLists.txt (+1/-1) include/unity/shell/application/MirSurfaceListInterface.h (+1/-1) include/unity/shell/launcher/CMakeLists.txt (+1/-1) include/unity/shell/launcher/LauncherItemInterface.h (+9/-0) include/unity/shell/launcher/LauncherModelInterface.h (+3/-1) test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp (+5/-0) test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h (+3/-2) test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp (+6/-0) test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h (+3/-0) test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cpp (+2/-0) test/qmltest/unity/shell/launcher/tst_Launcher.qml (+2/-0) |
To merge this branch: | bzr merge lp:~mzanetti/unity-api/surfaceCount-property |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity8 CI Bot | continuous-integration | Approve | |
Albert Astals Cid (community) | Approve | ||
Daniel d'Andrada (community) | Disapprove | ||
Lukáš Tinkl (community) | Approve | ||
Review via email: mp+294264@code.launchpad.net |
Commit message
Add a surface count property to the launcher model
In order to allow using the application api more easily, added a convenience property there too.
Description of the change
Related MPs:
https:/
https:/
I know the versions are gonna collide with other branches, I'll update them as we get closer to landing.
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:232
https:/
Executed test runs:
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:233
https:/
Executed test runs:
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Lukáš Tinkl (lukas-kde) wrote : | # |
Just a minor nitpick: fix the typo in the apidox, "conveniece"
Otherwise all good from my side
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:234
https:/
Executed test runs:
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:235
https:/
Executed test runs:
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Lukáš Tinkl (lukas-kde) wrote : | # |
LGTM, works fine with the qtmir/u8 branches
Daniel d'Andrada (dandrader) wrote : | # |
As I explained in the unity8 MP, I think this Application:
As http://
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:236
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 237. By Michael Zanetti
-
merge trunk
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:237
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Michael Zanetti (mzanetti) wrote : | # |
> As I explained in the unity8 MP, I think this Application:
> property is redundant.
>
> As http://
> pips/revision/2398 shows.
Just because you think your approach is better and you're on a mission to put a needs fixing on each and every merge proposal that's not yours? As I said, I strongly disagree on apis that require people to capture pointers to objects with potentially different lifetime in lambdas (I can't even count how many crashes we had in qtmir because of this bad practice).
Api design is not just about naming signals not like slots. It's about providing an api that is fail-safe to use. Requiring the user to have knowledge about lifetime of other objects than the one he connects to is bad.
Daniel d'Andrada (dandrader) wrote : | # |
On 19/05/2016 08:08, Michael Zanetti wrote:
>> As I explained in the unity8 MP, I think this Application:
>> property is redundant.
>>
>> As http://
>> pips/revision/2398 shows.
>
> Just because you think your approach is better and you're on a mission to put a needs fixing on each and every merge proposal that's not yours? As I said, I strongly disagree on apis that require people to capture pointers to objects with potentially different lifetime in lambdas (I can't even count how many crashes we had in qtmir because of this bad practice).
>
> Api design is not just about naming signals not like slots. It's about providing an api that is fail-safe to use. Requiring the user to have knowledge about lifetime of other objects than the one he connects to is bad.
>
We will have to agree to disagree in that topic.
So let me get just one more reviewer/opinion so we can move on and
resolve that standoff.
I apologize for putting back to "need review" an already approved branch
just because of API style (I see that now that it can be seen as an
offensive and agressive move), but would appreciate if the message
exchange remained on the topic and didn't degrade to personal attacks.
Albert Astals Cid (aacid) wrote : | # |
I think it's just two different ways to approach how to implement the feature, and I can't mark one as better than the other.
Daniel has a point in that the list is documented to be a constant property so it won't disappear magically under your feet, but on the other hand you need an extra disconnect that is a bit uglier.
This is a nice philosophical discussion and makes for a nice bar+beer nerd-discussion.
BUT let's not forget we're here to make a product and that we need to be pragmatical and let's agree that the code written here is not so bad that it needs to be rewritten and cause another round of reviews + review fixes, which probably mean a day or more of work-time invested in something that will still give us a feature with the same level of quality and maintenance effort as we have now.
For that reason i'm just going to approve this MR.
Let's try to be a bit more pragmatical with the reviews and also take comments a bit less personally (i know it's hard, i'm the first to fail)
- 238. By Michael Zanetti
-
bump application API version again
Now that trunk has been updated to 16 already
- 239. By Michael Zanetti
-
merge trunk
- 240. By Michael Zanetti
-
bump version once more
- 241. By Michael Zanetti
-
bump debian/changelog
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:238
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2016-05-25 06:02:38 +0000 |
3 | +++ debian/changelog 2016-06-03 11:15:53 +0000 |
4 | @@ -1,3 +1,9 @@ |
5 | +unity-api (7.114) UNRELEASED; urgency=medium |
6 | + |
7 | + * Add ApplicationInfoInterface::surfaceCount property |
8 | + |
9 | + -- Michael Zanetti <michael.zanetti@canonical.com> Mon, 09 May 2016 18:43:38 +0200 |
10 | + |
11 | unity-api (7.113+16.10.20160525-0ubuntu1) yakkety; urgency=medium |
12 | |
13 | [ Daniel d'Andrada ] |
14 | |
15 | === modified file 'include/unity/shell/application/ApplicationInfoInterface.h' |
16 | --- include/unity/shell/application/ApplicationInfoInterface.h 2016-05-17 12:55:00 +0000 |
17 | +++ include/unity/shell/application/ApplicationInfoInterface.h 2016-06-03 11:15:53 +0000 |
18 | @@ -229,6 +229,16 @@ |
19 | */ |
20 | Q_PROPERTY(unity::shell::application::MirSurfaceListInterface* promptSurfaceList READ promptSurfaceList CONSTANT) |
21 | |
22 | + /** |
23 | + * @brief Count of application's surfaces |
24 | + * |
25 | + * This is a convenience property and will always be the same as surfaceList->count(). |
26 | + * It allows to connect to an application and listen for surface creations/removals for |
27 | + * that particular application without having to keep track of the |
28 | + * application <-> surfaceList relationship. |
29 | + */ |
30 | + Q_PROPERTY(int surfaceCount READ surfaceCount NOTIFY surfaceCountChanged) |
31 | + |
32 | protected: |
33 | /// @cond |
34 | ApplicationInfoInterface(const QString &appId, QObject* parent = 0): QObject(parent) { Q_UNUSED(appId) } |
35 | @@ -305,8 +315,9 @@ |
36 | virtual void setExemptFromLifecycle(bool) = 0; |
37 | virtual QSize initialSurfaceSize() const = 0; |
38 | virtual void setInitialSurfaceSize(const QSize &size) = 0; |
39 | - virtual MirSurfaceListInterface* surfaceList() = 0; |
40 | - virtual MirSurfaceListInterface* promptSurfaceList() = 0; |
41 | + virtual MirSurfaceListInterface* surfaceList() const = 0; |
42 | + virtual MirSurfaceListInterface* promptSurfaceList() const = 0; |
43 | + virtual int surfaceCount() const = 0; |
44 | /// @endcond |
45 | |
46 | Q_SIGNALS: |
47 | @@ -320,6 +331,7 @@ |
48 | void focusedChanged(bool focused); |
49 | void exemptFromLifecycleChanged(bool exemptFromLifecycle); |
50 | void initialSurfaceSizeChanged(const QSize &size); |
51 | + void surfaceCountChanged(int surfaceCount); |
52 | /// @endcond |
53 | |
54 | /** |
55 | |
56 | === modified file 'include/unity/shell/application/CMakeLists.txt' |
57 | --- include/unity/shell/application/CMakeLists.txt 2016-05-18 20:51:23 +0000 |
58 | +++ include/unity/shell/application/CMakeLists.txt 2016-06-03 11:15:53 +0000 |
59 | @@ -7,7 +7,7 @@ |
60 | |
61 | set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) |
62 | |
63 | -set(VERSION 17) |
64 | +set(VERSION 18) |
65 | set(PKGCONFIG_NAME "unity-shell-application") |
66 | set(PKGCONFIG_DESCRIPTION "Unity shell Application APIs") |
67 | set(PKGCONFIG_REQUIRES "Qt5Core") |
68 | |
69 | === modified file 'include/unity/shell/application/MirSurfaceListInterface.h' |
70 | --- include/unity/shell/application/MirSurfaceListInterface.h 2016-05-25 06:02:36 +0000 |
71 | +++ include/unity/shell/application/MirSurfaceListInterface.h 2016-06-03 11:15:53 +0000 |
72 | @@ -89,7 +89,7 @@ |
73 | |
74 | Q_SIGNALS: |
75 | /// @cond |
76 | - void countChanged(); |
77 | + void countChanged(int count); |
78 | void firstChanged(); |
79 | /// @endcond |
80 | }; |
81 | |
82 | === modified file 'include/unity/shell/launcher/CMakeLists.txt' |
83 | --- include/unity/shell/launcher/CMakeLists.txt 2015-06-19 16:13:00 +0000 |
84 | +++ include/unity/shell/launcher/CMakeLists.txt 2016-06-03 11:15:53 +0000 |
85 | @@ -7,7 +7,7 @@ |
86 | |
87 | set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) |
88 | |
89 | -set(VERSION 7) |
90 | +set(VERSION 8) |
91 | set(PKGCONFIG_NAME "unity-shell-launcher") |
92 | set(PKGCONFIG_DESCRIPTION "Unity shell Launcher APIs") |
93 | set(PKGCONFIG_REQUIRES "Qt5Core") |
94 | |
95 | === modified file 'include/unity/shell/launcher/LauncherItemInterface.h' |
96 | --- include/unity/shell/launcher/LauncherItemInterface.h 2015-06-12 11:06:29 +0000 |
97 | +++ include/unity/shell/launcher/LauncherItemInterface.h 2016-06-03 11:15:53 +0000 |
98 | @@ -112,6 +112,13 @@ |
99 | Q_PROPERTY(bool alerting READ alerting NOTIFY alertingChanged) |
100 | |
101 | /** |
102 | + * @brief The number of surfaces that this application entry has opened |
103 | + * |
104 | + * The Launcher will display up to 3 pips, one for each surface |
105 | + */ |
106 | + Q_PROPERTY(int surfaceCount READ surfaceCount NOTIFY surfaceCountChanged) |
107 | + |
108 | + /** |
109 | * @brief The quick list menu contents for the item |
110 | * |
111 | * Items can have a quick list menu. This property holds a model for |
112 | @@ -138,6 +145,7 @@ |
113 | virtual bool countVisible() const = 0; |
114 | virtual bool focused() const = 0; |
115 | virtual bool alerting() const = 0; |
116 | + virtual int surfaceCount() const = 0; |
117 | virtual unity::shell::launcher::QuickListModelInterface *quickList() const = 0; |
118 | |
119 | Q_SIGNALS: |
120 | @@ -151,6 +159,7 @@ |
121 | void countVisibleChanged(bool countVisible); |
122 | void focusedChanged(bool focused); |
123 | void alertingChanged(bool alerting); |
124 | + void surfaceCountChanged(int surfaceCount); |
125 | /// @endcond |
126 | }; |
127 | |
128 | |
129 | === modified file 'include/unity/shell/launcher/LauncherModelInterface.h' |
130 | --- include/unity/shell/launcher/LauncherModelInterface.h 2015-06-19 16:13:00 +0000 |
131 | +++ include/unity/shell/launcher/LauncherModelInterface.h 2016-06-03 11:15:53 +0000 |
132 | @@ -73,6 +73,7 @@ |
133 | m_roleNames.insert(RoleCountVisible, "countVisible"); |
134 | m_roleNames.insert(RoleFocused, "focused"); |
135 | m_roleNames.insert(RoleAlerting, "alerting"); |
136 | + m_roleNames.insert(RoleSurfaceCount, "surfaceCount"); |
137 | } |
138 | /// @endcond |
139 | |
140 | @@ -93,7 +94,8 @@ |
141 | RoleCount, |
142 | RoleCountVisible, |
143 | RoleFocused, |
144 | - RoleAlerting |
145 | + RoleAlerting, |
146 | + RoleSurfaceCount |
147 | }; |
148 | |
149 | virtual ~LauncherModelInterface() {} |
150 | |
151 | === modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp' |
152 | --- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2015-12-03 17:07:15 +0000 |
153 | +++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2016-06-03 11:15:53 +0000 |
154 | @@ -164,3 +164,8 @@ |
155 | Q_EMIT exemptFromLifecycleChanged(m_exemptFromLifecycle); |
156 | } |
157 | } |
158 | + |
159 | +int MockApplicationInfo::surfaceCount() const |
160 | +{ |
161 | + return 1; |
162 | +} |
163 | |
164 | === modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h' |
165 | --- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2016-05-17 12:55:00 +0000 |
166 | +++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2016-06-03 11:15:53 +0000 |
167 | @@ -62,8 +62,9 @@ |
168 | QSize initialSurfaceSize() const override { return QSize(); } |
169 | void setInitialSurfaceSize(const QSize &) override {} |
170 | |
171 | - MirSurfaceListInterface* surfaceList() override { return nullptr; } |
172 | - MirSurfaceListInterface* promptSurfaceList() override { return nullptr; } |
173 | + MirSurfaceListInterface* surfaceList() const override { return nullptr; } |
174 | + MirSurfaceListInterface* promptSurfaceList() const override { return nullptr; } |
175 | + int surfaceCount() const override; |
176 | |
177 | private: |
178 | QString m_appId; |
179 | |
180 | === modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp' |
181 | --- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp 2015-06-18 17:03:45 +0000 |
182 | +++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp 2016-06-03 11:15:53 +0000 |
183 | @@ -35,6 +35,7 @@ |
184 | m_count(8), |
185 | m_countVisible(false), |
186 | m_alerting(false), |
187 | + m_surfaceCount(1), |
188 | m_quickListModel(new MockQuickListModel(this)) |
189 | { |
190 | |
191 | @@ -172,6 +173,11 @@ |
192 | } |
193 | } |
194 | |
195 | +int MockLauncherItem::surfaceCount() const |
196 | +{ |
197 | + return m_surfaceCount; |
198 | +} |
199 | + |
200 | QuickListModelInterface *MockLauncherItem::quickList() const |
201 | { |
202 | return m_quickListModel; |
203 | |
204 | === modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h' |
205 | --- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h 2015-06-02 13:52:49 +0000 |
206 | +++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h 2016-06-03 11:15:53 +0000 |
207 | @@ -59,6 +59,8 @@ |
208 | bool alerting() const; |
209 | void setAlerting(bool alerting); |
210 | |
211 | + int surfaceCount() const override; |
212 | + |
213 | unity::shell::launcher::QuickListModelInterface *quickList() const; |
214 | |
215 | private: |
216 | @@ -74,6 +76,7 @@ |
217 | bool m_countVisible; |
218 | bool m_focused; |
219 | bool m_alerting; |
220 | + int m_surfaceCount; |
221 | QuickListModelInterface *m_quickListModel; |
222 | }; |
223 | |
224 | |
225 | === modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cpp' |
226 | --- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cpp 2015-06-19 16:13:00 +0000 |
227 | +++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cpp 2016-06-03 11:15:53 +0000 |
228 | @@ -90,6 +90,8 @@ |
229 | return item->focused(); |
230 | case RoleAlerting: |
231 | return item->alerting(); |
232 | + case RoleSurfaceCount: |
233 | + return item->surfaceCount(); |
234 | } |
235 | |
236 | return QVariant(); |
237 | |
238 | === modified file 'test/qmltest/unity/shell/launcher/tst_Launcher.qml' |
239 | --- test/qmltest/unity/shell/launcher/tst_Launcher.qml 2015-06-19 16:13:00 +0000 |
240 | +++ test/qmltest/unity/shell/launcher/tst_Launcher.qml 2016-06-03 11:15:53 +0000 |
241 | @@ -88,6 +88,7 @@ |
242 | { tag: "Model.roles[countVisible]", role: "countVisible", type: "boolean" }, |
243 | { tag: "Model.roles[focused]", role: "focused", type: "boolean" }, |
244 | { tag: "Model.roles[alerting]", role: "alerting", type: "boolean" }, |
245 | + { tag: "Model.roles[surfaceCount]", role: "surfaceCount", type: "number" }, |
246 | ]; |
247 | } |
248 | |
249 | @@ -146,6 +147,7 @@ |
250 | { tag: "Item.properties[countVisible]", property: "countVisible", type: "boolean" }, |
251 | { tag: "Item.properties[focused]", property: "focused", type: "boolean" }, |
252 | { tag: "Item.properties[alerting]", property: "alerting", type: "boolean" }, |
253 | + { tag: "Item.properties[surfaceCount]", property: "surfaceCount", type: "number" }, |
254 | { tag: "Item.properties[quickList]", constant: "quickList", type: "object" }, |
255 | ]; |
256 | } |
FAILED: Continuous integration, rev:231 /unity8- jenkins. ubuntu. com/job/ lp-unity- api-ci/ 69/ /unity8- jenkins. ubuntu. com/job/ build-0- fetch/1566/ console
https:/
Executed test runs:
FAILURE: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-unity- api-ci/ 69/rebuild
https:/