Merge lp:~cimi/unity8/card_emblems_2 into lp:unity8
- card_emblems_2
- Merge into trunk
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 |
Related bugs: |
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
- 1094. By Andrea Cimitan
-
Fixed tests
- 1095. By Andrea Cimitan
-
Fixed test
- 1096. By Andrea Cimitan
-
Added test
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1096
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
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
Ying-Chun Liu (paulliu) wrote : | # |
Ying-Chun Liu (paulliu) wrote : | # |
cardTool?
- 1097. By Andrea Cimitan
-
More fixes
Ying-Chun Liu (paulliu) wrote : | # |
In the diff there's conflict. Seems we need a re-merge trunk here?
- 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
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1097
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1099
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1099
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 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
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.
- 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
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1100
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1109. By Andrea Cimitan
-
Fix issue in reviewy
Unmerged revisions
Preview Diff
1 | === modified file 'data/unity8-dash.conf' | |||
2 | --- data/unity8-dash.conf 2014-07-29 11:35:10 +0000 | |||
3 | +++ data/unity8-dash.conf 2014-08-08 14:57:17 +0000 | |||
4 | @@ -13,7 +13,7 @@ | |||
5 | 13 | pre-start script | 13 | pre-start script |
6 | 14 | if [ -z "$UNITY_SCOPES_LIST" ]; then | 14 | if [ -z "$UNITY_SCOPES_LIST" ]; then |
7 | 15 | # FIXME: remove once we have this in dconf | 15 | # FIXME: remove once we have this in dconf |
9 | 16 | initctl set-env UNITY_SCOPES_LIST="scopes;clickscope;musicaggregator;videoaggregator" | 16 | initctl set-env UNITY_SCOPES_LIST="clickscope;musicaggregator;videoaggregator" |
10 | 17 | fi | 17 | fi |
11 | 18 | 18 | ||
12 | 19 | initctl emit scope-ui-starting | 19 | initctl emit scope-ui-starting |
13 | 20 | 20 | ||
14 | === modified file 'plugins/Dash/CardCreator.js' | |||
15 | --- plugins/Dash/CardCreator.js 2014-08-06 19:39:39 +0000 | |||
16 | +++ plugins/Dash/CardCreator.js 2014-08-08 14:57:17 +0000 | |||
17 | @@ -108,6 +108,7 @@ | |||
18 | 108 | sourceComponent: ShaderEffect { \n\ | 108 | sourceComponent: ShaderEffect { \n\ |
19 | 109 | id: overlay; \n\ | 109 | id: overlay; \n\ |
20 | 110 | height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); \n\ | 110 | height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); \n\ |
21 | 111 | property real luminance: 0.2126 * overlayColor.r + 0.7152 * overlayColor.g + 0.0722 * overlayColor.b; \n\ | ||
22 | 111 | property color overlayColor: cardData && cardData["overlayColor"] || "#99000000"; \n\ | 112 | property color overlayColor: cardData && cardData["overlayColor"] || "#99000000"; \n\ |
23 | 112 | property var source: ShaderEffectSource { \n\ | 113 | property var source: ShaderEffectSource { \n\ |
24 | 113 | id: shaderSource; \n\ | 114 | id: shaderSource; \n\ |
25 | @@ -137,69 +138,43 @@ | |||
26 | 137 | } \n\ | 138 | } \n\ |
27 | 138 | }\n'; | 139 | }\n'; |
28 | 139 | 140 | ||
78 | 140 | // %1 is used as anchors of row | 141 | // multiple row version of HeaderRowCode |
79 | 141 | // %2 is used as first child of the row | 142 | function kHeaderRowCodeGenerator() { |
80 | 142 | // %3 is used as second child of the row | 143 | var kHeaderRowCodeTemplate = 'Row { \n\ |
81 | 143 | var kHeaderRow2Code = 'Row { \n\ | 144 | id: row; \n\ |
82 | 144 | id: row; \n\ | 145 | objectName: "outerRow"; \n\ |
83 | 145 | objectName: "outerRow"; \n\ | 146 | property real margins: units.gu(1); \n\ |
84 | 146 | property real margins: units.gu(1); \n\ | 147 | spacing: margins; \n\ |
85 | 147 | spacing: margins; \n\ | 148 | height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\ |
86 | 148 | height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\ | 149 | anchors { %1 } \n\ |
87 | 149 | anchors { %1 } \n\ | 150 | anchors.right: parent.right; \n\ |
88 | 150 | anchors.right: parent.right; \n\ | 151 | anchors.margins: margins; \n\ |
89 | 151 | anchors.margins: margins;\n\ | 152 | anchors.rightMargin: 0; \n\ |
90 | 152 | data: [ %2\n\ | 153 | data: [ \n\ |
91 | 153 | ,\n\ | 154 | %2 \n\ |
92 | 154 | %3 \n\ | 155 | ] \n\ |
93 | 155 | ] \n\ | 156 | }\n'; |
94 | 156 | }\n'; | 157 | var args = Array.prototype.slice.call(arguments); |
95 | 157 | 158 | var HeaderRowAnchors = args.shift(); | |
96 | 158 | // %1 is used as anchors of row | 159 | var code = kHeaderRowCodeTemplate.arg(HeaderRowAnchors).arg(args.join(',\n')); |
97 | 159 | // %2 is used as first child of the row | 160 | return code; |
98 | 160 | // %3 is used as second child of the row | 161 | } |
99 | 161 | // %4 is used as third child of the row | 162 | |
100 | 162 | var kHeaderRow3Code = 'Row { \n\ | 163 | // multiple item version of kHeaderContainerCode |
101 | 163 | id: row; \n\ | 164 | function kHeaderContainerCodeGenerator() { |
102 | 164 | objectName: "outerRow"; \n\ | 165 | var headerContainerCodeTemplate = 'Item { \n\ |
103 | 165 | property real margins: units.gu(1); \n\ | 166 | id: headerTitleContainer; \n\ |
104 | 166 | spacing: margins; \n\ | 167 | anchors { %1 } \n\ |
105 | 167 | height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\ | 168 | width: parent.width - x; \n\ |
106 | 168 | anchors { %1 } \n\ | 169 | implicitHeight: %2; \n\ |
107 | 169 | anchors.right: parent.right; \n\ | 170 | data: [ \n\ |
108 | 170 | anchors.margins: margins;\n\ | 171 | %3 \n\ |
109 | 171 | data: [ %2\n\ | 172 | ]\n\ |
61 | 172 | ,\n\ | ||
62 | 173 | %3 \n\ | ||
63 | 174 | ,\n\ | ||
64 | 175 | %4 \n\ | ||
65 | 176 | ] \n\ | ||
66 | 177 | }\n'; | ||
67 | 178 | |||
68 | 179 | // %1 is used as first child of the column | ||
69 | 180 | // %2 is used as second child of the column | ||
70 | 181 | var kHeaderColumnCode = 'Column { \n\ | ||
71 | 182 | anchors.verticalCenter: parent.verticalCenter; \n\ | ||
72 | 183 | spacing: units.dp(2); \n\ | ||
73 | 184 | width: parent.width - x;\n\ | ||
74 | 185 | data: [ %1\n\ | ||
75 | 186 | ,\n\ | ||
76 | 187 | %2 \n\ | ||
77 | 188 | ] \n\ | ||
110 | 189 | }\n'; | 173 | }\n'; |
111 | 190 | |||
112 | 191 | // multiple column version of kHeaderColumnCode. | ||
113 | 192 | function kHeaderColumnCodeGenerator() { | ||
114 | 193 | var headerColumnCodeTemplate = 'Column { \n\ | ||
115 | 194 | anchors.verticalCenter: parent.verticalCenter; \n\ | ||
116 | 195 | spacing: units.dp(2); \n\ | ||
117 | 196 | width: parent.width - x;\n\ | ||
118 | 197 | data: [ \n\ | ||
119 | 198 | %1 \n\ | ||
120 | 199 | ]\n\ | ||
121 | 200 | }\n'; | ||
122 | 201 | var args = Array.prototype.slice.call(arguments); | 174 | var args = Array.prototype.slice.call(arguments); |
124 | 202 | var code = headerColumnCodeTemplate.arg(args.join(',\n')); | 175 | var headerContainerAnchors = args.shift(); |
125 | 176 | var headerContainerHeight = args.shift(); | ||
126 | 177 | var code = headerContainerCodeTemplate.arg(headerContainerAnchors).arg(headerContainerHeight).arg(args.join(',\n')); | ||
127 | 203 | return code; | 178 | return code; |
128 | 204 | } | 179 | } |
129 | 205 | 180 | ||
130 | @@ -223,7 +198,7 @@ | |||
131 | 223 | objectName: "mascotImage"; \n\ | 198 | objectName: "mascotImage"; \n\ |
132 | 224 | anchors { %1 } \n\ | 199 | anchors { %1 } \n\ |
133 | 225 | readonly property int maxSize: Math.max(width, height) * 4; \n\ | 200 | readonly property int maxSize: Math.max(width, height) * 4; \n\ |
135 | 226 | source: cardData && cardData["mascot"]; \n\ | 201 | source: cardData && cardData["mascot"] || ""; \n\ |
136 | 227 | width: units.gu(6); \n\ | 202 | width: units.gu(6); \n\ |
137 | 228 | height: units.gu(5.625); \n\ | 203 | height: units.gu(5.625); \n\ |
138 | 229 | sourceSize { width: maxSize; height: maxSize } \n\ | 204 | sourceSize { width: maxSize; height: maxSize } \n\ |
139 | @@ -252,6 +227,20 @@ | |||
140 | 252 | horizontalAlignment: root.headerAlignment; \n\ | 227 | horizontalAlignment: root.headerAlignment; \n\ |
141 | 253 | }\n'; | 228 | }\n'; |
142 | 254 | 229 | ||
143 | 230 | var kEmblemImageCode = 'Image { \n\ | ||
144 | 231 | id: emblemImage; \n\ | ||
145 | 232 | objectName: "emblemImage"; \n\ | ||
146 | 233 | anchors { \n\ | ||
147 | 234 | bottom: titleLabel.baseline; \n\ | ||
148 | 235 | right: parent.right; \n\ | ||
149 | 236 | rightMargin: status === Image.Ready ? units.gu(1) : 0; \n\ | ||
150 | 237 | } \n\ | ||
151 | 238 | source: cardData && cardData["emblem"] || ""; \n\ | ||
152 | 239 | width: height; \n\ | ||
153 | 240 | height: status === Image.Ready ? titleLabel.font.pixelSize : 0; \n\ | ||
154 | 241 | fillMode: Image.PreserveAspectFit; \n\ | ||
155 | 242 | }\n'; | ||
156 | 243 | |||
157 | 255 | // %1 is used as anchors of touchdown effect | 244 | // %1 is used as anchors of touchdown effect |
158 | 256 | var kTouchdownCode = 'UbuntuShape { \n\ | 245 | var kTouchdownCode = 'UbuntuShape { \n\ |
159 | 257 | id: touchdown; \n\ | 246 | id: touchdown; \n\ |
160 | @@ -268,6 +257,7 @@ | |||
161 | 268 | id: subtitleLabel; \n\ | 257 | id: subtitleLabel; \n\ |
162 | 269 | objectName: "subtitleLabel"; \n\ | 258 | objectName: "subtitleLabel"; \n\ |
163 | 270 | anchors { %1 } \n\ | 259 | anchors { %1 } \n\ |
164 | 260 | anchors.topMargin: units.dp(2); \n\ | ||
165 | 271 | elide: Text.ElideRight; \n\ | 261 | elide: Text.ElideRight; \n\ |
166 | 272 | fontSize: "small"; \n\ | 262 | fontSize: "small"; \n\ |
167 | 273 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\ | 263 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\ |
168 | @@ -284,7 +274,7 @@ | |||
169 | 284 | objectName: "attributesRow"; \n\ | 274 | objectName: "attributesRow"; \n\ |
170 | 285 | anchors { %1 } \n\ | 275 | anchors { %1 } \n\ |
171 | 286 | color: %2; \n\ | 276 | color: %2; \n\ |
173 | 287 | model: cardData["attributes"]; \n\ | 277 | model: cardData && cardData["attributes"]; \n\ |
174 | 288 | }\n'; | 278 | }\n'; |
175 | 289 | 279 | ||
176 | 290 | // %1 is used as top anchor of summary | 280 | // %1 is used as top anchor of summary |
177 | @@ -334,10 +324,11 @@ | |||
178 | 334 | var hasBackground = !isHorizontal && (template["card-background"] || components["background"] || artAndSummary); | 324 | var hasBackground = !isHorizontal && (template["card-background"] || components["background"] || artAndSummary); |
179 | 335 | var hasTitle = components["title"] || false; | 325 | var hasTitle = components["title"] || false; |
180 | 336 | var hasMascot = components["mascot"] || false; | 326 | var hasMascot = components["mascot"] || false; |
181 | 327 | var hasEmblem = components["emblem"] && !(hasMascot && template["card-size"] === "small") || false; | ||
182 | 337 | var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot); | 328 | var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot); |
183 | 338 | var hasSubtitle = hasTitle && components["subtitle"] || false; | 329 | var hasSubtitle = hasTitle && components["subtitle"] || false; |
184 | 339 | var hasHeaderRow = hasMascot && hasTitle; | 330 | var hasHeaderRow = hasMascot && hasTitle; |
186 | 340 | var hasAttributes = hasTitle && components["attributes"] || false; | 331 | var hasAttributes = hasTitle && components["attributes"]["field"] || false; |
187 | 341 | 332 | ||
188 | 342 | if (hasBackground) { | 333 | if (hasBackground) { |
189 | 343 | code += kBackgroundLoaderCode; | 334 | code += kBackgroundLoaderCode; |
190 | @@ -348,9 +339,9 @@ | |||
191 | 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'; |
192 | 349 | 340 | ||
193 | 350 | var widthCode, heightCode; | 341 | var widthCode, heightCode; |
195 | 351 | var anchors; | 342 | var artAnchors; |
196 | 352 | if (isHorizontal) { | 343 | if (isHorizontal) { |
198 | 353 | anchors = 'left: parent.left'; | 344 | artAnchors = 'left: parent.left'; |
199 | 354 | if (hasMascot || hasTitle) { | 345 | if (hasMascot || hasTitle) { |
200 | 355 | widthCode = 'height * artShape.aspect' | 346 | widthCode = 'height * artShape.aspect' |
201 | 356 | heightCode = 'headerHeight + 2 * units.gu(1)'; | 347 | heightCode = 'headerHeight + 2 * units.gu(1)'; |
202 | @@ -361,12 +352,12 @@ | |||
203 | 361 | heightCode = 'units.gu(7.625)'; | 352 | heightCode = 'units.gu(7.625)'; |
204 | 362 | } | 353 | } |
205 | 363 | } else { | 354 | } else { |
207 | 364 | anchors = 'horizontalCenter: parent.horizontalCenter;'; | 355 | artAnchors = 'horizontalCenter: parent.horizontalCenter;'; |
208 | 365 | widthCode = 'root.width' | 356 | widthCode = 'root.width' |
209 | 366 | heightCode = 'width / artShape.aspect'; | 357 | heightCode = 'width / artShape.aspect'; |
210 | 367 | } | 358 | } |
211 | 368 | 359 | ||
213 | 369 | code += kArtShapeHolderCode.arg(anchors).arg(widthCode).arg(heightCode); | 360 | code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode); |
214 | 370 | } else { | 361 | } else { |
215 | 371 | code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n' | 362 | code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n' |
216 | 372 | } | 363 | } |
217 | @@ -423,155 +414,194 @@ | |||
218 | 423 | code += 'readonly property int headerHeight: 0;\n' | 414 | code += 'readonly property int headerHeight: 0;\n' |
219 | 424 | } | 415 | } |
220 | 425 | 416 | ||
223 | 426 | var mascotShapeCode = ""; | 417 | var mascotShapeCode = ''; |
224 | 427 | var mascotCode = ""; | 418 | var mascotCode = ''; |
225 | 428 | if (hasMascot) { | 419 | if (hasMascot) { |
226 | 429 | var useMascotShape = !hasBackground && !headerAsOverlay; | 420 | var useMascotShape = !hasBackground && !headerAsOverlay; |
228 | 430 | var anchors = ""; | 421 | var mascotAnchors = ''; |
229 | 431 | if (!hasHeaderRow) { | 422 | if (!hasHeaderRow) { |
232 | 432 | anchors += headerLeftAnchor; | 423 | mascotAnchors += headerLeftAnchor; |
233 | 433 | anchors += headerVerticalAnchors; | 424 | mascotAnchors += headerVerticalAnchors; |
234 | 434 | if (!headerLeftAnchorHasMargin) { | 425 | if (!headerLeftAnchorHasMargin) { |
236 | 435 | anchors += 'leftMargin: units.gu(1);\n' | 426 | mascotAnchors += 'leftMargin: units.gu(1);\n' |
237 | 436 | } | 427 | } |
238 | 437 | } else { | 428 | } else { |
240 | 438 | anchors = "verticalCenter: parent.verticalCenter;" | 429 | mascotAnchors = 'verticalCenter: parent.verticalCenter;' |
241 | 439 | } | 430 | } |
242 | 440 | 431 | ||
243 | 441 | if (useMascotShape) { | 432 | if (useMascotShape) { |
245 | 442 | mascotShapeCode = kMascotShapeLoaderCode.arg(anchors); | 433 | mascotShapeCode = kMascotShapeLoaderCode.arg(mascotAnchors); |
246 | 443 | } | 434 | } |
247 | 444 | 435 | ||
248 | 445 | var mascotImageVisible = useMascotShape ? 'false' : 'showHeader'; | 436 | var mascotImageVisible = useMascotShape ? 'false' : 'showHeader'; |
250 | 446 | mascotCode = kMascotImageCode.arg(anchors).arg(mascotImageVisible); | 437 | mascotCode = kMascotImageCode.arg(mascotAnchors).arg(mascotImageVisible); |
251 | 447 | } | 438 | } |
252 | 448 | 439 | ||
254 | 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")'; |
255 | 450 | 441 | ||
257 | 451 | var titleSubtitleCode = ""; | 442 | var hasTitleContainer = hasTitle && (hasEmblem || (hasMascot && (hasSubtitle || hasAttributes))); |
258 | 443 | var titleSubtitleCode = ''; | ||
259 | 452 | if (hasTitle) { | 444 | if (hasTitle) { |
261 | 453 | var color; | 445 | var titleColor; |
262 | 454 | if (headerAsOverlay) { | 446 | if (headerAsOverlay) { |
264 | 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")'; |
265 | 456 | } else if (hasSummary) { | 448 | } else if (hasSummary) { |
267 | 457 | color = 'summary.color'; | 449 | titleColor = 'summary.color'; |
268 | 458 | } else if (hasBackground) { | 450 | } else if (hasBackground) { |
270 | 459 | color = summaryColorWithBackground; | 451 | titleColor = summaryColorWithBackground; |
271 | 460 | } else { | 452 | } else { |
273 | 461 | color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"'; | 453 | titleColor = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"'; |
274 | 462 | } | 454 | } |
275 | 463 | 455 | ||
276 | 464 | var titleAnchors; | 456 | var titleAnchors; |
277 | 465 | var subtitleAnchors; | 457 | var subtitleAnchors; |
278 | 466 | var attributesAnchors; | 458 | var attributesAnchors; |
284 | 467 | if (hasMascot && (hasSubtitle || hasAttributes)) { | 459 | var titleContainerAnchors; |
285 | 468 | // Using row + column | 460 | var titleRightAnchor; |
286 | 469 | titleAnchors = 'left: parent.left; right: parent.right'; | 461 | |
287 | 470 | subtitleAnchors = titleAnchors; | 462 | if (hasMascot) { |
288 | 471 | attributesAnchors = subtitleAnchors; | 463 | titleContainerAnchors = 'verticalCenter: parent.verticalCenter; '; |
289 | 464 | } else { | ||
290 | 465 | titleContainerAnchors = 'right: parent.right; '; | ||
291 | 466 | titleContainerAnchors += headerLeftAnchor; | ||
292 | 467 | titleContainerAnchors += headerVerticalAnchors; | ||
293 | 468 | if (!headerLeftAnchorHasMargin) { | ||
294 | 469 | titleContainerAnchors += 'leftMargin: units.gu(1);\n'; | ||
295 | 470 | } | ||
296 | 471 | } | ||
297 | 472 | if (hasEmblem) { | ||
298 | 473 | titleRightAnchor = 'right: emblemImage.left; \n\ | ||
299 | 474 | rightMargin: emblemImage.width > 0 ? units.gu(0.5) : 0; \n'; | ||
300 | 475 | } else { | ||
301 | 476 | titleRightAnchor = 'right: parent.right; \n\ | ||
302 | 477 | rightMargin: units.gu(1); \n'; | ||
303 | 478 | } | ||
304 | 479 | |||
305 | 480 | if (hasTitleContainer) { | ||
306 | 481 | // Using headerTitleContainer | ||
307 | 482 | titleAnchors = titleRightAnchor; | ||
308 | 483 | titleAnchors += 'left: parent.left; \n\ | ||
309 | 484 | top: parent.top;'; | ||
310 | 485 | subtitleAnchors = 'right: parent.right; \n\ | ||
311 | 486 | left: parent.left; \n\ | ||
312 | 487 | rightMargin: units.gu(1); \n'; | ||
313 | 488 | if (hasSubtitle) { | ||
314 | 489 | attributesAnchors = subtitleAnchors + 'top: subtitleLabel.bottom;\n'; | ||
315 | 490 | subtitleAnchors += 'top: titleLabel.bottom;\n'; | ||
316 | 491 | } else { | ||
317 | 492 | attributesAnchors = subtitleAnchors + 'top: titleLabel.bottom;\n'; | ||
318 | 493 | } | ||
319 | 472 | } else if (hasMascot) { | 494 | } else if (hasMascot) { |
322 | 473 | // Using row + label | 495 | // Using row + titleContainer |
323 | 474 | titleAnchors = 'verticalCenter: parent.verticalCenter;\n' | 496 | titleAnchors = 'verticalCenter: parent.verticalCenter;\n'; |
324 | 475 | } else { | 497 | } else { |
325 | 476 | if (headerAsOverlay) { | 498 | if (headerAsOverlay) { |
326 | 477 | // Using anchors to the overlay | 499 | // Using anchors to the overlay |
333 | 478 | titleAnchors = 'left: parent.left; \n\ | 500 | titleAnchors = titleRightAnchor; |
334 | 479 | leftMargin: units.gu(1); \n\ | 501 | titleAnchors += 'left: parent.left; \n\ |
335 | 480 | right: parent.right; \n\ | 502 | leftMargin: units.gu(1); \n\ |
336 | 481 | rightMargin: units.gu(1); \n\ | 503 | top: overlayLoader.top; \n\ |
337 | 482 | top: overlayLoader.top; \n\ | 504 | topMargin: units.gu(1);\n'; |
332 | 483 | topMargin: units.gu(1);\n'; | ||
338 | 484 | } else { | 505 | } else { |
339 | 485 | // Using anchors to the mascot/parent | 506 | // Using anchors to the mascot/parent |
342 | 486 | titleAnchors = "right: parent.right;\n"; | 507 | titleAnchors = titleRightAnchor; |
341 | 487 | titleAnchors += "rightMargin: units.gu(1);\n"; | ||
343 | 488 | titleAnchors += headerLeftAnchor; | 508 | titleAnchors += headerLeftAnchor; |
344 | 489 | titleAnchors += headerVerticalAnchors; | 509 | titleAnchors += headerVerticalAnchors; |
345 | 490 | if (!headerLeftAnchorHasMargin) { | 510 | if (!headerLeftAnchorHasMargin) { |
347 | 491 | titleAnchors += 'leftMargin: units.gu(1);\n' | 511 | titleAnchors += 'leftMargin: units.gu(1);\n'; |
348 | 492 | } | 512 | } |
349 | 493 | } | 513 | } |
350 | 494 | subtitleAnchors = 'left: titleLabel.left; \n\ | 514 | subtitleAnchors = 'left: titleLabel.left; \n\ |
351 | 495 | leftMargin: titleLabel.leftMargin; \n\ | 515 | leftMargin: titleLabel.leftMargin; \n\ |
356 | 496 | right: titleLabel.right; \n\ | 516 | rightMargin: units.gu(1); \n'; |
357 | 497 | rightMargin: titleLabel.rightMargin; \n\ | 517 | if (hasEmblem) { |
358 | 498 | top: titleLabel.bottom; \n\ | 518 | // using container |
359 | 499 | topMargin: units.dp(2);\n'; | 519 | subtitleAnchors += 'right: parent.right; \n'; |
360 | 520 | } else { | ||
361 | 521 | subtitleAnchors += 'right: titleLabel.right; \n'; | ||
362 | 522 | } | ||
363 | 523 | |||
364 | 500 | if (hasSubtitle) { | 524 | if (hasSubtitle) { |
371 | 501 | attributesAnchors = 'left: subtitleLabel.left; \n\ | 525 | attributesAnchors = subtitleAnchors + 'top: subtitleLabel.bottom;\n'; |
372 | 502 | leftMargin: subtitleLabel.leftMargin; \n\ | 526 | subtitleAnchors += 'top: titleLabel.bottom;\n'; |
367 | 503 | right: subtitleLabel.right; \n\ | ||
368 | 504 | rightMargin: subtitleLabel.rightMargin; \n\ | ||
369 | 505 | top: subtitleLabel.bottom; \n\ | ||
370 | 506 | topMargin: units.dp(2);\n'; | ||
373 | 507 | } else { | 527 | } else { |
375 | 508 | attributesAnchors = subtitleAnchors; | 528 | attributesAnchors = subtitleAnchors + 'top: titleLabel.bottom;\n'; |
376 | 509 | } | 529 | } |
377 | 510 | } | 530 | } |
378 | 511 | 531 | ||
379 | 532 | // code for different elements | ||
380 | 512 | var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': ''); | 533 | var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': ''); |
383 | 513 | var titleCode = kTitleLabelCode.arg(titleAnchors).arg(color).arg(titleLabelVisibleExtra); | 534 | var titleCode = kTitleLabelCode.arg(titleAnchors).arg(titleColor).arg(titleLabelVisibleExtra); |
384 | 514 | var subtitleCode = ""; | 535 | var subtitleCode; |
385 | 536 | var attributesCode; | ||
386 | 537 | var emblemCode; | ||
387 | 538 | |||
388 | 539 | // code for the title container | ||
389 | 540 | var containerCode = []; | ||
390 | 541 | var containerHeight = 'titleLabel.height'; | ||
391 | 542 | containerCode.push(titleCode); | ||
392 | 515 | if (hasSubtitle) { | 543 | if (hasSubtitle) { |
394 | 516 | subtitleCode += kSubtitleLabelCode.arg(subtitleAnchors).arg(color); | 544 | subtitleCode = kSubtitleLabelCode.arg(subtitleAnchors).arg(titleColor); |
395 | 545 | containerCode.push(subtitleCode); | ||
396 | 546 | containerHeight += ' + subtitleLabel.height'; | ||
397 | 547 | } | ||
398 | 548 | if (hasEmblem) { | ||
399 | 549 | containerCode.push(kEmblemImageCode); | ||
400 | 550 | } | ||
401 | 551 | if (hasAttributes) { | ||
402 | 552 | attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(titleColor); | ||
403 | 553 | containerCode.push(kAttributesRowCode.arg(attributesAnchors).arg(titleColor)); | ||
404 | 554 | containerHeight += ' + attributesRow.height'; | ||
405 | 517 | } | 555 | } |
406 | 518 | 556 | ||
419 | 519 | if (hasMascot && (hasSubtitle || hasAttributes)) { | 557 | if (hasTitleContainer) { |
420 | 520 | // If using row + column wrap the code in the column | 558 | // use container |
421 | 521 | titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode); | 559 | titleSubtitleCode = kHeaderContainerCodeGenerator(titleContainerAnchors, containerHeight, containerCode); |
410 | 522 | if (hasSubtitle && hasAttributes) { | ||
411 | 523 | var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color); | ||
412 | 524 | titleSubtitleCode = kHeaderColumnCodeGenerator(titleCode, subtitleCode, attributesCode); | ||
413 | 525 | } else if (hasSubtitle) { | ||
414 | 526 | titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode); | ||
415 | 527 | } else if (hasAttributes) { | ||
416 | 528 | var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color); | ||
417 | 529 | titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(attributesCode); | ||
418 | 530 | } | ||
422 | 531 | } else { | 560 | } else { |
423 | 561 | // no container | ||
424 | 532 | titleSubtitleCode = titleCode; | 562 | titleSubtitleCode = titleCode; |
425 | 533 | if (hasSubtitle) { | 563 | if (hasSubtitle) { |
427 | 534 | titleSubtitleCode = titleSubtitleCode + subtitleCode; | 564 | titleSubtitleCode += subtitleCode; |
428 | 535 | } | 565 | } |
429 | 536 | if (hasAttributes) { | 566 | if (hasAttributes) { |
432 | 537 | var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color); | 567 | titleSubtitleCode += attributesCode; |
431 | 538 | titleSubtitleCode = titleSubtitleCode + attributesCode; | ||
433 | 539 | } | 568 | } |
434 | 540 | } | 569 | } |
435 | 541 | } | 570 | } |
436 | 542 | 571 | ||
437 | 543 | if (hasHeaderRow) { | 572 | if (hasHeaderRow) { |
442 | 544 | if (mascotShapeCode != "") { | 573 | var rowCode = [mascotCode, titleSubtitleCode]; |
443 | 545 | code += kHeaderRow3Code.arg(headerVerticalAnchors + headerLeftAnchor).arg(mascotShapeCode).arg(mascotCode).arg(titleSubtitleCode); | 574 | if (mascotShapeCode != '') { |
444 | 546 | } else { | 575 | rowCode.unshift(mascotShapeCode); |
441 | 547 | code += kHeaderRow2Code.arg(headerVerticalAnchors + headerLeftAnchor).arg(mascotCode).arg(titleSubtitleCode); | ||
445 | 548 | } | 576 | } |
446 | 577 | code += kHeaderRowCodeGenerator(headerVerticalAnchors + headerLeftAnchor, rowCode) | ||
447 | 549 | } else { | 578 | } else { |
448 | 550 | code += mascotShapeCode + mascotCode + titleSubtitleCode; | 579 | code += mascotShapeCode + mascotCode + titleSubtitleCode; |
449 | 551 | } | 580 | } |
450 | 552 | 581 | ||
451 | 553 | if (hasSummary) { | 582 | if (hasSummary) { |
452 | 554 | var summaryTopAnchor; | 583 | var summaryTopAnchor; |
462 | 555 | if (isHorizontal && hasArt) summaryTopAnchor = "artShapeHolder.bottom"; | 584 | if (isHorizontal && hasArt) summaryTopAnchor = 'artShapeHolder.bottom'; |
463 | 556 | else if (headerAsOverlay && hasArt) summaryTopAnchor = "artShapeHolder.bottom"; | 585 | else if (headerAsOverlay && hasArt) summaryTopAnchor = 'artShapeHolder.bottom'; |
464 | 557 | else if (hasHeaderRow) summaryTopAnchor = "row.bottom"; | 586 | else if (hasHeaderRow) summaryTopAnchor = 'row.bottom'; |
465 | 558 | else if (hasMascot) summaryTopAnchor = "mascotImage.bottom"; | 587 | else if (hasTitleContainer) summaryTopAnchor = 'headerTitleContainer.bottom'; |
466 | 559 | else if (hasAttributes) summaryTopAnchor = "attributesRow.bottom"; | 588 | else if (hasMascot) summaryTopAnchor = 'mascotImage.bottom'; |
467 | 560 | else if (hasSubtitle) summaryTopAnchor = "subtitleLabel.bottom"; | 589 | else if (hasAttributes) summaryTopAnchor = 'attributesRow.bottom'; |
468 | 561 | else if (hasTitle) summaryTopAnchor = "titleLabel.bottom"; | 590 | else if (hasSubtitle) summaryTopAnchor = 'subtitleLabel.bottom'; |
469 | 562 | else if (hasArt) summaryTopAnchor = "artShapeHolder.bottom"; | 591 | else if (hasTitle) summaryTopAnchor = 'titleLabel.bottom'; |
470 | 563 | else summaryTopAnchor = "parent.top"; | 592 | else if (hasArt) summaryTopAnchor = 'artShapeHolder.bottom'; |
471 | 593 | else summaryTopAnchor = 'parent.top'; | ||
472 | 564 | 594 | ||
474 | 565 | var color; | 595 | var summaryColor; |
475 | 566 | if (hasBackground) { | 596 | if (hasBackground) { |
477 | 567 | color = summaryColorWithBackground; | 597 | summaryColor = summaryColorWithBackground; |
478 | 568 | } else { | 598 | } else { |
480 | 569 | color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"'; | 599 | summaryColor = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"'; |
481 | 570 | } | 600 | } |
482 | 571 | 601 | ||
483 | 572 | var summaryTopMargin = (hasMascot || hasSubtitle || hasAttributes ? 'anchors.margins' : '0'); | 602 | var summaryTopMargin = (hasMascot || hasSubtitle || hasAttributes ? 'anchors.margins' : '0'); |
484 | 573 | 603 | ||
486 | 574 | code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(color); | 604 | code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(summaryColor); |
487 | 575 | } | 605 | } |
488 | 576 | 606 | ||
489 | 577 | var touchdownAnchors; | 607 | var touchdownAnchors; |
490 | @@ -584,23 +614,26 @@ | |||
491 | 584 | } | 614 | } |
492 | 585 | code += kTouchdownCode.arg(touchdownAnchors); | 615 | code += kTouchdownCode.arg(touchdownAnchors); |
493 | 586 | 616 | ||
494 | 617 | var implicitHeight = 'implicitHeight: '; | ||
495 | 587 | if (hasSummary) { | 618 | if (hasSummary) { |
497 | 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'; |
498 | 589 | } else if (hasHeaderRow) { | 620 | } else if (hasHeaderRow) { |
500 | 590 | code += 'implicitHeight: row.y + row.height + units.gu(1);\n'; | 621 | implicitHeight += 'row.y + row.height + units.gu(1);\n'; |
501 | 591 | } else if (hasMascot) { | 622 | } else if (hasMascot) { |
503 | 592 | code += 'implicitHeight: mascotImage.y + mascotImage.height;\n'; | 623 | implicitHeight += 'mascotImage.y + mascotImage.height;\n'; |
504 | 624 | } else if (hasTitleContainer) { | ||
505 | 625 | implicitHeight += 'headerTitleContainer.y + headerTitleContainer.height + units.gu(1);\n'; | ||
506 | 593 | } else if (hasAttributes) { | 626 | } else if (hasAttributes) { |
508 | 594 | code += 'implicitHeight: attributesRow.y + attributesRow.height + units.gu(1);\n'; | 627 | implicitHeight += 'attributesRow.y + attributesRow.height + units.gu(1);\n'; |
509 | 595 | } else if (hasSubtitle) { | 628 | } else if (hasSubtitle) { |
511 | 596 | code += 'implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);\n'; | 629 | implicitHeight += 'subtitleLabel.y + subtitleLabel.height + units.gu(1);\n'; |
512 | 597 | } else if (hasTitle) { | 630 | } else if (hasTitle) { |
514 | 598 | code += 'implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);\n'; | 631 | implicitHeight += 'titleLabel.y + titleLabel.height + units.gu(1);\n'; |
515 | 599 | } else if (hasArt) { | 632 | } else if (hasArt) { |
517 | 600 | code += 'implicitHeight: artShapeHolder.height;\n'; | 633 | implicitHeight += 'artShapeHolder.height;\n'; |
518 | 601 | } | 634 | } |
519 | 602 | // Close the AbstractButton | 635 | // Close the AbstractButton |
521 | 603 | code += '}\n'; | 636 | code += implicitHeight + '}\n'; |
522 | 604 | 637 | ||
523 | 605 | return code; | 638 | return code; |
524 | 606 | } | 639 | } |
525 | 607 | 640 | ||
526 | === modified file 'plugins/Dash/ScopeStyle.qml' | |||
527 | --- plugins/Dash/ScopeStyle.qml 2014-07-25 11:42:06 +0000 | |||
528 | +++ plugins/Dash/ScopeStyle.qml 2014-08-08 14:57:17 +0000 | |||
529 | @@ -49,9 +49,10 @@ | |||
530 | 49 | 49 | ||
531 | 50 | /*! \brief Luminance threshold for switching between fore and background color | 50 | /*! \brief Luminance threshold for switching between fore and background color |
532 | 51 | 51 | ||
534 | 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. |
535 | 53 | */ | 53 | */ |
537 | 54 | readonly property real threshold: background.a !== 1.0 ? foregroundLuminance : (foregroundLuminance + backgroundLuminance) / 2 | 54 | readonly property real threshold: background.a !== 1.0 ? (foregroundLuminance + d.defaultLightLuminance) / 2 |
538 | 55 | : (foregroundLuminance + backgroundLuminance) / 2 | ||
539 | 55 | 56 | ||
540 | 56 | /*! \brief The lighter of foreground and background colors | 57 | /*! \brief The lighter of foreground and background colors |
541 | 57 | 58 | ||
542 | 58 | 59 | ||
543 | === modified file 'plugins/Dash/listviewwithpageheader.cpp' | |||
544 | --- plugins/Dash/listviewwithpageheader.cpp 2014-07-25 10:47:08 +0000 | |||
545 | +++ plugins/Dash/listviewwithpageheader.cpp 2014-08-08 14:57:17 +0000 | |||
546 | @@ -330,6 +330,11 @@ | |||
547 | 330 | return m_topSectionItem ? m_topSectionItem->height() : 0; | 330 | return m_topSectionItem ? m_topSectionItem->height() : 0; |
548 | 331 | } | 331 | } |
549 | 332 | 332 | ||
550 | 333 | qreal ListViewWithPageHeader::headerItemShownHeight() const | ||
551 | 334 | { | ||
552 | 335 | return m_headerItemShownHeight; | ||
553 | 336 | } | ||
554 | 337 | |||
555 | 333 | void ListViewWithPageHeader::positionAtBeginning() | 338 | void ListViewWithPageHeader::positionAtBeginning() |
556 | 334 | { | 339 | { |
557 | 335 | if (m_delegateModel->count() <= 0) | 340 | if (m_delegateModel->count() <= 0) |
558 | @@ -396,6 +401,7 @@ | |||
559 | 396 | firstItem->setY(firstItem->y() - m_headerItemShownHeight); | 401 | firstItem->setY(firstItem->y() - m_headerItemShownHeight); |
560 | 397 | layout(); | 402 | layout(); |
561 | 398 | } | 403 | } |
562 | 404 | Q_EMIT headerItemShownHeightChanged(); | ||
563 | 399 | } | 405 | } |
564 | 400 | m_contentYAnimation->setTo(to); | 406 | m_contentYAnimation->setTo(to); |
565 | 401 | contentYAnimationType = ContentYAnimationShowHeader; | 407 | contentYAnimationType = ContentYAnimationShowHeader; |
566 | @@ -544,6 +550,7 @@ | |||
567 | 544 | m_headerItem->setY(-m_minYExtent); | 550 | m_headerItem->setY(-m_minYExtent); |
568 | 545 | } | 551 | } |
569 | 546 | } | 552 | } |
570 | 553 | Q_EMIT headerItemShownHeightChanged(); | ||
571 | 547 | } else { | 554 | } else { |
572 | 548 | // Stick the header item to the top when dragging down | 555 | // Stick the header item to the top when dragging down |
573 | 549 | m_headerItem->setY(contentY()); | 556 | m_headerItem->setY(contentY()); |
574 | @@ -822,8 +829,8 @@ | |||
575 | 822 | ListItem *nextItem = itemAtIndex(modelIndex + 1); | 829 | ListItem *nextItem = itemAtIndex(modelIndex + 1); |
576 | 823 | if (nextItem) { | 830 | if (nextItem) { |
577 | 824 | listItem->setY(nextItem->y() - listItem->height()); | 831 | listItem->setY(nextItem->y() - listItem->height()); |
580 | 825 | } else if (modelIndex == 0 && m_headerItem) { | 832 | } else if (modelIndex == 0) { |
581 | 826 | listItem->setY(m_headerItem->height()); | 833 | listItem->setY(m_headerItem ? m_headerItem->height() : 0); |
582 | 827 | } else if (!m_visibleItems.isEmpty()) { | 834 | } else if (!m_visibleItems.isEmpty()) { |
583 | 828 | lostItem = true; | 835 | lostItem = true; |
584 | 829 | } | 836 | } |
585 | @@ -1096,6 +1103,7 @@ | |||
586 | 1096 | m_headerItemShownHeight = qBound(static_cast<qreal>(0.), m_headerItemShownHeight, newHeaderHeight); | 1103 | m_headerItemShownHeight = qBound(static_cast<qreal>(0.), m_headerItemShownHeight, newHeaderHeight); |
587 | 1097 | updateClipItem(); | 1104 | updateClipItem(); |
588 | 1098 | adjustMinYExtent(); | 1105 | adjustMinYExtent(); |
589 | 1106 | Q_EMIT headerItemShownHeightChanged(); | ||
590 | 1099 | } else { | 1107 | } else { |
591 | 1100 | if (oldHeaderY + oldHeaderHeight > contentY()) { | 1108 | if (oldHeaderY + oldHeaderHeight > contentY()) { |
592 | 1101 | // If the header is shown because its position | 1109 | // If the header is shown because its position |
593 | 1102 | 1110 | ||
594 | === modified file 'plugins/Dash/listviewwithpageheader.h' | |||
595 | --- plugins/Dash/listviewwithpageheader.h 2014-06-12 14:08:54 +0000 | |||
596 | +++ plugins/Dash/listviewwithpageheader.h 2014-08-08 14:57:17 +0000 | |||
597 | @@ -53,6 +53,7 @@ | |||
598 | 53 | Q_PROPERTY(QString sectionProperty READ sectionProperty WRITE setSectionProperty NOTIFY sectionPropertyChanged) | 53 | Q_PROPERTY(QString sectionProperty READ sectionProperty WRITE setSectionProperty NOTIFY sectionPropertyChanged) |
599 | 54 | Q_PROPERTY(bool forceNoClip READ forceNoClip WRITE setForceNoClip NOTIFY forceNoClipChanged) | 54 | Q_PROPERTY(bool forceNoClip READ forceNoClip WRITE setForceNoClip NOTIFY forceNoClipChanged) |
600 | 55 | Q_PROPERTY(int stickyHeaderHeight READ stickyHeaderHeight NOTIFY stickyHeaderHeightChanged) | 55 | Q_PROPERTY(int stickyHeaderHeight READ stickyHeaderHeight NOTIFY stickyHeaderHeightChanged) |
601 | 56 | Q_PROPERTY(qreal headerItemShownHeight READ headerItemShownHeight NOTIFY headerItemShownHeightChanged) | ||
602 | 56 | 57 | ||
603 | 57 | friend class ListViewWithPageHeaderTest; | 58 | friend class ListViewWithPageHeaderTest; |
604 | 58 | friend class ListViewWithPageHeaderTestSection; | 59 | friend class ListViewWithPageHeaderTestSection; |
605 | @@ -81,6 +82,7 @@ | |||
606 | 81 | void setForceNoClip(bool noClip); | 82 | void setForceNoClip(bool noClip); |
607 | 82 | 83 | ||
608 | 83 | int stickyHeaderHeight() const; | 84 | int stickyHeaderHeight() const; |
609 | 85 | qreal headerItemShownHeight() const; | ||
610 | 84 | 86 | ||
611 | 85 | Q_INVOKABLE void positionAtBeginning(); | 87 | Q_INVOKABLE void positionAtBeginning(); |
612 | 86 | Q_INVOKABLE void showHeader(); | 88 | Q_INVOKABLE void showHeader(); |
613 | @@ -100,6 +102,7 @@ | |||
614 | 100 | void sectionPropertyChanged(); | 102 | void sectionPropertyChanged(); |
615 | 101 | void forceNoClipChanged(); | 103 | void forceNoClipChanged(); |
616 | 102 | void stickyHeaderHeightChanged(); | 104 | void stickyHeaderHeightChanged(); |
617 | 105 | void headerItemShownHeightChanged(); | ||
618 | 103 | 106 | ||
619 | 104 | protected: | 107 | protected: |
620 | 105 | void componentComplete() override; | 108 | void componentComplete() override; |
621 | 106 | 109 | ||
622 | === modified file 'po/hu.po' | |||
623 | --- po/hu.po 2014-08-08 07:07:33 +0000 | |||
624 | +++ po/hu.po 2014-08-08 14:57:17 +0000 | |||
625 | @@ -6,16 +6,17 @@ | |||
626 | 6 | msgid "" | 6 | msgid "" |
627 | 7 | msgstr "" | 7 | msgstr "" |
628 | 8 | "Project-Id-Version: unity\n" | 8 | "Project-Id-Version: unity\n" |
630 | 9 | "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" | 9 | "Report-Msgid-Bugs-To: \n" |
631 | 10 | "POT-Creation-Date: 2014-07-11 14:59+0200\n" | 10 | "POT-Creation-Date: 2014-07-11 14:59+0200\n" |
632 | 11 | "PO-Revision-Date: 2014-08-06 07:41+0000\n" | 11 | "PO-Revision-Date: 2014-08-06 07:41+0000\n" |
633 | 12 | "Last-Translator: Richard Somlói <ricsipontaz@gmail.com>\n" | 12 | "Last-Translator: Richard Somlói <ricsipontaz@gmail.com>\n" |
634 | 13 | "Language-Team: Hungarian <hu@li.org>\n" | 13 | "Language-Team: Hungarian <hu@li.org>\n" |
635 | 14 | "Language: hu\n" | ||
636 | 14 | "MIME-Version: 1.0\n" | 15 | "MIME-Version: 1.0\n" |
637 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 16 | "Content-Type: text/plain; charset=UTF-8\n" |
638 | 16 | "Content-Transfer-Encoding: 8bit\n" | 17 | "Content-Transfer-Encoding: 8bit\n" |
641 | 17 | "X-Launchpad-Export-Date: 2014-08-08 07:07+0000\n" | 18 | "X-Launchpad-Export-Date: 2014-08-07 06:27+0000\n" |
642 | 18 | "X-Generator: Launchpad (build 17156)\n" | 19 | "X-Generator: Launchpad (build 17147)\n" |
643 | 19 | 20 | ||
644 | 20 | #: plugins/Unity/Launcher/launcheritem.cpp:43 | 21 | #: plugins/Unity/Launcher/launcheritem.cpp:43 |
645 | 21 | #: plugins/Unity/Launcher/launcheritem.cpp:73 | 22 | #: plugins/Unity/Launcher/launcheritem.cpp:73 |
646 | @@ -73,8 +74,8 @@ | |||
647 | 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 " |
648 | 74 | "phone<br><br>Tap on the screen to start" | 75 | "phone<br><br>Tap on the screen to start" |
649 | 75 | msgstr "" | 76 | msgstr "" |
652 | 76 | "Elsajátította a gesztusokat, és megkezdheti a telefon " | 77 | "Elsajátította a gesztusokat, és megkezdheti a telefon használatát." |
653 | 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." |
654 | 78 | 79 | ||
655 | 79 | #: qml/Components/Lockscreen.qml:214 | 80 | #: qml/Components/Lockscreen.qml:214 |
656 | 80 | msgid "Emergency Call" | 81 | msgid "Emergency Call" |
657 | 81 | 82 | ||
658 | === modified file 'po/sl.po' | |||
659 | --- po/sl.po 2014-08-08 07:07:33 +0000 | |||
660 | +++ po/sl.po 2014-08-08 14:57:17 +0000 | |||
661 | @@ -6,16 +6,17 @@ | |||
662 | 6 | msgid "" | 6 | msgid "" |
663 | 7 | msgstr "" | 7 | msgstr "" |
664 | 8 | "Project-Id-Version: unity\n" | 8 | "Project-Id-Version: unity\n" |
666 | 9 | "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" | 9 | "Report-Msgid-Bugs-To: \n" |
667 | 10 | "POT-Creation-Date: 2014-07-11 14:59+0200\n" | 10 | "POT-Creation-Date: 2014-07-11 14:59+0200\n" |
668 | 11 | "PO-Revision-Date: 2014-08-06 06:11+0000\n" | 11 | "PO-Revision-Date: 2014-08-06 06:11+0000\n" |
669 | 12 | "Last-Translator: Damir Jerovšek <Unknown>\n" | 12 | "Last-Translator: Damir Jerovšek <Unknown>\n" |
670 | 13 | "Language-Team: Slovenian <sl@li.org>\n" | 13 | "Language-Team: Slovenian <sl@li.org>\n" |
671 | 14 | "Language: sl\n" | ||
672 | 14 | "MIME-Version: 1.0\n" | 15 | "MIME-Version: 1.0\n" |
673 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 16 | "Content-Type: text/plain; charset=UTF-8\n" |
674 | 16 | "Content-Transfer-Encoding: 8bit\n" | 17 | "Content-Transfer-Encoding: 8bit\n" |
677 | 17 | "X-Launchpad-Export-Date: 2014-08-08 07:07+0000\n" | 18 | "X-Launchpad-Export-Date: 2014-08-07 06:27+0000\n" |
678 | 18 | "X-Generator: Launchpad (build 17156)\n" | 19 | "X-Generator: Launchpad (build 17147)\n" |
679 | 19 | 20 | ||
680 | 20 | #: plugins/Unity/Launcher/launcheritem.cpp:43 | 21 | #: plugins/Unity/Launcher/launcheritem.cpp:43 |
681 | 21 | #: plugins/Unity/Launcher/launcheritem.cpp:73 | 22 | #: plugins/Unity/Launcher/launcheritem.cpp:73 |
682 | 22 | 23 | ||
683 | === modified file 'po/unity8.pot' | |||
684 | --- po/unity8.pot 2014-07-11 14:20:12 +0000 | |||
685 | +++ po/unity8.pot 2014-08-08 14:57:17 +0000 | |||
686 | @@ -8,7 +8,7 @@ | |||
687 | 8 | msgstr "" | 8 | msgstr "" |
688 | 9 | "Project-Id-Version: unity8\n" | 9 | "Project-Id-Version: unity8\n" |
689 | 10 | "Report-Msgid-Bugs-To: \n" | 10 | "Report-Msgid-Bugs-To: \n" |
691 | 11 | "POT-Creation-Date: 2014-07-11 14:59+0200\n" | 11 | "POT-Creation-Date: 2014-08-08 11:17+0200\n" |
692 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
693 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
694 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
695 | @@ -26,66 +26,82 @@ | |||
696 | 26 | msgid "Unpin shortcut" | 26 | msgid "Unpin shortcut" |
697 | 27 | msgstr "" | 27 | msgstr "" |
698 | 28 | 28 | ||
699 | 29 | #: qml/Components/Dialogs.qml:142 | ||
700 | 30 | msgid "Are you sure you would like to turn power off?" | ||
701 | 31 | msgstr "" | ||
702 | 32 | |||
703 | 33 | #: qml/Components/Dialogs.qml:144 | ||
704 | 34 | msgid "Power off" | ||
705 | 35 | msgstr "" | ||
706 | 36 | |||
707 | 37 | #: qml/Components/Dialogs.qml:153 | ||
708 | 38 | msgid "Restart" | ||
709 | 39 | msgstr "" | ||
710 | 40 | |||
711 | 41 | #: qml/Components/Dialogs.qml:162 | ||
712 | 42 | msgid "Cancel" | ||
713 | 43 | msgstr "" | ||
714 | 44 | |||
715 | 29 | #: qml/Components/EdgeDemoOverlay.qml:151 | 45 | #: qml/Components/EdgeDemoOverlay.qml:151 |
716 | 30 | msgid "Skip intro" | 46 | msgid "Skip intro" |
717 | 31 | msgstr "" | 47 | msgstr "" |
718 | 32 | 48 | ||
719 | 49 | #: qml/Components/EdgeDemo.qml:112 | ||
720 | 50 | msgid "Right edge" | ||
721 | 51 | msgstr "" | ||
722 | 52 | |||
723 | 33 | #: qml/Components/EdgeDemo.qml:113 | 53 | #: qml/Components/EdgeDemo.qml:113 |
724 | 34 | msgid "Right edge" | ||
725 | 35 | msgstr "" | ||
726 | 36 | |||
727 | 37 | #: qml/Components/EdgeDemo.qml:114 | ||
728 | 38 | msgid "Try swiping from the right edge to unlock the phone" | 54 | msgid "Try swiping from the right edge to unlock the phone" |
729 | 39 | msgstr "" | 55 | msgstr "" |
730 | 40 | 56 | ||
731 | 57 | #: qml/Components/EdgeDemo.qml:144 | ||
732 | 58 | msgid "Top edge" | ||
733 | 59 | msgstr "" | ||
734 | 60 | |||
735 | 41 | #: qml/Components/EdgeDemo.qml:145 | 61 | #: qml/Components/EdgeDemo.qml:145 |
736 | 42 | msgid "Top edge" | ||
737 | 43 | msgstr "" | ||
738 | 44 | |||
739 | 45 | #: qml/Components/EdgeDemo.qml:146 | ||
740 | 46 | msgid "Try swiping from the top edge to access the indicators" | 62 | msgid "Try swiping from the top edge to access the indicators" |
741 | 47 | msgstr "" | 63 | msgstr "" |
742 | 48 | 64 | ||
743 | 65 | #: qml/Components/EdgeDemo.qml:170 | ||
744 | 66 | msgid "Close" | ||
745 | 67 | msgstr "" | ||
746 | 68 | |||
747 | 49 | #: qml/Components/EdgeDemo.qml:171 | 69 | #: qml/Components/EdgeDemo.qml:171 |
748 | 50 | msgid "Close" | ||
749 | 51 | msgstr "" | ||
750 | 52 | |||
751 | 53 | #: qml/Components/EdgeDemo.qml:172 | ||
752 | 54 | msgid "Swipe up again to close the settings screen" | 70 | msgid "Swipe up again to close the settings screen" |
753 | 55 | msgstr "" | 71 | msgstr "" |
754 | 56 | 72 | ||
755 | 73 | #: qml/Components/EdgeDemo.qml:198 | ||
756 | 74 | msgid "Left edge" | ||
757 | 75 | msgstr "" | ||
758 | 76 | |||
759 | 57 | #: qml/Components/EdgeDemo.qml:199 | 77 | #: qml/Components/EdgeDemo.qml:199 |
760 | 58 | msgid "Left edge" | ||
761 | 59 | msgstr "" | ||
762 | 60 | |||
763 | 61 | #: qml/Components/EdgeDemo.qml:200 | ||
764 | 62 | msgid "Swipe from the left to reveal the launcher for quick access to apps" | 78 | msgid "Swipe from the left to reveal the launcher for quick access to apps" |
765 | 63 | msgstr "" | 79 | msgstr "" |
766 | 64 | 80 | ||
767 | 81 | #: qml/Components/EdgeDemo.qml:226 | ||
768 | 82 | msgid "Well done" | ||
769 | 83 | msgstr "" | ||
770 | 84 | |||
771 | 65 | #: qml/Components/EdgeDemo.qml:227 | 85 | #: qml/Components/EdgeDemo.qml:227 |
772 | 66 | msgid "Well done" | ||
773 | 67 | msgstr "" | ||
774 | 68 | |||
775 | 69 | #: qml/Components/EdgeDemo.qml:228 | ||
776 | 70 | msgid "" | 86 | msgid "" |
777 | 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 " |
778 | 72 | "phone<br><br>Tap on the screen to start" | 88 | "phone<br><br>Tap on the screen to start" |
779 | 73 | msgstr "" | 89 | msgstr "" |
780 | 74 | 90 | ||
782 | 75 | #: qml/Components/Lockscreen.qml:214 | 91 | #: qml/Components/Lockscreen.qml:220 |
783 | 76 | msgid "Emergency Call" | 92 | msgid "Emergency Call" |
784 | 77 | msgstr "" | 93 | msgstr "" |
785 | 78 | 94 | ||
787 | 79 | #: qml/Components/Lockscreen.qml:231 | 95 | #: qml/Components/Lockscreen.qml:243 |
788 | 80 | msgid "OK" | 96 | msgid "OK" |
789 | 81 | msgstr "" | 97 | msgstr "" |
790 | 82 | 98 | ||
792 | 83 | #: qml/Components/PassphraseLockscreen.qml:60 | 99 | #: qml/Components/PassphraseLockscreen.qml:62 |
793 | 84 | #, qt-format | 100 | #, qt-format |
794 | 85 | msgid "Hello %1" | 101 | msgid "Hello %1" |
795 | 86 | msgstr "" | 102 | msgstr "" |
796 | 87 | 103 | ||
798 | 88 | #: qml/Components/PassphraseLockscreen.qml:60 | 104 | #: qml/Components/PassphraseLockscreen.qml:62 |
799 | 89 | msgid "Hello" | 105 | msgid "Hello" |
800 | 90 | msgstr "" | 106 | msgstr "" |
801 | 91 | 107 | ||
802 | @@ -97,19 +113,11 @@ | |||
803 | 97 | msgid "DONE" | 113 | msgid "DONE" |
804 | 98 | msgstr "" | 114 | msgstr "" |
805 | 99 | 115 | ||
811 | 100 | #: qml/Components/SeeMore.qml:35 | 116 | #: qml/Dash/GenericScopeView.qml:358 |
807 | 101 | msgid "See more" | ||
808 | 102 | msgstr "" | ||
809 | 103 | |||
810 | 104 | #: qml/Components/SeeMore.qml:58 qml/Dash/GenericScopeView.qml:330 | ||
812 | 105 | msgid "See less" | 117 | msgid "See less" |
813 | 106 | msgstr "" | 118 | msgstr "" |
814 | 107 | 119 | ||
820 | 108 | #: qml/Dash/DashApps.qml:37 | 120 | #: qml/Dash/GenericScopeView.qml:358 |
816 | 109 | msgid "Recent" | ||
817 | 110 | msgstr "" | ||
818 | 111 | |||
819 | 112 | #: qml/Dash/GenericScopeView.qml:330 | ||
821 | 113 | msgid "See all" | 121 | msgid "See all" |
822 | 114 | msgstr "" | 122 | msgstr "" |
823 | 115 | 123 | ||
824 | @@ -133,6 +141,26 @@ | |||
825 | 133 | msgid "Send" | 141 | msgid "Send" |
826 | 134 | msgstr "" | 142 | msgstr "" |
827 | 135 | 143 | ||
828 | 144 | #: qml/Dash/ScopesOverview.qml:200 | ||
829 | 145 | msgid "Manage Dash" | ||
830 | 146 | msgstr "" | ||
831 | 147 | |||
832 | 148 | #: qml/Dash/ScopesOverview.qml:405 | ||
833 | 149 | msgid "Done" | ||
834 | 150 | msgstr "" | ||
835 | 151 | |||
836 | 152 | #: qml/Dash/ScopesOverview.qml:431 | ||
837 | 153 | msgid "Store" | ||
838 | 154 | msgstr "" | ||
839 | 155 | |||
840 | 156 | #: qml/Dash/ScopesOverviewTab.qml:36 | ||
841 | 157 | msgid "Favorites" | ||
842 | 158 | msgstr "" | ||
843 | 159 | |||
844 | 160 | #: qml/Dash/ScopesOverviewTab.qml:54 | ||
845 | 161 | msgid "All" | ||
846 | 162 | msgstr "" | ||
847 | 163 | |||
848 | 136 | #: qml/Greeter/Greeter.qml:157 | 164 | #: qml/Greeter/Greeter.qml:157 |
849 | 137 | msgid "Swipe to unlock" | 165 | msgid "Swipe to unlock" |
850 | 138 | msgstr "" | 166 | msgstr "" |
851 | @@ -157,11 +185,11 @@ | |||
852 | 157 | msgid "Speaking..." | 185 | msgid "Speaking..." |
853 | 158 | msgstr "" | 186 | msgstr "" |
854 | 159 | 187 | ||
856 | 160 | #: qml/Notifications/NotificationMenuItemFactory.qml:91 | 188 | #: qml/Notifications/NotificationMenuItemFactory.qml:100 |
857 | 161 | msgid "Show password" | 189 | msgid "Show password" |
858 | 162 | msgstr "" | 190 | msgstr "" |
859 | 163 | 191 | ||
861 | 164 | #: qml/Notifications/NotificationMenuItemFactory.qml:103 | 192 | #: qml/Notifications/NotificationMenuItemFactory.qml:115 |
862 | 165 | msgid "Please enter SIM PIN" | 193 | msgid "Please enter SIM PIN" |
863 | 166 | msgstr "" | 194 | msgstr "" |
864 | 167 | 195 | ||
865 | @@ -173,35 +201,43 @@ | |||
866 | 173 | msgid "Conference" | 201 | msgid "Conference" |
867 | 174 | msgstr "" | 202 | msgstr "" |
868 | 175 | 203 | ||
870 | 176 | #: qml/Panel/Indicators/MenuItemFactory.qml:583 | 204 | #: qml/Panel/Indicators/MenuItemFactory.qml:651 |
871 | 177 | msgid "In queue…" | 205 | msgid "In queue…" |
872 | 178 | msgstr "" | 206 | msgstr "" |
873 | 179 | 207 | ||
875 | 180 | #: qml/Panel/Indicators/MenuItemFactory.qml:587 | 208 | #: qml/Panel/Indicators/MenuItemFactory.qml:655 |
876 | 181 | msgid "Downloading" | 209 | msgid "Downloading" |
877 | 182 | msgstr "" | 210 | msgstr "" |
878 | 183 | 211 | ||
880 | 184 | #: qml/Panel/Indicators/MenuItemFactory.qml:589 | 212 | #: qml/Panel/Indicators/MenuItemFactory.qml:657 |
881 | 185 | msgid "Paused, tap to resume" | 213 | msgid "Paused, tap to resume" |
882 | 186 | msgstr "" | 214 | msgstr "" |
883 | 187 | 215 | ||
885 | 188 | #: qml/Panel/Indicators/MenuItemFactory.qml:591 | 216 | #: qml/Panel/Indicators/MenuItemFactory.qml:659 |
886 | 189 | msgid "Canceled" | 217 | msgid "Canceled" |
887 | 190 | msgstr "" | 218 | msgstr "" |
888 | 191 | 219 | ||
890 | 192 | #: qml/Panel/Indicators/MenuItemFactory.qml:593 | 220 | #: qml/Panel/Indicators/MenuItemFactory.qml:661 |
891 | 193 | msgid "Finished" | 221 | msgid "Finished" |
892 | 194 | msgstr "" | 222 | msgstr "" |
893 | 195 | 223 | ||
895 | 196 | #: qml/Panel/Indicators/MenuItemFactory.qml:595 | 224 | #: qml/Panel/Indicators/MenuItemFactory.qml:663 |
896 | 197 | msgid "Failed, tap to retry" | 225 | msgid "Failed, tap to retry" |
897 | 198 | msgstr "" | 226 | msgstr "" |
898 | 199 | 227 | ||
899 | 228 | #: qml/Panel/Indicators/ModemInfoItem.qml:105 | ||
900 | 229 | msgid "Unlock SIM" | ||
901 | 230 | msgstr "" | ||
902 | 231 | |||
903 | 232 | #: qml/Panel/Indicators/RoamingIndication.qml:27 | ||
904 | 233 | msgid "Roaming" | ||
905 | 234 | msgstr "" | ||
906 | 235 | |||
907 | 200 | #: qml/Panel/SearchIndicator.qml:27 | 236 | #: qml/Panel/SearchIndicator.qml:27 |
908 | 201 | msgid "Search" | 237 | msgid "Search" |
909 | 202 | msgstr "" | 238 | msgstr "" |
910 | 203 | 239 | ||
912 | 204 | #: qml/Shell.qml:359 | 240 | #: qml/Shell.qml:256 |
913 | 205 | #, qt-format | 241 | #, qt-format |
914 | 206 | msgid "Please enter %1" | 242 | msgid "Please enter %1" |
915 | 207 | msgstr "" | 243 | msgstr "" |
916 | 208 | 244 | ||
917 | === modified file 'qml/Components/PageHeader.qml' | |||
918 | --- qml/Components/PageHeader.qml 2014-08-06 19:39:30 +0000 | |||
919 | +++ qml/Components/PageHeader.qml 2014-08-08 14:57:17 +0000 | |||
920 | @@ -24,7 +24,7 @@ | |||
921 | 24 | Item { | 24 | Item { |
922 | 25 | id: root | 25 | id: root |
923 | 26 | objectName: "pageHeader" | 26 | objectName: "pageHeader" |
925 | 27 | implicitHeight: headerContainer.height + units.gu(2) + bottomContainer.height | 27 | implicitHeight: headerContainer.height + bottomContainer.height + (showSignatureLine ? units.gu(2) : 0) |
926 | 28 | 28 | ||
927 | 29 | property bool showBackButton: false | 29 | property bool showBackButton: false |
928 | 30 | property string title | 30 | property string title |
929 | @@ -32,6 +32,7 @@ | |||
930 | 32 | property bool searchEntryEnabled: false | 32 | property bool searchEntryEnabled: false |
931 | 33 | property ListModel searchHistory: SearchHistoryModel | 33 | property ListModel searchHistory: SearchHistoryModel |
932 | 34 | property alias searchQuery: searchTextField.text | 34 | property alias searchQuery: searchTextField.text |
933 | 35 | property alias showSignatureLine: bottomBorder.visible | ||
934 | 35 | 36 | ||
935 | 36 | property alias bottomItem: bottomContainer.children | 37 | property alias bottomItem: bottomContainer.children |
936 | 37 | property int paginationCount: 0 | 38 | property int paginationCount: 0 |
937 | @@ -251,6 +252,7 @@ | |||
938 | 251 | 252 | ||
939 | 252 | actions: [ | 253 | actions: [ |
940 | 253 | Action { | 254 | Action { |
941 | 255 | objectName: "search" | ||
942 | 254 | iconName: "search" | 256 | iconName: "search" |
943 | 255 | visible: root.searchEntryEnabled | 257 | visible: root.searchEntryEnabled |
944 | 256 | onTriggered: { | 258 | onTriggered: { |
945 | 257 | 259 | ||
946 | === modified file 'qml/Components/ResponsiveGridView.qml' | |||
947 | --- qml/Components/ResponsiveGridView.qml 2014-07-11 12:12:50 +0000 | |||
948 | +++ qml/Components/ResponsiveGridView.qml 2014-08-08 14:57:17 +0000 | |||
949 | @@ -34,7 +34,7 @@ | |||
950 | 34 | readonly property int cellWidth: gridView.cellWidth | 34 | readonly property int cellWidth: gridView.cellWidth |
951 | 35 | readonly property int cellHeight: gridView.cellHeight | 35 | readonly property int cellHeight: gridView.cellHeight |
952 | 36 | readonly property int totalContentHeight: { | 36 | readonly property int totalContentHeight: { |
954 | 37 | return contentHeightForRows(Math.ceil(gridView.model.count / columns)) | 37 | return contentHeightForRows(Math.ceil(gridView.model.count / columns), cellHeight) |
955 | 38 | } | 38 | } |
956 | 39 | property alias interactive: gridView.interactive | 39 | property alias interactive: gridView.interactive |
957 | 40 | readonly property alias flicking: gridView.flicking | 40 | readonly property alias flicking: gridView.flicking |
958 | @@ -47,8 +47,8 @@ | |||
959 | 47 | property alias cacheBuffer: gridView.cacheBuffer | 47 | property alias cacheBuffer: gridView.cacheBuffer |
960 | 48 | readonly property alias currentItem: gridView.currentItem | 48 | readonly property alias currentItem: gridView.currentItem |
961 | 49 | 49 | ||
964 | 50 | function contentHeightForRows(rows) { | 50 | function contentHeightForRows(rows, height) { |
965 | 51 | return rows * cellHeight; | 51 | return rows * height |
966 | 52 | } | 52 | } |
967 | 53 | 53 | ||
968 | 54 | GridView { | 54 | GridView { |
969 | 55 | 55 | ||
970 | === removed directory 'qml/Dash/Apps' | |||
971 | === modified file 'qml/Dash/CardCarousel.qml' | |||
972 | --- qml/Dash/CardCarousel.qml 2014-07-11 12:13:08 +0000 | |||
973 | +++ qml/Dash/CardCarousel.qml 2014-08-08 14:57:17 +0000 | |||
974 | @@ -48,8 +48,8 @@ | |||
975 | 48 | 48 | ||
976 | 49 | objectName: "carouselDelegate" + index | 49 | objectName: "carouselDelegate" + index |
977 | 50 | 50 | ||
980 | 51 | function clicked() { cardCarousel.clicked(index, model.result) } | 51 | function clicked() { cardCarousel.clicked(index, model.result, loader.item, model) } |
981 | 52 | function pressAndHold() { cardCarousel.pressAndHold(index, model.result) } | 52 | function pressAndHold() { cardCarousel.pressAndHold(index) } |
982 | 53 | 53 | ||
983 | 54 | sourceComponent: cardTool.cardComponent | 54 | sourceComponent: cardTool.cardComponent |
984 | 55 | onLoaded: { | 55 | onLoaded: { |
985 | 56 | 56 | ||
986 | === modified file 'qml/Dash/CardGrid.qml' | |||
987 | --- qml/Dash/CardGrid.qml 2014-07-18 11:35:47 +0000 | |||
988 | +++ qml/Dash/CardGrid.qml 2014-08-08 14:57:17 +0000 | |||
989 | @@ -26,10 +26,20 @@ | |||
990 | 26 | } | 26 | } |
991 | 27 | 27 | ||
992 | 28 | expandedHeight: grid.totalContentHeight | 28 | expandedHeight: grid.totalContentHeight |
994 | 29 | collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows), expandedHeight) | 29 | collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows, grid.cellHeight), expandedHeight) |
995 | 30 | collapsedItemCount: collapsedRows * grid.columns | 30 | collapsedItemCount: collapsedRows * grid.columns |
996 | 31 | originY: grid.originY | 31 | originY: grid.originY |
997 | 32 | 32 | ||
998 | 33 | function cardPosition(index) { | ||
999 | 34 | var pos = {}; | ||
1000 | 35 | var row = Math.floor(index / grid.columns); | ||
1001 | 36 | var column = index % grid.columns; | ||
1002 | 37 | // Bit sad this is not symmetrical | ||
1003 | 38 | pos.x = column * grid.cellWidth + grid.margins; | ||
1004 | 39 | pos.y = row * grid.cellHeight; | ||
1005 | 40 | return pos; | ||
1006 | 41 | } | ||
1007 | 42 | |||
1008 | 33 | ResponsiveGridView { | 43 | ResponsiveGridView { |
1009 | 34 | id: grid | 44 | id: grid |
1010 | 35 | anchors.fill: parent | 45 | anchors.fill: parent |
1011 | @@ -53,6 +63,7 @@ | |||
1012 | 53 | item.objectName = "delegate" + index; | 63 | item.objectName = "delegate" + index; |
1013 | 54 | item.width = Qt.binding(function() { return cardTool.cardWidth; }); | 64 | item.width = Qt.binding(function() { return cardTool.cardWidth; }); |
1014 | 55 | item.height = Qt.binding(function() { return cardTool.cardHeight; }); | 65 | item.height = Qt.binding(function() { return cardTool.cardHeight; }); |
1015 | 66 | item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; }); | ||
1016 | 56 | item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; }); | 67 | item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; }); |
1017 | 57 | item.cardData = Qt.binding(function() { return model; }); | 68 | item.cardData = Qt.binding(function() { return model; }); |
1018 | 58 | item.template = Qt.binding(function() { return cardTool.template; }); | 69 | item.template = Qt.binding(function() { return cardTool.template; }); |
1019 | @@ -62,7 +73,7 @@ | |||
1020 | 62 | } | 73 | } |
1021 | 63 | Connections { | 74 | Connections { |
1022 | 64 | target: loader.item | 75 | target: loader.item |
1024 | 65 | onClicked: root.clicked(index, result) | 76 | onClicked: root.clicked(index, result, loader.item, model) |
1025 | 66 | onPressAndHold: root.pressAndHold(index) | 77 | onPressAndHold: root.pressAndHold(index) |
1026 | 67 | } | 78 | } |
1027 | 68 | } | 79 | } |
1028 | 69 | 80 | ||
1029 | === modified file 'qml/Dash/CardVerticalJournal.qml' | |||
1030 | --- qml/Dash/CardVerticalJournal.qml 2014-07-22 12:17:34 +0000 | |||
1031 | +++ qml/Dash/CardVerticalJournal.qml 2014-08-08 14:57:17 +0000 | |||
1032 | @@ -61,7 +61,7 @@ | |||
1033 | 61 | } | 61 | } |
1034 | 62 | Connections { | 62 | Connections { |
1035 | 63 | target: loader.item | 63 | target: loader.item |
1037 | 64 | onClicked: root.clicked(index, result) | 64 | onClicked: root.clicked(index, result, loader.item, model) |
1038 | 65 | onPressAndHold: root.pressAndHold(index) | 65 | onPressAndHold: root.pressAndHold(index) |
1039 | 66 | } | 66 | } |
1040 | 67 | } | 67 | } |
1041 | 68 | 68 | ||
1042 | === modified file 'qml/Dash/Dash.qml' | |||
1043 | --- qml/Dash/Dash.qml 2014-08-06 19:39:30 +0000 | |||
1044 | +++ qml/Dash/Dash.qml 2014-08-08 14:57:17 +0000 | |||
1045 | @@ -16,6 +16,7 @@ | |||
1046 | 16 | 16 | ||
1047 | 17 | import QtQuick 2.2 | 17 | import QtQuick 2.2 |
1048 | 18 | import Ubuntu.Components 0.1 | 18 | import Ubuntu.Components 0.1 |
1049 | 19 | import Ubuntu.Gestures 0.1 | ||
1050 | 19 | import Unity 0.2 | 20 | import Unity 0.2 |
1051 | 20 | import Utils 0.1 | 21 | import Utils 0.1 |
1052 | 21 | import Unity.DashCommunicator 0.1 | 22 | import Unity.DashCommunicator 0.1 |
1053 | @@ -73,26 +74,104 @@ | |||
1054 | 73 | id: scopes | 74 | id: scopes |
1055 | 74 | } | 75 | } |
1056 | 75 | 76 | ||
1058 | 76 | Image { | 77 | QtObject { |
1059 | 78 | id: overviewController | ||
1060 | 79 | objectName: "overviewController" | ||
1061 | 80 | |||
1062 | 81 | property alias enableAnimation: progressAnimation.enabled | ||
1063 | 82 | property real progress: 0 | ||
1064 | 83 | Behavior on progress { | ||
1065 | 84 | id: progressAnimation | ||
1066 | 85 | UbuntuNumberAnimation { } | ||
1067 | 86 | } | ||
1068 | 87 | } | ||
1069 | 88 | |||
1070 | 89 | ScopesOverview { | ||
1071 | 90 | id: scopesOverview | ||
1072 | 91 | objectName: "scopesOverview" | ||
1073 | 77 | anchors.fill: parent | 92 | anchors.fill: parent |
1078 | 78 | source: parent.width > parent.height ? "graphics/paper_landscape.png" : "graphics/paper_portrait.png" | 93 | scope: scopes.overviewScope |
1079 | 79 | fillMode: Image.PreserveAspectCrop | 94 | progress: overviewController.progress |
1080 | 80 | horizontalAlignment: Image.AlignRight | 95 | scopeScale: scopeItem.scope ? 0.4 : (1 - overviewController.progress * 0.6) |
1081 | 81 | verticalAlignment: Image.AlignTop | 96 | visible: scopeScale != 1 |
1082 | 97 | currentIndex: dashContent.currentIndex | ||
1083 | 98 | onDone: { | ||
1084 | 99 | if (currentTab == 1) { | ||
1085 | 100 | animateDashFromAll(dashContent.currentScopeId); | ||
1086 | 101 | } | ||
1087 | 102 | hide(); | ||
1088 | 103 | } | ||
1089 | 104 | onFavoriteSelected: { | ||
1090 | 105 | setCurrentScope(scopeId, false, false); | ||
1091 | 106 | dashContentCache.scheduleUpdate(); | ||
1092 | 107 | hide(); | ||
1093 | 108 | } | ||
1094 | 109 | onAllFavoriteSelected: { | ||
1095 | 110 | setCurrentScope(scopeId, false, false); | ||
1096 | 111 | dashContentCache.scheduleUpdate(); | ||
1097 | 112 | animateDashFromAll(dashContent.currentScopeId); | ||
1098 | 113 | hide(); | ||
1099 | 114 | } | ||
1100 | 115 | onSearchSelected: { | ||
1101 | 116 | var scopeIndex = -1; | ||
1102 | 117 | for (var i = 0; i < scopes.count; ++i) { | ||
1103 | 118 | if (scopes.getScope(i).id == scopeId) { | ||
1104 | 119 | scopeIndex = i; | ||
1105 | 120 | break; | ||
1106 | 121 | } | ||
1107 | 122 | } | ||
1108 | 123 | if (scopeIndex >= 0) { | ||
1109 | 124 | // Is a favorite one | ||
1110 | 125 | setCurrentScope(scopeId, false, false); | ||
1111 | 126 | dashContentCache.scheduleUpdate(); | ||
1112 | 127 | showDashFromPos(pos, size); | ||
1113 | 128 | hide(); | ||
1114 | 129 | } else { | ||
1115 | 130 | // Is not a favorite one, activate and get openScope | ||
1116 | 131 | scope.activate(result); | ||
1117 | 132 | } | ||
1118 | 133 | } | ||
1119 | 134 | function hide() { | ||
1120 | 135 | overviewController.enableAnimation = true; | ||
1121 | 136 | overviewController.progress = 0; | ||
1122 | 137 | } | ||
1123 | 138 | onProgressChanged: { | ||
1124 | 139 | if (progress == 0) { | ||
1125 | 140 | currentTab = scopeItem.scope ? 1 : 0; | ||
1126 | 141 | } | ||
1127 | 142 | } | ||
1128 | 143 | } | ||
1129 | 144 | |||
1130 | 145 | ShaderEffectSource { | ||
1131 | 146 | id: dashContentCache | ||
1132 | 147 | parent: scopesOverview.dashItemEater | ||
1133 | 148 | z: 1 | ||
1134 | 149 | sourceItem: dashContent | ||
1135 | 150 | height: sourceItem.height | ||
1136 | 151 | width: sourceItem.width | ||
1137 | 152 | opacity: 1 - overviewController.progress | ||
1138 | 153 | visible: overviewController.progress != 0 && scopeItem.scope === null | ||
1139 | 154 | live: false | ||
1140 | 82 | } | 155 | } |
1141 | 83 | 156 | ||
1142 | 84 | DashContent { | 157 | DashContent { |
1143 | 85 | id: dashContent | 158 | id: dashContent |
1144 | 159 | |||
1145 | 160 | property var scopeThatOpenedScope: null | ||
1146 | 161 | |||
1147 | 86 | objectName: "dashContent" | 162 | objectName: "dashContent" |
1150 | 87 | width: parent.width | 163 | width: dash.width |
1151 | 88 | height: parent.height | 164 | height: dash.height |
1152 | 89 | scopes: scopes | 165 | scopes: scopes |
1154 | 90 | visible: x != -width | 166 | visible: !scopesOverview.showingNonFavoriteScope && x != -width |
1155 | 91 | onGotoScope: { | 167 | onGotoScope: { |
1156 | 92 | dash.setCurrentScope(scopeId, true, false); | 168 | dash.setCurrentScope(scopeId, true, false); |
1157 | 93 | } | 169 | } |
1158 | 94 | onOpenScope: { | 170 | onOpenScope: { |
1159 | 171 | scopeThatOpenedScope = currentScope; | ||
1160 | 95 | scopeItem.scope = scope; | 172 | scopeItem.scope = scope; |
1161 | 173 | scopesOverview.currentTab = 1; | ||
1162 | 174 | scopesOverview.ensureAllScopeVisible(scope.id); | ||
1163 | 96 | x = -width; | 175 | x = -width; |
1164 | 97 | } | 176 | } |
1165 | 98 | onScopeLoaded: { | 177 | onScopeLoaded: { |
1166 | @@ -102,25 +181,63 @@ | |||
1167 | 102 | } | 181 | } |
1168 | 103 | } | 182 | } |
1169 | 104 | scale: dash.contentScale | 183 | scale: dash.contentScale |
1171 | 105 | clip: scale != 1.0 || scopeItem.visible | 184 | clip: scale != 1.0 || scopeItem.visible || overviewController.progress != 0 |
1172 | 106 | Behavior on x { | 185 | Behavior on x { |
1173 | 107 | UbuntuNumberAnimation { | 186 | UbuntuNumberAnimation { |
1174 | 187 | duration: overviewController.progress != 0 ? 0 : UbuntuAnimation.FastDuration | ||
1175 | 108 | onRunningChanged: { | 188 | onRunningChanged: { |
1176 | 109 | if (!running && dashContent.x == 0) { | 189 | if (!running && dashContent.x == 0) { |
1178 | 110 | dashContent.closeScope(scopeItem.scope); | 190 | dashContent.scopeThatOpenedScope.closeScope(scopeItem.scope); |
1179 | 111 | scopeItem.scope = null; | 191 | scopeItem.scope = null; |
1180 | 192 | if (overviewController.progress == 0) { | ||
1181 | 193 | // Set tab to Favorites only if we are not showing the overview | ||
1182 | 194 | scopesOverview.currentTab = 0; | ||
1183 | 195 | } | ||
1184 | 112 | } | 196 | } |
1185 | 113 | } | 197 | } |
1186 | 114 | } | 198 | } |
1187 | 115 | } | 199 | } |
1188 | 200 | |||
1189 | 201 | enabled: overviewController.progress == 0 | ||
1190 | 202 | opacity: enabled ? 1 : 0 | ||
1191 | 203 | } | ||
1192 | 204 | |||
1193 | 205 | DashBackground | ||
1194 | 206 | { | ||
1195 | 207 | anchors.fill: scopeItem | ||
1196 | 208 | visible: scopeItem.visible | ||
1197 | 209 | parent: scopeItem.parent | ||
1198 | 210 | scale: scopeItem.scale | ||
1199 | 211 | opacity: scopeItem.opacity | ||
1200 | 116 | } | 212 | } |
1201 | 117 | 213 | ||
1202 | 118 | GenericScopeView { | 214 | GenericScopeView { |
1203 | 119 | id: scopeItem | 215 | id: scopeItem |
1205 | 120 | anchors.left: dashContent.right | 216 | objectName: "dashTempScopeItem" |
1206 | 217 | |||
1207 | 218 | readonly property real targetOverviewScale: { | ||
1208 | 219 | if (scopesOverview.currentTab == 0) { | ||
1209 | 220 | return 0.4; | ||
1210 | 221 | } else { | ||
1211 | 222 | return scopesOverview.allCardSize.width / scopeItem.width; | ||
1212 | 223 | } | ||
1213 | 224 | } | ||
1214 | 225 | readonly property real overviewProgressScale: (1 - overviewController.progress * (1 - targetOverviewScale)) | ||
1215 | 226 | readonly property var targetOverviewPosition: scope ? scopesOverview.allScopeCardPosition(scope.id) : null | ||
1216 | 227 | readonly property real overviewProgressX: scope && scopesOverview.currentTab == 1 && targetOverviewPosition ? | ||
1217 | 228 | overviewController.progress * (targetOverviewPosition.x - (width - scopesOverview.allCardSize.width) / 2) | ||
1218 | 229 | : 0 | ||
1219 | 230 | readonly property real overviewProgressY: scope && scopesOverview.currentTab == 1 && targetOverviewPosition ? | ||
1220 | 231 | overviewController.progress * (targetOverviewPosition.y - (height - scopesOverview.allCardSize.height) / 2) | ||
1221 | 232 | : 0 | ||
1222 | 233 | |||
1223 | 234 | x: overviewController.progress == 0 ? dashContent.x + width : overviewProgressX | ||
1224 | 235 | y: overviewController.progress == 0 ? dashContent.y : overviewProgressY | ||
1225 | 121 | width: parent.width | 236 | width: parent.width |
1226 | 122 | height: parent.height | 237 | height: parent.height |
1228 | 123 | scale: dash.contentScale | 238 | scale: dash.contentScale * overviewProgressScale |
1229 | 239 | enabled: opacity == 1 | ||
1230 | 240 | opacity: 1 - overviewController.progress | ||
1231 | 124 | clip: scale != 1.0 | 241 | clip: scale != 1.0 |
1232 | 125 | visible: scope != null | 242 | visible: scope != null |
1233 | 126 | hasBackAction: true | 243 | hasBackAction: true |
1234 | @@ -154,7 +271,7 @@ | |||
1235 | 154 | opacity: 0 | 271 | opacity: 0 |
1236 | 155 | visible: opacity > 0 | 272 | visible: opacity > 0 |
1237 | 156 | 273 | ||
1239 | 157 | readonly property bool processing: dashContent.processing || scopeItem.processing | 274 | readonly property bool processing: dashContent.processing || scopeItem.processing || scopesOverview.processing |
1240 | 158 | 275 | ||
1241 | 159 | Behavior on opacity { | 276 | Behavior on opacity { |
1242 | 160 | UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration } | 277 | UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration } |
1243 | @@ -207,4 +324,45 @@ | |||
1244 | 207 | } | 324 | } |
1245 | 208 | } | 325 | } |
1246 | 209 | 326 | ||
1247 | 327 | Image { | ||
1248 | 328 | source: "graphics/overview_hint.png" | ||
1249 | 329 | anchors.horizontalCenter: parent.horizontalCenter | ||
1250 | 330 | opacity: (scopeItem.scope ? scopeItem.pageHeaderTotallyVisible : dashContent.pageHeaderTotallyVisible) && | ||
1251 | 331 | (overviewDragHandle.enabled || overviewController.progress != 0) ? 1 : 0 | ||
1252 | 332 | Behavior on opacity { | ||
1253 | 333 | enabled: overviewController.progress == 0 | ||
1254 | 334 | UbuntuNumberAnimation {} | ||
1255 | 335 | } | ||
1256 | 336 | y: parent.height - height * (1 - overviewController.progress * 4) | ||
1257 | 337 | } | ||
1258 | 338 | |||
1259 | 339 | EdgeDragArea { | ||
1260 | 340 | id: overviewDragHandle | ||
1261 | 341 | objectName: "overviewDragHandle" | ||
1262 | 342 | z: 1 | ||
1263 | 343 | direction: Direction.Upwards | ||
1264 | 344 | enabled: !dashContent.previewShown && | ||
1265 | 345 | dashContent.currentScope && | ||
1266 | 346 | dashContent.currentScope.searchQuery == "" && | ||
1267 | 347 | (overviewController.progress == 0 || dragging) | ||
1268 | 348 | |||
1269 | 349 | readonly property real fullMovement: units.gu(20) | ||
1270 | 350 | |||
1271 | 351 | anchors { left: parent.left; right: parent.right; bottom: parent.bottom } | ||
1272 | 352 | height: units.gu(2) | ||
1273 | 353 | |||
1274 | 354 | onSceneDistanceChanged: { | ||
1275 | 355 | if (overviewController.enableAnimation) { | ||
1276 | 356 | dashContentCache.scheduleUpdate(); | ||
1277 | 357 | } | ||
1278 | 358 | overviewController.enableAnimation = false; | ||
1279 | 359 | overviewController.progress = Math.max(0, Math.min(1, sceneDistance / fullMovement)); | ||
1280 | 360 | } | ||
1281 | 361 | |||
1282 | 362 | onDraggingChanged: { | ||
1283 | 363 | overviewController.enableAnimation = true; | ||
1284 | 364 | overviewController.progress = (overviewController.progress > 0.7) ? 1 : 0; | ||
1285 | 365 | } | ||
1286 | 366 | } | ||
1287 | 367 | |||
1288 | 210 | } | 368 | } |
1289 | 211 | 369 | ||
1290 | === added file 'qml/Dash/DashBackground.qml' | |||
1291 | --- qml/Dash/DashBackground.qml 1970-01-01 00:00:00 +0000 | |||
1292 | +++ qml/Dash/DashBackground.qml 2014-08-08 14:57:17 +0000 | |||
1293 | @@ -0,0 +1,24 @@ | |||
1294 | 1 | /* | ||
1295 | 2 | * Copyright (C) 2013, 2014 Canonical, Ltd. | ||
1296 | 3 | * | ||
1297 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1298 | 5 | * it under the terms of the GNU General Public License as published by | ||
1299 | 6 | * the Free Software Foundation; version 3. | ||
1300 | 7 | * | ||
1301 | 8 | * This program is distributed in the hope that it will be useful, | ||
1302 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1303 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1304 | 11 | * GNU General Public License for more details. | ||
1305 | 12 | * | ||
1306 | 13 | * You should have received a copy of the GNU General Public License | ||
1307 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1308 | 15 | */ | ||
1309 | 16 | |||
1310 | 17 | import QtQuick 2.0 | ||
1311 | 18 | |||
1312 | 19 | Image { | ||
1313 | 20 | source: anchors.fill.width > anchors.fill.height ? "graphics/paper_landscape.png" : "graphics/paper_portrait.png" | ||
1314 | 21 | fillMode: Image.PreserveAspectCrop | ||
1315 | 22 | horizontalAlignment: Image.AlignRight | ||
1316 | 23 | verticalAlignment: Image.AlignTop | ||
1317 | 24 | } | ||
1318 | 0 | 25 | ||
1319 | === modified file 'qml/Dash/DashContent.qml' | |||
1320 | --- qml/Dash/DashContent.qml 2014-08-06 19:39:30 +0000 | |||
1321 | +++ qml/Dash/DashContent.qml 2014-08-08 14:57:17 +0000 | |||
1322 | @@ -25,8 +25,14 @@ | |||
1323 | 25 | 25 | ||
1324 | 26 | property alias scopes: dashContentList.model | 26 | property alias scopes: dashContentList.model |
1325 | 27 | readonly property alias currentIndex: dashContentList.currentIndex | 27 | readonly property alias currentIndex: dashContentList.currentIndex |
1326 | 28 | readonly property string currentScopeId: dashContentList.currentItem ? dashContentList.currentItem.scopeId : "" | ||
1327 | 29 | readonly property var currentScope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null | ||
1328 | 30 | readonly property bool previewShown: dashContentList.currentItem && dashContentList.currentItem.item ? | ||
1329 | 31 | dashContentList.currentItem.item.previewShown : false | ||
1330 | 28 | readonly property bool processing: dashContentList.currentItem && dashContentList.currentItem.item | 32 | readonly property bool processing: dashContentList.currentItem && dashContentList.currentItem.item |
1331 | 29 | && dashContentList.currentItem.item.processing || false | 33 | && dashContentList.currentItem.item.processing || false |
1332 | 34 | readonly property bool pageHeaderTotallyVisible: dashContentList.currentItem && dashContentList.currentItem.item | ||
1333 | 35 | && dashContentList.currentItem.item.pageHeaderTotallyVisible || false | ||
1334 | 30 | 36 | ||
1335 | 31 | signal scopeLoaded(string scopeId) | 37 | signal scopeLoaded(string scopeId) |
1336 | 32 | signal gotoScope(string scopeId) | 38 | signal gotoScope(string scopeId) |
1337 | @@ -77,15 +83,15 @@ | |||
1338 | 77 | } | 83 | } |
1339 | 78 | } | 84 | } |
1340 | 79 | 85 | ||
1341 | 80 | function closeScope(scope) { | ||
1342 | 81 | dashContentList.currentItem.theScope.closeScope(scope) | ||
1343 | 82 | } | ||
1344 | 83 | |||
1345 | 84 | Item { | 86 | Item { |
1346 | 85 | id: dashContentListHolder | 87 | id: dashContentListHolder |
1347 | 86 | 88 | ||
1348 | 87 | anchors.fill: parent | 89 | anchors.fill: parent |
1349 | 88 | 90 | ||
1350 | 91 | DashBackground { | ||
1351 | 92 | anchors.fill: parent | ||
1352 | 93 | } | ||
1353 | 94 | |||
1354 | 89 | ListView { | 95 | ListView { |
1355 | 90 | id: dashContentList | 96 | id: dashContentList |
1356 | 91 | objectName: "dashContentList" | 97 | objectName: "dashContentList" |
1357 | 92 | 98 | ||
1358 | === modified file 'qml/Dash/DashRenderer.qml' | |||
1359 | --- qml/Dash/DashRenderer.qml 2014-07-22 12:17:34 +0000 | |||
1360 | +++ qml/Dash/DashRenderer.qml 2014-08-08 14:57:17 +0000 | |||
1361 | @@ -41,7 +41,9 @@ | |||
1362 | 41 | /// Emitted when the user clicked on an item | 41 | /// Emitted when the user clicked on an item |
1363 | 42 | /// @param index is the index of the clicked item | 42 | /// @param index is the index of the clicked item |
1364 | 43 | /// @param result result model of the cliked item, used for activation | 43 | /// @param result result model of the cliked item, used for activation |
1366 | 44 | signal clicked(int index, var result) | 44 | /// @param item item that has been clicked |
1367 | 45 | /// @param itemModel model of the item | ||
1368 | 46 | signal clicked(int index, var result, var item, var itemModel) | ||
1369 | 45 | 47 | ||
1370 | 46 | /// Emitted when the user pressed and held on an item | 48 | /// Emitted when the user pressed and held on an item |
1371 | 47 | /// @param index is the index of the held item | 49 | /// @param index is the index of the held item |
1372 | 48 | 50 | ||
1373 | === modified file 'qml/Dash/GenericScopeView.qml' | |||
1374 | --- qml/Dash/GenericScopeView.qml 2014-08-06 19:39:30 +0000 | |||
1375 | +++ qml/Dash/GenericScopeView.qml 2014-08-08 14:57:17 +0000 | |||
1376 | @@ -25,7 +25,7 @@ | |||
1377 | 25 | FocusScope { | 25 | FocusScope { |
1378 | 26 | id: scopeView | 26 | id: scopeView |
1379 | 27 | 27 | ||
1381 | 28 | readonly property alias navigationShown: dashNavigation.showList | 28 | readonly property bool navigationShown: pageHeaderLoader.item ? pageHeaderLoader.item.bottomItem[0].showList : false |
1382 | 29 | property var scope: null | 29 | property var scope: null |
1383 | 30 | property SortFilterProxyModel categories: categoryFilter | 30 | property SortFilterProxyModel categories: categoryFilter |
1384 | 31 | property bool isCurrent: false | 31 | property bool isCurrent: false |
1385 | @@ -33,8 +33,11 @@ | |||
1386 | 33 | property bool hasBackAction: false | 33 | property bool hasBackAction: false |
1387 | 34 | property bool enableHeightBehaviorOnNextCreation: false | 34 | property bool enableHeightBehaviorOnNextCreation: false |
1388 | 35 | property var categoryView: categoryView | 35 | property var categoryView: categoryView |
1391 | 36 | property alias paginationCount: pageHeader.paginationCount | 36 | property bool showPageHeader: true |
1392 | 37 | property alias paginationIndex: pageHeader.paginationIndex | 37 | readonly property alias previewShown: previewListView.open |
1393 | 38 | property int paginationCount: 0 | ||
1394 | 39 | property int paginationIndex: 0 | ||
1395 | 40 | property alias pageHeaderTotallyVisible: categoryView.pageHeaderTotallyVisible | ||
1396 | 38 | 41 | ||
1397 | 39 | property var scopeStyle: ScopeStyle { | 42 | property var scopeStyle: ScopeStyle { |
1398 | 40 | style: scope ? scope.customizations : {} | 43 | style: scope ? scope.customizations : {} |
1399 | @@ -56,6 +59,34 @@ | |||
1400 | 56 | previewListView.open = false; | 59 | previewListView.open = false; |
1401 | 57 | } | 60 | } |
1402 | 58 | 61 | ||
1403 | 62 | function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) { | ||
1404 | 63 | if (scope.id === "scopes" || scope.id == "clickscope") { | ||
1405 | 64 | // TODO Technically it is possible that calling activate() will make the scope emit | ||
1406 | 65 | // previewRequested so that we show a preview but there's no scope that does that yet | ||
1407 | 66 | // so it's not implemented | ||
1408 | 67 | scope.activate(result) | ||
1409 | 68 | } else { | ||
1410 | 69 | openPreview(index, resultsModel, limitedCategoryItemCount); | ||
1411 | 70 | } | ||
1412 | 71 | } | ||
1413 | 72 | |||
1414 | 73 | function itemPressedAndHeld(index, resultsModel, limitedCategoryItemCount) { | ||
1415 | 74 | openPreview(index, resultsModel, limitedCategoryItemCount); | ||
1416 | 75 | } | ||
1417 | 76 | |||
1418 | 77 | function openPreview(index, resultsModel, limitedCategoryItemCount) { | ||
1419 | 78 | if (limitedCategoryItemCount > 0) { | ||
1420 | 79 | previewLimitModel.model = resultsModel; | ||
1421 | 80 | previewLimitModel.limit = limitedCategoryItemCount; | ||
1422 | 81 | previewListView.model = previewLimitModel; | ||
1423 | 82 | } else { | ||
1424 | 83 | previewListView.model = resultsModel; | ||
1425 | 84 | } | ||
1426 | 85 | previewListView.currentIndex = -1; | ||
1427 | 86 | previewListView.currentIndex = index; | ||
1428 | 87 | previewListView.open = true; | ||
1429 | 88 | } | ||
1430 | 89 | |||
1431 | 59 | Binding { | 90 | Binding { |
1432 | 60 | target: scope | 91 | target: scope |
1433 | 61 | property: "isActive" | 92 | property: "isActive" |
1434 | @@ -72,22 +103,24 @@ | |||
1435 | 72 | } | 103 | } |
1436 | 73 | 104 | ||
1437 | 74 | onIsCurrentChanged: { | 105 | onIsCurrentChanged: { |
1439 | 75 | pageHeader.resetSearch(); | 106 | if (showPageHeader) { |
1440 | 107 | pageHeaderLoader.item.resetSearch(); | ||
1441 | 108 | } | ||
1442 | 76 | previewListView.open = false; | 109 | previewListView.open = false; |
1443 | 77 | } | 110 | } |
1444 | 78 | 111 | ||
1445 | 79 | Binding { | 112 | Binding { |
1446 | 80 | target: scopeView.scope | 113 | target: scopeView.scope |
1447 | 81 | property: "searchQuery" | 114 | property: "searchQuery" |
1450 | 82 | value: pageHeader.searchQuery | 115 | value: pageHeaderLoader.item ? pageHeaderLoader.item.searchQuery : "" |
1451 | 83 | when: isCurrent | 116 | when: isCurrent && showPageHeader |
1452 | 84 | } | 117 | } |
1453 | 85 | 118 | ||
1454 | 86 | Binding { | 119 | Binding { |
1456 | 87 | target: pageHeader | 120 | target: pageHeaderLoader.item |
1457 | 88 | property: "searchQuery" | 121 | property: "searchQuery" |
1458 | 89 | value: scopeView.scope ? scopeView.scope.searchQuery : "" | 122 | value: scopeView.scope ? scopeView.scope.searchQuery : "" |
1460 | 90 | when: isCurrent | 123 | when: isCurrent && showPageHeader |
1461 | 91 | } | 124 | } |
1462 | 92 | 125 | ||
1463 | 93 | Connections { | 126 | Connections { |
1464 | @@ -114,10 +147,13 @@ | |||
1465 | 114 | model: scopeView.categories | 147 | model: scopeView.categories |
1466 | 115 | forceNoClip: previewListView.open | 148 | forceNoClip: previewListView.open |
1467 | 116 | pixelAligned: true | 149 | pixelAligned: true |
1469 | 117 | interactive: !dashNavigation.showList | 150 | interactive: !navigationShown |
1470 | 118 | 151 | ||
1471 | 119 | property string expandedCategoryId: "" | 152 | property string expandedCategoryId: "" |
1472 | 120 | 153 | ||
1473 | 154 | readonly property bool pageHeaderTotallyVisible: scopeView.showPageHeader && | ||
1474 | 155 | ((headerItemShownHeight == 0 && categoryView.contentY <= categoryView.originY) || (headerItemShownHeight == pageHeaderLoader.item.height)) | ||
1475 | 156 | |||
1476 | 121 | delegate: ListItems.Base { | 157 | delegate: ListItems.Base { |
1477 | 122 | id: baseItem | 158 | id: baseItem |
1478 | 123 | objectName: "dashCategory" + category | 159 | objectName: "dashCategory" + category |
1479 | @@ -223,28 +259,19 @@ | |||
1480 | 223 | Connections { | 259 | Connections { |
1481 | 224 | target: rendererLoader.item | 260 | target: rendererLoader.item |
1482 | 225 | onClicked: { | 261 | onClicked: { |
1495 | 226 | if (scopeView.scope.id === "scopes" || scopeView.scope.id == "clickscope") { | 262 | scopeView.itemClicked(index, result, item, itemModel, target.model, categoryItemCount()); |
1496 | 227 | // TODO Technically it is possible that calling activate() will make the scope emit | 263 | } |
1497 | 228 | // previewRequested so that we show a preview but there's no scope that does that yet | 264 | |
1498 | 229 | // so it's not implemented | 265 | onPressAndHold: { |
1499 | 230 | scopeView.scope.activate(result) | 266 | scopeView.itemPressedAndHeld(index, target.model, categoryItemCount()); |
1500 | 231 | } else { | 267 | } |
1501 | 232 | openPreview(index); | 268 | |
1502 | 233 | } | 269 | function categoryItemCount() { |
1503 | 234 | } | 270 | var categoryItemCount = -1; |
1492 | 235 | onPressAndHold: openPreview(index) | ||
1493 | 236 | |||
1494 | 237 | function openPreview(index) { | ||
1504 | 238 | if (!rendererLoader.expanded && !seeAllLabel.visible && target.collapsedItemCount > 0) { | 271 | if (!rendererLoader.expanded && !seeAllLabel.visible && target.collapsedItemCount > 0) { |
1510 | 239 | previewLimitModel.model = target.model; | 272 | categoryItemCount = target.collapsedItemCount; |
1506 | 240 | previewLimitModel.limit = target.collapsedItemCount; | ||
1507 | 241 | previewListView.model = previewLimitModel; | ||
1508 | 242 | } else { | ||
1509 | 243 | previewListView.model = target.model; | ||
1511 | 244 | } | 273 | } |
1515 | 245 | previewListView.currentIndex = -1; | 274 | return categoryItemCount; |
1513 | 246 | previewListView.currentIndex = index; | ||
1514 | 247 | previewListView.open = true; | ||
1516 | 248 | } | 275 | } |
1517 | 249 | } | 276 | } |
1518 | 250 | Connections { | 277 | Connections { |
1519 | @@ -380,26 +407,35 @@ | |||
1520 | 380 | } | 407 | } |
1521 | 381 | } | 408 | } |
1522 | 382 | 409 | ||
1526 | 383 | pageHeader: PageHeader { | 410 | pageHeader: scopeView.showPageHeader ? pageHeaderLoader : null |
1527 | 384 | id: pageHeader | 411 | Loader { |
1528 | 385 | objectName: "scopePageHeader" | 412 | id: pageHeaderLoader |
1529 | 386 | width: parent.width | 413 | width: parent.width |
1543 | 387 | title: scopeView.scope ? scopeView.scope.name : "" | 414 | sourceComponent: scopeView.showPageHeader ? pageHeaderComponent : undefined |
1544 | 388 | showBackButton: scopeView.hasBackAction | 415 | Component { |
1545 | 389 | searchEntryEnabled: true | 416 | id: pageHeaderComponent |
1546 | 390 | scopeStyle: scopeView.scopeStyle | 417 | PageHeader { |
1547 | 391 | 418 | objectName: "scopePageHeader" | |
1548 | 392 | bottomItem: DashNavigation { | 419 | width: parent.width |
1549 | 393 | id: dashNavigation | 420 | title: scopeView.scope ? scopeView.scope.name : "" |
1550 | 394 | scope: scopeView.scope | 421 | showBackButton: scopeView.hasBackAction |
1551 | 395 | width: parent.width <= units.gu(60) ? parent.width : units.gu(40) | 422 | searchEntryEnabled: true |
1552 | 396 | anchors.right: parent.right | 423 | scopeStyle: scopeView.scopeStyle |
1553 | 397 | windowHeight: scopeView.height | 424 | paginationCount: scopeView.paginationCount |
1554 | 398 | windowWidth: scopeView.width | 425 | paginationIndex: scopeView.paginationIndex |
1555 | 399 | scopeStyle: scopeView.scopeStyle | 426 | |
1556 | 427 | bottomItem: DashNavigation { | ||
1557 | 428 | scope: scopeView.scope | ||
1558 | 429 | width: parent.width <= units.gu(60) ? parent.width : units.gu(40) | ||
1559 | 430 | anchors.right: parent.right | ||
1560 | 431 | windowHeight: scopeView.height | ||
1561 | 432 | windowWidth: scopeView.width | ||
1562 | 433 | scopeStyle: scopeView.scopeStyle | ||
1563 | 434 | } | ||
1564 | 435 | |||
1565 | 436 | onBackClicked: scopeView.backClicked() | ||
1566 | 437 | } | ||
1567 | 400 | } | 438 | } |
1568 | 401 | |||
1569 | 402 | onBackClicked: scopeView.backClicked() | ||
1570 | 403 | } | 439 | } |
1571 | 404 | } | 440 | } |
1572 | 405 | 441 | ||
1573 | @@ -418,7 +454,9 @@ | |||
1574 | 418 | anchors.left: categoryView.right | 454 | anchors.left: categoryView.right |
1575 | 419 | 455 | ||
1576 | 420 | onOpenChanged: { | 456 | onOpenChanged: { |
1578 | 421 | pageHeader.unfocus(); | 457 | if (showPageHeader) { |
1579 | 458 | pageHeaderLoader.item.unfocus(); | ||
1580 | 459 | } | ||
1581 | 422 | } | 460 | } |
1582 | 423 | } | 461 | } |
1583 | 424 | 462 | ||
1584 | 425 | 463 | ||
1585 | === modified file 'qml/Dash/PreviewListView.qml' | |||
1586 | --- qml/Dash/PreviewListView.qml 2014-07-30 15:46:44 +0000 | |||
1587 | +++ qml/Dash/PreviewListView.qml 2014-08-08 14:57:17 +0000 | |||
1588 | @@ -108,7 +108,7 @@ | |||
1589 | 108 | anchors { | 108 | anchors { |
1590 | 109 | left: parent.left | 109 | left: parent.left |
1591 | 110 | right: parent.right | 110 | right: parent.right |
1593 | 111 | top: pageHeader.bottom | 111 | top: header.bottom |
1594 | 112 | bottom: parent.bottom | 112 | bottom: parent.bottom |
1595 | 113 | } | 113 | } |
1596 | 114 | 114 | ||
1597 | 115 | 115 | ||
1598 | === added file 'qml/Dash/ScopesOverview.qml' | |||
1599 | --- qml/Dash/ScopesOverview.qml 1970-01-01 00:00:00 +0000 | |||
1600 | +++ qml/Dash/ScopesOverview.qml 2014-08-08 14:57:17 +0000 | |||
1601 | @@ -0,0 +1,531 @@ | |||
1602 | 1 | /* | ||
1603 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
1604 | 3 | * | ||
1605 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1606 | 5 | * it under the terms of the GNU General Public License as published by | ||
1607 | 6 | * the Free Software Foundation; version 3. | ||
1608 | 7 | * | ||
1609 | 8 | * This program is distributed in the hope that it will be useful, | ||
1610 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1611 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1612 | 11 | * GNU General Public License for more details. | ||
1613 | 12 | * | ||
1614 | 13 | * You should have received a copy of the GNU General Public License | ||
1615 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1616 | 15 | */ | ||
1617 | 16 | |||
1618 | 17 | import QtQuick 2.0 | ||
1619 | 18 | import Dash 0.1 | ||
1620 | 19 | import Ubuntu.Components 0.1 | ||
1621 | 20 | import "../Components" | ||
1622 | 21 | |||
1623 | 22 | Item { | ||
1624 | 23 | id: root | ||
1625 | 24 | |||
1626 | 25 | // Properties set by parent | ||
1627 | 26 | property real progress: 0 | ||
1628 | 27 | property var scope: null | ||
1629 | 28 | property int currentIndex: 0 | ||
1630 | 29 | property real scopeScale: 1 | ||
1631 | 30 | |||
1632 | 31 | // Properties set and used by parent | ||
1633 | 32 | property alias currentTab: tabBar.currentTab | ||
1634 | 33 | |||
1635 | 34 | // Properties used by parent | ||
1636 | 35 | readonly property bool processing: searchResultsViewer.processing || tempScopeItem.processing | ||
1637 | 36 | property bool growingDashFromPos: false | ||
1638 | 37 | readonly property bool searching: scope && scope.searchQuery == "" | ||
1639 | 38 | readonly property bool showingNonFavoriteScope: tempScopeItem.scope != null | ||
1640 | 39 | readonly property var dashItemEater: { | ||
1641 | 40 | if (!forceXYScalerEater && tabBar.currentTab == 0 && middleItems.count > 0) { | ||
1642 | 41 | var loaderItem = middleItems.itemAt(0).item; | ||
1643 | 42 | return loaderItem && loaderItem.currentItem ? loaderItem.currentItem : null; | ||
1644 | 43 | } | ||
1645 | 44 | return scopesOverviewXYScaler; | ||
1646 | 45 | } | ||
1647 | 46 | readonly property size allCardSize: { | ||
1648 | 47 | if (middleItems.count > 1) { | ||
1649 | 48 | var loaderItem = middleItems.itemAt(1).item; | ||
1650 | 49 | if (loaderItem) { | ||
1651 | 50 | var cardTool = loaderItem.cardTool; | ||
1652 | 51 | return Qt.size(cardTool.cardWidth, cardTool.cardHeight); | ||
1653 | 52 | } | ||
1654 | 53 | } | ||
1655 | 54 | return Qt.size(0, 0); | ||
1656 | 55 | } | ||
1657 | 56 | |||
1658 | 57 | // Internal properties | ||
1659 | 58 | property bool forceXYScalerEater: false | ||
1660 | 59 | |||
1661 | 60 | signal done() | ||
1662 | 61 | signal favoriteSelected(var scopeId) | ||
1663 | 62 | signal allFavoriteSelected(var scopeId) | ||
1664 | 63 | signal searchSelected(var scopeId, var result, var pos, var size) | ||
1665 | 64 | |||
1666 | 65 | Connections { | ||
1667 | 66 | target: scope | ||
1668 | 67 | onOpenScope: { | ||
1669 | 68 | var itemPos = scopesOverviewXYScaler.restorePosition; | ||
1670 | 69 | var itemSize = scopesOverviewXYScaler.restoreSize; | ||
1671 | 70 | scopesOverviewXYScaler.scale = itemSize.width / scopesOverviewXYScaler.width; | ||
1672 | 71 | if (itemPos) { | ||
1673 | 72 | scopesOverviewXYScaler.x = itemPos.x -(scopesOverviewXYScaler.width - scopesOverviewXYScaler.width * scopesOverviewXYScaler.scale) / 2; | ||
1674 | 73 | scopesOverviewXYScaler.y = itemPos.y -(scopesOverviewXYScaler.height - scopesOverviewXYScaler.height * scopesOverviewXYScaler.scale) / 2; | ||
1675 | 74 | } else { | ||
1676 | 75 | scopesOverviewXYScaler.x = 0; | ||
1677 | 76 | scopesOverviewXYScaler.y = 0; | ||
1678 | 77 | } | ||
1679 | 78 | scopesOverviewXYScaler.opacity = 0; | ||
1680 | 79 | tempScopeItem.scope = scope; | ||
1681 | 80 | middleItems.overrideOpacity = 0; | ||
1682 | 81 | scopesOverviewXYScaler.scale = 1; | ||
1683 | 82 | scopesOverviewXYScaler.x = 0; | ||
1684 | 83 | scopesOverviewXYScaler.y = 0; | ||
1685 | 84 | scopesOverviewXYScaler.opacity = 1; | ||
1686 | 85 | } | ||
1687 | 86 | onGotoScope: { | ||
1688 | 87 | if (tabBar.currentTab == 0) { | ||
1689 | 88 | root.favoriteSelected(scopeId); | ||
1690 | 89 | } else { | ||
1691 | 90 | root.allFavoriteSelected(scopeId); | ||
1692 | 91 | } | ||
1693 | 92 | } | ||
1694 | 93 | } | ||
1695 | 94 | |||
1696 | 95 | Binding { | ||
1697 | 96 | target: scope | ||
1698 | 97 | property: "isActive" | ||
1699 | 98 | value: progress === 1 | ||
1700 | 99 | } | ||
1701 | 100 | |||
1702 | 101 | function animateDashFromAll(scopeId) { | ||
1703 | 102 | var currentScopePos = allScopeCardPosition(scopeId); | ||
1704 | 103 | if (currentScopePos) { | ||
1705 | 104 | showDashFromPos(currentScopePos, allCardSize); | ||
1706 | 105 | } else { | ||
1707 | 106 | console.log("Warning: Could not find Dash OverView All card position for scope", dashContent.currentScopeId); | ||
1708 | 107 | } | ||
1709 | 108 | } | ||
1710 | 109 | |||
1711 | 110 | function showDashFromPos(itemPos, itemSize) { | ||
1712 | 111 | scopesOverviewXYScaler.scale = itemSize.width / scopesOverviewXYScaler.width; | ||
1713 | 112 | scopesOverviewXYScaler.x = itemPos.x -(scopesOverviewXYScaler.width - scopesOverviewXYScaler.width * scopesOverviewXYScaler.scale) / 2; | ||
1714 | 113 | scopesOverviewXYScaler.y = itemPos.y -(scopesOverviewXYScaler.height - scopesOverviewXYScaler.height * scopesOverviewXYScaler.scale) / 2; | ||
1715 | 114 | scopesOverviewXYScaler.opacity = 0; | ||
1716 | 115 | root.growingDashFromPos = true; | ||
1717 | 116 | scopesOverviewXYScaler.scale = 1; | ||
1718 | 117 | scopesOverviewXYScaler.x = 0; | ||
1719 | 118 | scopesOverviewXYScaler.y = 0; | ||
1720 | 119 | scopesOverviewXYScaler.opacity = 1; | ||
1721 | 120 | } | ||
1722 | 121 | |||
1723 | 122 | function allScopeCardPosition(scopeId) { | ||
1724 | 123 | if (middleItems.count > 1) { | ||
1725 | 124 | var loaderItem = middleItems.itemAt(1).item; | ||
1726 | 125 | if (loaderItem) { | ||
1727 | 126 | var pos = loaderItem.scopeCardPosition(scopeId); | ||
1728 | 127 | return loaderItem.mapToItem(null, pos.x, pos.y); | ||
1729 | 128 | } | ||
1730 | 129 | } | ||
1731 | 130 | } | ||
1732 | 131 | |||
1733 | 132 | function ensureAllScopeVisible(scopeId) { | ||
1734 | 133 | if (middleItems.count > 1) { | ||
1735 | 134 | var loaderItem = middleItems.itemAt(1).item; | ||
1736 | 135 | if (loaderItem) { | ||
1737 | 136 | var pos = loaderItem.scopeCardPosition(scopeId); | ||
1738 | 137 | loaderItem.contentY = Math.min(pos.y, loaderItem.contentHeight - loaderItem.height); | ||
1739 | 138 | } | ||
1740 | 139 | } | ||
1741 | 140 | } | ||
1742 | 141 | |||
1743 | 142 | onProgressChanged: { | ||
1744 | 143 | if (progress == 0) { | ||
1745 | 144 | pageHeader.resetSearch(); | ||
1746 | 145 | pageHeader.unfocus(); // Shouldn't the previous call do this too? | ||
1747 | 146 | } | ||
1748 | 147 | } | ||
1749 | 148 | |||
1750 | 149 | ScopeStyle { | ||
1751 | 150 | id: overviewScopeStyle | ||
1752 | 151 | style: { "foreground-color" : "white", "background-color" : "transparent" } | ||
1753 | 152 | } | ||
1754 | 153 | |||
1755 | 154 | DashBackground { | ||
1756 | 155 | anchors.fill: parent | ||
1757 | 156 | source: "graphics/dark_background.jpg" | ||
1758 | 157 | } | ||
1759 | 158 | |||
1760 | 159 | Connections { | ||
1761 | 160 | target: pageHeader | ||
1762 | 161 | onSearchQueryChanged: { | ||
1763 | 162 | // Need this in order, otherwise something gets unhappy in rendering | ||
1764 | 163 | // of the overlay in carousels because the parent of the dash dies for | ||
1765 | 164 | // a moment, this way we make sure it's reparented first | ||
1766 | 165 | // by forceXYScalerEater making dashItemEater return scopesOverviewXYScaler | ||
1767 | 166 | // before we kill the previous parent by scope.searchQuery | ||
1768 | 167 | root.forceXYScalerEater = true; | ||
1769 | 168 | root.scope.searchQuery = pageHeader.searchQuery; | ||
1770 | 169 | root.forceXYScalerEater = false; | ||
1771 | 170 | } | ||
1772 | 171 | } | ||
1773 | 172 | |||
1774 | 173 | Binding { | ||
1775 | 174 | target: pageHeader | ||
1776 | 175 | property: "searchQuery" | ||
1777 | 176 | value: scope ? scope.searchQuery : "" | ||
1778 | 177 | } | ||
1779 | 178 | |||
1780 | 179 | Item { | ||
1781 | 180 | id: scopesOverviewContent | ||
1782 | 181 | x: previewListView.open ? -width : 0 | ||
1783 | 182 | Behavior on x { UbuntuNumberAnimation { } } | ||
1784 | 183 | width: parent.width | ||
1785 | 184 | height: parent.height | ||
1786 | 185 | |||
1787 | 186 | PageHeader { | ||
1788 | 187 | id: pageHeader | ||
1789 | 188 | objectName: "scopesOverviewPageHeader" | ||
1790 | 189 | |||
1791 | 190 | readonly property real yDisplacement: pageHeader.height + tabBar.height + tabBar.anchors.margins | ||
1792 | 191 | |||
1793 | 192 | y: { | ||
1794 | 193 | if (root.progress < 0.5) { | ||
1795 | 194 | return -yDisplacement; | ||
1796 | 195 | } else { | ||
1797 | 196 | return -yDisplacement + (root.progress - 0.5) * yDisplacement * 2; | ||
1798 | 197 | } | ||
1799 | 198 | } | ||
1800 | 199 | width: parent.width | ||
1801 | 200 | clip: true | ||
1802 | 201 | title: i18n.tr("Manage Dash") | ||
1803 | 202 | scopeStyle: overviewScopeStyle | ||
1804 | 203 | showSignatureLine: false | ||
1805 | 204 | searchEntryEnabled: true | ||
1806 | 205 | } | ||
1807 | 206 | |||
1808 | 207 | ScopesOverviewTab { | ||
1809 | 208 | id: tabBar | ||
1810 | 209 | anchors { | ||
1811 | 210 | left: parent.left | ||
1812 | 211 | right: parent.right | ||
1813 | 212 | top: pageHeader.bottom | ||
1814 | 213 | margins: units.gu(2) | ||
1815 | 214 | } | ||
1816 | 215 | height: units.gu(4) | ||
1817 | 216 | |||
1818 | 217 | enabled: opacity == 1 | ||
1819 | 218 | opacity: !scope || scope.searchQuery == "" ? 1 : 0 | ||
1820 | 219 | Behavior on opacity { UbuntuNumberAnimation { } } | ||
1821 | 220 | } | ||
1822 | 221 | |||
1823 | 222 | Repeater { | ||
1824 | 223 | id: middleItems | ||
1825 | 224 | objectName: "scopesOverviewRepeater" | ||
1826 | 225 | property real overrideOpacity: -1 | ||
1827 | 226 | model: scope && scope.searchQuery == "" ? scope.categories : null | ||
1828 | 227 | delegate: Loader { | ||
1829 | 228 | id: loader | ||
1830 | 229 | objectName: "scopesOverviewRepeaterChild" + index | ||
1831 | 230 | |||
1832 | 231 | height: { | ||
1833 | 232 | if (index == 0) { | ||
1834 | 233 | return root.height; | ||
1835 | 234 | } else { | ||
1836 | 235 | return root.height - pageHeader.height - tabBar.height - tabBar.anchors.margins - units.gu(2); | ||
1837 | 236 | } | ||
1838 | 237 | } | ||
1839 | 238 | width: { | ||
1840 | 239 | if (index == 0) { | ||
1841 | 240 | return root.width / scopeScale; | ||
1842 | 241 | } else { | ||
1843 | 242 | return root.width; | ||
1844 | 243 | } | ||
1845 | 244 | } | ||
1846 | 245 | x: { | ||
1847 | 246 | if (index == 0) { | ||
1848 | 247 | return (root.width - width) / 2; | ||
1849 | 248 | } else { | ||
1850 | 249 | return 0; | ||
1851 | 250 | } | ||
1852 | 251 | } | ||
1853 | 252 | anchors { | ||
1854 | 253 | bottom: scopesOverviewContent.bottom | ||
1855 | 254 | } | ||
1856 | 255 | |||
1857 | 256 | scale: index == 0 ? scopeScale : 1 | ||
1858 | 257 | |||
1859 | 258 | opacity: { | ||
1860 | 259 | if (middleItems.overrideOpacity >= 0) | ||
1861 | 260 | return middleItems.overrideOpacity; | ||
1862 | 261 | |||
1863 | 262 | if (tabBar.currentTab != index) | ||
1864 | 263 | return 0; | ||
1865 | 264 | |||
1866 | 265 | return index == 0 ? 1 : root.progress; | ||
1867 | 266 | } | ||
1868 | 267 | Behavior on opacity { | ||
1869 | 268 | enabled: root.progress == 1 | ||
1870 | 269 | UbuntuNumberAnimation { } | ||
1871 | 270 | } | ||
1872 | 271 | enabled: opacity == 1 | ||
1873 | 272 | |||
1874 | 273 | clip: index == 1 | ||
1875 | 274 | |||
1876 | 275 | CardTool { | ||
1877 | 276 | id: cardTool | ||
1878 | 277 | objectName: "cardTool" | ||
1879 | 278 | count: results.count | ||
1880 | 279 | template: model.renderer | ||
1881 | 280 | components: model.components | ||
1882 | 281 | viewWidth: parent.width | ||
1883 | 282 | } | ||
1884 | 283 | |||
1885 | 284 | source: { | ||
1886 | 285 | if (index == 0 && categoryId == "favorites") return "ScopesOverviewFavorites.qml"; | ||
1887 | 286 | else if (index == 1 && categoryId == "all") return "ScopesOverviewAll.qml"; | ||
1888 | 287 | else return ""; | ||
1889 | 288 | } | ||
1890 | 289 | |||
1891 | 290 | onLoaded: { | ||
1892 | 291 | item.model = Qt.binding(function() { return results; }); | ||
1893 | 292 | item.cardTool = cardTool; | ||
1894 | 293 | if (index == 0) { | ||
1895 | 294 | item.scopeWidth = Qt.binding(function() { return root.width; }); | ||
1896 | 295 | item.scopeHeight = Qt.binding(function() { return root.height; }); | ||
1897 | 296 | item.appliedScale = Qt.binding(function() { return loader.scale }); | ||
1898 | 297 | item.currentIndex = Qt.binding(function() { return root.currentIndex }); | ||
1899 | 298 | } else if (index == 1) { | ||
1900 | 299 | item.extraHeight = bottomBar.height; | ||
1901 | 300 | } | ||
1902 | 301 | } | ||
1903 | 302 | |||
1904 | 303 | Connections { | ||
1905 | 304 | target: loader.item | ||
1906 | 305 | onClicked: { | ||
1907 | 306 | if (tabBar.currentTab == 0) { | ||
1908 | 307 | root.favoriteSelected(itemModel.scopeId); | ||
1909 | 308 | } else { | ||
1910 | 309 | var favoriteScopesItem = middleItems.itemAt(0).item; | ||
1911 | 310 | var scopeIndex = favoriteScopesItem.model.scopeIndex(itemModel.scopeId); | ||
1912 | 311 | if (scopeIndex >= 0) { | ||
1913 | 312 | root.allFavoriteSelected(itemModel.scopeId); | ||
1914 | 313 | } else { | ||
1915 | 314 | // Will result in an openScope from root.scope | ||
1916 | 315 | scopesOverviewXYScaler.restorePosition = item.mapToItem(null, 0, 0); | ||
1917 | 316 | scopesOverviewXYScaler.restoreSize = allCardSize; | ||
1918 | 317 | root.scope.activate(result); | ||
1919 | 318 | } | ||
1920 | 319 | } | ||
1921 | 320 | } | ||
1922 | 321 | onPressAndHold: { | ||
1923 | 322 | // Preview can call openScope so make sure restorePosition and restoreSize are set | ||
1924 | 323 | scopesOverviewXYScaler.restorePosition = undefined; | ||
1925 | 324 | scopesOverviewXYScaler.restoreSize = allCardSize; | ||
1926 | 325 | |||
1927 | 326 | previewListView.model = target.model; | ||
1928 | 327 | previewListView.currentIndex = -1; | ||
1929 | 328 | previewListView.currentIndex = index; | ||
1930 | 329 | previewListView.open = true; | ||
1931 | 330 | } | ||
1932 | 331 | } | ||
1933 | 332 | } | ||
1934 | 333 | } | ||
1935 | 334 | |||
1936 | 335 | GenericScopeView { | ||
1937 | 336 | id: searchResultsViewer | ||
1938 | 337 | objectName: "searchResultsViewer" | ||
1939 | 338 | anchors { | ||
1940 | 339 | top: pageHeader.bottom | ||
1941 | 340 | right: parent.right | ||
1942 | 341 | left: parent.left | ||
1943 | 342 | bottom: parent.bottom | ||
1944 | 343 | } | ||
1945 | 344 | scope: root.scope && root.scope.searchQuery != "" ? root.scope : null | ||
1946 | 345 | scopeStyle: overviewScopeStyle | ||
1947 | 346 | enabled: opacity == 1 | ||
1948 | 347 | showPageHeader: false | ||
1949 | 348 | clip: true | ||
1950 | 349 | opacity: searchResultsViewer.scope ? 1 : 0 | ||
1951 | 350 | isCurrent: true | ||
1952 | 351 | Behavior on opacity { UbuntuNumberAnimation { } } | ||
1953 | 352 | |||
1954 | 353 | function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) { | ||
1955 | 354 | pageHeader.closePopup(); | ||
1956 | 355 | if (itemModel.scopeId) { | ||
1957 | 356 | // This can end up in openScope so save restorePosition and restoreSize | ||
1958 | 357 | scopesOverviewXYScaler.restorePosition = item.mapToItem(null, 0, 0); | ||
1959 | 358 | scopesOverviewXYScaler.restoreSize = Qt.size(item.width, item.height); | ||
1960 | 359 | root.searchSelected(itemModel.scopeId, result, item.mapToItem(null, 0, 0), Qt.size(item.width, item.height)); | ||
1961 | 360 | } else { | ||
1962 | 361 | // Not a scope, just activate it | ||
1963 | 362 | searchResultsViewer.scope.activate(result); | ||
1964 | 363 | } | ||
1965 | 364 | } | ||
1966 | 365 | |||
1967 | 366 | function itemPressedAndHeld(index, resultsModel, limitedCategoryItemCount) { | ||
1968 | 367 | // Do nothing | ||
1969 | 368 | } | ||
1970 | 369 | } | ||
1971 | 370 | |||
1972 | 371 | Rectangle { | ||
1973 | 372 | id: bottomBar | ||
1974 | 373 | color: "black" | ||
1975 | 374 | height: units.gu(8) | ||
1976 | 375 | width: parent.width | ||
1977 | 376 | enabled: opacity == 1 | ||
1978 | 377 | opacity: scope && scope.searchQuery == "" ? 1 : 0 | ||
1979 | 378 | Behavior on opacity { UbuntuNumberAnimation { } } | ||
1980 | 379 | y: { | ||
1981 | 380 | if (root.progress < 0.5) { | ||
1982 | 381 | return parent.height; | ||
1983 | 382 | } else { | ||
1984 | 383 | return parent.height - (root.progress - 0.5) * height * 2; | ||
1985 | 384 | } | ||
1986 | 385 | } | ||
1987 | 386 | |||
1988 | 387 | AbstractButton { | ||
1989 | 388 | objectName: "scopesOverviewDoneButton" | ||
1990 | 389 | width: Math.max(label.width + units.gu(2), units.gu(10)) | ||
1991 | 390 | height: units.gu(4) | ||
1992 | 391 | anchors { | ||
1993 | 392 | left: parent.left | ||
1994 | 393 | leftMargin: units.gu(2) | ||
1995 | 394 | verticalCenter: parent.verticalCenter | ||
1996 | 395 | } | ||
1997 | 396 | Rectangle { | ||
1998 | 397 | anchors.fill: parent | ||
1999 | 398 | border.color: "white" | ||
2000 | 399 | border.width: units.dp(1) | ||
2001 | 400 | radius: units.dp(10) | ||
2002 | 401 | color: parent.pressed ? "gray" : "transparent" | ||
2003 | 402 | } | ||
2004 | 403 | Label { | ||
2005 | 404 | id: label | ||
2006 | 405 | anchors.centerIn: parent | ||
2007 | 406 | text: i18n.tr("Done") | ||
2008 | 407 | color: parent.pressed ? "black" : "white" | ||
2009 | 408 | } | ||
2010 | 409 | onClicked: root.done(); | ||
2011 | 410 | } | ||
2012 | 411 | |||
2013 | 412 | AbstractButton { | ||
2014 | 413 | objectName: "scopesOverviewStoreButton" | ||
2015 | 414 | width: Math.max(storeLabel.width, units.gu(10)) | ||
2016 | 415 | height: units.gu(4) | ||
2017 | 416 | anchors { | ||
2018 | 417 | right: parent.right | ||
2019 | 418 | verticalCenter: parent.verticalCenter | ||
2020 | 419 | } | ||
2021 | 420 | Icon { | ||
2022 | 421 | id: storeImage | ||
2023 | 422 | name: "ubuntu-store-symbolic" | ||
2024 | 423 | color: "white" | ||
2025 | 424 | anchors.horizontalCenter: parent.horizontalCenter | ||
2026 | 425 | width: units.gu(2) | ||
2027 | 426 | height: units.gu(2) | ||
2028 | 427 | } | ||
2029 | 428 | Label { | ||
2030 | 429 | id: storeLabel | ||
2031 | 430 | anchors.horizontalCenter: parent.horizontalCenter | ||
2032 | 431 | anchors.top: storeImage.bottom | ||
2033 | 432 | text: i18n.tr("Store") | ||
2034 | 433 | color: "white" | ||
2035 | 434 | } | ||
2036 | 435 | onClicked: { | ||
2037 | 436 | // Just zoom from the middle | ||
2038 | 437 | scopesOverviewXYScaler.restorePosition = undefined; | ||
2039 | 438 | scopesOverviewXYScaler.restoreSize = allCardSize; | ||
2040 | 439 | scope.performQuery("scope://com.canonical.scopes.clickstore"); | ||
2041 | 440 | } | ||
2042 | 441 | } | ||
2043 | 442 | } | ||
2044 | 443 | } | ||
2045 | 444 | |||
2046 | 445 | PreviewListView { | ||
2047 | 446 | id: previewListView | ||
2048 | 447 | objectName: "scopesOverviewPreviewListView" | ||
2049 | 448 | scope: root.scope | ||
2050 | 449 | scopeStyle: overviewScopeStyle | ||
2051 | 450 | visible: x != width | ||
2052 | 451 | width: parent.width | ||
2053 | 452 | height: parent.height | ||
2054 | 453 | anchors.left: scopesOverviewContent.right | ||
2055 | 454 | } | ||
2056 | 455 | |||
2057 | 456 | |||
2058 | 457 | |||
2059 | 458 | Item { | ||
2060 | 459 | id: scopesOverviewXYScaler | ||
2061 | 460 | width: parent.width | ||
2062 | 461 | height: parent.height | ||
2063 | 462 | |||
2064 | 463 | clip: scale != 1.0 | ||
2065 | 464 | enabled: scale == 1 | ||
2066 | 465 | |||
2067 | 466 | property bool animationsEnabled: root.showingNonFavoriteScope || root.growingDashFromPos | ||
2068 | 467 | |||
2069 | 468 | property var restorePosition | ||
2070 | 469 | property var restoreSize | ||
2071 | 470 | |||
2072 | 471 | Behavior on x { | ||
2073 | 472 | enabled: scopesOverviewXYScaler.animationsEnabled | ||
2074 | 473 | UbuntuNumberAnimation { } | ||
2075 | 474 | } | ||
2076 | 475 | Behavior on y { | ||
2077 | 476 | enabled: scopesOverviewXYScaler.animationsEnabled | ||
2078 | 477 | UbuntuNumberAnimation { } | ||
2079 | 478 | } | ||
2080 | 479 | Behavior on opacity { | ||
2081 | 480 | enabled: scopesOverviewXYScaler.animationsEnabled | ||
2082 | 481 | UbuntuNumberAnimation { } | ||
2083 | 482 | } | ||
2084 | 483 | Behavior on scale { | ||
2085 | 484 | enabled: scopesOverviewXYScaler.animationsEnabled | ||
2086 | 485 | UbuntuNumberAnimation { | ||
2087 | 486 | onRunningChanged: { | ||
2088 | 487 | if (!running) { | ||
2089 | 488 | if (root.showingNonFavoriteScope && scopesOverviewXYScaler.scale != 1) { | ||
2090 | 489 | root.scope.closeScope(tempScopeItem.scope); | ||
2091 | 490 | tempScopeItem.scope = null; | ||
2092 | 491 | } else if (root.growingDashFromPos) { | ||
2093 | 492 | root.growingDashFromPos = false; | ||
2094 | 493 | } | ||
2095 | 494 | } | ||
2096 | 495 | } | ||
2097 | 496 | } | ||
2098 | 497 | } | ||
2099 | 498 | |||
2100 | 499 | DashBackground { | ||
2101 | 500 | anchors.fill: tempScopeItem | ||
2102 | 501 | visible: tempScopeItem.visible | ||
2103 | 502 | parent: tempScopeItem.parent | ||
2104 | 503 | } | ||
2105 | 504 | |||
2106 | 505 | GenericScopeView { | ||
2107 | 506 | id: tempScopeItem | ||
2108 | 507 | objectName: "scopesOverviewTempScopeItem" | ||
2109 | 508 | |||
2110 | 509 | width: parent.width | ||
2111 | 510 | height: parent.height | ||
2112 | 511 | scale: dash.contentScale | ||
2113 | 512 | clip: scale != 1.0 | ||
2114 | 513 | visible: scope != null | ||
2115 | 514 | hasBackAction: true | ||
2116 | 515 | isCurrent: visible | ||
2117 | 516 | onBackClicked: { | ||
2118 | 517 | var v = scopesOverviewXYScaler.restoreSize.width / tempScopeItem.width; | ||
2119 | 518 | scopesOverviewXYScaler.scale = v; | ||
2120 | 519 | if (scopesOverviewXYScaler.restorePosition) { | ||
2121 | 520 | scopesOverviewXYScaler.x = scopesOverviewXYScaler.restorePosition.x -(tempScopeItem.width - tempScopeItem.width * v) / 2; | ||
2122 | 521 | scopesOverviewXYScaler.y = scopesOverviewXYScaler.restorePosition.y -(tempScopeItem.height - tempScopeItem.height * v) / 2; | ||
2123 | 522 | } else { | ||
2124 | 523 | scopesOverviewXYScaler.x = 0; | ||
2125 | 524 | scopesOverviewXYScaler.y = 0; | ||
2126 | 525 | } | ||
2127 | 526 | scopesOverviewXYScaler.opacity = 0; | ||
2128 | 527 | middleItems.overrideOpacity = -1; | ||
2129 | 528 | } | ||
2130 | 529 | } | ||
2131 | 530 | } | ||
2132 | 531 | } | ||
2133 | 0 | 532 | ||
2134 | === added file 'qml/Dash/ScopesOverviewAll.qml' | |||
2135 | --- qml/Dash/ScopesOverviewAll.qml 1970-01-01 00:00:00 +0000 | |||
2136 | +++ qml/Dash/ScopesOverviewAll.qml 2014-08-08 14:57:17 +0000 | |||
2137 | @@ -0,0 +1,54 @@ | |||
2138 | 1 | /* | ||
2139 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
2140 | 3 | * | ||
2141 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2142 | 5 | * it under the terms of the GNU General Public License as published by | ||
2143 | 6 | * the Free Software Foundation; version 3. | ||
2144 | 7 | * | ||
2145 | 8 | * This program is distributed in the hope that it will be useful, | ||
2146 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2147 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2148 | 11 | * GNU General Public License for more details. | ||
2149 | 12 | * | ||
2150 | 13 | * You should have received a copy of the GNU General Public License | ||
2151 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2152 | 15 | */ | ||
2153 | 16 | |||
2154 | 17 | import QtQuick 2.0 | ||
2155 | 18 | import Ubuntu.Components 0.1 | ||
2156 | 19 | |||
2157 | 20 | Flickable { | ||
2158 | 21 | id: root | ||
2159 | 22 | |||
2160 | 23 | property alias model: cardGrid.model | ||
2161 | 24 | property alias cardTool: cardGrid.cardTool | ||
2162 | 25 | |||
2163 | 26 | property real extraHeight: 0 | ||
2164 | 27 | |||
2165 | 28 | signal clicked(int index, var result, var item, var itemModel) | ||
2166 | 29 | signal pressAndHold(int index) | ||
2167 | 30 | |||
2168 | 31 | contentHeight: cardGrid.expandedHeight + extraHeight | ||
2169 | 32 | contentWidth: cardGrid.width | ||
2170 | 33 | flickableDirection: Flickable.VerticalFlick | ||
2171 | 34 | |||
2172 | 35 | function scopeCardPosition(scopeId) { | ||
2173 | 36 | var index = model.scopeIndex(scopeId); | ||
2174 | 37 | var pos = cardGrid.cardPosition(index); | ||
2175 | 38 | pos.y = pos.y - root.contentY; | ||
2176 | 39 | return pos; | ||
2177 | 40 | } | ||
2178 | 41 | |||
2179 | 42 | CardGrid { | ||
2180 | 43 | id: cardGrid | ||
2181 | 44 | width: root.width | ||
2182 | 45 | height: parent.height | ||
2183 | 46 | |||
2184 | 47 | onClicked: { | ||
2185 | 48 | root.clicked(index, result, item, itemModel); | ||
2186 | 49 | } | ||
2187 | 50 | onPressAndHold: { | ||
2188 | 51 | root.pressAndHold(index); | ||
2189 | 52 | } | ||
2190 | 53 | } | ||
2191 | 54 | } | ||
2192 | 0 | 55 | ||
2193 | === added file 'qml/Dash/ScopesOverviewFavorites.qml' | |||
2194 | --- qml/Dash/ScopesOverviewFavorites.qml 1970-01-01 00:00:00 +0000 | |||
2195 | +++ qml/Dash/ScopesOverviewFavorites.qml 2014-08-08 14:57:17 +0000 | |||
2196 | @@ -0,0 +1,73 @@ | |||
2197 | 1 | /* | ||
2198 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
2199 | 3 | * | ||
2200 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2201 | 5 | * it under the terms of the GNU General Public License as published by | ||
2202 | 6 | * the Free Software Foundation; version 3. | ||
2203 | 7 | * | ||
2204 | 8 | * This program is distributed in the hope that it will be useful, | ||
2205 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2206 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2207 | 11 | * GNU General Public License for more details. | ||
2208 | 12 | * | ||
2209 | 13 | * You should have received a copy of the GNU General Public License | ||
2210 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2211 | 15 | */ | ||
2212 | 16 | |||
2213 | 17 | import QtQuick 2.0 | ||
2214 | 18 | |||
2215 | 19 | Flickable { | ||
2216 | 20 | id: root | ||
2217 | 21 | |||
2218 | 22 | signal clicked(int index, var result, var itemModel) | ||
2219 | 23 | signal pressAndHold(int index) | ||
2220 | 24 | |||
2221 | 25 | property var cardTool: null | ||
2222 | 26 | property real scopeHeight: 0 | ||
2223 | 27 | property real scopeWidth: 0 | ||
2224 | 28 | property real appliedScale: 1 | ||
2225 | 29 | property int currentIndex: -1 | ||
2226 | 30 | property var currentItem: currentIndex < repeater.count ? repeater.itemAt(currentIndex) : null | ||
2227 | 31 | |||
2228 | 32 | property alias model: repeater.model | ||
2229 | 33 | |||
2230 | 34 | contentHeight: height | ||
2231 | 35 | contentWidth: repeater.count * root.scopeWidth + units.gu(2) / appliedScale * (repeater.count - 1) | ||
2232 | 36 | |||
2233 | 37 | contentX: { | ||
2234 | 38 | var indexX = currentIndex * scopeWidth + units.gu(2) / appliedScale * currentIndex; | ||
2235 | 39 | var newContentX = indexX - (width - scopeWidth) / 2; | ||
2236 | 40 | newContentX = Math.min(Math.max(newContentX, 0), contentWidth - width); | ||
2237 | 41 | return newContentX; | ||
2238 | 42 | } | ||
2239 | 43 | |||
2240 | 44 | Repeater { | ||
2241 | 45 | id: repeater | ||
2242 | 46 | objectName: "scopesOverviewFavoritesRepeater" | ||
2243 | 47 | |||
2244 | 48 | delegate: Loader { | ||
2245 | 49 | id: loader | ||
2246 | 50 | |||
2247 | 51 | x: index * root.scopeWidth + units.gu(2) / appliedScale * index | ||
2248 | 52 | asynchronous: true | ||
2249 | 53 | |||
2250 | 54 | sourceComponent: cardTool.cardComponent | ||
2251 | 55 | onLoaded: { | ||
2252 | 56 | item.fixedArtShapeSize = Qt.binding(function() { return Qt.size(root.scopeWidth, root.scopeHeight); }); | ||
2253 | 57 | item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight / appliedScale; }); | ||
2254 | 58 | item.fontScale = Qt.binding(function() { return 1 / appliedScale; }); | ||
2255 | 59 | item.height = Qt.binding(function() { return root.scopeHeight; }); | ||
2256 | 60 | item.width = Qt.binding(function() { return root.scopeWidth; }); | ||
2257 | 61 | item.cardData = Qt.binding(function() { return model; }); | ||
2258 | 62 | item.template = Qt.binding(function() { return cardTool.template; }); | ||
2259 | 63 | item.components = Qt.binding(function() { return cardTool.components; }); | ||
2260 | 64 | item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; }); | ||
2261 | 65 | } | ||
2262 | 66 | |||
2263 | 67 | Connections { | ||
2264 | 68 | target: loader.item | ||
2265 | 69 | onClicked: root.clicked(index, result, model) | ||
2266 | 70 | } | ||
2267 | 71 | } | ||
2268 | 72 | } | ||
2269 | 73 | } | ||
2270 | 0 | 74 | ||
2271 | === added file 'qml/Dash/ScopesOverviewTab.qml' | |||
2272 | --- qml/Dash/ScopesOverviewTab.qml 1970-01-01 00:00:00 +0000 | |||
2273 | +++ qml/Dash/ScopesOverviewTab.qml 2014-08-08 14:57:17 +0000 | |||
2274 | @@ -0,0 +1,74 @@ | |||
2275 | 1 | /* | ||
2276 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
2277 | 3 | * | ||
2278 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2279 | 5 | * it under the terms of the GNU General Public License as published by | ||
2280 | 6 | * the Free Software Foundation; version 3. | ||
2281 | 7 | * | ||
2282 | 8 | * This program is distributed in the hope that it will be useful, | ||
2283 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2284 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2285 | 11 | * GNU General Public License for more details. | ||
2286 | 12 | * | ||
2287 | 13 | * You should have received a copy of the GNU General Public License | ||
2288 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2289 | 15 | */ | ||
2290 | 16 | |||
2291 | 17 | import QtQuick 2.3 | ||
2292 | 18 | import Ubuntu.Components 0.1 | ||
2293 | 19 | |||
2294 | 20 | Item { | ||
2295 | 21 | id: root | ||
2296 | 22 | |||
2297 | 23 | property int currentTab: 0 | ||
2298 | 24 | |||
2299 | 25 | AbstractButton { | ||
2300 | 26 | id: tab1 | ||
2301 | 27 | height: parent.height | ||
2302 | 28 | width: parent.width / 2 | ||
2303 | 29 | Rectangle { | ||
2304 | 30 | anchors.fill: parent | ||
2305 | 31 | color: root.currentTab == 0 && root.enabled ? "white" : "transparent" | ||
2306 | 32 | radius: units.dp(10) | ||
2307 | 33 | } | ||
2308 | 34 | Label { | ||
2309 | 35 | anchors.centerIn: parent | ||
2310 | 36 | text: i18n.tr("Favorites") | ||
2311 | 37 | color: root.currentTab == 0 && root.enabled ? "black" : "white" | ||
2312 | 38 | } | ||
2313 | 39 | onClicked: root.currentTab = 0 | ||
2314 | 40 | } | ||
2315 | 41 | AbstractButton { | ||
2316 | 42 | id: tab2 | ||
2317 | 43 | objectName: "scopesOverviewAllTabButton" | ||
2318 | 44 | x: width | ||
2319 | 45 | height: parent.height | ||
2320 | 46 | width: parent.width / 2 | ||
2321 | 47 | Rectangle { | ||
2322 | 48 | anchors.fill: parent | ||
2323 | 49 | color: root.currentTab == 1 && root.enabled ? "white" : "transparent" | ||
2324 | 50 | radius: units.dp(10) | ||
2325 | 51 | } | ||
2326 | 52 | Label { | ||
2327 | 53 | anchors.centerIn: parent | ||
2328 | 54 | text: i18n.tr("All") | ||
2329 | 55 | color: root.currentTab == 1 && root.enabled ? "black" : "white" | ||
2330 | 56 | } | ||
2331 | 57 | onClicked: root.currentTab = 1 | ||
2332 | 58 | } | ||
2333 | 59 | Rectangle { | ||
2334 | 60 | id: centerPiece | ||
2335 | 61 | width: root.enabled ? units.dp(10) : units.dp(1) | ||
2336 | 62 | height: parent.height | ||
2337 | 63 | color: "white" | ||
2338 | 64 | x: root.currentTab == 1 ? tab2.x : tab2.x - width | ||
2339 | 65 | } | ||
2340 | 66 | Rectangle { | ||
2341 | 67 | id: border | ||
2342 | 68 | anchors.fill: parent | ||
2343 | 69 | radius: units.dp(10) | ||
2344 | 70 | color: "transparent" | ||
2345 | 71 | border.color: centerPiece.color | ||
2346 | 72 | border.width: units.dp(1) | ||
2347 | 73 | } | ||
2348 | 74 | } | ||
2349 | 0 | 75 | ||
2350 | === added file 'qml/Dash/graphics/dark_background.jpg' | |||
2351 | 1 | Binary 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 | 76 | Binary 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 |
2352 | === added file 'qml/Dash/graphics/overview_hint@27.png' | |||
2353 | 2 | Binary 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 | 77 | Binary 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 |
2354 | === modified file 'tests/autopilot/unity8/shell/tests/test_emulators.py' | |||
2355 | --- tests/autopilot/unity8/shell/tests/test_emulators.py 2014-07-30 20:01:30 +0000 | |||
2356 | +++ tests/autopilot/unity8/shell/tests/test_emulators.py 2014-08-08 14:57:17 +0000 | |||
2357 | @@ -122,7 +122,7 @@ | |||
2358 | 122 | self._assert_scope_is_opened(scope, scope_id) | 122 | self._assert_scope_is_opened(scope, scope_id) |
2359 | 123 | 123 | ||
2360 | 124 | def test_open_generic_scope(self): | 124 | def test_open_generic_scope(self): |
2362 | 125 | scope_id = 'scopes' | 125 | scope_id = 'musicaggregator' |
2363 | 126 | scope = self.dash.open_scope(scope_id) | 126 | scope = self.dash.open_scope(scope_id) |
2364 | 127 | self._assert_scope_is_opened(scope, scope_id) | 127 | self._assert_scope_is_opened(scope, scope_id) |
2365 | 128 | self.assertIsInstance(scope, dash_emulators.GenericScopeView) | 128 | self.assertIsInstance(scope, dash_emulators.GenericScopeView) |
2366 | 129 | 129 | ||
2367 | === modified file 'tests/mocks/Unity/CMakeLists.txt' | |||
2368 | --- tests/mocks/Unity/CMakeLists.txt 2014-08-06 19:38:57 +0000 | |||
2369 | +++ tests/mocks/Unity/CMakeLists.txt 2014-08-08 14:57:17 +0000 | |||
2370 | @@ -22,6 +22,7 @@ | |||
2371 | 22 | set(UnityQML_SOURCES | 22 | set(UnityQML_SOURCES |
2372 | 23 | fake_scope.cpp | 23 | fake_scope.cpp |
2373 | 24 | fake_scopes.cpp | 24 | fake_scopes.cpp |
2374 | 25 | fake_scopesoverview.cpp | ||
2375 | 25 | fake_categories.cpp | 26 | fake_categories.cpp |
2376 | 26 | fake_navigation.cpp | 27 | fake_navigation.cpp |
2377 | 27 | fake_resultsmodel.cpp | 28 | fake_resultsmodel.cpp |
2378 | 28 | 29 | ||
2379 | === modified file 'tests/mocks/Unity/fake_categories.cpp' | |||
2380 | --- tests/mocks/Unity/fake_categories.cpp 2014-07-18 11:35:47 +0000 | |||
2381 | +++ tests/mocks/Unity/fake_categories.cpp 2014-08-08 14:57:17 +0000 | |||
2382 | @@ -109,11 +109,13 @@ | |||
2383 | 109 | } | 109 | } |
2384 | 110 | case RoleComponents: | 110 | case RoleComponents: |
2385 | 111 | { | 111 | { |
2387 | 112 | QVariantMap map, artMap; | 112 | QVariantMap map, artMap, attributeMap; |
2388 | 113 | artMap["aspect-ratio"] = "1.0"; | 113 | artMap["aspect-ratio"] = "1.0"; |
2389 | 114 | artMap["field"] = "art"; | 114 | artMap["field"] = "art"; |
2390 | 115 | map["art"] = artMap; | 115 | map["art"] = artMap; |
2391 | 116 | map["title"] = "HOLA"; | 116 | map["title"] = "HOLA"; |
2392 | 117 | attributeMap["field"] = "attribute"; | ||
2393 | 118 | map["attributes"] = attributeMap; | ||
2394 | 117 | return map; | 119 | return map; |
2395 | 118 | } | 120 | } |
2396 | 119 | case RoleHeaderLink: | 121 | case RoleHeaderLink: |
2397 | @@ -156,7 +158,7 @@ | |||
2398 | 156 | } | 158 | } |
2399 | 157 | case RoleComponents: | 159 | case RoleComponents: |
2400 | 158 | { | 160 | { |
2402 | 159 | QVariantMap map, artMap; | 161 | QVariantMap map, artMap, attributeMap; |
2403 | 160 | if (index.row() % 2 != 0) { | 162 | if (index.row() % 2 != 0) { |
2404 | 161 | artMap["aspect-ratio"] = QString("1.%1").arg(index.row()); | 163 | artMap["aspect-ratio"] = QString("1.%1").arg(index.row()); |
2405 | 162 | } else { | 164 | } else { |
2406 | @@ -166,6 +168,8 @@ | |||
2407 | 166 | map["art"] = artMap; | 168 | map["art"] = artMap; |
2408 | 167 | map["title"] = "HOLA"; | 169 | map["title"] = "HOLA"; |
2409 | 168 | map["subtitle"] = "HOLA"; | 170 | map["subtitle"] = "HOLA"; |
2410 | 171 | attributeMap["field"] = "attribute"; | ||
2411 | 172 | map["attributes"] = attributeMap; | ||
2412 | 169 | return map; | 173 | return map; |
2413 | 170 | } | 174 | } |
2414 | 171 | case RoleHeaderLink: | 175 | case RoleHeaderLink: |
2415 | 172 | 176 | ||
2416 | === modified file 'tests/mocks/Unity/fake_resultsmodel.cpp' | |||
2417 | --- tests/mocks/Unity/fake_resultsmodel.cpp 2014-05-20 10:29:20 +0000 | |||
2418 | +++ tests/mocks/Unity/fake_resultsmodel.cpp 2014-08-08 14:57:17 +0000 | |||
2419 | @@ -58,8 +58,9 @@ | |||
2420 | 58 | case RoleUri: | 58 | case RoleUri: |
2421 | 59 | case RoleCategoryId: | 59 | case RoleCategoryId: |
2422 | 60 | case RoleDndUri: | 60 | case RoleDndUri: |
2423 | 61 | return QString(); | ||
2424 | 61 | case RoleResult: | 62 | case RoleResult: |
2426 | 62 | return QString(); | 63 | return QString("Result.%1.%2").arg(m_categoryId).arg(index.row()); |
2427 | 63 | case RoleTitle: | 64 | case RoleTitle: |
2428 | 64 | return QString("Title.%1.%2").arg(m_categoryId).arg(index.row()); | 65 | return QString("Title.%1.%2").arg(m_categoryId).arg(index.row()); |
2429 | 65 | case RoleArt: | 66 | case RoleArt: |
2430 | 66 | 67 | ||
2431 | === modified file 'tests/mocks/Unity/fake_scope.cpp' | |||
2432 | --- tests/mocks/Unity/fake_scope.cpp 2014-08-06 10:03:55 +0000 | |||
2433 | +++ tests/mocks/Unity/fake_scope.cpp 2014-08-08 14:57:17 +0000 | |||
2434 | @@ -18,14 +18,16 @@ | |||
2435 | 18 | #include <QUrl> | 18 | #include <QUrl> |
2436 | 19 | 19 | ||
2437 | 20 | #include "fake_scope.h" | 20 | #include "fake_scope.h" |
2438 | 21 | |||
2439 | 21 | #include "fake_navigation.h" | 22 | #include "fake_navigation.h" |
2440 | 22 | #include "fake_resultsmodel.h" | 23 | #include "fake_resultsmodel.h" |
2441 | 24 | #include "fake_scopes.h" | ||
2442 | 23 | 25 | ||
2444 | 24 | Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent) | 26 | Scope::Scope(Scopes* parent) : Scope(QString(), QString(), false, parent) |
2445 | 25 | { | 27 | { |
2446 | 26 | } | 28 | } |
2447 | 27 | 29 | ||
2449 | 28 | Scope::Scope(QString const& id, QString const& name, bool favorite, QObject* parent, int categories) | 30 | Scope::Scope(QString const& id, QString const& name, bool favorite, Scopes* parent, int categories) |
2450 | 29 | : unity::shell::scopes::ScopeInterface(parent) | 31 | : unity::shell::scopes::ScopeInterface(parent) |
2451 | 30 | , m_id(id) | 32 | , m_id(id) |
2452 | 31 | , m_name(name) | 33 | , m_name(name) |
2453 | @@ -36,6 +38,7 @@ | |||
2454 | 36 | , m_currentAltNavigationId("altroot") | 38 | , m_currentAltNavigationId("altroot") |
2455 | 37 | , m_previewRendererName("preview-generic") | 39 | , m_previewRendererName("preview-generic") |
2456 | 38 | , m_categories(new Categories(categories, this)) | 40 | , m_categories(new Categories(categories, this)) |
2457 | 41 | , m_openScope(nullptr) | ||
2458 | 39 | { | 42 | { |
2459 | 40 | } | 43 | } |
2460 | 41 | 44 | ||
2461 | @@ -158,7 +161,12 @@ | |||
2462 | 158 | 161 | ||
2463 | 159 | void Scope::activate(QVariant const& result) | 162 | void Scope::activate(QVariant const& result) |
2464 | 160 | { | 163 | { |
2466 | 161 | Q_UNUSED(result); | 164 | qDebug() << "Called activate on scope" << m_id << "with result" << result; |
2467 | 165 | if (result.toString() == "Result.2.2") { | ||
2468 | 166 | Scopes *scopes = dynamic_cast<Scopes*>(parent()); | ||
2469 | 167 | m_openScope = scopes->getScopeFromAll("MockScope9"); | ||
2470 | 168 | Q_EMIT openScope(m_openScope); | ||
2471 | 169 | } | ||
2472 | 162 | } | 170 | } |
2473 | 163 | 171 | ||
2474 | 164 | PreviewStack* Scope::preview(QVariant const& result) | 172 | PreviewStack* Scope::preview(QVariant const& result) |
2475 | @@ -174,9 +182,13 @@ | |||
2476 | 174 | { | 182 | { |
2477 | 175 | } | 183 | } |
2478 | 176 | 184 | ||
2480 | 177 | void Scope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/) | 185 | void Scope::closeScope(unity::shell::scopes::ScopeInterface* scope) |
2481 | 178 | { | 186 | { |
2483 | 179 | qFatal("Scope::closeScope is not implemented"); | 187 | if (scope != m_openScope) { |
2484 | 188 | qDebug() << scope << m_openScope; | ||
2485 | 189 | qFatal("Scope::closeScope got wrong scope in closeScope"); | ||
2486 | 190 | } | ||
2487 | 191 | m_openScope = nullptr; | ||
2488 | 180 | } | 192 | } |
2489 | 181 | 193 | ||
2490 | 182 | QString Scope::currentNavigationId() const | 194 | QString Scope::currentNavigationId() const |
2491 | 183 | 195 | ||
2492 | === modified file 'tests/mocks/Unity/fake_scope.h' | |||
2493 | --- tests/mocks/Unity/fake_scope.h 2014-08-06 10:03:55 +0000 | |||
2494 | +++ tests/mocks/Unity/fake_scope.h 2014-08-08 14:57:17 +0000 | |||
2495 | @@ -24,13 +24,15 @@ | |||
2496 | 24 | 24 | ||
2497 | 25 | #include <QTimer> | 25 | #include <QTimer> |
2498 | 26 | 26 | ||
2499 | 27 | class Scopes; | ||
2500 | 28 | |||
2501 | 27 | class Scope : public unity::shell::scopes::ScopeInterface | 29 | class Scope : public unity::shell::scopes::ScopeInterface |
2502 | 28 | { | 30 | { |
2503 | 29 | Q_OBJECT | 31 | Q_OBJECT |
2504 | 30 | 32 | ||
2505 | 31 | public: | 33 | public: |
2508 | 32 | Scope(QObject* parent = 0); | 34 | Scope(Scopes* parent = 0); |
2509 | 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); |
2510 | 34 | 36 | ||
2511 | 35 | /* getters */ | 37 | /* getters */ |
2512 | 36 | QString id() const override; | 38 | QString id() const override; |
2513 | @@ -92,7 +94,8 @@ | |||
2514 | 92 | 94 | ||
2515 | 93 | QString m_previewRendererName; | 95 | QString m_previewRendererName; |
2516 | 94 | 96 | ||
2518 | 95 | Categories* m_categories; | 97 | unity::shell::scopes::CategoriesInterface* m_categories; |
2519 | 98 | unity::shell::scopes::ScopeInterface* m_openScope; | ||
2520 | 96 | }; | 99 | }; |
2521 | 97 | 100 | ||
2522 | 98 | #endif // FAKE_SCOPE_H | 101 | #endif // FAKE_SCOPE_H |
2523 | 99 | 102 | ||
2524 | === modified file 'tests/mocks/Unity/fake_scopes.cpp' | |||
2525 | --- tests/mocks/Unity/fake_scopes.cpp 2014-08-06 19:38:57 +0000 | |||
2526 | +++ tests/mocks/Unity/fake_scopes.cpp 2014-08-08 14:57:17 +0000 | |||
2527 | @@ -18,6 +18,7 @@ | |||
2528 | 18 | 18 | ||
2529 | 19 | // Self | 19 | // Self |
2530 | 20 | #include "fake_scopes.h" | 20 | #include "fake_scopes.h" |
2531 | 21 | #include "fake_scopesoverview.h" | ||
2532 | 21 | 22 | ||
2533 | 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) |
2534 | 23 | 24 | ||
2535 | @@ -26,6 +27,7 @@ | |||
2536 | 26 | 27 | ||
2537 | 27 | Scopes::Scopes(QObject *parent) | 28 | Scopes::Scopes(QObject *parent) |
2538 | 28 | : unity::shell::scopes::ScopesInterface(parent) | 29 | : unity::shell::scopes::ScopesInterface(parent) |
2539 | 30 | , m_scopesOverview(nullptr) | ||
2540 | 29 | , m_loaded(false) | 31 | , m_loaded(false) |
2541 | 30 | , timer(this) | 32 | , timer(this) |
2542 | 31 | { | 33 | { |
2543 | @@ -52,10 +54,17 @@ | |||
2544 | 52 | addScope(new Scope("clickscope", "Apps", true, this)); | 54 | addScope(new Scope("clickscope", "Apps", true, this)); |
2545 | 53 | addScope(new Scope("MockScope5", "Videos", true, this)); | 55 | addScope(new Scope("MockScope5", "Videos", true, this)); |
2546 | 54 | addScope(new Scope("SingleCategoryScope", "Single", true, this, 1)); | 56 | addScope(new Scope("SingleCategoryScope", "Single", true, this, 1)); |
2547 | 57 | addScope(new Scope("MockScope4", "MS4", true, this)); | ||
2548 | 58 | addScope(new Scope("MockScope6", "MS6", true, this)); | ||
2549 | 59 | addScope(new Scope("MockScope7", "MS7", false, this)); | ||
2550 | 60 | addScope(new Scope("MockScope8", "MS8", false, this)); | ||
2551 | 61 | addScope(new Scope("MockScope9", "MS9", false, this)); | ||
2552 | 62 | m_scopesOverview = new ScopesOverview(this); | ||
2553 | 55 | 63 | ||
2554 | 56 | if (!m_loaded) { | 64 | if (!m_loaded) { |
2555 | 57 | m_loaded = true; | 65 | m_loaded = true; |
2556 | 58 | Q_EMIT loadedChanged(); | 66 | Q_EMIT loadedChanged(); |
2557 | 67 | Q_EMIT overviewScopeChanged(); | ||
2558 | 59 | } | 68 | } |
2559 | 60 | } | 69 | } |
2560 | 61 | 70 | ||
2561 | @@ -64,10 +73,13 @@ | |||
2562 | 64 | timer.stop(); | 73 | timer.stop(); |
2563 | 65 | if (m_scopes.size() > 0) { | 74 | if (m_scopes.size() > 0) { |
2564 | 66 | beginRemoveRows(QModelIndex(), 0, m_scopes.count()-1); | 75 | beginRemoveRows(QModelIndex(), 0, m_scopes.count()-1); |
2566 | 67 | qDeleteAll(m_scopes); | 76 | qDeleteAll(m_allScopes); |
2567 | 77 | m_allScopes.clear(); | ||
2568 | 68 | m_scopes.clear(); | 78 | m_scopes.clear(); |
2569 | 69 | endRemoveRows(); | 79 | endRemoveRows(); |
2570 | 70 | } | 80 | } |
2571 | 81 | delete m_scopesOverview; | ||
2572 | 82 | m_scopesOverview = nullptr; | ||
2573 | 71 | 83 | ||
2574 | 72 | if (m_loaded) { | 84 | if (m_loaded) { |
2575 | 73 | m_loaded = false; | 85 | m_loaded = false; |
2576 | @@ -113,8 +125,22 @@ | |||
2577 | 113 | return m_scopes[row]; | 125 | return m_scopes[row]; |
2578 | 114 | } | 126 | } |
2579 | 115 | 127 | ||
2582 | 116 | unity::shell::scopes::ScopeInterface* Scopes::getScope(QString const&) const | 128 | unity::shell::scopes::ScopeInterface* Scopes::getScope(QString const &scope_id) const |
2583 | 117 | { | 129 | { |
2584 | 130 | // According to mh3 Scopes::getScope should only return favorite scopes (i.e the ones in the model) | ||
2585 | 131 | for (Scope *scope : m_scopes) { | ||
2586 | 132 | if (scope->id() == scope_id) | ||
2587 | 133 | return scope; | ||
2588 | 134 | } | ||
2589 | 135 | return nullptr; | ||
2590 | 136 | } | ||
2591 | 137 | |||
2592 | 138 | Scope* Scopes::getScopeFromAll(const QString& scope_id) const | ||
2593 | 139 | { | ||
2594 | 140 | for (Scope *scope : m_allScopes) { | ||
2595 | 141 | if (scope->id() == scope_id) | ||
2596 | 142 | return scope; | ||
2597 | 143 | } | ||
2598 | 118 | return nullptr; | 144 | return nullptr; |
2599 | 119 | } | 145 | } |
2600 | 120 | 146 | ||
2601 | @@ -135,13 +161,26 @@ | |||
2602 | 135 | 161 | ||
2603 | 136 | unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const | 162 | unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const |
2604 | 137 | { | 163 | { |
2606 | 138 | return nullptr; | 164 | return m_scopesOverview; |
2607 | 165 | } | ||
2608 | 166 | |||
2609 | 167 | QList<Scope*> Scopes::scopes() const | ||
2610 | 168 | { | ||
2611 | 169 | return m_scopes; | ||
2612 | 170 | } | ||
2613 | 171 | |||
2614 | 172 | QList<Scope*> Scopes::allScopes() const | ||
2615 | 173 | { | ||
2616 | 174 | return m_allScopes; | ||
2617 | 139 | } | 175 | } |
2618 | 140 | 176 | ||
2619 | 141 | void Scopes::addScope(Scope* scope) | 177 | void Scopes::addScope(Scope* scope) |
2620 | 142 | { | 178 | { |
2621 | 143 | int index = rowCount(); | 179 | int index = rowCount(); |
2625 | 144 | beginInsertRows(QModelIndex(), index, index); | 180 | if (scope->favorite()) { |
2626 | 145 | m_scopes.append(scope); | 181 | beginInsertRows(QModelIndex(), index, index); |
2627 | 146 | endInsertRows(); | 182 | m_scopes.append(scope); |
2628 | 183 | endInsertRows(); | ||
2629 | 184 | } | ||
2630 | 185 | m_allScopes.append(scope); | ||
2631 | 147 | } | 186 | } |
2632 | 148 | 187 | ||
2633 | === modified file 'tests/mocks/Unity/fake_scopes.h' | |||
2634 | --- tests/mocks/Unity/fake_scopes.h 2014-08-06 19:38:57 +0000 | |||
2635 | +++ tests/mocks/Unity/fake_scopes.h 2014-08-08 14:57:17 +0000 | |||
2636 | @@ -53,11 +53,18 @@ | |||
2637 | 53 | int count() const override; | 53 | int count() const override; |
2638 | 54 | unity::shell::scopes::ScopeInterface* overviewScope() const override; | 54 | unity::shell::scopes::ScopeInterface* overviewScope() const override; |
2639 | 55 | 55 | ||
2640 | 56 | // This is used as part of implementation of the other C++ code, not API | ||
2641 | 57 | QList<Scope*> scopes() const; | ||
2642 | 58 | QList<Scope*> allScopes() const; | ||
2643 | 59 | Scope* getScopeFromAll(const QString& scope_id) const; | ||
2644 | 60 | |||
2645 | 56 | private Q_SLOTS: | 61 | private Q_SLOTS: |
2646 | 57 | void updateScopes(); | 62 | void updateScopes(); |
2647 | 58 | 63 | ||
2648 | 59 | private: | 64 | private: |
2650 | 60 | QList<Scope*> m_scopes; | 65 | QList<Scope*> m_scopes; // the favorite ones |
2651 | 66 | QList<Scope*> m_allScopes; | ||
2652 | 67 | Scope *m_scopesOverview; | ||
2653 | 61 | bool m_loaded; | 68 | bool m_loaded; |
2654 | 62 | QTimer timer; | 69 | QTimer timer; |
2655 | 63 | }; | 70 | }; |
2656 | 64 | 71 | ||
2657 | === added file 'tests/mocks/Unity/fake_scopesoverview.cpp' | |||
2658 | --- tests/mocks/Unity/fake_scopesoverview.cpp 1970-01-01 00:00:00 +0000 | |||
2659 | +++ tests/mocks/Unity/fake_scopesoverview.cpp 2014-08-08 14:57:17 +0000 | |||
2660 | @@ -0,0 +1,281 @@ | |||
2661 | 1 | /* | ||
2662 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
2663 | 3 | * | ||
2664 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2665 | 5 | * it under the terms of the GNU General Public License as published by | ||
2666 | 6 | * the Free Software Foundation; version 3. | ||
2667 | 7 | * | ||
2668 | 8 | * This program is distributed in the hope that it will be useful, | ||
2669 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2670 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2671 | 11 | * GNU General Public License for more details. | ||
2672 | 12 | * | ||
2673 | 13 | * You should have received a copy of the GNU General Public License | ||
2674 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2675 | 15 | */ | ||
2676 | 16 | |||
2677 | 17 | #include "fake_scopesoverview.h" | ||
2678 | 18 | |||
2679 | 19 | #include "fake_scopes.h" | ||
2680 | 20 | |||
2681 | 21 | #include <paths.h> | ||
2682 | 22 | |||
2683 | 23 | ScopesOverview::ScopesOverview(Scopes* parent) | ||
2684 | 24 | : Scope("scopesOverview", "Scopes Overview", false, parent) | ||
2685 | 25 | { | ||
2686 | 26 | delete m_categories; // delete the usual categories, we're not going to use it | ||
2687 | 27 | m_scopesOverviewCategories = new ScopesOverviewCategories(parent, this); | ||
2688 | 28 | m_searchCategories = new ScopesOverviewSearchCategories(parent, this); | ||
2689 | 29 | m_categories = m_scopesOverviewCategories; | ||
2690 | 30 | } | ||
2691 | 31 | |||
2692 | 32 | void ScopesOverview::setSearchQuery(const QString& search_query) | ||
2693 | 33 | { | ||
2694 | 34 | Scope::setSearchQuery(search_query); | ||
2695 | 35 | |||
2696 | 36 | auto origCategories = m_categories; | ||
2697 | 37 | if (search_query.isEmpty()) m_categories = m_scopesOverviewCategories; | ||
2698 | 38 | else m_categories = m_searchCategories; | ||
2699 | 39 | |||
2700 | 40 | if (m_categories != origCategories) | ||
2701 | 41 | Q_EMIT categoriesChanged(); | ||
2702 | 42 | } | ||
2703 | 43 | |||
2704 | 44 | Q_INVOKABLE void ScopesOverview::activate(QVariant const& result) | ||
2705 | 45 | { | ||
2706 | 46 | Scopes *scopes = dynamic_cast<Scopes*>(parent()); | ||
2707 | 47 | m_openScope = scopes->getScopeFromAll(result.toString()); | ||
2708 | 48 | Q_EMIT openScope(m_openScope); | ||
2709 | 49 | } | ||
2710 | 50 | |||
2711 | 51 | ScopesOverviewCategories::ScopesOverviewCategories(Scopes *scopes, QObject* parent) | ||
2712 | 52 | : unity::shell::scopes::CategoriesInterface(parent) | ||
2713 | 53 | , m_scopes(scopes) | ||
2714 | 54 | { | ||
2715 | 55 | } | ||
2716 | 56 | |||
2717 | 57 | int ScopesOverviewCategories::rowCount(const QModelIndex& /*parent*/) const | ||
2718 | 58 | { | ||
2719 | 59 | return 2; | ||
2720 | 60 | } | ||
2721 | 61 | |||
2722 | 62 | void ScopesOverviewCategories::addSpecialCategory(QString const&, QString const&, QString const&, QString const&, QObject*) | ||
2723 | 63 | { | ||
2724 | 64 | qFatal("Using un-implemented ScopesOverviewCategories::addSpecialCategory"); | ||
2725 | 65 | } | ||
2726 | 66 | |||
2727 | 67 | bool ScopesOverviewCategories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */) | ||
2728 | 68 | { | ||
2729 | 69 | qFatal("Using un-implemented ScopesOverviewCategories::overrideCategoryJson"); | ||
2730 | 70 | } | ||
2731 | 71 | |||
2732 | 72 | QVariant | ||
2733 | 73 | ScopesOverviewCategories::data(const QModelIndex& index, int role) const | ||
2734 | 74 | { | ||
2735 | 75 | if (!index.isValid()) { | ||
2736 | 76 | return QVariant(); | ||
2737 | 77 | } | ||
2738 | 78 | |||
2739 | 79 | const QString categoryId = index.row() == 0 ? "favorites" : "all"; | ||
2740 | 80 | |||
2741 | 81 | unity::shell::scopes::ResultsModelInterface *resultsModel = m_resultsModels[index.row()]; | ||
2742 | 82 | if (!resultsModel) { | ||
2743 | 83 | QObject *that = const_cast<ScopesOverviewCategories*>(this); | ||
2744 | 84 | QList<Scope*> scopes = index.row() == 0 ? m_scopes->scopes() : m_scopes->allScopes(); | ||
2745 | 85 | resultsModel = new ScopesOverviewResultsModel(scopes, categoryId, that); | ||
2746 | 86 | m_resultsModels[index.row()] = resultsModel; | ||
2747 | 87 | } | ||
2748 | 88 | switch (role) { | ||
2749 | 89 | case RoleCategoryId: | ||
2750 | 90 | return categoryId; | ||
2751 | 91 | case RoleName: | ||
2752 | 92 | return index.row() == 0 ? "Favorites" : "All"; | ||
2753 | 93 | case RoleIcon: | ||
2754 | 94 | return QVariant(); | ||
2755 | 95 | case RoleRawRendererTemplate: | ||
2756 | 96 | qFatal("Using un-implemented RoleRawRendererTemplate Categories role"); | ||
2757 | 97 | return QVariant(); | ||
2758 | 98 | case RoleRenderer: | ||
2759 | 99 | { | ||
2760 | 100 | QVariantMap map; | ||
2761 | 101 | map["category-layout"] = "grid"; | ||
2762 | 102 | map["card-size"] = "small"; | ||
2763 | 103 | map["overlay"] = true; | ||
2764 | 104 | return map; | ||
2765 | 105 | } | ||
2766 | 106 | case RoleComponents: | ||
2767 | 107 | { | ||
2768 | 108 | QVariantMap map, artMap; | ||
2769 | 109 | artMap["aspect-ratio"] = "0.5"; | ||
2770 | 110 | artMap["field"] = "art"; | ||
2771 | 111 | map["art"] = artMap; | ||
2772 | 112 | map["title"] = "HOLA"; | ||
2773 | 113 | return map; | ||
2774 | 114 | } | ||
2775 | 115 | case RoleResults: | ||
2776 | 116 | return QVariant::fromValue(resultsModel); | ||
2777 | 117 | case RoleCount: | ||
2778 | 118 | return resultsModel->rowCount(); | ||
2779 | 119 | case RoleHeaderLink: | ||
2780 | 120 | return QString(); | ||
2781 | 121 | default: | ||
2782 | 122 | qFatal("Using un-implemented Categories role"); | ||
2783 | 123 | return QVariant(); | ||
2784 | 124 | } | ||
2785 | 125 | } | ||
2786 | 126 | |||
2787 | 127 | |||
2788 | 128 | |||
2789 | 129 | ScopesOverviewSearchCategories::ScopesOverviewSearchCategories(Scopes *scopes, QObject* parent) | ||
2790 | 130 | : unity::shell::scopes::CategoriesInterface(parent) | ||
2791 | 131 | , m_scopes(scopes) | ||
2792 | 132 | { | ||
2793 | 133 | } | ||
2794 | 134 | |||
2795 | 135 | int ScopesOverviewSearchCategories::rowCount(const QModelIndex& /*parent*/) const | ||
2796 | 136 | { | ||
2797 | 137 | return 2; | ||
2798 | 138 | } | ||
2799 | 139 | |||
2800 | 140 | void ScopesOverviewSearchCategories::addSpecialCategory(QString const&, QString const&, QString const&, QString const&, QObject*) | ||
2801 | 141 | { | ||
2802 | 142 | qFatal("Using un-implemented ScopesOverviewSearchCategories::addSpecialCategory"); | ||
2803 | 143 | } | ||
2804 | 144 | |||
2805 | 145 | bool ScopesOverviewSearchCategories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */) | ||
2806 | 146 | { | ||
2807 | 147 | qFatal("Using un-implemented ScopesOverviewSearchCategories::overrideCategoryJson"); | ||
2808 | 148 | } | ||
2809 | 149 | |||
2810 | 150 | QVariant | ||
2811 | 151 | ScopesOverviewSearchCategories::data(const QModelIndex& index, int role) const | ||
2812 | 152 | { | ||
2813 | 153 | if (!index.isValid()) { | ||
2814 | 154 | return QVariant(); | ||
2815 | 155 | } | ||
2816 | 156 | |||
2817 | 157 | const QString categoryId = index.row() == 0 ? "searchA" : "searchB"; | ||
2818 | 158 | |||
2819 | 159 | unity::shell::scopes::ResultsModelInterface *resultsModel = m_resultsModels[index.row()]; | ||
2820 | 160 | if (!resultsModel) { | ||
2821 | 161 | QObject *that = const_cast<ScopesOverviewSearchCategories*>(this); | ||
2822 | 162 | QList<Scope *> scopes; | ||
2823 | 163 | if (index.row() == 0) { | ||
2824 | 164 | scopes << m_scopes->getScopeFromAll("clickscope") << nullptr << m_scopes->getScopeFromAll("MockScope2"); | ||
2825 | 165 | } else { | ||
2826 | 166 | scopes << nullptr << m_scopes->getScopeFromAll("MockScope7") << nullptr << m_scopes->getScopeFromAll("MockScope1"); | ||
2827 | 167 | } | ||
2828 | 168 | resultsModel = new ScopesOverviewResultsModel(scopes, categoryId, that); | ||
2829 | 169 | m_resultsModels[index.row()] = resultsModel; | ||
2830 | 170 | } | ||
2831 | 171 | switch (role) { | ||
2832 | 172 | case RoleCategoryId: | ||
2833 | 173 | return categoryId; | ||
2834 | 174 | case RoleName: | ||
2835 | 175 | return index.row() == 0 ? "SearchA" : "SearchB"; | ||
2836 | 176 | case RoleIcon: | ||
2837 | 177 | return QVariant(); | ||
2838 | 178 | case RoleRawRendererTemplate: | ||
2839 | 179 | qFatal("Using un-implemented RoleRawRendererTemplate Categories role"); | ||
2840 | 180 | return QVariant(); | ||
2841 | 181 | case RoleRenderer: | ||
2842 | 182 | { | ||
2843 | 183 | QVariantMap map; | ||
2844 | 184 | map["category-layout"] = "grid"; | ||
2845 | 185 | map["card-size"] = "small"; | ||
2846 | 186 | map["overlay"] = true; | ||
2847 | 187 | return map; | ||
2848 | 188 | } | ||
2849 | 189 | case RoleComponents: | ||
2850 | 190 | { | ||
2851 | 191 | QVariantMap map, artMap; | ||
2852 | 192 | artMap["aspect-ratio"] = "1"; | ||
2853 | 193 | artMap["field"] = "art"; | ||
2854 | 194 | map["art"] = artMap; | ||
2855 | 195 | map["title"] = "HOLA"; | ||
2856 | 196 | return map; | ||
2857 | 197 | } | ||
2858 | 198 | case RoleResults: | ||
2859 | 199 | return QVariant::fromValue(resultsModel); | ||
2860 | 200 | case RoleCount: | ||
2861 | 201 | return resultsModel->rowCount(); | ||
2862 | 202 | case RoleHeaderLink: | ||
2863 | 203 | return QString(); | ||
2864 | 204 | default: | ||
2865 | 205 | qFatal("Using un-implemented Categories role"); | ||
2866 | 206 | return QVariant(); | ||
2867 | 207 | } | ||
2868 | 208 | } | ||
2869 | 209 | |||
2870 | 210 | |||
2871 | 211 | ScopesOverviewResultsModel::ScopesOverviewResultsModel(const QList<Scope *> &scopes, const QString &categoryId, QObject* parent) | ||
2872 | 212 | : unity::shell::scopes::ResultsModelInterface(parent) | ||
2873 | 213 | , m_scopes(scopes) | ||
2874 | 214 | , m_categoryId(categoryId) | ||
2875 | 215 | { | ||
2876 | 216 | } | ||
2877 | 217 | |||
2878 | 218 | QString ScopesOverviewResultsModel::categoryId() const | ||
2879 | 219 | { | ||
2880 | 220 | return m_categoryId; | ||
2881 | 221 | } | ||
2882 | 222 | |||
2883 | 223 | void ScopesOverviewResultsModel::setCategoryId(QString const& /*id*/) | ||
2884 | 224 | { | ||
2885 | 225 | qFatal("Calling un-implemented ScopesOverviewResultsModel::setCategoryId"); | ||
2886 | 226 | } | ||
2887 | 227 | |||
2888 | 228 | int ScopesOverviewResultsModel::scopeIndex(QString const& id) const | ||
2889 | 229 | { | ||
2890 | 230 | const int scopeCount = count(); | ||
2891 | 231 | for (int i = 0; i < scopeCount; ++i) { | ||
2892 | 232 | if (m_scopes[i]->id() == id) | ||
2893 | 233 | return i; | ||
2894 | 234 | } | ||
2895 | 235 | return -1; | ||
2896 | 236 | } | ||
2897 | 237 | |||
2898 | 238 | QHash<int, QByteArray> ScopesOverviewResultsModel::roleNames() const | ||
2899 | 239 | { | ||
2900 | 240 | QHash<int, QByteArray> roles = unity::shell::scopes::ResultsModelInterface::roleNames(); | ||
2901 | 241 | roles[RoleBackground + 1] = "scopeId"; | ||
2902 | 242 | return roles; | ||
2903 | 243 | } | ||
2904 | 244 | |||
2905 | 245 | int ScopesOverviewResultsModel::rowCount(const QModelIndex& parent) const | ||
2906 | 246 | { | ||
2907 | 247 | Q_UNUSED(parent); | ||
2908 | 248 | |||
2909 | 249 | return m_scopes.count(); | ||
2910 | 250 | } | ||
2911 | 251 | |||
2912 | 252 | int ScopesOverviewResultsModel::count() const | ||
2913 | 253 | { | ||
2914 | 254 | return rowCount(); | ||
2915 | 255 | } | ||
2916 | 256 | |||
2917 | 257 | QVariant | ||
2918 | 258 | ScopesOverviewResultsModel::data(const QModelIndex& index, int role) const | ||
2919 | 259 | { | ||
2920 | 260 | unity::shell::scopes::ScopeInterface *scope = m_scopes[index.row()]; | ||
2921 | 261 | switch (role) { | ||
2922 | 262 | case RoleUri: | ||
2923 | 263 | case RoleCategoryId: | ||
2924 | 264 | case RoleDndUri: | ||
2925 | 265 | return QString(); | ||
2926 | 266 | case RoleResult: | ||
2927 | 267 | return scope ? scope->id() : QString("Result.%1.%2").arg(categoryId()).arg(index.row()); | ||
2928 | 268 | case RoleTitle: | ||
2929 | 269 | return scope ? scope->name() : QString("Title.%1.%2").arg(categoryId()).arg(index.row()); | ||
2930 | 270 | case RoleArt: | ||
2931 | 271 | return qmlDirectory() + "graphics/applicationIcons/dash.png"; | ||
2932 | 272 | case RoleMascot: | ||
2933 | 273 | case RoleEmblem: | ||
2934 | 274 | case RoleSummary: | ||
2935 | 275 | case RoleBackground + 1: // scopeId | ||
2936 | 276 | return scope ? scope->id() : nullptr; | ||
2937 | 277 | break; | ||
2938 | 278 | default: | ||
2939 | 279 | return QVariant(); | ||
2940 | 280 | } | ||
2941 | 281 | } | ||
2942 | 0 | 282 | ||
2943 | === added file 'tests/mocks/Unity/fake_scopesoverview.h' | |||
2944 | --- tests/mocks/Unity/fake_scopesoverview.h 1970-01-01 00:00:00 +0000 | |||
2945 | +++ tests/mocks/Unity/fake_scopesoverview.h 2014-08-08 14:57:17 +0000 | |||
2946 | @@ -0,0 +1,104 @@ | |||
2947 | 1 | /* | ||
2948 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
2949 | 3 | * | ||
2950 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2951 | 5 | * it under the terms of the GNU General Public License as published by | ||
2952 | 6 | * the Free Software Foundation; version 3. | ||
2953 | 7 | * | ||
2954 | 8 | * This program is distributed in the hope that it will be useful, | ||
2955 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2956 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2957 | 11 | * GNU General Public License for more details. | ||
2958 | 12 | * | ||
2959 | 13 | * You should have received a copy of the GNU General Public License | ||
2960 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2961 | 15 | */ | ||
2962 | 16 | |||
2963 | 17 | #ifndef FAKE_SCOPESOVERVIEW_H | ||
2964 | 18 | #define FAKE_SCOPESOVERVIEW_H | ||
2965 | 19 | |||
2966 | 20 | #include "fake_scope.h" | ||
2967 | 21 | #include <unity/shell/scopes/ResultsModelInterface.h> | ||
2968 | 22 | |||
2969 | 23 | class Scopes; | ||
2970 | 24 | |||
2971 | 25 | class ScopesOverview : public Scope | ||
2972 | 26 | { | ||
2973 | 27 | Q_OBJECT | ||
2974 | 28 | |||
2975 | 29 | public: | ||
2976 | 30 | ScopesOverview(Scopes* parent = 0); | ||
2977 | 31 | |||
2978 | 32 | void setSearchQuery(const QString& search_query) override; | ||
2979 | 33 | Q_INVOKABLE void activate(QVariant const& result) override; | ||
2980 | 34 | |||
2981 | 35 | private: | ||
2982 | 36 | unity::shell::scopes::CategoriesInterface *m_scopesOverviewCategories; | ||
2983 | 37 | unity::shell::scopes::CategoriesInterface *m_searchCategories; | ||
2984 | 38 | }; | ||
2985 | 39 | |||
2986 | 40 | class ScopesOverviewCategories : public unity::shell::scopes::CategoriesInterface | ||
2987 | 41 | { | ||
2988 | 42 | Q_OBJECT | ||
2989 | 43 | |||
2990 | 44 | public: | ||
2991 | 45 | ScopesOverviewCategories(Scopes *scopes, QObject* parent = 0); | ||
2992 | 46 | |||
2993 | 47 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||
2994 | 48 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||
2995 | 49 | |||
2996 | 50 | Q_INVOKABLE void addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject) override; | ||
2997 | 51 | Q_INVOKABLE bool overrideCategoryJson(QString const& categoryId, QString const& json) override; | ||
2998 | 52 | |||
2999 | 53 | private: | ||
3000 | 54 | mutable QHash<int, unity::shell::scopes::ResultsModelInterface*> m_resultsModels; | ||
3001 | 55 | |||
3002 | 56 | Scopes *m_scopes; | ||
3003 | 57 | }; | ||
3004 | 58 | |||
3005 | 59 | class ScopesOverviewSearchCategories : public unity::shell::scopes::CategoriesInterface | ||
3006 | 60 | { | ||
3007 | 61 | Q_OBJECT | ||
3008 | 62 | |||
3009 | 63 | public: | ||
3010 | 64 | ScopesOverviewSearchCategories(Scopes *scopes, QObject* parent = 0); | ||
3011 | 65 | |||
3012 | 66 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||
3013 | 67 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||
3014 | 68 | |||
3015 | 69 | Q_INVOKABLE void addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject) override; | ||
3016 | 70 | Q_INVOKABLE bool overrideCategoryJson(QString const& categoryId, QString const& json) override; | ||
3017 | 71 | |||
3018 | 72 | private: | ||
3019 | 73 | mutable QHash<int, unity::shell::scopes::ResultsModelInterface*> m_resultsModels; | ||
3020 | 74 | |||
3021 | 75 | Scopes *m_scopes; | ||
3022 | 76 | }; | ||
3023 | 77 | |||
3024 | 78 | class ScopesOverviewResultsModel : public unity::shell::scopes::ResultsModelInterface | ||
3025 | 79 | { | ||
3026 | 80 | Q_OBJECT | ||
3027 | 81 | |||
3028 | 82 | public: | ||
3029 | 83 | explicit ScopesOverviewResultsModel(const QList<Scope *> &scopes, const QString &categoryId, QObject* parent = 0); | ||
3030 | 84 | |||
3031 | 85 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||
3032 | 86 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||
3033 | 87 | |||
3034 | 88 | /* getters */ | ||
3035 | 89 | QString categoryId() const override; | ||
3036 | 90 | int count() const override; | ||
3037 | 91 | |||
3038 | 92 | /* setters */ | ||
3039 | 93 | void setCategoryId(QString const& id) override; | ||
3040 | 94 | |||
3041 | 95 | /* Special API */ | ||
3042 | 96 | Q_INVOKABLE int scopeIndex(QString const& id) const; | ||
3043 | 97 | QHash<int, QByteArray> roleNames() const override; | ||
3044 | 98 | |||
3045 | 99 | private: | ||
3046 | 100 | QList<Scope *> m_scopes; | ||
3047 | 101 | QString m_categoryId; | ||
3048 | 102 | }; | ||
3049 | 103 | |||
3050 | 104 | #endif // FAKE_SCOPESOVERVIEW_H | ||
3051 | 0 | 105 | ||
3052 | === modified file 'tests/plugins/Dash/cardcreator/1.res' | |||
3053 | --- tests/plugins/Dash/cardcreator/1.res 2014-08-05 22:51:17 +0000 | |||
3054 | +++ tests/plugins/Dash/cardcreator/1.res 2014-08-08 14:57:17 +0000 | |||
3055 | @@ -61,12 +61,12 @@ | |||
3056 | 61 | id: titleLabel; | 61 | id: titleLabel; |
3057 | 62 | objectName: "titleLabel"; | 62 | objectName: "titleLabel"; |
3058 | 63 | anchors { right: parent.right; | 63 | anchors { right: parent.right; |
3065 | 64 | rightMargin: units.gu(1); | 64 | rightMargin: units.gu(1); |
3066 | 65 | left: parent.left; | 65 | left: parent.left; |
3067 | 66 | top: artShapeHolder.bottom; | 66 | top: artShapeHolder.bottom; |
3068 | 67 | topMargin: units.gu(1); | 67 | topMargin: units.gu(1); |
3069 | 68 | leftMargin: units.gu(1); | 68 | leftMargin: units.gu(1); |
3070 | 69 | } | 69 | } |
3071 | 70 | elide: Text.ElideRight; | 70 | elide: Text.ElideRight; |
3072 | 71 | fontSize: "small"; | 71 | fontSize: "small"; |
3073 | 72 | wrapMode: Text.Wrap; | 72 | wrapMode: Text.Wrap; |
3074 | 73 | 73 | ||
3075 | === modified file 'tests/plugins/Dash/cardcreator/1.tst' | |||
3076 | --- tests/plugins/Dash/cardcreator/1.tst 2014-07-28 15:09:45 +0000 | |||
3077 | +++ tests/plugins/Dash/cardcreator/1.tst 2014-08-08 14:57:17 +0000 | |||
3078 | @@ -1,3 +1,3 @@ | |||
3079 | 1 | template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2} | 1 | template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2} |
3081 | 2 | components: {"art":{"aspect-ratio":1.6,"field":"art"},"title":{"field":"title"}} | 2 | components: {"art":{"aspect-ratio":1.6,"field":"art"},"title":{"field":"title"},"attributes":{}} |
3082 | 3 | result: 1.res | 3 | result: 1.res |
3083 | 4 | 4 | ||
3084 | === modified file 'tests/plugins/Dash/cardcreator/2.res' | |||
3085 | --- tests/plugins/Dash/cardcreator/2.res 2014-07-31 13:33:56 +0000 | |||
3086 | +++ tests/plugins/Dash/cardcreator/2.res 2014-08-08 14:57:17 +0000 | |||
3087 | @@ -55,17 +55,19 @@ | |||
3088 | 55 | spacing: margins; | 55 | spacing: margins; |
3089 | 56 | height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; | 56 | height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; |
3090 | 57 | anchors { top: parent.top; | 57 | anchors { top: parent.top; |
3094 | 58 | topMargin: units.gu(1); | 58 | topMargin: units.gu(1); |
3095 | 59 | left: parent.left; | 59 | left: parent.left; |
3096 | 60 | } | 60 | } |
3097 | 61 | anchors.right: parent.right; | 61 | anchors.right: parent.right; |
3098 | 62 | anchors.margins: margins; | 62 | anchors.margins: margins; |
3100 | 63 | data: [ Image { | 63 | anchors.rightMargin: 0; |
3101 | 64 | data: [ | ||
3102 | 65 | Image { | ||
3103 | 64 | id: mascotImage; | 66 | id: mascotImage; |
3104 | 65 | objectName: "mascotImage"; | 67 | objectName: "mascotImage"; |
3105 | 66 | anchors { verticalCenter: parent.verticalCenter; } | 68 | anchors { verticalCenter: parent.verticalCenter; } |
3106 | 67 | readonly property int maxSize: Math.max(width, height) * 4; | 69 | readonly property int maxSize: Math.max(width, height) * 4; |
3108 | 68 | source: cardData && cardData["mascot"]; | 70 | source: cardData && cardData["mascot"] || ""; |
3109 | 69 | width: units.gu(6); | 71 | width: units.gu(6); |
3110 | 70 | height: units.gu(5.625); | 72 | height: units.gu(5.625); |
3111 | 71 | sourceSize { width: maxSize; height: maxSize } | 73 | sourceSize { width: maxSize; height: maxSize } |
3112 | @@ -74,37 +76,43 @@ | |||
3113 | 74 | verticalAlignment: Image.AlignVCenter; | 76 | verticalAlignment: Image.AlignVCenter; |
3114 | 75 | visible: showHeader; | 77 | visible: showHeader; |
3115 | 76 | } | 78 | } |
3123 | 77 | 79 | ,Item { | |
3124 | 78 | , | 80 | id: headerTitleContainer; |
3125 | 79 | Column { | 81 | anchors { verticalCenter: parent.verticalCenter; } |
3126 | 80 | anchors.verticalCenter: parent.verticalCenter; | 82 | width: parent.width - x; |
3127 | 81 | spacing: units.dp(2); | 83 | implicitHeight: titleLabel.height + subtitleLabel.height; |
3128 | 82 | width: parent.width - x; | 84 | data: [ |
3129 | 83 | data: [ Label { | 85 | Label { |
3130 | 84 | id: titleLabel; | 86 | id: titleLabel; |
3131 | 85 | objectName: "titleLabel"; | 87 | objectName: "titleLabel"; |
3133 | 86 | anchors { left: parent.left; right: parent.right } | 88 | anchors { right: parent.right; |
3134 | 89 | rightMargin: units.gu(1); | ||
3135 | 90 | left: parent.left; | ||
3136 | 91 | top: parent.top; } | ||
3137 | 87 | elide: Text.ElideRight; | 92 | elide: Text.ElideRight; |
3138 | 88 | fontSize: "small"; | 93 | fontSize: "small"; |
3139 | 89 | wrapMode: Text.Wrap; | 94 | wrapMode: Text.Wrap; |
3140 | 90 | maximumLineCount: 2; | 95 | maximumLineCount: 2; |
3141 | 91 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 96 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
3143 | 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"); |
3144 | 93 | visible: showHeader ; | 98 | visible: showHeader ; |
3145 | 94 | text: root.title; | 99 | text: root.title; |
3146 | 95 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | 100 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; |
3147 | 96 | horizontalAlignment: root.headerAlignment; | 101 | horizontalAlignment: root.headerAlignment; |
3148 | 97 | } | 102 | } |
3152 | 98 | 103 | ,Label { | |
3150 | 99 | , | ||
3151 | 100 | Label { | ||
3153 | 101 | id: subtitleLabel; | 104 | id: subtitleLabel; |
3154 | 102 | objectName: "subtitleLabel"; | 105 | objectName: "subtitleLabel"; |
3156 | 103 | anchors { left: parent.left; right: parent.right } | 106 | anchors { right: parent.right; |
3157 | 107 | left: parent.left; | ||
3158 | 108 | rightMargin: units.gu(1); | ||
3159 | 109 | top: titleLabel.bottom; | ||
3160 | 110 | } | ||
3161 | 111 | anchors.topMargin: units.dp(2); | ||
3162 | 104 | elide: Text.ElideRight; | 112 | elide: Text.ElideRight; |
3163 | 105 | fontSize: "small"; | 113 | fontSize: "small"; |
3164 | 106 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 114 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
3166 | 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"); |
3167 | 108 | visible: titleLabel.visible && titleLabel.text; | 116 | visible: titleLabel.visible && titleLabel.text; |
3168 | 109 | text: cardData && cardData["subtitle"] || ""; | 117 | text: cardData && cardData["subtitle"] || ""; |
3169 | 110 | font.weight: Font.Light; | 118 | font.weight: Font.Light; |
3170 | 111 | 119 | ||
3171 | === modified file 'tests/plugins/Dash/cardcreator/2.tst' | |||
3172 | --- tests/plugins/Dash/cardcreator/2.tst 2014-07-28 15:09:45 +0000 | |||
3173 | +++ tests/plugins/Dash/cardcreator/2.tst 2014-08-08 14:57:17 +0000 | |||
3174 | @@ -1,3 +1,3 @@ | |||
3175 | 1 | template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2} | 1 | template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2} |
3177 | 2 | components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"}} | 2 | components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}} |
3178 | 3 | result: 2.res | 3 | result: 2.res |
3179 | 4 | 4 | ||
3180 | === modified file 'tests/plugins/Dash/cardcreator/3.res' | |||
3181 | --- tests/plugins/Dash/cardcreator/3.res 2014-08-05 22:51:17 +0000 | |||
3182 | +++ tests/plugins/Dash/cardcreator/3.res 2014-08-08 14:57:17 +0000 | |||
3183 | @@ -61,12 +61,12 @@ | |||
3184 | 61 | id: titleLabel; | 61 | id: titleLabel; |
3185 | 62 | objectName: "titleLabel"; | 62 | objectName: "titleLabel"; |
3186 | 63 | anchors { right: parent.right; | 63 | anchors { right: parent.right; |
3193 | 64 | rightMargin: units.gu(1); | 64 | rightMargin: units.gu(1); |
3194 | 65 | left: parent.left; | 65 | left: parent.left; |
3195 | 66 | top: artShapeHolder.bottom; | 66 | top: artShapeHolder.bottom; |
3196 | 67 | topMargin: units.gu(1); | 67 | topMargin: units.gu(1); |
3197 | 68 | leftMargin: units.gu(1); | 68 | leftMargin: units.gu(1); |
3198 | 69 | } | 69 | } |
3199 | 70 | elide: Text.ElideRight; | 70 | elide: Text.ElideRight; |
3200 | 71 | fontSize: "small"; | 71 | fontSize: "small"; |
3201 | 72 | wrapMode: Text.Wrap; | 72 | wrapMode: Text.Wrap; |
3202 | @@ -82,12 +82,12 @@ | |||
3203 | 82 | id: subtitleLabel; | 82 | id: subtitleLabel; |
3204 | 83 | objectName: "subtitleLabel"; | 83 | objectName: "subtitleLabel"; |
3205 | 84 | anchors { left: titleLabel.left; | 84 | anchors { left: titleLabel.left; |
3212 | 85 | leftMargin: titleLabel.leftMargin; | 85 | leftMargin: titleLabel.leftMargin; |
3213 | 86 | right: titleLabel.right; | 86 | rightMargin: units.gu(1); |
3214 | 87 | rightMargin: titleLabel.rightMargin; | 87 | right: titleLabel.right; |
3215 | 88 | top: titleLabel.bottom; | 88 | top: titleLabel.bottom; |
3216 | 89 | topMargin: units.dp(2); | 89 | } |
3217 | 90 | } | 90 | anchors.topMargin: units.dp(2); |
3218 | 91 | elide: Text.ElideRight; | 91 | elide: Text.ElideRight; |
3219 | 92 | fontSize: "small"; | 92 | fontSize: "small"; |
3220 | 93 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 93 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
3221 | 94 | 94 | ||
3222 | === modified file 'tests/plugins/Dash/cardcreator/3.tst' | |||
3223 | --- tests/plugins/Dash/cardcreator/3.tst 2014-07-28 15:09:45 +0000 | |||
3224 | +++ tests/plugins/Dash/cardcreator/3.tst 2014-08-08 14:57:17 +0000 | |||
3225 | @@ -1,3 +1,3 @@ | |||
3226 | 1 | template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2} | 1 | template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2} |
3228 | 2 | components: {"art":{"aspect-ratio":0.75,"field":"art"},"subtitle":{"field":"price"},"title":{"field":"title"}} | 2 | components: {"art":{"aspect-ratio":0.75,"field":"art"},"subtitle":{"field":"price"},"title":{"field":"title"},"attributes":{}} |
3229 | 3 | result: 3.res | 3 | result: 3.res |
3230 | 4 | 4 | ||
3231 | === modified file 'tests/plugins/Dash/cardcreator/4.res' | |||
3232 | --- tests/plugins/Dash/cardcreator/4.res 2014-07-25 13:41:19 +0000 | |||
3233 | +++ tests/plugins/Dash/cardcreator/4.res 2014-08-08 14:57:17 +0000 | |||
3234 | @@ -27,7 +27,9 @@ | |||
3235 | 27 | } | 27 | } |
3236 | 28 | anchors.right: parent.right; | 28 | anchors.right: parent.right; |
3237 | 29 | anchors.margins: margins; | 29 | anchors.margins: margins; |
3239 | 30 | data: [ Loader { | 30 | anchors.rightMargin: 0; |
3240 | 31 | data: [ | ||
3241 | 32 | Loader { | ||
3242 | 31 | id: mascotShapeLoader; | 33 | id: mascotShapeLoader; |
3243 | 32 | objectName: "mascotShapeLoader"; | 34 | objectName: "mascotShapeLoader"; |
3244 | 33 | asynchronous: root.asynchronous; | 35 | asynchronous: root.asynchronous; |
3245 | @@ -39,13 +41,12 @@ | |||
3246 | 39 | anchors { verticalCenter: parent.verticalCenter; } | 41 | anchors { verticalCenter: parent.verticalCenter; } |
3247 | 40 | } | 42 | } |
3248 | 41 | 43 | ||
3251 | 42 | , | 44 | ,Image { |
3250 | 43 | Image { | ||
3252 | 44 | id: mascotImage; | 45 | id: mascotImage; |
3253 | 45 | objectName: "mascotImage"; | 46 | objectName: "mascotImage"; |
3254 | 46 | anchors { verticalCenter: parent.verticalCenter; } | 47 | anchors { verticalCenter: parent.verticalCenter; } |
3255 | 47 | readonly property int maxSize: Math.max(width, height) * 4; | 48 | readonly property int maxSize: Math.max(width, height) * 4; |
3257 | 48 | source: cardData && cardData["mascot"]; | 49 | source: cardData && cardData["mascot"] || ""; |
3258 | 49 | width: units.gu(6); | 50 | width: units.gu(6); |
3259 | 50 | height: units.gu(5.625); | 51 | height: units.gu(5.625); |
3260 | 51 | sourceSize { width: maxSize; height: maxSize } | 52 | sourceSize { width: maxSize; height: maxSize } |
3261 | @@ -55,15 +56,19 @@ | |||
3262 | 55 | visible: false; | 56 | visible: false; |
3263 | 56 | } | 57 | } |
3264 | 57 | 58 | ||
3271 | 58 | , | 59 | ,Item { |
3272 | 59 | Column { | 60 | id: headerTitleContainer; |
3273 | 60 | anchors.verticalCenter: parent.verticalCenter; | 61 | anchors { verticalCenter: parent.verticalCenter; } |
3274 | 61 | spacing: units.dp(2); | 62 | width: parent.width - x; |
3275 | 62 | width: parent.width - x; | 63 | implicitHeight: titleLabel.height + subtitleLabel.height; |
3276 | 63 | data: [ Label { | 64 | data: [ |
3277 | 65 | Label { | ||
3278 | 64 | id: titleLabel; | 66 | id: titleLabel; |
3279 | 65 | objectName: "titleLabel"; | 67 | objectName: "titleLabel"; |
3281 | 66 | anchors { left: parent.left; right: parent.right } | 68 | anchors { right: parent.right; |
3282 | 69 | rightMargin: units.gu(1); | ||
3283 | 70 | left: parent.left; | ||
3284 | 71 | top: parent.top; } | ||
3285 | 67 | elide: Text.ElideRight; | 72 | elide: Text.ElideRight; |
3286 | 68 | fontSize: "small"; | 73 | fontSize: "small"; |
3287 | 69 | wrapMode: Text.Wrap; | 74 | wrapMode: Text.Wrap; |
3288 | @@ -75,12 +80,15 @@ | |||
3289 | 75 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | 80 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; |
3290 | 76 | horizontalAlignment: root.headerAlignment; | 81 | horizontalAlignment: root.headerAlignment; |
3291 | 77 | } | 82 | } |
3294 | 78 | , | 83 | ,Label { |
3293 | 79 | Label { | ||
3295 | 80 | id: subtitleLabel; | 84 | id: subtitleLabel; |
3296 | 81 | objectName: "subtitleLabel"; | 85 | objectName: "subtitleLabel"; |
3299 | 82 | anchors { left: parent.left; right: parent.right } | 86 | anchors { right: parent.right; |
3300 | 83 | 87 | left: parent.left; | |
3301 | 88 | rightMargin: units.gu(1); | ||
3302 | 89 | top: titleLabel.bottom; | ||
3303 | 90 | } | ||
3304 | 91 | anchors.topMargin: units.dp(2); | ||
3305 | 84 | elide: Text.ElideRight; | 92 | elide: Text.ElideRight; |
3306 | 85 | fontSize: "small"; | 93 | fontSize: "small"; |
3307 | 86 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 94 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
3308 | 87 | 95 | ||
3309 | === modified file 'tests/plugins/Dash/cardcreator/4.tst' | |||
3310 | --- tests/plugins/Dash/cardcreator/4.tst 2014-07-28 15:09:45 +0000 | |||
3311 | +++ tests/plugins/Dash/cardcreator/4.tst 2014-08-08 14:57:17 +0000 | |||
3312 | @@ -1,3 +1,3 @@ | |||
3313 | 1 | template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2} | 1 | template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2} |
3315 | 2 | components: {"art":{"aspect-ratio":1},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"}} | 2 | components: {"art":{"aspect-ratio":1},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"},"attributes":{}} |
3316 | 3 | result: 4.res | 3 | result: 4.res |
3317 | 4 | 4 | ||
3318 | === modified file 'tests/plugins/Dash/cardcreator/5.res' | |||
3319 | --- tests/plugins/Dash/cardcreator/5.res 2014-08-05 22:51:17 +0000 | |||
3320 | +++ tests/plugins/Dash/cardcreator/5.res 2014-08-08 14:57:17 +0000 | |||
3321 | @@ -68,8 +68,9 @@ | |||
3322 | 68 | visible: showHeader && status == Loader.Ready; | 68 | visible: showHeader && status == Loader.Ready; |
3323 | 69 | sourceComponent: ShaderEffect { | 69 | sourceComponent: ShaderEffect { |
3324 | 70 | id: overlay; | 70 | id: overlay; |
3327 | 71 | height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); | 71 | height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); |
3328 | 72 | opacity: 0.6; | 72 | property real luminance: 0.2126 * overlayColor.r + 0.7152 * overlayColor.g + 0.0722 * overlayColor.b; |
3329 | 73 | property color overlayColor: cardData && cardData["overlayColor"] || "#99000000"; | ||
3330 | 73 | property var source: ShaderEffectSource { | 74 | property var source: ShaderEffectSource { |
3331 | 74 | id: shaderSource; | 75 | id: shaderSource; |
3332 | 75 | sourceItem: artShapeLoader.item; | 76 | sourceItem: artShapeLoader.item; |
3333 | @@ -90,29 +91,30 @@ | |||
3334 | 90 | varying highp vec2 coord; | 91 | varying highp vec2 coord; |
3335 | 91 | uniform sampler2D source; | 92 | uniform sampler2D source; |
3336 | 92 | uniform lowp float qt_Opacity; | 93 | uniform lowp float qt_Opacity; |
3337 | 94 | uniform highp vec4 overlayColor; | ||
3338 | 93 | void main() { | 95 | void main() { |
3339 | 94 | lowp vec4 tex = texture2D(source, coord); | 96 | lowp vec4 tex = texture2D(source, coord); |
3341 | 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; |
3342 | 96 | }"; | 98 | }"; |
3343 | 97 | } | 99 | } |
3344 | 98 | } | 100 | } |
3345 | 99 | readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin; | 101 | readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin; |
3346 | 100 | Label { | 102 | Label { |
3348 | 101 | id: titleLabel; | 103 | id: titleLabel; |
3349 | 102 | objectName: "titleLabel"; | 104 | objectName: "titleLabel"; |
3357 | 103 | anchors { left: parent.left; | 105 | anchors { right: parent.right; |
3358 | 104 | leftMargin: units.gu(1); | 106 | rightMargin: units.gu(1); |
3359 | 105 | right: parent.right; | 107 | left: parent.left; |
3360 | 106 | rightMargin: units.gu(1); | 108 | leftMargin: units.gu(1); |
3361 | 107 | top: overlayLoader.top; | 109 | top: overlayLoader.top; |
3362 | 108 | topMargin: units.gu(1); | 110 | topMargin: units.gu(1); |
3363 | 109 | } | 111 | } |
3364 | 110 | elide: Text.ElideRight; | 112 | elide: Text.ElideRight; |
3365 | 111 | fontSize: "small"; | 113 | fontSize: "small"; |
3366 | 112 | wrapMode: Text.Wrap; | 114 | wrapMode: Text.Wrap; |
3367 | 113 | maximumLineCount: 2; | 115 | maximumLineCount: 2; |
3368 | 114 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 116 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
3370 | 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"); |
3371 | 116 | visible: showHeader && overlayLoader.active; | 118 | visible: showHeader && overlayLoader.active; |
3372 | 117 | text: root.title; | 119 | text: root.title; |
3373 | 118 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | 120 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; |
3374 | @@ -122,16 +124,16 @@ | |||
3375 | 122 | id: subtitleLabel; | 124 | id: subtitleLabel; |
3376 | 123 | objectName: "subtitleLabel"; | 125 | objectName: "subtitleLabel"; |
3377 | 124 | anchors { left: titleLabel.left; | 126 | anchors { left: titleLabel.left; |
3384 | 125 | leftMargin: titleLabel.leftMargin; | 127 | leftMargin: titleLabel.leftMargin; |
3385 | 126 | right: titleLabel.right; | 128 | rightMargin: units.gu(1); |
3386 | 127 | rightMargin: titleLabel.rightMargin; | 129 | right: titleLabel.right; |
3387 | 128 | top: titleLabel.bottom; | 130 | top: titleLabel.bottom; |
3388 | 129 | topMargin: units.dp(2); | 131 | } |
3389 | 130 | } | 132 | anchors.topMargin: units.dp(2); |
3390 | 131 | elide: Text.ElideRight; | 133 | elide: Text.ElideRight; |
3391 | 132 | fontSize: "small"; | 134 | fontSize: "small"; |
3392 | 133 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 135 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
3394 | 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"); |
3395 | 135 | visible: titleLabel.visible && titleLabel.text; | 137 | visible: titleLabel.visible && titleLabel.text; |
3396 | 136 | text: cardData && cardData["subtitle"] || ""; | 138 | text: cardData && cardData["subtitle"] || ""; |
3397 | 137 | font.weight: Font.Light; | 139 | font.weight: Font.Light; |
3398 | 138 | 140 | ||
3399 | === modified file 'tests/plugins/Dash/cardcreator/5.tst' | |||
3400 | --- tests/plugins/Dash/cardcreator/5.tst 2014-07-28 15:09:45 +0000 | |||
3401 | +++ tests/plugins/Dash/cardcreator/5.tst 2014-08-08 14:57:17 +0000 | |||
3402 | @@ -1,3 +1,3 @@ | |||
3403 | 1 | template: {"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true} | 1 | template: {"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true} |
3405 | 2 | components: {"art":{"aspect-ratio":1,"field":"art"},"subtitle":{"field":"artist"},"title":{"field":"title"}} | 2 | components: {"art":{"aspect-ratio":1,"field":"art"},"subtitle":{"field":"artist"},"title":{"field":"title"},"attributes":{}} |
3406 | 3 | result: 5.res | 3 | result: 5.res |
3407 | 4 | 4 | ||
3408 | === modified file 'tests/plugins/Dash/cardcreator/6.res' | |||
3409 | --- tests/plugins/Dash/cardcreator/6.res 2014-08-05 22:51:17 +0000 | |||
3410 | +++ tests/plugins/Dash/cardcreator/6.res 2014-08-08 14:57:17 +0000 | |||
3411 | @@ -13,57 +13,110 @@ | |||
3412 | 13 | property bool asynchronous: true; | 13 | property bool asynchronous: true; |
3413 | 14 | property bool showHeader: true; | 14 | property bool showHeader: true; |
3414 | 15 | implicitWidth: childrenRect.width; | 15 | implicitWidth: childrenRect.width; |
3456 | 16 | onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; } | 16 | Loader { |
3457 | 17 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); | 17 | id: backgroundLoader; |
3458 | 18 | Item { | 18 | objectName: "backgroundLoader"; |
3459 | 19 | id: artShapeHolder; | 19 | anchors.fill: parent; |
3460 | 20 | height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; | 20 | asynchronous: root.asynchronous; |
3461 | 21 | width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; | 21 | visible: status == Loader.Ready; |
3462 | 22 | anchors { horizontalCenter: parent.horizontalCenter; } | 22 | sourceComponent: UbuntuShape { |
3463 | 23 | Loader { | 23 | objectName: "background"; |
3464 | 24 | id: artShapeLoader; | 24 | radius: "medium"; |
3465 | 25 | objectName: "artShapeLoader"; | 25 | color: getColor(0) || "white"; |
3466 | 26 | active: cardData && cardData["art"] || false; | 26 | gradientColor: getColor(1) || color; |
3467 | 27 | asynchronous: root.asynchronous; | 27 | anchors.fill: parent; |
3468 | 28 | visible: status == Loader.Ready; | 28 | image: backgroundImage.source ? backgroundImage : null; |
3469 | 29 | sourceComponent: UbuntuShape { | 29 | property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b; |
3470 | 30 | id: artShape; | 30 | property Image backgroundImage: Image { |
3471 | 31 | objectName: "artShape"; | 31 | objectName: "backgroundImage"; |
3472 | 32 | radius: "medium"; | 32 | source: { |
3473 | 33 | visible: image.status == Image.Ready; | 33 | if (cardData && typeof cardData["background"] === "string") return cardData["background"]; |
3474 | 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"]; |
3475 | 35 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; | 35 | else return ""; |
3476 | 36 | Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } | 36 | } |
3477 | 37 | Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } | 37 | } |
3478 | 38 | function updateWidthHeightBindings() { | 38 | function getColor(index) { |
3479 | 39 | if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { | 39 | if (cardData && typeof cardData["background"] === "object" |
3480 | 40 | width = root.fixedArtShapeSize.width; | 40 | && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) { |
3481 | 41 | height = root.fixedArtShapeSize.height; | 41 | return cardData["background"]["elements"][index]; |
3482 | 42 | } else { | 42 | } else if (template && typeof template["card-background"] === "object" |
3483 | 43 | width = Qt.binding(function() { return !visible ? 0 : image.width }); | 43 | && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) { |
3484 | 44 | height = Qt.binding(function() { return !visible ? 0 : image.height }); | 44 | return template["card-background"]["elements"][index]; |
3485 | 45 | } | 45 | } else return undefined; |
3486 | 46 | } | 46 | } |
3487 | 47 | image: Image { | 47 | } |
3488 | 48 | objectName: "artImage"; | 48 | } |
3489 | 49 | source: cardData && cardData["art"] || ""; | 49 | readonly property size artShapeSize: Qt.size(-1, -1); |
3490 | 50 | cache: true; | 50 | readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin; |
3491 | 51 | asynchronous: root.asynchronous; | 51 | Item { |
3492 | 52 | fillMode: Image.PreserveAspectCrop; | 52 | id: headerTitleContainer; |
3493 | 53 | width: root.width; | 53 | anchors { right: parent.right; left: parent.left; |
3494 | 54 | height: width / artShape.aspect; | 54 | top: parent.top; |
3495 | 55 | } | 55 | topMargin: units.gu(1); |
3496 | 56 | } | 56 | leftMargin: units.gu(1); |
3497 | 57 | } | ||
3498 | 58 | width: parent.width - x; | ||
3499 | 59 | implicitHeight: titleLabel.height + subtitleLabel.height; | ||
3500 | 60 | data: [ | ||
3501 | 61 | Label { | ||
3502 | 62 | id: titleLabel; | ||
3503 | 63 | objectName: "titleLabel"; | ||
3504 | 64 | anchors { right: emblemImage.left; | ||
3505 | 65 | rightMargin: emblemImage.width > 0 ? units.gu(0.5) : 0; | ||
3506 | 66 | left: parent.left; | ||
3507 | 67 | top: parent.top; } | ||
3508 | 68 | elide: Text.ElideRight; | ||
3509 | 69 | fontSize: "small"; | ||
3510 | 70 | wrapMode: Text.Wrap; | ||
3511 | 71 | maximumLineCount: 2; | ||
3512 | 72 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | ||
3513 | 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"); | ||
3514 | 74 | visible: showHeader ; | ||
3515 | 75 | text: root.title; | ||
3516 | 76 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | ||
3517 | 77 | horizontalAlignment: root.headerAlignment; | ||
3518 | 57 | } | 78 | } |
3521 | 58 | } | 79 | ,Label { |
3522 | 59 | readonly property int headerHeight: 0; | 80 | id: subtitleLabel; |
3523 | 81 | objectName: "subtitleLabel"; | ||
3524 | 82 | anchors { right: parent.right; | ||
3525 | 83 | left: parent.left; | ||
3526 | 84 | rightMargin: units.gu(1); | ||
3527 | 85 | top: titleLabel.bottom; | ||
3528 | 86 | } | ||
3529 | 87 | anchors.topMargin: units.dp(2); | ||
3530 | 88 | elide: Text.ElideRight; | ||
3531 | 89 | fontSize: "small"; | ||
3532 | 90 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | ||
3533 | 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"); | ||
3534 | 92 | visible: titleLabel.visible && titleLabel.text; | ||
3535 | 93 | text: cardData && cardData["subtitle"] || ""; | ||
3536 | 94 | font.weight: Font.Light; | ||
3537 | 95 | horizontalAlignment: root.headerAlignment; | ||
3538 | 96 | } | ||
3539 | 97 | ,Image { | ||
3540 | 98 | id: emblemImage; | ||
3541 | 99 | objectName: "emblemImage"; | ||
3542 | 100 | anchors { | ||
3543 | 101 | bottom: titleLabel.baseline; | ||
3544 | 102 | right: parent.right; | ||
3545 | 103 | rightMargin: status === Image.Ready ? units.gu(1) : 0; | ||
3546 | 104 | } | ||
3547 | 105 | source: cardData && cardData["emblem"] || ""; | ||
3548 | 106 | width: height; | ||
3549 | 107 | height: status === Image.Ready ? titleLabel.font.pixelSize : 0; | ||
3550 | 108 | fillMode: Image.PreserveAspectFit; | ||
3551 | 109 | } | ||
3552 | 110 | |||
3553 | 111 | ] | ||
3554 | 112 | } | ||
3555 | 60 | UbuntuShape { | 113 | UbuntuShape { |
3556 | 61 | id: touchdown; | 114 | id: touchdown; |
3557 | 62 | objectName: "touchdown"; | 115 | objectName: "touchdown"; |
3559 | 63 | anchors { fill: artShapeHolder } | 116 | anchors { fill: backgroundLoader } |
3560 | 64 | visible: root.pressed; | 117 | visible: root.pressed; |
3561 | 65 | radius: "medium"; | 118 | radius: "medium"; |
3562 | 66 | borderSource: "radius_pressed.sci" | 119 | borderSource: "radius_pressed.sci" |
3563 | 67 | } | 120 | } |
3565 | 68 | implicitHeight: artShapeHolder.height; | 121 | implicitHeight: headerTitleContainer.y + headerTitleContainer.height + units.gu(1); |
3566 | 69 | } | 122 | } |
3567 | 70 | 123 | ||
3568 | === modified file 'tests/plugins/Dash/cardcreator/6.tst' | |||
3569 | --- tests/plugins/Dash/cardcreator/6.tst 2014-07-28 15:09:45 +0000 | |||
3570 | +++ tests/plugins/Dash/cardcreator/6.tst 2014-08-08 14:57:17 +0000 | |||
3571 | @@ -1,3 +1,3 @@ | |||
3574 | 1 | template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2} | 1 | template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2} |
3575 | 2 | components: {"art":{"aspect-ratio":1.6,"field":"art"}} | 2 | components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"subtitle":{"field":"author"},"title":{"field":"title"},"emblem":{"field":"source"},"attributes":{}} |
3576 | 3 | result: 6.res | 3 | result: 6.res |
3577 | 4 | 4 | ||
3578 | === modified file 'tests/plugins/Dash/cardcreator/7.res' | |||
3579 | --- tests/plugins/Dash/cardcreator/7.res 2014-08-05 22:51:17 +0000 | |||
3580 | +++ tests/plugins/Dash/cardcreator/7.res 2014-08-08 14:57:17 +0000 | |||
3581 | @@ -55,17 +55,19 @@ | |||
3582 | 55 | spacing: margins; | 55 | spacing: margins; |
3583 | 56 | height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; | 56 | height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; |
3584 | 57 | anchors { top: parent.top; | 57 | anchors { top: parent.top; |
3588 | 58 | topMargin: units.gu(1); | 58 | topMargin: units.gu(1); |
3589 | 59 | left: parent.left; | 59 | left: parent.left; |
3590 | 60 | } | 60 | } |
3591 | 61 | anchors.right: parent.right; | 61 | anchors.right: parent.right; |
3592 | 62 | anchors.margins: margins; | 62 | anchors.margins: margins; |
3594 | 63 | data: [ Image { | 63 | anchors.rightMargin: 0; |
3595 | 64 | data: [ | ||
3596 | 65 | Image { | ||
3597 | 64 | id: mascotImage; | 66 | id: mascotImage; |
3598 | 65 | objectName: "mascotImage"; | 67 | objectName: "mascotImage"; |
3599 | 66 | anchors { verticalCenter: parent.verticalCenter; } | 68 | anchors { verticalCenter: parent.verticalCenter; } |
3600 | 67 | readonly property int maxSize: Math.max(width, height) * 4; | 69 | readonly property int maxSize: Math.max(width, height) * 4; |
3602 | 68 | source: cardData && cardData["mascot"]; | 70 | source: cardData && cardData["mascot"] || ""; |
3603 | 69 | width: units.gu(6); | 71 | width: units.gu(6); |
3604 | 70 | height: units.gu(5.625); | 72 | height: units.gu(5.625); |
3605 | 71 | sourceSize { width: maxSize; height: maxSize } | 73 | sourceSize { width: maxSize; height: maxSize } |
3606 | @@ -75,48 +77,58 @@ | |||
3607 | 75 | visible: showHeader; | 77 | visible: showHeader; |
3608 | 76 | } | 78 | } |
3609 | 77 | 79 | ||
3617 | 78 | , | 80 | ,Item { |
3618 | 79 | Column { | 81 | id: headerTitleContainer; |
3619 | 80 | anchors.verticalCenter: parent.verticalCenter; | 82 | anchors { verticalCenter: parent.verticalCenter; } |
3620 | 81 | spacing: units.dp(2); | 83 | width: parent.width - x; |
3621 | 82 | width: parent.width - x; | 84 | implicitHeight: titleLabel.height + subtitleLabel.height + attributesRow.height; |
3622 | 83 | data: [ | 85 | data: [ |
3623 | 84 | Label { | 86 | Label { |
3624 | 85 | id: titleLabel; | 87 | id: titleLabel; |
3625 | 86 | objectName: "titleLabel"; | 88 | objectName: "titleLabel"; |
3627 | 87 | anchors { left: parent.left; right: parent.right } | 89 | anchors { right: parent.right; |
3628 | 90 | rightMargin: units.gu(1); | ||
3629 | 91 | left: parent.left; | ||
3630 | 92 | top: parent.top; } | ||
3631 | 88 | elide: Text.ElideRight; | 93 | elide: Text.ElideRight; |
3632 | 89 | fontSize: "small"; | 94 | fontSize: "small"; |
3633 | 90 | wrapMode: Text.Wrap; | 95 | wrapMode: Text.Wrap; |
3634 | 91 | maximumLineCount: 2; | 96 | maximumLineCount: 2; |
3635 | 92 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 97 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
3637 | 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"); |
3638 | 94 | visible: showHeader ; | 99 | visible: showHeader ; |
3639 | 95 | text: root.title; | 100 | text: root.title; |
3640 | 96 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | 101 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; |
3641 | 97 | horizontalAlignment: root.headerAlignment; | 102 | horizontalAlignment: root.headerAlignment; |
3642 | 98 | } | 103 | } |
3645 | 99 | , | 104 | ,Label { |
3644 | 100 | Label { | ||
3646 | 101 | id: subtitleLabel; | 105 | id: subtitleLabel; |
3647 | 102 | objectName: "subtitleLabel"; | 106 | objectName: "subtitleLabel"; |
3649 | 103 | anchors { left: parent.left; right: parent.right } | 107 | anchors { right: parent.right; |
3650 | 108 | left: parent.left; | ||
3651 | 109 | rightMargin: units.gu(1); | ||
3652 | 110 | top: titleLabel.bottom; | ||
3653 | 111 | } | ||
3654 | 112 | anchors.topMargin: units.dp(2); | ||
3655 | 104 | elide: Text.ElideRight; | 113 | elide: Text.ElideRight; |
3656 | 105 | fontSize: "small"; | 114 | fontSize: "small"; |
3657 | 106 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 115 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
3659 | 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"); |
3660 | 108 | visible: titleLabel.visible && titleLabel.text; | 117 | visible: titleLabel.visible && titleLabel.text; |
3661 | 109 | text: cardData && cardData["subtitle"] || ""; | 118 | text: cardData && cardData["subtitle"] || ""; |
3662 | 110 | font.weight: Font.Light; | 119 | font.weight: Font.Light; |
3663 | 111 | horizontalAlignment: root.headerAlignment; | 120 | horizontalAlignment: root.headerAlignment; |
3664 | 112 | } | 121 | } |
3667 | 113 | , | 122 | ,CardAttributes { |
3666 | 114 | CardAttributes { | ||
3668 | 115 | id: attributesRow; | 123 | id: attributesRow; |
3669 | 116 | objectName: "attributesRow"; | 124 | objectName: "attributesRow"; |
3673 | 117 | anchors { left: parent.left; right: parent.right } | 125 | anchors { right: parent.right; |
3674 | 118 | color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); | 126 | left: parent.left; |
3675 | 119 | model: cardData["attributes"]; | 127 | rightMargin: units.gu(1); |
3676 | 128 | top: subtitleLabel.bottom; | ||
3677 | 129 | } | ||
3678 | 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"); | ||
3679 | 131 | model: cardData && cardData["attributes"]; | ||
3680 | 120 | } | 132 | } |
3681 | 121 | 133 | ||
3682 | 122 | ] | 134 | ] |
3683 | 123 | 135 | ||
3684 | === modified file 'tests/plugins/Dash/tst_ScopeStyle.qml' | |||
3685 | --- tests/plugins/Dash/tst_ScopeStyle.qml 2014-07-25 11:42:06 +0000 | |||
3686 | +++ tests/plugins/Dash/tst_ScopeStyle.qml 2014-08-08 14:57:17 +0000 | |||
3687 | @@ -101,7 +101,7 @@ | |||
3688 | 101 | 101 | ||
3689 | 102 | function test_threshold_data() { | 102 | function test_threshold_data() { |
3690 | 103 | return [ | 103 | return [ |
3692 | 104 | { tag: "default", index: 0, threshold: 0.5020 }, | 104 | { tag: "default", index: 0, threshold: 0.7510 }, |
3693 | 105 | { tag: "red on black", index: 1, threshold: 0.1063 }, | 105 | { tag: "red on black", index: 1, threshold: 0.1063 }, |
3694 | 106 | { tag: "green on white", index: 2, threshold: 0.6795 }, | 106 | { tag: "green on white", index: 2, threshold: 0.6795 }, |
3695 | 107 | { tag: "blue on darkgrey", index: 3, threshold: 0.3675 }, | 107 | { tag: "blue on darkgrey", index: 3, threshold: 0.3675 }, |
3696 | 108 | 108 | ||
3697 | === modified file 'tests/qmltests/Dash/CardHelpers.js' | |||
3698 | --- tests/qmltests/Dash/CardHelpers.js 2014-08-06 19:38:16 +0000 | |||
3699 | +++ tests/qmltests/Dash/CardHelpers.js 2014-08-08 14:57:17 +0000 | |||
3700 | @@ -60,6 +60,7 @@ | |||
3701 | 60 | "art": "art", \ | 60 | "art": "art", \ |
3702 | 61 | "subtitle": "subtitle", \ | 61 | "subtitle": "subtitle", \ |
3703 | 62 | "mascot": "mascot", \ | 62 | "mascot": "mascot", \ |
3704 | 63 | "emblem": "emblem", \ | ||
3705 | 63 | "overlayColor": "overlayColor", \ | 64 | "overlayColor": "overlayColor", \ |
3706 | 64 | "summary": "summary", \ | 65 | "summary": "summary", \ |
3707 | 65 | "attributes": "attributes" \ | 66 | "attributes": "attributes" \ |
3708 | 66 | 67 | ||
3709 | === added file 'tests/qmltests/Dash/artwork/emblem.png' | |||
3710 | 67 | Binary 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 | 68 | Binary 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 |
3711 | === modified file 'tests/qmltests/Dash/tst_Card.qml' | |||
3712 | --- tests/qmltests/Dash/tst_Card.qml 2014-08-05 22:51:17 +0000 | |||
3713 | +++ tests/qmltests/Dash/tst_Card.qml 2014-08-08 14:57:17 +0000 | |||
3714 | @@ -31,6 +31,7 @@ | |||
3715 | 31 | { | 31 | { |
3716 | 32 | "art": "../../../tests/qmltests/Dash/artwork/music-player-design.png", | 32 | "art": "../../../tests/qmltests/Dash/artwork/music-player-design.png", |
3717 | 33 | "mascot": "../../../tests/qmltests/Dash/artwork/avatar.png", | 33 | "mascot": "../../../tests/qmltests/Dash/artwork/avatar.png", |
3718 | 34 | "emblem": "../../../tests/qmltests/Dash/artwork/emblem.png", | ||
3719 | 34 | "title": "foo", | 35 | "title": "foo", |
3720 | 35 | "subtitle": "bar", | 36 | "subtitle": "bar", |
3721 | 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.", |
3722 | @@ -270,7 +271,7 @@ | |||
3723 | 270 | { tag: "Large", width: units.gu(38), index: 2 }, | 271 | { tag: "Large", width: units.gu(38), index: 2 }, |
3724 | 271 | { tag: "Wide", height: units.gu(19), size: "large", index: 3 }, | 272 | { tag: "Wide", height: units.gu(19), size: "large", index: 3 }, |
3725 | 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 }, |
3727 | 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 }, |
3728 | 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 }, |
3729 | 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 }, |
3730 | 276 | ] | 277 | ] |
3731 | @@ -458,6 +459,23 @@ | |||
3732 | 458 | tryCompareFunction(function() { return Qt.colorEqual(subtitle.color, fontColor); }, true); | 459 | tryCompareFunction(function() { return Qt.colorEqual(subtitle.color, fontColor); }, true); |
3733 | 459 | } | 460 | } |
3734 | 460 | 461 | ||
3735 | 462 | function test_emblemImage_data() { | ||
3736 | 463 | return [ | ||
3737 | 464 | { tag: "Art and summary", emblem: true, index: 0 }, | ||
3738 | 465 | { tag: "Art and summary, small", emblem: false, index: 1 }, | ||
3739 | 466 | { tag: "No header", emblem: false, index: 7 }, | ||
3740 | 467 | { tag: "With background", emblem: true, index: 10 }, | ||
3741 | 468 | ]; | ||
3742 | 469 | } | ||
3743 | 470 | |||
3744 | 471 | function test_emblemImage(data) { | ||
3745 | 472 | selector.selectedIndex = data.index; | ||
3746 | 473 | waitForRendering(card); | ||
3747 | 474 | |||
3748 | 475 | var emblemImage = findChild(card, "emblemImage"); | ||
3749 | 476 | compare(emblemImage !== null, data.emblem); | ||
3750 | 477 | } | ||
3751 | 478 | |||
3752 | 461 | function test_mascotShape_data() { | 479 | function test_mascotShape_data() { |
3753 | 462 | return [ | 480 | return [ |
3754 | 463 | { tag: "Art and summary", shape: false, index: 0 }, | 481 | { tag: "Art and summary", shape: false, index: 0 }, |
3755 | 464 | 482 | ||
3756 | === modified file 'tests/qmltests/Dash/tst_Dash.qml' | |||
3757 | --- tests/qmltests/Dash/tst_Dash.qml 2014-08-06 14:50:25 +0000 | |||
3758 | +++ tests/qmltests/Dash/tst_Dash.qml 2014-08-08 14:57:17 +0000 | |||
3759 | @@ -20,8 +20,6 @@ | |||
3760 | 20 | import Ubuntu.Components 0.1 | 20 | import Ubuntu.Components 0.1 |
3761 | 21 | import Unity.Test 0.1 as UT | 21 | import Unity.Test 0.1 as UT |
3762 | 22 | 22 | ||
3763 | 23 | // TODO We don't have any tests for the overlay scope functionality. | ||
3764 | 24 | |||
3765 | 25 | Item { | 23 | Item { |
3766 | 26 | id: shell | 24 | id: shell |
3767 | 27 | width: units.gu(40) | 25 | width: units.gu(40) |
3768 | @@ -61,9 +59,9 @@ | |||
3769 | 61 | function get_scope_data() { | 59 | function get_scope_data() { |
3770 | 62 | return [ | 60 | return [ |
3771 | 63 | { tag: "MockScope1", visualIndex: 0 }, | 61 | { tag: "MockScope1", visualIndex: 0 }, |
3775 | 64 | { tag: "MockScope2", visualIndex: 1 }, | 62 | { tag: "MockScope2", visualIndex: -1 }, |
3776 | 65 | { tag: "clickscope", visualIndex: 2 }, | 63 | { tag: "clickscope", visualIndex: 1 }, |
3777 | 66 | { tag: "MockScope5", visualIndex: 3 }, | 64 | { tag: "MockScope5", visualIndex: 2 }, |
3778 | 67 | ] | 65 | ] |
3779 | 68 | } | 66 | } |
3780 | 69 | 67 | ||
3781 | @@ -79,10 +77,234 @@ | |||
3782 | 79 | tryCompare(dashContentList, "count", 0); | 77 | tryCompare(dashContentList, "count", 0); |
3783 | 80 | scopes.load(); | 78 | scopes.load(); |
3784 | 81 | tryCompare(scopes, "loaded", true); | 79 | tryCompare(scopes, "loaded", true); |
3786 | 82 | tryCompare(dashContentList, "count", 5); | 80 | tryCompare(dashContentList, "count", 6); |
3787 | 83 | 81 | ||
3788 | 84 | verify(dashContentList != undefined); | 82 | verify(dashContentList != undefined); |
3790 | 85 | tryCompare(dashContentList, "currentIndex", data.visualIndex); | 83 | if (data.visualIndex == -1) { |
3791 | 84 | tryCompare(dashContentList, "currentIndex", 0); | ||
3792 | 85 | expectFail(data.tag, "non favorite scopes should not be visble in the scopes model"); | ||
3793 | 86 | compare(dashContentList.currentItem.scopeId, data.tag); // this should fail | ||
3794 | 87 | } else { | ||
3795 | 88 | tryCompare(dashContentList, "currentIndex", data.visualIndex); | ||
3796 | 89 | compare(dashContentList.currentItem.scopeId, data.tag); | ||
3797 | 90 | } | ||
3798 | 91 | } | ||
3799 | 92 | |||
3800 | 93 | function test_dash_overview_show_select_same_favorite() { | ||
3801 | 94 | // Wait for stuff to be loaded | ||
3802 | 95 | tryCompare(scopes, "loaded", true); | ||
3803 | 96 | var dashContentList = findChild(dash, "dashContentList"); | ||
3804 | 97 | tryCompare(dashContentList, "count", 6); | ||
3805 | 98 | var mockScope1Loader = findChild(dash, "MockScope1 loader"); | ||
3806 | 99 | tryCompareFunction(function() { return mockScope1Loader.item != null; }, true); | ||
3807 | 100 | |||
3808 | 101 | // Show the overview | ||
3809 | 102 | touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18)); | ||
3810 | 103 | var overviewController = findInvisibleChild(dash, "overviewController"); | ||
3811 | 104 | tryCompare(overviewController, "progress", 1); | ||
3812 | 105 | |||
3813 | 106 | // Make sure tab is where it should | ||
3814 | 107 | var scopesOverview = findChild(dash, "scopesOverview"); | ||
3815 | 108 | compare(scopesOverview.currentTab, 0); | ||
3816 | 109 | |||
3817 | 110 | // Make sure stuff is loaded | ||
3818 | 111 | var scopesOverviewFavoritesRepeater = findChild(dash, "scopesOverviewFavoritesRepeater"); | ||
3819 | 112 | tryCompare(scopesOverviewFavoritesRepeater, "count", 6); | ||
3820 | 113 | tryCompareFunction(function() { return scopesOverviewFavoritesRepeater.itemAt(0).item != null; }, true); | ||
3821 | 114 | waitForRendering(scopesOverviewFavoritesRepeater.itemAt(0).item); | ||
3822 | 115 | |||
3823 | 116 | // Click in first item | ||
3824 | 117 | mouseClick(scopesOverviewFavoritesRepeater.itemAt(0).item, 0, 0); | ||
3825 | 118 | |||
3826 | 119 | // Make sure animation went back | ||
3827 | 120 | tryCompare(overviewController, "progress", 0); | ||
3828 | 121 | compare(dashContentList.currentIndex, 0); | ||
3829 | 122 | } | ||
3830 | 123 | |||
3831 | 124 | function test_dash_overview_show_select_different_favorite() { | ||
3832 | 125 | // Wait for stuff to be loaded | ||
3833 | 126 | tryCompare(scopes, "loaded", true); | ||
3834 | 127 | var dashContentList = findChild(dash, "dashContentList"); | ||
3835 | 128 | tryCompare(dashContentList, "count", 6); | ||
3836 | 129 | var mockScope1Loader = findChild(dash, "MockScope1 loader"); | ||
3837 | 130 | tryCompareFunction(function() { return mockScope1Loader.item != null; }, true); | ||
3838 | 131 | |||
3839 | 132 | // Show the overview | ||
3840 | 133 | touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18)); | ||
3841 | 134 | var overviewController = findInvisibleChild(dash, "overviewController"); | ||
3842 | 135 | tryCompare(overviewController, "progress", 1); | ||
3843 | 136 | |||
3844 | 137 | // Make sure tab is where it should | ||
3845 | 138 | var scopesOverview = findChild(dash, "scopesOverview"); | ||
3846 | 139 | compare(scopesOverview.currentTab, 0); | ||
3847 | 140 | |||
3848 | 141 | // Make sure stuff is loaded | ||
3849 | 142 | var scopesOverviewFavoritesRepeater = findChild(dash, "scopesOverviewFavoritesRepeater"); | ||
3850 | 143 | tryCompare(scopesOverviewFavoritesRepeater, "count", 6); | ||
3851 | 144 | tryCompareFunction(function() { return scopesOverviewFavoritesRepeater.itemAt(0).item != null; }, true); | ||
3852 | 145 | waitForRendering(scopesOverviewFavoritesRepeater.itemAt(1).item); | ||
3853 | 146 | |||
3854 | 147 | // Click in first item | ||
3855 | 148 | mouseClick(scopesOverviewFavoritesRepeater.itemAt(1).item, 0, 0); | ||
3856 | 149 | |||
3857 | 150 | // Make sure animation went back | ||
3858 | 151 | tryCompare(overviewController, "progress", 0); | ||
3859 | 152 | compare(dashContentList.currentIndex, 1); | ||
3860 | 153 | } | ||
3861 | 154 | |||
3862 | 155 | function test_dash_overview_all_temp_scope_done_from_all() { | ||
3863 | 156 | // Wait for stuff to be loaded | ||
3864 | 157 | tryCompare(scopes, "loaded", true); | ||
3865 | 158 | var dashContentList = findChild(dash, "dashContentList"); | ||
3866 | 159 | tryCompare(dashContentList, "count", 6); | ||
3867 | 160 | var mockScope1Loader = findChild(dash, "MockScope1 loader"); | ||
3868 | 161 | tryCompareFunction(function() { return mockScope1Loader.item != null; }, true); | ||
3869 | 162 | |||
3870 | 163 | // Show the overview | ||
3871 | 164 | touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18)); | ||
3872 | 165 | var overviewController = findInvisibleChild(dash, "overviewController"); | ||
3873 | 166 | tryCompare(overviewController, "progress", 1); | ||
3874 | 167 | |||
3875 | 168 | // Make sure tab is where it should | ||
3876 | 169 | var scopesOverview = findChild(dash, "scopesOverview"); | ||
3877 | 170 | compare(scopesOverview.currentTab, 0); | ||
3878 | 171 | |||
3879 | 172 | // Make sure stuff is loaded | ||
3880 | 173 | var scopesOverviewFavoritesRepeater = findChild(dash, "scopesOverviewFavoritesRepeater"); | ||
3881 | 174 | tryCompare(scopesOverviewFavoritesRepeater, "count", 6); | ||
3882 | 175 | tryCompareFunction(function() { return scopesOverviewFavoritesRepeater.itemAt(0).item != null; }, true); | ||
3883 | 176 | waitForRendering(scopesOverviewFavoritesRepeater.itemAt(1).item); | ||
3884 | 177 | |||
3885 | 178 | // Click on the all tab | ||
3886 | 179 | var scopesOverviewAllTabButton = findChild(dash, "scopesOverviewAllTabButton"); | ||
3887 | 180 | mouseClick(scopesOverviewAllTabButton, 0, 0); | ||
3888 | 181 | |||
3889 | 182 | // Wait for all tab to be enabled (animation finish) | ||
3890 | 183 | var scopesOverviewAllView = findChild(dash, "scopesOverviewRepeaterChild1"); | ||
3891 | 184 | tryCompare(scopesOverviewAllView, "enabled", true); | ||
3892 | 185 | |||
3893 | 186 | // Click on a temp scope | ||
3894 | 187 | var tempScopeCard = findChild(scopesOverviewAllView, "delegate1"); | ||
3895 | 188 | mouseClick(tempScopeCard, 0, 0); | ||
3896 | 189 | |||
3897 | 190 | // Check the bottom edge (overview) is disabled from temp scope | ||
3898 | 191 | var overviewDragHandle = findChild(dash, "overviewDragHandle"); | ||
3899 | 192 | compare(overviewDragHandle.enabled, false); | ||
3900 | 193 | |||
3901 | 194 | // Check temp scope is there | ||
3902 | 195 | var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem"); | ||
3903 | 196 | tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope != null; }, true); | ||
3904 | 197 | tryCompare(scopesOverviewTempScopeItem, "enabled", true); | ||
3905 | 198 | |||
3906 | 199 | // Go back | ||
3907 | 200 | var scopesOverviewTempScopeItemHeader = findChild(scopesOverviewTempScopeItem, "scopePageHeader"); | ||
3908 | 201 | var backButton = findChild(findChild(scopesOverviewTempScopeItemHeader, "innerPageHeader"), "backButton"); | ||
3909 | 202 | mouseClick(backButton, 0, 0); | ||
3910 | 203 | |||
3911 | 204 | // Check temp scope is gone | ||
3912 | 205 | var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem"); | ||
3913 | 206 | tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope == null; }, true); | ||
3914 | 207 | tryCompare(scopesOverviewTempScopeItem, "enabled", false); | ||
3915 | 208 | |||
3916 | 209 | // Press on done | ||
3917 | 210 | var scopesOverviewDoneButton = findChild(scopesOverview, "scopesOverviewDoneButton"); | ||
3918 | 211 | mouseClick(scopesOverviewDoneButton, 0, 0); | ||
3919 | 212 | |||
3920 | 213 | // Check the dash overview is gone | ||
3921 | 214 | tryCompare(overviewController, "progress", 0); | ||
3922 | 215 | |||
3923 | 216 | // Original list is still on 0 | ||
3924 | 217 | compare(dashContentList.currentIndex, 0); | ||
3925 | 218 | } | ||
3926 | 219 | |||
3927 | 220 | function test_temp_scope_dash_overview_all_search_temp_scope_favorite_from_all() { | ||
3928 | 221 | // Wait for stuff to be loaded | ||
3929 | 222 | tryCompare(scopes, "loaded", true); | ||
3930 | 223 | var dashContentList = findChild(dash, "dashContentList"); | ||
3931 | 224 | tryCompare(dashContentList, "count", 6); | ||
3932 | 225 | var mockScope1Loader = findChild(dash, "MockScope1 loader"); | ||
3933 | 226 | tryCompareFunction(function() { return mockScope1Loader.item != null; }, true); | ||
3934 | 227 | |||
3935 | 228 | // Swipe right to Apps scope | ||
3936 | 229 | touchFlick(dash, dash.width - 1, units.gu(1), dash.width - units.gu(10), units.gu(1)); | ||
3937 | 230 | tryCompare(dashContentList, "contentX", dashContentList.width); | ||
3938 | 231 | tryCompare(dashContentList, "currentIndex", 1); | ||
3939 | 232 | |||
3940 | 233 | // Click on card that opens temp scope | ||
3941 | 234 | var categoryListView = findChild(dashContentList.currentItem, "categoryListView"); | ||
3942 | 235 | var dashCategory2 = findChild(categoryListView, "dashCategory2"); | ||
3943 | 236 | tryCompareFunction(function() { | ||
3944 | 237 | var d = findChild(dashCategory2, "delegate2"); | ||
3945 | 238 | if (d) return true; | ||
3946 | 239 | categoryListView.contentY += 100; | ||
3947 | 240 | return false; | ||
3948 | 241 | }, true); | ||
3949 | 242 | var card2 = findChild(dashCategory2, "delegate2"); | ||
3950 | 243 | waitForRendering(card2); | ||
3951 | 244 | mouseClick(card2, card2.width / 2, card2.height / 2); | ||
3952 | 245 | |||
3953 | 246 | // Wait for temp scope to be there | ||
3954 | 247 | var dashTempScopeItem = findChild(dash, "dashTempScopeItem"); | ||
3955 | 248 | tryCompare(dashTempScopeItem, "x", 0); | ||
3956 | 249 | |||
3957 | 250 | // Show the overview | ||
3958 | 251 | touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18)); | ||
3959 | 252 | var overviewController = findInvisibleChild(dash, "overviewController"); | ||
3960 | 253 | tryCompare(overviewController, "progress", 1); | ||
3961 | 254 | |||
3962 | 255 | // Make sure tab is where it should | ||
3963 | 256 | var scopesOverview = findChild(dash, "scopesOverview"); | ||
3964 | 257 | compare(scopesOverview.currentTab, 1); | ||
3965 | 258 | |||
3966 | 259 | // Do a search | ||
3967 | 260 | var scopesOverviewPageHeader = findChild(scopesOverview, "scopesOverviewPageHeader"); | ||
3968 | 261 | var searchButton = findChild(scopesOverviewPageHeader, "search_header_button"); | ||
3969 | 262 | mouseClick(searchButton, 0, 0); | ||
3970 | 263 | |||
3971 | 264 | // Type something | ||
3972 | 265 | keyClick(Qt.Key_H); | ||
3973 | 266 | |||
3974 | 267 | // Check results grid is there and the other lists are not | ||
3975 | 268 | var searchResultsViewer = findChild(scopesOverview, "searchResultsViewer"); | ||
3976 | 269 | var scopesOverviewRepeater = findChild(dash, "scopesOverviewRepeater"); | ||
3977 | 270 | tryCompare(searchResultsViewer, "opacity", 1); | ||
3978 | 271 | tryCompare(scopesOverviewRepeater, "count", 0); | ||
3979 | 272 | |||
3980 | 273 | // Click on a temp scope in the search | ||
3981 | 274 | var dashCategorysearchA = findChild(searchResultsViewer, "dashCategorysearchA"); | ||
3982 | 275 | var cardTempScope = findChild(dashCategorysearchA, "delegate2"); | ||
3983 | 276 | waitForRendering(cardTempScope); | ||
3984 | 277 | mouseClick(cardTempScope, cardTempScope.width / 2, cardTempScope.height / 2); | ||
3985 | 278 | |||
3986 | 279 | // Check the bottom edge (overview) is disabled from temp scope | ||
3987 | 280 | var overviewDragHandle = findChild(dash, "overviewDragHandle"); | ||
3988 | 281 | compare(overviewDragHandle.enabled, false); | ||
3989 | 282 | |||
3990 | 283 | // Check temp scope is there | ||
3991 | 284 | var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem"); | ||
3992 | 285 | tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope != null; }, true); | ||
3993 | 286 | tryCompare(scopesOverviewTempScopeItem, "enabled", true); | ||
3994 | 287 | |||
3995 | 288 | // Go back | ||
3996 | 289 | var scopesOverviewTempScopeItemHeader = findChild(scopesOverviewTempScopeItem, "scopePageHeader"); | ||
3997 | 290 | var backButton = findChild(findChild(scopesOverviewTempScopeItemHeader, "innerPageHeader"), "backButton"); | ||
3998 | 291 | mouseClick(backButton, 0, 0); | ||
3999 | 292 | |||
4000 | 293 | // Check temp scope is gone | ||
4001 | 294 | var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem"); | ||
4002 | 295 | tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope == null; }, true); | ||
4003 | 296 | tryCompare(scopesOverviewTempScopeItem, "enabled", false); | ||
4004 | 297 | |||
4005 | 298 | // Press on a favorite | ||
4006 | 299 | var dashCategorysearchB = findChild(searchResultsViewer, "dashCategorysearchB"); | ||
4007 | 300 | var cardFavSearch = findChild(dashCategorysearchB, "delegate3"); | ||
4008 | 301 | mouseClick(cardFavSearch, 0, 0); | ||
4009 | 302 | |||
4010 | 303 | // Check the dash overview is gone | ||
4011 | 304 | tryCompare(overviewController, "progress", 0); | ||
4012 | 305 | |||
4013 | 306 | // Original list went to the favorite | ||
4014 | 307 | compare(dashContentList.currentIndex, 0); | ||
4015 | 86 | } | 308 | } |
4016 | 87 | 309 | ||
4017 | 88 | function test_setCurrentScope() { | 310 | function test_setCurrentScope() { |
4018 | 89 | 311 | ||
4019 | === modified file 'tests/qmltests/Dash/tst_DashContent.qml' | |||
4020 | --- tests/qmltests/Dash/tst_DashContent.qml 2014-08-06 10:16:59 +0000 | |||
4021 | +++ tests/qmltests/Dash/tst_DashContent.qml 2014-08-08 14:57:17 +0000 | |||
4022 | @@ -70,7 +70,7 @@ | |||
4023 | 70 | function loadScopes() { | 70 | function loadScopes() { |
4024 | 71 | scopeLoadedSpy.clear(); | 71 | scopeLoadedSpy.clear(); |
4025 | 72 | scopesModel.load(); | 72 | scopesModel.load(); |
4027 | 73 | tryCompare(scopeLoadedSpy, "count", 4); | 73 | tryCompare(scopeLoadedSpy, "count", 6); |
4028 | 74 | } | 74 | } |
4029 | 75 | 75 | ||
4030 | 76 | function init() { | 76 | function init() { |
4031 | @@ -114,7 +114,8 @@ | |||
4032 | 114 | 114 | ||
4033 | 115 | loadScopes(); | 115 | loadScopes(); |
4034 | 116 | 116 | ||
4036 | 117 | verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5); | 117 | compare(dashContentList.count, 6); |
4037 | 118 | verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < dashContentList.count); | ||
4038 | 118 | } | 119 | } |
4039 | 119 | 120 | ||
4040 | 120 | function test_show_header_on_list_movement() { | 121 | function test_show_header_on_list_movement() { |
4041 | @@ -170,7 +171,7 @@ | |||
4042 | 170 | 171 | ||
4043 | 171 | // test greater than scope count. | 172 | // test greater than scope count. |
4044 | 172 | var currentScopeIndex = dashContent.currentIndex; | 173 | var currentScopeIndex = dashContent.currentIndex; |
4046 | 173 | dashContent.setCurrentScopeAtIndex(8, true, false); | 174 | dashContent.setCurrentScopeAtIndex(18, true, false); |
4047 | 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"); |
4048 | 175 | } | 176 | } |
4049 | 176 | 177 | ||
4050 | @@ -189,9 +190,9 @@ | |||
4051 | 189 | function test_scope_mapping_data() { | 190 | function test_scope_mapping_data() { |
4052 | 190 | return [ | 191 | return [ |
4053 | 191 | {tag: "index0", index: 0, objectName: "MockScope1"}, | 192 | {tag: "index0", index: 0, objectName: "MockScope1"}, |
4057 | 192 | {tag: "index1", index: 1, objectName: "MockScope2"}, | 193 | {tag: "index1", index: 1, objectName: "clickscope"}, |
4058 | 193 | {tag: "index2", index: 2, objectName: "clickscope"}, | 194 | {tag: "index2", index: 2, objectName: "MockScope5"}, |
4059 | 194 | {tag: "index3", index: 3, objectName: "MockScope5"} | 195 | {tag: "index3", index: 3, objectName: "SingleCategoryScope"} |
4060 | 195 | ] | 196 | ] |
4061 | 196 | } | 197 | } |
4062 | 197 | 198 | ||
4063 | 198 | 199 | ||
4064 | === modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml' | |||
4065 | --- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-06 19:39:30 +0000 | |||
4066 | +++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-08 14:57:17 +0000 | |||
4067 | @@ -61,8 +61,8 @@ | |||
4068 | 61 | property Item header: findChild(genericScopeView, "scopePageHeader") | 61 | property Item header: findChild(genericScopeView, "scopePageHeader") |
4069 | 62 | 62 | ||
4070 | 63 | function init() { | 63 | function init() { |
4073 | 64 | genericScopeView.scope = scopes.getScope(1) | 64 | genericScopeView.scope = scopes.getScope(2); |
4074 | 65 | shell.width = units.gu(120) | 65 | shell.width = units.gu(120); |
4075 | 66 | genericScopeView.categoryView.positionAtBeginning(); | 66 | genericScopeView.categoryView.positionAtBeginning(); |
4076 | 67 | waitForRendering(genericScopeView.categoryView); | 67 | waitForRendering(genericScopeView.categoryView); |
4077 | 68 | } | 68 | } |
4078 | @@ -88,13 +88,13 @@ | |||
4079 | 88 | 88 | ||
4080 | 89 | function test_showDash() { | 89 | function test_showDash() { |
4081 | 90 | testCase.previewListView.open = true; | 90 | testCase.previewListView.open = true; |
4083 | 91 | scopes.getScope(1).showDash(); | 91 | genericScopeView.scope.showDash(); |
4084 | 92 | tryCompare(testCase.previewListView, "open", false); | 92 | tryCompare(testCase.previewListView, "open", false); |
4085 | 93 | } | 93 | } |
4086 | 94 | 94 | ||
4087 | 95 | function test_hideDash() { | 95 | function test_hideDash() { |
4088 | 96 | testCase.previewListView.open = true; | 96 | testCase.previewListView.open = true; |
4090 | 97 | scopes.getScope(1).hideDash(); | 97 | genericScopeView.scope.hideDash(); |
4091 | 98 | tryCompare(testCase.previewListView, "open", false); | 98 | tryCompare(testCase.previewListView, "open", false); |
4092 | 99 | } | 99 | } |
4093 | 100 | 100 | ||
4094 | @@ -111,8 +111,9 @@ | |||
4095 | 111 | 111 | ||
4096 | 112 | function test_changeScope() { | 112 | function test_changeScope() { |
4097 | 113 | genericScopeView.scope.searchQuery = "test" | 113 | genericScopeView.scope.searchQuery = "test" |
4100 | 114 | genericScopeView.scope = scopes.getScope(2) | 114 | var originalScopeId = genericScopeView.scope.id; |
4101 | 115 | genericScopeView.scope = scopes.getScope(1) | 115 | genericScopeView.scope = scopes.getScope(originalScopeId + 1) |
4102 | 116 | genericScopeView.scope = scopes.getScope(originalScopeId) | ||
4103 | 116 | tryCompare(genericScopeView.scope, "searchQuery", "test") | 117 | tryCompare(genericScopeView.scope, "searchQuery", "test") |
4104 | 117 | } | 118 | } |
4105 | 118 | 119 | ||
4106 | @@ -198,6 +199,8 @@ | |||
4107 | 198 | openPreview(4, 0); | 199 | openPreview(4, 0); |
4108 | 199 | 200 | ||
4109 | 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."); |
4110 | 202 | |||
4111 | 203 | closePreview(); | ||
4112 | 201 | } | 204 | } |
4113 | 202 | 205 | ||
4114 | 203 | function test_narrow_delegate_ranges_expand() { | 206 | function test_narrow_delegate_ranges_expand() { |
4115 | @@ -232,7 +235,7 @@ | |||
4116 | 232 | } | 235 | } |
4117 | 233 | 236 | ||
4118 | 234 | function test_single_category_expansion() { | 237 | function test_single_category_expansion() { |
4120 | 235 | genericScopeView.scope = scopes.getScope(4); | 238 | genericScopeView.scope = scopes.getScope(3); |
4121 | 236 | 239 | ||
4122 | 237 | tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory0") != undefined; }, true); | 240 | tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory0") != undefined; }, true); |
4123 | 238 | var category = findChild(genericScopeView, "dashCategory0") | 241 | var category = findChild(genericScopeView, "dashCategory0") |
4124 | @@ -329,8 +332,8 @@ | |||
4125 | 329 | function test_header_style_data() { | 332 | function test_header_style_data() { |
4126 | 330 | return [ | 333 | return [ |
4127 | 331 | { tag: "Default", index: 0, foreground: "grey", background: "", logo: "" }, | 334 | { tag: "Default", index: 0, foreground: "grey", background: "", logo: "" }, |
4130 | 332 | { tag: "Foreground", index: 2, foreground: "yellow", background: "", logo: "" }, | 335 | { tag: "Foreground", index: 1, foreground: "yellow", background: "", logo: "" }, |
4131 | 333 | { tag: "Logo+Background", index: 3, foreground: "grey", background: "gradient:///lightgrey/grey", | 336 | { tag: "Logo+Background", index: 2, foreground: "grey", background: "gradient:///lightgrey/grey", |
4132 | 334 | logo: Qt.resolvedUrl("../Components/tst_PageHeader/logo-ubuntu-orange.svg") }, | 337 | logo: Qt.resolvedUrl("../Components/tst_PageHeader/logo-ubuntu-orange.svg") }, |
4133 | 335 | ]; | 338 | ]; |
4134 | 336 | } | 339 | } |
FAILED: Continuous integration, rev:1093 /code.launchpad .net/~cimi/ unity8/ card_emblems_ 2/+merge/ 229046/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ unity8- ci/3707/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/2833 jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- utopic/ 709 jenkins. qa.ubuntu. com/job/ unity8- utopic- amd64-ci/ 801 jenkins. qa.ubuntu. com/job/ unity8- utopic- armhf-ci/ 801 jenkins. qa.ubuntu. com/job/ unity8- utopic- armhf-ci/ 801/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity8- utopic- i386-ci/ 801 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- mako/2913 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/4076 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/4076/ artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 10782
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity8- ci/3707/ rebuild
http://