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
Prerequisite: lp:~cimi/unity8/card_touchdown_2
Diff against target: 4134 lines (+2313/-477)
52 files modified
data/unity8-dash.conf (+1/-1)
plugins/Dash/CardCreator.js (+187/-154)
plugins/Dash/ScopeStyle.qml (+3/-2)
plugins/Dash/listviewwithpageheader.cpp (+10/-2)
plugins/Dash/listviewwithpageheader.h (+3/-0)
po/hu.po (+6/-5)
po/sl.po (+4/-3)
po/unity8.pot (+80/-44)
qml/Components/PageHeader.qml (+3/-1)
qml/Components/ResponsiveGridView.qml (+3/-3)
qml/Dash/CardCarousel.qml (+2/-2)
qml/Dash/CardGrid.qml (+13/-2)
qml/Dash/CardVerticalJournal.qml (+1/-1)
qml/Dash/Dash.qml (+171/-13)
qml/Dash/DashBackground.qml (+24/-0)
qml/Dash/DashContent.qml (+10/-4)
qml/Dash/DashRenderer.qml (+3/-1)
qml/Dash/GenericScopeView.qml (+86/-48)
qml/Dash/PreviewListView.qml (+1/-1)
qml/Dash/ScopesOverview.qml (+531/-0)
qml/Dash/ScopesOverviewAll.qml (+54/-0)
qml/Dash/ScopesOverviewFavorites.qml (+73/-0)
qml/Dash/ScopesOverviewTab.qml (+74/-0)
tests/autopilot/unity8/shell/tests/test_emulators.py (+1/-1)
tests/mocks/Unity/CMakeLists.txt (+1/-0)
tests/mocks/Unity/fake_categories.cpp (+6/-2)
tests/mocks/Unity/fake_resultsmodel.cpp (+2/-1)
tests/mocks/Unity/fake_scope.cpp (+17/-5)
tests/mocks/Unity/fake_scope.h (+6/-3)
tests/mocks/Unity/fake_scopes.cpp (+46/-7)
tests/mocks/Unity/fake_scopes.h (+8/-1)
tests/mocks/Unity/fake_scopesoverview.cpp (+281/-0)
tests/mocks/Unity/fake_scopesoverview.h (+104/-0)
tests/plugins/Dash/cardcreator/1.res (+6/-6)
tests/plugins/Dash/cardcreator/1.tst (+1/-1)
tests/plugins/Dash/cardcreator/2.res (+27/-19)
tests/plugins/Dash/cardcreator/2.tst (+1/-1)
tests/plugins/Dash/cardcreator/3.res (+12/-12)
tests/plugins/Dash/cardcreator/3.tst (+1/-1)
tests/plugins/Dash/cardcreator/4.res (+23/-15)
tests/plugins/Dash/cardcreator/4.tst (+1/-1)
tests/plugins/Dash/cardcreator/5.res (+21/-19)
tests/plugins/Dash/cardcreator/5.tst (+1/-1)
tests/plugins/Dash/cardcreator/6.res (+98/-45)
tests/plugins/Dash/cardcreator/6.tst (+2/-2)
tests/plugins/Dash/cardcreator/7.res (+35/-23)
tests/plugins/Dash/tst_ScopeStyle.qml (+1/-1)
tests/qmltests/Dash/CardHelpers.js (+1/-0)
tests/qmltests/Dash/tst_Card.qml (+19/-1)
tests/qmltests/Dash/tst_Dash.qml (+229/-7)
tests/qmltests/Dash/tst_DashContent.qml (+7/-6)
tests/qmltests/Dash/tst_GenericScopeView.qml (+12/-9)
To merge this branch: bzr merge lp:~cimi/unity8/card_emblems_2
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Michał Sawicz Needs Fixing
Review via email: mp+229046@code.launchpad.net

This proposal has been superseded by a proposal from 2014-08-08.

Commit message

Add emblems

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
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

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

Fixed tests

1095. By Andrea Cimitan

Fixed test

1096. By Andrea Cimitan

Added test

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
Andrea Cimitan (cimi) wrote :

 * Are there any related MPs required for this MP to build/function as expected? Please list.
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

Revision history for this message
Ying-Chun Liu (paulliu) wrote :
Revision history for this message
Ying-Chun Liu (paulliu) wrote :

cardTool?

lp:~cimi/unity8/card_emblems_2 updated
1097. By Andrea Cimitan

More fixes

Revision history for this message
Ying-Chun Liu (paulliu) wrote :

In the diff there's conflict. Seems we need a re-merge trunk here?

lp:~cimi/unity8/card_emblems_2 updated
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

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)
lp:~cimi/unity8/card_emblems_2 updated
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

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

When emblem is declared, but invalid, there's no right text margin.

You should use StatusIcon (like attributes do) for the emblem, and colourize it with the foreground color.

review: Needs Fixing
lp:~cimi/unity8/card_emblems_2 updated
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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~cimi/unity8/card_emblems_2 updated
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
=== modified file 'data/unity8-dash.conf'
--- data/unity8-dash.conf 2014-07-29 11:35:10 +0000
+++ data/unity8-dash.conf 2014-08-08 14:57:17 +0000
@@ -13,7 +13,7 @@
13pre-start script13pre-start script
14 if [ -z "$UNITY_SCOPES_LIST" ]; then14 if [ -z "$UNITY_SCOPES_LIST" ]; then
15 # FIXME: remove once we have this in dconf15 # FIXME: remove once we have this in dconf
16 initctl set-env UNITY_SCOPES_LIST="scopes;clickscope;musicaggregator;videoaggregator"16 initctl set-env UNITY_SCOPES_LIST="clickscope;musicaggregator;videoaggregator"
17 fi17 fi
1818
19 initctl emit scope-ui-starting19 initctl emit scope-ui-starting
2020
=== modified file 'plugins/Dash/CardCreator.js'
--- plugins/Dash/CardCreator.js 2014-08-06 19:39:39 +0000
+++ plugins/Dash/CardCreator.js 2014-08-08 14:57:17 +0000
@@ -108,6 +108,7 @@
108 sourceComponent: ShaderEffect { \n\108 sourceComponent: ShaderEffect { \n\
109 id: overlay; \n\109 id: overlay; \n\
110 height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); \n\110 height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); \n\
111 property real luminance: 0.2126 * overlayColor.r + 0.7152 * overlayColor.g + 0.0722 * overlayColor.b; \n\
111 property color overlayColor: cardData && cardData["overlayColor"] || "#99000000"; \n\112 property color overlayColor: cardData && cardData["overlayColor"] || "#99000000"; \n\
112 property var source: ShaderEffectSource { \n\113 property var source: ShaderEffectSource { \n\
113 id: shaderSource; \n\114 id: shaderSource; \n\
@@ -137,69 +138,43 @@
137 } \n\138 } \n\
138 }\n';139 }\n';
139140
140// %1 is used as anchors of row141// multiple row version of HeaderRowCode
141// %2 is used as first child of the row142function kHeaderRowCodeGenerator() {
142// %3 is used as second child of the row143var kHeaderRowCodeTemplate = 'Row { \n\
143var kHeaderRow2Code = 'Row { \n\144 id: row; \n\
144 id: row; \n\145 objectName: "outerRow"; \n\
145 objectName: "outerRow"; \n\146 property real margins: units.gu(1); \n\
146 property real margins: units.gu(1); \n\147 spacing: margins; \n\
147 spacing: margins; \n\148 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\
148 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\149 anchors { %1 } \n\
149 anchors { %1 } \n\150 anchors.right: parent.right; \n\
150 anchors.right: parent.right; \n\151 anchors.margins: margins; \n\
151 anchors.margins: margins;\n\152 anchors.rightMargin: 0; \n\
152 data: [ %2\n\153 data: [ \n\
153 ,\n\154 %2 \n\
154 %3 \n\155 ] \n\
155 ] \n\156 }\n';
156 }\n';157 var args = Array.prototype.slice.call(arguments);
157158 var HeaderRowAnchors = args.shift();
158// %1 is used as anchors of row159 var code = kHeaderRowCodeTemplate.arg(HeaderRowAnchors).arg(args.join(',\n'));
159// %2 is used as first child of the row160 return code;
160// %3 is used as second child of the row161}
161// %4 is used as third child of the row162
162var kHeaderRow3Code = 'Row { \n\163// multiple item version of kHeaderContainerCode
163 id: row; \n\164function kHeaderContainerCodeGenerator() {
164 objectName: "outerRow"; \n\165 var headerContainerCodeTemplate = 'Item { \n\
165 property real margins: units.gu(1); \n\166 id: headerTitleContainer; \n\
166 spacing: margins; \n\167 anchors { %1 } \n\
167 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\168 width: parent.width - x; \n\
168 anchors { %1 } \n\169 implicitHeight: %2; \n\
169 anchors.right: parent.right; \n\170 data: [ \n\
170 anchors.margins: margins;\n\171 %3 \n\
171 data: [ %2\n\172 ]\n\
172 ,\n\
173 %3 \n\
174 ,\n\
175 %4 \n\
176 ] \n\
177 }\n';
178
179// %1 is used as first child of the column
180// %2 is used as second child of the column
181var kHeaderColumnCode = 'Column { \n\
182 anchors.verticalCenter: parent.verticalCenter; \n\
183 spacing: units.dp(2); \n\
184 width: parent.width - x;\n\
185 data: [ %1\n\
186 ,\n\
187 %2 \n\
188 ] \n\
189 }\n';173 }\n';
190
191// multiple column version of kHeaderColumnCode.
192function kHeaderColumnCodeGenerator() {
193 var headerColumnCodeTemplate = 'Column { \n\
194 anchors.verticalCenter: parent.verticalCenter; \n\
195 spacing: units.dp(2); \n\
196 width: parent.width - x;\n\
197 data: [ \n\
198 %1 \n\
199 ]\n\
200 }\n';
201 var args = Array.prototype.slice.call(arguments);174 var args = Array.prototype.slice.call(arguments);
202 var code = headerColumnCodeTemplate.arg(args.join(',\n'));175 var headerContainerAnchors = args.shift();
176 var headerContainerHeight = args.shift();
177 var code = headerContainerCodeTemplate.arg(headerContainerAnchors).arg(headerContainerHeight).arg(args.join(',\n'));
203 return code;178 return code;
204}179}
205180
@@ -223,7 +198,7 @@
223 objectName: "mascotImage"; \n\198 objectName: "mascotImage"; \n\
224 anchors { %1 } \n\199 anchors { %1 } \n\
225 readonly property int maxSize: Math.max(width, height) * 4; \n\200 readonly property int maxSize: Math.max(width, height) * 4; \n\
226 source: cardData && cardData["mascot"]; \n\201 source: cardData && cardData["mascot"] || ""; \n\
227 width: units.gu(6); \n\202 width: units.gu(6); \n\
228 height: units.gu(5.625); \n\203 height: units.gu(5.625); \n\
229 sourceSize { width: maxSize; height: maxSize } \n\204 sourceSize { width: maxSize; height: maxSize } \n\
@@ -252,6 +227,20 @@
252 horizontalAlignment: root.headerAlignment; \n\227 horizontalAlignment: root.headerAlignment; \n\
253 }\n';228 }\n';
254229
230var kEmblemImageCode = 'Image { \n\
231 id: emblemImage; \n\
232 objectName: "emblemImage"; \n\
233 anchors { \n\
234 bottom: titleLabel.baseline; \n\
235 right: parent.right; \n\
236 rightMargin: status === Image.Ready ? units.gu(1) : 0; \n\
237 } \n\
238 source: cardData && cardData["emblem"] || ""; \n\
239 width: height; \n\
240 height: status === Image.Ready ? titleLabel.font.pixelSize : 0; \n\
241 fillMode: Image.PreserveAspectFit; \n\
242 }\n';
243
255// %1 is used as anchors of touchdown effect244// %1 is used as anchors of touchdown effect
256var kTouchdownCode = 'UbuntuShape { \n\245var kTouchdownCode = 'UbuntuShape { \n\
257 id: touchdown; \n\246 id: touchdown; \n\
@@ -268,6 +257,7 @@
268 id: subtitleLabel; \n\257 id: subtitleLabel; \n\
269 objectName: "subtitleLabel"; \n\258 objectName: "subtitleLabel"; \n\
270 anchors { %1 } \n\259 anchors { %1 } \n\
260 anchors.topMargin: units.dp(2); \n\
271 elide: Text.ElideRight; \n\261 elide: Text.ElideRight; \n\
272 fontSize: "small"; \n\262 fontSize: "small"; \n\
273 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\263 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\
@@ -284,7 +274,7 @@
284 objectName: "attributesRow"; \n\274 objectName: "attributesRow"; \n\
285 anchors { %1 } \n\275 anchors { %1 } \n\
286 color: %2; \n\276 color: %2; \n\
287 model: cardData["attributes"]; \n\277 model: cardData && cardData["attributes"]; \n\
288 }\n';278 }\n';
289279
290// %1 is used as top anchor of summary280// %1 is used as top anchor of summary
@@ -334,10 +324,11 @@
334 var hasBackground = !isHorizontal && (template["card-background"] || components["background"] || artAndSummary);324 var hasBackground = !isHorizontal && (template["card-background"] || components["background"] || artAndSummary);
335 var hasTitle = components["title"] || false;325 var hasTitle = components["title"] || false;
336 var hasMascot = components["mascot"] || false;326 var hasMascot = components["mascot"] || false;
327 var hasEmblem = components["emblem"] && !(hasMascot && template["card-size"] === "small") || false;
337 var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot);328 var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot);
338 var hasSubtitle = hasTitle && components["subtitle"] || false;329 var hasSubtitle = hasTitle && components["subtitle"] || false;
339 var hasHeaderRow = hasMascot && hasTitle;330 var hasHeaderRow = hasMascot && hasTitle;
340 var hasAttributes = hasTitle && components["attributes"] || false;331 var hasAttributes = hasTitle && components["attributes"]["field"] || false;
341332
342 if (hasBackground) {333 if (hasBackground) {
343 code += kBackgroundLoaderCode;334 code += kBackgroundLoaderCode;
@@ -348,9 +339,9 @@
348 code += 'readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);\n';339 code += 'readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);\n';
349340
350 var widthCode, heightCode;341 var widthCode, heightCode;
351 var anchors;342 var artAnchors;
352 if (isHorizontal) {343 if (isHorizontal) {
353 anchors = 'left: parent.left';344 artAnchors = 'left: parent.left';
354 if (hasMascot || hasTitle) {345 if (hasMascot || hasTitle) {
355 widthCode = 'height * artShape.aspect'346 widthCode = 'height * artShape.aspect'
356 heightCode = 'headerHeight + 2 * units.gu(1)';347 heightCode = 'headerHeight + 2 * units.gu(1)';
@@ -361,12 +352,12 @@
361 heightCode = 'units.gu(7.625)';352 heightCode = 'units.gu(7.625)';
362 }353 }
363 } else {354 } else {
364 anchors = 'horizontalCenter: parent.horizontalCenter;';355 artAnchors = 'horizontalCenter: parent.horizontalCenter;';
365 widthCode = 'root.width'356 widthCode = 'root.width'
366 heightCode = 'width / artShape.aspect';357 heightCode = 'width / artShape.aspect';
367 }358 }
368359
369 code += kArtShapeHolderCode.arg(anchors).arg(widthCode).arg(heightCode);360 code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode);
370 } else {361 } else {
371 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'362 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
372 }363 }
@@ -423,155 +414,194 @@
423 code += 'readonly property int headerHeight: 0;\n'414 code += 'readonly property int headerHeight: 0;\n'
424 }415 }
425416
426 var mascotShapeCode = "";417 var mascotShapeCode = '';
427 var mascotCode = "";418 var mascotCode = '';
428 if (hasMascot) {419 if (hasMascot) {
429 var useMascotShape = !hasBackground && !headerAsOverlay;420 var useMascotShape = !hasBackground && !headerAsOverlay;
430 var anchors = "";421 var mascotAnchors = '';
431 if (!hasHeaderRow) {422 if (!hasHeaderRow) {
432 anchors += headerLeftAnchor;423 mascotAnchors += headerLeftAnchor;
433 anchors += headerVerticalAnchors;424 mascotAnchors += headerVerticalAnchors;
434 if (!headerLeftAnchorHasMargin) {425 if (!headerLeftAnchorHasMargin) {
435 anchors += 'leftMargin: units.gu(1);\n'426 mascotAnchors += 'leftMargin: units.gu(1);\n'
436 }427 }
437 } else {428 } else {
438 anchors = "verticalCenter: parent.verticalCenter;"429 mascotAnchors = 'verticalCenter: parent.verticalCenter;'
439 }430 }
440431
441 if (useMascotShape) {432 if (useMascotShape) {
442 mascotShapeCode = kMascotShapeLoaderCode.arg(anchors);433 mascotShapeCode = kMascotShapeLoaderCode.arg(mascotAnchors);
443 }434 }
444435
445 var mascotImageVisible = useMascotShape ? 'false' : 'showHeader';436 var mascotImageVisible = useMascotShape ? 'false' : 'showHeader';
446 mascotCode = kMascotImageCode.arg(anchors).arg(mascotImageVisible);437 mascotCode = kMascotImageCode.arg(mascotAnchors).arg(mascotImageVisible);
447 }438 }
448439
449 var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey")';440 var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey")';
450441
451 var titleSubtitleCode = "";442 var hasTitleContainer = hasTitle && (hasEmblem || (hasMascot && (hasSubtitle || hasAttributes)));
443 var titleSubtitleCode = '';
452 if (hasTitle) {444 if (hasTitle) {
453 var color;445 var titleColor;
454 if (headerAsOverlay) {446 if (headerAsOverlay) {
455 color = '"white"';447 titleColor = 'overlayLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey")';
456 } else if (hasSummary) {448 } else if (hasSummary) {
457 color = 'summary.color';449 titleColor = 'summary.color';
458 } else if (hasBackground) {450 } else if (hasBackground) {
459 color = summaryColorWithBackground;451 titleColor = summaryColorWithBackground;
460 } else {452 } else {
461 color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';453 titleColor = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
462 }454 }
463455
464 var titleAnchors;456 var titleAnchors;
465 var subtitleAnchors;457 var subtitleAnchors;
466 var attributesAnchors;458 var attributesAnchors;
467 if (hasMascot && (hasSubtitle || hasAttributes)) {459 var titleContainerAnchors;
468 // Using row + column460 var titleRightAnchor;
469 titleAnchors = 'left: parent.left; right: parent.right';461
470 subtitleAnchors = titleAnchors;462 if (hasMascot) {
471 attributesAnchors = subtitleAnchors;463 titleContainerAnchors = 'verticalCenter: parent.verticalCenter; ';
464 } else {
465 titleContainerAnchors = 'right: parent.right; ';
466 titleContainerAnchors += headerLeftAnchor;
467 titleContainerAnchors += headerVerticalAnchors;
468 if (!headerLeftAnchorHasMargin) {
469 titleContainerAnchors += 'leftMargin: units.gu(1);\n';
470 }
471 }
472 if (hasEmblem) {
473 titleRightAnchor = 'right: emblemImage.left; \n\
474 rightMargin: emblemImage.width > 0 ? units.gu(0.5) : 0; \n';
475 } else {
476 titleRightAnchor = 'right: parent.right; \n\
477 rightMargin: units.gu(1); \n';
478 }
479
480 if (hasTitleContainer) {
481 // Using headerTitleContainer
482 titleAnchors = titleRightAnchor;
483 titleAnchors += 'left: parent.left; \n\
484 top: parent.top;';
485 subtitleAnchors = 'right: parent.right; \n\
486 left: parent.left; \n\
487 rightMargin: units.gu(1); \n';
488 if (hasSubtitle) {
489 attributesAnchors = subtitleAnchors + 'top: subtitleLabel.bottom;\n';
490 subtitleAnchors += 'top: titleLabel.bottom;\n';
491 } else {
492 attributesAnchors = subtitleAnchors + 'top: titleLabel.bottom;\n';
493 }
472 } else if (hasMascot) {494 } else if (hasMascot) {
473 // Using row + label495 // Using row + titleContainer
474 titleAnchors = 'verticalCenter: parent.verticalCenter;\n'496 titleAnchors = 'verticalCenter: parent.verticalCenter;\n';
475 } else {497 } else {
476 if (headerAsOverlay) {498 if (headerAsOverlay) {
477 // Using anchors to the overlay499 // Using anchors to the overlay
478 titleAnchors = 'left: parent.left; \n\500 titleAnchors = titleRightAnchor;
479 leftMargin: units.gu(1); \n\501 titleAnchors += 'left: parent.left; \n\
480 right: parent.right; \n\502 leftMargin: units.gu(1); \n\
481 rightMargin: units.gu(1); \n\503 top: overlayLoader.top; \n\
482 top: overlayLoader.top; \n\504 topMargin: units.gu(1);\n';
483 topMargin: units.gu(1);\n';
484 } else {505 } else {
485 // Using anchors to the mascot/parent506 // Using anchors to the mascot/parent
486 titleAnchors = "right: parent.right;\n";507 titleAnchors = titleRightAnchor;
487 titleAnchors += "rightMargin: units.gu(1);\n";
488 titleAnchors += headerLeftAnchor;508 titleAnchors += headerLeftAnchor;
489 titleAnchors += headerVerticalAnchors;509 titleAnchors += headerVerticalAnchors;
490 if (!headerLeftAnchorHasMargin) {510 if (!headerLeftAnchorHasMargin) {
491 titleAnchors += 'leftMargin: units.gu(1);\n'511 titleAnchors += 'leftMargin: units.gu(1);\n';
492 }512 }
493 }513 }
494 subtitleAnchors = 'left: titleLabel.left; \n\514 subtitleAnchors = 'left: titleLabel.left; \n\
495 leftMargin: titleLabel.leftMargin; \n\515 leftMargin: titleLabel.leftMargin; \n\
496 right: titleLabel.right; \n\516 rightMargin: units.gu(1); \n';
497 rightMargin: titleLabel.rightMargin; \n\517 if (hasEmblem) {
498 top: titleLabel.bottom; \n\518 // using container
499 topMargin: units.dp(2);\n';519 subtitleAnchors += 'right: parent.right; \n';
520 } else {
521 subtitleAnchors += 'right: titleLabel.right; \n';
522 }
523
500 if (hasSubtitle) {524 if (hasSubtitle) {
501 attributesAnchors = 'left: subtitleLabel.left; \n\525 attributesAnchors = subtitleAnchors + 'top: subtitleLabel.bottom;\n';
502 leftMargin: subtitleLabel.leftMargin; \n\526 subtitleAnchors += 'top: titleLabel.bottom;\n';
503 right: subtitleLabel.right; \n\
504 rightMargin: subtitleLabel.rightMargin; \n\
505 top: subtitleLabel.bottom; \n\
506 topMargin: units.dp(2);\n';
507 } else {527 } else {
508 attributesAnchors = subtitleAnchors;528 attributesAnchors = subtitleAnchors + 'top: titleLabel.bottom;\n';
509 }529 }
510 }530 }
511531
532 // code for different elements
512 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');533 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
513 var titleCode = kTitleLabelCode.arg(titleAnchors).arg(color).arg(titleLabelVisibleExtra);534 var titleCode = kTitleLabelCode.arg(titleAnchors).arg(titleColor).arg(titleLabelVisibleExtra);
514 var subtitleCode = "";535 var subtitleCode;
536 var attributesCode;
537 var emblemCode;
538
539 // code for the title container
540 var containerCode = [];
541 var containerHeight = 'titleLabel.height';
542 containerCode.push(titleCode);
515 if (hasSubtitle) {543 if (hasSubtitle) {
516 subtitleCode += kSubtitleLabelCode.arg(subtitleAnchors).arg(color);544 subtitleCode = kSubtitleLabelCode.arg(subtitleAnchors).arg(titleColor);
545 containerCode.push(subtitleCode);
546 containerHeight += ' + subtitleLabel.height';
547 }
548 if (hasEmblem) {
549 containerCode.push(kEmblemImageCode);
550 }
551 if (hasAttributes) {
552 attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(titleColor);
553 containerCode.push(kAttributesRowCode.arg(attributesAnchors).arg(titleColor));
554 containerHeight += ' + attributesRow.height';
517 }555 }
518556
519 if (hasMascot && (hasSubtitle || hasAttributes)) {557 if (hasTitleContainer) {
520 // If using row + column wrap the code in the column558 // use container
521 titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);559 titleSubtitleCode = kHeaderContainerCodeGenerator(titleContainerAnchors, containerHeight, containerCode);
522 if (hasSubtitle && hasAttributes) {
523 var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
524 titleSubtitleCode = kHeaderColumnCodeGenerator(titleCode, subtitleCode, attributesCode);
525 } else if (hasSubtitle) {
526 titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
527 } else if (hasAttributes) {
528 var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
529 titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(attributesCode);
530 }
531 } else {560 } else {
561 // no container
532 titleSubtitleCode = titleCode;562 titleSubtitleCode = titleCode;
533 if (hasSubtitle) {563 if (hasSubtitle) {
534 titleSubtitleCode = titleSubtitleCode + subtitleCode;564 titleSubtitleCode += subtitleCode;
535 }565 }
536 if (hasAttributes) {566 if (hasAttributes) {
537 var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);567 titleSubtitleCode += attributesCode;
538 titleSubtitleCode = titleSubtitleCode + attributesCode;
539 }568 }
540 }569 }
541 }570 }
542571
543 if (hasHeaderRow) {572 if (hasHeaderRow) {
544 if (mascotShapeCode != "") {573 var rowCode = [mascotCode, titleSubtitleCode];
545 code += kHeaderRow3Code.arg(headerVerticalAnchors + headerLeftAnchor).arg(mascotShapeCode).arg(mascotCode).arg(titleSubtitleCode);574 if (mascotShapeCode != '') {
546 } else {575 rowCode.unshift(mascotShapeCode);
547 code += kHeaderRow2Code.arg(headerVerticalAnchors + headerLeftAnchor).arg(mascotCode).arg(titleSubtitleCode);
548 }576 }
577 code += kHeaderRowCodeGenerator(headerVerticalAnchors + headerLeftAnchor, rowCode)
549 } else {578 } else {
550 code += mascotShapeCode + mascotCode + titleSubtitleCode;579 code += mascotShapeCode + mascotCode + titleSubtitleCode;
551 }580 }
552581
553 if (hasSummary) {582 if (hasSummary) {
554 var summaryTopAnchor;583 var summaryTopAnchor;
555 if (isHorizontal && hasArt) summaryTopAnchor = "artShapeHolder.bottom";584 if (isHorizontal && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
556 else if (headerAsOverlay && hasArt) summaryTopAnchor = "artShapeHolder.bottom";585 else if (headerAsOverlay && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
557 else if (hasHeaderRow) summaryTopAnchor = "row.bottom";586 else if (hasHeaderRow) summaryTopAnchor = 'row.bottom';
558 else if (hasMascot) summaryTopAnchor = "mascotImage.bottom";587 else if (hasTitleContainer) summaryTopAnchor = 'headerTitleContainer.bottom';
559 else if (hasAttributes) summaryTopAnchor = "attributesRow.bottom";588 else if (hasMascot) summaryTopAnchor = 'mascotImage.bottom';
560 else if (hasSubtitle) summaryTopAnchor = "subtitleLabel.bottom";589 else if (hasAttributes) summaryTopAnchor = 'attributesRow.bottom';
561 else if (hasTitle) summaryTopAnchor = "titleLabel.bottom";590 else if (hasSubtitle) summaryTopAnchor = 'subtitleLabel.bottom';
562 else if (hasArt) summaryTopAnchor = "artShapeHolder.bottom";591 else if (hasTitle) summaryTopAnchor = 'titleLabel.bottom';
563 else summaryTopAnchor = "parent.top";592 else if (hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
593 else summaryTopAnchor = 'parent.top';
564594
565 var color;595 var summaryColor;
566 if (hasBackground) {596 if (hasBackground) {
567 color = summaryColorWithBackground;597 summaryColor = summaryColorWithBackground;
568 } else {598 } else {
569 color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';599 summaryColor = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
570 }600 }
571601
572 var summaryTopMargin = (hasMascot || hasSubtitle || hasAttributes ? 'anchors.margins' : '0');602 var summaryTopMargin = (hasMascot || hasSubtitle || hasAttributes ? 'anchors.margins' : '0');
573603
574 code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(color);604 code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(summaryColor);
575 }605 }
576606
577 var touchdownAnchors;607 var touchdownAnchors;
@@ -584,23 +614,26 @@
584 }614 }
585 code += kTouchdownCode.arg(touchdownAnchors);615 code += kTouchdownCode.arg(touchdownAnchors);
586616
617 var implicitHeight = 'implicitHeight: ';
587 if (hasSummary) {618 if (hasSummary) {
588 code += 'implicitHeight: summary.y + summary.height + (summary.text ? units.gu(1) : 0);\n';619 implicitHeight += 'summary.y + summary.height + (summary.text ? units.gu(1) : 0);\n';
589 } else if (hasHeaderRow) {620 } else if (hasHeaderRow) {
590 code += 'implicitHeight: row.y + row.height + units.gu(1);\n';621 implicitHeight += 'row.y + row.height + units.gu(1);\n';
591 } else if (hasMascot) {622 } else if (hasMascot) {
592 code += 'implicitHeight: mascotImage.y + mascotImage.height;\n';623 implicitHeight += 'mascotImage.y + mascotImage.height;\n';
624 } else if (hasTitleContainer) {
625 implicitHeight += 'headerTitleContainer.y + headerTitleContainer.height + units.gu(1);\n';
593 } else if (hasAttributes) {626 } else if (hasAttributes) {
594 code += 'implicitHeight: attributesRow.y + attributesRow.height + units.gu(1);\n';627 implicitHeight += 'attributesRow.y + attributesRow.height + units.gu(1);\n';
595 } else if (hasSubtitle) {628 } else if (hasSubtitle) {
596 code += 'implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);\n';629 implicitHeight += 'subtitleLabel.y + subtitleLabel.height + units.gu(1);\n';
597 } else if (hasTitle) {630 } else if (hasTitle) {
598 code += 'implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);\n';631 implicitHeight += 'titleLabel.y + titleLabel.height + units.gu(1);\n';
599 } else if (hasArt) {632 } else if (hasArt) {
600 code += 'implicitHeight: artShapeHolder.height;\n';633 implicitHeight += 'artShapeHolder.height;\n';
601 }634 }
602 // Close the AbstractButton635 // Close the AbstractButton
603 code += '}\n';636 code += implicitHeight + '}\n';
604637
605 return code;638 return code;
606}639}
607640
=== modified file 'plugins/Dash/ScopeStyle.qml'
--- plugins/Dash/ScopeStyle.qml 2014-07-25 11:42:06 +0000
+++ plugins/Dash/ScopeStyle.qml 2014-08-08 14:57:17 +0000
@@ -49,9 +49,10 @@
4949
50 /*! \brief Luminance threshold for switching between fore and background color50 /*! \brief Luminance threshold for switching between fore and background color
5151
52 \note If background colour is not fully opaque, it's not taken into account.52 \note If background colour is not fully opaque, the defaultLightLuminance it's taken into account instead of it.
53 */53 */
54 readonly property real threshold: background.a !== 1.0 ? foregroundLuminance : (foregroundLuminance + backgroundLuminance) / 254 readonly property real threshold: background.a !== 1.0 ? (foregroundLuminance + d.defaultLightLuminance) / 2
55 : (foregroundLuminance + backgroundLuminance) / 2
5556
56 /*! \brief The lighter of foreground and background colors57 /*! \brief The lighter of foreground and background colors
5758
5859
=== modified file 'plugins/Dash/listviewwithpageheader.cpp'
--- plugins/Dash/listviewwithpageheader.cpp 2014-07-25 10:47:08 +0000
+++ plugins/Dash/listviewwithpageheader.cpp 2014-08-08 14:57:17 +0000
@@ -330,6 +330,11 @@
330 return m_topSectionItem ? m_topSectionItem->height() : 0;330 return m_topSectionItem ? m_topSectionItem->height() : 0;
331}331}
332332
333qreal ListViewWithPageHeader::headerItemShownHeight() const
334{
335 return m_headerItemShownHeight;
336}
337
333void ListViewWithPageHeader::positionAtBeginning()338void ListViewWithPageHeader::positionAtBeginning()
334{339{
335 if (m_delegateModel->count() <= 0)340 if (m_delegateModel->count() <= 0)
@@ -396,6 +401,7 @@
396 firstItem->setY(firstItem->y() - m_headerItemShownHeight);401 firstItem->setY(firstItem->y() - m_headerItemShownHeight);
397 layout();402 layout();
398 }403 }
404 Q_EMIT headerItemShownHeightChanged();
399 }405 }
400 m_contentYAnimation->setTo(to);406 m_contentYAnimation->setTo(to);
401 contentYAnimationType = ContentYAnimationShowHeader;407 contentYAnimationType = ContentYAnimationShowHeader;
@@ -544,6 +550,7 @@
544 m_headerItem->setY(-m_minYExtent);550 m_headerItem->setY(-m_minYExtent);
545 }551 }
546 }552 }
553 Q_EMIT headerItemShownHeightChanged();
547 } else {554 } else {
548 // Stick the header item to the top when dragging down555 // Stick the header item to the top when dragging down
549 m_headerItem->setY(contentY());556 m_headerItem->setY(contentY());
@@ -822,8 +829,8 @@
822 ListItem *nextItem = itemAtIndex(modelIndex + 1);829 ListItem *nextItem = itemAtIndex(modelIndex + 1);
823 if (nextItem) {830 if (nextItem) {
824 listItem->setY(nextItem->y() - listItem->height());831 listItem->setY(nextItem->y() - listItem->height());
825 } else if (modelIndex == 0 && m_headerItem) {832 } else if (modelIndex == 0) {
826 listItem->setY(m_headerItem->height());833 listItem->setY(m_headerItem ? m_headerItem->height() : 0);
827 } else if (!m_visibleItems.isEmpty()) {834 } else if (!m_visibleItems.isEmpty()) {
828 lostItem = true;835 lostItem = true;
829 }836 }
@@ -1096,6 +1103,7 @@
1096 m_headerItemShownHeight = qBound(static_cast<qreal>(0.), m_headerItemShownHeight, newHeaderHeight);1103 m_headerItemShownHeight = qBound(static_cast<qreal>(0.), m_headerItemShownHeight, newHeaderHeight);
1097 updateClipItem();1104 updateClipItem();
1098 adjustMinYExtent();1105 adjustMinYExtent();
1106 Q_EMIT headerItemShownHeightChanged();
1099 } else {1107 } else {
1100 if (oldHeaderY + oldHeaderHeight > contentY()) {1108 if (oldHeaderY + oldHeaderHeight > contentY()) {
1101 // If the header is shown because its position1109 // If the header is shown because its position
11021110
=== modified file 'plugins/Dash/listviewwithpageheader.h'
--- plugins/Dash/listviewwithpageheader.h 2014-06-12 14:08:54 +0000
+++ plugins/Dash/listviewwithpageheader.h 2014-08-08 14:57:17 +0000
@@ -53,6 +53,7 @@
53 Q_PROPERTY(QString sectionProperty READ sectionProperty WRITE setSectionProperty NOTIFY sectionPropertyChanged)53 Q_PROPERTY(QString sectionProperty READ sectionProperty WRITE setSectionProperty NOTIFY sectionPropertyChanged)
54 Q_PROPERTY(bool forceNoClip READ forceNoClip WRITE setForceNoClip NOTIFY forceNoClipChanged)54 Q_PROPERTY(bool forceNoClip READ forceNoClip WRITE setForceNoClip NOTIFY forceNoClipChanged)
55 Q_PROPERTY(int stickyHeaderHeight READ stickyHeaderHeight NOTIFY stickyHeaderHeightChanged)55 Q_PROPERTY(int stickyHeaderHeight READ stickyHeaderHeight NOTIFY stickyHeaderHeightChanged)
56 Q_PROPERTY(qreal headerItemShownHeight READ headerItemShownHeight NOTIFY headerItemShownHeightChanged)
5657
57 friend class ListViewWithPageHeaderTest;58 friend class ListViewWithPageHeaderTest;
58 friend class ListViewWithPageHeaderTestSection;59 friend class ListViewWithPageHeaderTestSection;
@@ -81,6 +82,7 @@
81 void setForceNoClip(bool noClip);82 void setForceNoClip(bool noClip);
8283
83 int stickyHeaderHeight() const;84 int stickyHeaderHeight() const;
85 qreal headerItemShownHeight() const;
8486
85 Q_INVOKABLE void positionAtBeginning();87 Q_INVOKABLE void positionAtBeginning();
86 Q_INVOKABLE void showHeader();88 Q_INVOKABLE void showHeader();
@@ -100,6 +102,7 @@
100 void sectionPropertyChanged();102 void sectionPropertyChanged();
101 void forceNoClipChanged();103 void forceNoClipChanged();
102 void stickyHeaderHeightChanged();104 void stickyHeaderHeightChanged();
105 void headerItemShownHeightChanged();
103106
104protected:107protected:
105 void componentComplete() override;108 void componentComplete() override;
106109
=== modified file 'po/hu.po'
--- po/hu.po 2014-08-08 07:07:33 +0000
+++ po/hu.po 2014-08-08 14:57:17 +0000
@@ -6,16 +6,17 @@
6msgid ""6msgid ""
7msgstr ""7msgstr ""
8"Project-Id-Version: unity\n"8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"9"Report-Msgid-Bugs-To: \n"
10"POT-Creation-Date: 2014-07-11 14:59+0200\n"10"POT-Creation-Date: 2014-07-11 14:59+0200\n"
11"PO-Revision-Date: 2014-08-06 07:41+0000\n"11"PO-Revision-Date: 2014-08-06 07:41+0000\n"
12"Last-Translator: Richard Somlói <ricsipontaz@gmail.com>\n"12"Last-Translator: Richard Somlói <ricsipontaz@gmail.com>\n"
13"Language-Team: Hungarian <hu@li.org>\n"13"Language-Team: Hungarian <hu@li.org>\n"
14"Language: hu\n"
14"MIME-Version: 1.0\n"15"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"16"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"17"Content-Transfer-Encoding: 8bit\n"
17"X-Launchpad-Export-Date: 2014-08-08 07:07+0000\n"18"X-Launchpad-Export-Date: 2014-08-07 06:27+0000\n"
18"X-Generator: Launchpad (build 17156)\n"19"X-Generator: Launchpad (build 17147)\n"
1920
20#: plugins/Unity/Launcher/launcheritem.cpp:4321#: plugins/Unity/Launcher/launcheritem.cpp:43
21#: plugins/Unity/Launcher/launcheritem.cpp:7322#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -73,8 +74,8 @@
73"You have now mastered the edge gestures and can start using the "74"You have now mastered the edge gestures and can start using the "
74"phone<br><br>Tap on the screen to start"75"phone<br><br>Tap on the screen to start"
75msgstr ""76msgstr ""
76"Elsajátította a gesztusokat, és megkezdheti a telefon "77"Elsajátította a gesztusokat, és megkezdheti a telefon használatát."
77"használatát.<br><br>Koppintson a képernyőre a kezdéshez."78"<br><br>Koppintson a képernyőre a kezdéshez."
7879
79#: qml/Components/Lockscreen.qml:21480#: qml/Components/Lockscreen.qml:214
80msgid "Emergency Call"81msgid "Emergency Call"
8182
=== modified file 'po/sl.po'
--- po/sl.po 2014-08-08 07:07:33 +0000
+++ po/sl.po 2014-08-08 14:57:17 +0000
@@ -6,16 +6,17 @@
6msgid ""6msgid ""
7msgstr ""7msgstr ""
8"Project-Id-Version: unity\n"8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"9"Report-Msgid-Bugs-To: \n"
10"POT-Creation-Date: 2014-07-11 14:59+0200\n"10"POT-Creation-Date: 2014-07-11 14:59+0200\n"
11"PO-Revision-Date: 2014-08-06 06:11+0000\n"11"PO-Revision-Date: 2014-08-06 06:11+0000\n"
12"Last-Translator: Damir Jerovšek <Unknown>\n"12"Last-Translator: Damir Jerovšek <Unknown>\n"
13"Language-Team: Slovenian <sl@li.org>\n"13"Language-Team: Slovenian <sl@li.org>\n"
14"Language: sl\n"
14"MIME-Version: 1.0\n"15"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"16"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"17"Content-Transfer-Encoding: 8bit\n"
17"X-Launchpad-Export-Date: 2014-08-08 07:07+0000\n"18"X-Launchpad-Export-Date: 2014-08-07 06:27+0000\n"
18"X-Generator: Launchpad (build 17156)\n"19"X-Generator: Launchpad (build 17147)\n"
1920
20#: plugins/Unity/Launcher/launcheritem.cpp:4321#: plugins/Unity/Launcher/launcheritem.cpp:43
21#: plugins/Unity/Launcher/launcheritem.cpp:7322#: plugins/Unity/Launcher/launcheritem.cpp:73
2223
=== modified file 'po/unity8.pot'
--- po/unity8.pot 2014-07-11 14:20:12 +0000
+++ po/unity8.pot 2014-08-08 14:57:17 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: unity8\n"9"Project-Id-Version: unity8\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2014-07-11 14:59+0200\n"11"POT-Creation-Date: 2014-08-08 11:17+0200\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -26,66 +26,82 @@
26msgid "Unpin shortcut"26msgid "Unpin shortcut"
27msgstr ""27msgstr ""
2828
29#: qml/Components/Dialogs.qml:142
30msgid "Are you sure you would like to turn power off?"
31msgstr ""
32
33#: qml/Components/Dialogs.qml:144
34msgid "Power off"
35msgstr ""
36
37#: qml/Components/Dialogs.qml:153
38msgid "Restart"
39msgstr ""
40
41#: qml/Components/Dialogs.qml:162
42msgid "Cancel"
43msgstr ""
44
29#: qml/Components/EdgeDemoOverlay.qml:15145#: qml/Components/EdgeDemoOverlay.qml:151
30msgid "Skip intro"46msgid "Skip intro"
31msgstr ""47msgstr ""
3248
49#: qml/Components/EdgeDemo.qml:112
50msgid "Right edge"
51msgstr ""
52
33#: qml/Components/EdgeDemo.qml:11353#: qml/Components/EdgeDemo.qml:113
34msgid "Right edge"
35msgstr ""
36
37#: qml/Components/EdgeDemo.qml:114
38msgid "Try swiping from the right edge to unlock the phone"54msgid "Try swiping from the right edge to unlock the phone"
39msgstr ""55msgstr ""
4056
57#: qml/Components/EdgeDemo.qml:144
58msgid "Top edge"
59msgstr ""
60
41#: qml/Components/EdgeDemo.qml:14561#: qml/Components/EdgeDemo.qml:145
42msgid "Top edge"
43msgstr ""
44
45#: qml/Components/EdgeDemo.qml:146
46msgid "Try swiping from the top edge to access the indicators"62msgid "Try swiping from the top edge to access the indicators"
47msgstr ""63msgstr ""
4864
65#: qml/Components/EdgeDemo.qml:170
66msgid "Close"
67msgstr ""
68
49#: qml/Components/EdgeDemo.qml:17169#: qml/Components/EdgeDemo.qml:171
50msgid "Close"
51msgstr ""
52
53#: qml/Components/EdgeDemo.qml:172
54msgid "Swipe up again to close the settings screen"70msgid "Swipe up again to close the settings screen"
55msgstr ""71msgstr ""
5672
73#: qml/Components/EdgeDemo.qml:198
74msgid "Left edge"
75msgstr ""
76
57#: qml/Components/EdgeDemo.qml:19977#: qml/Components/EdgeDemo.qml:199
58msgid "Left edge"
59msgstr ""
60
61#: qml/Components/EdgeDemo.qml:200
62msgid "Swipe from the left to reveal the launcher for quick access to apps"78msgid "Swipe from the left to reveal the launcher for quick access to apps"
63msgstr ""79msgstr ""
6480
81#: qml/Components/EdgeDemo.qml:226
82msgid "Well done"
83msgstr ""
84
65#: qml/Components/EdgeDemo.qml:22785#: qml/Components/EdgeDemo.qml:227
66msgid "Well done"
67msgstr ""
68
69#: qml/Components/EdgeDemo.qml:228
70msgid ""86msgid ""
71"You have now mastered the edge gestures and can start using the "87"You have now mastered the edge gestures and can start using the "
72"phone<br><br>Tap on the screen to start"88"phone<br><br>Tap on the screen to start"
73msgstr ""89msgstr ""
7490
75#: qml/Components/Lockscreen.qml:21491#: qml/Components/Lockscreen.qml:220
76msgid "Emergency Call"92msgid "Emergency Call"
77msgstr ""93msgstr ""
7894
79#: qml/Components/Lockscreen.qml:23195#: qml/Components/Lockscreen.qml:243
80msgid "OK"96msgid "OK"
81msgstr ""97msgstr ""
8298
83#: qml/Components/PassphraseLockscreen.qml:6099#: qml/Components/PassphraseLockscreen.qml:62
84#, qt-format100#, qt-format
85msgid "Hello %1"101msgid "Hello %1"
86msgstr ""102msgstr ""
87103
88#: qml/Components/PassphraseLockscreen.qml:60104#: qml/Components/PassphraseLockscreen.qml:62
89msgid "Hello"105msgid "Hello"
90msgstr ""106msgstr ""
91107
@@ -97,19 +113,11 @@
97msgid "DONE"113msgid "DONE"
98msgstr ""114msgstr ""
99115
100#: qml/Components/SeeMore.qml:35116#: qml/Dash/GenericScopeView.qml:358
101msgid "See more"
102msgstr ""
103
104#: qml/Components/SeeMore.qml:58 qml/Dash/GenericScopeView.qml:330
105msgid "See less"117msgid "See less"
106msgstr ""118msgstr ""
107119
108#: qml/Dash/DashApps.qml:37120#: qml/Dash/GenericScopeView.qml:358
109msgid "Recent"
110msgstr ""
111
112#: qml/Dash/GenericScopeView.qml:330
113msgid "See all"121msgid "See all"
114msgstr ""122msgstr ""
115123
@@ -133,6 +141,26 @@
133msgid "Send"141msgid "Send"
134msgstr ""142msgstr ""
135143
144#: qml/Dash/ScopesOverview.qml:200
145msgid "Manage Dash"
146msgstr ""
147
148#: qml/Dash/ScopesOverview.qml:405
149msgid "Done"
150msgstr ""
151
152#: qml/Dash/ScopesOverview.qml:431
153msgid "Store"
154msgstr ""
155
156#: qml/Dash/ScopesOverviewTab.qml:36
157msgid "Favorites"
158msgstr ""
159
160#: qml/Dash/ScopesOverviewTab.qml:54
161msgid "All"
162msgstr ""
163
136#: qml/Greeter/Greeter.qml:157164#: qml/Greeter/Greeter.qml:157
137msgid "Swipe to unlock"165msgid "Swipe to unlock"
138msgstr ""166msgstr ""
@@ -157,11 +185,11 @@
157msgid "Speaking..."185msgid "Speaking..."
158msgstr ""186msgstr ""
159187
160#: qml/Notifications/NotificationMenuItemFactory.qml:91188#: qml/Notifications/NotificationMenuItemFactory.qml:100
161msgid "Show password"189msgid "Show password"
162msgstr ""190msgstr ""
163191
164#: qml/Notifications/NotificationMenuItemFactory.qml:103192#: qml/Notifications/NotificationMenuItemFactory.qml:115
165msgid "Please enter SIM PIN"193msgid "Please enter SIM PIN"
166msgstr ""194msgstr ""
167195
@@ -173,35 +201,43 @@
173msgid "Conference"201msgid "Conference"
174msgstr ""202msgstr ""
175203
176#: qml/Panel/Indicators/MenuItemFactory.qml:583204#: qml/Panel/Indicators/MenuItemFactory.qml:651
177msgid "In queue…"205msgid "In queue…"
178msgstr ""206msgstr ""
179207
180#: qml/Panel/Indicators/MenuItemFactory.qml:587208#: qml/Panel/Indicators/MenuItemFactory.qml:655
181msgid "Downloading"209msgid "Downloading"
182msgstr ""210msgstr ""
183211
184#: qml/Panel/Indicators/MenuItemFactory.qml:589212#: qml/Panel/Indicators/MenuItemFactory.qml:657
185msgid "Paused, tap to resume"213msgid "Paused, tap to resume"
186msgstr ""214msgstr ""
187215
188#: qml/Panel/Indicators/MenuItemFactory.qml:591216#: qml/Panel/Indicators/MenuItemFactory.qml:659
189msgid "Canceled"217msgid "Canceled"
190msgstr ""218msgstr ""
191219
192#: qml/Panel/Indicators/MenuItemFactory.qml:593220#: qml/Panel/Indicators/MenuItemFactory.qml:661
193msgid "Finished"221msgid "Finished"
194msgstr ""222msgstr ""
195223
196#: qml/Panel/Indicators/MenuItemFactory.qml:595224#: qml/Panel/Indicators/MenuItemFactory.qml:663
197msgid "Failed, tap to retry"225msgid "Failed, tap to retry"
198msgstr ""226msgstr ""
199227
228#: qml/Panel/Indicators/ModemInfoItem.qml:105
229msgid "Unlock SIM"
230msgstr ""
231
232#: qml/Panel/Indicators/RoamingIndication.qml:27
233msgid "Roaming"
234msgstr ""
235
200#: qml/Panel/SearchIndicator.qml:27236#: qml/Panel/SearchIndicator.qml:27
201msgid "Search"237msgid "Search"
202msgstr ""238msgstr ""
203239
204#: qml/Shell.qml:359240#: qml/Shell.qml:256
205#, qt-format241#, qt-format
206msgid "Please enter %1"242msgid "Please enter %1"
207msgstr ""243msgstr ""
208244
=== modified file 'qml/Components/PageHeader.qml'
--- qml/Components/PageHeader.qml 2014-08-06 19:39:30 +0000
+++ qml/Components/PageHeader.qml 2014-08-08 14:57:17 +0000
@@ -24,7 +24,7 @@
24Item {24Item {
25 id: root25 id: root
26 objectName: "pageHeader"26 objectName: "pageHeader"
27 implicitHeight: headerContainer.height + units.gu(2) + bottomContainer.height27 implicitHeight: headerContainer.height + bottomContainer.height + (showSignatureLine ? units.gu(2) : 0)
2828
29 property bool showBackButton: false29 property bool showBackButton: false
30 property string title30 property string title
@@ -32,6 +32,7 @@
32 property bool searchEntryEnabled: false32 property bool searchEntryEnabled: false
33 property ListModel searchHistory: SearchHistoryModel33 property ListModel searchHistory: SearchHistoryModel
34 property alias searchQuery: searchTextField.text34 property alias searchQuery: searchTextField.text
35 property alias showSignatureLine: bottomBorder.visible
3536
36 property alias bottomItem: bottomContainer.children37 property alias bottomItem: bottomContainer.children
37 property int paginationCount: 038 property int paginationCount: 0
@@ -251,6 +252,7 @@
251252
252 actions: [253 actions: [
253 Action {254 Action {
255 objectName: "search"
254 iconName: "search"256 iconName: "search"
255 visible: root.searchEntryEnabled257 visible: root.searchEntryEnabled
256 onTriggered: {258 onTriggered: {
257259
=== modified file 'qml/Components/ResponsiveGridView.qml'
--- qml/Components/ResponsiveGridView.qml 2014-07-11 12:12:50 +0000
+++ qml/Components/ResponsiveGridView.qml 2014-08-08 14:57:17 +0000
@@ -34,7 +34,7 @@
34 readonly property int cellWidth: gridView.cellWidth34 readonly property int cellWidth: gridView.cellWidth
35 readonly property int cellHeight: gridView.cellHeight35 readonly property int cellHeight: gridView.cellHeight
36 readonly property int totalContentHeight: {36 readonly property int totalContentHeight: {
37 return contentHeightForRows(Math.ceil(gridView.model.count / columns))37 return contentHeightForRows(Math.ceil(gridView.model.count / columns), cellHeight)
38 }38 }
39 property alias interactive: gridView.interactive39 property alias interactive: gridView.interactive
40 readonly property alias flicking: gridView.flicking40 readonly property alias flicking: gridView.flicking
@@ -47,8 +47,8 @@
47 property alias cacheBuffer: gridView.cacheBuffer47 property alias cacheBuffer: gridView.cacheBuffer
48 readonly property alias currentItem: gridView.currentItem48 readonly property alias currentItem: gridView.currentItem
4949
50 function contentHeightForRows(rows) {50 function contentHeightForRows(rows, height) {
51 return rows * cellHeight;51 return rows * height
52 }52 }
5353
54 GridView {54 GridView {
5555
=== removed directory 'qml/Dash/Apps'
=== modified file 'qml/Dash/CardCarousel.qml'
--- qml/Dash/CardCarousel.qml 2014-07-11 12:13:08 +0000
+++ qml/Dash/CardCarousel.qml 2014-08-08 14:57:17 +0000
@@ -48,8 +48,8 @@
4848
49 objectName: "carouselDelegate" + index49 objectName: "carouselDelegate" + index
5050
51 function clicked() { cardCarousel.clicked(index, model.result) }51 function clicked() { cardCarousel.clicked(index, model.result, loader.item, model) }
52 function pressAndHold() { cardCarousel.pressAndHold(index, model.result) }52 function pressAndHold() { cardCarousel.pressAndHold(index) }
5353
54 sourceComponent: cardTool.cardComponent54 sourceComponent: cardTool.cardComponent
55 onLoaded: {55 onLoaded: {
5656
=== modified file 'qml/Dash/CardGrid.qml'
--- qml/Dash/CardGrid.qml 2014-07-18 11:35:47 +0000
+++ qml/Dash/CardGrid.qml 2014-08-08 14:57:17 +0000
@@ -26,10 +26,20 @@
26 }26 }
2727
28 expandedHeight: grid.totalContentHeight28 expandedHeight: grid.totalContentHeight
29 collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows), expandedHeight)29 collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows, grid.cellHeight), expandedHeight)
30 collapsedItemCount: collapsedRows * grid.columns30 collapsedItemCount: collapsedRows * grid.columns
31 originY: grid.originY31 originY: grid.originY
3232
33 function cardPosition(index) {
34 var pos = {};
35 var row = Math.floor(index / grid.columns);
36 var column = index % grid.columns;
37 // Bit sad this is not symmetrical
38 pos.x = column * grid.cellWidth + grid.margins;
39 pos.y = row * grid.cellHeight;
40 return pos;
41 }
42
33 ResponsiveGridView {43 ResponsiveGridView {
34 id: grid44 id: grid
35 anchors.fill: parent45 anchors.fill: parent
@@ -53,6 +63,7 @@
53 item.objectName = "delegate" + index;63 item.objectName = "delegate" + index;
54 item.width = Qt.binding(function() { return cardTool.cardWidth; });64 item.width = Qt.binding(function() { return cardTool.cardWidth; });
55 item.height = Qt.binding(function() { return cardTool.cardHeight; });65 item.height = Qt.binding(function() { return cardTool.cardHeight; });
66 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
56 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });67 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
57 item.cardData = Qt.binding(function() { return model; });68 item.cardData = Qt.binding(function() { return model; });
58 item.template = Qt.binding(function() { return cardTool.template; });69 item.template = Qt.binding(function() { return cardTool.template; });
@@ -62,7 +73,7 @@
62 }73 }
63 Connections {74 Connections {
64 target: loader.item75 target: loader.item
65 onClicked: root.clicked(index, result)76 onClicked: root.clicked(index, result, loader.item, model)
66 onPressAndHold: root.pressAndHold(index)77 onPressAndHold: root.pressAndHold(index)
67 }78 }
68 }79 }
6980
=== modified file 'qml/Dash/CardVerticalJournal.qml'
--- qml/Dash/CardVerticalJournal.qml 2014-07-22 12:17:34 +0000
+++ qml/Dash/CardVerticalJournal.qml 2014-08-08 14:57:17 +0000
@@ -61,7 +61,7 @@
61 }61 }
62 Connections {62 Connections {
63 target: loader.item63 target: loader.item
64 onClicked: root.clicked(index, result)64 onClicked: root.clicked(index, result, loader.item, model)
65 onPressAndHold: root.pressAndHold(index)65 onPressAndHold: root.pressAndHold(index)
66 }66 }
67 }67 }
6868
=== modified file 'qml/Dash/Dash.qml'
--- qml/Dash/Dash.qml 2014-08-06 19:39:30 +0000
+++ qml/Dash/Dash.qml 2014-08-08 14:57:17 +0000
@@ -16,6 +16,7 @@
1616
17import QtQuick 2.217import QtQuick 2.2
18import Ubuntu.Components 0.118import Ubuntu.Components 0.1
19import Ubuntu.Gestures 0.1
19import Unity 0.220import Unity 0.2
20import Utils 0.121import Utils 0.1
21import Unity.DashCommunicator 0.122import Unity.DashCommunicator 0.1
@@ -73,26 +74,104 @@
73 id: scopes74 id: scopes
74 }75 }
7576
76 Image {77 QtObject {
78 id: overviewController
79 objectName: "overviewController"
80
81 property alias enableAnimation: progressAnimation.enabled
82 property real progress: 0
83 Behavior on progress {
84 id: progressAnimation
85 UbuntuNumberAnimation { }
86 }
87 }
88
89 ScopesOverview {
90 id: scopesOverview
91 objectName: "scopesOverview"
77 anchors.fill: parent92 anchors.fill: parent
78 source: parent.width > parent.height ? "graphics/paper_landscape.png" : "graphics/paper_portrait.png"93 scope: scopes.overviewScope
79 fillMode: Image.PreserveAspectCrop94 progress: overviewController.progress
80 horizontalAlignment: Image.AlignRight95 scopeScale: scopeItem.scope ? 0.4 : (1 - overviewController.progress * 0.6)
81 verticalAlignment: Image.AlignTop96 visible: scopeScale != 1
97 currentIndex: dashContent.currentIndex
98 onDone: {
99 if (currentTab == 1) {
100 animateDashFromAll(dashContent.currentScopeId);
101 }
102 hide();
103 }
104 onFavoriteSelected: {
105 setCurrentScope(scopeId, false, false);
106 dashContentCache.scheduleUpdate();
107 hide();
108 }
109 onAllFavoriteSelected: {
110 setCurrentScope(scopeId, false, false);
111 dashContentCache.scheduleUpdate();
112 animateDashFromAll(dashContent.currentScopeId);
113 hide();
114 }
115 onSearchSelected: {
116 var scopeIndex = -1;
117 for (var i = 0; i < scopes.count; ++i) {
118 if (scopes.getScope(i).id == scopeId) {
119 scopeIndex = i;
120 break;
121 }
122 }
123 if (scopeIndex >= 0) {
124 // Is a favorite one
125 setCurrentScope(scopeId, false, false);
126 dashContentCache.scheduleUpdate();
127 showDashFromPos(pos, size);
128 hide();
129 } else {
130 // Is not a favorite one, activate and get openScope
131 scope.activate(result);
132 }
133 }
134 function hide() {
135 overviewController.enableAnimation = true;
136 overviewController.progress = 0;
137 }
138 onProgressChanged: {
139 if (progress == 0) {
140 currentTab = scopeItem.scope ? 1 : 0;
141 }
142 }
143 }
144
145 ShaderEffectSource {
146 id: dashContentCache
147 parent: scopesOverview.dashItemEater
148 z: 1
149 sourceItem: dashContent
150 height: sourceItem.height
151 width: sourceItem.width
152 opacity: 1 - overviewController.progress
153 visible: overviewController.progress != 0 && scopeItem.scope === null
154 live: false
82 }155 }
83156
84 DashContent {157 DashContent {
85 id: dashContent158 id: dashContent
159
160 property var scopeThatOpenedScope: null
161
86 objectName: "dashContent"162 objectName: "dashContent"
87 width: parent.width163 width: dash.width
88 height: parent.height164 height: dash.height
89 scopes: scopes165 scopes: scopes
90 visible: x != -width166 visible: !scopesOverview.showingNonFavoriteScope && x != -width
91 onGotoScope: {167 onGotoScope: {
92 dash.setCurrentScope(scopeId, true, false);168 dash.setCurrentScope(scopeId, true, false);
93 }169 }
94 onOpenScope: {170 onOpenScope: {
171 scopeThatOpenedScope = currentScope;
95 scopeItem.scope = scope;172 scopeItem.scope = scope;
173 scopesOverview.currentTab = 1;
174 scopesOverview.ensureAllScopeVisible(scope.id);
96 x = -width;175 x = -width;
97 }176 }
98 onScopeLoaded: {177 onScopeLoaded: {
@@ -102,25 +181,63 @@
102 }181 }
103 }182 }
104 scale: dash.contentScale183 scale: dash.contentScale
105 clip: scale != 1.0 || scopeItem.visible184 clip: scale != 1.0 || scopeItem.visible || overviewController.progress != 0
106 Behavior on x {185 Behavior on x {
107 UbuntuNumberAnimation {186 UbuntuNumberAnimation {
187 duration: overviewController.progress != 0 ? 0 : UbuntuAnimation.FastDuration
108 onRunningChanged: {188 onRunningChanged: {
109 if (!running && dashContent.x == 0) {189 if (!running && dashContent.x == 0) {
110 dashContent.closeScope(scopeItem.scope);190 dashContent.scopeThatOpenedScope.closeScope(scopeItem.scope);
111 scopeItem.scope = null;191 scopeItem.scope = null;
192 if (overviewController.progress == 0) {
193 // Set tab to Favorites only if we are not showing the overview
194 scopesOverview.currentTab = 0;
195 }
112 }196 }
113 }197 }
114 }198 }
115 }199 }
200
201 enabled: overviewController.progress == 0
202 opacity: enabled ? 1 : 0
203 }
204
205 DashBackground
206 {
207 anchors.fill: scopeItem
208 visible: scopeItem.visible
209 parent: scopeItem.parent
210 scale: scopeItem.scale
211 opacity: scopeItem.opacity
116 }212 }
117213
118 GenericScopeView {214 GenericScopeView {
119 id: scopeItem215 id: scopeItem
120 anchors.left: dashContent.right216 objectName: "dashTempScopeItem"
217
218 readonly property real targetOverviewScale: {
219 if (scopesOverview.currentTab == 0) {
220 return 0.4;
221 } else {
222 return scopesOverview.allCardSize.width / scopeItem.width;
223 }
224 }
225 readonly property real overviewProgressScale: (1 - overviewController.progress * (1 - targetOverviewScale))
226 readonly property var targetOverviewPosition: scope ? scopesOverview.allScopeCardPosition(scope.id) : null
227 readonly property real overviewProgressX: scope && scopesOverview.currentTab == 1 && targetOverviewPosition ?
228 overviewController.progress * (targetOverviewPosition.x - (width - scopesOverview.allCardSize.width) / 2)
229 : 0
230 readonly property real overviewProgressY: scope && scopesOverview.currentTab == 1 && targetOverviewPosition ?
231 overviewController.progress * (targetOverviewPosition.y - (height - scopesOverview.allCardSize.height) / 2)
232 : 0
233
234 x: overviewController.progress == 0 ? dashContent.x + width : overviewProgressX
235 y: overviewController.progress == 0 ? dashContent.y : overviewProgressY
121 width: parent.width236 width: parent.width
122 height: parent.height237 height: parent.height
123 scale: dash.contentScale238 scale: dash.contentScale * overviewProgressScale
239 enabled: opacity == 1
240 opacity: 1 - overviewController.progress
124 clip: scale != 1.0241 clip: scale != 1.0
125 visible: scope != null242 visible: scope != null
126 hasBackAction: true243 hasBackAction: true
@@ -154,7 +271,7 @@
154 opacity: 0271 opacity: 0
155 visible: opacity > 0272 visible: opacity > 0
156273
157 readonly property bool processing: dashContent.processing || scopeItem.processing274 readonly property bool processing: dashContent.processing || scopeItem.processing || scopesOverview.processing
158275
159 Behavior on opacity {276 Behavior on opacity {
160 UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }277 UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
@@ -207,4 +324,45 @@
207 }324 }
208 }325 }
209326
327 Image {
328 source: "graphics/overview_hint.png"
329 anchors.horizontalCenter: parent.horizontalCenter
330 opacity: (scopeItem.scope ? scopeItem.pageHeaderTotallyVisible : dashContent.pageHeaderTotallyVisible) &&
331 (overviewDragHandle.enabled || overviewController.progress != 0) ? 1 : 0
332 Behavior on opacity {
333 enabled: overviewController.progress == 0
334 UbuntuNumberAnimation {}
335 }
336 y: parent.height - height * (1 - overviewController.progress * 4)
337 }
338
339 EdgeDragArea {
340 id: overviewDragHandle
341 objectName: "overviewDragHandle"
342 z: 1
343 direction: Direction.Upwards
344 enabled: !dashContent.previewShown &&
345 dashContent.currentScope &&
346 dashContent.currentScope.searchQuery == "" &&
347 (overviewController.progress == 0 || dragging)
348
349 readonly property real fullMovement: units.gu(20)
350
351 anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
352 height: units.gu(2)
353
354 onSceneDistanceChanged: {
355 if (overviewController.enableAnimation) {
356 dashContentCache.scheduleUpdate();
357 }
358 overviewController.enableAnimation = false;
359 overviewController.progress = Math.max(0, Math.min(1, sceneDistance / fullMovement));
360 }
361
362 onDraggingChanged: {
363 overviewController.enableAnimation = true;
364 overviewController.progress = (overviewController.progress > 0.7) ? 1 : 0;
365 }
366 }
367
210}368}
211369
=== added file 'qml/Dash/DashBackground.qml'
--- qml/Dash/DashBackground.qml 1970-01-01 00:00:00 +0000
+++ qml/Dash/DashBackground.qml 2014-08-08 14:57:17 +0000
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2013, 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19Image {
20 source: anchors.fill.width > anchors.fill.height ? "graphics/paper_landscape.png" : "graphics/paper_portrait.png"
21 fillMode: Image.PreserveAspectCrop
22 horizontalAlignment: Image.AlignRight
23 verticalAlignment: Image.AlignTop
24}
025
=== modified file 'qml/Dash/DashContent.qml'
--- qml/Dash/DashContent.qml 2014-08-06 19:39:30 +0000
+++ qml/Dash/DashContent.qml 2014-08-08 14:57:17 +0000
@@ -25,8 +25,14 @@
2525
26 property alias scopes: dashContentList.model26 property alias scopes: dashContentList.model
27 readonly property alias currentIndex: dashContentList.currentIndex27 readonly property alias currentIndex: dashContentList.currentIndex
28 readonly property string currentScopeId: dashContentList.currentItem ? dashContentList.currentItem.scopeId : ""
29 readonly property var currentScope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null
30 readonly property bool previewShown: dashContentList.currentItem && dashContentList.currentItem.item ?
31 dashContentList.currentItem.item.previewShown : false
28 readonly property bool processing: dashContentList.currentItem && dashContentList.currentItem.item32 readonly property bool processing: dashContentList.currentItem && dashContentList.currentItem.item
29 && dashContentList.currentItem.item.processing || false33 && dashContentList.currentItem.item.processing || false
34 readonly property bool pageHeaderTotallyVisible: dashContentList.currentItem && dashContentList.currentItem.item
35 && dashContentList.currentItem.item.pageHeaderTotallyVisible || false
3036
31 signal scopeLoaded(string scopeId)37 signal scopeLoaded(string scopeId)
32 signal gotoScope(string scopeId)38 signal gotoScope(string scopeId)
@@ -77,15 +83,15 @@
77 }83 }
78 }84 }
7985
80 function closeScope(scope) {
81 dashContentList.currentItem.theScope.closeScope(scope)
82 }
83
84 Item {86 Item {
85 id: dashContentListHolder87 id: dashContentListHolder
8688
87 anchors.fill: parent89 anchors.fill: parent
8890
91 DashBackground {
92 anchors.fill: parent
93 }
94
89 ListView {95 ListView {
90 id: dashContentList96 id: dashContentList
91 objectName: "dashContentList"97 objectName: "dashContentList"
9298
=== modified file 'qml/Dash/DashRenderer.qml'
--- qml/Dash/DashRenderer.qml 2014-07-22 12:17:34 +0000
+++ qml/Dash/DashRenderer.qml 2014-08-08 14:57:17 +0000
@@ -41,7 +41,9 @@
41 /// Emitted when the user clicked on an item41 /// Emitted when the user clicked on an item
42 /// @param index is the index of the clicked item42 /// @param index is the index of the clicked item
43 /// @param result result model of the cliked item, used for activation43 /// @param result result model of the cliked item, used for activation
44 signal clicked(int index, var result)44 /// @param item item that has been clicked
45 /// @param itemModel model of the item
46 signal clicked(int index, var result, var item, var itemModel)
4547
46 /// Emitted when the user pressed and held on an item48 /// Emitted when the user pressed and held on an item
47 /// @param index is the index of the held item49 /// @param index is the index of the held item
4850
=== modified file 'qml/Dash/GenericScopeView.qml'
--- qml/Dash/GenericScopeView.qml 2014-08-06 19:39:30 +0000
+++ qml/Dash/GenericScopeView.qml 2014-08-08 14:57:17 +0000
@@ -25,7 +25,7 @@
25FocusScope {25FocusScope {
26 id: scopeView26 id: scopeView
2727
28 readonly property alias navigationShown: dashNavigation.showList28 readonly property bool navigationShown: pageHeaderLoader.item ? pageHeaderLoader.item.bottomItem[0].showList : false
29 property var scope: null29 property var scope: null
30 property SortFilterProxyModel categories: categoryFilter30 property SortFilterProxyModel categories: categoryFilter
31 property bool isCurrent: false31 property bool isCurrent: false
@@ -33,8 +33,11 @@
33 property bool hasBackAction: false33 property bool hasBackAction: false
34 property bool enableHeightBehaviorOnNextCreation: false34 property bool enableHeightBehaviorOnNextCreation: false
35 property var categoryView: categoryView35 property var categoryView: categoryView
36 property alias paginationCount: pageHeader.paginationCount36 property bool showPageHeader: true
37 property alias paginationIndex: pageHeader.paginationIndex37 readonly property alias previewShown: previewListView.open
38 property int paginationCount: 0
39 property int paginationIndex: 0
40 property alias pageHeaderTotallyVisible: categoryView.pageHeaderTotallyVisible
3841
39 property var scopeStyle: ScopeStyle {42 property var scopeStyle: ScopeStyle {
40 style: scope ? scope.customizations : {}43 style: scope ? scope.customizations : {}
@@ -56,6 +59,34 @@
56 previewListView.open = false;59 previewListView.open = false;
57 }60 }
5861
62 function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) {
63 if (scope.id === "scopes" || scope.id == "clickscope") {
64 // TODO Technically it is possible that calling activate() will make the scope emit
65 // previewRequested so that we show a preview but there's no scope that does that yet
66 // so it's not implemented
67 scope.activate(result)
68 } else {
69 openPreview(index, resultsModel, limitedCategoryItemCount);
70 }
71 }
72
73 function itemPressedAndHeld(index, resultsModel, limitedCategoryItemCount) {
74 openPreview(index, resultsModel, limitedCategoryItemCount);
75 }
76
77 function openPreview(index, resultsModel, limitedCategoryItemCount) {
78 if (limitedCategoryItemCount > 0) {
79 previewLimitModel.model = resultsModel;
80 previewLimitModel.limit = limitedCategoryItemCount;
81 previewListView.model = previewLimitModel;
82 } else {
83 previewListView.model = resultsModel;
84 }
85 previewListView.currentIndex = -1;
86 previewListView.currentIndex = index;
87 previewListView.open = true;
88 }
89
59 Binding {90 Binding {
60 target: scope91 target: scope
61 property: "isActive"92 property: "isActive"
@@ -72,22 +103,24 @@
72 }103 }
73104
74 onIsCurrentChanged: {105 onIsCurrentChanged: {
75 pageHeader.resetSearch();106 if (showPageHeader) {
107 pageHeaderLoader.item.resetSearch();
108 }
76 previewListView.open = false;109 previewListView.open = false;
77 }110 }
78111
79 Binding {112 Binding {
80 target: scopeView.scope113 target: scopeView.scope
81 property: "searchQuery"114 property: "searchQuery"
82 value: pageHeader.searchQuery115 value: pageHeaderLoader.item ? pageHeaderLoader.item.searchQuery : ""
83 when: isCurrent116 when: isCurrent && showPageHeader
84 }117 }
85118
86 Binding {119 Binding {
87 target: pageHeader120 target: pageHeaderLoader.item
88 property: "searchQuery"121 property: "searchQuery"
89 value: scopeView.scope ? scopeView.scope.searchQuery : ""122 value: scopeView.scope ? scopeView.scope.searchQuery : ""
90 when: isCurrent123 when: isCurrent && showPageHeader
91 }124 }
92125
93 Connections {126 Connections {
@@ -114,10 +147,13 @@
114 model: scopeView.categories147 model: scopeView.categories
115 forceNoClip: previewListView.open148 forceNoClip: previewListView.open
116 pixelAligned: true149 pixelAligned: true
117 interactive: !dashNavigation.showList150 interactive: !navigationShown
118151
119 property string expandedCategoryId: ""152 property string expandedCategoryId: ""
120153
154 readonly property bool pageHeaderTotallyVisible: scopeView.showPageHeader &&
155 ((headerItemShownHeight == 0 && categoryView.contentY <= categoryView.originY) || (headerItemShownHeight == pageHeaderLoader.item.height))
156
121 delegate: ListItems.Base {157 delegate: ListItems.Base {
122 id: baseItem158 id: baseItem
123 objectName: "dashCategory" + category159 objectName: "dashCategory" + category
@@ -223,28 +259,19 @@
223 Connections {259 Connections {
224 target: rendererLoader.item260 target: rendererLoader.item
225 onClicked: {261 onClicked: {
226 if (scopeView.scope.id === "scopes" || scopeView.scope.id == "clickscope") {262 scopeView.itemClicked(index, result, item, itemModel, target.model, categoryItemCount());
227 // TODO Technically it is possible that calling activate() will make the scope emit263 }
228 // previewRequested so that we show a preview but there's no scope that does that yet264
229 // so it's not implemented265 onPressAndHold: {
230 scopeView.scope.activate(result)266 scopeView.itemPressedAndHeld(index, target.model, categoryItemCount());
231 } else {267 }
232 openPreview(index);268
233 }269 function categoryItemCount() {
234 }270 var categoryItemCount = -1;
235 onPressAndHold: openPreview(index)
236
237 function openPreview(index) {
238 if (!rendererLoader.expanded && !seeAllLabel.visible && target.collapsedItemCount > 0) {271 if (!rendererLoader.expanded && !seeAllLabel.visible && target.collapsedItemCount > 0) {
239 previewLimitModel.model = target.model;272 categoryItemCount = target.collapsedItemCount;
240 previewLimitModel.limit = target.collapsedItemCount;
241 previewListView.model = previewLimitModel;
242 } else {
243 previewListView.model = target.model;
244 }273 }
245 previewListView.currentIndex = -1;274 return categoryItemCount;
246 previewListView.currentIndex = index;
247 previewListView.open = true;
248 }275 }
249 }276 }
250 Connections {277 Connections {
@@ -380,26 +407,35 @@
380 }407 }
381 }408 }
382409
383 pageHeader: PageHeader {410 pageHeader: scopeView.showPageHeader ? pageHeaderLoader : null
384 id: pageHeader411 Loader {
385 objectName: "scopePageHeader"412 id: pageHeaderLoader
386 width: parent.width413 width: parent.width
387 title: scopeView.scope ? scopeView.scope.name : ""414 sourceComponent: scopeView.showPageHeader ? pageHeaderComponent : undefined
388 showBackButton: scopeView.hasBackAction415 Component {
389 searchEntryEnabled: true416 id: pageHeaderComponent
390 scopeStyle: scopeView.scopeStyle417 PageHeader {
391418 objectName: "scopePageHeader"
392 bottomItem: DashNavigation {419 width: parent.width
393 id: dashNavigation420 title: scopeView.scope ? scopeView.scope.name : ""
394 scope: scopeView.scope421 showBackButton: scopeView.hasBackAction
395 width: parent.width <= units.gu(60) ? parent.width : units.gu(40)422 searchEntryEnabled: true
396 anchors.right: parent.right423 scopeStyle: scopeView.scopeStyle
397 windowHeight: scopeView.height424 paginationCount: scopeView.paginationCount
398 windowWidth: scopeView.width425 paginationIndex: scopeView.paginationIndex
399 scopeStyle: scopeView.scopeStyle426
427 bottomItem: DashNavigation {
428 scope: scopeView.scope
429 width: parent.width <= units.gu(60) ? parent.width : units.gu(40)
430 anchors.right: parent.right
431 windowHeight: scopeView.height
432 windowWidth: scopeView.width
433 scopeStyle: scopeView.scopeStyle
434 }
435
436 onBackClicked: scopeView.backClicked()
437 }
400 }438 }
401
402 onBackClicked: scopeView.backClicked()
403 }439 }
404 }440 }
405441
@@ -418,7 +454,9 @@
418 anchors.left: categoryView.right454 anchors.left: categoryView.right
419455
420 onOpenChanged: {456 onOpenChanged: {
421 pageHeader.unfocus();457 if (showPageHeader) {
458 pageHeaderLoader.item.unfocus();
459 }
422 }460 }
423 }461 }
424462
425463
=== modified file 'qml/Dash/PreviewListView.qml'
--- qml/Dash/PreviewListView.qml 2014-07-30 15:46:44 +0000
+++ qml/Dash/PreviewListView.qml 2014-08-08 14:57:17 +0000
@@ -108,7 +108,7 @@
108 anchors {108 anchors {
109 left: parent.left109 left: parent.left
110 right: parent.right110 right: parent.right
111 top: pageHeader.bottom111 top: header.bottom
112 bottom: parent.bottom112 bottom: parent.bottom
113 }113 }
114114
115115
=== added file 'qml/Dash/ScopesOverview.qml'
--- qml/Dash/ScopesOverview.qml 1970-01-01 00:00:00 +0000
+++ qml/Dash/ScopesOverview.qml 2014-08-08 14:57:17 +0000
@@ -0,0 +1,531 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Dash 0.1
19import Ubuntu.Components 0.1
20import "../Components"
21
22Item {
23 id: root
24
25 // Properties set by parent
26 property real progress: 0
27 property var scope: null
28 property int currentIndex: 0
29 property real scopeScale: 1
30
31 // Properties set and used by parent
32 property alias currentTab: tabBar.currentTab
33
34 // Properties used by parent
35 readonly property bool processing: searchResultsViewer.processing || tempScopeItem.processing
36 property bool growingDashFromPos: false
37 readonly property bool searching: scope && scope.searchQuery == ""
38 readonly property bool showingNonFavoriteScope: tempScopeItem.scope != null
39 readonly property var dashItemEater: {
40 if (!forceXYScalerEater && tabBar.currentTab == 0 && middleItems.count > 0) {
41 var loaderItem = middleItems.itemAt(0).item;
42 return loaderItem && loaderItem.currentItem ? loaderItem.currentItem : null;
43 }
44 return scopesOverviewXYScaler;
45 }
46 readonly property size allCardSize: {
47 if (middleItems.count > 1) {
48 var loaderItem = middleItems.itemAt(1).item;
49 if (loaderItem) {
50 var cardTool = loaderItem.cardTool;
51 return Qt.size(cardTool.cardWidth, cardTool.cardHeight);
52 }
53 }
54 return Qt.size(0, 0);
55 }
56
57 // Internal properties
58 property bool forceXYScalerEater: false
59
60 signal done()
61 signal favoriteSelected(var scopeId)
62 signal allFavoriteSelected(var scopeId)
63 signal searchSelected(var scopeId, var result, var pos, var size)
64
65 Connections {
66 target: scope
67 onOpenScope: {
68 var itemPos = scopesOverviewXYScaler.restorePosition;
69 var itemSize = scopesOverviewXYScaler.restoreSize;
70 scopesOverviewXYScaler.scale = itemSize.width / scopesOverviewXYScaler.width;
71 if (itemPos) {
72 scopesOverviewXYScaler.x = itemPos.x -(scopesOverviewXYScaler.width - scopesOverviewXYScaler.width * scopesOverviewXYScaler.scale) / 2;
73 scopesOverviewXYScaler.y = itemPos.y -(scopesOverviewXYScaler.height - scopesOverviewXYScaler.height * scopesOverviewXYScaler.scale) / 2;
74 } else {
75 scopesOverviewXYScaler.x = 0;
76 scopesOverviewXYScaler.y = 0;
77 }
78 scopesOverviewXYScaler.opacity = 0;
79 tempScopeItem.scope = scope;
80 middleItems.overrideOpacity = 0;
81 scopesOverviewXYScaler.scale = 1;
82 scopesOverviewXYScaler.x = 0;
83 scopesOverviewXYScaler.y = 0;
84 scopesOverviewXYScaler.opacity = 1;
85 }
86 onGotoScope: {
87 if (tabBar.currentTab == 0) {
88 root.favoriteSelected(scopeId);
89 } else {
90 root.allFavoriteSelected(scopeId);
91 }
92 }
93 }
94
95 Binding {
96 target: scope
97 property: "isActive"
98 value: progress === 1
99 }
100
101 function animateDashFromAll(scopeId) {
102 var currentScopePos = allScopeCardPosition(scopeId);
103 if (currentScopePos) {
104 showDashFromPos(currentScopePos, allCardSize);
105 } else {
106 console.log("Warning: Could not find Dash OverView All card position for scope", dashContent.currentScopeId);
107 }
108 }
109
110 function showDashFromPos(itemPos, itemSize) {
111 scopesOverviewXYScaler.scale = itemSize.width / scopesOverviewXYScaler.width;
112 scopesOverviewXYScaler.x = itemPos.x -(scopesOverviewXYScaler.width - scopesOverviewXYScaler.width * scopesOverviewXYScaler.scale) / 2;
113 scopesOverviewXYScaler.y = itemPos.y -(scopesOverviewXYScaler.height - scopesOverviewXYScaler.height * scopesOverviewXYScaler.scale) / 2;
114 scopesOverviewXYScaler.opacity = 0;
115 root.growingDashFromPos = true;
116 scopesOverviewXYScaler.scale = 1;
117 scopesOverviewXYScaler.x = 0;
118 scopesOverviewXYScaler.y = 0;
119 scopesOverviewXYScaler.opacity = 1;
120 }
121
122 function allScopeCardPosition(scopeId) {
123 if (middleItems.count > 1) {
124 var loaderItem = middleItems.itemAt(1).item;
125 if (loaderItem) {
126 var pos = loaderItem.scopeCardPosition(scopeId);
127 return loaderItem.mapToItem(null, pos.x, pos.y);
128 }
129 }
130 }
131
132 function ensureAllScopeVisible(scopeId) {
133 if (middleItems.count > 1) {
134 var loaderItem = middleItems.itemAt(1).item;
135 if (loaderItem) {
136 var pos = loaderItem.scopeCardPosition(scopeId);
137 loaderItem.contentY = Math.min(pos.y, loaderItem.contentHeight - loaderItem.height);
138 }
139 }
140 }
141
142 onProgressChanged: {
143 if (progress == 0) {
144 pageHeader.resetSearch();
145 pageHeader.unfocus(); // Shouldn't the previous call do this too?
146 }
147 }
148
149 ScopeStyle {
150 id: overviewScopeStyle
151 style: { "foreground-color" : "white", "background-color" : "transparent" }
152 }
153
154 DashBackground {
155 anchors.fill: parent
156 source: "graphics/dark_background.jpg"
157 }
158
159 Connections {
160 target: pageHeader
161 onSearchQueryChanged: {
162 // Need this in order, otherwise something gets unhappy in rendering
163 // of the overlay in carousels because the parent of the dash dies for
164 // a moment, this way we make sure it's reparented first
165 // by forceXYScalerEater making dashItemEater return scopesOverviewXYScaler
166 // before we kill the previous parent by scope.searchQuery
167 root.forceXYScalerEater = true;
168 root.scope.searchQuery = pageHeader.searchQuery;
169 root.forceXYScalerEater = false;
170 }
171 }
172
173 Binding {
174 target: pageHeader
175 property: "searchQuery"
176 value: scope ? scope.searchQuery : ""
177 }
178
179 Item {
180 id: scopesOverviewContent
181 x: previewListView.open ? -width : 0
182 Behavior on x { UbuntuNumberAnimation { } }
183 width: parent.width
184 height: parent.height
185
186 PageHeader {
187 id: pageHeader
188 objectName: "scopesOverviewPageHeader"
189
190 readonly property real yDisplacement: pageHeader.height + tabBar.height + tabBar.anchors.margins
191
192 y: {
193 if (root.progress < 0.5) {
194 return -yDisplacement;
195 } else {
196 return -yDisplacement + (root.progress - 0.5) * yDisplacement * 2;
197 }
198 }
199 width: parent.width
200 clip: true
201 title: i18n.tr("Manage Dash")
202 scopeStyle: overviewScopeStyle
203 showSignatureLine: false
204 searchEntryEnabled: true
205 }
206
207 ScopesOverviewTab {
208 id: tabBar
209 anchors {
210 left: parent.left
211 right: parent.right
212 top: pageHeader.bottom
213 margins: units.gu(2)
214 }
215 height: units.gu(4)
216
217 enabled: opacity == 1
218 opacity: !scope || scope.searchQuery == "" ? 1 : 0
219 Behavior on opacity { UbuntuNumberAnimation { } }
220 }
221
222 Repeater {
223 id: middleItems
224 objectName: "scopesOverviewRepeater"
225 property real overrideOpacity: -1
226 model: scope && scope.searchQuery == "" ? scope.categories : null
227 delegate: Loader {
228 id: loader
229 objectName: "scopesOverviewRepeaterChild" + index
230
231 height: {
232 if (index == 0) {
233 return root.height;
234 } else {
235 return root.height - pageHeader.height - tabBar.height - tabBar.anchors.margins - units.gu(2);
236 }
237 }
238 width: {
239 if (index == 0) {
240 return root.width / scopeScale;
241 } else {
242 return root.width;
243 }
244 }
245 x: {
246 if (index == 0) {
247 return (root.width - width) / 2;
248 } else {
249 return 0;
250 }
251 }
252 anchors {
253 bottom: scopesOverviewContent.bottom
254 }
255
256 scale: index == 0 ? scopeScale : 1
257
258 opacity: {
259 if (middleItems.overrideOpacity >= 0)
260 return middleItems.overrideOpacity;
261
262 if (tabBar.currentTab != index)
263 return 0;
264
265 return index == 0 ? 1 : root.progress;
266 }
267 Behavior on opacity {
268 enabled: root.progress == 1
269 UbuntuNumberAnimation { }
270 }
271 enabled: opacity == 1
272
273 clip: index == 1
274
275 CardTool {
276 id: cardTool
277 objectName: "cardTool"
278 count: results.count
279 template: model.renderer
280 components: model.components
281 viewWidth: parent.width
282 }
283
284 source: {
285 if (index == 0 && categoryId == "favorites") return "ScopesOverviewFavorites.qml";
286 else if (index == 1 && categoryId == "all") return "ScopesOverviewAll.qml";
287 else return "";
288 }
289
290 onLoaded: {
291 item.model = Qt.binding(function() { return results; });
292 item.cardTool = cardTool;
293 if (index == 0) {
294 item.scopeWidth = Qt.binding(function() { return root.width; });
295 item.scopeHeight = Qt.binding(function() { return root.height; });
296 item.appliedScale = Qt.binding(function() { return loader.scale });
297 item.currentIndex = Qt.binding(function() { return root.currentIndex });
298 } else if (index == 1) {
299 item.extraHeight = bottomBar.height;
300 }
301 }
302
303 Connections {
304 target: loader.item
305 onClicked: {
306 if (tabBar.currentTab == 0) {
307 root.favoriteSelected(itemModel.scopeId);
308 } else {
309 var favoriteScopesItem = middleItems.itemAt(0).item;
310 var scopeIndex = favoriteScopesItem.model.scopeIndex(itemModel.scopeId);
311 if (scopeIndex >= 0) {
312 root.allFavoriteSelected(itemModel.scopeId);
313 } else {
314 // Will result in an openScope from root.scope
315 scopesOverviewXYScaler.restorePosition = item.mapToItem(null, 0, 0);
316 scopesOverviewXYScaler.restoreSize = allCardSize;
317 root.scope.activate(result);
318 }
319 }
320 }
321 onPressAndHold: {
322 // Preview can call openScope so make sure restorePosition and restoreSize are set
323 scopesOverviewXYScaler.restorePosition = undefined;
324 scopesOverviewXYScaler.restoreSize = allCardSize;
325
326 previewListView.model = target.model;
327 previewListView.currentIndex = -1;
328 previewListView.currentIndex = index;
329 previewListView.open = true;
330 }
331 }
332 }
333 }
334
335 GenericScopeView {
336 id: searchResultsViewer
337 objectName: "searchResultsViewer"
338 anchors {
339 top: pageHeader.bottom
340 right: parent.right
341 left: parent.left
342 bottom: parent.bottom
343 }
344 scope: root.scope && root.scope.searchQuery != "" ? root.scope : null
345 scopeStyle: overviewScopeStyle
346 enabled: opacity == 1
347 showPageHeader: false
348 clip: true
349 opacity: searchResultsViewer.scope ? 1 : 0
350 isCurrent: true
351 Behavior on opacity { UbuntuNumberAnimation { } }
352
353 function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) {
354 pageHeader.closePopup();
355 if (itemModel.scopeId) {
356 // This can end up in openScope so save restorePosition and restoreSize
357 scopesOverviewXYScaler.restorePosition = item.mapToItem(null, 0, 0);
358 scopesOverviewXYScaler.restoreSize = Qt.size(item.width, item.height);
359 root.searchSelected(itemModel.scopeId, result, item.mapToItem(null, 0, 0), Qt.size(item.width, item.height));
360 } else {
361 // Not a scope, just activate it
362 searchResultsViewer.scope.activate(result);
363 }
364 }
365
366 function itemPressedAndHeld(index, resultsModel, limitedCategoryItemCount) {
367 // Do nothing
368 }
369 }
370
371 Rectangle {
372 id: bottomBar
373 color: "black"
374 height: units.gu(8)
375 width: parent.width
376 enabled: opacity == 1
377 opacity: scope && scope.searchQuery == "" ? 1 : 0
378 Behavior on opacity { UbuntuNumberAnimation { } }
379 y: {
380 if (root.progress < 0.5) {
381 return parent.height;
382 } else {
383 return parent.height - (root.progress - 0.5) * height * 2;
384 }
385 }
386
387 AbstractButton {
388 objectName: "scopesOverviewDoneButton"
389 width: Math.max(label.width + units.gu(2), units.gu(10))
390 height: units.gu(4)
391 anchors {
392 left: parent.left
393 leftMargin: units.gu(2)
394 verticalCenter: parent.verticalCenter
395 }
396 Rectangle {
397 anchors.fill: parent
398 border.color: "white"
399 border.width: units.dp(1)
400 radius: units.dp(10)
401 color: parent.pressed ? "gray" : "transparent"
402 }
403 Label {
404 id: label
405 anchors.centerIn: parent
406 text: i18n.tr("Done")
407 color: parent.pressed ? "black" : "white"
408 }
409 onClicked: root.done();
410 }
411
412 AbstractButton {
413 objectName: "scopesOverviewStoreButton"
414 width: Math.max(storeLabel.width, units.gu(10))
415 height: units.gu(4)
416 anchors {
417 right: parent.right
418 verticalCenter: parent.verticalCenter
419 }
420 Icon {
421 id: storeImage
422 name: "ubuntu-store-symbolic"
423 color: "white"
424 anchors.horizontalCenter: parent.horizontalCenter
425 width: units.gu(2)
426 height: units.gu(2)
427 }
428 Label {
429 id: storeLabel
430 anchors.horizontalCenter: parent.horizontalCenter
431 anchors.top: storeImage.bottom
432 text: i18n.tr("Store")
433 color: "white"
434 }
435 onClicked: {
436 // Just zoom from the middle
437 scopesOverviewXYScaler.restorePosition = undefined;
438 scopesOverviewXYScaler.restoreSize = allCardSize;
439 scope.performQuery("scope://com.canonical.scopes.clickstore");
440 }
441 }
442 }
443 }
444
445 PreviewListView {
446 id: previewListView
447 objectName: "scopesOverviewPreviewListView"
448 scope: root.scope
449 scopeStyle: overviewScopeStyle
450 visible: x != width
451 width: parent.width
452 height: parent.height
453 anchors.left: scopesOverviewContent.right
454 }
455
456
457
458 Item {
459 id: scopesOverviewXYScaler
460 width: parent.width
461 height: parent.height
462
463 clip: scale != 1.0
464 enabled: scale == 1
465
466 property bool animationsEnabled: root.showingNonFavoriteScope || root.growingDashFromPos
467
468 property var restorePosition
469 property var restoreSize
470
471 Behavior on x {
472 enabled: scopesOverviewXYScaler.animationsEnabled
473 UbuntuNumberAnimation { }
474 }
475 Behavior on y {
476 enabled: scopesOverviewXYScaler.animationsEnabled
477 UbuntuNumberAnimation { }
478 }
479 Behavior on opacity {
480 enabled: scopesOverviewXYScaler.animationsEnabled
481 UbuntuNumberAnimation { }
482 }
483 Behavior on scale {
484 enabled: scopesOverviewXYScaler.animationsEnabled
485 UbuntuNumberAnimation {
486 onRunningChanged: {
487 if (!running) {
488 if (root.showingNonFavoriteScope && scopesOverviewXYScaler.scale != 1) {
489 root.scope.closeScope(tempScopeItem.scope);
490 tempScopeItem.scope = null;
491 } else if (root.growingDashFromPos) {
492 root.growingDashFromPos = false;
493 }
494 }
495 }
496 }
497 }
498
499 DashBackground {
500 anchors.fill: tempScopeItem
501 visible: tempScopeItem.visible
502 parent: tempScopeItem.parent
503 }
504
505 GenericScopeView {
506 id: tempScopeItem
507 objectName: "scopesOverviewTempScopeItem"
508
509 width: parent.width
510 height: parent.height
511 scale: dash.contentScale
512 clip: scale != 1.0
513 visible: scope != null
514 hasBackAction: true
515 isCurrent: visible
516 onBackClicked: {
517 var v = scopesOverviewXYScaler.restoreSize.width / tempScopeItem.width;
518 scopesOverviewXYScaler.scale = v;
519 if (scopesOverviewXYScaler.restorePosition) {
520 scopesOverviewXYScaler.x = scopesOverviewXYScaler.restorePosition.x -(tempScopeItem.width - tempScopeItem.width * v) / 2;
521 scopesOverviewXYScaler.y = scopesOverviewXYScaler.restorePosition.y -(tempScopeItem.height - tempScopeItem.height * v) / 2;
522 } else {
523 scopesOverviewXYScaler.x = 0;
524 scopesOverviewXYScaler.y = 0;
525 }
526 scopesOverviewXYScaler.opacity = 0;
527 middleItems.overrideOpacity = -1;
528 }
529 }
530 }
531}
0532
=== added file 'qml/Dash/ScopesOverviewAll.qml'
--- qml/Dash/ScopesOverviewAll.qml 1970-01-01 00:00:00 +0000
+++ qml/Dash/ScopesOverviewAll.qml 2014-08-08 14:57:17 +0000
@@ -0,0 +1,54 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20Flickable {
21 id: root
22
23 property alias model: cardGrid.model
24 property alias cardTool: cardGrid.cardTool
25
26 property real extraHeight: 0
27
28 signal clicked(int index, var result, var item, var itemModel)
29 signal pressAndHold(int index)
30
31 contentHeight: cardGrid.expandedHeight + extraHeight
32 contentWidth: cardGrid.width
33 flickableDirection: Flickable.VerticalFlick
34
35 function scopeCardPosition(scopeId) {
36 var index = model.scopeIndex(scopeId);
37 var pos = cardGrid.cardPosition(index);
38 pos.y = pos.y - root.contentY;
39 return pos;
40 }
41
42 CardGrid {
43 id: cardGrid
44 width: root.width
45 height: parent.height
46
47 onClicked: {
48 root.clicked(index, result, item, itemModel);
49 }
50 onPressAndHold: {
51 root.pressAndHold(index);
52 }
53 }
54}
055
=== added file 'qml/Dash/ScopesOverviewFavorites.qml'
--- qml/Dash/ScopesOverviewFavorites.qml 1970-01-01 00:00:00 +0000
+++ qml/Dash/ScopesOverviewFavorites.qml 2014-08-08 14:57:17 +0000
@@ -0,0 +1,73 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19Flickable {
20 id: root
21
22 signal clicked(int index, var result, var itemModel)
23 signal pressAndHold(int index)
24
25 property var cardTool: null
26 property real scopeHeight: 0
27 property real scopeWidth: 0
28 property real appliedScale: 1
29 property int currentIndex: -1
30 property var currentItem: currentIndex < repeater.count ? repeater.itemAt(currentIndex) : null
31
32 property alias model: repeater.model
33
34 contentHeight: height
35 contentWidth: repeater.count * root.scopeWidth + units.gu(2) / appliedScale * (repeater.count - 1)
36
37 contentX: {
38 var indexX = currentIndex * scopeWidth + units.gu(2) / appliedScale * currentIndex;
39 var newContentX = indexX - (width - scopeWidth) / 2;
40 newContentX = Math.min(Math.max(newContentX, 0), contentWidth - width);
41 return newContentX;
42 }
43
44 Repeater {
45 id: repeater
46 objectName: "scopesOverviewFavoritesRepeater"
47
48 delegate: Loader {
49 id: loader
50
51 x: index * root.scopeWidth + units.gu(2) / appliedScale * index
52 asynchronous: true
53
54 sourceComponent: cardTool.cardComponent
55 onLoaded: {
56 item.fixedArtShapeSize = Qt.binding(function() { return Qt.size(root.scopeWidth, root.scopeHeight); });
57 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight / appliedScale; });
58 item.fontScale = Qt.binding(function() { return 1 / appliedScale; });
59 item.height = Qt.binding(function() { return root.scopeHeight; });
60 item.width = Qt.binding(function() { return root.scopeWidth; });
61 item.cardData = Qt.binding(function() { return model; });
62 item.template = Qt.binding(function() { return cardTool.template; });
63 item.components = Qt.binding(function() { return cardTool.components; });
64 item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
65 }
66
67 Connections {
68 target: loader.item
69 onClicked: root.clicked(index, result, model)
70 }
71 }
72 }
73}
074
=== added file 'qml/Dash/ScopesOverviewTab.qml'
--- qml/Dash/ScopesOverviewTab.qml 1970-01-01 00:00:00 +0000
+++ qml/Dash/ScopesOverviewTab.qml 2014-08-08 14:57:17 +0000
@@ -0,0 +1,74 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.3
18import Ubuntu.Components 0.1
19
20Item {
21 id: root
22
23 property int currentTab: 0
24
25 AbstractButton {
26 id: tab1
27 height: parent.height
28 width: parent.width / 2
29 Rectangle {
30 anchors.fill: parent
31 color: root.currentTab == 0 && root.enabled ? "white" : "transparent"
32 radius: units.dp(10)
33 }
34 Label {
35 anchors.centerIn: parent
36 text: i18n.tr("Favorites")
37 color: root.currentTab == 0 && root.enabled ? "black" : "white"
38 }
39 onClicked: root.currentTab = 0
40 }
41 AbstractButton {
42 id: tab2
43 objectName: "scopesOverviewAllTabButton"
44 x: width
45 height: parent.height
46 width: parent.width / 2
47 Rectangle {
48 anchors.fill: parent
49 color: root.currentTab == 1 && root.enabled ? "white" : "transparent"
50 radius: units.dp(10)
51 }
52 Label {
53 anchors.centerIn: parent
54 text: i18n.tr("All")
55 color: root.currentTab == 1 && root.enabled ? "black" : "white"
56 }
57 onClicked: root.currentTab = 1
58 }
59 Rectangle {
60 id: centerPiece
61 width: root.enabled ? units.dp(10) : units.dp(1)
62 height: parent.height
63 color: "white"
64 x: root.currentTab == 1 ? tab2.x : tab2.x - width
65 }
66 Rectangle {
67 id: border
68 anchors.fill: parent
69 radius: units.dp(10)
70 color: "transparent"
71 border.color: centerPiece.color
72 border.width: units.dp(1)
73 }
74}
075
=== added file 'qml/Dash/graphics/dark_background.jpg'
1Binary files qml/Dash/graphics/dark_background.jpg 1970-01-01 00:00:00 +0000 and qml/Dash/graphics/dark_background.jpg 2014-08-08 14:57:17 +0000 differ76Binary files qml/Dash/graphics/dark_background.jpg 1970-01-01 00:00:00 +0000 and qml/Dash/graphics/dark_background.jpg 2014-08-08 14:57:17 +0000 differ
=== added file 'qml/Dash/graphics/overview_hint@27.png'
2Binary files qml/Dash/graphics/overview_hint@27.png 1970-01-01 00:00:00 +0000 and qml/Dash/graphics/overview_hint@27.png 2014-08-08 14:57:17 +0000 differ77Binary files qml/Dash/graphics/overview_hint@27.png 1970-01-01 00:00:00 +0000 and qml/Dash/graphics/overview_hint@27.png 2014-08-08 14:57:17 +0000 differ
=== modified file 'tests/autopilot/unity8/shell/tests/test_emulators.py'
--- tests/autopilot/unity8/shell/tests/test_emulators.py 2014-07-30 20:01:30 +0000
+++ tests/autopilot/unity8/shell/tests/test_emulators.py 2014-08-08 14:57:17 +0000
@@ -122,7 +122,7 @@
122 self._assert_scope_is_opened(scope, scope_id)122 self._assert_scope_is_opened(scope, scope_id)
123123
124 def test_open_generic_scope(self):124 def test_open_generic_scope(self):
125 scope_id = 'scopes'125 scope_id = 'musicaggregator'
126 scope = self.dash.open_scope(scope_id)126 scope = self.dash.open_scope(scope_id)
127 self._assert_scope_is_opened(scope, scope_id)127 self._assert_scope_is_opened(scope, scope_id)
128 self.assertIsInstance(scope, dash_emulators.GenericScopeView)128 self.assertIsInstance(scope, dash_emulators.GenericScopeView)
129129
=== modified file 'tests/mocks/Unity/CMakeLists.txt'
--- tests/mocks/Unity/CMakeLists.txt 2014-08-06 19:38:57 +0000
+++ tests/mocks/Unity/CMakeLists.txt 2014-08-08 14:57:17 +0000
@@ -22,6 +22,7 @@
22set(UnityQML_SOURCES22set(UnityQML_SOURCES
23 fake_scope.cpp23 fake_scope.cpp
24 fake_scopes.cpp24 fake_scopes.cpp
25 fake_scopesoverview.cpp
25 fake_categories.cpp26 fake_categories.cpp
26 fake_navigation.cpp27 fake_navigation.cpp
27 fake_resultsmodel.cpp28 fake_resultsmodel.cpp
2829
=== modified file 'tests/mocks/Unity/fake_categories.cpp'
--- tests/mocks/Unity/fake_categories.cpp 2014-07-18 11:35:47 +0000
+++ tests/mocks/Unity/fake_categories.cpp 2014-08-08 14:57:17 +0000
@@ -109,11 +109,13 @@
109 }109 }
110 case RoleComponents:110 case RoleComponents:
111 {111 {
112 QVariantMap map, artMap;112 QVariantMap map, artMap, attributeMap;
113 artMap["aspect-ratio"] = "1.0";113 artMap["aspect-ratio"] = "1.0";
114 artMap["field"] = "art";114 artMap["field"] = "art";
115 map["art"] = artMap;115 map["art"] = artMap;
116 map["title"] = "HOLA";116 map["title"] = "HOLA";
117 attributeMap["field"] = "attribute";
118 map["attributes"] = attributeMap;
117 return map;119 return map;
118 }120 }
119 case RoleHeaderLink:121 case RoleHeaderLink:
@@ -156,7 +158,7 @@
156 }158 }
157 case RoleComponents:159 case RoleComponents:
158 {160 {
159 QVariantMap map, artMap;161 QVariantMap map, artMap, attributeMap;
160 if (index.row() % 2 != 0) {162 if (index.row() % 2 != 0) {
161 artMap["aspect-ratio"] = QString("1.%1").arg(index.row());163 artMap["aspect-ratio"] = QString("1.%1").arg(index.row());
162 } else {164 } else {
@@ -166,6 +168,8 @@
166 map["art"] = artMap;168 map["art"] = artMap;
167 map["title"] = "HOLA";169 map["title"] = "HOLA";
168 map["subtitle"] = "HOLA";170 map["subtitle"] = "HOLA";
171 attributeMap["field"] = "attribute";
172 map["attributes"] = attributeMap;
169 return map;173 return map;
170 }174 }
171 case RoleHeaderLink:175 case RoleHeaderLink:
172176
=== modified file 'tests/mocks/Unity/fake_resultsmodel.cpp'
--- tests/mocks/Unity/fake_resultsmodel.cpp 2014-05-20 10:29:20 +0000
+++ tests/mocks/Unity/fake_resultsmodel.cpp 2014-08-08 14:57:17 +0000
@@ -58,8 +58,9 @@
58 case RoleUri:58 case RoleUri:
59 case RoleCategoryId:59 case RoleCategoryId:
60 case RoleDndUri:60 case RoleDndUri:
61 return QString();
61 case RoleResult:62 case RoleResult:
62 return QString();63 return QString("Result.%1.%2").arg(m_categoryId).arg(index.row());
63 case RoleTitle:64 case RoleTitle:
64 return QString("Title.%1.%2").arg(m_categoryId).arg(index.row());65 return QString("Title.%1.%2").arg(m_categoryId).arg(index.row());
65 case RoleArt:66 case RoleArt:
6667
=== modified file 'tests/mocks/Unity/fake_scope.cpp'
--- tests/mocks/Unity/fake_scope.cpp 2014-08-06 10:03:55 +0000
+++ tests/mocks/Unity/fake_scope.cpp 2014-08-08 14:57:17 +0000
@@ -18,14 +18,16 @@
18#include <QUrl>18#include <QUrl>
1919
20#include "fake_scope.h"20#include "fake_scope.h"
21
21#include "fake_navigation.h"22#include "fake_navigation.h"
22#include "fake_resultsmodel.h"23#include "fake_resultsmodel.h"
24#include "fake_scopes.h"
2325
24Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)26Scope::Scope(Scopes* parent) : Scope(QString(), QString(), false, parent)
25{27{
26}28}
2729
28Scope::Scope(QString const& id, QString const& name, bool favorite, QObject* parent, int categories)30Scope::Scope(QString const& id, QString const& name, bool favorite, Scopes* parent, int categories)
29 : unity::shell::scopes::ScopeInterface(parent)31 : unity::shell::scopes::ScopeInterface(parent)
30 , m_id(id)32 , m_id(id)
31 , m_name(name)33 , m_name(name)
@@ -36,6 +38,7 @@
36 , m_currentAltNavigationId("altroot")38 , m_currentAltNavigationId("altroot")
37 , m_previewRendererName("preview-generic")39 , m_previewRendererName("preview-generic")
38 , m_categories(new Categories(categories, this))40 , m_categories(new Categories(categories, this))
41 , m_openScope(nullptr)
39{42{
40}43}
4144
@@ -158,7 +161,12 @@
158161
159void Scope::activate(QVariant const& result)162void Scope::activate(QVariant const& result)
160{163{
161 Q_UNUSED(result);164 qDebug() << "Called activate on scope" << m_id << "with result" << result;
165 if (result.toString() == "Result.2.2") {
166 Scopes *scopes = dynamic_cast<Scopes*>(parent());
167 m_openScope = scopes->getScopeFromAll("MockScope9");
168 Q_EMIT openScope(m_openScope);
169 }
162}170}
163171
164PreviewStack* Scope::preview(QVariant const& result)172PreviewStack* Scope::preview(QVariant const& result)
@@ -174,9 +182,13 @@
174{182{
175}183}
176184
177void Scope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/)185void Scope::closeScope(unity::shell::scopes::ScopeInterface* scope)
178{186{
179 qFatal("Scope::closeScope is not implemented");187 if (scope != m_openScope) {
188 qDebug() << scope << m_openScope;
189 qFatal("Scope::closeScope got wrong scope in closeScope");
190 }
191 m_openScope = nullptr;
180}192}
181193
182QString Scope::currentNavigationId() const194QString Scope::currentNavigationId() const
183195
=== modified file 'tests/mocks/Unity/fake_scope.h'
--- tests/mocks/Unity/fake_scope.h 2014-08-06 10:03:55 +0000
+++ tests/mocks/Unity/fake_scope.h 2014-08-08 14:57:17 +0000
@@ -24,13 +24,15 @@
2424
25#include <QTimer>25#include <QTimer>
2626
27class Scopes;
28
27class Scope : public unity::shell::scopes::ScopeInterface29class Scope : public unity::shell::scopes::ScopeInterface
28{30{
29 Q_OBJECT31 Q_OBJECT
3032
31public:33public:
32 Scope(QObject* parent = 0);34 Scope(Scopes* parent = 0);
33 Scope(QString const& id, QString const& name, bool favorite, QObject* parent = 0, int categories = 20);35 Scope(QString const& id, QString const& name, bool favorite, Scopes* parent = 0, int categories = 20);
3436
35 /* getters */37 /* getters */
36 QString id() const override;38 QString id() const override;
@@ -92,7 +94,8 @@
9294
93 QString m_previewRendererName;95 QString m_previewRendererName;
9496
95 Categories* m_categories;97 unity::shell::scopes::CategoriesInterface* m_categories;
98 unity::shell::scopes::ScopeInterface* m_openScope;
96};99};
97100
98#endif // FAKE_SCOPE_H101#endif // FAKE_SCOPE_H
99102
=== modified file 'tests/mocks/Unity/fake_scopes.cpp'
--- tests/mocks/Unity/fake_scopes.cpp 2014-08-06 19:38:57 +0000
+++ tests/mocks/Unity/fake_scopes.cpp 2014-08-08 14:57:17 +0000
@@ -18,6 +18,7 @@
1818
19// Self19// Self
20#include "fake_scopes.h"20#include "fake_scopes.h"
21#include "fake_scopesoverview.h"
2122
22// TODO: Implement remaining pieces, like Categories (i.e. LensView now gives warnings)23// TODO: Implement remaining pieces, like Categories (i.e. LensView now gives warnings)
2324
@@ -26,6 +27,7 @@
2627
27Scopes::Scopes(QObject *parent)28Scopes::Scopes(QObject *parent)
28 : unity::shell::scopes::ScopesInterface(parent)29 : unity::shell::scopes::ScopesInterface(parent)
30 , m_scopesOverview(nullptr)
29 , m_loaded(false)31 , m_loaded(false)
30 , timer(this)32 , timer(this)
31{33{
@@ -52,10 +54,17 @@
52 addScope(new Scope("clickscope", "Apps", true, this));54 addScope(new Scope("clickscope", "Apps", true, this));
53 addScope(new Scope("MockScope5", "Videos", true, this));55 addScope(new Scope("MockScope5", "Videos", true, this));
54 addScope(new Scope("SingleCategoryScope", "Single", true, this, 1));56 addScope(new Scope("SingleCategoryScope", "Single", true, this, 1));
57 addScope(new Scope("MockScope4", "MS4", true, this));
58 addScope(new Scope("MockScope6", "MS6", true, this));
59 addScope(new Scope("MockScope7", "MS7", false, this));
60 addScope(new Scope("MockScope8", "MS8", false, this));
61 addScope(new Scope("MockScope9", "MS9", false, this));
62 m_scopesOverview = new ScopesOverview(this);
5563
56 if (!m_loaded) {64 if (!m_loaded) {
57 m_loaded = true;65 m_loaded = true;
58 Q_EMIT loadedChanged();66 Q_EMIT loadedChanged();
67 Q_EMIT overviewScopeChanged();
59 }68 }
60}69}
6170
@@ -64,10 +73,13 @@
64 timer.stop();73 timer.stop();
65 if (m_scopes.size() > 0) {74 if (m_scopes.size() > 0) {
66 beginRemoveRows(QModelIndex(), 0, m_scopes.count()-1);75 beginRemoveRows(QModelIndex(), 0, m_scopes.count()-1);
67 qDeleteAll(m_scopes);76 qDeleteAll(m_allScopes);
77 m_allScopes.clear();
68 m_scopes.clear();78 m_scopes.clear();
69 endRemoveRows();79 endRemoveRows();
70 }80 }
81 delete m_scopesOverview;
82 m_scopesOverview = nullptr;
7183
72 if (m_loaded) {84 if (m_loaded) {
73 m_loaded = false;85 m_loaded = false;
@@ -113,8 +125,22 @@
113 return m_scopes[row];125 return m_scopes[row];
114}126}
115127
116unity::shell::scopes::ScopeInterface* Scopes::getScope(QString const&) const128unity::shell::scopes::ScopeInterface* Scopes::getScope(QString const &scope_id) const
117{129{
130 // According to mh3 Scopes::getScope should only return favorite scopes (i.e the ones in the model)
131 for (Scope *scope : m_scopes) {
132 if (scope->id() == scope_id)
133 return scope;
134 }
135 return nullptr;
136}
137
138Scope* Scopes::getScopeFromAll(const QString& scope_id) const
139{
140 for (Scope *scope : m_allScopes) {
141 if (scope->id() == scope_id)
142 return scope;
143 }
118 return nullptr;144 return nullptr;
119}145}
120146
@@ -135,13 +161,26 @@
135161
136unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const162unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const
137{163{
138 return nullptr;164 return m_scopesOverview;
165}
166
167QList<Scope*> Scopes::scopes() const
168{
169 return m_scopes;
170}
171
172QList<Scope*> Scopes::allScopes() const
173{
174 return m_allScopes;
139}175}
140176
141void Scopes::addScope(Scope* scope)177void Scopes::addScope(Scope* scope)
142{178{
143 int index = rowCount();179 int index = rowCount();
144 beginInsertRows(QModelIndex(), index, index);180 if (scope->favorite()) {
145 m_scopes.append(scope);181 beginInsertRows(QModelIndex(), index, index);
146 endInsertRows();182 m_scopes.append(scope);
183 endInsertRows();
184 }
185 m_allScopes.append(scope);
147}186}
148187
=== modified file 'tests/mocks/Unity/fake_scopes.h'
--- tests/mocks/Unity/fake_scopes.h 2014-08-06 19:38:57 +0000
+++ tests/mocks/Unity/fake_scopes.h 2014-08-08 14:57:17 +0000
@@ -53,11 +53,18 @@
53 int count() const override;53 int count() const override;
54 unity::shell::scopes::ScopeInterface* overviewScope() const override;54 unity::shell::scopes::ScopeInterface* overviewScope() const override;
5555
56 // This is used as part of implementation of the other C++ code, not API
57 QList<Scope*> scopes() const;
58 QList<Scope*> allScopes() const;
59 Scope* getScopeFromAll(const QString& scope_id) const;
60
56private Q_SLOTS:61private Q_SLOTS:
57 void updateScopes();62 void updateScopes();
5863
59private:64private:
60 QList<Scope*> m_scopes;65 QList<Scope*> m_scopes; // the favorite ones
66 QList<Scope*> m_allScopes;
67 Scope *m_scopesOverview;
61 bool m_loaded;68 bool m_loaded;
62 QTimer timer;69 QTimer timer;
63};70};
6471
=== added file 'tests/mocks/Unity/fake_scopesoverview.cpp'
--- tests/mocks/Unity/fake_scopesoverview.cpp 1970-01-01 00:00:00 +0000
+++ tests/mocks/Unity/fake_scopesoverview.cpp 2014-08-08 14:57:17 +0000
@@ -0,0 +1,281 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "fake_scopesoverview.h"
18
19#include "fake_scopes.h"
20
21#include <paths.h>
22
23ScopesOverview::ScopesOverview(Scopes* parent)
24 : Scope("scopesOverview", "Scopes Overview", false, parent)
25{
26 delete m_categories; // delete the usual categories, we're not going to use it
27 m_scopesOverviewCategories = new ScopesOverviewCategories(parent, this);
28 m_searchCategories = new ScopesOverviewSearchCategories(parent, this);
29 m_categories = m_scopesOverviewCategories;
30}
31
32void ScopesOverview::setSearchQuery(const QString& search_query)
33{
34 Scope::setSearchQuery(search_query);
35
36 auto origCategories = m_categories;
37 if (search_query.isEmpty()) m_categories = m_scopesOverviewCategories;
38 else m_categories = m_searchCategories;
39
40 if (m_categories != origCategories)
41 Q_EMIT categoriesChanged();
42}
43
44Q_INVOKABLE void ScopesOverview::activate(QVariant const& result)
45{
46 Scopes *scopes = dynamic_cast<Scopes*>(parent());
47 m_openScope = scopes->getScopeFromAll(result.toString());
48 Q_EMIT openScope(m_openScope);
49}
50
51ScopesOverviewCategories::ScopesOverviewCategories(Scopes *scopes, QObject* parent)
52 : unity::shell::scopes::CategoriesInterface(parent)
53 , m_scopes(scopes)
54{
55}
56
57int ScopesOverviewCategories::rowCount(const QModelIndex& /*parent*/) const
58{
59 return 2;
60}
61
62void ScopesOverviewCategories::addSpecialCategory(QString const&, QString const&, QString const&, QString const&, QObject*)
63{
64 qFatal("Using un-implemented ScopesOverviewCategories::addSpecialCategory");
65}
66
67bool ScopesOverviewCategories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */)
68{
69 qFatal("Using un-implemented ScopesOverviewCategories::overrideCategoryJson");
70}
71
72QVariant
73ScopesOverviewCategories::data(const QModelIndex& index, int role) const
74{
75 if (!index.isValid()) {
76 return QVariant();
77 }
78
79 const QString categoryId = index.row() == 0 ? "favorites" : "all";
80
81 unity::shell::scopes::ResultsModelInterface *resultsModel = m_resultsModels[index.row()];
82 if (!resultsModel) {
83 QObject *that = const_cast<ScopesOverviewCategories*>(this);
84 QList<Scope*> scopes = index.row() == 0 ? m_scopes->scopes() : m_scopes->allScopes();
85 resultsModel = new ScopesOverviewResultsModel(scopes, categoryId, that);
86 m_resultsModels[index.row()] = resultsModel;
87 }
88 switch (role) {
89 case RoleCategoryId:
90 return categoryId;
91 case RoleName:
92 return index.row() == 0 ? "Favorites" : "All";
93 case RoleIcon:
94 return QVariant();
95 case RoleRawRendererTemplate:
96 qFatal("Using un-implemented RoleRawRendererTemplate Categories role");
97 return QVariant();
98 case RoleRenderer:
99 {
100 QVariantMap map;
101 map["category-layout"] = "grid";
102 map["card-size"] = "small";
103 map["overlay"] = true;
104 return map;
105 }
106 case RoleComponents:
107 {
108 QVariantMap map, artMap;
109 artMap["aspect-ratio"] = "0.5";
110 artMap["field"] = "art";
111 map["art"] = artMap;
112 map["title"] = "HOLA";
113 return map;
114 }
115 case RoleResults:
116 return QVariant::fromValue(resultsModel);
117 case RoleCount:
118 return resultsModel->rowCount();
119 case RoleHeaderLink:
120 return QString();
121 default:
122 qFatal("Using un-implemented Categories role");
123 return QVariant();
124 }
125}
126
127
128
129ScopesOverviewSearchCategories::ScopesOverviewSearchCategories(Scopes *scopes, QObject* parent)
130 : unity::shell::scopes::CategoriesInterface(parent)
131 , m_scopes(scopes)
132{
133}
134
135int ScopesOverviewSearchCategories::rowCount(const QModelIndex& /*parent*/) const
136{
137 return 2;
138}
139
140void ScopesOverviewSearchCategories::addSpecialCategory(QString const&, QString const&, QString const&, QString const&, QObject*)
141{
142 qFatal("Using un-implemented ScopesOverviewSearchCategories::addSpecialCategory");
143}
144
145bool ScopesOverviewSearchCategories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */)
146{
147 qFatal("Using un-implemented ScopesOverviewSearchCategories::overrideCategoryJson");
148}
149
150QVariant
151ScopesOverviewSearchCategories::data(const QModelIndex& index, int role) const
152{
153 if (!index.isValid()) {
154 return QVariant();
155 }
156
157 const QString categoryId = index.row() == 0 ? "searchA" : "searchB";
158
159 unity::shell::scopes::ResultsModelInterface *resultsModel = m_resultsModels[index.row()];
160 if (!resultsModel) {
161 QObject *that = const_cast<ScopesOverviewSearchCategories*>(this);
162 QList<Scope *> scopes;
163 if (index.row() == 0) {
164 scopes << m_scopes->getScopeFromAll("clickscope") << nullptr << m_scopes->getScopeFromAll("MockScope2");
165 } else {
166 scopes << nullptr << m_scopes->getScopeFromAll("MockScope7") << nullptr << m_scopes->getScopeFromAll("MockScope1");
167 }
168 resultsModel = new ScopesOverviewResultsModel(scopes, categoryId, that);
169 m_resultsModels[index.row()] = resultsModel;
170 }
171 switch (role) {
172 case RoleCategoryId:
173 return categoryId;
174 case RoleName:
175 return index.row() == 0 ? "SearchA" : "SearchB";
176 case RoleIcon:
177 return QVariant();
178 case RoleRawRendererTemplate:
179 qFatal("Using un-implemented RoleRawRendererTemplate Categories role");
180 return QVariant();
181 case RoleRenderer:
182 {
183 QVariantMap map;
184 map["category-layout"] = "grid";
185 map["card-size"] = "small";
186 map["overlay"] = true;
187 return map;
188 }
189 case RoleComponents:
190 {
191 QVariantMap map, artMap;
192 artMap["aspect-ratio"] = "1";
193 artMap["field"] = "art";
194 map["art"] = artMap;
195 map["title"] = "HOLA";
196 return map;
197 }
198 case RoleResults:
199 return QVariant::fromValue(resultsModel);
200 case RoleCount:
201 return resultsModel->rowCount();
202 case RoleHeaderLink:
203 return QString();
204 default:
205 qFatal("Using un-implemented Categories role");
206 return QVariant();
207 }
208}
209
210
211ScopesOverviewResultsModel::ScopesOverviewResultsModel(const QList<Scope *> &scopes, const QString &categoryId, QObject* parent)
212 : unity::shell::scopes::ResultsModelInterface(parent)
213 , m_scopes(scopes)
214 , m_categoryId(categoryId)
215{
216}
217
218QString ScopesOverviewResultsModel::categoryId() const
219{
220 return m_categoryId;
221}
222
223void ScopesOverviewResultsModel::setCategoryId(QString const& /*id*/)
224{
225 qFatal("Calling un-implemented ScopesOverviewResultsModel::setCategoryId");
226}
227
228int ScopesOverviewResultsModel::scopeIndex(QString const& id) const
229{
230 const int scopeCount = count();
231 for (int i = 0; i < scopeCount; ++i) {
232 if (m_scopes[i]->id() == id)
233 return i;
234 }
235 return -1;
236}
237
238QHash<int, QByteArray> ScopesOverviewResultsModel::roleNames() const
239{
240 QHash<int, QByteArray> roles = unity::shell::scopes::ResultsModelInterface::roleNames();
241 roles[RoleBackground + 1] = "scopeId";
242 return roles;
243}
244
245int ScopesOverviewResultsModel::rowCount(const QModelIndex& parent) const
246{
247 Q_UNUSED(parent);
248
249 return m_scopes.count();
250}
251
252int ScopesOverviewResultsModel::count() const
253{
254 return rowCount();
255}
256
257QVariant
258ScopesOverviewResultsModel::data(const QModelIndex& index, int role) const
259{
260 unity::shell::scopes::ScopeInterface *scope = m_scopes[index.row()];
261 switch (role) {
262 case RoleUri:
263 case RoleCategoryId:
264 case RoleDndUri:
265 return QString();
266 case RoleResult:
267 return scope ? scope->id() : QString("Result.%1.%2").arg(categoryId()).arg(index.row());
268 case RoleTitle:
269 return scope ? scope->name() : QString("Title.%1.%2").arg(categoryId()).arg(index.row());
270 case RoleArt:
271 return qmlDirectory() + "graphics/applicationIcons/dash.png";
272 case RoleMascot:
273 case RoleEmblem:
274 case RoleSummary:
275 case RoleBackground + 1: // scopeId
276 return scope ? scope->id() : nullptr;
277 break;
278 default:
279 return QVariant();
280 }
281}
0282
=== added file 'tests/mocks/Unity/fake_scopesoverview.h'
--- tests/mocks/Unity/fake_scopesoverview.h 1970-01-01 00:00:00 +0000
+++ tests/mocks/Unity/fake_scopesoverview.h 2014-08-08 14:57:17 +0000
@@ -0,0 +1,104 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef FAKE_SCOPESOVERVIEW_H
18#define FAKE_SCOPESOVERVIEW_H
19
20#include "fake_scope.h"
21#include <unity/shell/scopes/ResultsModelInterface.h>
22
23class Scopes;
24
25class ScopesOverview : public Scope
26{
27 Q_OBJECT
28
29public:
30 ScopesOverview(Scopes* parent = 0);
31
32 void setSearchQuery(const QString& search_query) override;
33 Q_INVOKABLE void activate(QVariant const& result) override;
34
35private:
36 unity::shell::scopes::CategoriesInterface *m_scopesOverviewCategories;
37 unity::shell::scopes::CategoriesInterface *m_searchCategories;
38};
39
40class ScopesOverviewCategories : public unity::shell::scopes::CategoriesInterface
41{
42 Q_OBJECT
43
44public:
45 ScopesOverviewCategories(Scopes *scopes, QObject* parent = 0);
46
47 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
48 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
49
50 Q_INVOKABLE void addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject) override;
51 Q_INVOKABLE bool overrideCategoryJson(QString const& categoryId, QString const& json) override;
52
53private:
54 mutable QHash<int, unity::shell::scopes::ResultsModelInterface*> m_resultsModels;
55
56 Scopes *m_scopes;
57};
58
59class ScopesOverviewSearchCategories : public unity::shell::scopes::CategoriesInterface
60{
61 Q_OBJECT
62
63public:
64 ScopesOverviewSearchCategories(Scopes *scopes, QObject* parent = 0);
65
66 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
67 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
68
69 Q_INVOKABLE void addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject) override;
70 Q_INVOKABLE bool overrideCategoryJson(QString const& categoryId, QString const& json) override;
71
72private:
73 mutable QHash<int, unity::shell::scopes::ResultsModelInterface*> m_resultsModels;
74
75 Scopes *m_scopes;
76};
77
78class ScopesOverviewResultsModel : public unity::shell::scopes::ResultsModelInterface
79{
80 Q_OBJECT
81
82public:
83 explicit ScopesOverviewResultsModel(const QList<Scope *> &scopes, const QString &categoryId, QObject* parent = 0);
84
85 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
86 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
87
88 /* getters */
89 QString categoryId() const override;
90 int count() const override;
91
92 /* setters */
93 void setCategoryId(QString const& id) override;
94
95 /* Special API */
96 Q_INVOKABLE int scopeIndex(QString const& id) const;
97 QHash<int, QByteArray> roleNames() const override;
98
99private:
100 QList<Scope *> m_scopes;
101 QString m_categoryId;
102};
103
104#endif // FAKE_SCOPESOVERVIEW_H
0105
=== modified file 'tests/plugins/Dash/cardcreator/1.res'
--- tests/plugins/Dash/cardcreator/1.res 2014-08-05 22:51:17 +0000
+++ tests/plugins/Dash/cardcreator/1.res 2014-08-08 14:57:17 +0000
@@ -61,12 +61,12 @@
61 id: titleLabel; 61 id: titleLabel;
62 objectName: "titleLabel"; 62 objectName: "titleLabel";
63 anchors { right: parent.right;63 anchors { right: parent.right;
64rightMargin: units.gu(1);64 rightMargin: units.gu(1);
65left: parent.left;65 left: parent.left;
66top: artShapeHolder.bottom; 66 top: artShapeHolder.bottom;
67 topMargin: units.gu(1);67 topMargin: units.gu(1);
68leftMargin: units.gu(1);68 leftMargin: units.gu(1);
69 } 69 }
70 elide: Text.ElideRight; 70 elide: Text.ElideRight;
71 fontSize: "small"; 71 fontSize: "small";
72 wrapMode: Text.Wrap; 72 wrapMode: Text.Wrap;
7373
=== modified file 'tests/plugins/Dash/cardcreator/1.tst'
--- tests/plugins/Dash/cardcreator/1.tst 2014-07-28 15:09:45 +0000
+++ tests/plugins/Dash/cardcreator/1.tst 2014-08-08 14:57:17 +0000
@@ -1,3 +1,3 @@
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1.6,"field":"art"},"title":{"field":"title"}}2components: {"art":{"aspect-ratio":1.6,"field":"art"},"title":{"field":"title"},"attributes":{}}
3result: 1.res3result: 1.res
44
=== modified file 'tests/plugins/Dash/cardcreator/2.res'
--- tests/plugins/Dash/cardcreator/2.res 2014-07-31 13:33:56 +0000
+++ tests/plugins/Dash/cardcreator/2.res 2014-08-08 14:57:17 +0000
@@ -55,17 +55,19 @@
55 spacing: margins; 55 spacing: margins;
56 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; 56 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
57 anchors { top: parent.top; 57 anchors { top: parent.top;
58 topMargin: units.gu(1);58 topMargin: units.gu(1);
59left: parent.left;59 left: parent.left;
60 } 60 }
61 anchors.right: parent.right; 61 anchors.right: parent.right;
62 anchors.margins: margins;62 anchors.margins: margins;
63 data: [ Image { 63 anchors.rightMargin: 0;
64 data: [
65Image {
64 id: mascotImage; 66 id: mascotImage;
65 objectName: "mascotImage"; 67 objectName: "mascotImage";
66 anchors { verticalCenter: parent.verticalCenter; } 68 anchors { verticalCenter: parent.verticalCenter; }
67 readonly property int maxSize: Math.max(width, height) * 4; 69 readonly property int maxSize: Math.max(width, height) * 4;
68 source: cardData && cardData["mascot"]; 70 source: cardData && cardData["mascot"] || "";
69 width: units.gu(6); 71 width: units.gu(6);
70 height: units.gu(5.625); 72 height: units.gu(5.625);
71 sourceSize { width: maxSize; height: maxSize } 73 sourceSize { width: maxSize; height: maxSize }
@@ -74,37 +76,43 @@
74 verticalAlignment: Image.AlignVCenter; 76 verticalAlignment: Image.AlignVCenter;
75 visible: showHeader; 77 visible: showHeader;
76 }78 }
7779,Item {
78 ,80 id: headerTitleContainer;
79 Column { 81 anchors { verticalCenter: parent.verticalCenter; }
80 anchors.verticalCenter: parent.verticalCenter; 82 width: parent.width - x;
81 spacing: units.dp(2); 83 implicitHeight: titleLabel.height + subtitleLabel.height;
82 width: parent.width - x;84 data: [
83 data: [ Label { 85 Label {
84 id: titleLabel; 86 id: titleLabel;
85 objectName: "titleLabel"; 87 objectName: "titleLabel";
86 anchors { left: parent.left; right: parent.right } 88 anchors { right: parent.right;
89 rightMargin: units.gu(1);
90 left: parent.left;
91 top: parent.top; }
87 elide: Text.ElideRight; 92 elide: Text.ElideRight;
88 fontSize: "small"; 93 fontSize: "small";
89 wrapMode: Text.Wrap; 94 wrapMode: Text.Wrap;
90 maximumLineCount: 2; 95 maximumLineCount: 2;
91 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 96 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
92 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); 97 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey");
93 visible: showHeader ; 98 visible: showHeader ;
94 text: root.title; 99 text: root.title;
95 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; 100 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
96 horizontalAlignment: root.headerAlignment; 101 horizontalAlignment: root.headerAlignment;
97 }102 }
98103 ,Label {
99 ,
100 Label {
101 id: subtitleLabel; 104 id: subtitleLabel;
102 objectName: "subtitleLabel"; 105 objectName: "subtitleLabel";
103 anchors { left: parent.left; right: parent.right } 106 anchors { right: parent.right;
107 left: parent.left;
108 rightMargin: units.gu(1);
109 top: titleLabel.bottom;
110 }
111 anchors.topMargin: units.dp(2);
104 elide: Text.ElideRight; 112 elide: Text.ElideRight;
105 fontSize: "small"; 113 fontSize: "small";
106 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 114 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
107 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); 115 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey");
108 visible: titleLabel.visible && titleLabel.text; 116 visible: titleLabel.visible && titleLabel.text;
109 text: cardData && cardData["subtitle"] || ""; 117 text: cardData && cardData["subtitle"] || "";
110 font.weight: Font.Light; 118 font.weight: Font.Light;
111119
=== modified file 'tests/plugins/Dash/cardcreator/2.tst'
--- tests/plugins/Dash/cardcreator/2.tst 2014-07-28 15:09:45 +0000
+++ tests/plugins/Dash/cardcreator/2.tst 2014-08-08 14:57:17 +0000
@@ -1,3 +1,3 @@
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"}}2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
3result: 2.res3result: 2.res
44
=== modified file 'tests/plugins/Dash/cardcreator/3.res'
--- tests/plugins/Dash/cardcreator/3.res 2014-08-05 22:51:17 +0000
+++ tests/plugins/Dash/cardcreator/3.res 2014-08-08 14:57:17 +0000
@@ -61,12 +61,12 @@
61 id: titleLabel; 61 id: titleLabel;
62 objectName: "titleLabel"; 62 objectName: "titleLabel";
63 anchors { right: parent.right;63 anchors { right: parent.right;
64rightMargin: units.gu(1);64 rightMargin: units.gu(1);
65left: parent.left;65 left: parent.left;
66top: artShapeHolder.bottom; 66 top: artShapeHolder.bottom;
67 topMargin: units.gu(1);67 topMargin: units.gu(1);
68leftMargin: units.gu(1);68 leftMargin: units.gu(1);
69 } 69 }
70 elide: Text.ElideRight; 70 elide: Text.ElideRight;
71 fontSize: "small"; 71 fontSize: "small";
72 wrapMode: Text.Wrap; 72 wrapMode: Text.Wrap;
@@ -82,12 +82,12 @@
82 id: subtitleLabel; 82 id: subtitleLabel;
83 objectName: "subtitleLabel"; 83 objectName: "subtitleLabel";
84 anchors { left: titleLabel.left; 84 anchors { left: titleLabel.left;
85 leftMargin: titleLabel.leftMargin; 85 leftMargin: titleLabel.leftMargin;
86 right: titleLabel.right; 86 rightMargin: units.gu(1);
87 rightMargin: titleLabel.rightMargin; 87 right: titleLabel.right;
88 top: titleLabel.bottom; 88 top: titleLabel.bottom;
89 topMargin: units.dp(2);89 }
90 } 90 anchors.topMargin: units.dp(2);
91 elide: Text.ElideRight; 91 elide: Text.ElideRight;
92 fontSize: "small"; 92 fontSize: "small";
93 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 93 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
9494
=== modified file 'tests/plugins/Dash/cardcreator/3.tst'
--- tests/plugins/Dash/cardcreator/3.tst 2014-07-28 15:09:45 +0000
+++ tests/plugins/Dash/cardcreator/3.tst 2014-08-08 14:57:17 +0000
@@ -1,3 +1,3 @@
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":0.75,"field":"art"},"subtitle":{"field":"price"},"title":{"field":"title"}}2components: {"art":{"aspect-ratio":0.75,"field":"art"},"subtitle":{"field":"price"},"title":{"field":"title"},"attributes":{}}
3result: 3.res3result: 3.res
44
=== modified file 'tests/plugins/Dash/cardcreator/4.res'
--- tests/plugins/Dash/cardcreator/4.res 2014-07-25 13:41:19 +0000
+++ tests/plugins/Dash/cardcreator/4.res 2014-08-08 14:57:17 +0000
@@ -27,7 +27,9 @@
27}27}
28 anchors.right: parent.right; 28 anchors.right: parent.right;
29 anchors.margins: margins;29 anchors.margins: margins;
30data: [ Loader { 30 anchors.rightMargin: 0;
31data: [
32Loader {
31 id: mascotShapeLoader; 33 id: mascotShapeLoader;
32 objectName: "mascotShapeLoader"; 34 objectName: "mascotShapeLoader";
33 asynchronous: root.asynchronous; 35 asynchronous: root.asynchronous;
@@ -39,13 +41,12 @@
39 anchors { verticalCenter: parent.verticalCenter; }41 anchors { verticalCenter: parent.verticalCenter; }
40 }42 }
4143
42,44,Image {
43Image {
44 id: mascotImage; 45 id: mascotImage;
45 objectName: "mascotImage"; 46 objectName: "mascotImage";
46 anchors { verticalCenter: parent.verticalCenter; }47 anchors { verticalCenter: parent.verticalCenter; }
47 readonly property int maxSize: Math.max(width, height) * 4; 48 readonly property int maxSize: Math.max(width, height) * 4;
48 source: cardData && cardData["mascot"]; 49 source: cardData && cardData["mascot"] || "";
49 width: units.gu(6); 50 width: units.gu(6);
50 height: units.gu(5.625); 51 height: units.gu(5.625);
51 sourceSize { width: maxSize; height: maxSize } 52 sourceSize { width: maxSize; height: maxSize }
@@ -55,15 +56,19 @@
55 visible: false; 56 visible: false;
56 }57 }
5758
58,59,Item {
59Column { 60 id: headerTitleContainer;
60 anchors.verticalCenter: parent.verticalCenter; 61 anchors { verticalCenter: parent.verticalCenter; }
61 spacing: units.dp(2); 62 width: parent.width - x;
62 width: parent.width - x;63 implicitHeight: titleLabel.height + subtitleLabel.height;
63data: [ Label { 64 data: [
65Label {
64 id: titleLabel; 66 id: titleLabel;
65 objectName: "titleLabel"; 67 objectName: "titleLabel";
66 anchors { left: parent.left; right: parent.right }68 anchors { right: parent.right;
69 rightMargin: units.gu(1);
70 left: parent.left;
71 top: parent.top; }
67 elide: Text.ElideRight; 72 elide: Text.ElideRight;
68 fontSize: "small"; 73 fontSize: "small";
69 wrapMode: Text.Wrap; 74 wrapMode: Text.Wrap;
@@ -75,12 +80,15 @@
75 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; 80 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
76 horizontalAlignment: root.headerAlignment; 81 horizontalAlignment: root.headerAlignment;
77 }82 }
78,83,Label {
79Label {
80 id: subtitleLabel; 84 id: subtitleLabel;
81 objectName: "subtitleLabel"; 85 objectName: "subtitleLabel";
82 anchors { left: parent.left; right: parent.right }86 anchors { right: parent.right;
8387 left: parent.left;
88 rightMargin: units.gu(1);
89 top: titleLabel.bottom;
90 }
91 anchors.topMargin: units.dp(2);
84 elide: Text.ElideRight; 92 elide: Text.ElideRight;
85 fontSize: "small"; 93 fontSize: "small";
86 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 94 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
8795
=== modified file 'tests/plugins/Dash/cardcreator/4.tst'
--- tests/plugins/Dash/cardcreator/4.tst 2014-07-28 15:09:45 +0000
+++ tests/plugins/Dash/cardcreator/4.tst 2014-08-08 14:57:17 +0000
@@ -1,3 +1,3 @@
1template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2}1template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"}}2components: {"art":{"aspect-ratio":1},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"},"attributes":{}}
3result: 4.res3result: 4.res
44
=== modified file 'tests/plugins/Dash/cardcreator/5.res'
--- tests/plugins/Dash/cardcreator/5.res 2014-08-05 22:51:17 +0000
+++ tests/plugins/Dash/cardcreator/5.res 2014-08-08 14:57:17 +0000
@@ -68,8 +68,9 @@
68 visible: showHeader && status == Loader.Ready; 68 visible: showHeader && status == Loader.Ready;
69 sourceComponent: ShaderEffect { 69 sourceComponent: ShaderEffect {
70 id: overlay; 70 id: overlay;
71 height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); 71 height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
72 opacity: 0.6; 72 property real luminance: 0.2126 * overlayColor.r + 0.7152 * overlayColor.g + 0.0722 * overlayColor.b;
73 property color overlayColor: cardData && cardData["overlayColor"] || "#99000000";
73 property var source: ShaderEffectSource { 74 property var source: ShaderEffectSource {
74 id: shaderSource; 75 id: shaderSource;
75 sourceItem: artShapeLoader.item; 76 sourceItem: artShapeLoader.item;
@@ -90,29 +91,30 @@
90 varying highp vec2 coord; 91 varying highp vec2 coord;
91 uniform sampler2D source; 92 uniform sampler2D source;
92 uniform lowp float qt_Opacity; 93 uniform lowp float qt_Opacity;
94 uniform highp vec4 overlayColor;
93 void main() { 95 void main() {
94 lowp vec4 tex = texture2D(source, coord); 96 lowp vec4 tex = texture2D(source, coord);
95 gl_FragColor = vec4(0, 0, 0, tex.a) * qt_Opacity; 97 gl_FragColor = vec4(overlayColor.r, overlayColor.g, overlayColor.b, 1) * qt_Opacity * overlayColor.a * tex.a;
96 }"; 98 }";
97 } 99 }
98 }100 }
99readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;101readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
100Label { 102Label {
101 id: titleLabel; 103 id: titleLabel;
102 objectName: "titleLabel"; 104 objectName: "titleLabel";
103 anchors { left: parent.left; 105 anchors { right: parent.right;
104 leftMargin: units.gu(1); 106 rightMargin: units.gu(1);
105 right: parent.right; 107 left: parent.left;
106 rightMargin: units.gu(1); 108 leftMargin: units.gu(1);
107 top: overlayLoader.top; 109 top: overlayLoader.top;
108 topMargin: units.gu(1);110 topMargin: units.gu(1);
109 } 111 }
110 elide: Text.ElideRight; 112 elide: Text.ElideRight;
111 fontSize: "small"; 113 fontSize: "small";
112 wrapMode: Text.Wrap; 114 wrapMode: Text.Wrap;
113 maximumLineCount: 2; 115 maximumLineCount: 2;
114 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 116 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
115 color: "white"; 117 color: overlayLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey");
116 visible: showHeader && overlayLoader.active; 118 visible: showHeader && overlayLoader.active;
117 text: root.title; 119 text: root.title;
118 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; 120 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
@@ -122,16 +124,16 @@
122 id: subtitleLabel; 124 id: subtitleLabel;
123 objectName: "subtitleLabel"; 125 objectName: "subtitleLabel";
124 anchors { left: titleLabel.left; 126 anchors { left: titleLabel.left;
125 leftMargin: titleLabel.leftMargin; 127 leftMargin: titleLabel.leftMargin;
126 right: titleLabel.right; 128 rightMargin: units.gu(1);
127 rightMargin: titleLabel.rightMargin; 129 right: titleLabel.right;
128 top: titleLabel.bottom; 130 top: titleLabel.bottom;
129 topMargin: units.dp(2);131 }
130 } 132 anchors.topMargin: units.dp(2);
131 elide: Text.ElideRight; 133 elide: Text.ElideRight;
132 fontSize: "small"; 134 fontSize: "small";
133 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 135 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
134 color: "white"; 136 color: overlayLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey");
135 visible: titleLabel.visible && titleLabel.text; 137 visible: titleLabel.visible && titleLabel.text;
136 text: cardData && cardData["subtitle"] || ""; 138 text: cardData && cardData["subtitle"] || "";
137 font.weight: Font.Light; 139 font.weight: Font.Light;
138140
=== modified file 'tests/plugins/Dash/cardcreator/5.tst'
--- tests/plugins/Dash/cardcreator/5.tst 2014-07-28 15:09:45 +0000
+++ tests/plugins/Dash/cardcreator/5.tst 2014-08-08 14:57:17 +0000
@@ -1,3 +1,3 @@
1template: {"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true}1template: {"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true}
2components: {"art":{"aspect-ratio":1,"field":"art"},"subtitle":{"field":"artist"},"title":{"field":"title"}}2components: {"art":{"aspect-ratio":1,"field":"art"},"subtitle":{"field":"artist"},"title":{"field":"title"},"attributes":{}}
3result: 5.res3result: 5.res
44
=== modified file 'tests/plugins/Dash/cardcreator/6.res'
--- tests/plugins/Dash/cardcreator/6.res 2014-08-05 22:51:17 +0000
+++ tests/plugins/Dash/cardcreator/6.res 2014-08-08 14:57:17 +0000
@@ -13,57 +13,110 @@
13 property bool asynchronous: true;13 property bool asynchronous: true;
14 property bool showHeader: true;14 property bool showHeader: true;
15 implicitWidth: childrenRect.width;15 implicitWidth: childrenRect.width;
16onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }16Loader {
17readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);17 id: backgroundLoader;
18Item {18 objectName: "backgroundLoader";
19 id: artShapeHolder;19 anchors.fill: parent;
20 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;20 asynchronous: root.asynchronous;
21 width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;21 visible: status == Loader.Ready;
22 anchors { horizontalCenter: parent.horizontalCenter; }22 sourceComponent: UbuntuShape {
23 Loader {23 objectName: "background";
24 id: artShapeLoader;24 radius: "medium";
25 objectName: "artShapeLoader";25 color: getColor(0) || "white";
26 active: cardData && cardData["art"] || false;26 gradientColor: getColor(1) || color;
27 asynchronous: root.asynchronous;27 anchors.fill: parent;
28 visible: status == Loader.Ready;28 image: backgroundImage.source ? backgroundImage : null;
29 sourceComponent: UbuntuShape {29 property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
30 id: artShape;30 property Image backgroundImage: Image {
31 objectName: "artShape";31 objectName: "backgroundImage";
32 radius: "medium";32 source: {
33 visible: image.status == Image.Ready;33 if (cardData && typeof cardData["background"] === "string") return cardData["background"];
34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;34 else if (template && typeof template["card-background"] === "string") return template["card-background"];
35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;35 else return "";
36 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }36 }
37 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }37 }
38 function updateWidthHeightBindings() {38 function getColor(index) {
39 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {39 if (cardData && typeof cardData["background"] === "object"
40 width = root.fixedArtShapeSize.width;40 && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
41 height = root.fixedArtShapeSize.height;41 return cardData["background"]["elements"][index];
42 } else {42 } else if (template && typeof template["card-background"] === "object"
43 width = Qt.binding(function() { return !visible ? 0 : image.width });43 && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
44 height = Qt.binding(function() { return !visible ? 0 : image.height });44 return template["card-background"]["elements"][index];
45 }45 } else return undefined;
46 }46 }
47 image: Image {47 }
48 objectName: "artImage";48 }
49 source: cardData && cardData["art"] || "";49readonly property size artShapeSize: Qt.size(-1, -1);
50 cache: true;50readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
51 asynchronous: root.asynchronous;51Item {
52 fillMode: Image.PreserveAspectCrop;52 id: headerTitleContainer;
53 width: root.width;53 anchors { right: parent.right; left: parent.left;
54 height: width / artShape.aspect;54 top: parent.top;
55 }55 topMargin: units.gu(1);
56 }56 leftMargin: units.gu(1);
57 }
58 width: parent.width - x;
59 implicitHeight: titleLabel.height + subtitleLabel.height;
60 data: [
61 Label {
62 id: titleLabel;
63 objectName: "titleLabel";
64 anchors { right: emblemImage.left;
65 rightMargin: emblemImage.width > 0 ? units.gu(0.5) : 0;
66 left: parent.left;
67 top: parent.top; }
68 elide: Text.ElideRight;
69 fontSize: "small";
70 wrapMode: Text.Wrap;
71 maximumLineCount: 2;
72 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
73 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey");
74 visible: showHeader ;
75 text: root.title;
76 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
77 horizontalAlignment: root.headerAlignment;
57 }78 }
58 }79,Label {
59readonly property int headerHeight: 0;80 id: subtitleLabel;
81 objectName: "subtitleLabel";
82 anchors { right: parent.right;
83 left: parent.left;
84 rightMargin: units.gu(1);
85 top: titleLabel.bottom;
86 }
87 anchors.topMargin: units.dp(2);
88 elide: Text.ElideRight;
89 fontSize: "small";
90 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
91 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey");
92 visible: titleLabel.visible && titleLabel.text;
93 text: cardData && cardData["subtitle"] || "";
94 font.weight: Font.Light;
95 horizontalAlignment: root.headerAlignment;
96 }
97,Image {
98 id: emblemImage;
99 objectName: "emblemImage";
100 anchors {
101 bottom: titleLabel.baseline;
102 right: parent.right;
103 rightMargin: status === Image.Ready ? units.gu(1) : 0;
104 }
105 source: cardData && cardData["emblem"] || "";
106 width: height;
107 height: status === Image.Ready ? titleLabel.font.pixelSize : 0;
108 fillMode: Image.PreserveAspectFit;
109 }
110
111 ]
112 }
60UbuntuShape {113UbuntuShape {
61 id: touchdown;114 id: touchdown;
62 objectName: "touchdown";115 objectName: "touchdown";
63 anchors { fill: artShapeHolder }116 anchors { fill: backgroundLoader }
64 visible: root.pressed;117 visible: root.pressed;
65 radius: "medium";118 radius: "medium";
66 borderSource: "radius_pressed.sci"119 borderSource: "radius_pressed.sci"
67}120}
68implicitHeight: artShapeHolder.height;121implicitHeight: headerTitleContainer.y + headerTitleContainer.height + units.gu(1);
69}122}
70123
=== modified file 'tests/plugins/Dash/cardcreator/6.tst'
--- tests/plugins/Dash/cardcreator/6.tst 2014-07-28 15:09:45 +0000
+++ tests/plugins/Dash/cardcreator/6.tst 2014-08-08 14:57:17 +0000
@@ -1,3 +1,3 @@
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1.6,"field":"art"}}2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"subtitle":{"field":"author"},"title":{"field":"title"},"emblem":{"field":"source"},"attributes":{}}
3result: 6.res3result: 6.res
44
=== modified file 'tests/plugins/Dash/cardcreator/7.res'
--- tests/plugins/Dash/cardcreator/7.res 2014-08-05 22:51:17 +0000
+++ tests/plugins/Dash/cardcreator/7.res 2014-08-08 14:57:17 +0000
@@ -55,17 +55,19 @@
55 spacing: margins; 55 spacing: margins;
56 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; 56 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
57 anchors { top: parent.top; 57 anchors { top: parent.top;
58 topMargin: units.gu(1);58 topMargin: units.gu(1);
59left: parent.left;59 left: parent.left;
60 } 60 }
61 anchors.right: parent.right; 61 anchors.right: parent.right;
62 anchors.margins: margins;62 anchors.margins: margins;
63 data: [ Image { 63 anchors.rightMargin: 0;
64 data: [
65Image {
64 id: mascotImage; 66 id: mascotImage;
65 objectName: "mascotImage"; 67 objectName: "mascotImage";
66 anchors { verticalCenter: parent.verticalCenter; } 68 anchors { verticalCenter: parent.verticalCenter; }
67 readonly property int maxSize: Math.max(width, height) * 4; 69 readonly property int maxSize: Math.max(width, height) * 4;
68 source: cardData && cardData["mascot"]; 70 source: cardData && cardData["mascot"] || "";
69 width: units.gu(6); 71 width: units.gu(6);
70 height: units.gu(5.625); 72 height: units.gu(5.625);
71 sourceSize { width: maxSize; height: maxSize } 73 sourceSize { width: maxSize; height: maxSize }
@@ -75,48 +77,58 @@
75 visible: showHeader; 77 visible: showHeader;
76 }78 }
7779
78 ,80,Item {
79 Column { 81 id: headerTitleContainer;
80 anchors.verticalCenter: parent.verticalCenter; 82 anchors { verticalCenter: parent.verticalCenter; }
81 spacing: units.dp(2); 83 width: parent.width - x;
82 width: parent.width - x;84 implicitHeight: titleLabel.height + subtitleLabel.height + attributesRow.height;
83 data: [ 85 data: [
84 Label { 86 Label {
85 id: titleLabel; 87 id: titleLabel;
86 objectName: "titleLabel"; 88 objectName: "titleLabel";
87 anchors { left: parent.left; right: parent.right } 89 anchors { right: parent.right;
90 rightMargin: units.gu(1);
91 left: parent.left;
92 top: parent.top; }
88 elide: Text.ElideRight; 93 elide: Text.ElideRight;
89 fontSize: "small"; 94 fontSize: "small";
90 wrapMode: Text.Wrap; 95 wrapMode: Text.Wrap;
91 maximumLineCount: 2; 96 maximumLineCount: 2;
92 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 97 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
93 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); 98 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey");
94 visible: showHeader ; 99 visible: showHeader ;
95 text: root.title; 100 text: root.title;
96 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; 101 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
97 horizontalAlignment: root.headerAlignment; 102 horizontalAlignment: root.headerAlignment;
98 }103 }
99,104,Label {
100Label {
101 id: subtitleLabel; 105 id: subtitleLabel;
102 objectName: "subtitleLabel"; 106 objectName: "subtitleLabel";
103 anchors { left: parent.left; right: parent.right } 107 anchors { right: parent.right;
108 left: parent.left;
109 rightMargin: units.gu(1);
110 top: titleLabel.bottom;
111 }
112 anchors.topMargin: units.dp(2);
104 elide: Text.ElideRight; 113 elide: Text.ElideRight;
105 fontSize: "small"; 114 fontSize: "small";
106 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 115 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
107 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); 116 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey");
108 visible: titleLabel.visible && titleLabel.text; 117 visible: titleLabel.visible && titleLabel.text;
109 text: cardData && cardData["subtitle"] || ""; 118 text: cardData && cardData["subtitle"] || "";
110 font.weight: Font.Light; 119 font.weight: Font.Light;
111 horizontalAlignment: root.headerAlignment; 120 horizontalAlignment: root.headerAlignment;
112 }121 }
113,122,CardAttributes {
114CardAttributes {
115 id: attributesRow; 123 id: attributesRow;
116 objectName: "attributesRow"; 124 objectName: "attributesRow";
117 anchors { left: parent.left; right: parent.right } 125 anchors { right: parent.right;
118 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); 126 left: parent.left;
119 model: cardData["attributes"]; 127 rightMargin: units.gu(1);
128 top: subtitleLabel.bottom;
129 }
130 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey");
131 model: cardData && cardData["attributes"];
120 }132 }
121 133
122 ]134 ]
123135
=== modified file 'tests/plugins/Dash/tst_ScopeStyle.qml'
--- tests/plugins/Dash/tst_ScopeStyle.qml 2014-07-25 11:42:06 +0000
+++ tests/plugins/Dash/tst_ScopeStyle.qml 2014-08-08 14:57:17 +0000
@@ -101,7 +101,7 @@
101101
102 function test_threshold_data() {102 function test_threshold_data() {
103 return [103 return [
104 { tag: "default", index: 0, threshold: 0.5020 },104 { tag: "default", index: 0, threshold: 0.7510 },
105 { tag: "red on black", index: 1, threshold: 0.1063 },105 { tag: "red on black", index: 1, threshold: 0.1063 },
106 { tag: "green on white", index: 2, threshold: 0.6795 },106 { tag: "green on white", index: 2, threshold: 0.6795 },
107 { tag: "blue on darkgrey", index: 3, threshold: 0.3675 },107 { tag: "blue on darkgrey", index: 3, threshold: 0.3675 },
108108
=== modified file 'tests/qmltests/Dash/CardHelpers.js'
--- tests/qmltests/Dash/CardHelpers.js 2014-08-06 19:38:16 +0000
+++ tests/qmltests/Dash/CardHelpers.js 2014-08-08 14:57:17 +0000
@@ -60,6 +60,7 @@
60 "art": "art", \60 "art": "art", \
61 "subtitle": "subtitle", \61 "subtitle": "subtitle", \
62 "mascot": "mascot", \62 "mascot": "mascot", \
63 "emblem": "emblem", \
63 "overlayColor": "overlayColor", \64 "overlayColor": "overlayColor", \
64 "summary": "summary", \65 "summary": "summary", \
65 "attributes": "attributes" \66 "attributes": "attributes" \
6667
=== added file 'tests/qmltests/Dash/artwork/emblem.png'
67Binary files tests/qmltests/Dash/artwork/emblem.png 1970-01-01 00:00:00 +0000 and tests/qmltests/Dash/artwork/emblem.png 2014-08-08 14:57:17 +0000 differ68Binary files tests/qmltests/Dash/artwork/emblem.png 1970-01-01 00:00:00 +0000 and tests/qmltests/Dash/artwork/emblem.png 2014-08-08 14:57:17 +0000 differ
=== modified file 'tests/qmltests/Dash/tst_Card.qml'
--- tests/qmltests/Dash/tst_Card.qml 2014-08-05 22:51:17 +0000
+++ tests/qmltests/Dash/tst_Card.qml 2014-08-08 14:57:17 +0000
@@ -31,6 +31,7 @@
31 {31 {
32 "art": "../../../tests/qmltests/Dash/artwork/music-player-design.png",32 "art": "../../../tests/qmltests/Dash/artwork/music-player-design.png",
33 "mascot": "../../../tests/qmltests/Dash/artwork/avatar.png",33 "mascot": "../../../tests/qmltests/Dash/artwork/avatar.png",
34 "emblem": "../../../tests/qmltests/Dash/artwork/emblem.png",
34 "title": "foo",35 "title": "foo",
35 "subtitle": "bar",36 "subtitle": "bar",
36 "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.",37 "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.",
@@ -270,7 +271,7 @@
270 { tag: "Large", width: units.gu(38), index: 2 },271 { tag: "Large", width: units.gu(38), index: 2 },
271 { tag: "Wide", height: units.gu(19), size: "large", index: 3 },272 { tag: "Wide", height: units.gu(19), size: "large", index: 3 },
272 { tag: "Tall", height: units.gu(38) / 0.7, size: "large", width: units.gu(38), index: 4 },273 { tag: "Tall", height: units.gu(38) / 0.7, size: "large", width: units.gu(38), index: 4 },
273 { tag: "VerticalWidth", width: function() { return headerRow.width + units.gu(1) * 2 }, index: 0 },274 { tag: "VerticalWidth", width: function() { return headerRow.width + units.gu(1) }, index: 0 },
274 { tag: "HorizontalHeight", height: function() { return headerRow.height + units.gu(1) * 2 }, index: 5 },275 { tag: "HorizontalHeight", height: function() { return headerRow.height + units.gu(1) * 2 }, index: 5 },
275 { tag: "HorizontalWidth", width: function() { return headerRow.x - units.gu(1) }, index: 5 },276 { tag: "HorizontalWidth", width: function() { return headerRow.x - units.gu(1) }, index: 5 },
276 ]277 ]
@@ -458,6 +459,23 @@
458 tryCompareFunction(function() { return Qt.colorEqual(subtitle.color, fontColor); }, true);459 tryCompareFunction(function() { return Qt.colorEqual(subtitle.color, fontColor); }, true);
459 }460 }
460461
462 function test_emblemImage_data() {
463 return [
464 { tag: "Art and summary", emblem: true, index: 0 },
465 { tag: "Art and summary, small", emblem: false, index: 1 },
466 { tag: "No header", emblem: false, index: 7 },
467 { tag: "With background", emblem: true, index: 10 },
468 ];
469 }
470
471 function test_emblemImage(data) {
472 selector.selectedIndex = data.index;
473 waitForRendering(card);
474
475 var emblemImage = findChild(card, "emblemImage");
476 compare(emblemImage !== null, data.emblem);
477 }
478
461 function test_mascotShape_data() {479 function test_mascotShape_data() {
462 return [480 return [
463 { tag: "Art and summary", shape: false, index: 0 },481 { tag: "Art and summary", shape: false, index: 0 },
464482
=== modified file 'tests/qmltests/Dash/tst_Dash.qml'
--- tests/qmltests/Dash/tst_Dash.qml 2014-08-06 14:50:25 +0000
+++ tests/qmltests/Dash/tst_Dash.qml 2014-08-08 14:57:17 +0000
@@ -20,8 +20,6 @@
20import Ubuntu.Components 0.120import Ubuntu.Components 0.1
21import Unity.Test 0.1 as UT21import Unity.Test 0.1 as UT
2222
23// TODO We don't have any tests for the overlay scope functionality.
24
25Item {23Item {
26 id: shell24 id: shell
27 width: units.gu(40)25 width: units.gu(40)
@@ -61,9 +59,9 @@
61 function get_scope_data() {59 function get_scope_data() {
62 return [60 return [
63 { tag: "MockScope1", visualIndex: 0 },61 { tag: "MockScope1", visualIndex: 0 },
64 { tag: "MockScope2", visualIndex: 1 },62 { tag: "MockScope2", visualIndex: -1 },
65 { tag: "clickscope", visualIndex: 2 },63 { tag: "clickscope", visualIndex: 1 },
66 { tag: "MockScope5", visualIndex: 3 },64 { tag: "MockScope5", visualIndex: 2 },
67 ]65 ]
68 }66 }
6967
@@ -79,10 +77,234 @@
79 tryCompare(dashContentList, "count", 0);77 tryCompare(dashContentList, "count", 0);
80 scopes.load();78 scopes.load();
81 tryCompare(scopes, "loaded", true);79 tryCompare(scopes, "loaded", true);
82 tryCompare(dashContentList, "count", 5);80 tryCompare(dashContentList, "count", 6);
8381
84 verify(dashContentList != undefined);82 verify(dashContentList != undefined);
85 tryCompare(dashContentList, "currentIndex", data.visualIndex);83 if (data.visualIndex == -1) {
84 tryCompare(dashContentList, "currentIndex", 0);
85 expectFail(data.tag, "non favorite scopes should not be visble in the scopes model");
86 compare(dashContentList.currentItem.scopeId, data.tag); // this should fail
87 } else {
88 tryCompare(dashContentList, "currentIndex", data.visualIndex);
89 compare(dashContentList.currentItem.scopeId, data.tag);
90 }
91 }
92
93 function test_dash_overview_show_select_same_favorite() {
94 // Wait for stuff to be loaded
95 tryCompare(scopes, "loaded", true);
96 var dashContentList = findChild(dash, "dashContentList");
97 tryCompare(dashContentList, "count", 6);
98 var mockScope1Loader = findChild(dash, "MockScope1 loader");
99 tryCompareFunction(function() { return mockScope1Loader.item != null; }, true);
100
101 // Show the overview
102 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
103 var overviewController = findInvisibleChild(dash, "overviewController");
104 tryCompare(overviewController, "progress", 1);
105
106 // Make sure tab is where it should
107 var scopesOverview = findChild(dash, "scopesOverview");
108 compare(scopesOverview.currentTab, 0);
109
110 // Make sure stuff is loaded
111 var scopesOverviewFavoritesRepeater = findChild(dash, "scopesOverviewFavoritesRepeater");
112 tryCompare(scopesOverviewFavoritesRepeater, "count", 6);
113 tryCompareFunction(function() { return scopesOverviewFavoritesRepeater.itemAt(0).item != null; }, true);
114 waitForRendering(scopesOverviewFavoritesRepeater.itemAt(0).item);
115
116 // Click in first item
117 mouseClick(scopesOverviewFavoritesRepeater.itemAt(0).item, 0, 0);
118
119 // Make sure animation went back
120 tryCompare(overviewController, "progress", 0);
121 compare(dashContentList.currentIndex, 0);
122 }
123
124 function test_dash_overview_show_select_different_favorite() {
125 // Wait for stuff to be loaded
126 tryCompare(scopes, "loaded", true);
127 var dashContentList = findChild(dash, "dashContentList");
128 tryCompare(dashContentList, "count", 6);
129 var mockScope1Loader = findChild(dash, "MockScope1 loader");
130 tryCompareFunction(function() { return mockScope1Loader.item != null; }, true);
131
132 // Show the overview
133 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
134 var overviewController = findInvisibleChild(dash, "overviewController");
135 tryCompare(overviewController, "progress", 1);
136
137 // Make sure tab is where it should
138 var scopesOverview = findChild(dash, "scopesOverview");
139 compare(scopesOverview.currentTab, 0);
140
141 // Make sure stuff is loaded
142 var scopesOverviewFavoritesRepeater = findChild(dash, "scopesOverviewFavoritesRepeater");
143 tryCompare(scopesOverviewFavoritesRepeater, "count", 6);
144 tryCompareFunction(function() { return scopesOverviewFavoritesRepeater.itemAt(0).item != null; }, true);
145 waitForRendering(scopesOverviewFavoritesRepeater.itemAt(1).item);
146
147 // Click in first item
148 mouseClick(scopesOverviewFavoritesRepeater.itemAt(1).item, 0, 0);
149
150 // Make sure animation went back
151 tryCompare(overviewController, "progress", 0);
152 compare(dashContentList.currentIndex, 1);
153 }
154
155 function test_dash_overview_all_temp_scope_done_from_all() {
156 // Wait for stuff to be loaded
157 tryCompare(scopes, "loaded", true);
158 var dashContentList = findChild(dash, "dashContentList");
159 tryCompare(dashContentList, "count", 6);
160 var mockScope1Loader = findChild(dash, "MockScope1 loader");
161 tryCompareFunction(function() { return mockScope1Loader.item != null; }, true);
162
163 // Show the overview
164 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
165 var overviewController = findInvisibleChild(dash, "overviewController");
166 tryCompare(overviewController, "progress", 1);
167
168 // Make sure tab is where it should
169 var scopesOverview = findChild(dash, "scopesOverview");
170 compare(scopesOverview.currentTab, 0);
171
172 // Make sure stuff is loaded
173 var scopesOverviewFavoritesRepeater = findChild(dash, "scopesOverviewFavoritesRepeater");
174 tryCompare(scopesOverviewFavoritesRepeater, "count", 6);
175 tryCompareFunction(function() { return scopesOverviewFavoritesRepeater.itemAt(0).item != null; }, true);
176 waitForRendering(scopesOverviewFavoritesRepeater.itemAt(1).item);
177
178 // Click on the all tab
179 var scopesOverviewAllTabButton = findChild(dash, "scopesOverviewAllTabButton");
180 mouseClick(scopesOverviewAllTabButton, 0, 0);
181
182 // Wait for all tab to be enabled (animation finish)
183 var scopesOverviewAllView = findChild(dash, "scopesOverviewRepeaterChild1");
184 tryCompare(scopesOverviewAllView, "enabled", true);
185
186 // Click on a temp scope
187 var tempScopeCard = findChild(scopesOverviewAllView, "delegate1");
188 mouseClick(tempScopeCard, 0, 0);
189
190 // Check the bottom edge (overview) is disabled from temp scope
191 var overviewDragHandle = findChild(dash, "overviewDragHandle");
192 compare(overviewDragHandle.enabled, false);
193
194 // Check temp scope is there
195 var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem");
196 tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope != null; }, true);
197 tryCompare(scopesOverviewTempScopeItem, "enabled", true);
198
199 // Go back
200 var scopesOverviewTempScopeItemHeader = findChild(scopesOverviewTempScopeItem, "scopePageHeader");
201 var backButton = findChild(findChild(scopesOverviewTempScopeItemHeader, "innerPageHeader"), "backButton");
202 mouseClick(backButton, 0, 0);
203
204 // Check temp scope is gone
205 var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem");
206 tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope == null; }, true);
207 tryCompare(scopesOverviewTempScopeItem, "enabled", false);
208
209 // Press on done
210 var scopesOverviewDoneButton = findChild(scopesOverview, "scopesOverviewDoneButton");
211 mouseClick(scopesOverviewDoneButton, 0, 0);
212
213 // Check the dash overview is gone
214 tryCompare(overviewController, "progress", 0);
215
216 // Original list is still on 0
217 compare(dashContentList.currentIndex, 0);
218 }
219
220 function test_temp_scope_dash_overview_all_search_temp_scope_favorite_from_all() {
221 // Wait for stuff to be loaded
222 tryCompare(scopes, "loaded", true);
223 var dashContentList = findChild(dash, "dashContentList");
224 tryCompare(dashContentList, "count", 6);
225 var mockScope1Loader = findChild(dash, "MockScope1 loader");
226 tryCompareFunction(function() { return mockScope1Loader.item != null; }, true);
227
228 // Swipe right to Apps scope
229 touchFlick(dash, dash.width - 1, units.gu(1), dash.width - units.gu(10), units.gu(1));
230 tryCompare(dashContentList, "contentX", dashContentList.width);
231 tryCompare(dashContentList, "currentIndex", 1);
232
233 // Click on card that opens temp scope
234 var categoryListView = findChild(dashContentList.currentItem, "categoryListView");
235 var dashCategory2 = findChild(categoryListView, "dashCategory2");
236 tryCompareFunction(function() {
237 var d = findChild(dashCategory2, "delegate2");
238 if (d) return true;
239 categoryListView.contentY += 100;
240 return false;
241 }, true);
242 var card2 = findChild(dashCategory2, "delegate2");
243 waitForRendering(card2);
244 mouseClick(card2, card2.width / 2, card2.height / 2);
245
246 // Wait for temp scope to be there
247 var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
248 tryCompare(dashTempScopeItem, "x", 0);
249
250 // Show the overview
251 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
252 var overviewController = findInvisibleChild(dash, "overviewController");
253 tryCompare(overviewController, "progress", 1);
254
255 // Make sure tab is where it should
256 var scopesOverview = findChild(dash, "scopesOverview");
257 compare(scopesOverview.currentTab, 1);
258
259 // Do a search
260 var scopesOverviewPageHeader = findChild(scopesOverview, "scopesOverviewPageHeader");
261 var searchButton = findChild(scopesOverviewPageHeader, "search_header_button");
262 mouseClick(searchButton, 0, 0);
263
264 // Type something
265 keyClick(Qt.Key_H);
266
267 // Check results grid is there and the other lists are not
268 var searchResultsViewer = findChild(scopesOverview, "searchResultsViewer");
269 var scopesOverviewRepeater = findChild(dash, "scopesOverviewRepeater");
270 tryCompare(searchResultsViewer, "opacity", 1);
271 tryCompare(scopesOverviewRepeater, "count", 0);
272
273 // Click on a temp scope in the search
274 var dashCategorysearchA = findChild(searchResultsViewer, "dashCategorysearchA");
275 var cardTempScope = findChild(dashCategorysearchA, "delegate2");
276 waitForRendering(cardTempScope);
277 mouseClick(cardTempScope, cardTempScope.width / 2, cardTempScope.height / 2);
278
279 // Check the bottom edge (overview) is disabled from temp scope
280 var overviewDragHandle = findChild(dash, "overviewDragHandle");
281 compare(overviewDragHandle.enabled, false);
282
283 // Check temp scope is there
284 var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem");
285 tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope != null; }, true);
286 tryCompare(scopesOverviewTempScopeItem, "enabled", true);
287
288 // Go back
289 var scopesOverviewTempScopeItemHeader = findChild(scopesOverviewTempScopeItem, "scopePageHeader");
290 var backButton = findChild(findChild(scopesOverviewTempScopeItemHeader, "innerPageHeader"), "backButton");
291 mouseClick(backButton, 0, 0);
292
293 // Check temp scope is gone
294 var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem");
295 tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope == null; }, true);
296 tryCompare(scopesOverviewTempScopeItem, "enabled", false);
297
298 // Press on a favorite
299 var dashCategorysearchB = findChild(searchResultsViewer, "dashCategorysearchB");
300 var cardFavSearch = findChild(dashCategorysearchB, "delegate3");
301 mouseClick(cardFavSearch, 0, 0);
302
303 // Check the dash overview is gone
304 tryCompare(overviewController, "progress", 0);
305
306 // Original list went to the favorite
307 compare(dashContentList.currentIndex, 0);
86 }308 }
87309
88 function test_setCurrentScope() {310 function test_setCurrentScope() {
89311
=== modified file 'tests/qmltests/Dash/tst_DashContent.qml'
--- tests/qmltests/Dash/tst_DashContent.qml 2014-08-06 10:16:59 +0000
+++ tests/qmltests/Dash/tst_DashContent.qml 2014-08-08 14:57:17 +0000
@@ -70,7 +70,7 @@
70 function loadScopes() {70 function loadScopes() {
71 scopeLoadedSpy.clear();71 scopeLoadedSpy.clear();
72 scopesModel.load();72 scopesModel.load();
73 tryCompare(scopeLoadedSpy, "count", 4);73 tryCompare(scopeLoadedSpy, "count", 6);
74 }74 }
7575
76 function init() {76 function init() {
@@ -114,7 +114,8 @@
114114
115 loadScopes();115 loadScopes();
116116
117 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5);117 compare(dashContentList.count, 6);
118 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < dashContentList.count);
118 }119 }
119120
120 function test_show_header_on_list_movement() {121 function test_show_header_on_list_movement() {
@@ -170,7 +171,7 @@
170171
171 // test greater than scope count.172 // test greater than scope count.
172 var currentScopeIndex = dashContent.currentIndex;173 var currentScopeIndex = dashContent.currentIndex;
173 dashContent.setCurrentScopeAtIndex(8, true, false);174 dashContent.setCurrentScopeAtIndex(18, true, false);
174 compare(dashContent.currentIndex, currentScopeIndex, "Scope should not change if changing to greater index than count");175 compare(dashContent.currentIndex, currentScopeIndex, "Scope should not change if changing to greater index than count");
175 }176 }
176177
@@ -189,9 +190,9 @@
189 function test_scope_mapping_data() {190 function test_scope_mapping_data() {
190 return [191 return [
191 {tag: "index0", index: 0, objectName: "MockScope1"},192 {tag: "index0", index: 0, objectName: "MockScope1"},
192 {tag: "index1", index: 1, objectName: "MockScope2"},193 {tag: "index1", index: 1, objectName: "clickscope"},
193 {tag: "index2", index: 2, objectName: "clickscope"},194 {tag: "index2", index: 2, objectName: "MockScope5"},
194 {tag: "index3", index: 3, objectName: "MockScope5"}195 {tag: "index3", index: 3, objectName: "SingleCategoryScope"}
195 ]196 ]
196 }197 }
197198
198199
=== modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml'
--- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-06 19:39:30 +0000
+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-08 14:57:17 +0000
@@ -61,8 +61,8 @@
61 property Item header: findChild(genericScopeView, "scopePageHeader")61 property Item header: findChild(genericScopeView, "scopePageHeader")
6262
63 function init() {63 function init() {
64 genericScopeView.scope = scopes.getScope(1)64 genericScopeView.scope = scopes.getScope(2);
65 shell.width = units.gu(120)65 shell.width = units.gu(120);
66 genericScopeView.categoryView.positionAtBeginning();66 genericScopeView.categoryView.positionAtBeginning();
67 waitForRendering(genericScopeView.categoryView);67 waitForRendering(genericScopeView.categoryView);
68 }68 }
@@ -88,13 +88,13 @@
8888
89 function test_showDash() {89 function test_showDash() {
90 testCase.previewListView.open = true;90 testCase.previewListView.open = true;
91 scopes.getScope(1).showDash();91 genericScopeView.scope.showDash();
92 tryCompare(testCase.previewListView, "open", false);92 tryCompare(testCase.previewListView, "open", false);
93 }93 }
9494
95 function test_hideDash() {95 function test_hideDash() {
96 testCase.previewListView.open = true;96 testCase.previewListView.open = true;
97 scopes.getScope(1).hideDash();97 genericScopeView.scope.hideDash();
98 tryCompare(testCase.previewListView, "open", false);98 tryCompare(testCase.previewListView, "open", false);
99 }99 }
100100
@@ -111,8 +111,9 @@
111111
112 function test_changeScope() {112 function test_changeScope() {
113 genericScopeView.scope.searchQuery = "test"113 genericScopeView.scope.searchQuery = "test"
114 genericScopeView.scope = scopes.getScope(2)114 var originalScopeId = genericScopeView.scope.id;
115 genericScopeView.scope = scopes.getScope(1)115 genericScopeView.scope = scopes.getScope(originalScopeId + 1)
116 genericScopeView.scope = scopes.getScope(originalScopeId)
116 tryCompare(genericScopeView.scope, "searchQuery", "test")117 tryCompare(genericScopeView.scope, "searchQuery", "test")
117 }118 }
118119
@@ -198,6 +199,8 @@
198 openPreview(4, 0);199 openPreview(4, 0);
199200
200 compare(testCase.previewListView.count, 12, "There should only be 12 items in preview.");201 compare(testCase.previewListView.count, 12, "There should only be 12 items in preview.");
202
203 closePreview();
201 }204 }
202205
203 function test_narrow_delegate_ranges_expand() {206 function test_narrow_delegate_ranges_expand() {
@@ -232,7 +235,7 @@
232 }235 }
233236
234 function test_single_category_expansion() {237 function test_single_category_expansion() {
235 genericScopeView.scope = scopes.getScope(4);238 genericScopeView.scope = scopes.getScope(3);
236239
237 tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory0") != undefined; }, true);240 tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory0") != undefined; }, true);
238 var category = findChild(genericScopeView, "dashCategory0")241 var category = findChild(genericScopeView, "dashCategory0")
@@ -329,8 +332,8 @@
329 function test_header_style_data() {332 function test_header_style_data() {
330 return [333 return [
331 { tag: "Default", index: 0, foreground: "grey", background: "", logo: "" },334 { tag: "Default", index: 0, foreground: "grey", background: "", logo: "" },
332 { tag: "Foreground", index: 2, foreground: "yellow", background: "", logo: "" },335 { tag: "Foreground", index: 1, foreground: "yellow", background: "", logo: "" },
333 { tag: "Logo+Background", index: 3, foreground: "grey", background: "gradient:///lightgrey/grey",336 { tag: "Logo+Background", index: 2, foreground: "grey", background: "gradient:///lightgrey/grey",
334 logo: Qt.resolvedUrl("../Components/tst_PageHeader/logo-ubuntu-orange.svg") },337 logo: Qt.resolvedUrl("../Components/tst_PageHeader/logo-ubuntu-orange.svg") },
335 ];338 ];
336 }339 }

Subscribers

People subscribed via source and target branches