Merge lp:~aacid/unity8/fixTodayScope into lp:unity8

Proposed by Albert Astals Cid on 2015-06-22
Status: Merged
Approved by: Andrea Cimitan on 2015-07-01
Approved revision: 1825
Merged at revision: 1840
Proposed branch: lp:~aacid/unity8/fixTodayScope
Merge into: lp:unity8
Diff against target: 255 lines (+119/-3)
10 files modified
plugins/Dash/CardCreator.js (+7/-3)
tests/plugins/Dash/cardcreator/1.res (+1/-0)
tests/plugins/Dash/cardcreator/2.res (+1/-0)
tests/plugins/Dash/cardcreator/3.res (+1/-0)
tests/plugins/Dash/cardcreator/4.res (+1/-0)
tests/plugins/Dash/cardcreator/5.res (+1/-0)
tests/plugins/Dash/cardcreator/6.res (+1/-0)
tests/plugins/Dash/cardcreator/7.res (+1/-0)
tests/plugins/Dash/cardcreator/8.res (+102/-0)
tests/plugins/Dash/cardcreator/8.tst (+3/-0)
To merge this branch: bzr merge lp:~aacid/unity8/fixTodayScope
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) 2015-06-23 Approve on 2015-07-01
PS Jenkins bot continuous-integration Needs Fixing on 2015-06-22
Unity Team 2015-06-22 Pending
Review via email: mp+262564@code.launchpad.net

Commit Message

Set width of title label when inside the title row

Description of the Change

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

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

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

 * 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?
N/A

 * Did you have a look at the warnings when running tests? Can they be reduced?
No new warnings

To post a comment you must log in.
Andrea Cimitan (cimi) 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.
ap
 * Did you make sure that the branch does not contain spurious tags?
yes

review: Approve

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 2015-06-16 15:12:28 +0000
3+++ plugins/Dash/CardCreator.js 2015-06-22 08:48:09 +0000
4@@ -155,7 +155,7 @@
5
6 // multiple row version of HeaderRowCode
7 function kHeaderRowCodeGenerator() {
8-var kHeaderRowCodeTemplate = 'Row { \n\
9+ var kHeaderRowCodeTemplate = 'Row { \n\
10 id: row; \n\
11 objectName: "outerRow"; \n\
12 property real margins: units.gu(1); \n\
13@@ -220,6 +220,7 @@
14 // %1 is used as anchors of titleLabel
15 // %2 is used as color of titleLabel
16 // %3 is used as extra condition for visible of titleLabel
17+// %4 is used as title width
18 var kTitleLabelCode = 'Label { \n\
19 id: titleLabel; \n\
20 objectName: "titleLabel"; \n\
21@@ -231,6 +232,7 @@
22 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\
23 color: %2; \n\
24 visible: showHeader %3; \n\
25+ width: %4; \n\
26 text: root.title; \n\
27 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; \n\
28 horizontalAlignment: root.titleAlignment; \n\
29@@ -491,6 +493,7 @@
30 var attributesAnchors;
31 var titleContainerAnchors;
32 var titleRightAnchor;
33+ var titleWidth = "undefined";
34
35 var extraRightAnchor = '';
36 var extraLeftAnchor = '';
37@@ -534,8 +537,9 @@
38 attributesAnchors = subtitleAnchors + 'top: titleLabel.bottom;\n';
39 }
40 } else if (hasMascot) {
41- // Using row + titleContainer
42+ // Using row without titleContainer
43 titleAnchors = 'verticalCenter: parent.verticalCenter;\n';
44+ titleWidth = "parent.width - x";
45 } else {
46 if (headerAsOverlay) {
47 // Using anchors to the overlay
48@@ -573,7 +577,7 @@
49
50 // code for different elements
51 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
52- var titleCode = kTitleLabelCode.arg(titleAnchors).arg(titleColor).arg(titleLabelVisibleExtra);
53+ var titleCode = kTitleLabelCode.arg(titleAnchors).arg(titleColor).arg(titleLabelVisibleExtra).arg(titleWidth);
54 var subtitleCode;
55 var attributesCode;
56
57
58=== modified file 'tests/plugins/Dash/cardcreator/1.res'
59--- tests/plugins/Dash/cardcreator/1.res 2015-06-16 15:12:28 +0000
60+++ tests/plugins/Dash/cardcreator/1.res 2015-06-22 08:48:09 +0000
61@@ -89,6 +89,7 @@
62 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
63 color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
64 visible: showHeader ;
65+ width: undefined;
66 text: root.title;
67 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
68 horizontalAlignment: root.titleAlignment;
69
70=== modified file 'tests/plugins/Dash/cardcreator/2.res'
71--- tests/plugins/Dash/cardcreator/2.res 2015-05-13 10:21:18 +0000
72+++ tests/plugins/Dash/cardcreator/2.res 2015-06-22 08:48:09 +0000
73@@ -90,6 +90,7 @@
74 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
75 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");
76 visible: showHeader ;
77+ width: undefined;
78 text: root.title;
79 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
80 horizontalAlignment: root.titleAlignment;
81
82=== modified file 'tests/plugins/Dash/cardcreator/3.res'
83--- tests/plugins/Dash/cardcreator/3.res 2015-06-16 15:12:28 +0000
84+++ tests/plugins/Dash/cardcreator/3.res 2015-06-22 08:48:09 +0000
85@@ -89,6 +89,7 @@
86 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
87 color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
88 visible: showHeader ;
89+ width: undefined;
90 text: root.title;
91 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
92 horizontalAlignment: root.titleAlignment;
93
94=== modified file 'tests/plugins/Dash/cardcreator/4.res'
95--- tests/plugins/Dash/cardcreator/4.res 2015-05-13 10:21:18 +0000
96+++ tests/plugins/Dash/cardcreator/4.res 2015-06-22 08:48:09 +0000
97@@ -74,6 +74,7 @@
98 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
99 color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
100 visible: showHeader ;
101+ width: undefined;
102 text: root.title;
103 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
104 horizontalAlignment: root.titleAlignment;
105
106=== modified file 'tests/plugins/Dash/cardcreator/5.res'
107--- tests/plugins/Dash/cardcreator/5.res 2015-06-16 15:12:28 +0000
108+++ tests/plugins/Dash/cardcreator/5.res 2015-06-22 08:48:09 +0000
109@@ -133,6 +133,7 @@
110 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
111 color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
112 visible: showHeader && overlayLoader.active;
113+ width: undefined;
114 text: root.title;
115 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
116 horizontalAlignment: root.titleAlignment;
117
118=== modified file 'tests/plugins/Dash/cardcreator/6.res'
119--- tests/plugins/Dash/cardcreator/6.res 2015-05-13 10:21:18 +0000
120+++ tests/plugins/Dash/cardcreator/6.res 2015-06-22 08:48:09 +0000
121@@ -69,6 +69,7 @@
122 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
123 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");
124 visible: showHeader ;
125+ width: undefined;
126 text: root.title;
127 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
128 horizontalAlignment: root.titleAlignment;
129
130=== modified file 'tests/plugins/Dash/cardcreator/7.res'
131--- tests/plugins/Dash/cardcreator/7.res 2015-05-13 10:21:18 +0000
132+++ tests/plugins/Dash/cardcreator/7.res 2015-06-22 08:48:09 +0000
133@@ -91,6 +91,7 @@
134 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
135 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");
136 visible: showHeader ;
137+ width: undefined;
138 text: root.title;
139 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
140 horizontalAlignment: root.titleAlignment;
141
142=== added file 'tests/plugins/Dash/cardcreator/8.res'
143--- tests/plugins/Dash/cardcreator/8.res 1970-01-01 00:00:00 +0000
144+++ tests/plugins/Dash/cardcreator/8.res 2015-06-22 08:48:09 +0000
145@@ -0,0 +1,102 @@
146+AbstractButton {
147+ id: root;
148+ property var components;
149+ property var cardData;
150+ property var artShapeBorderSource: undefined;
151+ property real fontScale: 1.0;
152+ property var scopeStyle: null;
153+ property int titleAlignment: Text.AlignLeft;
154+ property int fixedHeaderHeight: -1;
155+ property size fixedArtShapeSize: Qt.size(-1, -1);
156+ readonly property string title: cardData && cardData["title"] || "";
157+ property bool asynchronous: true;
158+ property bool showHeader: true;
159+ implicitWidth: childrenRect.width;
160+ enabled: true;
161+
162+Loader {
163+ id: backgroundLoader;
164+ objectName: "backgroundLoader";
165+ anchors.fill: parent;
166+ asynchronous: root.asynchronous;
167+ visible: status == Loader.Ready;
168+ sourceComponent: UbuntuShape {
169+ objectName: "background";
170+ radius: "medium";
171+ color: getColor(0) || "white";
172+ gradientColor: getColor(1) || color;
173+ anchors.fill: parent;
174+ image: backgroundImage.source ? backgroundImage : null;
175+ property real luminance: Style.luminance(color);
176+ property Image backgroundImage: Image {
177+ objectName: "backgroundImage";
178+ source: {
179+ if (cardData && typeof cardData["background"] === "string") return cardData["background"];
180+ else return "";
181+ }
182+ }
183+ function getColor(index) {
184+ if (cardData && typeof cardData["background"] === "object"
185+ && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
186+ return cardData["background"]["elements"][index];
187+ } else return index === 0 ? "#E9E9E9" : "#E9AAE9";
188+ }
189+ }
190+ }
191+readonly property size artShapeSize: Qt.size(-1, -1);
192+readonly property int headerHeight: row.height;
193+Row {
194+ id: row;
195+ objectName: "outerRow";
196+ property real margins: units.gu(1);
197+ spacing: margins;
198+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
199+ anchors { top: parent.top;
200+ topMargin: units.gu(1);
201+left: parent.left;
202+ }
203+ anchors.right: parent.right;
204+ anchors.margins: margins;
205+ anchors.rightMargin: 0;
206+ data: [
207+ CroppedImageMinimumSourceSize {
208+ id: mascotImage;
209+ objectName: "mascotImage";
210+ anchors { verticalCenter: parent.verticalCenter; }
211+ source: cardData && cardData["mascot"] || "";
212+ width: units.gu(6);
213+ height: units.gu(5.625);
214+ horizontalAlignment: Image.AlignHCenter;
215+ verticalAlignment: Image.AlignVCenter;
216+ visible: showHeader;
217+ }
218+,Label {
219+ id: titleLabel;
220+ objectName: "titleLabel";
221+ anchors { verticalCenter: parent.verticalCenter;
222+ }
223+ elide: Text.ElideRight;
224+ fontSize: "small";
225+ wrapMode: Text.Wrap;
226+ maximumLineCount: 2;
227+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
228+ 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");
229+ visible: showHeader ;
230+ width: parent.width - x;
231+ text: root.title;
232+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
233+ horizontalAlignment: root.titleAlignment;
234+ }
235+
236+ ]
237+ }
238+UbuntuShape {
239+ id: touchdown;
240+ objectName: "touchdown";
241+ anchors { fill: backgroundLoader }
242+ visible: root.pressed;
243+ radius: "medium";
244+ borderSource: "radius_pressed.sci"
245+ }
246+implicitHeight: row.y + row.height + units.gu(1);
247+}
248
249=== added file 'tests/plugins/Dash/cardcreator/8.tst'
250--- tests/plugins/Dash/cardcreator/8.tst 1970-01-01 00:00:00 +0000
251+++ tests/plugins/Dash/cardcreator/8.tst 2015-06-22 08:48:09 +0000
252@@ -0,0 +1,3 @@
253+template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
254+components: {"background":{"field":"background"},"mascot":{"field":"icon"},"title":{"field":"title"},"attributes":{}}
255+result: 8.res

Subscribers

People subscribed via source and target branches