Merge lp:~dandrader/unity-api/splash into lp:unity-api

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Michael Zanetti
Approved revision: 164
Merged at revision: 158
Proposed branch: lp:~dandrader/unity-api/splash
Merge into: lp:unity-api
Diff against target: 342 lines (+175/-11)
12 files modified
debian/changelog (+6/-0)
include/unity/shell/application/ApplicationInfoInterface.h (+85/-0)
include/unity/shell/application/CMakeLists.txt (+1/-1)
test/qmltest/mocks/plugins/Unity/Application/CMakeLists.txt (+3/-2)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp (+30/-0)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h (+7/-0)
test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt (+1/-1)
test/qmltest/modules/TestUtil/CMakeLists.txt (+6/-6)
test/qmltest/modules/TestUtil/TestUtil.cpp (+15/-0)
test/qmltest/modules/TestUtil/TestUtil.h (+4/-0)
test/qmltest/modules/TestUtil/Verifier.qml (+11/-1)
test/qmltest/unity/shell/application/tst_Application.qml (+6/-0)
To merge this branch: bzr merge lp:~dandrader/unity-api/splash
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michael Zanetti (community) Abstain
Gerry Boland (community) Approve
Review via email: mp+233288@code.launchpad.net

Commit message

ApplicationInfoInterface: add splash screen data

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 :

You should test for the added properties in test/qmltest/unity/shell/application/tst_Application.qml

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

+ * The header will display the splashTitle, if defined, or the application
+ * name otherwise.

The documentation is weak. We offer 2 kinds of splash screens for applications:
1. a splash with a gradient background and image
2. a splash faking a MainView with header text set - so in theory once the app starts up, this splash and the app's first frame are identical.

splashShowHeader is the switch to select between these. Can you pad out the docs with examples of both types?

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

> You should test for the added properties in
> test/qmltest/unity/shell/application/tst_Application.qml

Done.

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

> + * The header will display the splashTitle, if defined, or the application
> + * name otherwise.
>
> The documentation is weak. We offer 2 kinds of splash screens for
> applications:
> 1. a splash with a gradient background and image
> 2. a splash faking a MainView with header text set - so in theory once the app
> starts up, this splash and the app's first frame are identical.
>
> splashShowHeader is the switch to select between these. Can you pad out the
> docs with examples of both types?

Documentation improved.

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

LGTM

review: Approve
Revision history for this message
Michael Zanetti (mzanetti) wrote :

Need to bump changelog and depends in unity8 or unity8 it won't build in the ppa

review: Needs Fixing
lp:~dandrader/unity-api/splash updated
163. By Daniel d'Andrada

Updated changelog

164. By Daniel d'Andrada

Merge trunk

Revision history for this message
Michael Zanetti (mzanetti) wrote :

ack.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-09-18 16:42:26 +0000
3+++ debian/changelog 2014-09-22 10:27:10 +0000
4@@ -1,3 +1,9 @@
5+unity-api (7.91) UNRELEASED; urgency=medium
6+
7+ * Added splash screen data do ApplicationInfoInterface
8+
9+ -- Daniel d'Andrada <daniel.dandrada@canonical.com> Mon, 22 Sep 2014 07:22:26 -0300
10+
11 unity-api (7.90+14.10.20140918-0ubuntu1) utopic; urgency=medium
12
13 [ Michael Zanetti ]
14
15=== modified file 'include/unity/shell/application/ApplicationInfoInterface.h'
16--- include/unity/shell/application/ApplicationInfoInterface.h 2014-08-13 18:05:37 +0000
17+++ include/unity/shell/application/ApplicationInfoInterface.h 2014-09-22 10:27:10 +0000
18@@ -24,6 +24,7 @@
19
20 #include <QtCore/QObject>
21 #include <QtCore/QUrl>
22+#include <QColor>
23
24 namespace unity
25 {
26@@ -97,6 +98,84 @@
27 */
28 Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged)
29
30+ /**
31+ * @brief Splash screen title
32+ *
33+ * @see splashShowHeader
34+ * Title of the splash screen, to be displayed on its header.
35+ *
36+ * A splash screen is shown while the application is loading,
37+ * before it has drawn its first frame.
38+ */
39+ Q_PROPERTY(QString splashTitle READ splashTitle CONSTANT)
40+
41+ /**
42+ * @brief Splash image
43+ *
44+ * Url of the splash image to be shown while the application is loading,
45+ * before it has drawn its first frame.
46+ *
47+ * The splash image is centered on the splash screen and displayed in
48+ * its actual size (ie, it's not stretched or shrinked and aspect ratio
49+ * is kept).
50+ */
51+ Q_PROPERTY(QUrl splashImage READ splashImage CONSTANT)
52+
53+ /**
54+ * @brief Whether an application header should be shown on the splash screen
55+ *
56+ * We offer 2 kinds of splash screens for applications:
57+ * 1. A splash with a gradient background and image
58+ * 2. A splash faking a MainView with header text set. So it is possible to
59+ * arrange things so that once the app starts up, this splash and the app's
60+ * first frame are identical.
61+ *
62+ * This property is the switch to select between these.
63+ *
64+ * The header will display the splashTitle, if defined, or the application
65+ * name otherwise.
66+ *
67+ * @see name, splashTitle
68+ */
69+ Q_PROPERTY(bool splashShowHeader READ splashShowHeader CONSTANT)
70+
71+ /**
72+ * @brief Background color of the splash screen
73+ *
74+ * Any color that is not fully opaque (having an alpha value of less than
75+ * 1.0) is ignored and the default background color will be used instead.
76+ *
77+ * A splash screen is shown while the application is loading,
78+ * before it has drawn its first frame.
79+ */
80+ Q_PROPERTY(QColor splashColor READ splashColor CONSTANT)
81+
82+ /**
83+ * @brief Color of the splash screen header
84+ *
85+ * Any color that is not fully opaque (having an alpha value of less than
86+ * 1.0) is ignored and the splashColor will be used instead.
87+ *
88+ * A splash screen is shown while the application is loading,
89+ * before it has drawn its first frame.
90+ *
91+ * @see splashColor
92+ */
93+ Q_PROPERTY(QColor splashColorHeader READ splashColorHeader CONSTANT)
94+
95+ /**
96+ * @brief Color of the splash screen footer
97+ *
98+ * Any color that is not fully opaque (having an alpha value of less than
99+ * 1.0) is ignored and the splashColor will be used instead.
100+ *
101+ * A splash screen is shown while the application is loading,
102+ * before it has drawn its first frame.
103+ *
104+ * @see splashColor
105+ */
106+ Q_PROPERTY(QColor splashColorFooter READ splashColorFooter CONSTANT)
107+
108 protected:
109 /// @cond
110 ApplicationInfoInterface(const QString &appId, QObject* parent = 0): QObject(parent) { Q_UNUSED(appId) }
111@@ -145,6 +224,12 @@
112 virtual Stage stage() const = 0;
113 virtual State state() const = 0;
114 virtual bool focused() const = 0;
115+ virtual QString splashTitle() const = 0;
116+ virtual QUrl splashImage() const = 0;
117+ virtual bool splashShowHeader() const = 0;
118+ virtual QColor splashColor() const = 0;
119+ virtual QColor splashColorHeader() const = 0;
120+ virtual QColor splashColorFooter() const = 0;
121 /// @endcond
122
123 Q_SIGNALS:
124
125=== modified file 'include/unity/shell/application/CMakeLists.txt'
126--- include/unity/shell/application/CMakeLists.txt 2014-08-11 13:39:14 +0000
127+++ include/unity/shell/application/CMakeLists.txt 2014-09-22 10:27:10 +0000
128@@ -7,7 +7,7 @@
129
130 set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)
131
132-set(VERSION 3)
133+set(VERSION 4)
134 set(PKGCONFIG_NAME "unity-shell-application")
135 set(PKGCONFIG_DESCRIPTION "Unity shell Application APIs")
136 set(PKGCONFIG_REQUIRES "Qt5Core")
137
138=== modified file 'test/qmltest/mocks/plugins/Unity/Application/CMakeLists.txt'
139--- test/qmltest/mocks/plugins/Unity/Application/CMakeLists.txt 2013-08-29 12:54:56 +0000
140+++ test/qmltest/mocks/plugins/Unity/Application/CMakeLists.txt 2014-09-22 10:27:10 +0000
141@@ -7,6 +7,7 @@
142 set(CMAKE_AUTOMOC ON)
143
144 find_package(Qt5Core REQUIRED)
145+find_package(Qt5Gui REQUIRED)
146 find_package(Qt5Quick REQUIRED)
147 find_package(Qt5Qml REQUIRED)
148
149@@ -19,7 +20,7 @@
150
151 add_library(ApplicationMocks SHARED ${ApplicationMocks_SOURCES})
152
153-qt5_use_modules(ApplicationMocks Core)
154+qt5_use_modules(ApplicationMocks Core Gui)
155
156 set(TestApplicationPlugin_SOURCES
157 TestApplicationPlugin.cpp
158@@ -27,7 +28,7 @@
159
160 add_library(TestApplicationPlugin MODULE ${TestApplicationPlugin_SOURCES})
161
162-qt5_use_modules(TestApplicationPlugin Core Quick)
163+qt5_use_modules(TestApplicationPlugin Core Gui Quick)
164
165 target_link_libraries(TestApplicationPlugin ApplicationMocks)
166
167
168=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp'
169--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2014-08-13 18:05:37 +0000
170+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2014-09-22 10:27:10 +0000
171@@ -95,3 +95,33 @@
172 Q_EMIT focusedChanged(focused);
173 }
174 }
175+
176+QString MockApplicationInfo::splashTitle() const
177+{
178+ return "Foo Bar";
179+}
180+
181+QUrl MockApplicationInfo::splashImage() const
182+{
183+ return QUrl();
184+}
185+
186+bool MockApplicationInfo::splashShowHeader() const
187+{
188+ return true;
189+}
190+
191+QColor MockApplicationInfo::splashColor() const
192+{
193+ return QColor(0,0,0,0);
194+}
195+
196+QColor MockApplicationInfo::splashColorHeader() const
197+{
198+ return QColor(0,0,0,0);
199+}
200+
201+QColor MockApplicationInfo::splashColorFooter() const
202+{
203+ return QColor(0,0,0,0);
204+}
205
206=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h'
207--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2014-08-13 18:05:37 +0000
208+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2014-09-22 10:27:10 +0000
209@@ -46,6 +46,13 @@
210 bool focused() const;
211 void setFocused(bool focused);
212
213+ QString splashTitle() const override;
214+ QUrl splashImage() const override;
215+ bool splashShowHeader() const override;
216+ QColor splashColor() const override;
217+ QColor splashColorHeader() const override;
218+ QColor splashColorFooter() const override;
219+
220 private:
221 QString m_appId;
222 QString m_name;
223
224=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt'
225--- test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt 2013-09-11 15:28:22 +0000
226+++ test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt 2014-09-22 10:27:10 +0000
227@@ -27,7 +27,7 @@
228
229 add_library(LauncherMocks SHARED ${LauncherMocks_SOURCES})
230
231-qt5_use_modules(LauncherMocks Core)
232+qt5_use_modules(LauncherMocks Core Gui)
233
234 set(TestLauncherPlugin_SOURCES
235 TestLauncherPlugin.cpp
236
237=== modified file 'test/qmltest/modules/TestUtil/CMakeLists.txt'
238--- test/qmltest/modules/TestUtil/CMakeLists.txt 2013-05-16 06:36:37 +0000
239+++ test/qmltest/modules/TestUtil/CMakeLists.txt 2014-09-22 10:27:10 +0000
240@@ -18,12 +18,12 @@
241 qt5_use_modules(TestUtilQml Core Quick)
242
243 # copy qmldir file into build directory for shadow builds
244-file(GLOB QML_JS_FILES *.js *.qml)
245-
246-file(COPY qmldir ${QML_JS_FILES}
247- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
248- )
249-
250+file(GLOB QML_JS_FILES qmldir *.js *.qml)
251+add_custom_target(TestUtil-qmlfiles ALL
252+ COMMAND cp ${QML_JS_FILES} ${CMAKE_CURRENT_BINARY_DIR}
253+ DEPENDS ${QML_JS_FILES}
254+ SOURCES ${QML_JS_FILES}
255+)
256
257 # tests
258 include(QmlTest)
259
260=== modified file 'test/qmltest/modules/TestUtil/TestUtil.cpp'
261--- test/qmltest/modules/TestUtil/TestUtil.cpp 2013-06-26 23:47:34 +0000
262+++ test/qmltest/modules/TestUtil/TestUtil.cpp 2014-09-22 10:27:10 +0000
263@@ -17,6 +17,8 @@
264
265 #include <TestUtil.h>
266
267+#include <QQmlProperty>
268+
269 TestUtil::TestUtil(QObject *parent)
270 : QObject(parent)
271 {
272@@ -44,3 +46,16 @@
273 }
274 return result;
275 }
276+
277+bool TestUtil::objectHasPropertyOfType(QObject *qmlObject, const QString &propertyName,
278+ const QString &expectedPropertyTypeName)
279+{
280+ if (!qmlObject) return false;
281+
282+ QQmlProperty property(qmlObject, propertyName);
283+
284+ if (!property.isValid()) return false;
285+ if (!property.isProperty()) return false;
286+ return QString(property.propertyTypeName()) == expectedPropertyTypeName;
287+
288+}
289
290=== modified file 'test/qmltest/modules/TestUtil/TestUtil.h'
291--- test/qmltest/modules/TestUtil/TestUtil.h 2013-06-26 23:47:34 +0000
292+++ test/qmltest/modules/TestUtil/TestUtil.h 2014-09-22 10:27:10 +0000
293@@ -30,6 +30,10 @@
294 ~TestUtil();
295
296 Q_INVOKABLE bool isInstanceOf(QObject*, QString);
297+
298+ Q_INVOKABLE bool objectHasPropertyOfType(QObject *qmlObject,
299+ const QString &propertyName,
300+ const QString &propertyTypeName);
301 };
302
303 QML_DECLARE_TYPE(TestUtil)
304
305=== modified file 'test/qmltest/modules/TestUtil/Verifier.qml'
306--- test/qmltest/modules/TestUtil/Verifier.qml 2013-06-04 14:50:08 +0000
307+++ test/qmltest/modules/TestUtil/Verifier.qml 2014-09-22 10:27:10 +0000
308@@ -78,7 +78,17 @@
309 fail(msg);
310 }
311
312- verifyType(object[member], type, msg);
313+ if (type === "url") {
314+ if (!Util.objectHasPropertyOfType(object, member, "QUrl")) {
315+ fail(msg);
316+ }
317+ } else if (type === "color") {
318+ if (!Util.objectHasPropertyOfType(object, member, "QColor")) {
319+ fail(msg);
320+ }
321+ } else {
322+ verifyType(object[member], type, msg);
323+ }
324 }
325
326 /* verify that the object is registered */
327
328=== modified file 'test/qmltest/unity/shell/application/tst_Application.qml'
329--- test/qmltest/unity/shell/application/tst_Application.qml 2014-08-18 12:41:43 +0000
330+++ test/qmltest/unity/shell/application/tst_Application.qml 2014-09-22 10:27:10 +0000
331@@ -143,6 +143,12 @@
332 { tag: "ApplicationInfo.properties[stage]", property: "stage", type: "number" },
333 { tag: "ApplicationInfo.properties[state]", property: "state", type: "number" },
334 { tag: "ApplicationInfo.properties[focused]", property: "focused", type: "boolean" },
335+ { tag: "ApplicationInfo.properties[splashTitle]", constant: "splashTitle", type: "string" },
336+ { tag: "ApplicationInfo.properties[splashImage]", constant: "splashImage", type: "url" },
337+ { tag: "ApplicationInfo.properties[splashShowHeader]", constant: "splashShowHeader", type: "boolean"},
338+ { tag: "ApplicationInfo.properties[splashColor]", constant: "splashColor", type: "color"},
339+ { tag: "ApplicationInfo.properties[splashColorHeader]", constant: "splashColorHeader", type: "color"},
340+ { tag: "ApplicationInfo.properties[splashColorFooter]", constant: "splashColorFooter", type: "color"},
341 ];
342 }
343

Subscribers

People subscribed via source and target branches

to all changes: