Merge lp:~cimi/unity8/card_emblems_2 into lp:unity8

Proposed by Andrea Cimitan
Status: Superseded
Proposed branch: lp:~cimi/unity8/card_emblems_2
Merge into: lp:unity8
Diff against target: 425 lines (+201/-31)
10 files modified
plugins/Dash/CardCreator.js (+116/-29)
tests/plugins/Dash/cardcreator/1.res (+8/-0)
tests/plugins/Dash/cardcreator/2.res (+8/-0)
tests/plugins/Dash/cardcreator/3.res (+8/-0)
tests/plugins/Dash/cardcreator/4.res (+8/-0)
tests/plugins/Dash/cardcreator/5.res (+8/-0)
tests/plugins/Dash/cardcreator/6.res (+8/-0)
tests/plugins/Dash/cardcreatortest.cpp (+6/-2)
tests/qmltests/Dash/CardHelpers.js (+1/-0)
tests/qmltests/Dash/tst_Card.qml (+30/-0)
To merge this branch: bzr merge lp:~cimi/unity8/card_emblems_2
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+228651@code.launchpad.net

Description of the change

WIP

To post a comment you must log in.
lp:~cimi/unity8/card_emblems_2 updated
1090. By Andrea Cimitan

Fix emblem code and padding

1091. By Andrea Cimitan

Moving towards unique container

1092. By Andrea Cimitan

Conflicts solved

1093. By Andrea Cimitan

[ Michael Terry ]
* Check user's pin/password using PAM, instead of a plaintext keyfile.
  New build dependency: libpam0g-dev for phone unlock with PAM (LP:
  #1234983)
[ Gerry Boland ]
[ Daniel d'Andrada ]
* Re-architecture unity8 to use the QtMirCompositor library so that
  the Qt scenegraph renderer is used as the Mir compositor, and
  application surfaces are added to the QML scene as items.

[ Michael Zanetti ]
* Port phone right-edge spread code to use QtCompositor
* Add right-edge spread animation for tablet
[ Ubuntu daily release ]
* New rebuild forced

1094. By Andrea Cimitan

Fixed tests

1095. By Andrea Cimitan

Fixed test

1096. By Andrea Cimitan

Added test

1097. By Andrea Cimitan

More fixes

1098. By Andrea Cimitan

[ Gerry Boland ]
* Fix the run.sh script - pretend to be running with qtmir and emit
  SIGSTOP at the right time
[ Ying-Chun Liu ]
* Implement Attribute UI. (LP: #1282460)
[ Albert Astals ]
* Hide search history popup as soon as you start typing As discussed
  with Mike and Saviq
* Compile with for scopes-v3 unity-api
* PageHeader: Unfocus search field when search entry is selected
* Show search field if the search query changes
* Test: Add a condition for art.height being > 0 means stuff has
  already been layouted a bit without it it can happen that we get 0
  for everything at startup and tests still pass
* Remove leftover in test of an old headerless implementation
[ Michael Zanetti ]
* Drop Recent apps category from Dash (LP: #1281092)
* update launcher count emblems to match new spec (LP: #1338984)
[ Bill Filler ]
* disable predictive text for dash search field (LP: #1340409)
[ CI bot ]
* Resync trunk
[ Antti Kaijanmäki ]
* DefaultIndicatorPage: use Loader status to determine the visible
  property. (LP: #1350555)

1099. By Andrea Cimitan

Merge

1100. By Andrea Cimitan

merged trunk

1101. By Andrea Cimitan

Fix categories with attributes

1102. By Andrea Cimitan

Moar fixes

1103. By Andrea Cimitan

Fixed whitespaces

1104. By Andrea Cimitan

merged overview

1105. By Andrea Cimitan

Fixed right padding

1106. By Andrea Cimitan

Fixed issue of spacing when the touchdown is on the art only

1107. By Andrea Cimitan

Fixed another review erequest

1108. By Andrea Cimitan

Add colorisation

1109. By Andrea Cimitan

Fix issue in reviewy

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Dash/CardCreator.js'
2--- plugins/Dash/CardCreator.js 2014-07-09 19:44:44 +0000
3+++ plugins/Dash/CardCreator.js 2014-07-29 11:22:19 +0000
4@@ -181,15 +181,35 @@
5 ] \n\
6 }\n';
7
8-// %1 is used as first child of the column
9-// %2 is used as second child of the column
10-var kHeaderColumnCode = 'Column { \n\
11- anchors.verticalCenter: parent.verticalCenter; \n\
12- spacing: units.dp(2); \n\
13- width: parent.width - x;\n\
14- data: [ %1\n\
15- ,\n\
16- %2 \n\
17+// %1 is used as anchors
18+// %2 is used as height of the container
19+// %3 is used as first child of the container
20+// %4 is used as second child of the container
21+var kHeader2ContainerCode = 'Item { \n\
22+ id: headerTitleContainer; \n\
23+ anchors { %1 } \n\
24+ width: parent.width - x; \n\
25+ implicitHeight: %2; \n\
26+ data: [ %3\n\
27+ ,\n\
28+ %4 \n\
29+ ] \n\
30+ }\n';
31+
32+// %1 is used as anchors
33+// %2 is used as first child of the container
34+// %3 is used as second child of the container
35+// %4 is used as third child of the container
36+var kHeader3ContainerCode = 'Item { \n\
37+ id: headerTitleContainer; \n\
38+ anchors { %1 } \n\
39+ width: parent.width - x; \n\
40+ implicitHeight: titleLabel.height + subtitleLabel.height; \n\
41+ data: [ %2\n\
42+ ,\n\
43+ %3 \n\
44+ ,\n\
45+ %4 \n\
46 ] \n\
47 }\n';
48
49@@ -224,7 +244,7 @@
50 }\n';
51
52 // %1 is used as anchors of titleLabel
53-// %1 is used as color of titleLabel
54+// %2 is used as color of titleLabel
55 // %3 is used as extra condition for visible of titleLabel
56 var kTitleLabelCode = 'Label { \n\
57 id: titleLabel; \n\
58@@ -242,12 +262,35 @@
59 horizontalAlignment: root.headerAlignment; \n\
60 }\n';
61
62+var kEmblemImageCode = 'Image { \n\
63+ id: emblemImage; \n\
64+ objectName: "emblemImage"; \n\
65+ anchors { \n\
66+ bottom: titleLabel.baseline; \n\
67+ right: parent.right; \n\ } \n\
68+ source: cardData && cardData["emblem"]; \n\
69+ width: height; \n\
70+ height: titleLabel.font.pixelSize; \n\
71+ fillMode: Image.PreserveAspectFit; \n\
72+ }\n';
73+
74+// %1 is used as anchors of touchdown effect
75+var kTouchdownCode = 'UbuntuShape { \n\
76+ id: touchdown; \n\
77+ objectName: "touchdown"; \n\
78+ anchors { %1 } \n\
79+ visible: root.pressed; \n\
80+ radius: "medium"; \n\
81+ borderSource: "radius_pressed.sci" \n\
82+ }\n';
83+
84 // %1 is used as anchors of subtitleLabel
85 // %2 is used as color of subtitleLabel
86 var kSubtitleLabelCode = 'Label { \n\
87 id: subtitleLabel; \n\
88 objectName: "subtitleLabel"; \n\
89 anchors { %1 } \n\
90+ anchors.topMargin: units.dp(2); \n\
91 elide: Text.ElideRight; \n\
92 fontSize: "small"; \n\
93 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\
94@@ -305,6 +348,7 @@
95 var hasBackground = !isHorizontal && (template["card-background"] || components["background"] || artAndSummary);
96 var hasTitle = components["title"] || false;
97 var hasMascot = components["mascot"] || false;
98+ var hasEmblem = components["emblem"] && !(hasMascot && template["card-size"] === "small") || false;
99 var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot);
100 var hasSubtitle = hasTitle && components["subtitle"] || false;
101 var hasHeaderRow = hasMascot && hasTitle;
102@@ -425,24 +469,44 @@
103
104 var titleAnchors;
105 var subtitleAnchors;
106- if (hasMascot && hasSubtitle) {
107- // Using row + column
108- titleAnchors = 'left: parent.left; right: parent.right';
109- subtitleAnchors = titleAnchors;
110+ var titleRightAnchor;
111+ var titleContainerAnchors;
112+
113+ if (hasMascot) {
114+ titleContainerAnchors = 'verticalCenter: parent.verticalCenter; ';
115+ } else {
116+ titleContainerAnchors = 'right: parent.right; ';
117+ titleContainerAnchors += headerLeftAnchor;
118+ titleContainerAnchors += headerVerticalAnchors;
119+ }
120+ if (hasEmblem) {
121+ titleRightAnchor = 'right: emblemImage.left;\n';
122+ } else {
123+ titleRightAnchor = 'right: parent.right;\n';
124+ }
125+
126+ if (hasEmblem || (hasMascot && hasSubtitle)) {
127+ // Using titleContainer (and maybe row)
128+ titleAnchors = titleRightAnchor;
129+ titleAnchors += 'left: parent.left;\n\
130+ top: parent.top;';
131+ subtitleAnchors = 'right: parent.right;\n\
132+ left: parent.left;\n\
133+ top: titleLabel.bottom;\n';
134 } else if (hasMascot) {
135- // Using row + label
136- titleAnchors = 'verticalCenter: parent.verticalCenter;\n'
137+ // Using row + titleContainer
138+ titleAnchors = 'verticalCenter: parent.verticalCenter;\n';
139 } else {
140 if (headerAsOverlay) {
141 // Using anchors to the overlay
142- titleAnchors = 'left: parent.left; \n\
143- leftMargin: units.gu(1); \n\
144- right: parent.right; \n\
145- top: overlayLoader.top; \n\
146- topMargin: units.gu(1);\n';
147+ titleAnchors = titleRightAnchor;
148+ titleAnchors += 'left: parent.left; \n\
149+ leftMargin: units.gu(1); \n\
150+ top: overlayLoader.top; \n\
151+ topMargin: units.gu(1);\n';
152 } else {
153 // Using anchors to the mascot/parent
154- titleAnchors = "right: parent.right;";
155+ titleAnchors = titleRightAnchor;
156 titleAnchors += headerLeftAnchor;
157 titleAnchors += headerVerticalAnchors;
158 if (!headerLeftAnchorHasMargin) {
159@@ -451,22 +515,34 @@
160 }
161 subtitleAnchors = 'left: titleLabel.left; \n\
162 leftMargin: titleLabel.leftMargin; \n\
163- right: titleLabel.right; \n\
164- top: titleLabel.bottom; \n\
165- topMargin: units.dp(2);\n';
166+ top: titleLabel.bottom;\n';
167+ if (hasEmblem) {
168+ // using container
169+ subtitleAnchors += 'right: parent.right; \n';
170+ } else {
171+ subtitleAnchors += 'right: titleLabel.right; \n';
172+ }
173 }
174
175 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
176- var titleCode = kTitleLabelCode.arg(titleAnchors).arg(color).arg(titleLabelVisibleExtra);
177+ var titleCode;
178+ titleCode = kTitleLabelCode.arg(titleAnchors).arg(color).arg(titleLabelVisibleExtra);
179 var subtitleCode = "";
180 if (hasSubtitle) {
181 subtitleCode += kSubtitleLabelCode.arg(subtitleAnchors).arg(color);
182 }
183
184- if (hasMascot && hasSubtitle) {
185- // If using row + column wrap the code in the column
186- titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
187+ if (hasEmblem && hasSubtitle) {
188+ // using container 3
189+ titleSubtitleCode = kHeader3ContainerCode.arg(titleContainerAnchors).arg(titleCode).arg(kEmblemImageCode).arg(kSubtitleLabelCode.arg(subtitleAnchors).arg(color));
190+ } else if (hasEmblem) {
191+ // container with emblem
192+ titleSubtitleCode = kHeader2ContainerCode.arg(titleContainerAnchors).arg('titleLabel.height').arg(titleCode).arg(kEmblemImageCode);
193+ } else if (hasMascot && hasSubtitle) {
194+ // container with subtitle
195+ titleSubtitleCode = kHeader2ContainerCode.arg(titleContainerAnchors).arg('titleLabel.height + subtitleLabel.height').arg(titleCode).arg(subtitleCode);
196 } else {
197+ // no container
198 titleSubtitleCode = titleCode + subtitleCode;
199 }
200 }
201@@ -486,6 +562,7 @@
202 if (isHorizontal && hasArt) summaryTopAnchor = "artShapeHolder.bottom";
203 else if (headerAsOverlay && hasArt) summaryTopAnchor = "artShapeHolder.bottom";
204 else if (hasHeaderRow) summaryTopAnchor = "row.bottom";
205+ else if (hasEmblem || (hasMascot && hasSubtitle)) summaryTopAnchor = "headerTitleContainer.bottom";
206 else if (hasMascot) summaryTopAnchor = "mascotImage.bottom";
207 else if (hasSubtitle) summaryTopAnchor = "subtitleLabel.bottom";
208 else if (hasTitle) summaryTopAnchor = "titleLabel.bottom";
209@@ -504,6 +581,16 @@
210 code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(color);
211 }
212
213+ var touchdownAnchors;
214+ if (hasBackground) {
215+ touchdownAnchors = 'fill: backgroundLoader';
216+ } else if (hasArt && !hasMascot && !hasSummary) {
217+ touchdownAnchors = 'fill: artShapeHolder';
218+ } else {
219+ touchdownAnchors = 'fill: root'
220+ }
221+ code += kTouchdownCode.arg(touchdownAnchors);
222+
223 if (hasSummary) {
224 code += 'implicitHeight: summary.y + summary.height + (summary.text ? units.gu(1) : 0);\n';
225 } else if (hasHeaderRow) {
226
227=== modified file 'tests/plugins/Dash/cardcreator/1.res'
228--- tests/plugins/Dash/cardcreator/1.res 2014-07-08 12:37:34 +0000
229+++ tests/plugins/Dash/cardcreator/1.res 2014-07-29 11:22:19 +0000
230@@ -82,5 +82,13 @@
231 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
232 horizontalAlignment: root.headerAlignment;
233 }
234+UbuntuShape {
235+ id: touchdown;
236+ objectName: "touchdown";
237+ anchors { fill: artShapeHolder }
238+ visible: root.pressed;
239+ radius: "medium";
240+ borderSource: "radius_pressed.sci"
241+}
242 implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
243 }
244
245=== modified file 'tests/plugins/Dash/cardcreator/2.res'
246--- tests/plugins/Dash/cardcreator/2.res 2014-07-08 12:53:51 +0000
247+++ tests/plugins/Dash/cardcreator/2.res 2014-07-29 11:22:19 +0000
248@@ -113,5 +113,13 @@
249 }
250 ]
251 }
252+UbuntuShape {
253+ id: touchdown;
254+ objectName: "touchdown";
255+ anchors { fill: backgroundLoader }
256+ visible: root.pressed;
257+ radius: "medium";
258+ borderSource: "radius_pressed.sci"
259+}
260 implicitHeight: row.y + row.height + units.gu(1);
261 }
262
263=== modified file 'tests/plugins/Dash/cardcreator/3.res'
264--- tests/plugins/Dash/cardcreator/3.res 2014-07-08 12:37:34 +0000
265+++ tests/plugins/Dash/cardcreator/3.res 2014-07-29 11:22:19 +0000
266@@ -100,5 +100,13 @@
267 font.weight: Font.Light;
268 horizontalAlignment: root.headerAlignment;
269 }
270+UbuntuShape {
271+ id: touchdown;
272+ objectName: "touchdown";
273+ anchors { fill: artShapeHolder }
274+ visible: root.pressed;
275+ radius: "medium";
276+ borderSource: "radius_pressed.sci"
277+}
278 implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
279 }
280
281=== modified file 'tests/plugins/Dash/cardcreator/4.res'
282--- tests/plugins/Dash/cardcreator/4.res 2014-07-08 12:37:34 +0000
283+++ tests/plugins/Dash/cardcreator/4.res 2014-07-29 11:22:19 +0000
284@@ -94,5 +94,13 @@
285 }
286 ]
287 }
288+UbuntuShape {
289+ id: touchdown;
290+ objectName: "touchdown";
291+ anchors { fill: root }
292+ visible: root.pressed;
293+ radius: "medium";
294+ borderSource: "radius_pressed.sci"
295+}
296 implicitHeight: row.y + row.height + units.gu(1);
297 }
298
299=== modified file 'tests/plugins/Dash/cardcreator/5.res'
300--- tests/plugins/Dash/cardcreator/5.res 2014-07-08 12:37:34 +0000
301+++ tests/plugins/Dash/cardcreator/5.res 2014-07-29 11:22:19 +0000
302@@ -141,5 +141,13 @@
303 font.weight: Font.Light;
304 horizontalAlignment: root.headerAlignment;
305 }
306+UbuntuShape {
307+ id: touchdown;
308+ objectName: "touchdown";
309+ anchors { fill: artShapeHolder }
310+ visible: root.pressed;
311+ radius: "medium";
312+ borderSource: "radius_pressed.sci"
313+}
314 implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
315 }
316
317=== modified file 'tests/plugins/Dash/cardcreator/6.res'
318--- tests/plugins/Dash/cardcreator/6.res 2014-07-10 18:03:16 +0000
319+++ tests/plugins/Dash/cardcreator/6.res 2014-07-29 11:22:19 +0000
320@@ -63,5 +63,13 @@
321 }
322 }
323 readonly property int headerHeight: 0;
324+UbuntuShape {
325+ id: touchdown;
326+ objectName: "touchdown";
327+ anchors { fill: artShapeHolder }
328+ visible: root.pressed;
329+ radius: "medium";
330+ borderSource: "radius_pressed.sci"
331+}
332 implicitHeight: artShapeHolder.height;
333 }
334
335=== modified file 'tests/plugins/Dash/cardcreatortest.cpp'
336--- tests/plugins/Dash/cardcreatortest.cpp 2014-05-06 13:09:08 +0000
337+++ tests/plugins/Dash/cardcreatortest.cpp 2014-07-29 11:22:19 +0000
338@@ -19,6 +19,7 @@
339 #include <QQuickItem>
340 #include <QQuickView>
341 #include <QtTestGui>
342+#include <QDebug>
343
344 class CardCreatorTest : public QObject
345 {
346@@ -73,8 +74,11 @@
347 QFile testResultFile(testDirPath + resultFileName);
348 QVERIFY(testResultFile.open(QIODevice::ReadOnly));
349 QTextStream ts2(&testResultFile);
350- const QString expectedResult = ts2.readAll();
351- QCOMPARE(cardStringResult.toString().simplified(), expectedResult.simplified());
352+ const QStringList expectedLines = ts2.readAll().trimmed().replace(QRegExp("\n\\s*\n"),"\n").split("\n");
353+ const QStringList cardStringResultLines = cardStringResult.toString().trimmed().replace(QRegExp("\n\\s*\n"),"\n").split("\n");
354+ for (int i = 0; i < expectedLines.size(); ++i) {
355+ QCOMPARE(cardStringResultLines[i].simplified(), expectedLines[i].simplified());
356+ }
357
358 QVariant createCardComponentResult;
359 QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON));
360
361=== modified file 'tests/qmltests/Dash/CardHelpers.js'
362--- tests/qmltests/Dash/CardHelpers.js 2014-02-04 18:14:07 +0000
363+++ tests/qmltests/Dash/CardHelpers.js 2014-07-29 11:22:19 +0000
364@@ -59,6 +59,7 @@
365 "art": "art", \
366 "subtitle": "subtitle", \
367 "mascot": "mascot", \
368+ "emblem": "emblem", \
369 "summary": "summary" \
370 }'
371
372
373=== modified file 'tests/qmltests/Dash/tst_Card.qml'
374--- tests/qmltests/Dash/tst_Card.qml 2014-06-27 08:47:04 +0000
375+++ tests/qmltests/Dash/tst_Card.qml 2014-07-29 11:22:19 +0000
376@@ -31,6 +31,7 @@
377 {
378 "art": "../../../tests/qmltests/Dash/artwork/music-player-design.png",
379 "mascot": "../../../tests/qmltests/Dash/artwork/avatar.png",
380+ "emblem": "../../../tests/qmltests/Dash/artwork/emblem.png",
381 "title": "foo",
382 "subtitle": "bar",
383 "summary": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
384@@ -456,6 +457,23 @@
385 tryCompareFunction(function() { return Qt.colorEqual(subtitle.color, fontColor); }, true);
386 }
387
388+ function test_emblemImage_data() {
389+ return [
390+ { tag: "Art and summary", emblem: true, index: 0 },
391+ { tag: "Art and summary, small", emblem: false, index: 1 },
392+ { tag: "No header", emblem: false, index: 7 },
393+ { tag: "With background", emblem: true, index: 10 },
394+ ];
395+ }
396+
397+ function test_emblemImage(data) {
398+ selector.selectedIndex = data.index;
399+ waitForRendering(card);
400+
401+ var emblemImage = findChild(card, "emblemImage");
402+ compare(emblemImage !== null, data.emblem);
403+ }
404+
405 function test_mascotShape_data() {
406 return [
407 { tag: "Art and summary", shape: false, index: 0 },
408@@ -473,5 +491,17 @@
409 compare(shape !== null, data.shape);
410 tryCompare(mascotImage, "visible", !data.shape);
411 }
412+
413+ function test_touchdown_visibility() {
414+ selector.selectedIndex = 0;
415+
416+ var touchdown = findChild(card, "touchdown");
417+
418+ compare(touchdown.visible, false);
419+ mousePress(card, card.width/2, card.height/2);
420+ compare(touchdown.visible, true);
421+ mouseRelease(card, card.width/2, card.height/2);
422+ compare(touchdown.visible, false);
423+ }
424 }
425 }

Subscribers

People subscribed via source and target branches