Merge lp:~cimi/unity8/scope-settings into lp:unity8

Proposed by Andrea Cimitan on 2014-08-07
Status: Superseded
Proposed branch: lp:~cimi/unity8/scope-settings
Merge into: lp:unity8
Diff against target: 4142 lines (+2536/-286)
48 files modified
data/unity8-dash.conf (+1/-1)
plugins/Dash/CardCreator.js (+3/-2)
plugins/Dash/ScopeStyle.qml (+3/-2)
plugins/Dash/listviewwithpageheader.cpp (+10/-2)
plugins/Dash/listviewwithpageheader.h (+3/-0)
po/hu.po (+69/-33)
po/sl.po (+67/-31)
po/unity8.pot (+80/-44)
qml/Components/PageHeader.qml (+13/-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 (+168/-64)
qml/Dash/PreviewListView.qml (+4/-2)
qml/Dash/ScopeSettings/ScopeSetting.qml (+36/-0)
qml/Dash/ScopeSettings/ScopeSettingLabel.qml (+51/-0)
qml/Dash/ScopeSettings/ScopeSettingList.qml (+37/-0)
qml/Dash/ScopeSettings/ScopeSettingNumber.qml (+52/-0)
qml/Dash/ScopeSettings/ScopeSettingSwitch.qml (+48/-0)
qml/Dash/ScopeSettings/ScopeSettingWidgetFactory.qml (+55/-0)
qml/Dash/ScopeSettings/ScopeSettings.qml (+35/-0)
qml/Dash/ScopeSettingsPage.qml (+54/-0)
qml/Dash/ScopesOverview.qml (+533/-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_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/2.res (+2/-2)
tests/plugins/Dash/cardcreator/5.res (+8/-6)
tests/plugins/Dash/cardcreator/7.res (+4/-4)
tests/plugins/Dash/tst_ScopeStyle.qml (+1/-1)
tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingSwitch.qml (+33/-0)
tests/qmltests/Dash/tst_Dash.qml (+229/-7)
tests/qmltests/Dash/tst_DashContent.qml (+7/-6)
tests/qmltests/Dash/tst_GenericScopeView.qml (+36/-34)
To merge this branch: bzr merge lp:~cimi/unity8/scope-settings
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing on 2014-08-08
Unity Team 2014-08-07 Pending
Review via email: mp+229995@code.launchpad.net

Commit message

WIP but let's jenkins build the packages

Description of the change

WIP but let's jenkins build the packages

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~cimi/unity8/scope-settings updated on 2014-08-26
1112. By Andrea Cimitan on 2014-08-08

Merged dash overview

1113. By Andrea Cimitan on 2014-08-08

Remerged

1114. By Andrea Cimitan on 2014-08-09

Whitespaces

1115. By Andrea Cimitan on 2014-08-11

Add small tests

1116. By Andrea Cimitan on 2014-08-11

Added more tests

1117. By Andrea Cimitan on 2014-08-12

Merge trunk

1118. By Andrea Cimitan on 2014-08-12

Added fake settings

1119. By Andrea Cimitan on 2014-08-12

Moar fixes

1120. By Andrea Cimitan on 2014-08-12

Added tests for settings open close

1121. By Andrea Cimitan on 2014-08-13

Update ScopeSettingBoolean

1122. By Andrea Cimitan on 2014-08-14

Merge el trunko

1123. By Andrea Cimitan on 2014-08-15

Force focus properly

1124. By Andrea Cimitan on 2014-08-15

Merged horizontal list

1125. By Andrea Cimitan on 2014-08-15

Fix issue with initial count for preview

1126. By Andrea Cimitan on 2014-08-15

Should not feature overview in settings page

1127. By Andrea Cimitan on 2014-08-16

Workaround test

1128. By Andrea Cimitan on 2014-08-16

Properly fix tests

1129. By Andrea Cimitan on 2014-08-16

Better the string test too

1130. By Andrea Cimitan on 2014-08-16

Fix issue with preview in scope overview

1131. By Andrea Cimitan on 2014-08-18

[ CI bot ]
* Resync trunk
[ Michał Sawicz ]
* Fix dash overview test and prevent crash in mock ApplicationInfo's
  d'tor. tryCompareFunction didn't work because .item threw.
[ Michael Terry ]
* Bring dialer to front on incoming call even when device is locked
  (LP: #1354532)
[ CI bot ]
* Resync trunk
[ Michał Sawicz ]
* Use palette's baseText for text colour in dash.
* Update qmltypes definitions
* Move PageHeader out of qml/Components into qml/Dash
* Reshuffle and update dependencies
* Fix cardtool test and make card creator output debugging info on
  errors.
* Support previews for scopes in overview and hook up preview
  processing to activity indicator.
* Fix notifications indicator title
* Fix horizontal list activation and add test for it.
[ Ying-Chun Liu ]
* Add button colors and i18n for power off dialog. (LP: #1354506)
[ Mirco Müller ]
* Force plain-text rendering for summary- and body-text. (LP:
  #1335787)

1132. By Andrea Cimitan on 2014-08-18

More stuff addressed

1133. By Andrea Cimitan on 2014-08-19

Fixed tests

1134. By Andrea Cimitan on 2014-08-22

[ CI bot ]
* Resync trunk
[ Nick Dedekind ]
* Fixed CachedUnityMenuModel destruction unhinging indicators. (LP:
  #1328646)
[ Mirco Müller ]
* Temporarily disable any opacity-animation for notifications to
  unblock the train due to LP: 1354406. (LP: #1354406)

1135. By Andrea Cimitan on 2014-08-25

Removed previewShown and settingsShown properties

1136. By Andrea Cimitan on 2014-08-25

More changes requested

1137. By Andrea Cimitan on 2014-08-25

More fixes

1138. By Andrea Cimitan on 2014-08-25

More changes, still doesn't work

1139. By Andrea Cimitan on 2014-08-25

More changes to review

1140. By Andrea Cimitan on 2014-08-25

Fix tests with refactor

1141. By Andrea Cimitan on 2014-08-26

Another thing addressed

1142. By Andrea Cimitan on 2014-08-26

Changes according to review

1143. By Andrea Cimitan on 2014-08-26

merged trunk

1144. By Andrea Cimitan on 2014-08-26

More changes

1145. By Andrea Cimitan on 2014-08-26

Fixed tests

1146. By Andrea Cimitan on 2014-08-26

Test initialValue

1147. By Andrea Cimitan on 2014-08-26

Other approach to test

1148. By Andrea Cimitan on 2014-08-26

New approach to test

1149. By Andrea Cimitan on 2014-08-26

merged lp:~unity-team/unity8/alt_nav_support

Unmerged revisions

1149. By Andrea Cimitan on 2014-08-26

merged lp:~unity-team/unity8/alt_nav_support

Preview Diff

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

Subscribers

People subscribed via source and target branches