Merge lp:~unity-team/unity8/card-visual-tweaks into lp:unity8

Proposed by Michał Sawicz
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 1243
Merged at revision: 1323
Proposed branch: lp:~unity-team/unity8/card-visual-tweaks
Merge into: lp:unity8
Prerequisite: lp:~unity-team/unity8/scopes_more_things_on_memory
Diff against target: 556 lines (+88/-94)
16 files modified
plugins/Dash/CardAttributes.qml (+1/-1)
plugins/Dash/CardCreator.js (+6/-7)
qml/Dash/CardGrid.qml (+1/-1)
qml/Dash/CardHorizontalList.qml (+1/-1)
qml/Dash/CardTool.qml (+19/-14)
qml/Dash/CardVerticalJournal.qml (+1/-1)
qml/Dash/ScopesOverviewFavorites.qml (+1/-1)
tests/plugins/Dash/cardcreator/1.res (+3/-3)
tests/plugins/Dash/cardcreator/2.res (+4/-5)
tests/plugins/Dash/cardcreator/3.res (+4/-5)
tests/plugins/Dash/cardcreator/4.res (+4/-5)
tests/plugins/Dash/cardcreator/5.res (+4/-5)
tests/plugins/Dash/cardcreator/6.res (+5/-7)
tests/plugins/Dash/cardcreator/7.res (+4/-5)
tests/qmltests/Dash/CardHelpers.js (+1/-12)
tests/qmltests/Dash/tst_CardTool.qml (+29/-21)
To merge this branch: bzr merge lp:~unity-team/unity8/card-visual-tweaks
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
Albert Astals Cid (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+234332@code.launchpad.net

This proposal supersedes a proposal from 2014-09-04.

Commit message

Tweak card header to match the spec

- title is Medium only if subtitle is non-empty
- title is only centered if explicitly requested by the scope ("align": "center" in components)
- subtitle is x-small
- highlighted attribute is Bold
- emblem is allowed non-square

Description of the change

* Are there any related MPs required for this MP to build/function as expected? Please list.

** All scopes that want center alignment need to adapt **
See bug #1365549

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Y
 * Did you make sure that your branch does not contain spurious tags?
Y
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
 * If you changed the UI, has there been a design review?
This comes from design, see the referenced bugs.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Alejandro J. Cura (alecu) wrote : Posted in a previous version of this proposal

Tested the debs produced by jenkins on mako, it looks much nicer overall, but the title is still centered by default.

I'm attaching a screenshot to show this.

review: Needs Fixing
Revision history for this message
Alejandro J. Cura (alecu) wrote : Posted in a previous version of this proposal
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Wayne (cwayne) wrote : Posted in a previous version of this proposal

I've verified that this makes rectangular emblems look *much* better, but I'm still seeing the titles centered by default as well

Revision history for this message
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal

Yeah, shouldn't have worked so late... Fixed the tests and alignment, as well as the single-line enforcing, even though I expect we won't be doing that in the end.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Wayne (cwayne) wrote : Posted in a previous version of this proposal

Verified that emblems look better + Titles are now left-aligned as expected

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
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
Michał Sawicz (saviq) wrote :

Changing to WiP until all the scopes get updated.

Revision history for this message
Alejandro J. Cura (alecu) wrote :

The spec for this has been updated, and left align is no longer the default for "only title" cards.

So, there seems to be no need for other scopes to be changed and it's likely that this branch needs some fixing to account for that.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

The adb host failed during the most recent test run, the unity8-ci job has been restarted.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

If i run this on current distro i get the apps scope left aligned that i understand is nto what we want, is there a needed dependency missing or something?

review: Needs Information
Revision history for this message
Albert Astals Cid (aacid) wrote :

For reference see http://i.imgur.com/rDTSHKS.png

"Gestor de archivos" doesn't look very nice in my opinion

1242. By Andrea Cimitan

Updated alignment

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1243. By Andrea Cimitan

merged

Revision history for this message
Albert Astals Cid (aacid) wrote :

Code looks good, waiting on CI to run to see the qmluitests look good and also to get an easy to test deb for the phone

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass? If not, please explain why.
No, known broken things

 * Did you make sure that the branch does not contain spurious tags?
Yes

review: Approve
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Tested on mako, rtm image #64, installed apps scope and store scope both look lovely with this branch.

review: Approve
Revision history for this message
Michał Sawicz (saviq) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Dash/CardAttributes.qml'
2--- plugins/Dash/CardAttributes.qml 2014-08-16 12:41:11 +0000
3+++ plugins/Dash/CardAttributes.qml 2014-09-30 09:23:55 +0000
4@@ -59,7 +59,7 @@
5 text: "value" in modelData && modelData["value"] || "";
6 elide: Text.ElideRight
7 maximumLineCount: 1
8- font.weight: "style" in modelData && modelData["style"] == "highlighted" ? Font.DemiBold : Font.Light
9+ font.weight: "style" in modelData && modelData["style"] === "highlighted" ? Font.Bold : Font.Light
10 fontSize: "small"
11 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
12 color: grid.color
13
14=== modified file 'plugins/Dash/CardCreator.js'
15--- plugins/Dash/CardCreator.js 2014-09-30 09:23:55 +0000
16+++ plugins/Dash/CardCreator.js 2014-09-30 09:23:55 +0000
17@@ -222,13 +222,13 @@
18 color: %2; \n\
19 visible: showHeader %3; \n\
20 text: root.title; \n\
21- font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; \n\
22- horizontalAlignment: root.headerAlignment; \n\
23+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; \n\
24+ horizontalAlignment: root.titleAlignment; \n\
25 }\n';
26
27 // %1 is used as extra anchors of emblemIcon
28 // %2 is used as color of emblemIcon
29-var kEmblemIconCode = 'Icon { \n\
30+var kEmblemIconCode = 'StatusIcon { \n\
31 id: emblemIcon; \n\
32 objectName: "emblemIcon"; \n\
33 anchors { \n\
34@@ -238,7 +238,6 @@
35 } \n\
36 source: cardData && cardData["emblem"] || ""; \n\
37 color: %2; \n\
38- width: height; \n\
39 height: source != "" ? titleLabel.font.pixelSize : 0; \n\
40 }\n';
41
42@@ -260,13 +259,12 @@
43 anchors { %1 } \n\
44 anchors.topMargin: units.dp(2); \n\
45 elide: Text.ElideRight; \n\
46- fontSize: "small"; \n\
47+ fontSize: "x-small"; \n\
48 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\
49 color: %2; \n\
50 visible: titleLabel.visible && titleLabel.text; \n\
51 text: cardData && cardData["subtitle"] || ""; \n\
52 font.weight: Font.Light; \n\
53- horizontalAlignment: root.headerAlignment; \n\
54 }\n';
55
56 // %1 is used as anchors of attributesRow
57@@ -312,7 +310,7 @@
58 property var artShapeBorderSource: undefined; \n\
59 property real fontScale: 1.0; \n\
60 property var scopeStyle: null; \n\
61- property int headerAlignment: Text.AlignLeft; \n\
62+ property int titleAlignment: Text.AlignLeft; \n\
63 property int fixedHeaderHeight: -1; \n\
64 property size fixedArtShapeSize: Qt.size(-1, -1); \n\
65 readonly property string title: cardData && cardData["title"] || ""; \n\
66@@ -657,6 +655,7 @@
67 function createCardComponent(parent, template, components) {
68 var imports = 'import QtQuick 2.2; \n\
69 import Ubuntu.Components 1.1; \n\
70+ import Ubuntu.Settings.Components 0.1; \n\
71 import Ubuntu.Connectivity 1.0; \n\
72 import Dash 0.1;\n\
73 import Utils 0.1;\n';
74
75=== modified file 'qml/Dash/CardGrid.qml'
76--- qml/Dash/CardGrid.qml 2014-09-30 09:23:55 +0000
77+++ qml/Dash/CardGrid.qml 2014-09-30 09:23:55 +0000
78@@ -69,7 +69,7 @@
79 item.cardData = Qt.binding(function() { return model; });
80 item.template = Qt.binding(function() { return cardTool.template; });
81 item.components = Qt.binding(function() { return cardTool.components; });
82- item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
83+ item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
84 item.scopeStyle = root.scopeStyle;
85 }
86 Connections {
87
88=== modified file 'qml/Dash/CardHorizontalList.qml'
89--- qml/Dash/CardHorizontalList.qml 2014-09-12 09:31:56 +0000
90+++ qml/Dash/CardHorizontalList.qml 2014-09-30 09:23:55 +0000
91@@ -49,7 +49,7 @@
92 item.cardData = Qt.binding(function() { return model; });
93 item.template = Qt.binding(function() { return cardTool.template; });
94 item.components = Qt.binding(function() { return cardTool.components; });
95- item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
96+ item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
97 item.scopeStyle = root.scopeStyle;
98 }
99 Connections {
100
101=== modified file 'qml/Dash/CardTool.qml'
102--- qml/Dash/CardTool.qml 2014-09-30 09:23:55 +0000
103+++ qml/Dash/CardTool.qml 2014-09-30 09:23:55 +0000
104@@ -131,21 +131,26 @@
105 property size artShapeSize: cardLoader.item ? cardLoader.item.artShapeSize : 0
106
107 /*!
108- \brief Desired alignment of header components.
109+ \brief Desired alignment of title
110 */
111- readonly property int headerAlignment: {
112- var subtitle = components["subtitle"];
113- var price = components["price"];
114- var summary = components["summary"];
115-
116- var hasSubtitle = subtitle && (typeof subtitle === "string" || subtitle["field"])
117- var hasPrice = price && (typeof price === "string" || subtitle["field"]);
118- var hasSummary = summary && (typeof summary === "string" || summary["field"])
119-
120- var isOnlyTextComponent = !hasSubtitle && !hasPrice && !hasSummary;
121- if (!isOnlyTextComponent) return Text.AlignLeft;
122-
123- return (template["card-layout"] === "horizontal") ? Text.AlignLeft : Text.AlignHCenter;
124+ readonly property int titleAlignment: {
125+ if (template["card-layout"] === "horizontal"
126+ || (typeof components["title"] !== "object" &&
127+ components["title"]["align"] !== "center")) return Text.AlignLeft;
128+
129+ var keys = ["mascot", "emblem", "subtitle", "attributes", "summary"];
130+
131+ for (var key in keys) {
132+ key = keys[key];
133+ try {
134+ if (typeof components[key] === "string"
135+ || typeof components[key]["field"] === "string") return Text.AlignLeft;
136+ } catch (e) {
137+ continue;
138+ }
139+ }
140+
141+ return Text.AlignHCenter;
142 }
143
144 QtObject {
145
146=== modified file 'qml/Dash/CardVerticalJournal.qml'
147--- qml/Dash/CardVerticalJournal.qml 2014-09-30 09:23:55 +0000
148+++ qml/Dash/CardVerticalJournal.qml 2014-09-30 09:23:55 +0000
149@@ -57,7 +57,7 @@
150 item.cardData = Qt.binding(function() { return model; });
151 item.template = Qt.binding(function() { return cardTool.template; });
152 item.components = Qt.binding(function() { return cardTool.components; });
153- item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
154+ item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
155 item.scopeStyle = root.scopeStyle;
156 }
157 Connections {
158
159=== modified file 'qml/Dash/ScopesOverviewFavorites.qml'
160--- qml/Dash/ScopesOverviewFavorites.qml 2014-07-30 10:14:35 +0000
161+++ qml/Dash/ScopesOverviewFavorites.qml 2014-09-30 09:23:55 +0000
162@@ -61,7 +61,7 @@
163 item.cardData = Qt.binding(function() { return model; });
164 item.template = Qt.binding(function() { return cardTool.template; });
165 item.components = Qt.binding(function() { return cardTool.components; });
166- item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
167+ item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
168 }
169
170 Connections {
171
172=== modified file 'tests/plugins/Dash/cardcreator/1.res'
173--- tests/plugins/Dash/cardcreator/1.res 2014-09-30 09:23:55 +0000
174+++ tests/plugins/Dash/cardcreator/1.res 2014-09-30 09:23:55 +0000
175@@ -6,7 +6,7 @@
176 property var artShapeBorderSource: undefined;
177 property real fontScale: 1.0;
178 property var scopeStyle: null;
179- property int headerAlignment: Text.AlignLeft;
180+ property int titleAlignment: Text.AlignLeft;
181 property int fixedHeaderHeight: -1;
182 property size fixedArtShapeSize: Qt.size(-1, -1);
183 readonly property string title: cardData && cardData["title"] || "";
184@@ -74,8 +74,8 @@
185 color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
186 visible: showHeader ;
187 text: root.title;
188- font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
189- horizontalAlignment: root.headerAlignment;
190+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
191+ horizontalAlignment: root.titleAlignment;
192 }
193 UbuntuShape {
194 id: touchdown;
195
196=== modified file 'tests/plugins/Dash/cardcreator/2.res'
197--- tests/plugins/Dash/cardcreator/2.res 2014-09-30 09:23:55 +0000
198+++ tests/plugins/Dash/cardcreator/2.res 2014-09-30 09:23:55 +0000
199@@ -6,7 +6,7 @@
200 property var artShapeBorderSource: undefined;
201 property real fontScale: 1.0;
202 property var scopeStyle: null;
203- property int headerAlignment: Text.AlignLeft;
204+ property int titleAlignment: Text.AlignLeft;
205 property int fixedHeaderHeight: -1;
206 property size fixedArtShapeSize: Qt.size(-1, -1);
207 readonly property string title: cardData && cardData["title"] || "";
208@@ -98,8 +98,8 @@
209 color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
210 visible: showHeader ;
211 text: root.title;
212- font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
213- horizontalAlignment: root.headerAlignment;
214+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
215+ horizontalAlignment: root.titleAlignment;
216 }
217 ,Label {
218 id: subtitleLabel;
219@@ -111,13 +111,12 @@
220 }
221 anchors.topMargin: units.dp(2);
222 elide: Text.ElideRight;
223- fontSize: "small";
224+ fontSize: "x-small";
225 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
226 color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
227 visible: titleLabel.visible && titleLabel.text;
228 text: cardData && cardData["subtitle"] || "";
229 font.weight: Font.Light;
230- horizontalAlignment: root.headerAlignment;
231 }
232
233 ]
234
235=== modified file 'tests/plugins/Dash/cardcreator/3.res'
236--- tests/plugins/Dash/cardcreator/3.res 2014-09-30 09:23:55 +0000
237+++ tests/plugins/Dash/cardcreator/3.res 2014-09-30 09:23:55 +0000
238@@ -6,7 +6,7 @@
239 property var artShapeBorderSource: undefined;
240 property real fontScale: 1.0;
241 property var scopeStyle: null;
242- property int headerAlignment: Text.AlignLeft;
243+ property int titleAlignment: Text.AlignLeft;
244 property int fixedHeaderHeight: -1;
245 property size fixedArtShapeSize: Qt.size(-1, -1);
246 readonly property string title: cardData && cardData["title"] || "";
247@@ -74,8 +74,8 @@
248 color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
249 visible: showHeader ;
250 text: root.title;
251- font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
252- horizontalAlignment: root.headerAlignment;
253+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
254+ horizontalAlignment: root.titleAlignment;
255 }
256 Label {
257 id: subtitleLabel;
258@@ -87,13 +87,12 @@
259 }
260 anchors.topMargin: units.dp(2);
261 elide: Text.ElideRight;
262- fontSize: "small";
263+ fontSize: "x-small";
264 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
265 color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
266 visible: titleLabel.visible && titleLabel.text;
267 text: cardData && cardData["subtitle"] || "";
268 font.weight: Font.Light;
269- horizontalAlignment: root.headerAlignment;
270 }
271 UbuntuShape {
272 id: touchdown;
273
274=== modified file 'tests/plugins/Dash/cardcreator/4.res'
275--- tests/plugins/Dash/cardcreator/4.res 2014-09-30 09:23:55 +0000
276+++ tests/plugins/Dash/cardcreator/4.res 2014-09-30 09:23:55 +0000
277@@ -6,7 +6,7 @@
278 property var artShapeBorderSource: undefined;
279 property real fontScale: 1.0;
280 property var scopeStyle: null;
281- property int headerAlignment: Text.AlignLeft;
282+ property int titleAlignment: Text.AlignLeft;
283 property int fixedHeaderHeight: -1;
284 property size fixedArtShapeSize: Qt.size(-1, -1);
285 readonly property string title: cardData && cardData["title"] || "";
286@@ -78,8 +78,8 @@
287 color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
288 visible: showHeader ;
289 text: root.title;
290- font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
291- horizontalAlignment: root.headerAlignment;
292+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
293+ horizontalAlignment: root.titleAlignment;
294 }
295 ,Label {
296 id: subtitleLabel;
297@@ -91,13 +91,12 @@
298 }
299 anchors.topMargin: units.dp(2);
300 elide: Text.ElideRight;
301- fontSize: "small";
302+ fontSize: "x-small";
303 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
304 color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
305 visible: titleLabel.visible && titleLabel.text;
306 text: cardData && cardData["subtitle"] || "";
307 font.weight: Font.Light;
308- horizontalAlignment: root.headerAlignment;
309 }
310 ]
311 }
312
313=== modified file 'tests/plugins/Dash/cardcreator/5.res'
314--- tests/plugins/Dash/cardcreator/5.res 2014-09-30 09:23:55 +0000
315+++ tests/plugins/Dash/cardcreator/5.res 2014-09-30 09:23:55 +0000
316@@ -6,7 +6,7 @@
317 property var artShapeBorderSource: undefined;
318 property real fontScale: 1.0;
319 property var scopeStyle: null;
320- property int headerAlignment: Text.AlignLeft;
321+ property int titleAlignment: Text.AlignLeft;
322 property int fixedHeaderHeight: -1;
323 property size fixedArtShapeSize: Qt.size(-1, -1);
324 readonly property string title: cardData && cardData["title"] || "";
325@@ -118,8 +118,8 @@
326 color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
327 visible: showHeader && overlayLoader.active;
328 text: root.title;
329- font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
330- horizontalAlignment: root.headerAlignment;
331+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
332+ horizontalAlignment: root.titleAlignment;
333 }
334 Label {
335 id: subtitleLabel;
336@@ -132,13 +132,12 @@
337 }
338 anchors.topMargin: units.dp(2);
339 elide: Text.ElideRight;
340- fontSize: "small";
341+ fontSize: "x-small";
342 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
343 color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
344 visible: titleLabel.visible && titleLabel.text;
345 text: cardData && cardData["subtitle"] || "";
346 font.weight: Font.Light;
347- horizontalAlignment: root.headerAlignment;
348 }
349 UbuntuShape {
350 id: touchdown;
351
352=== modified file 'tests/plugins/Dash/cardcreator/6.res'
353--- tests/plugins/Dash/cardcreator/6.res 2014-08-29 08:31:22 +0000
354+++ tests/plugins/Dash/cardcreator/6.res 2014-09-30 09:23:55 +0000
355@@ -6,7 +6,7 @@
356 property var artShapeBorderSource: undefined;
357 property real fontScale: 1.0;
358 property var scopeStyle: null;
359- property int headerAlignment: Text.AlignLeft;
360+ property int titleAlignment: Text.AlignLeft;
361 property int fixedHeaderHeight: -1;
362 property size fixedArtShapeSize: Qt.size(-1, -1);
363 readonly property string title: cardData && cardData["title"] || "";
364@@ -73,8 +73,8 @@
365 color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
366 visible: showHeader ;
367 text: root.title;
368- font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
369- horizontalAlignment: root.headerAlignment;
370+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
371+ horizontalAlignment: root.titleAlignment;
372 }
373 ,Label {
374 id: subtitleLabel;
375@@ -86,15 +86,14 @@
376 }
377 anchors.topMargin: units.dp(2);
378 elide: Text.ElideRight;
379- fontSize: "small";
380+ fontSize: "x-small";
381 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
382 color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
383 visible: titleLabel.visible && titleLabel.text;
384 text: cardData && cardData["subtitle"] || "";
385 font.weight: Font.Light;
386- horizontalAlignment: root.headerAlignment;
387 }
388-,Icon {
389+,StatusIcon {
390 id: emblemIcon;
391 objectName: "emblemIcon";
392 anchors {
393@@ -104,7 +103,6 @@
394 }
395 source: cardData && cardData["emblem"] || "";
396 color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
397- width: height;
398 height: source != "" ? titleLabel.font.pixelSize : 0;
399 }
400
401
402=== modified file 'tests/plugins/Dash/cardcreator/7.res'
403--- tests/plugins/Dash/cardcreator/7.res 2014-09-30 09:23:55 +0000
404+++ tests/plugins/Dash/cardcreator/7.res 2014-09-30 09:23:55 +0000
405@@ -6,7 +6,7 @@
406 property var artShapeBorderSource: undefined;
407 property real fontScale: 1.0;
408 property var scopeStyle: null;
409- property int headerAlignment: Text.AlignLeft;
410+ property int titleAlignment: Text.AlignLeft;
411 property int fixedHeaderHeight: -1;
412 property size fixedArtShapeSize: Qt.size(-1, -1);
413 readonly property string title: cardData && cardData["title"] || "";
414@@ -99,8 +99,8 @@
415 color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
416 visible: showHeader ;
417 text: root.title;
418- font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
419- horizontalAlignment: root.headerAlignment;
420+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
421+ horizontalAlignment: root.titleAlignment;
422 }
423 ,Label {
424 id: subtitleLabel;
425@@ -112,13 +112,12 @@
426 }
427 anchors.topMargin: units.dp(2);
428 elide: Text.ElideRight;
429- fontSize: "small";
430+ fontSize: "x-small";
431 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
432 color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
433 visible: titleLabel.visible && titleLabel.text;
434 text: cardData && cardData["subtitle"] || "";
435 font.weight: Font.Light;
436- horizontalAlignment: root.headerAlignment;
437 }
438 ,CardAttributes {
439 id: attributesRow;
440
441=== modified file 'tests/qmltests/Dash/CardHelpers.js'
442--- tests/qmltests/Dash/CardHelpers.js 2014-08-08 14:56:53 +0000
443+++ tests/qmltests/Dash/CardHelpers.js 2014-09-30 09:23:55 +0000
444@@ -16,7 +16,7 @@
445
446 .pragma library
447
448-var components = ["title", "art", "subtitle", "mascot", "emblem", "old-price", "price", "alt-price", "rating", "alt-rating", "summary", "attributes", "overlayColor"]
449+var components = ["title", "art", "subtitle", "mascot", "emblem", "summary", "attributes", "overlayColor"]
450
451 var defaultLayout = ' \
452 { \
453@@ -37,17 +37,6 @@
454 "overlayColor": null, \
455 "mascot": null, \
456 "emblem": null, \
457- "old-price": null, \
458- "price": null, \
459- "alt-price": null, \
460- "rating": { \
461- "type": "stars", \
462- "range": [0, 5], \
463- "full": "image://theme/rating-star-full", \
464- "half": "image://theme/rating-star-half", \
465- "empty": "image://theme/rating-star-empty" \
466- }, \
467- "alt-rating": null, \
468 "summary": null, \
469 "attributes": { "max-count": 2 } \
470 }, \
471
472=== modified file 'tests/qmltests/Dash/tst_CardTool.qml'
473--- tests/qmltests/Dash/tst_CardTool.qml 2014-08-14 23:07:21 +0000
474+++ tests/qmltests/Dash/tst_CardTool.qml 2014-09-30 09:23:55 +0000
475@@ -85,8 +85,8 @@
476 "layout": { "template": { "card-layout": "vertical" }, "components": { "title": "title", "subtitle": "subtitle" } }
477 },
478 {
479- "name": "Title, price - horizontal",
480- "layout": { "template": { "card-layout": "horizontal" }, "components": { "title": "title", "price": "price" } }
481+ "name": "Title, attributes - horizontal",
482+ "layout": { "template": { "card-layout": "horizontal" }, "components": { "title": "title", "attributes": "attributes" } }
483 },
484 ]
485
486@@ -100,6 +100,7 @@
487 }
488
489 Column {
490+ id: column
491 width: units.gu(38)
492 anchors { left: parent.left; top: parent.top; margins: units.gu(1) }
493
494@@ -111,7 +112,7 @@
495 ]
496
497 delegate: Row {
498- anchors { left: parent.left; right: parent.right; margins: units.gu(3) }
499+ anchors { left: column.left; right: column.right; margins: units.gu(3) }
500
501 Label {
502 height: units.gu(5)
503@@ -315,28 +316,35 @@
504 }
505 }
506
507- function test_card_header_component_alignment_data() {
508+ function test_card_title_alignment_data() {
509 return [
510- { tag: "Title - vertical", component: "titleLabel", property: "headerAlignment",
511- value: Text.AlignHCenter, index: 11, layout_index: 0 },
512- { tag: "Title - horizontal", component: "titleLabel", property: "headerAlignment",
513- value: Text.AlignLeft, index: 12, layout_index: 0},
514- { tag: "Title, subtitle - vertical", component: "titleLabel", property: "headerAlignment",
515- value: Text.AlignLeft, index: 13, layout_index: 0},
516- { tag: "Title, price - horizontal", component: "titleLabel", property: "headerAlignment",
517- value: Text.AlignLeft, index: 14, layout_index: 0},
518- ]
519+ { tag: "Art, header, summary", value: Text.AlignLeft, index: 0 },
520+ { tag: "Header, summary", value: Text.AlignLeft, index: 1 },
521+ { tag: "Art, header", value: Text.AlignLeft, index: 2 },
522+ { tag: "Header only", value: Text.AlignLeft, index: 3 },
523+ { tag: "Header title only", value: Text.AlignHCenter, index: 4 },
524+ { tag: "Header title and subtitle", value: Text.AlignLeft, index: 5 },
525+ { tag: "Header title and mascot", value: Text.AlignLeft, index: 6 },
526+ { tag: "Art, header, summary - small", value: Text.AlignLeft, index: 7 },
527+ { tag: "Art, header, summary - large", value: Text.AlignLeft, index: 8 },
528+ { tag: "Art, header, summary - horizontal", value: Text.AlignLeft, index: 9 },
529+ { tag: "Art, header - portrait", value: Text.AlignLeft, index: 10 },
530+ { tag: "Title - vertical", value: Text.AlignHCenter, index: 11 },
531+ { tag: "Title - horizontal", value: Text.AlignLeft, index: 12 },
532+ { tag: "Title, subtitle - vertical", value: Text.AlignLeft, index: 13 },
533+ { tag: "Title, attributes - horizontal", value: Text.AlignLeft, index: 14 },
534+ ];
535 }
536
537- function test_card_header_component_alignment(data) {
538+ function test_card_title_alignment(data) {
539 selector.selectedIndex = data.index;
540- if (data.hasOwnProperty("layout_index")) {
541- layoutSelector.selectedIndex = data.layout_index;
542- }
543-
544- if (data.hasOwnProperty("property")) {
545- tryCompare(cardTool, data.property, data.value);
546- }
547+
548+ tryCompare(cardTool, "titleAlignment", Text.AlignLeft);
549+
550+ cardTool.components['title'] = { "field": "title", "align": "center" };
551+ cardTool.componentsChanged();
552+
553+ tryCompare(cardTool, "titleAlignment", data.value);
554 }
555
556 function test_categoryLayout_data() {

Subscribers

People subscribed via source and target branches