Merge lp:~aacid/unity8/scopeSearchHintText into lp:unity8
- scopeSearchHintText
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~aacid/unity8/scopeSearchHintText |
Merge into: | lp:unity8 |
Diff against target: |
2711 lines (+1789/-111) 35 files modified
data/unity8.conf (+1/-1) debian/control (+1/-1) plugins/Dash/CardCreator.js (+2/-1) plugins/Dash/ScopeStyle.qml (+2/-2) plugins/Dash/listviewwithpageheader.cpp (+2/-2) po/unity8.pot (+44/-12) qml/Components/PageHeader.qml (+27/-8) qml/Components/ResponsiveGridView.qml (+3/-3) qml/Dash/CardCarousel.qml (+2/-2) qml/Dash/CardGrid.qml (+14/-3) qml/Dash/CardVerticalJournal.qml (+2/-2) qml/Dash/Dash.qml (+138/-7) qml/Dash/DashBackground.qml (+24/-0) qml/Dash/DashContent.qml (+7/-4) qml/Dash/DashRenderer.qml (+5/-2) qml/Dash/GenericScopeView.qml (+57/-26) qml/Dash/PreviewListView.qml (+2/-2) qml/Dash/ScopesOverview.qml (+518/-0) qml/Dash/ScopesOverviewAll.qml (+54/-0) qml/Dash/ScopesOverviewFavorites.qml (+73/-0) qml/Dash/ScopesOverviewTab.qml (+74/-0) qml/Shell.qml (+2/-8) tests/autopilot/unity8/shell/emulators/dash.py (+9/-0) tests/mocks/Unity/CMakeLists.txt (+2/-1) tests/mocks/Unity/fake_resultsmodel.cpp (+2/-1) tests/mocks/Unity/fake_scope.cpp (+19/-6) tests/mocks/Unity/fake_scope.h (+6/-3) tests/mocks/Unity/fake_scopes.cpp (+43/-2) tests/mocks/Unity/fake_scopes.h (+6/-0) tests/mocks/Unity/fake_scopesoverview.cpp (+280/-0) tests/mocks/Unity/fake_scopesoverview.h (+104/-0) tests/plugins/Dash/cardcreator/5.res (+1/-0) tests/qmltests/Components/tst_PageHeader.qml (+36/-6) tests/qmltests/Dash/tst_Dash.qml (+211/-3) tests/qmltests/Dash/tst_DashContent.qml (+16/-3) |
To merge this branch: | bzr merge lp:~aacid/unity8/scopeSearchHintText |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Michael Zanetti (community) | Approve | ||
Review via email: mp+228279@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-07-29.
Commit message
Pass the scope search hint up to the search line
Description of the change
* Are there any related MPs required for this MP to build/function as expected?
https:/
No, but there is a crash somewhere in scopes plugin that makes it crash for some scopes and also we have a white on white text problem, so it eihter needs the SDK team to fix the color on SuruDark or the Dash being a separate app so we can not use SuruDark theme
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes, changed hint color of /usr/lib/
* Did you make sure that your branch does not contain spurious tags?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
* If you changed the UI, has there been a design review?
This is requested by design
Michael Zanetti (mzanetti) wrote : | # |
Otherwise it works fine except the above mentioned issues. I tried to merge it into the dash-as-app branch but that makes me hit the mentioned crash.
- 1082. By Albert Astals Cid
-
Check the searchhint travels up correcly through the layers
Albert Astals Cid (aacid) wrote : | # |
> I think we could add a simple test here to make sure the value from the scope
> ends up in the placeholderText.
Added.
- 1083. By Albert Astals Cid
-
Merge
Michael Zanetti (mzanetti) wrote : | # |
thanks. looks good.
* Did you perform an exploratory manual test run of the code change and any related functionality?
yeah man!
* Did CI run pass? If not, please explain why.
CI? what's that?
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1081
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1081
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1084. By Albert Astals Cid
-
Merge
- 1085. By Albert Astals Cid
- 1086. By Albert Astals Cid
-
Merge
- 1087. By Albert Astals Cid
-
Merge
- 1088. By Albert Astals Cid
-
Merge
- 1089. By Albert Astals Cid
-
Merge
- 1090. By Albert Astals Cid
-
Merge
- 1091. By Albert Astals Cid
-
Merge
- 1092. By Albert Astals Cid
-
Merge
- 1093. By Albert Astals Cid
-
Merge
- 1094. By Albert Astals Cid
-
Merge
- 1095. By Albert Astals Cid
-
Merge
Unmerged revisions
Preview Diff
1 | === modified file 'data/unity8.conf' | |||
2 | --- data/unity8.conf 2014-07-16 15:51:56 +0000 | |||
3 | +++ data/unity8.conf 2014-07-29 11:27:22 +0000 | |||
4 | @@ -36,7 +36,7 @@ | |||
5 | 36 | 36 | ||
6 | 37 | if [ -z "$UNITY_SCOPES_LIST" ]; then | 37 | if [ -z "$UNITY_SCOPES_LIST" ]; then |
7 | 38 | # FIXME: remove once we have this in dconf | 38 | # FIXME: remove once we have this in dconf |
9 | 39 | initctl set-env UNITY_SCOPES_LIST="scopes;clickscope;musicaggregator;videoaggregator" | 39 | initctl set-env UNITY_SCOPES_LIST="clickscope;musicaggregator;videoaggregator" |
10 | 40 | fi | 40 | fi |
11 | 41 | 41 | ||
12 | 42 | # Remove the socket if still there | 42 | # Remove the socket if still there |
13 | 43 | 43 | ||
14 | === modified file 'debian/control' | |||
15 | --- debian/control 2014-07-24 20:40:44 +0000 | |||
16 | +++ debian/control 2014-07-29 11:27:22 +0000 | |||
17 | @@ -23,7 +23,7 @@ | |||
18 | 23 | libpulse-dev, | 23 | libpulse-dev, |
19 | 24 | libqmenumodel-dev (>= 0.2.8), | 24 | libqmenumodel-dev (>= 0.2.8), |
20 | 25 | libqt5xmlpatterns5-dev, | 25 | libqt5xmlpatterns5-dev, |
22 | 26 | libunity-api-dev (>= 7.85), | 26 | libunity-api-dev (>= 7.87), |
23 | 27 | libunity-mir-dev, | 27 | libunity-mir-dev, |
24 | 28 | libusermetricsoutput1-dev, | 28 | libusermetricsoutput1-dev, |
25 | 29 | libxcb1-dev, | 29 | libxcb1-dev, |
26 | 30 | 30 | ||
27 | === modified file 'plugins/Dash/CardCreator.js' | |||
28 | --- plugins/Dash/CardCreator.js 2014-07-09 19:44:44 +0000 | |||
29 | +++ plugins/Dash/CardCreator.js 2014-07-29 11:27:22 +0000 | |||
30 | @@ -408,7 +408,7 @@ | |||
31 | 408 | mascotCode = kMascotImageCode.arg(anchors).arg(mascotImageVisible); | 408 | mascotCode = kMascotImageCode.arg(anchors).arg(mascotImageVisible); |
32 | 409 | } | 409 | } |
33 | 410 | 410 | ||
35 | 411 | var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey")'; | 411 | 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")'; |
36 | 412 | 412 | ||
37 | 413 | var titleSubtitleCode = ""; | 413 | var titleSubtitleCode = ""; |
38 | 414 | if (hasTitle) { | 414 | if (hasTitle) { |
39 | @@ -438,6 +438,7 @@ | |||
40 | 438 | titleAnchors = 'left: parent.left; \n\ | 438 | titleAnchors = 'left: parent.left; \n\ |
41 | 439 | leftMargin: units.gu(1); \n\ | 439 | leftMargin: units.gu(1); \n\ |
42 | 440 | right: parent.right; \n\ | 440 | right: parent.right; \n\ |
43 | 441 | rightMargin: units.gu(1); \n\ | ||
44 | 441 | top: overlayLoader.top; \n\ | 442 | top: overlayLoader.top; \n\ |
45 | 442 | topMargin: units.gu(1);\n'; | 443 | topMargin: units.gu(1);\n'; |
46 | 443 | } else { | 444 | } else { |
47 | 444 | 445 | ||
48 | === modified file 'plugins/Dash/ScopeStyle.qml' | |||
49 | --- plugins/Dash/ScopeStyle.qml 2014-07-18 18:09:13 +0000 | |||
50 | +++ plugins/Dash/ScopeStyle.qml 2014-07-29 11:27:22 +0000 | |||
51 | @@ -43,9 +43,9 @@ | |||
52 | 43 | 43 | ||
53 | 44 | /*! \brief Luminance threshold for switching between fore and background color | 44 | /*! \brief Luminance threshold for switching between fore and background color |
54 | 45 | 45 | ||
56 | 46 | \note If background colour is not fully opaque, it's not taken into account. | 46 | \note If background colour is not fully opaque, the defaultLightLuminance it's taken into account instead of it. |
57 | 47 | */ | 47 | */ |
59 | 48 | readonly property real threshold: background.a !== 1.0 ? d.foregroundLuminance : (d.foregroundLuminance + d.backgroundLuminance) / 2 | 48 | readonly property real threshold: background.a !== 1.0 ? (d.foregroundLuminance + d.defaultLightLuminance) / 2: (d.foregroundLuminance + d.backgroundLuminance) / 2 |
60 | 49 | 49 | ||
61 | 50 | /*! \brief The lighter of foreground and background colors | 50 | /*! \brief The lighter of foreground and background colors |
62 | 51 | 51 | ||
63 | 52 | 52 | ||
64 | === modified file 'plugins/Dash/listviewwithpageheader.cpp' | |||
65 | --- plugins/Dash/listviewwithpageheader.cpp 2014-07-25 10:47:08 +0000 | |||
66 | +++ plugins/Dash/listviewwithpageheader.cpp 2014-07-29 11:27:22 +0000 | |||
67 | @@ -822,8 +822,8 @@ | |||
68 | 822 | ListItem *nextItem = itemAtIndex(modelIndex + 1); | 822 | ListItem *nextItem = itemAtIndex(modelIndex + 1); |
69 | 823 | if (nextItem) { | 823 | if (nextItem) { |
70 | 824 | listItem->setY(nextItem->y() - listItem->height()); | 824 | listItem->setY(nextItem->y() - listItem->height()); |
73 | 825 | } else if (modelIndex == 0 && m_headerItem) { | 825 | } else if (modelIndex == 0) { |
74 | 826 | listItem->setY(m_headerItem->height()); | 826 | listItem->setY(m_headerItem ? m_headerItem->height() : 0); |
75 | 827 | } else if (!m_visibleItems.isEmpty()) { | 827 | } else if (!m_visibleItems.isEmpty()) { |
76 | 828 | lostItem = true; | 828 | lostItem = true; |
77 | 829 | } | 829 | } |
78 | 830 | 830 | ||
79 | === modified file 'po/unity8.pot' | |||
80 | --- po/unity8.pot 2014-07-11 14:20:12 +0000 | |||
81 | +++ po/unity8.pot 2014-07-29 11:27:22 +0000 | |||
82 | @@ -8,7 +8,7 @@ | |||
83 | 8 | msgstr "" | 8 | msgstr "" |
84 | 9 | "Project-Id-Version: unity8\n" | 9 | "Project-Id-Version: unity8\n" |
85 | 10 | "Report-Msgid-Bugs-To: \n" | 10 | "Report-Msgid-Bugs-To: \n" |
87 | 11 | "POT-Creation-Date: 2014-07-11 14:59+0200\n" | 11 | "POT-Creation-Date: 2014-07-21 15:41+0200\n" |
88 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
89 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
90 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
91 | @@ -101,7 +101,7 @@ | |||
92 | 101 | msgid "See more" | 101 | msgid "See more" |
93 | 102 | msgstr "" | 102 | msgstr "" |
94 | 103 | 103 | ||
96 | 104 | #: qml/Components/SeeMore.qml:58 qml/Dash/GenericScopeView.qml:330 | 104 | #: qml/Components/SeeMore.qml:58 qml/Dash/GenericScopeView.qml:356 |
97 | 105 | msgid "See less" | 105 | msgid "See less" |
98 | 106 | msgstr "" | 106 | msgstr "" |
99 | 107 | 107 | ||
100 | @@ -109,7 +109,7 @@ | |||
101 | 109 | msgid "Recent" | 109 | msgid "Recent" |
102 | 110 | msgstr "" | 110 | msgstr "" |
103 | 111 | 111 | ||
105 | 112 | #: qml/Dash/GenericScopeView.qml:330 | 112 | #: qml/Dash/GenericScopeView.qml:356 |
106 | 113 | msgid "See all" | 113 | msgid "See all" |
107 | 114 | msgstr "" | 114 | msgstr "" |
108 | 115 | 115 | ||
109 | @@ -133,6 +133,22 @@ | |||
110 | 133 | msgid "Send" | 133 | msgid "Send" |
111 | 134 | msgstr "" | 134 | msgstr "" |
112 | 135 | 135 | ||
113 | 136 | #: qml/Dash/ScopesOverview.qml:185 | ||
114 | 137 | msgid "Manage Dash" | ||
115 | 138 | msgstr "" | ||
116 | 139 | |||
117 | 140 | #: qml/Dash/ScopesOverview.qml:390 | ||
118 | 141 | msgid "Done" | ||
119 | 142 | msgstr "" | ||
120 | 143 | |||
121 | 144 | #: qml/Dash/ScopesOverviewTab.qml:36 | ||
122 | 145 | msgid "Favorites" | ||
123 | 146 | msgstr "" | ||
124 | 147 | |||
125 | 148 | #: qml/Dash/ScopesOverviewTab.qml:54 | ||
126 | 149 | msgid "All" | ||
127 | 150 | msgstr "" | ||
128 | 151 | |||
129 | 136 | #: qml/Greeter/Greeter.qml:157 | 152 | #: qml/Greeter/Greeter.qml:157 |
130 | 137 | msgid "Swipe to unlock" | 153 | msgid "Swipe to unlock" |
131 | 138 | msgstr "" | 154 | msgstr "" |
132 | @@ -157,11 +173,11 @@ | |||
133 | 157 | msgid "Speaking..." | 173 | msgid "Speaking..." |
134 | 158 | msgstr "" | 174 | msgstr "" |
135 | 159 | 175 | ||
137 | 160 | #: qml/Notifications/NotificationMenuItemFactory.qml:91 | 176 | #: qml/Notifications/NotificationMenuItemFactory.qml:97 |
138 | 161 | msgid "Show password" | 177 | msgid "Show password" |
139 | 162 | msgstr "" | 178 | msgstr "" |
140 | 163 | 179 | ||
142 | 164 | #: qml/Notifications/NotificationMenuItemFactory.qml:103 | 180 | #: qml/Notifications/NotificationMenuItemFactory.qml:112 |
143 | 165 | msgid "Please enter SIM PIN" | 181 | msgid "Please enter SIM PIN" |
144 | 166 | msgstr "" | 182 | msgstr "" |
145 | 167 | 183 | ||
146 | @@ -173,27 +189,27 @@ | |||
147 | 173 | msgid "Conference" | 189 | msgid "Conference" |
148 | 174 | msgstr "" | 190 | msgstr "" |
149 | 175 | 191 | ||
151 | 176 | #: qml/Panel/Indicators/MenuItemFactory.qml:583 | 192 | #: qml/Panel/Indicators/MenuItemFactory.qml:577 |
152 | 177 | msgid "In queue…" | 193 | msgid "In queue…" |
153 | 178 | msgstr "" | 194 | msgstr "" |
154 | 179 | 195 | ||
156 | 180 | #: qml/Panel/Indicators/MenuItemFactory.qml:587 | 196 | #: qml/Panel/Indicators/MenuItemFactory.qml:581 |
157 | 181 | msgid "Downloading" | 197 | msgid "Downloading" |
158 | 182 | msgstr "" | 198 | msgstr "" |
159 | 183 | 199 | ||
161 | 184 | #: qml/Panel/Indicators/MenuItemFactory.qml:589 | 200 | #: qml/Panel/Indicators/MenuItemFactory.qml:583 |
162 | 185 | msgid "Paused, tap to resume" | 201 | msgid "Paused, tap to resume" |
163 | 186 | msgstr "" | 202 | msgstr "" |
164 | 187 | 203 | ||
166 | 188 | #: qml/Panel/Indicators/MenuItemFactory.qml:591 | 204 | #: qml/Panel/Indicators/MenuItemFactory.qml:585 |
167 | 189 | msgid "Canceled" | 205 | msgid "Canceled" |
168 | 190 | msgstr "" | 206 | msgstr "" |
169 | 191 | 207 | ||
171 | 192 | #: qml/Panel/Indicators/MenuItemFactory.qml:593 | 208 | #: qml/Panel/Indicators/MenuItemFactory.qml:587 |
172 | 193 | msgid "Finished" | 209 | msgid "Finished" |
173 | 194 | msgstr "" | 210 | msgstr "" |
174 | 195 | 211 | ||
176 | 196 | #: qml/Panel/Indicators/MenuItemFactory.qml:595 | 212 | #: qml/Panel/Indicators/MenuItemFactory.qml:589 |
177 | 197 | msgid "Failed, tap to retry" | 213 | msgid "Failed, tap to retry" |
178 | 198 | msgstr "" | 214 | msgstr "" |
179 | 199 | 215 | ||
180 | @@ -201,7 +217,23 @@ | |||
181 | 201 | msgid "Search" | 217 | msgid "Search" |
182 | 202 | msgstr "" | 218 | msgstr "" |
183 | 203 | 219 | ||
185 | 204 | #: qml/Shell.qml:359 | 220 | #: qml/Shell.qml:347 |
186 | 221 | msgid "Are you sure you would like to turn power off?" | ||
187 | 222 | msgstr "" | ||
188 | 223 | |||
189 | 224 | #: qml/Shell.qml:349 | ||
190 | 225 | msgid "Power off" | ||
191 | 226 | msgstr "" | ||
192 | 227 | |||
193 | 228 | #: qml/Shell.qml:360 | ||
194 | 229 | msgid "Restart" | ||
195 | 230 | msgstr "" | ||
196 | 231 | |||
197 | 232 | #: qml/Shell.qml:369 | ||
198 | 233 | msgid "Cancel" | ||
199 | 234 | msgstr "" | ||
200 | 235 | |||
201 | 236 | #: qml/Shell.qml:496 | ||
202 | 205 | #, qt-format | 237 | #, qt-format |
203 | 206 | msgid "Please enter %1" | 238 | msgid "Please enter %1" |
204 | 207 | msgstr "" | 239 | msgstr "" |
205 | 208 | 240 | ||
206 | === modified file 'qml/Components/PageHeader.qml' | |||
207 | --- qml/Components/PageHeader.qml 2014-07-21 09:49:41 +0000 | |||
208 | +++ qml/Components/PageHeader.qml 2014-07-29 11:27:22 +0000 | |||
209 | @@ -24,7 +24,7 @@ | |||
210 | 24 | Item { | 24 | Item { |
211 | 25 | id: root | 25 | id: root |
212 | 26 | objectName: "pageHeader" | 26 | objectName: "pageHeader" |
214 | 27 | implicitHeight: headerContainer.height + units.gu(2) + bottomContainer.height | 27 | implicitHeight: headerContainer.height + bottomContainer.height + (showSignatureLine ? units.gu(2) : 0) |
215 | 28 | 28 | ||
216 | 29 | property bool showBackButton: false | 29 | property bool showBackButton: false |
217 | 30 | property string title | 30 | property string title |
218 | @@ -32,7 +32,9 @@ | |||
219 | 32 | property bool searchEntryEnabled: false | 32 | property bool searchEntryEnabled: false |
220 | 33 | property ListModel searchHistory: SearchHistoryModel | 33 | property ListModel searchHistory: SearchHistoryModel |
221 | 34 | property alias searchQuery: searchTextField.text | 34 | property alias searchQuery: searchTextField.text |
222 | 35 | property alias searchHint: searchTextField.placeholderText | ||
223 | 35 | property bool searchInProgress: false | 36 | property bool searchInProgress: false |
224 | 37 | property alias showSignatureLine: bottomBorder.visible | ||
225 | 36 | 38 | ||
226 | 37 | property alias bottomItem: bottomContainer.children | 39 | property alias bottomItem: bottomContainer.children |
227 | 38 | 40 | ||
228 | @@ -44,6 +46,12 @@ | |||
229 | 44 | signal backClicked() | 46 | signal backClicked() |
230 | 45 | 47 | ||
231 | 46 | onScopeStyleChanged: refreshLogo() | 48 | onScopeStyleChanged: refreshLogo() |
232 | 49 | onSearchQueryChanged: { | ||
233 | 50 | // Make sure we are at the search page if the search query changes behind our feet | ||
234 | 51 | if (searchQuery) { | ||
235 | 52 | headerContainer.showSearch = true; | ||
236 | 53 | } | ||
237 | 54 | } | ||
238 | 47 | 55 | ||
239 | 48 | function triggerSearch() { | 56 | function triggerSearch() { |
240 | 49 | if (searchEntryEnabled) { | 57 | if (searchEntryEnabled) { |
241 | @@ -52,6 +60,12 @@ | |||
242 | 52 | } | 60 | } |
243 | 53 | } | 61 | } |
244 | 54 | 62 | ||
245 | 63 | function closePopup() { | ||
246 | 64 | if (headerContainer.popover != null) { | ||
247 | 65 | PopupUtils.close(headerContainer.popover); | ||
248 | 66 | } | ||
249 | 67 | } | ||
250 | 68 | |||
251 | 55 | function resetSearch(keepFocus) { | 69 | function resetSearch(keepFocus) { |
252 | 56 | if (searchHistory) { | 70 | if (searchHistory) { |
253 | 57 | searchHistory.addQuery(searchTextField.text); | 71 | searchHistory.addQuery(searchTextField.text); |
254 | @@ -60,9 +74,7 @@ | |||
255 | 60 | unfocus(); | 74 | unfocus(); |
256 | 61 | } | 75 | } |
257 | 62 | searchTextField.text = ""; | 76 | searchTextField.text = ""; |
261 | 63 | if (headerContainer.popover != null) { | 77 | closePopup(); |
259 | 64 | PopupUtils.close(headerContainer.popover); | ||
260 | 65 | } | ||
262 | 66 | } | 78 | } |
263 | 67 | 79 | ||
264 | 68 | function unfocus() { | 80 | function unfocus() { |
265 | @@ -103,9 +115,7 @@ | |||
266 | 103 | anchors { fill: parent; margins: units.gu(1); bottomMargin: units.gu(3) + bottomContainer.height } | 115 | anchors { fill: parent; margins: units.gu(1); bottomMargin: units.gu(3) + bottomContainer.height } |
267 | 104 | visible: headerContainer.showSearch | 116 | visible: headerContainer.showSearch |
268 | 105 | onPressed: { | 117 | onPressed: { |
272 | 106 | if (headerContainer.popover) { | 118 | closePopup(); |
270 | 107 | PopupUtils.close(headerContainer.popover); | ||
271 | 108 | } | ||
273 | 109 | if (!searchTextField.text) { | 119 | if (!searchTextField.text) { |
274 | 110 | headerContainer.showSearch = false; | 120 | headerContainer.showSearch = false; |
275 | 111 | } | 121 | } |
276 | @@ -220,6 +230,12 @@ | |||
277 | 220 | root.openSearchHistory(); | 230 | root.openSearchHistory(); |
278 | 221 | } | 231 | } |
279 | 222 | } | 232 | } |
280 | 233 | |||
281 | 234 | onTextChanged: { | ||
282 | 235 | if (text != "") { | ||
283 | 236 | closePopup(); | ||
284 | 237 | } | ||
285 | 238 | } | ||
286 | 223 | } | 239 | } |
287 | 224 | } | 240 | } |
288 | 225 | 241 | ||
289 | @@ -244,6 +260,7 @@ | |||
290 | 244 | 260 | ||
291 | 245 | actions: [ | 261 | actions: [ |
292 | 246 | Action { | 262 | Action { |
293 | 263 | objectName: "search" | ||
294 | 247 | iconName: "search" | 264 | iconName: "search" |
295 | 248 | visible: root.searchEntryEnabled | 265 | visible: root.searchEntryEnabled |
296 | 249 | onTriggered: { | 266 | onTriggered: { |
297 | @@ -296,6 +313,7 @@ | |||
298 | 296 | 313 | ||
299 | 297 | Repeater { | 314 | Repeater { |
300 | 298 | id: recentSearches | 315 | id: recentSearches |
301 | 316 | objectName: "recentSearches" | ||
302 | 299 | model: searchHistory | 317 | model: searchHistory |
303 | 300 | 318 | ||
304 | 301 | delegate: Standard { | 319 | delegate: Standard { |
305 | @@ -304,7 +322,8 @@ | |||
306 | 304 | onClicked: { | 322 | onClicked: { |
307 | 305 | searchHistory.addQuery(text); | 323 | searchHistory.addQuery(text); |
308 | 306 | searchTextField.text = text; | 324 | searchTextField.text = text; |
310 | 307 | PopupUtils.close(popover); | 325 | closePopup(); |
311 | 326 | unfocus(); | ||
312 | 308 | } | 327 | } |
313 | 309 | } | 328 | } |
314 | 310 | } | 329 | } |
315 | 311 | 330 | ||
316 | === modified file 'qml/Components/ResponsiveGridView.qml' | |||
317 | --- qml/Components/ResponsiveGridView.qml 2014-07-11 12:12:50 +0000 | |||
318 | +++ qml/Components/ResponsiveGridView.qml 2014-07-29 11:27:22 +0000 | |||
319 | @@ -34,7 +34,7 @@ | |||
320 | 34 | readonly property int cellWidth: gridView.cellWidth | 34 | readonly property int cellWidth: gridView.cellWidth |
321 | 35 | readonly property int cellHeight: gridView.cellHeight | 35 | readonly property int cellHeight: gridView.cellHeight |
322 | 36 | readonly property int totalContentHeight: { | 36 | readonly property int totalContentHeight: { |
324 | 37 | return contentHeightForRows(Math.ceil(gridView.model.count / columns)) | 37 | return contentHeightForRows(Math.ceil(gridView.model.count / columns), cellHeight) |
325 | 38 | } | 38 | } |
326 | 39 | property alias interactive: gridView.interactive | 39 | property alias interactive: gridView.interactive |
327 | 40 | readonly property alias flicking: gridView.flicking | 40 | readonly property alias flicking: gridView.flicking |
328 | @@ -47,8 +47,8 @@ | |||
329 | 47 | property alias cacheBuffer: gridView.cacheBuffer | 47 | property alias cacheBuffer: gridView.cacheBuffer |
330 | 48 | readonly property alias currentItem: gridView.currentItem | 48 | readonly property alias currentItem: gridView.currentItem |
331 | 49 | 49 | ||
334 | 50 | function contentHeightForRows(rows) { | 50 | function contentHeightForRows(rows, height) { |
335 | 51 | return rows * cellHeight; | 51 | return rows * height |
336 | 52 | } | 52 | } |
337 | 53 | 53 | ||
338 | 54 | GridView { | 54 | GridView { |
339 | 55 | 55 | ||
340 | === modified file 'qml/Dash/CardCarousel.qml' | |||
341 | --- qml/Dash/CardCarousel.qml 2014-07-11 12:13:08 +0000 | |||
342 | +++ qml/Dash/CardCarousel.qml 2014-07-29 11:27:22 +0000 | |||
343 | @@ -48,8 +48,8 @@ | |||
344 | 48 | 48 | ||
345 | 49 | objectName: "carouselDelegate" + index | 49 | objectName: "carouselDelegate" + index |
346 | 50 | 50 | ||
349 | 51 | function clicked() { cardCarousel.clicked(index, model.result) } | 51 | function clicked() { cardCarousel.clicked(index, model.result, loader.item, model) } |
350 | 52 | function pressAndHold() { cardCarousel.pressAndHold(index, model.result) } | 52 | function pressAndHold() { cardCarousel.pressAndHold(index, model) } |
351 | 53 | 53 | ||
352 | 54 | sourceComponent: cardTool.cardComponent | 54 | sourceComponent: cardTool.cardComponent |
353 | 55 | onLoaded: { | 55 | onLoaded: { |
354 | 56 | 56 | ||
355 | === modified file 'qml/Dash/CardGrid.qml' | |||
356 | --- qml/Dash/CardGrid.qml 2014-07-18 11:35:47 +0000 | |||
357 | +++ qml/Dash/CardGrid.qml 2014-07-29 11:27:22 +0000 | |||
358 | @@ -26,10 +26,20 @@ | |||
359 | 26 | } | 26 | } |
360 | 27 | 27 | ||
361 | 28 | expandedHeight: grid.totalContentHeight | 28 | expandedHeight: grid.totalContentHeight |
363 | 29 | collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows), expandedHeight) | 29 | collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows, grid.cellHeight), expandedHeight) |
364 | 30 | collapsedItemCount: collapsedRows * grid.columns | 30 | collapsedItemCount: collapsedRows * grid.columns |
365 | 31 | originY: grid.originY | 31 | originY: grid.originY |
366 | 32 | 32 | ||
367 | 33 | function cardPosition(index) { | ||
368 | 34 | var pos = {}; | ||
369 | 35 | var row = Math.floor(index / grid.columns); | ||
370 | 36 | var column = index % grid.columns; | ||
371 | 37 | // Bit sad this is not symmetrical | ||
372 | 38 | pos.x = column * grid.cellWidth + grid.margins; | ||
373 | 39 | pos.y = row * grid.cellHeight; | ||
374 | 40 | return pos; | ||
375 | 41 | } | ||
376 | 42 | |||
377 | 33 | ResponsiveGridView { | 43 | ResponsiveGridView { |
378 | 34 | id: grid | 44 | id: grid |
379 | 35 | anchors.fill: parent | 45 | anchors.fill: parent |
380 | @@ -53,6 +63,7 @@ | |||
381 | 53 | item.objectName = "delegate" + index; | 63 | item.objectName = "delegate" + index; |
382 | 54 | item.width = Qt.binding(function() { return cardTool.cardWidth; }); | 64 | item.width = Qt.binding(function() { return cardTool.cardWidth; }); |
383 | 55 | item.height = Qt.binding(function() { return cardTool.cardHeight; }); | 65 | item.height = Qt.binding(function() { return cardTool.cardHeight; }); |
384 | 66 | item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; }); | ||
385 | 56 | item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; }); | 67 | item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; }); |
386 | 57 | item.cardData = Qt.binding(function() { return model; }); | 68 | item.cardData = Qt.binding(function() { return model; }); |
387 | 58 | item.template = Qt.binding(function() { return cardTool.template; }); | 69 | item.template = Qt.binding(function() { return cardTool.template; }); |
388 | @@ -62,8 +73,8 @@ | |||
389 | 62 | } | 73 | } |
390 | 63 | Connections { | 74 | Connections { |
391 | 64 | target: loader.item | 75 | target: loader.item |
394 | 65 | onClicked: root.clicked(index, result) | 76 | onClicked: root.clicked(index, result, loader.item, model) |
395 | 66 | onPressAndHold: root.pressAndHold(index) | 77 | onPressAndHold: root.pressAndHold(index, model) |
396 | 67 | } | 78 | } |
397 | 68 | } | 79 | } |
398 | 69 | } | 80 | } |
399 | 70 | 81 | ||
400 | === modified file 'qml/Dash/CardVerticalJournal.qml' | |||
401 | --- qml/Dash/CardVerticalJournal.qml 2014-07-22 12:17:34 +0000 | |||
402 | +++ qml/Dash/CardVerticalJournal.qml 2014-07-29 11:27:22 +0000 | |||
403 | @@ -61,8 +61,8 @@ | |||
404 | 61 | } | 61 | } |
405 | 62 | Connections { | 62 | Connections { |
406 | 63 | target: loader.item | 63 | target: loader.item |
409 | 64 | onClicked: root.clicked(index, result) | 64 | onClicked: root.clicked(index, result, loader.item, model) |
410 | 65 | onPressAndHold: root.pressAndHold(index) | 65 | onPressAndHold: root.pressAndHold(index, model) |
411 | 66 | } | 66 | } |
412 | 67 | } | 67 | } |
413 | 68 | } | 68 | } |
414 | 69 | 69 | ||
415 | === modified file 'qml/Dash/Dash.qml' | |||
416 | --- qml/Dash/Dash.qml 2014-07-07 08:20:04 +0000 | |||
417 | +++ qml/Dash/Dash.qml 2014-07-29 11:27:22 +0000 | |||
418 | @@ -16,6 +16,7 @@ | |||
419 | 16 | 16 | ||
420 | 17 | import QtQuick 2.0 | 17 | import QtQuick 2.0 |
421 | 18 | import Ubuntu.Components 0.1 | 18 | import Ubuntu.Components 0.1 |
422 | 19 | import Ubuntu.Gestures 0.1 | ||
423 | 19 | import Unity 0.2 | 20 | import Unity 0.2 |
424 | 20 | import Utils 0.1 | 21 | import Utils 0.1 |
425 | 21 | import "../Components" | 22 | import "../Components" |
426 | @@ -29,6 +30,8 @@ | |||
427 | 29 | property string showScopeOnLoaded: "clickscope" | 30 | property string showScopeOnLoaded: "clickscope" |
428 | 30 | property real contentScale: 1.0 | 31 | property real contentScale: 1.0 |
429 | 31 | 32 | ||
430 | 33 | property alias overviewHandleHeight: overviewDragHandle.height | ||
431 | 34 | |||
432 | 32 | function setCurrentScope(scopeId, animate, reset) { | 35 | function setCurrentScope(scopeId, animate, reset) { |
433 | 33 | var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId) | 36 | var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId) |
434 | 34 | 37 | ||
435 | @@ -66,19 +69,85 @@ | |||
436 | 66 | filterRegExp: RegExp("^true$") | 69 | filterRegExp: RegExp("^true$") |
437 | 67 | } | 70 | } |
438 | 68 | 71 | ||
439 | 72 | QtObject { | ||
440 | 73 | id: overviewController | ||
441 | 74 | objectName: "overviewController" | ||
442 | 75 | |||
443 | 76 | property alias enableAnimation: progressAnimation.enabled | ||
444 | 77 | property real progress: 0 | ||
445 | 78 | Behavior on progress { | ||
446 | 79 | id: progressAnimation | ||
447 | 80 | UbuntuNumberAnimation { } | ||
448 | 81 | } | ||
449 | 82 | } | ||
450 | 83 | |||
451 | 84 | ScopesOverview { | ||
452 | 85 | id: scopesOverview | ||
453 | 86 | objectName: "scopesOverview" | ||
454 | 87 | anchors.fill: parent | ||
455 | 88 | scope: scopes.overviewScope | ||
456 | 89 | progress: overviewController.progress | ||
457 | 90 | scopeScale: scopeItem.scope ? 0.4 : (1 - overviewController.progress * 0.6) | ||
458 | 91 | visible: scopeScale != 1 | ||
459 | 92 | currentIndex: dashContent.currentIndex | ||
460 | 93 | onDone: { | ||
461 | 94 | if (currentTab == 1) { | ||
462 | 95 | animateDashFromAll(dashContent.currentScopeId); | ||
463 | 96 | } | ||
464 | 97 | hide(); | ||
465 | 98 | } | ||
466 | 99 | onFavoriteSelected: { | ||
467 | 100 | setCurrentScope(scopeId, false, false); | ||
468 | 101 | hide(); | ||
469 | 102 | } | ||
470 | 103 | onAllFavoriteSelected: { | ||
471 | 104 | setCurrentScope(scopeId, false, false); | ||
472 | 105 | animateDashFromAll(dashContent.currentScopeId); | ||
473 | 106 | hide(); | ||
474 | 107 | } | ||
475 | 108 | onSearchSelected: { | ||
476 | 109 | var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId); | ||
477 | 110 | if (scopeIndex >= 0) { | ||
478 | 111 | // Is a favorite one | ||
479 | 112 | setCurrentScope(scopeId, false, false); | ||
480 | 113 | showDashFromPos(pos, size); | ||
481 | 114 | hide(); | ||
482 | 115 | } else { | ||
483 | 116 | // Is not a favorite one, activate and get openScope | ||
484 | 117 | scope.activate(result); | ||
485 | 118 | } | ||
486 | 119 | } | ||
487 | 120 | function hide() { | ||
488 | 121 | overviewController.enableAnimation = true; | ||
489 | 122 | overviewController.progress = 0; | ||
490 | 123 | } | ||
491 | 124 | onProgressChanged: { | ||
492 | 125 | if (progress == 0) { | ||
493 | 126 | currentTab = scopeItem.scope ? 1 : 0; | ||
494 | 127 | } | ||
495 | 128 | } | ||
496 | 129 | } | ||
497 | 130 | |||
498 | 69 | DashContent { | 131 | DashContent { |
499 | 70 | id: dashContent | 132 | id: dashContent |
500 | 133 | |||
501 | 134 | property var scopeThatOpenedScope: null | ||
502 | 135 | |||
503 | 136 | parent: overviewController.progress == 0 ? dash : scopesOverview.dashItemEater | ||
504 | 71 | objectName: "dashContent" | 137 | objectName: "dashContent" |
507 | 72 | width: parent.width | 138 | width: dash.width |
508 | 73 | height: parent.height | 139 | height: dash.height |
509 | 74 | model: filteredScopes | 140 | model: filteredScopes |
510 | 75 | scopes: scopes | 141 | scopes: scopes |
512 | 76 | visible: x != -width | 142 | visible: !scopesOverview.showingNonFavoriteScope && x != -width |
513 | 77 | onGotoScope: { | 143 | onGotoScope: { |
514 | 78 | dash.setCurrentScope(scopeId, true, false); | 144 | dash.setCurrentScope(scopeId, true, false); |
515 | 79 | } | 145 | } |
516 | 80 | onOpenScope: { | 146 | onOpenScope: { |
517 | 147 | scopeThatOpenedScope = currentScope; | ||
518 | 81 | scopeItem.scope = scope; | 148 | scopeItem.scope = scope; |
519 | 149 | scopesOverview.currentTab = 1; | ||
520 | 150 | scopesOverview.ensureAllScopeVisible(scope.id); | ||
521 | 82 | x = -width; | 151 | x = -width; |
522 | 83 | } | 152 | } |
523 | 84 | onScopeLoaded: { | 153 | onScopeLoaded: { |
524 | @@ -88,25 +157,63 @@ | |||
525 | 88 | } | 157 | } |
526 | 89 | } | 158 | } |
527 | 90 | scale: dash.contentScale | 159 | scale: dash.contentScale |
529 | 91 | clip: scale != 1.0 || scopeItem.visible | 160 | clip: scale != 1.0 || scopeItem.visible || overviewController.progress != 0 |
530 | 92 | Behavior on x { | 161 | Behavior on x { |
531 | 93 | UbuntuNumberAnimation { | 162 | UbuntuNumberAnimation { |
532 | 163 | duration: overviewController.progress != 0 ? 0 : UbuntuAnimation.FastDuration | ||
533 | 94 | onRunningChanged: { | 164 | onRunningChanged: { |
534 | 95 | if (!running && dashContent.x == 0) { | 165 | if (!running && dashContent.x == 0) { |
536 | 96 | dashContent.closeScope(scopeItem.scope); | 166 | dashContent.scopeThatOpenedScope.closeScope(scopeItem.scope); |
537 | 97 | scopeItem.scope = null; | 167 | scopeItem.scope = null; |
538 | 168 | if (overviewController.progress == 0) { | ||
539 | 169 | // Set tab to Favorites only if we are not showing the overview | ||
540 | 170 | scopesOverview.currentTab = 0; | ||
541 | 171 | } | ||
542 | 98 | } | 172 | } |
543 | 99 | } | 173 | } |
544 | 100 | } | 174 | } |
545 | 101 | } | 175 | } |
546 | 176 | |||
547 | 177 | enabled: opacity == 1 | ||
548 | 178 | opacity: scopesOverview.growingDashFromPos ? 1 : 1 - overviewController.progress | ||
549 | 179 | } | ||
550 | 180 | |||
551 | 181 | DashBackground | ||
552 | 182 | { | ||
553 | 183 | anchors.fill: scopeItem | ||
554 | 184 | visible: scopeItem.visible | ||
555 | 185 | parent: scopeItem.parent | ||
556 | 186 | scale: scopeItem.scale | ||
557 | 187 | opacity: scopeItem.opacity | ||
558 | 102 | } | 188 | } |
559 | 103 | 189 | ||
560 | 104 | GenericScopeView { | 190 | GenericScopeView { |
561 | 105 | id: scopeItem | 191 | id: scopeItem |
563 | 106 | anchors.left: dashContent.right | 192 | objectName: "dashTempScopeItem" |
564 | 193 | |||
565 | 194 | readonly property real targetOverviewScale: { | ||
566 | 195 | if (scopesOverview.currentTab == 0) { | ||
567 | 196 | return 0.4; | ||
568 | 197 | } else { | ||
569 | 198 | return scopesOverview.allCardSize.width / scopeItem.width; | ||
570 | 199 | } | ||
571 | 200 | } | ||
572 | 201 | readonly property real overviewProgressScale: (1 - overviewController.progress * (1 - targetOverviewScale)) | ||
573 | 202 | readonly property var targetOverviewPosition: scope ? scopesOverview.allScopeCardPosition(scope.id) : null | ||
574 | 203 | readonly property real overviewProgressX: scope && scopesOverview.currentTab == 1 && targetOverviewPosition ? | ||
575 | 204 | overviewController.progress * (targetOverviewPosition.x - (width - scopesOverview.allCardSize.width) / 2) | ||
576 | 205 | : 0 | ||
577 | 206 | readonly property real overviewProgressY: scope && scopesOverview.currentTab == 1 && targetOverviewPosition ? | ||
578 | 207 | overviewController.progress * (targetOverviewPosition.y - (height - scopesOverview.allCardSize.height) / 2) | ||
579 | 208 | : 0 | ||
580 | 209 | |||
581 | 210 | x: overviewController.progress == 0 ? dashContent.x + width : overviewProgressX | ||
582 | 211 | y: overviewController.progress == 0 ? dashContent.y : overviewProgressY | ||
583 | 107 | width: parent.width | 212 | width: parent.width |
584 | 108 | height: parent.height | 213 | height: parent.height |
586 | 109 | scale: dash.contentScale | 214 | scale: dash.contentScale * overviewProgressScale |
587 | 215 | enabled: opacity == 1 | ||
588 | 216 | opacity: 1 - overviewController.progress | ||
589 | 110 | clip: scale != 1.0 | 217 | clip: scale != 1.0 |
590 | 111 | visible: scope != null | 218 | visible: scope != null |
591 | 112 | hasBackAction: true | 219 | hasBackAction: true |
592 | @@ -126,4 +233,28 @@ | |||
593 | 126 | } | 233 | } |
594 | 127 | } | 234 | } |
595 | 128 | } | 235 | } |
596 | 236 | |||
597 | 237 | EdgeDragArea { | ||
598 | 238 | id: overviewDragHandle | ||
599 | 239 | objectName: "overviewDragHandle" | ||
600 | 240 | z: 1 | ||
601 | 241 | direction: Direction.Upwards | ||
602 | 242 | enabled: !dashContent.previewShown && dashContent.currentScope && dashContent.currentScope.searchQuery == "" && (overviewController.progress == 0 || dragging) | ||
603 | 243 | |||
604 | 244 | readonly property real fullMovement: units.gu(20) | ||
605 | 245 | |||
606 | 246 | anchors { left: parent.left; right: parent.right; bottom: parent.bottom } | ||
607 | 247 | height: units.gu(2) | ||
608 | 248 | |||
609 | 249 | onSceneDistanceChanged: { | ||
610 | 250 | overviewController.enableAnimation = false; | ||
611 | 251 | overviewController.progress = Math.max(0, Math.min(1, sceneDistance / fullMovement)); | ||
612 | 252 | } | ||
613 | 253 | |||
614 | 254 | onDraggingChanged: { | ||
615 | 255 | overviewController.enableAnimation = true; | ||
616 | 256 | overviewController.progress = (overviewController.progress > 0.7) ? 1 : 0; | ||
617 | 257 | } | ||
618 | 258 | } | ||
619 | 259 | |||
620 | 129 | } | 260 | } |
621 | 130 | 261 | ||
622 | === added file 'qml/Dash/DashBackground.qml' | |||
623 | --- qml/Dash/DashBackground.qml 1970-01-01 00:00:00 +0000 | |||
624 | +++ qml/Dash/DashBackground.qml 2014-07-29 11:27:22 +0000 | |||
625 | @@ -0,0 +1,24 @@ | |||
626 | 1 | /* | ||
627 | 2 | * Copyright (C) 2013, 2014 Canonical, Ltd. | ||
628 | 3 | * | ||
629 | 4 | * This program is free software; you can redistribute it and/or modify | ||
630 | 5 | * it under the terms of the GNU General Public License as published by | ||
631 | 6 | * the Free Software Foundation; version 3. | ||
632 | 7 | * | ||
633 | 8 | * This program is distributed in the hope that it will be useful, | ||
634 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
635 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
636 | 11 | * GNU General Public License for more details. | ||
637 | 12 | * | ||
638 | 13 | * You should have received a copy of the GNU General Public License | ||
639 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
640 | 15 | */ | ||
641 | 16 | |||
642 | 17 | import QtQuick 2.0 | ||
643 | 18 | |||
644 | 19 | Image { | ||
645 | 20 | source: anchors.fill.width > anchors.fill.height ? "graphics/paper_landscape.png" : "graphics/paper_portrait.png" | ||
646 | 21 | fillMode: Image.PreserveAspectCrop | ||
647 | 22 | horizontalAlignment: Image.AlignRight | ||
648 | 23 | verticalAlignment: Image.AlignTop | ||
649 | 24 | } | ||
650 | 0 | 25 | ||
651 | === modified file 'qml/Dash/DashContent.qml' | |||
652 | --- qml/Dash/DashContent.qml 2014-07-08 19:35:59 +0000 | |||
653 | +++ qml/Dash/DashContent.qml 2014-07-29 11:27:22 +0000 | |||
654 | @@ -26,6 +26,9 @@ | |||
655 | 26 | property var model: null | 26 | property var model: null |
656 | 27 | property var scopes: null | 27 | property var scopes: null |
657 | 28 | readonly property alias currentIndex: dashContentList.currentIndex | 28 | readonly property alias currentIndex: dashContentList.currentIndex |
658 | 29 | readonly property string currentScopeId: dashContentList.currentItem ? dashContentList.currentItem.scopeId : "" | ||
659 | 30 | readonly property var currentScope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null | ||
660 | 31 | readonly property bool previewShown: dashContentList.currentItem && dashContentList.currentItem.item ? dashContentList.currentItem.item.previewShown : false | ||
661 | 29 | 32 | ||
662 | 30 | signal scopeLoaded(string scopeId) | 33 | signal scopeLoaded(string scopeId) |
663 | 31 | signal gotoScope(string scopeId) | 34 | signal gotoScope(string scopeId) |
664 | @@ -76,15 +79,15 @@ | |||
665 | 76 | } | 79 | } |
666 | 77 | } | 80 | } |
667 | 78 | 81 | ||
668 | 79 | function closeScope(scope) { | ||
669 | 80 | dashContentList.currentItem.theScope.closeScope(scope) | ||
670 | 81 | } | ||
671 | 82 | |||
672 | 83 | Item { | 82 | Item { |
673 | 84 | id: dashContentListHolder | 83 | id: dashContentListHolder |
674 | 85 | 84 | ||
675 | 86 | anchors.fill: parent | 85 | anchors.fill: parent |
676 | 87 | 86 | ||
677 | 87 | DashBackground { | ||
678 | 88 | anchors.fill: parent | ||
679 | 89 | } | ||
680 | 90 | |||
681 | 88 | ListView { | 91 | ListView { |
682 | 89 | id: dashContentList | 92 | id: dashContentList |
683 | 90 | objectName: "dashContentList" | 93 | objectName: "dashContentList" |
684 | 91 | 94 | ||
685 | === modified file 'qml/Dash/DashRenderer.qml' | |||
686 | --- qml/Dash/DashRenderer.qml 2014-07-22 12:17:34 +0000 | |||
687 | +++ qml/Dash/DashRenderer.qml 2014-07-29 11:27:22 +0000 | |||
688 | @@ -41,9 +41,12 @@ | |||
689 | 41 | /// Emitted when the user clicked on an item | 41 | /// Emitted when the user clicked on an item |
690 | 42 | /// @param index is the index of the clicked item | 42 | /// @param index is the index of the clicked item |
691 | 43 | /// @param result result model of the cliked item, used for activation | 43 | /// @param result result model of the cliked item, used for activation |
693 | 44 | signal clicked(int index, var result) | 44 | /// @param item item that has been clicked |
694 | 45 | /// @param itemModel model of the item | ||
695 | 46 | signal clicked(int index, var result, var item, var itemModel) | ||
696 | 45 | 47 | ||
697 | 46 | /// Emitted when the user pressed and held on an item | 48 | /// Emitted when the user pressed and held on an item |
698 | 47 | /// @param index is the index of the held item | 49 | /// @param index is the index of the held item |
700 | 48 | signal pressAndHold(int index) | 50 | /// @param itemModel model of the item |
701 | 51 | signal pressAndHold(int index, var itemModel) | ||
702 | 49 | } | 52 | } |
703 | 50 | 53 | ||
704 | === modified file 'qml/Dash/GenericScopeView.qml' | |||
705 | --- qml/Dash/GenericScopeView.qml 2014-07-24 20:40:44 +0000 | |||
706 | +++ qml/Dash/GenericScopeView.qml 2014-07-29 11:27:22 +0000 | |||
707 | @@ -33,6 +33,10 @@ | |||
708 | 33 | property bool hasBackAction: false | 33 | property bool hasBackAction: false |
709 | 34 | property bool enableHeightBehaviorOnNextCreation: false | 34 | property bool enableHeightBehaviorOnNextCreation: false |
710 | 35 | property var categoryView: categoryView | 35 | property var categoryView: categoryView |
711 | 36 | property bool showPageHeader: true | ||
712 | 37 | property var clickOverride: null | ||
713 | 38 | property var pressAndHoldOverride: null | ||
714 | 39 | readonly property alias previewShown: previewListView.open | ||
715 | 36 | 40 | ||
716 | 37 | property var scopeStyle: ScopeStyle { | 41 | property var scopeStyle: ScopeStyle { |
717 | 38 | style: scope ? scope.customizations : {} | 42 | style: scope ? scope.customizations : {} |
718 | @@ -78,22 +82,24 @@ | |||
719 | 78 | } | 82 | } |
720 | 79 | 83 | ||
721 | 80 | onIsCurrentChanged: { | 84 | onIsCurrentChanged: { |
723 | 81 | pageHeader.resetSearch(); | 85 | if (showPageHeader) { |
724 | 86 | pageHeaderLoader.item.resetSearch(); | ||
725 | 87 | } | ||
726 | 82 | previewListView.open = false; | 88 | previewListView.open = false; |
727 | 83 | } | 89 | } |
728 | 84 | 90 | ||
729 | 85 | Binding { | 91 | Binding { |
730 | 86 | target: scopeView.scope | 92 | target: scopeView.scope |
731 | 87 | property: "searchQuery" | 93 | property: "searchQuery" |
734 | 88 | value: pageHeader.searchQuery | 94 | value: pageHeaderLoader.item ? pageHeaderLoader.item.searchQuery : "" |
735 | 89 | when: isCurrent | 95 | when: isCurrent && showPageHeader |
736 | 90 | } | 96 | } |
737 | 91 | 97 | ||
738 | 92 | Binding { | 98 | Binding { |
740 | 93 | target: pageHeader | 99 | target: pageHeaderLoader.item |
741 | 94 | property: "searchQuery" | 100 | property: "searchQuery" |
742 | 95 | value: scopeView.scope ? scopeView.scope.searchQuery : "" | 101 | value: scopeView.scope ? scopeView.scope.searchQuery : "" |
744 | 96 | when: isCurrent | 102 | when: isCurrent && showPageHeader |
745 | 97 | } | 103 | } |
746 | 98 | 104 | ||
747 | 99 | Connections { | 105 | Connections { |
748 | @@ -232,7 +238,12 @@ | |||
749 | 232 | Connections { | 238 | Connections { |
750 | 233 | target: rendererLoader.item | 239 | target: rendererLoader.item |
751 | 234 | onClicked: { | 240 | onClicked: { |
753 | 235 | if (scopeView.scope.id === "scopes" || scopeView.scope.id == "clickscope") { | 241 | if (scopeView.clickOverride) { |
754 | 242 | scopeView.clickOverride(index, result, item, itemModel); | ||
755 | 243 | return; | ||
756 | 244 | } | ||
757 | 245 | |||
758 | 246 | if (itemModel.uri.indexOf("scope://") === 0 || scopeView.scope.id === "clickscope") { | ||
759 | 236 | // TODO Technically it is possible that calling activate() will make the scope emit | 247 | // TODO Technically it is possible that calling activate() will make the scope emit |
760 | 237 | // previewRequested so that we show a preview but there's no scope that does that yet | 248 | // previewRequested so that we show a preview but there's no scope that does that yet |
761 | 238 | // so it's not implemented | 249 | // so it's not implemented |
762 | @@ -241,7 +252,16 @@ | |||
763 | 241 | openPreview(index); | 252 | openPreview(index); |
764 | 242 | } | 253 | } |
765 | 243 | } | 254 | } |
767 | 244 | onPressAndHold: openPreview(index) | 255 | |
768 | 256 | onPressAndHold: { | ||
769 | 257 | if (scopeView.pressAndHoldOverride) { | ||
770 | 258 | scopeView.pressAndHoldOverride(index); | ||
771 | 259 | } else { | ||
772 | 260 | if (itemModel.uri.indexOf("scope://") !== 0) { | ||
773 | 261 | openPreview(index) | ||
774 | 262 | } | ||
775 | 263 | } | ||
776 | 264 | } | ||
777 | 245 | 265 | ||
778 | 246 | function openPreview(index) { | 266 | function openPreview(index) { |
779 | 247 | if (!rendererLoader.expanded && !seeAllLabel.visible && target.collapsedItemCount > 0) { | 267 | if (!rendererLoader.expanded && !seeAllLabel.visible && target.collapsedItemCount > 0) { |
780 | @@ -389,26 +409,35 @@ | |||
781 | 389 | } | 409 | } |
782 | 390 | } | 410 | } |
783 | 391 | 411 | ||
787 | 392 | pageHeader: PageHeader { | 412 | pageHeader: scopeView.showPageHeader ? pageHeaderLoader : null |
788 | 393 | id: pageHeader | 413 | Loader { |
789 | 394 | objectName: "scopePageHeader" | 414 | id: pageHeaderLoader |
790 | 395 | width: parent.width | 415 | width: parent.width |
804 | 396 | title: scopeView.scope ? scopeView.scope.name : "" | 416 | sourceComponent: scopeView.showPageHeader ? pageHeaderComponent : undefined |
805 | 397 | showBackButton: scopeView.hasBackAction | 417 | Component { |
806 | 398 | searchEntryEnabled: true | 418 | id: pageHeaderComponent |
807 | 399 | searchInProgress: scopeView.scope ? scopeView.scope.searchInProgress : false | 419 | PageHeader { |
808 | 400 | scopeStyle: scopeView.scopeStyle | 420 | objectName: "scopePageHeader" |
809 | 401 | 421 | width: parent.width | |
810 | 402 | bottomItem: DashDepartments { | 422 | title: scopeView.scope ? scopeView.scope.name : "" |
811 | 403 | scope: scopeView.scope | 423 | searchHint: scopeView.scope && scopeView.scope.searchHint || i18n.tr("Search") |
812 | 404 | width: parent.width <= units.gu(60) ? parent.width : units.gu(40) | 424 | showBackButton: scopeView.hasBackAction |
813 | 405 | anchors.right: parent.right | 425 | searchEntryEnabled: true |
814 | 406 | windowHeight: scopeView.height | 426 | searchInProgress: scopeView.scope ? scopeView.scope.searchInProgress : false |
815 | 407 | windowWidth: scopeView.width | 427 | scopeStyle: scopeView.scopeStyle |
816 | 408 | scopeStyle: scopeView.scopeStyle | 428 | |
817 | 429 | bottomItem: DashDepartments { | ||
818 | 430 | scope: scopeView.scope | ||
819 | 431 | width: parent.width <= units.gu(60) ? parent.width : units.gu(40) | ||
820 | 432 | anchors.right: parent.right | ||
821 | 433 | windowHeight: scopeView.height | ||
822 | 434 | windowWidth: scopeView.width | ||
823 | 435 | scopeStyle: scopeView.scopeStyle | ||
824 | 436 | } | ||
825 | 437 | |||
826 | 438 | onBackClicked: scopeView.backClicked() | ||
827 | 439 | } | ||
828 | 409 | } | 440 | } |
829 | 410 | |||
830 | 411 | onBackClicked: scopeView.backClicked() | ||
831 | 412 | } | 441 | } |
832 | 413 | } | 442 | } |
833 | 414 | 443 | ||
834 | @@ -427,7 +456,9 @@ | |||
835 | 427 | anchors.left: categoryView.right | 456 | anchors.left: categoryView.right |
836 | 428 | 457 | ||
837 | 429 | onOpenChanged: { | 458 | onOpenChanged: { |
839 | 430 | pageHeader.unfocus(); | 459 | if (showPageHeader) { |
840 | 460 | pageHeaderLoader.item.unfocus(); | ||
841 | 461 | } | ||
842 | 431 | } | 462 | } |
843 | 432 | } | 463 | } |
844 | 433 | 464 | ||
845 | 434 | 465 | ||
846 | === modified file 'qml/Dash/PreviewListView.qml' | |||
847 | --- qml/Dash/PreviewListView.qml 2014-07-17 13:10:45 +0000 | |||
848 | +++ qml/Dash/PreviewListView.qml 2014-07-29 11:27:22 +0000 | |||
849 | @@ -88,7 +88,7 @@ | |||
850 | 88 | height: previewListView.height | 88 | height: previewListView.height |
851 | 89 | width: previewListView.width | 89 | width: previewListView.width |
852 | 90 | 90 | ||
854 | 91 | readonly property bool ready: preview.previewModel.loaded | 91 | readonly property bool ready: preview.previewModel && preview.previewModel.loaded |
855 | 92 | 92 | ||
856 | 93 | Previews.Preview { | 93 | Previews.Preview { |
857 | 94 | id: preview | 94 | id: preview |
858 | @@ -108,7 +108,7 @@ | |||
859 | 108 | id: processingMouseArea | 108 | id: processingMouseArea |
860 | 109 | objectName: "processingMouseArea" | 109 | objectName: "processingMouseArea" |
861 | 110 | anchors.fill: parent | 110 | anchors.fill: parent |
863 | 111 | enabled: !preview.previewModel.loaded || preview.previewModel.processingAction | 111 | enabled: preview.previewModel && (!preview.previewModel.loaded || preview.previewModel.processingAction) |
864 | 112 | 112 | ||
865 | 113 | ActivityIndicator { | 113 | ActivityIndicator { |
866 | 114 | anchors.centerIn: parent | 114 | anchors.centerIn: parent |
867 | 115 | 115 | ||
868 | === added file 'qml/Dash/ScopesOverview.qml' | |||
869 | --- qml/Dash/ScopesOverview.qml 1970-01-01 00:00:00 +0000 | |||
870 | +++ qml/Dash/ScopesOverview.qml 2014-07-29 11:27:22 +0000 | |||
871 | @@ -0,0 +1,518 @@ | |||
872 | 1 | /* | ||
873 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
874 | 3 | * | ||
875 | 4 | * This program is free software; you can redistribute it and/or modify | ||
876 | 5 | * it under the terms of the GNU General Public License as published by | ||
877 | 6 | * the Free Software Foundation; version 3. | ||
878 | 7 | * | ||
879 | 8 | * This program is distributed in the hope that it will be useful, | ||
880 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
881 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
882 | 11 | * GNU General Public License for more details. | ||
883 | 12 | * | ||
884 | 13 | * You should have received a copy of the GNU General Public License | ||
885 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
886 | 15 | */ | ||
887 | 16 | |||
888 | 17 | import QtQuick 2.0 | ||
889 | 18 | import Dash 0.1 | ||
890 | 19 | import Ubuntu.Components 0.1 | ||
891 | 20 | import "../Components" | ||
892 | 21 | |||
893 | 22 | Item { | ||
894 | 23 | id: root | ||
895 | 24 | |||
896 | 25 | // Properties set by parent | ||
897 | 26 | property real progress: 0 | ||
898 | 27 | property var scope: null | ||
899 | 28 | property int currentIndex: 0 | ||
900 | 29 | property real scopeScale: 1 | ||
901 | 30 | |||
902 | 31 | // Properties set and used by parent | ||
903 | 32 | property alias currentTab: tabBar.currentTab | ||
904 | 33 | |||
905 | 34 | // Properties used by parent | ||
906 | 35 | property bool growingDashFromPos: false | ||
907 | 36 | readonly property bool searching: scope && scope.searchQuery == "" | ||
908 | 37 | readonly property bool showingNonFavoriteScope: tempScopeItem.scope != null | ||
909 | 38 | readonly property var dashItemEater: { | ||
910 | 39 | if (!forceXYScalerEater && tabBar.currentTab == 0 && middleItems.count > 0) { | ||
911 | 40 | var loaderItem = middleItems.itemAt(0).item; | ||
912 | 41 | return loaderItem && loaderItem.currentItem ? loaderItem.currentItem : null; | ||
913 | 42 | } | ||
914 | 43 | return scopesOverviewXYScaler; | ||
915 | 44 | } | ||
916 | 45 | readonly property size allCardSize: { | ||
917 | 46 | if (middleItems.count > 1) { | ||
918 | 47 | var loaderItem = middleItems.itemAt(1).item; | ||
919 | 48 | if (loaderItem) { | ||
920 | 49 | var cardTool = loaderItem.cardTool; | ||
921 | 50 | return Qt.size(cardTool.cardWidth, cardTool.cardHeight); | ||
922 | 51 | } | ||
923 | 52 | } | ||
924 | 53 | return Qt.size(0, 0); | ||
925 | 54 | } | ||
926 | 55 | |||
927 | 56 | // Internal properties | ||
928 | 57 | property bool forceXYScalerEater: false | ||
929 | 58 | |||
930 | 59 | signal done() | ||
931 | 60 | signal favoriteSelected(var scopeId) | ||
932 | 61 | signal allFavoriteSelected(var scopeId) | ||
933 | 62 | signal searchSelected(var scopeId, var result, var pos, var size) | ||
934 | 63 | |||
935 | 64 | Connections { | ||
936 | 65 | target: scope | ||
937 | 66 | onOpenScope: { | ||
938 | 67 | var itemPos = scopesOverviewXYScaler.restorePosition; | ||
939 | 68 | var itemSize = scopesOverviewXYScaler.restoreSize; | ||
940 | 69 | scopesOverviewXYScaler.scale = itemSize.width / scopesOverviewXYScaler.width; | ||
941 | 70 | if (itemPos) { | ||
942 | 71 | scopesOverviewXYScaler.x = itemPos.x -(scopesOverviewXYScaler.width - scopesOverviewXYScaler.width * scopesOverviewXYScaler.scale) / 2; | ||
943 | 72 | scopesOverviewXYScaler.y = itemPos.y -(scopesOverviewXYScaler.height - scopesOverviewXYScaler.height * scopesOverviewXYScaler.scale) / 2; | ||
944 | 73 | } else { | ||
945 | 74 | scopesOverviewXYScaler.x = 0; | ||
946 | 75 | scopesOverviewXYScaler.y = 0; | ||
947 | 76 | } | ||
948 | 77 | scopesOverviewXYScaler.opacity = 0; | ||
949 | 78 | tempScopeItem.scope = scope; | ||
950 | 79 | middleItems.overrideOpacity = 0; | ||
951 | 80 | scopesOverviewXYScaler.scale = 1; | ||
952 | 81 | scopesOverviewXYScaler.x = 0; | ||
953 | 82 | scopesOverviewXYScaler.y = 0; | ||
954 | 83 | scopesOverviewXYScaler.opacity = 1; | ||
955 | 84 | } | ||
956 | 85 | } | ||
957 | 86 | |||
958 | 87 | function animateDashFromAll(scopeId) { | ||
959 | 88 | var currentScopePos = allScopeCardPosition(scopeId); | ||
960 | 89 | if (currentScopePos) { | ||
961 | 90 | showDashFromPos(currentScopePos, allCardSize); | ||
962 | 91 | } else { | ||
963 | 92 | console.log("Warning: Could not find Dash OverView All card position for scope", dashContent.currentScopeId); | ||
964 | 93 | } | ||
965 | 94 | } | ||
966 | 95 | |||
967 | 96 | function showDashFromPos(itemPos, itemSize) { | ||
968 | 97 | scopesOverviewXYScaler.scale = itemSize.width / scopesOverviewXYScaler.width; | ||
969 | 98 | scopesOverviewXYScaler.x = itemPos.x -(scopesOverviewXYScaler.width - scopesOverviewXYScaler.width * scopesOverviewXYScaler.scale) / 2; | ||
970 | 99 | scopesOverviewXYScaler.y = itemPos.y -(scopesOverviewXYScaler.height - scopesOverviewXYScaler.height * scopesOverviewXYScaler.scale) / 2; | ||
971 | 100 | scopesOverviewXYScaler.opacity = 0; | ||
972 | 101 | root.growingDashFromPos = true; | ||
973 | 102 | scopesOverviewXYScaler.scale = 1; | ||
974 | 103 | scopesOverviewXYScaler.x = 0; | ||
975 | 104 | scopesOverviewXYScaler.y = 0; | ||
976 | 105 | scopesOverviewXYScaler.opacity = 1; | ||
977 | 106 | } | ||
978 | 107 | |||
979 | 108 | function allScopeCardPosition(scopeId) { | ||
980 | 109 | if (middleItems.count > 1) { | ||
981 | 110 | var loaderItem = middleItems.itemAt(1).item; | ||
982 | 111 | if (loaderItem) { | ||
983 | 112 | var pos = loaderItem.scopeCardPosition(scopeId); | ||
984 | 113 | return loaderItem.mapToItem(null, pos.x, pos.y); | ||
985 | 114 | } | ||
986 | 115 | } | ||
987 | 116 | } | ||
988 | 117 | |||
989 | 118 | function ensureAllScopeVisible(scopeId) { | ||
990 | 119 | if (middleItems.count > 1) { | ||
991 | 120 | var loaderItem = middleItems.itemAt(1).item; | ||
992 | 121 | if (loaderItem) { | ||
993 | 122 | var pos = loaderItem.scopeCardPosition(scopeId); | ||
994 | 123 | loaderItem.contentY = Math.min(pos.y, loaderItem.contentHeight - loaderItem.height); | ||
995 | 124 | } | ||
996 | 125 | } | ||
997 | 126 | } | ||
998 | 127 | |||
999 | 128 | onProgressChanged: { | ||
1000 | 129 | if (progress == 0) { | ||
1001 | 130 | pageHeader.resetSearch(); | ||
1002 | 131 | pageHeader.unfocus(); // Shouldn't the previous call do this too? | ||
1003 | 132 | } | ||
1004 | 133 | } | ||
1005 | 134 | |||
1006 | 135 | ScopeStyle { | ||
1007 | 136 | id: overviewScopeStyle | ||
1008 | 137 | style: { "foreground-color" : "white", "background-color" : "transparent" } | ||
1009 | 138 | } | ||
1010 | 139 | |||
1011 | 140 | DashBackground { | ||
1012 | 141 | anchors.fill: parent | ||
1013 | 142 | source: "graphics/dark_background.jpg" | ||
1014 | 143 | } | ||
1015 | 144 | |||
1016 | 145 | Connections { | ||
1017 | 146 | target: pageHeader | ||
1018 | 147 | onSearchQueryChanged: { | ||
1019 | 148 | // Need this in order, otherwise something gets unhappy in rendering | ||
1020 | 149 | // of the overlay in carousels because the parent of the dash dies for | ||
1021 | 150 | // a moment, this way we make sure it's reparented first | ||
1022 | 151 | // by forceXYScalerEater making dashItemEater return scopesOverviewXYScaler | ||
1023 | 152 | // before we kill the previous parent by scope.searchQuery | ||
1024 | 153 | root.forceXYScalerEater = true; | ||
1025 | 154 | root.scope.searchQuery = pageHeader.searchQuery; | ||
1026 | 155 | root.forceXYScalerEater = false; | ||
1027 | 156 | } | ||
1028 | 157 | } | ||
1029 | 158 | |||
1030 | 159 | Binding { | ||
1031 | 160 | target: pageHeader | ||
1032 | 161 | property: "searchQuery" | ||
1033 | 162 | value: scope ? scope.searchQuery : "" | ||
1034 | 163 | } | ||
1035 | 164 | |||
1036 | 165 | Item { | ||
1037 | 166 | id: scopesOverviewContent | ||
1038 | 167 | x: previewListView.open ? -width : 0 | ||
1039 | 168 | Behavior on x { UbuntuNumberAnimation { } } | ||
1040 | 169 | width: parent.width | ||
1041 | 170 | height: parent.height | ||
1042 | 171 | |||
1043 | 172 | PageHeader { | ||
1044 | 173 | id: pageHeader | ||
1045 | 174 | objectName: "scopesOverviewPageHeader" | ||
1046 | 175 | |||
1047 | 176 | readonly property real yDisplacement: pageHeader.height + tabBar.height + tabBar.anchors.margins | ||
1048 | 177 | |||
1049 | 178 | y: { | ||
1050 | 179 | if (root.progress < 0.5) { | ||
1051 | 180 | return -yDisplacement; | ||
1052 | 181 | } else { | ||
1053 | 182 | return -yDisplacement + (root.progress - 0.5) * yDisplacement * 2; | ||
1054 | 183 | } | ||
1055 | 184 | } | ||
1056 | 185 | width: parent.width | ||
1057 | 186 | clip: true | ||
1058 | 187 | title: i18n.tr("Manage Dash") | ||
1059 | 188 | scopeStyle: overviewScopeStyle | ||
1060 | 189 | showSignatureLine: false | ||
1061 | 190 | searchEntryEnabled: true | ||
1062 | 191 | searchInProgress: root.scope ? root.scope.searchInProgress : false | ||
1063 | 192 | } | ||
1064 | 193 | |||
1065 | 194 | ScopesOverviewTab { | ||
1066 | 195 | id: tabBar | ||
1067 | 196 | anchors { | ||
1068 | 197 | left: parent.left | ||
1069 | 198 | right: parent.right | ||
1070 | 199 | top: pageHeader.bottom | ||
1071 | 200 | margins: units.gu(2) | ||
1072 | 201 | } | ||
1073 | 202 | height: units.gu(4) | ||
1074 | 203 | |||
1075 | 204 | enabled: opacity == 1 | ||
1076 | 205 | opacity: !scope || scope.searchQuery == "" ? 1 : 0 | ||
1077 | 206 | Behavior on opacity { UbuntuNumberAnimation { } } | ||
1078 | 207 | } | ||
1079 | 208 | |||
1080 | 209 | Repeater { | ||
1081 | 210 | id: middleItems | ||
1082 | 211 | objectName: "scopesOverviewRepeater" | ||
1083 | 212 | property real overrideOpacity: -1 | ||
1084 | 213 | model: scope && scope.searchQuery == "" ? scope.categories : null | ||
1085 | 214 | delegate: Loader { | ||
1086 | 215 | id: loader | ||
1087 | 216 | objectName: "scopesOverviewRepeaterChild" + index | ||
1088 | 217 | |||
1089 | 218 | height: { | ||
1090 | 219 | if (index == 0) { | ||
1091 | 220 | return root.height; | ||
1092 | 221 | } else { | ||
1093 | 222 | return root.height - pageHeader.height - tabBar.height - tabBar.anchors.margins - units.gu(2) | ||
1094 | 223 | } | ||
1095 | 224 | } | ||
1096 | 225 | width: { | ||
1097 | 226 | if (index == 0) { | ||
1098 | 227 | return root.width / scopeScale | ||
1099 | 228 | } else { | ||
1100 | 229 | return root.width | ||
1101 | 230 | } | ||
1102 | 231 | } | ||
1103 | 232 | x: { | ||
1104 | 233 | if (index == 0) { | ||
1105 | 234 | return (root.width - width) / 2; | ||
1106 | 235 | } else { | ||
1107 | 236 | return 0; | ||
1108 | 237 | } | ||
1109 | 238 | } | ||
1110 | 239 | anchors { | ||
1111 | 240 | bottom: scopesOverviewContent.bottom | ||
1112 | 241 | } | ||
1113 | 242 | |||
1114 | 243 | scale: index == 0 ? scopeScale : 1 | ||
1115 | 244 | |||
1116 | 245 | opacity: { | ||
1117 | 246 | if (middleItems.overrideOpacity >= 0) | ||
1118 | 247 | return middleItems.overrideOpacity; | ||
1119 | 248 | |||
1120 | 249 | if (tabBar.currentTab != index) | ||
1121 | 250 | return 0; | ||
1122 | 251 | |||
1123 | 252 | return index == 0 ? 1 : root.progress; | ||
1124 | 253 | } | ||
1125 | 254 | Behavior on opacity { | ||
1126 | 255 | enabled: root.progress == 1 | ||
1127 | 256 | UbuntuNumberAnimation { } | ||
1128 | 257 | } | ||
1129 | 258 | enabled: opacity == 1 | ||
1130 | 259 | |||
1131 | 260 | clip: index == 1 | ||
1132 | 261 | |||
1133 | 262 | CardTool { | ||
1134 | 263 | id: cardTool | ||
1135 | 264 | objectName: "cardTool" | ||
1136 | 265 | count: results.count | ||
1137 | 266 | template: model.renderer | ||
1138 | 267 | components: model.components | ||
1139 | 268 | viewWidth: parent.width | ||
1140 | 269 | } | ||
1141 | 270 | |||
1142 | 271 | source: { | ||
1143 | 272 | if (index == 0 && categoryId == "favorites") return "ScopesOverviewFavorites.qml"; | ||
1144 | 273 | else if (index == 1 && categoryId == "all") return "ScopesOverviewAll.qml"; | ||
1145 | 274 | else return ""; | ||
1146 | 275 | } | ||
1147 | 276 | |||
1148 | 277 | onLoaded: { | ||
1149 | 278 | item.model = Qt.binding(function() { return results }) | ||
1150 | 279 | item.cardTool = cardTool; | ||
1151 | 280 | if (index == 0) { | ||
1152 | 281 | item.scopeWidth = Qt.binding(function() { return root.width; }); | ||
1153 | 282 | item.scopeHeight = Qt.binding(function() { return root.height; }); | ||
1154 | 283 | item.appliedScale = Qt.binding(function() { return loader.scale }); | ||
1155 | 284 | item.currentIndex = Qt.binding(function() { return root.currentIndex }); | ||
1156 | 285 | } else if (index == 1) { | ||
1157 | 286 | item.extraHeight = bottomBar.height; | ||
1158 | 287 | } | ||
1159 | 288 | } | ||
1160 | 289 | |||
1161 | 290 | Connections { | ||
1162 | 291 | target: loader.item | ||
1163 | 292 | onClicked: { | ||
1164 | 293 | if (tabBar.currentTab == 0) { | ||
1165 | 294 | root.favoriteSelected(itemModel.scopeId) | ||
1166 | 295 | } else { | ||
1167 | 296 | var favoriteScopesItem = middleItems.itemAt(0).item; | ||
1168 | 297 | var scopeIndex = favoriteScopesItem.model.scopeIndex(itemModel.scopeId); | ||
1169 | 298 | if (scopeIndex >= 0) { | ||
1170 | 299 | root.allFavoriteSelected(itemModel.scopeId); | ||
1171 | 300 | } else { | ||
1172 | 301 | // Will result in an openScope from root.scope | ||
1173 | 302 | scopesOverviewXYScaler.restorePosition = item.mapToItem(null, 0, 0); | ||
1174 | 303 | scopesOverviewXYScaler.restoreSize = allCardSize; | ||
1175 | 304 | root.scope.activate(result); | ||
1176 | 305 | } | ||
1177 | 306 | } | ||
1178 | 307 | } | ||
1179 | 308 | onPressAndHold: { | ||
1180 | 309 | // Preview can call openScope so make sure restorePosition and restoreSize are set | ||
1181 | 310 | scopesOverviewXYScaler.restorePosition = undefined; | ||
1182 | 311 | scopesOverviewXYScaler.restoreSize = allCardSize; | ||
1183 | 312 | |||
1184 | 313 | previewListView.model = target.model; | ||
1185 | 314 | previewListView.currentIndex = -1 | ||
1186 | 315 | previewListView.currentIndex = index; | ||
1187 | 316 | previewListView.open = true | ||
1188 | 317 | } | ||
1189 | 318 | } | ||
1190 | 319 | } | ||
1191 | 320 | } | ||
1192 | 321 | |||
1193 | 322 | GenericScopeView { | ||
1194 | 323 | id: searchResultsViewer | ||
1195 | 324 | objectName: "searchResultsViewer" | ||
1196 | 325 | anchors { | ||
1197 | 326 | top: pageHeader.bottom | ||
1198 | 327 | right: parent.right | ||
1199 | 328 | left: parent.left | ||
1200 | 329 | bottom: parent.bottom | ||
1201 | 330 | } | ||
1202 | 331 | scope: root.scope && root.scope.searchQuery != "" ? root.scope : null | ||
1203 | 332 | scopeStyle: overviewScopeStyle | ||
1204 | 333 | enabled: opacity == 1 | ||
1205 | 334 | showPageHeader: false | ||
1206 | 335 | clip: true | ||
1207 | 336 | opacity: searchResultsViewer.scope ? 1 : 0 | ||
1208 | 337 | Behavior on opacity { UbuntuNumberAnimation { } } | ||
1209 | 338 | |||
1210 | 339 | clickOverride: function (index, result, item, itemModel) { | ||
1211 | 340 | pageHeader.closePopup(); | ||
1212 | 341 | if (itemModel.scopeId) { | ||
1213 | 342 | // This can end up in openScope so save restorePosition and restoreSize | ||
1214 | 343 | scopesOverviewXYScaler.restorePosition = item.mapToItem(null, 0, 0); | ||
1215 | 344 | scopesOverviewXYScaler.restoreSize = Qt.size(item.width, item.height); | ||
1216 | 345 | root.searchSelected(itemModel.scopeId, result, item.mapToItem(null, 0, 0), Qt.size(item.width, item.height)); | ||
1217 | 346 | } else { | ||
1218 | 347 | // Not a scope, just activate it | ||
1219 | 348 | searchResultsViewer.scope.activate(result); | ||
1220 | 349 | } | ||
1221 | 350 | } | ||
1222 | 351 | |||
1223 | 352 | pressAndHoldOverride: function (index) { | ||
1224 | 353 | // Do nothing | ||
1225 | 354 | } | ||
1226 | 355 | } | ||
1227 | 356 | |||
1228 | 357 | Rectangle { | ||
1229 | 358 | id: bottomBar | ||
1230 | 359 | color: "black" | ||
1231 | 360 | height: units.gu(6) | ||
1232 | 361 | width: parent.width | ||
1233 | 362 | enabled: opacity == 0.4 | ||
1234 | 363 | opacity: scope && scope.searchQuery == "" ? 0.4 : 0 | ||
1235 | 364 | Behavior on opacity { UbuntuNumberAnimation { } } | ||
1236 | 365 | y: { | ||
1237 | 366 | if (root.progress < 0.5) { | ||
1238 | 367 | return parent.height; | ||
1239 | 368 | } else { | ||
1240 | 369 | return parent.height - (root.progress - 0.5) * height * 2; | ||
1241 | 370 | } | ||
1242 | 371 | } | ||
1243 | 372 | |||
1244 | 373 | AbstractButton { | ||
1245 | 374 | objectName: "scopesOverviewDoneButton" | ||
1246 | 375 | width: Math.max(label.width + units.gu(2), units.gu(10)) | ||
1247 | 376 | height: units.gu(4) | ||
1248 | 377 | anchors { | ||
1249 | 378 | left: parent.left | ||
1250 | 379 | leftMargin: units.gu(2) | ||
1251 | 380 | verticalCenter: parent.verticalCenter | ||
1252 | 381 | } | ||
1253 | 382 | Rectangle { | ||
1254 | 383 | anchors.fill: parent | ||
1255 | 384 | border.color: "white" | ||
1256 | 385 | border.width: units.dp(1) | ||
1257 | 386 | radius: units.dp(10) | ||
1258 | 387 | color: parent.pressed ? "gray" : "transparent" | ||
1259 | 388 | } | ||
1260 | 389 | Label { | ||
1261 | 390 | id: label | ||
1262 | 391 | anchors.centerIn: parent | ||
1263 | 392 | text: i18n.tr("Done") | ||
1264 | 393 | color: parent.pressed ? "black" : "white" | ||
1265 | 394 | } | ||
1266 | 395 | onClicked: root.done(); | ||
1267 | 396 | } | ||
1268 | 397 | |||
1269 | 398 | AbstractButton { | ||
1270 | 399 | objectName: "scopesOverviewStoreButton" | ||
1271 | 400 | width: Math.max(storeLabel.width, units.gu(10)) | ||
1272 | 401 | height: units.gu(4) | ||
1273 | 402 | anchors { | ||
1274 | 403 | right: parent.right | ||
1275 | 404 | verticalCenter: parent.verticalCenter | ||
1276 | 405 | } | ||
1277 | 406 | Image { | ||
1278 | 407 | id: storeImage | ||
1279 | 408 | source: "graphics/apps-scope.png" | ||
1280 | 409 | anchors.horizontalCenter: parent.horizontalCenter | ||
1281 | 410 | width: units.gu(2) | ||
1282 | 411 | height: units.gu(2) | ||
1283 | 412 | fillMode: Image.Stretch | ||
1284 | 413 | } | ||
1285 | 414 | Label { | ||
1286 | 415 | id: storeLabel | ||
1287 | 416 | anchors.horizontalCenter: parent.horizontalCenter | ||
1288 | 417 | anchors.top: storeImage.bottom | ||
1289 | 418 | text: i18n.tr("Store") | ||
1290 | 419 | color: "white" | ||
1291 | 420 | } | ||
1292 | 421 | onClicked: { | ||
1293 | 422 | // Just zoom from the middle | ||
1294 | 423 | scopesOverviewXYScaler.restorePosition = undefined; | ||
1295 | 424 | scopesOverviewXYScaler.restoreSize = allCardSize; | ||
1296 | 425 | scope.performQuery("scope://com.canonical.scopes.clickstore"); | ||
1297 | 426 | } | ||
1298 | 427 | } | ||
1299 | 428 | } | ||
1300 | 429 | } | ||
1301 | 430 | |||
1302 | 431 | PreviewListView { | ||
1303 | 432 | id: previewListView | ||
1304 | 433 | objectName: "scopesOverviewPreviewListView" | ||
1305 | 434 | scope: root.scope | ||
1306 | 435 | scopeStyle: overviewScopeStyle | ||
1307 | 436 | visible: x != width | ||
1308 | 437 | width: parent.width | ||
1309 | 438 | height: parent.height | ||
1310 | 439 | anchors.left: scopesOverviewContent.right | ||
1311 | 440 | } | ||
1312 | 441 | |||
1313 | 442 | |||
1314 | 443 | |||
1315 | 444 | Item { | ||
1316 | 445 | id: scopesOverviewXYScaler | ||
1317 | 446 | width: parent.width | ||
1318 | 447 | height: parent.height | ||
1319 | 448 | |||
1320 | 449 | clip: scale != 1.0 | ||
1321 | 450 | enabled: scale == 1 | ||
1322 | 451 | |||
1323 | 452 | property bool animationsEnabled: root.showingNonFavoriteScope || root.growingDashFromPos | ||
1324 | 453 | |||
1325 | 454 | property var restorePosition | ||
1326 | 455 | property var restoreSize | ||
1327 | 456 | |||
1328 | 457 | Behavior on x { | ||
1329 | 458 | enabled: scopesOverviewXYScaler.animationsEnabled | ||
1330 | 459 | UbuntuNumberAnimation { } | ||
1331 | 460 | } | ||
1332 | 461 | Behavior on y { | ||
1333 | 462 | enabled: scopesOverviewXYScaler.animationsEnabled | ||
1334 | 463 | UbuntuNumberAnimation { } | ||
1335 | 464 | } | ||
1336 | 465 | Behavior on opacity { | ||
1337 | 466 | enabled: scopesOverviewXYScaler.animationsEnabled | ||
1338 | 467 | UbuntuNumberAnimation { } | ||
1339 | 468 | } | ||
1340 | 469 | Behavior on scale { | ||
1341 | 470 | enabled: scopesOverviewXYScaler.animationsEnabled | ||
1342 | 471 | UbuntuNumberAnimation { | ||
1343 | 472 | onRunningChanged: { | ||
1344 | 473 | if (!running) { | ||
1345 | 474 | if (root.showingNonFavoriteScope && scopesOverviewXYScaler.scale != 1) { | ||
1346 | 475 | root.scope.closeScope(tempScopeItem.scope); | ||
1347 | 476 | tempScopeItem.scope = null; | ||
1348 | 477 | } else if (root.growingDashFromPos) { | ||
1349 | 478 | root.growingDashFromPos = false; | ||
1350 | 479 | } | ||
1351 | 480 | } | ||
1352 | 481 | } | ||
1353 | 482 | } | ||
1354 | 483 | } | ||
1355 | 484 | |||
1356 | 485 | DashBackground | ||
1357 | 486 | { | ||
1358 | 487 | anchors.fill: tempScopeItem | ||
1359 | 488 | visible: tempScopeItem.visible | ||
1360 | 489 | parent: tempScopeItem.parent | ||
1361 | 490 | } | ||
1362 | 491 | |||
1363 | 492 | GenericScopeView { | ||
1364 | 493 | id: tempScopeItem | ||
1365 | 494 | objectName: "scopesOverviewTempScopeItem" | ||
1366 | 495 | |||
1367 | 496 | width: parent.width | ||
1368 | 497 | height: parent.height | ||
1369 | 498 | scale: dash.contentScale | ||
1370 | 499 | clip: scale != 1.0 | ||
1371 | 500 | visible: scope != null | ||
1372 | 501 | hasBackAction: true | ||
1373 | 502 | isCurrent: visible | ||
1374 | 503 | onBackClicked: { | ||
1375 | 504 | var v = scopesOverviewXYScaler.restoreSize.width / tempScopeItem.width; | ||
1376 | 505 | scopesOverviewXYScaler.scale = v; | ||
1377 | 506 | if (scopesOverviewXYScaler.restorePosition) { | ||
1378 | 507 | scopesOverviewXYScaler.x = scopesOverviewXYScaler.restorePosition.x -(tempScopeItem.width - tempScopeItem.width * v) / 2; | ||
1379 | 508 | scopesOverviewXYScaler.y = scopesOverviewXYScaler.restorePosition.y -(tempScopeItem.height - tempScopeItem.height * v) / 2; | ||
1380 | 509 | } else { | ||
1381 | 510 | scopesOverviewXYScaler.x = 0; | ||
1382 | 511 | scopesOverviewXYScaler.y = 0; | ||
1383 | 512 | } | ||
1384 | 513 | scopesOverviewXYScaler.opacity = 0; | ||
1385 | 514 | middleItems.overrideOpacity = -1; | ||
1386 | 515 | } | ||
1387 | 516 | } | ||
1388 | 517 | } | ||
1389 | 518 | } | ||
1390 | 0 | 519 | ||
1391 | === added file 'qml/Dash/ScopesOverviewAll.qml' | |||
1392 | --- qml/Dash/ScopesOverviewAll.qml 1970-01-01 00:00:00 +0000 | |||
1393 | +++ qml/Dash/ScopesOverviewAll.qml 2014-07-29 11:27:22 +0000 | |||
1394 | @@ -0,0 +1,54 @@ | |||
1395 | 1 | /* | ||
1396 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
1397 | 3 | * | ||
1398 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1399 | 5 | * it under the terms of the GNU General Public License as published by | ||
1400 | 6 | * the Free Software Foundation; version 3. | ||
1401 | 7 | * | ||
1402 | 8 | * This program is distributed in the hope that it will be useful, | ||
1403 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1404 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1405 | 11 | * GNU General Public License for more details. | ||
1406 | 12 | * | ||
1407 | 13 | * You should have received a copy of the GNU General Public License | ||
1408 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1409 | 15 | */ | ||
1410 | 16 | |||
1411 | 17 | import QtQuick 2.0 | ||
1412 | 18 | import Ubuntu.Components 0.1 | ||
1413 | 19 | |||
1414 | 20 | Flickable { | ||
1415 | 21 | id: root | ||
1416 | 22 | |||
1417 | 23 | property alias model: cardGrid.model | ||
1418 | 24 | property alias cardTool: cardGrid.cardTool | ||
1419 | 25 | |||
1420 | 26 | property real extraHeight: 0 | ||
1421 | 27 | |||
1422 | 28 | signal clicked(int index, var result, var item, var itemModel) | ||
1423 | 29 | signal pressAndHold(int index) | ||
1424 | 30 | |||
1425 | 31 | contentHeight: cardGrid.expandedHeight + extraHeight | ||
1426 | 32 | contentWidth: cardGrid.width | ||
1427 | 33 | flickableDirection: Flickable.VerticalFlick | ||
1428 | 34 | |||
1429 | 35 | function scopeCardPosition(scopeId) { | ||
1430 | 36 | var index = model.scopeIndex(scopeId); | ||
1431 | 37 | var pos = cardGrid.cardPosition(index); | ||
1432 | 38 | pos.y = pos.y - root.contentY; | ||
1433 | 39 | return pos; | ||
1434 | 40 | } | ||
1435 | 41 | |||
1436 | 42 | CardGrid { | ||
1437 | 43 | id: cardGrid | ||
1438 | 44 | width: root.width | ||
1439 | 45 | height: parent.height | ||
1440 | 46 | |||
1441 | 47 | onClicked: { | ||
1442 | 48 | root.clicked(index, result, item, itemModel); | ||
1443 | 49 | } | ||
1444 | 50 | onPressAndHold: { | ||
1445 | 51 | root.pressAndHold(index); | ||
1446 | 52 | } | ||
1447 | 53 | } | ||
1448 | 54 | } | ||
1449 | 0 | 55 | ||
1450 | === added file 'qml/Dash/ScopesOverviewFavorites.qml' | |||
1451 | --- qml/Dash/ScopesOverviewFavorites.qml 1970-01-01 00:00:00 +0000 | |||
1452 | +++ qml/Dash/ScopesOverviewFavorites.qml 2014-07-29 11:27:22 +0000 | |||
1453 | @@ -0,0 +1,73 @@ | |||
1454 | 1 | /* | ||
1455 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
1456 | 3 | * | ||
1457 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1458 | 5 | * it under the terms of the GNU General Public License as published by | ||
1459 | 6 | * the Free Software Foundation; version 3. | ||
1460 | 7 | * | ||
1461 | 8 | * This program is distributed in the hope that it will be useful, | ||
1462 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1463 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1464 | 11 | * GNU General Public License for more details. | ||
1465 | 12 | * | ||
1466 | 13 | * You should have received a copy of the GNU General Public License | ||
1467 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1468 | 15 | */ | ||
1469 | 16 | |||
1470 | 17 | import QtQuick 2.0 | ||
1471 | 18 | |||
1472 | 19 | Flickable { | ||
1473 | 20 | id: root | ||
1474 | 21 | |||
1475 | 22 | signal clicked(int index, var result, var itemModel) | ||
1476 | 23 | signal pressAndHold(int index) | ||
1477 | 24 | |||
1478 | 25 | property var cardTool: null | ||
1479 | 26 | property real scopeHeight: 0 | ||
1480 | 27 | property real scopeWidth: 0 | ||
1481 | 28 | property real appliedScale: 1 | ||
1482 | 29 | property int currentIndex: -1 | ||
1483 | 30 | property var currentItem: repeater.itemAt(currentIndex); | ||
1484 | 31 | |||
1485 | 32 | property alias model: repeater.model | ||
1486 | 33 | |||
1487 | 34 | contentHeight: height | ||
1488 | 35 | contentWidth: repeater.count * root.scopeWidth + units.gu(2) / appliedScale * (repeater.count - 1) | ||
1489 | 36 | |||
1490 | 37 | contentX: { | ||
1491 | 38 | var indexX = currentIndex * scopeWidth + units.gu(2) / appliedScale * currentIndex; | ||
1492 | 39 | var newContentX = indexX - (width - scopeWidth) / 2; | ||
1493 | 40 | newContentX = Math.min(Math.max(newContentX, 0), contentWidth - width); | ||
1494 | 41 | return newContentX; | ||
1495 | 42 | } | ||
1496 | 43 | |||
1497 | 44 | Repeater { | ||
1498 | 45 | id: repeater | ||
1499 | 46 | objectName: "scopesOverviewFavoritesRepeater" | ||
1500 | 47 | |||
1501 | 48 | delegate: Loader { | ||
1502 | 49 | id: loader | ||
1503 | 50 | |||
1504 | 51 | x: index * root.scopeWidth + units.gu(2) / appliedScale * index | ||
1505 | 52 | asynchronous: true | ||
1506 | 53 | |||
1507 | 54 | sourceComponent: cardTool.cardComponent | ||
1508 | 55 | onLoaded: { | ||
1509 | 56 | item.fixedArtShapeSize = Qt.binding(function() { return Qt.size(root.scopeWidth, root.scopeHeight); }); | ||
1510 | 57 | item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight / appliedScale; }); | ||
1511 | 58 | item.fontScale = Qt.binding(function() { return 1 / appliedScale; }); | ||
1512 | 59 | item.height = Qt.binding(function() { return root.scopeHeight; }); | ||
1513 | 60 | item.width = Qt.binding(function() { return root.scopeWidth; }); | ||
1514 | 61 | item.cardData = Qt.binding(function() { return model; }); | ||
1515 | 62 | item.template = Qt.binding(function() { return cardTool.template; }); | ||
1516 | 63 | item.components = Qt.binding(function() { return cardTool.components; }); | ||
1517 | 64 | item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; }); | ||
1518 | 65 | } | ||
1519 | 66 | |||
1520 | 67 | Connections { | ||
1521 | 68 | target: loader.item | ||
1522 | 69 | onClicked: root.clicked(index, result, model) | ||
1523 | 70 | } | ||
1524 | 71 | } | ||
1525 | 72 | } | ||
1526 | 73 | } | ||
1527 | 0 | 74 | ||
1528 | === added file 'qml/Dash/ScopesOverviewTab.qml' | |||
1529 | --- qml/Dash/ScopesOverviewTab.qml 1970-01-01 00:00:00 +0000 | |||
1530 | +++ qml/Dash/ScopesOverviewTab.qml 2014-07-29 11:27:22 +0000 | |||
1531 | @@ -0,0 +1,74 @@ | |||
1532 | 1 | /* | ||
1533 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
1534 | 3 | * | ||
1535 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1536 | 5 | * it under the terms of the GNU General Public License as published by | ||
1537 | 6 | * the Free Software Foundation; version 3. | ||
1538 | 7 | * | ||
1539 | 8 | * This program is distributed in the hope that it will be useful, | ||
1540 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1541 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1542 | 11 | * GNU General Public License for more details. | ||
1543 | 12 | * | ||
1544 | 13 | * You should have received a copy of the GNU General Public License | ||
1545 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1546 | 15 | */ | ||
1547 | 16 | |||
1548 | 17 | import QtQuick 2.3 | ||
1549 | 18 | import Ubuntu.Components 0.1 | ||
1550 | 19 | |||
1551 | 20 | Item { | ||
1552 | 21 | id: root | ||
1553 | 22 | |||
1554 | 23 | property int currentTab: 0 | ||
1555 | 24 | |||
1556 | 25 | AbstractButton { | ||
1557 | 26 | id: tab1 | ||
1558 | 27 | height: parent.height | ||
1559 | 28 | width: parent.width / 2 | ||
1560 | 29 | Rectangle { | ||
1561 | 30 | anchors.fill: parent | ||
1562 | 31 | color: root.currentTab == 0 && root.enabled ? "white" : "transparent" | ||
1563 | 32 | radius: units.dp(10) | ||
1564 | 33 | } | ||
1565 | 34 | Label { | ||
1566 | 35 | anchors.centerIn: parent | ||
1567 | 36 | text: i18n.tr("Favorites") | ||
1568 | 37 | color: root.currentTab == 0 && root.enabled ? "black" : "white" | ||
1569 | 38 | } | ||
1570 | 39 | onClicked: root.currentTab = 0 | ||
1571 | 40 | } | ||
1572 | 41 | AbstractButton { | ||
1573 | 42 | id: tab2 | ||
1574 | 43 | objectName: "scopesOverviewAllTabButton" | ||
1575 | 44 | x: width | ||
1576 | 45 | height: parent.height | ||
1577 | 46 | width: parent.width / 2 | ||
1578 | 47 | Rectangle { | ||
1579 | 48 | anchors.fill: parent | ||
1580 | 49 | color: root.currentTab == 1 && root.enabled ? "white" : "transparent" | ||
1581 | 50 | radius: units.dp(10) | ||
1582 | 51 | } | ||
1583 | 52 | Label { | ||
1584 | 53 | anchors.centerIn: parent | ||
1585 | 54 | text: i18n.tr("All") | ||
1586 | 55 | color: root.currentTab == 1 && root.enabled ? "black" : "white" | ||
1587 | 56 | } | ||
1588 | 57 | onClicked: root.currentTab = 1 | ||
1589 | 58 | } | ||
1590 | 59 | Rectangle { | ||
1591 | 60 | id: centerPiece | ||
1592 | 61 | width: root.enabled ? units.dp(10) : units.dp(1) | ||
1593 | 62 | height: parent.height | ||
1594 | 63 | color: "white" | ||
1595 | 64 | x: root.currentTab == 1 ? tab2.x : tab2.x - width | ||
1596 | 65 | } | ||
1597 | 66 | Rectangle { | ||
1598 | 67 | id: border | ||
1599 | 68 | anchors.fill: parent | ||
1600 | 69 | radius: units.dp(10) | ||
1601 | 70 | color: "transparent" | ||
1602 | 71 | border.color: centerPiece.color | ||
1603 | 72 | border.width: units.dp(1) | ||
1604 | 73 | } | ||
1605 | 74 | } | ||
1606 | 0 | 75 | ||
1607 | === added file 'qml/Dash/graphics/apps-scope.png' | |||
1608 | 1 | Binary files qml/Dash/graphics/apps-scope.png 1970-01-01 00:00:00 +0000 and qml/Dash/graphics/apps-scope.png 2014-07-29 11:27:22 +0000 differ | 76 | Binary files qml/Dash/graphics/apps-scope.png 1970-01-01 00:00:00 +0000 and qml/Dash/graphics/apps-scope.png 2014-07-29 11:27:22 +0000 differ |
1609 | === added file 'qml/Dash/graphics/dark_background.jpg' | |||
1610 | 2 | Binary files qml/Dash/graphics/dark_background.jpg 1970-01-01 00:00:00 +0000 and qml/Dash/graphics/dark_background.jpg 2014-07-29 11:27:22 +0000 differ | 77 | Binary files qml/Dash/graphics/dark_background.jpg 1970-01-01 00:00:00 +0000 and qml/Dash/graphics/dark_background.jpg 2014-07-29 11:27:22 +0000 differ |
1611 | === modified file 'qml/Shell.qml' | |||
1612 | --- qml/Shell.qml 2014-07-18 15:13:35 +0000 | |||
1613 | +++ qml/Shell.qml 2014-07-29 11:27:22 +0000 | |||
1614 | @@ -125,14 +125,6 @@ | |||
1615 | 125 | opacity: dash.disappearingAnimationProgress | 125 | opacity: dash.disappearingAnimationProgress |
1616 | 126 | } | 126 | } |
1617 | 127 | 127 | ||
1618 | 128 | Image { | ||
1619 | 129 | anchors.fill: dash | ||
1620 | 130 | source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png" | ||
1621 | 131 | fillMode: Image.PreserveAspectCrop | ||
1622 | 132 | horizontalAlignment: Image.AlignRight | ||
1623 | 133 | verticalAlignment: Image.AlignTop | ||
1624 | 134 | } | ||
1625 | 135 | |||
1626 | 136 | Dash { | 128 | Dash { |
1627 | 137 | id: dash | 129 | id: dash |
1628 | 138 | objectName: "dash" | 130 | objectName: "dash" |
1629 | @@ -142,6 +134,8 @@ | |||
1630 | 142 | shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0 | 134 | shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0 |
1631 | 143 | enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled | 135 | enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled |
1632 | 144 | 136 | ||
1633 | 137 | overviewHandleHeight: shell.edgeSize | ||
1634 | 138 | |||
1635 | 145 | anchors { | 139 | anchors { |
1636 | 146 | fill: parent | 140 | fill: parent |
1637 | 147 | topMargin: panel.panelHeight | 141 | topMargin: panel.panelHeight |
1638 | 148 | 142 | ||
1639 | === modified file 'tests/autopilot/unity8/shell/emulators/dash.py' | |||
1640 | --- tests/autopilot/unity8/shell/emulators/dash.py 2014-07-25 10:47:19 +0000 | |||
1641 | +++ tests/autopilot/unity8/shell/emulators/dash.py 2014-07-29 11:27:22 +0000 | |||
1642 | @@ -18,6 +18,7 @@ | |||
1643 | 18 | # | 18 | # |
1644 | 19 | 19 | ||
1645 | 20 | import logging | 20 | import logging |
1646 | 21 | import time | ||
1647 | 21 | import ubuntuuitoolkit | 22 | import ubuntuuitoolkit |
1648 | 22 | 23 | ||
1649 | 23 | from unity8.shell import emulators | 24 | from unity8.shell import emulators |
1650 | @@ -68,7 +69,9 @@ | |||
1651 | 68 | 69 | ||
1652 | 69 | """ | 70 | """ |
1653 | 70 | scope_loader = self._get_scope_loader(scope_id) | 71 | scope_loader = self._get_scope_loader(scope_id) |
1654 | 72 | print ("open_scope", scope_id, scope_loader) | ||
1655 | 71 | if scope_loader.isCurrent: | 73 | if scope_loader.isCurrent: |
1656 | 74 | print ("scope_loader.isCurrent") | ||
1657 | 72 | logger.info('The scope is already open.') | 75 | logger.info('The scope is already open.') |
1658 | 73 | return self._get_scope_from_loader(scope_loader) | 76 | return self._get_scope_from_loader(scope_loader) |
1659 | 74 | else: | 77 | else: |
1660 | @@ -83,6 +86,12 @@ | |||
1661 | 83 | 'No scope found with id {0}'.format(scope_id)) | 86 | 'No scope found with id {0}'.format(scope_id)) |
1662 | 84 | 87 | ||
1663 | 85 | def _get_scope_from_loader(self, loader): | 88 | def _get_scope_from_loader(self, loader): |
1664 | 89 | print ("_get_scope_from_loader", loader, loader.isCurrent, loader.isLoaded, loader.get_children()) | ||
1665 | 90 | i = 0 | ||
1666 | 91 | time.sleep(1) | ||
1667 | 92 | while len(loader.get_children()) < 1 and i < 5: | ||
1668 | 93 | time.sleep(1) | ||
1669 | 94 | i = i + 1 | ||
1670 | 86 | return loader.get_children()[0] | 95 | return loader.get_children()[0] |
1671 | 87 | 96 | ||
1672 | 88 | def _open_scope_scrolling(self, scope_loader): | 97 | def _open_scope_scrolling(self, scope_loader): |
1673 | 89 | 98 | ||
1674 | === modified file 'tests/mocks/Unity/CMakeLists.txt' | |||
1675 | --- tests/mocks/Unity/CMakeLists.txt 2014-07-08 09:23:14 +0000 | |||
1676 | +++ tests/mocks/Unity/CMakeLists.txt 2014-07-29 11:27:22 +0000 | |||
1677 | @@ -6,7 +6,7 @@ | |||
1678 | 6 | pkg_search_module(DEE dee-1.0 REQUIRED) | 6 | pkg_search_module(DEE dee-1.0 REQUIRED) |
1679 | 7 | pkg_search_module(GOBJECT gobject-2.0 REQUIRED) | 7 | pkg_search_module(GOBJECT gobject-2.0 REQUIRED) |
1680 | 8 | pkg_search_module(DEEQT libdee-qt5 REQUIRED) | 8 | pkg_search_module(DEEQT libdee-qt5 REQUIRED) |
1682 | 9 | pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=2) | 9 | pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=3) |
1683 | 10 | 10 | ||
1684 | 11 | include_directories( | 11 | include_directories( |
1685 | 12 | ${CMAKE_CURRENT_BINARY_DIR} | 12 | ${CMAKE_CURRENT_BINARY_DIR} |
1686 | @@ -21,6 +21,7 @@ | |||
1687 | 21 | set(UnityQML_SOURCES | 21 | set(UnityQML_SOURCES |
1688 | 22 | fake_scope.cpp | 22 | fake_scope.cpp |
1689 | 23 | fake_scopes.cpp | 23 | fake_scopes.cpp |
1690 | 24 | fake_scopesoverview.cpp | ||
1691 | 24 | fake_categories.cpp | 25 | fake_categories.cpp |
1692 | 25 | fake_department.cpp | 26 | fake_department.cpp |
1693 | 26 | fake_resultsmodel.cpp | 27 | fake_resultsmodel.cpp |
1694 | 27 | 28 | ||
1695 | === modified file 'tests/mocks/Unity/fake_resultsmodel.cpp' | |||
1696 | --- tests/mocks/Unity/fake_resultsmodel.cpp 2014-05-20 10:29:20 +0000 | |||
1697 | +++ tests/mocks/Unity/fake_resultsmodel.cpp 2014-07-29 11:27:22 +0000 | |||
1698 | @@ -58,8 +58,9 @@ | |||
1699 | 58 | case RoleUri: | 58 | case RoleUri: |
1700 | 59 | case RoleCategoryId: | 59 | case RoleCategoryId: |
1701 | 60 | case RoleDndUri: | 60 | case RoleDndUri: |
1702 | 61 | return QString(); | ||
1703 | 61 | case RoleResult: | 62 | case RoleResult: |
1705 | 62 | return QString(); | 63 | return QString("Result.%1.%2").arg(m_categoryId).arg(index.row()); |
1706 | 63 | case RoleTitle: | 64 | case RoleTitle: |
1707 | 64 | return QString("Title.%1.%2").arg(m_categoryId).arg(index.row()); | 65 | return QString("Title.%1.%2").arg(m_categoryId).arg(index.row()); |
1708 | 65 | case RoleArt: | 66 | case RoleArt: |
1709 | 66 | 67 | ||
1710 | === modified file 'tests/mocks/Unity/fake_scope.cpp' | |||
1711 | --- tests/mocks/Unity/fake_scope.cpp 2014-07-24 20:40:57 +0000 | |||
1712 | +++ tests/mocks/Unity/fake_scope.cpp 2014-07-29 11:27:22 +0000 | |||
1713 | @@ -14,17 +14,20 @@ | |||
1714 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1715 | 15 | */ | 15 | */ |
1716 | 16 | 16 | ||
1717 | 17 | #include <QDebug> | ||
1718 | 17 | #include <QUrl> | 18 | #include <QUrl> |
1719 | 18 | 19 | ||
1720 | 19 | #include "fake_scope.h" | 20 | #include "fake_scope.h" |
1721 | 21 | |||
1722 | 20 | #include "fake_department.h" | 22 | #include "fake_department.h" |
1723 | 21 | #include "fake_resultsmodel.h" | 23 | #include "fake_resultsmodel.h" |
1724 | 24 | #include "fake_scopes.h" | ||
1725 | 22 | 25 | ||
1727 | 23 | Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent) | 26 | Scope::Scope(Scopes* parent) : Scope(QString(), QString(), false, parent) |
1728 | 24 | { | 27 | { |
1729 | 25 | } | 28 | } |
1730 | 26 | 29 | ||
1732 | 27 | Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent, int categories) | 30 | Scope::Scope(QString const& id, QString const& name, bool visible, Scopes* parent, int categories) |
1733 | 28 | : unity::shell::scopes::ScopeInterface(parent) | 31 | : unity::shell::scopes::ScopeInterface(parent) |
1734 | 29 | , m_id(id) | 32 | , m_id(id) |
1735 | 30 | , m_name(name) | 33 | , m_name(name) |
1736 | @@ -34,6 +37,7 @@ | |||
1737 | 34 | , m_currentDeparment("root") | 37 | , m_currentDeparment("root") |
1738 | 35 | , m_previewRendererName("preview-generic") | 38 | , m_previewRendererName("preview-generic") |
1739 | 36 | , m_categories(new Categories(categories, this)) | 39 | , m_categories(new Categories(categories, this)) |
1740 | 40 | , m_openScope(nullptr) | ||
1741 | 37 | { | 41 | { |
1742 | 38 | } | 42 | } |
1743 | 39 | 43 | ||
1744 | @@ -64,7 +68,7 @@ | |||
1745 | 64 | 68 | ||
1746 | 65 | QString Scope::searchHint() const | 69 | QString Scope::searchHint() const |
1747 | 66 | { | 70 | { |
1749 | 67 | return QString(""); | 71 | return QString("Search %1").arg(m_name); |
1750 | 68 | } | 72 | } |
1751 | 69 | 73 | ||
1752 | 70 | QString Scope::shortcut() const | 74 | QString Scope::shortcut() const |
1753 | @@ -149,7 +153,12 @@ | |||
1754 | 149 | 153 | ||
1755 | 150 | void Scope::activate(QVariant const& result) | 154 | void Scope::activate(QVariant const& result) |
1756 | 151 | { | 155 | { |
1758 | 152 | Q_UNUSED(result); | 156 | qDebug() << "Called activate on scope" << m_id << "with result" << result; |
1759 | 157 | if (result.toString() == "Result.2.2") { | ||
1760 | 158 | Scopes *scopes = dynamic_cast<Scopes*>(parent()); | ||
1761 | 159 | m_openScope = scopes->getScopeFromAll("MockScope9"); | ||
1762 | 160 | Q_EMIT openScope(m_openScope); | ||
1763 | 161 | } | ||
1764 | 153 | } | 162 | } |
1765 | 154 | 163 | ||
1766 | 155 | PreviewStack* Scope::preview(QVariant const& result) | 164 | PreviewStack* Scope::preview(QVariant const& result) |
1767 | @@ -165,9 +174,13 @@ | |||
1768 | 165 | { | 174 | { |
1769 | 166 | } | 175 | } |
1770 | 167 | 176 | ||
1772 | 168 | void Scope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/) | 177 | void Scope::closeScope(unity::shell::scopes::ScopeInterface* scope) |
1773 | 169 | { | 178 | { |
1775 | 170 | qFatal("Scope::closeScope is not implemented"); | 179 | if (scope != m_openScope) { |
1776 | 180 | qDebug() << scope << m_openScope; | ||
1777 | 181 | qFatal("Scope::closeScope got wrong scope in closeScope"); | ||
1778 | 182 | } | ||
1779 | 183 | m_openScope = nullptr; | ||
1780 | 171 | } | 184 | } |
1781 | 172 | 185 | ||
1782 | 173 | QString Scope::currentDepartmentId() const | 186 | QString Scope::currentDepartmentId() const |
1783 | 174 | 187 | ||
1784 | === modified file 'tests/mocks/Unity/fake_scope.h' | |||
1785 | --- tests/mocks/Unity/fake_scope.h 2014-07-11 16:39:33 +0000 | |||
1786 | +++ tests/mocks/Unity/fake_scope.h 2014-07-29 11:27:22 +0000 | |||
1787 | @@ -24,13 +24,15 @@ | |||
1788 | 24 | 24 | ||
1789 | 25 | #include <QTimer> | 25 | #include <QTimer> |
1790 | 26 | 26 | ||
1791 | 27 | class Scopes; | ||
1792 | 28 | |||
1793 | 27 | class Scope : public unity::shell::scopes::ScopeInterface | 29 | class Scope : public unity::shell::scopes::ScopeInterface |
1794 | 28 | { | 30 | { |
1795 | 29 | Q_OBJECT | 31 | Q_OBJECT |
1796 | 30 | 32 | ||
1797 | 31 | public: | 33 | public: |
1800 | 32 | Scope(QObject* parent = 0); | 34 | Scope(Scopes* parent = 0); |
1801 | 33 | Scope(QString const& id, QString const& name, bool visible, QObject* parent = 0, int categories = 20); | 35 | Scope(QString const& id, QString const& name, bool visible, Scopes* parent = 0, int categories = 20); |
1802 | 34 | 36 | ||
1803 | 35 | /* getters */ | 37 | /* getters */ |
1804 | 36 | QString id() const override; | 38 | QString id() const override; |
1805 | @@ -84,7 +86,8 @@ | |||
1806 | 84 | 86 | ||
1807 | 85 | QString m_previewRendererName; | 87 | QString m_previewRendererName; |
1808 | 86 | 88 | ||
1810 | 87 | Categories* m_categories; | 89 | unity::shell::scopes::CategoriesInterface* m_categories; |
1811 | 90 | unity::shell::scopes::ScopeInterface* m_openScope; | ||
1812 | 88 | }; | 91 | }; |
1813 | 89 | 92 | ||
1814 | 90 | #endif // FAKE_SCOPE_H | 93 | #endif // FAKE_SCOPE_H |
1815 | 91 | 94 | ||
1816 | === modified file 'tests/mocks/Unity/fake_scopes.cpp' | |||
1817 | --- tests/mocks/Unity/fake_scopes.cpp 2014-07-11 11:45:45 +0000 | |||
1818 | +++ tests/mocks/Unity/fake_scopes.cpp 2014-07-29 11:27:22 +0000 | |||
1819 | @@ -18,6 +18,7 @@ | |||
1820 | 18 | 18 | ||
1821 | 19 | // Self | 19 | // Self |
1822 | 20 | #include "fake_scopes.h" | 20 | #include "fake_scopes.h" |
1823 | 21 | #include "fake_scopesoverview.h" | ||
1824 | 21 | 22 | ||
1825 | 22 | // TODO: Implement remaining pieces, like Categories (i.e. LensView now gives warnings) | 23 | // TODO: Implement remaining pieces, like Categories (i.e. LensView now gives warnings) |
1826 | 23 | 24 | ||
1827 | @@ -26,6 +27,7 @@ | |||
1828 | 26 | 27 | ||
1829 | 27 | Scopes::Scopes(QObject *parent) | 28 | Scopes::Scopes(QObject *parent) |
1830 | 28 | : unity::shell::scopes::ScopesInterface(parent) | 29 | : unity::shell::scopes::ScopesInterface(parent) |
1831 | 30 | , m_scopesOverview(nullptr) | ||
1832 | 29 | , m_loaded(false) | 31 | , m_loaded(false) |
1833 | 30 | , timer(this) | 32 | , timer(this) |
1834 | 31 | { | 33 | { |
1835 | @@ -47,10 +49,17 @@ | |||
1836 | 47 | addScope(new Scope("clickscope", "Apps", true, this)); | 49 | addScope(new Scope("clickscope", "Apps", true, this)); |
1837 | 48 | addScope(new Scope("MockScope5", "Videos", true, this)); | 50 | addScope(new Scope("MockScope5", "Videos", true, this)); |
1838 | 49 | addScope(new Scope("SingleCategoryScope", "Single", true, this, 1)); | 51 | addScope(new Scope("SingleCategoryScope", "Single", true, this, 1)); |
1839 | 52 | addScope(new Scope("MockScope4", "MS4", true, this)); | ||
1840 | 53 | addScope(new Scope("MockScope6", "MS6", true, this)); | ||
1841 | 54 | addScope(new Scope("MockScope7", "MS7", false, this)); | ||
1842 | 55 | addScope(new Scope("MockScope8", "MS8", false, this)); | ||
1843 | 56 | addScope(new Scope("MockScope9", "MS9", false, this)); | ||
1844 | 57 | m_scopesOverview = new ScopesOverview(this); | ||
1845 | 50 | 58 | ||
1846 | 51 | if (!m_loaded) { | 59 | if (!m_loaded) { |
1847 | 52 | m_loaded = true; | 60 | m_loaded = true; |
1848 | 53 | Q_EMIT loadedChanged(); | 61 | Q_EMIT loadedChanged(); |
1849 | 62 | Q_EMIT overviewScopeChanged(); | ||
1850 | 54 | } | 63 | } |
1851 | 55 | } | 64 | } |
1852 | 56 | 65 | ||
1853 | @@ -63,6 +72,8 @@ | |||
1854 | 63 | m_scopes.clear(); | 72 | m_scopes.clear(); |
1855 | 64 | endRemoveRows(); | 73 | endRemoveRows(); |
1856 | 65 | } | 74 | } |
1857 | 75 | delete m_scopesOverview; | ||
1858 | 76 | m_scopesOverview = nullptr; | ||
1859 | 66 | 77 | ||
1860 | 67 | if (m_loaded) { | 78 | if (m_loaded) { |
1861 | 68 | m_loaded = false; | 79 | m_loaded = false; |
1862 | @@ -110,8 +121,22 @@ | |||
1863 | 110 | return m_scopes[row]; | 121 | return m_scopes[row]; |
1864 | 111 | } | 122 | } |
1865 | 112 | 123 | ||
1868 | 113 | unity::shell::scopes::ScopeInterface* Scopes::getScope(QString const&) const | 124 | unity::shell::scopes::ScopeInterface* Scopes::getScope(QString const &scope_id) const |
1869 | 114 | { | 125 | { |
1870 | 126 | for (Scope *scope : m_scopes) { | ||
1871 | 127 | // According to mh3 Scopes::getScope should only return non null for visible scopes | ||
1872 | 128 | if (scope->id() == scope_id && scope->visible()) | ||
1873 | 129 | return scope; | ||
1874 | 130 | } | ||
1875 | 131 | return nullptr; | ||
1876 | 132 | } | ||
1877 | 133 | |||
1878 | 134 | unity::shell::scopes::ScopeInterface* Scopes::getScopeFromAll(const QString& scope_id) const | ||
1879 | 135 | { | ||
1880 | 136 | for (Scope *scope : m_scopes) { | ||
1881 | 137 | if (scope->id() == scope_id) | ||
1882 | 138 | return scope; | ||
1883 | 139 | } | ||
1884 | 115 | return nullptr; | 140 | return nullptr; |
1885 | 116 | } | 141 | } |
1886 | 117 | 142 | ||
1887 | @@ -125,6 +150,22 @@ | |||
1888 | 125 | return m_loaded; | 150 | return m_loaded; |
1889 | 126 | } | 151 | } |
1890 | 127 | 152 | ||
1891 | 153 | unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const | ||
1892 | 154 | { | ||
1893 | 155 | return m_scopesOverview; | ||
1894 | 156 | } | ||
1895 | 157 | |||
1896 | 158 | QList<unity::shell::scopes::ScopeInterface *> Scopes::scopes(bool onlyVisible) const | ||
1897 | 159 | { | ||
1898 | 160 | QList<unity::shell::scopes::ScopeInterface *> res; | ||
1899 | 161 | for (Scope *scope : m_scopes) { | ||
1900 | 162 | if (!onlyVisible || scope->visible()) { | ||
1901 | 163 | res << scope; | ||
1902 | 164 | } | ||
1903 | 165 | } | ||
1904 | 166 | return res; | ||
1905 | 167 | } | ||
1906 | 168 | |||
1907 | 128 | void Scopes::addScope(Scope* scope) | 169 | void Scopes::addScope(Scope* scope) |
1908 | 129 | { | 170 | { |
1909 | 130 | int index = rowCount(); | 171 | int index = rowCount(); |
1910 | 131 | 172 | ||
1911 | === modified file 'tests/mocks/Unity/fake_scopes.h' | |||
1912 | --- tests/mocks/Unity/fake_scopes.h 2014-05-20 14:48:08 +0000 | |||
1913 | +++ tests/mocks/Unity/fake_scopes.h 2014-07-29 11:27:22 +0000 | |||
1914 | @@ -50,12 +50,18 @@ | |||
1915 | 50 | QModelIndex parent ( const QModelIndex & index ) const; | 50 | QModelIndex parent ( const QModelIndex & index ) const; |
1916 | 51 | 51 | ||
1917 | 52 | bool loaded() const override; | 52 | bool loaded() const override; |
1918 | 53 | unity::shell::scopes::ScopeInterface* overviewScope() const override; | ||
1919 | 54 | |||
1920 | 55 | // This is used as part of implementation of the other C++ code, not API | ||
1921 | 56 | QList<unity::shell::scopes::ScopeInterface *> scopes(bool onlyVisible) const; | ||
1922 | 57 | unity::shell::scopes::ScopeInterface* getScopeFromAll(const QString& scope_id) const; | ||
1923 | 53 | 58 | ||
1924 | 54 | private Q_SLOTS: | 59 | private Q_SLOTS: |
1925 | 55 | void updateScopes(); | 60 | void updateScopes(); |
1926 | 56 | 61 | ||
1927 | 57 | private: | 62 | private: |
1928 | 58 | QList<Scope*> m_scopes; | 63 | QList<Scope*> m_scopes; |
1929 | 64 | Scope *m_scopesOverview; | ||
1930 | 59 | bool m_loaded; | 65 | bool m_loaded; |
1931 | 60 | QTimer timer; | 66 | QTimer timer; |
1932 | 61 | }; | 67 | }; |
1933 | 62 | 68 | ||
1934 | === added file 'tests/mocks/Unity/fake_scopesoverview.cpp' | |||
1935 | --- tests/mocks/Unity/fake_scopesoverview.cpp 1970-01-01 00:00:00 +0000 | |||
1936 | +++ tests/mocks/Unity/fake_scopesoverview.cpp 2014-07-29 11:27:22 +0000 | |||
1937 | @@ -0,0 +1,280 @@ | |||
1938 | 1 | /* | ||
1939 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
1940 | 3 | * | ||
1941 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1942 | 5 | * it under the terms of the GNU General Public License as published by | ||
1943 | 6 | * the Free Software Foundation; version 3. | ||
1944 | 7 | * | ||
1945 | 8 | * This program is distributed in the hope that it will be useful, | ||
1946 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1947 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1948 | 11 | * GNU General Public License for more details. | ||
1949 | 12 | * | ||
1950 | 13 | * You should have received a copy of the GNU General Public License | ||
1951 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1952 | 15 | */ | ||
1953 | 16 | |||
1954 | 17 | #include "fake_scopesoverview.h" | ||
1955 | 18 | |||
1956 | 19 | #include "fake_scopes.h" | ||
1957 | 20 | |||
1958 | 21 | #include <paths.h> | ||
1959 | 22 | |||
1960 | 23 | ScopesOverview::ScopesOverview(Scopes* parent) | ||
1961 | 24 | : Scope("scopesOverview", "Scopes Overview", false, parent) | ||
1962 | 25 | { | ||
1963 | 26 | delete m_categories; // delete the usual categories, we're not going to use it | ||
1964 | 27 | m_scopesOverviewCategories = new ScopesOverviewCategories(parent, this); | ||
1965 | 28 | m_searchCategories = new ScopesOverviewSearchCategories(parent, this); | ||
1966 | 29 | m_categories = m_scopesOverviewCategories; | ||
1967 | 30 | } | ||
1968 | 31 | |||
1969 | 32 | void ScopesOverview::setSearchQuery(const QString& search_query) | ||
1970 | 33 | { | ||
1971 | 34 | Scope::setSearchQuery(search_query); | ||
1972 | 35 | |||
1973 | 36 | auto origCategories = m_categories; | ||
1974 | 37 | if (search_query.isEmpty()) m_categories = m_scopesOverviewCategories; | ||
1975 | 38 | else m_categories = m_searchCategories; | ||
1976 | 39 | |||
1977 | 40 | if (m_categories != origCategories) | ||
1978 | 41 | Q_EMIT categoriesChanged(); | ||
1979 | 42 | } | ||
1980 | 43 | |||
1981 | 44 | Q_INVOKABLE void ScopesOverview::activate(QVariant const& result) | ||
1982 | 45 | { | ||
1983 | 46 | Scopes *scopes = dynamic_cast<Scopes*>(parent()); | ||
1984 | 47 | m_openScope = scopes->getScopeFromAll(result.toString()); | ||
1985 | 48 | Q_EMIT openScope(m_openScope); | ||
1986 | 49 | } | ||
1987 | 50 | |||
1988 | 51 | ScopesOverviewCategories::ScopesOverviewCategories(Scopes *scopes, QObject* parent) | ||
1989 | 52 | : unity::shell::scopes::CategoriesInterface(parent) | ||
1990 | 53 | , m_scopes(scopes) | ||
1991 | 54 | { | ||
1992 | 55 | } | ||
1993 | 56 | |||
1994 | 57 | int ScopesOverviewCategories::rowCount(const QModelIndex& /*parent*/) const | ||
1995 | 58 | { | ||
1996 | 59 | return 2; | ||
1997 | 60 | } | ||
1998 | 61 | |||
1999 | 62 | void ScopesOverviewCategories::addSpecialCategory(QString const&, QString const&, QString const&, QString const&, QObject*) | ||
2000 | 63 | { | ||
2001 | 64 | qFatal("Using un-implemented ScopesOverviewCategories::addSpecialCategory"); | ||
2002 | 65 | } | ||
2003 | 66 | |||
2004 | 67 | bool ScopesOverviewCategories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */) | ||
2005 | 68 | { | ||
2006 | 69 | qFatal("Using un-implemented ScopesOverviewCategories::overrideCategoryJson"); | ||
2007 | 70 | } | ||
2008 | 71 | |||
2009 | 72 | QVariant | ||
2010 | 73 | ScopesOverviewCategories::data(const QModelIndex& index, int role) const | ||
2011 | 74 | { | ||
2012 | 75 | if (!index.isValid()) { | ||
2013 | 76 | return QVariant(); | ||
2014 | 77 | } | ||
2015 | 78 | |||
2016 | 79 | const QString categoryId = index.row() == 0 ? "favorites" : "all"; | ||
2017 | 80 | |||
2018 | 81 | unity::shell::scopes::ResultsModelInterface *resultsModel = m_resultsModels[index.row()]; | ||
2019 | 82 | if (!resultsModel) { | ||
2020 | 83 | QObject *that = const_cast<ScopesOverviewCategories*>(this); | ||
2021 | 84 | resultsModel = new ScopesOverviewResultsModel(m_scopes->scopes(index.row() == 0), categoryId, that); | ||
2022 | 85 | m_resultsModels[index.row()] = resultsModel; | ||
2023 | 86 | } | ||
2024 | 87 | switch (role) { | ||
2025 | 88 | case RoleCategoryId: | ||
2026 | 89 | return categoryId; | ||
2027 | 90 | case RoleName: | ||
2028 | 91 | return index.row() == 0 ? "Favorites" : "All"; | ||
2029 | 92 | case RoleIcon: | ||
2030 | 93 | return QVariant(); | ||
2031 | 94 | case RoleRawRendererTemplate: | ||
2032 | 95 | qFatal("Using un-implemented RoleRawRendererTemplate Categories role"); | ||
2033 | 96 | return QVariant(); | ||
2034 | 97 | case RoleRenderer: | ||
2035 | 98 | { | ||
2036 | 99 | QVariantMap map; | ||
2037 | 100 | map["category-layout"] = "grid"; | ||
2038 | 101 | map["card-size"] = "small"; | ||
2039 | 102 | map["overlay"] = true; | ||
2040 | 103 | return map; | ||
2041 | 104 | } | ||
2042 | 105 | case RoleComponents: | ||
2043 | 106 | { | ||
2044 | 107 | QVariantMap map, artMap; | ||
2045 | 108 | artMap["aspect-ratio"] = "0.5"; | ||
2046 | 109 | artMap["field"] = "art"; | ||
2047 | 110 | map["art"] = artMap; | ||
2048 | 111 | map["title"] = "HOLA"; | ||
2049 | 112 | return map; | ||
2050 | 113 | } | ||
2051 | 114 | case RoleResults: | ||
2052 | 115 | return QVariant::fromValue(resultsModel); | ||
2053 | 116 | case RoleCount: | ||
2054 | 117 | return resultsModel->rowCount(); | ||
2055 | 118 | case RoleHeaderLink: | ||
2056 | 119 | return QString(); | ||
2057 | 120 | default: | ||
2058 | 121 | qFatal("Using un-implemented Categories role"); | ||
2059 | 122 | return QVariant(); | ||
2060 | 123 | } | ||
2061 | 124 | } | ||
2062 | 125 | |||
2063 | 126 | |||
2064 | 127 | |||
2065 | 128 | ScopesOverviewSearchCategories::ScopesOverviewSearchCategories(Scopes *scopes, QObject* parent) | ||
2066 | 129 | : unity::shell::scopes::CategoriesInterface(parent) | ||
2067 | 130 | , m_scopes(scopes) | ||
2068 | 131 | { | ||
2069 | 132 | } | ||
2070 | 133 | |||
2071 | 134 | int ScopesOverviewSearchCategories::rowCount(const QModelIndex& /*parent*/) const | ||
2072 | 135 | { | ||
2073 | 136 | return 2; | ||
2074 | 137 | } | ||
2075 | 138 | |||
2076 | 139 | void ScopesOverviewSearchCategories::addSpecialCategory(QString const&, QString const&, QString const&, QString const&, QObject*) | ||
2077 | 140 | { | ||
2078 | 141 | qFatal("Using un-implemented ScopesOverviewSearchCategories::addSpecialCategory"); | ||
2079 | 142 | } | ||
2080 | 143 | |||
2081 | 144 | bool ScopesOverviewSearchCategories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */) | ||
2082 | 145 | { | ||
2083 | 146 | qFatal("Using un-implemented ScopesOverviewSearchCategories::overrideCategoryJson"); | ||
2084 | 147 | } | ||
2085 | 148 | |||
2086 | 149 | QVariant | ||
2087 | 150 | ScopesOverviewSearchCategories::data(const QModelIndex& index, int role) const | ||
2088 | 151 | { | ||
2089 | 152 | if (!index.isValid()) { | ||
2090 | 153 | return QVariant(); | ||
2091 | 154 | } | ||
2092 | 155 | |||
2093 | 156 | const QString categoryId = index.row() == 0 ? "searchA" : "searchB"; | ||
2094 | 157 | |||
2095 | 158 | unity::shell::scopes::ResultsModelInterface *resultsModel = m_resultsModels[index.row()]; | ||
2096 | 159 | if (!resultsModel) { | ||
2097 | 160 | QObject *that = const_cast<ScopesOverviewSearchCategories*>(this); | ||
2098 | 161 | QList<unity::shell::scopes::ScopeInterface *> scopes; | ||
2099 | 162 | if (index.row() == 0) { | ||
2100 | 163 | scopes << m_scopes->getScopeFromAll("clickscope") << nullptr << m_scopes->getScopeFromAll("MockScope2"); | ||
2101 | 164 | } else { | ||
2102 | 165 | scopes << nullptr << m_scopes->getScopeFromAll("MockScope7") << nullptr << m_scopes->getScopeFromAll("MockScope1"); | ||
2103 | 166 | } | ||
2104 | 167 | resultsModel = new ScopesOverviewResultsModel(scopes, categoryId, that); | ||
2105 | 168 | m_resultsModels[index.row()] = resultsModel; | ||
2106 | 169 | } | ||
2107 | 170 | switch (role) { | ||
2108 | 171 | case RoleCategoryId: | ||
2109 | 172 | return categoryId; | ||
2110 | 173 | case RoleName: | ||
2111 | 174 | return index.row() == 0 ? "SearchA" : "SearchB"; | ||
2112 | 175 | case RoleIcon: | ||
2113 | 176 | return QVariant(); | ||
2114 | 177 | case RoleRawRendererTemplate: | ||
2115 | 178 | qFatal("Using un-implemented RoleRawRendererTemplate Categories role"); | ||
2116 | 179 | return QVariant(); | ||
2117 | 180 | case RoleRenderer: | ||
2118 | 181 | { | ||
2119 | 182 | QVariantMap map; | ||
2120 | 183 | map["category-layout"] = "grid"; | ||
2121 | 184 | map["card-size"] = "small"; | ||
2122 | 185 | map["overlay"] = true; | ||
2123 | 186 | return map; | ||
2124 | 187 | } | ||
2125 | 188 | case RoleComponents: | ||
2126 | 189 | { | ||
2127 | 190 | QVariantMap map, artMap; | ||
2128 | 191 | artMap["aspect-ratio"] = "1"; | ||
2129 | 192 | artMap["field"] = "art"; | ||
2130 | 193 | map["art"] = artMap; | ||
2131 | 194 | map["title"] = "HOLA"; | ||
2132 | 195 | return map; | ||
2133 | 196 | } | ||
2134 | 197 | case RoleResults: | ||
2135 | 198 | return QVariant::fromValue(resultsModel); | ||
2136 | 199 | case RoleCount: | ||
2137 | 200 | return resultsModel->rowCount(); | ||
2138 | 201 | case RoleHeaderLink: | ||
2139 | 202 | return QString(); | ||
2140 | 203 | default: | ||
2141 | 204 | qFatal("Using un-implemented Categories role"); | ||
2142 | 205 | return QVariant(); | ||
2143 | 206 | } | ||
2144 | 207 | } | ||
2145 | 208 | |||
2146 | 209 | |||
2147 | 210 | ScopesOverviewResultsModel::ScopesOverviewResultsModel(const QList<unity::shell::scopes::ScopeInterface *> &scopes, const QString &categoryId, QObject* parent) | ||
2148 | 211 | : unity::shell::scopes::ResultsModelInterface(parent) | ||
2149 | 212 | , m_scopes(scopes) | ||
2150 | 213 | , m_categoryId(categoryId) | ||
2151 | 214 | { | ||
2152 | 215 | } | ||
2153 | 216 | |||
2154 | 217 | QString ScopesOverviewResultsModel::categoryId() const | ||
2155 | 218 | { | ||
2156 | 219 | return m_categoryId; | ||
2157 | 220 | } | ||
2158 | 221 | |||
2159 | 222 | void ScopesOverviewResultsModel::setCategoryId(QString const& /*id*/) | ||
2160 | 223 | { | ||
2161 | 224 | qFatal("Calling un-implemented ScopesOverviewResultsModel::setCategoryId"); | ||
2162 | 225 | } | ||
2163 | 226 | |||
2164 | 227 | int ScopesOverviewResultsModel::scopeIndex(QString const& id) const | ||
2165 | 228 | { | ||
2166 | 229 | const int scopeCount = count(); | ||
2167 | 230 | for (int i = 0; i < scopeCount; ++i) { | ||
2168 | 231 | if (m_scopes[i]->id() == id) | ||
2169 | 232 | return i; | ||
2170 | 233 | } | ||
2171 | 234 | return -1; | ||
2172 | 235 | } | ||
2173 | 236 | |||
2174 | 237 | QHash<int, QByteArray> ScopesOverviewResultsModel::roleNames() const | ||
2175 | 238 | { | ||
2176 | 239 | QHash<int, QByteArray> roles = unity::shell::scopes::ResultsModelInterface::roleNames(); | ||
2177 | 240 | roles[RoleBackground + 1] = "scopeId"; | ||
2178 | 241 | return roles; | ||
2179 | 242 | } | ||
2180 | 243 | |||
2181 | 244 | int ScopesOverviewResultsModel::rowCount(const QModelIndex& parent) const | ||
2182 | 245 | { | ||
2183 | 246 | Q_UNUSED(parent); | ||
2184 | 247 | |||
2185 | 248 | return m_scopes.count(); | ||
2186 | 249 | } | ||
2187 | 250 | |||
2188 | 251 | int ScopesOverviewResultsModel::count() const | ||
2189 | 252 | { | ||
2190 | 253 | return rowCount(); | ||
2191 | 254 | } | ||
2192 | 255 | |||
2193 | 256 | QVariant | ||
2194 | 257 | ScopesOverviewResultsModel::data(const QModelIndex& index, int role) const | ||
2195 | 258 | { | ||
2196 | 259 | unity::shell::scopes::ScopeInterface *scope = m_scopes[index.row()]; | ||
2197 | 260 | switch (role) { | ||
2198 | 261 | case RoleUri: | ||
2199 | 262 | case RoleCategoryId: | ||
2200 | 263 | case RoleDndUri: | ||
2201 | 264 | return QString(); | ||
2202 | 265 | case RoleResult: | ||
2203 | 266 | return scope ? scope->id() : QString("Result.%1.%2").arg(categoryId()).arg(index.row()); | ||
2204 | 267 | case RoleTitle: | ||
2205 | 268 | return scope ? scope->name() : QString("Title.%1.%2").arg(categoryId()).arg(index.row()); | ||
2206 | 269 | case RoleArt: | ||
2207 | 270 | return qmlDirectory() + "graphics/applicationIcons/dash.png"; | ||
2208 | 271 | case RoleMascot: | ||
2209 | 272 | case RoleEmblem: | ||
2210 | 273 | case RoleSummary: | ||
2211 | 274 | case RoleBackground + 1: // scopeId | ||
2212 | 275 | return scope ? scope->id() : nullptr; | ||
2213 | 276 | break; | ||
2214 | 277 | default: | ||
2215 | 278 | return QVariant(); | ||
2216 | 279 | } | ||
2217 | 280 | } | ||
2218 | 0 | 281 | ||
2219 | === added file 'tests/mocks/Unity/fake_scopesoverview.h' | |||
2220 | --- tests/mocks/Unity/fake_scopesoverview.h 1970-01-01 00:00:00 +0000 | |||
2221 | +++ tests/mocks/Unity/fake_scopesoverview.h 2014-07-29 11:27:22 +0000 | |||
2222 | @@ -0,0 +1,104 @@ | |||
2223 | 1 | /* | ||
2224 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
2225 | 3 | * | ||
2226 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2227 | 5 | * it under the terms of the GNU General Public License as published by | ||
2228 | 6 | * the Free Software Foundation; version 3. | ||
2229 | 7 | * | ||
2230 | 8 | * This program is distributed in the hope that it will be useful, | ||
2231 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2232 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2233 | 11 | * GNU General Public License for more details. | ||
2234 | 12 | * | ||
2235 | 13 | * You should have received a copy of the GNU General Public License | ||
2236 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2237 | 15 | */ | ||
2238 | 16 | |||
2239 | 17 | #ifndef FAKE_SCOPESOVERVIEW_H | ||
2240 | 18 | #define FAKE_SCOPESOVERVIEW_H | ||
2241 | 19 | |||
2242 | 20 | #include "fake_scope.h" | ||
2243 | 21 | #include <unity/shell/scopes/ResultsModelInterface.h> | ||
2244 | 22 | |||
2245 | 23 | class Scopes; | ||
2246 | 24 | |||
2247 | 25 | class ScopesOverview : public Scope | ||
2248 | 26 | { | ||
2249 | 27 | Q_OBJECT | ||
2250 | 28 | |||
2251 | 29 | public: | ||
2252 | 30 | ScopesOverview(Scopes* parent = 0); | ||
2253 | 31 | |||
2254 | 32 | void setSearchQuery(const QString& search_query) override; | ||
2255 | 33 | Q_INVOKABLE void activate(QVariant const& result) override; | ||
2256 | 34 | |||
2257 | 35 | private: | ||
2258 | 36 | unity::shell::scopes::CategoriesInterface *m_scopesOverviewCategories; | ||
2259 | 37 | unity::shell::scopes::CategoriesInterface *m_searchCategories; | ||
2260 | 38 | }; | ||
2261 | 39 | |||
2262 | 40 | class ScopesOverviewCategories : public unity::shell::scopes::CategoriesInterface | ||
2263 | 41 | { | ||
2264 | 42 | Q_OBJECT | ||
2265 | 43 | |||
2266 | 44 | public: | ||
2267 | 45 | ScopesOverviewCategories(Scopes *scopes, QObject* parent = 0); | ||
2268 | 46 | |||
2269 | 47 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||
2270 | 48 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||
2271 | 49 | |||
2272 | 50 | Q_INVOKABLE void addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject) override; | ||
2273 | 51 | Q_INVOKABLE bool overrideCategoryJson(QString const& categoryId, QString const& json) override; | ||
2274 | 52 | |||
2275 | 53 | private: | ||
2276 | 54 | mutable QHash<int, unity::shell::scopes::ResultsModelInterface*> m_resultsModels; | ||
2277 | 55 | |||
2278 | 56 | Scopes *m_scopes; | ||
2279 | 57 | }; | ||
2280 | 58 | |||
2281 | 59 | class ScopesOverviewSearchCategories : public unity::shell::scopes::CategoriesInterface | ||
2282 | 60 | { | ||
2283 | 61 | Q_OBJECT | ||
2284 | 62 | |||
2285 | 63 | public: | ||
2286 | 64 | ScopesOverviewSearchCategories(Scopes *scopes, QObject* parent = 0); | ||
2287 | 65 | |||
2288 | 66 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||
2289 | 67 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||
2290 | 68 | |||
2291 | 69 | Q_INVOKABLE void addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject) override; | ||
2292 | 70 | Q_INVOKABLE bool overrideCategoryJson(QString const& categoryId, QString const& json) override; | ||
2293 | 71 | |||
2294 | 72 | private: | ||
2295 | 73 | mutable QHash<int, unity::shell::scopes::ResultsModelInterface*> m_resultsModels; | ||
2296 | 74 | |||
2297 | 75 | Scopes *m_scopes; | ||
2298 | 76 | }; | ||
2299 | 77 | |||
2300 | 78 | class ScopesOverviewResultsModel : public unity::shell::scopes::ResultsModelInterface | ||
2301 | 79 | { | ||
2302 | 80 | Q_OBJECT | ||
2303 | 81 | |||
2304 | 82 | public: | ||
2305 | 83 | explicit ScopesOverviewResultsModel(const QList<unity::shell::scopes::ScopeInterface *> &scopes, const QString &categoryId, QObject* parent = 0); | ||
2306 | 84 | |||
2307 | 85 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||
2308 | 86 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||
2309 | 87 | |||
2310 | 88 | /* getters */ | ||
2311 | 89 | QString categoryId() const override; | ||
2312 | 90 | int count() const override; | ||
2313 | 91 | |||
2314 | 92 | /* setters */ | ||
2315 | 93 | void setCategoryId(QString const& id) override; | ||
2316 | 94 | |||
2317 | 95 | /* Special API */ | ||
2318 | 96 | Q_INVOKABLE int scopeIndex(QString const& id) const; | ||
2319 | 97 | QHash<int, QByteArray> roleNames() const override; | ||
2320 | 98 | |||
2321 | 99 | private: | ||
2322 | 100 | QList<unity::shell::scopes::ScopeInterface *> m_scopes; | ||
2323 | 101 | QString m_categoryId; | ||
2324 | 102 | }; | ||
2325 | 103 | |||
2326 | 104 | #endif // FAKE_SCOPESOVERVIEW_H | ||
2327 | 0 | 105 | ||
2328 | === modified file 'tests/plugins/Dash/cardcreator/5.res' | |||
2329 | --- tests/plugins/Dash/cardcreator/5.res 2014-07-08 12:37:34 +0000 | |||
2330 | +++ tests/plugins/Dash/cardcreator/5.res 2014-07-29 11:27:22 +0000 | |||
2331 | @@ -109,6 +109,7 @@ | |||
2332 | 109 | anchors { left: parent.left; | 109 | anchors { left: parent.left; |
2333 | 110 | leftMargin: units.gu(1); | 110 | leftMargin: units.gu(1); |
2334 | 111 | right: parent.right; | 111 | right: parent.right; |
2335 | 112 | rightMargin: units.gu(1); | ||
2336 | 112 | top: overlayLoader.top; | 113 | top: overlayLoader.top; |
2337 | 113 | topMargin: units.gu(1); | 114 | topMargin: units.gu(1); |
2338 | 114 | } | 115 | } |
2339 | 115 | 116 | ||
2340 | === modified file 'tests/qmltests/Components/tst_PageHeader.qml' | |||
2341 | --- tests/qmltests/Components/tst_PageHeader.qml 2014-07-08 08:30:46 +0000 | |||
2342 | +++ tests/qmltests/Components/tst_PageHeader.qml 2014-07-29 11:27:22 +0000 | |||
2343 | @@ -36,6 +36,16 @@ | |||
2344 | 36 | 36 | ||
2345 | 37 | function init() { | 37 | function init() { |
2346 | 38 | searchEnabled = true; | 38 | searchEnabled = true; |
2347 | 39 | |||
2348 | 40 | // Reset to initial state | ||
2349 | 41 | pageHeader.searchQuery = ""; | ||
2350 | 42 | pageHeader.closePopup(); | ||
2351 | 43 | pageHeader.searchHistory.clear(); | ||
2352 | 44 | |||
2353 | 45 | // Check initial state | ||
2354 | 46 | var headerContainer = findChild(pageHeader, "headerContainer"); | ||
2355 | 47 | tryCompareFunction(function() { return headerContainer.popover === null; }, true); | ||
2356 | 48 | compare(pageHeader.searchHistory.count, 0); | ||
2357 | 39 | } | 49 | } |
2358 | 40 | 50 | ||
2359 | 41 | function test_search_disabled() { | 51 | function test_search_disabled() { |
2360 | @@ -80,9 +90,6 @@ | |||
2361 | 80 | } | 90 | } |
2362 | 81 | 91 | ||
2363 | 82 | function test_history() { | 92 | function test_history() { |
2364 | 83 | pageHeader.searchHistory.clear() | ||
2365 | 84 | compare(pageHeader.searchHistory.count, 0) | ||
2366 | 85 | |||
2367 | 86 | pageHeader.triggerSearch() | 93 | pageHeader.triggerSearch() |
2368 | 87 | typeString("humppa1") | 94 | typeString("humppa1") |
2369 | 88 | pageHeader.resetSearch() | 95 | pageHeader.resetSearch() |
2370 | @@ -166,16 +173,26 @@ | |||
2371 | 166 | tryCompareFunction(function() { return headerContainer.popover !== null; }, true); | 173 | tryCompareFunction(function() { return headerContainer.popover !== null; }, true); |
2372 | 167 | 174 | ||
2373 | 168 | tryCompare(headerContainer.popover, "visible", true); | 175 | tryCompare(headerContainer.popover, "visible", true); |
2374 | 176 | |||
2375 | 177 | var searchTextField = findChild(pageHeader, "searchTextField"); | ||
2376 | 178 | compare(searchTextField.focus, true); | ||
2377 | 179 | |||
2378 | 180 | var recentSearches = findChild(headerContainer.popover, "recentSearches"); | ||
2379 | 181 | mouseClick(recentSearches.itemAt(0), 0, 0); | ||
2380 | 182 | |||
2381 | 183 | compare(pageHeader.searchQuery, "Search2"); | ||
2382 | 184 | tryCompareFunction(function() { return headerContainer.popover === null; }, true); | ||
2383 | 185 | compare(searchTextField.focus, false); | ||
2384 | 169 | } | 186 | } |
2385 | 170 | 187 | ||
2387 | 171 | function test_tap_outside_closes_popup_data() { | 188 | function test_popup_closing_data() { |
2388 | 172 | return [ | 189 | return [ |
2389 | 173 | { tag: "with search text", searchText: "foobar", hideSearch: false }, | 190 | { tag: "with search text", searchText: "foobar", hideSearch: false }, |
2390 | 174 | { tag: "without search text", searchText: "", hideSearch: true } | 191 | { tag: "without search text", searchText: "", hideSearch: true } |
2391 | 175 | ]; | 192 | ]; |
2392 | 176 | } | 193 | } |
2393 | 177 | 194 | ||
2395 | 178 | function test_tap_outside_closes_popup(data) { | 195 | function test_popup_closing(data) { |
2396 | 179 | searchEnabled = true; | 196 | searchEnabled = true; |
2397 | 180 | pageHeader.searchHistory.clear(); | 197 | pageHeader.searchHistory.clear(); |
2398 | 181 | 198 | ||
2399 | @@ -191,13 +208,26 @@ | |||
2400 | 191 | 208 | ||
2401 | 192 | pageHeader.searchQuery = data.searchText; | 209 | pageHeader.searchQuery = data.searchText; |
2402 | 193 | 210 | ||
2404 | 194 | mouseClick(root, root.width / 2, root.height - 1); | 211 | if (data.searchText == "") { |
2405 | 212 | // When the text is empty the user can also close the | ||
2406 | 213 | // popup by clicking outside the header instead of by starting a search | ||
2407 | 214 | mouseClick(root, root.width / 2, root.height - 1); | ||
2408 | 215 | } | ||
2409 | 195 | 216 | ||
2410 | 196 | tryCompare(headerContainer, "showSearch", !data.hideSearch); | 217 | tryCompare(headerContainer, "showSearch", !data.hideSearch); |
2411 | 197 | tryCompareFunction(function() { return headerContainer.popover === null; }, true); | 218 | tryCompareFunction(function() { return headerContainer.popover === null; }, true); |
2412 | 198 | 219 | ||
2413 | 199 | pageHeader.resetSearch(); | 220 | pageHeader.resetSearch(); |
2414 | 200 | } | 221 | } |
2415 | 222 | |||
2416 | 223 | function test_search_change_shows_search() { | ||
2417 | 224 | var headerContainer = findChild(pageHeader, "headerContainer"); | ||
2418 | 225 | compare(headerContainer.showSearch, false); | ||
2419 | 226 | compare(searchQuery, ""); | ||
2420 | 227 | |||
2421 | 228 | searchQuery = "H"; | ||
2422 | 229 | compare(headerContainer.showSearch, true); | ||
2423 | 230 | } | ||
2424 | 201 | } | 231 | } |
2425 | 202 | 232 | ||
2426 | 203 | Column { | 233 | Column { |
2427 | 204 | 234 | ||
2428 | === modified file 'tests/qmltests/Dash/tst_Dash.qml' | |||
2429 | --- tests/qmltests/Dash/tst_Dash.qml 2014-07-11 11:45:45 +0000 | |||
2430 | +++ tests/qmltests/Dash/tst_Dash.qml 2014-07-29 11:27:22 +0000 | |||
2431 | @@ -20,8 +20,6 @@ | |||
2432 | 20 | import Ubuntu.Components 0.1 | 20 | import Ubuntu.Components 0.1 |
2433 | 21 | import Unity.Test 0.1 as UT | 21 | import Unity.Test 0.1 as UT |
2434 | 22 | 22 | ||
2435 | 23 | // TODO We don't have any tests for the overlay scope functionality. | ||
2436 | 24 | |||
2437 | 25 | Item { | 23 | Item { |
2438 | 26 | id: shell | 24 | id: shell |
2439 | 27 | width: units.gu(40) | 25 | width: units.gu(40) |
2440 | @@ -86,10 +84,220 @@ | |||
2441 | 86 | tryCompare(dashContentList, "count", 0); | 84 | tryCompare(dashContentList, "count", 0); |
2442 | 87 | scopes.load(); | 85 | scopes.load(); |
2443 | 88 | tryCompare(scopes, "loaded", true); | 86 | tryCompare(scopes, "loaded", true); |
2445 | 89 | tryCompare(dashContentList, "count", 4); | 87 | tryCompare(dashContentList, "count", 6); |
2446 | 90 | 88 | ||
2447 | 91 | verify(dashContentList != undefined); | 89 | verify(dashContentList != undefined); |
2448 | 92 | tryCompare(dashContentList, "currentIndex", data.visualIndex); | 90 | tryCompare(dashContentList, "currentIndex", data.visualIndex); |
2449 | 93 | } | 91 | } |
2450 | 92 | |||
2451 | 93 | function test_dash_overview_show_select_same_favorite() { | ||
2452 | 94 | // Wait for stuff to be loaded | ||
2453 | 95 | tryCompare(scopes, "loaded", true); | ||
2454 | 96 | var dashContentList = findChild(dash, "dashContentList"); | ||
2455 | 97 | tryCompare(dashContentList, "count", 6); | ||
2456 | 98 | var mockScope1Loader = findChild(dash, "MockScope1 loader"); | ||
2457 | 99 | tryCompareFunction(function() { return mockScope1Loader.item != null; }, true); | ||
2458 | 100 | |||
2459 | 101 | // Show the overview | ||
2460 | 102 | touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18)); | ||
2461 | 103 | var overviewController = findInvisibleChild(dash, "overviewController"); | ||
2462 | 104 | tryCompare(overviewController, "progress", 1); | ||
2463 | 105 | |||
2464 | 106 | // Make sure tab is where it should | ||
2465 | 107 | var scopesOverview = findChild(dash, "scopesOverview"); | ||
2466 | 108 | compare(scopesOverview.currentTab, 0); | ||
2467 | 109 | |||
2468 | 110 | // Make sure stuff is loaded | ||
2469 | 111 | var scopesOverviewFavoritesRepeater = findChild(dash, "scopesOverviewFavoritesRepeater"); | ||
2470 | 112 | tryCompare(scopesOverviewFavoritesRepeater, "count", 6); | ||
2471 | 113 | tryCompareFunction(function() { return scopesOverviewFavoritesRepeater.itemAt(0).item != null; }, true); | ||
2472 | 114 | waitForRendering(scopesOverviewFavoritesRepeater.itemAt(0).item); | ||
2473 | 115 | |||
2474 | 116 | // Click in first item | ||
2475 | 117 | mouseClick(scopesOverviewFavoritesRepeater.itemAt(0).item, 0, 0); | ||
2476 | 118 | |||
2477 | 119 | // Make sure animation went back | ||
2478 | 120 | tryCompare(overviewController, "progress", 0); | ||
2479 | 121 | compare(dashContentList.currentIndex, 0); | ||
2480 | 122 | } | ||
2481 | 123 | |||
2482 | 124 | function test_dash_overview_show_select_different_favorite() { | ||
2483 | 125 | // Wait for stuff to be loaded | ||
2484 | 126 | tryCompare(scopes, "loaded", true); | ||
2485 | 127 | var dashContentList = findChild(dash, "dashContentList"); | ||
2486 | 128 | tryCompare(dashContentList, "count", 6); | ||
2487 | 129 | var mockScope1Loader = findChild(dash, "MockScope1 loader"); | ||
2488 | 130 | tryCompareFunction(function() { return mockScope1Loader.item != null; }, true); | ||
2489 | 131 | |||
2490 | 132 | // Show the overview | ||
2491 | 133 | touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18)); | ||
2492 | 134 | var overviewController = findInvisibleChild(dash, "overviewController"); | ||
2493 | 135 | tryCompare(overviewController, "progress", 1); | ||
2494 | 136 | |||
2495 | 137 | // Make sure tab is where it should | ||
2496 | 138 | var scopesOverview = findChild(dash, "scopesOverview"); | ||
2497 | 139 | compare(scopesOverview.currentTab, 0); | ||
2498 | 140 | |||
2499 | 141 | // Make sure stuff is loaded | ||
2500 | 142 | var scopesOverviewFavoritesRepeater = findChild(dash, "scopesOverviewFavoritesRepeater"); | ||
2501 | 143 | tryCompare(scopesOverviewFavoritesRepeater, "count", 6); | ||
2502 | 144 | tryCompareFunction(function() { return scopesOverviewFavoritesRepeater.itemAt(0).item != null; }, true); | ||
2503 | 145 | waitForRendering(scopesOverviewFavoritesRepeater.itemAt(1).item); | ||
2504 | 146 | |||
2505 | 147 | // Click in first item | ||
2506 | 148 | mouseClick(scopesOverviewFavoritesRepeater.itemAt(1).item, 0, 0); | ||
2507 | 149 | |||
2508 | 150 | // Make sure animation went back | ||
2509 | 151 | tryCompare(overviewController, "progress", 0); | ||
2510 | 152 | compare(dashContentList.currentIndex, 1); | ||
2511 | 153 | } | ||
2512 | 154 | |||
2513 | 155 | function test_dash_overview_all_temp_scope_done_from_all() { | ||
2514 | 156 | // Wait for stuff to be loaded | ||
2515 | 157 | tryCompare(scopes, "loaded", true); | ||
2516 | 158 | var dashContentList = findChild(dash, "dashContentList"); | ||
2517 | 159 | tryCompare(dashContentList, "count", 6); | ||
2518 | 160 | var mockScope1Loader = findChild(dash, "MockScope1 loader"); | ||
2519 | 161 | tryCompareFunction(function() { return mockScope1Loader.item != null; }, true); | ||
2520 | 162 | |||
2521 | 163 | // Show the overview | ||
2522 | 164 | touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18)); | ||
2523 | 165 | var overviewController = findInvisibleChild(dash, "overviewController"); | ||
2524 | 166 | tryCompare(overviewController, "progress", 1); | ||
2525 | 167 | |||
2526 | 168 | // Make sure tab is where it should | ||
2527 | 169 | var scopesOverview = findChild(dash, "scopesOverview"); | ||
2528 | 170 | compare(scopesOverview.currentTab, 0); | ||
2529 | 171 | |||
2530 | 172 | // Make sure stuff is loaded | ||
2531 | 173 | var scopesOverviewFavoritesRepeater = findChild(dash, "scopesOverviewFavoritesRepeater"); | ||
2532 | 174 | tryCompare(scopesOverviewFavoritesRepeater, "count", 6); | ||
2533 | 175 | tryCompareFunction(function() { return scopesOverviewFavoritesRepeater.itemAt(0).item != null; }, true); | ||
2534 | 176 | waitForRendering(scopesOverviewFavoritesRepeater.itemAt(1).item); | ||
2535 | 177 | |||
2536 | 178 | // Click on the all tab | ||
2537 | 179 | var scopesOverviewAllTabButton = findChild(dash, "scopesOverviewAllTabButton"); | ||
2538 | 180 | mouseClick(scopesOverviewAllTabButton, 0, 0); | ||
2539 | 181 | |||
2540 | 182 | // Wait for all tab to be enabled (animation finish) | ||
2541 | 183 | var scopesOverviewAllView = findChild(dash, "scopesOverviewRepeaterChild1"); | ||
2542 | 184 | tryCompare(scopesOverviewAllView, "enabled", true); | ||
2543 | 185 | |||
2544 | 186 | // Click on a temp scope | ||
2545 | 187 | var tempScopeCard = findChild(scopesOverviewAllView, "delegate1"); | ||
2546 | 188 | mouseClick(tempScopeCard, 0, 0); | ||
2547 | 189 | |||
2548 | 190 | // Check the bottom edge (overview) is disabled from temp scope | ||
2549 | 191 | var overviewDragHandle = findChild(dash, "overviewDragHandle"); | ||
2550 | 192 | compare(overviewDragHandle.enabled, false); | ||
2551 | 193 | |||
2552 | 194 | // Check temp scope is there | ||
2553 | 195 | var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem"); | ||
2554 | 196 | tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope != null; }, true); | ||
2555 | 197 | tryCompare(scopesOverviewTempScopeItem, "enabled", true); | ||
2556 | 198 | |||
2557 | 199 | // Go back | ||
2558 | 200 | var scopesOverviewTempScopeItemHeader = findChild(scopesOverviewTempScopeItem, "scopePageHeader"); | ||
2559 | 201 | var backButton = findChild(findChild(scopesOverviewTempScopeItemHeader, "innerPageHeader"), "backButton"); | ||
2560 | 202 | mouseClick(backButton, 0, 0); | ||
2561 | 203 | |||
2562 | 204 | // Check temp scope is gone | ||
2563 | 205 | var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem"); | ||
2564 | 206 | tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope == null; }, true); | ||
2565 | 207 | tryCompare(scopesOverviewTempScopeItem, "enabled", false); | ||
2566 | 208 | |||
2567 | 209 | // Press on done | ||
2568 | 210 | var scopesOverviewDoneButton = findChild(scopesOverview, "scopesOverviewDoneButton"); | ||
2569 | 211 | mouseClick(scopesOverviewDoneButton, 0, 0); | ||
2570 | 212 | |||
2571 | 213 | // Check the dash overview is gone | ||
2572 | 214 | tryCompare(overviewController, "progress", 0); | ||
2573 | 215 | |||
2574 | 216 | // Original list is still on 0 | ||
2575 | 217 | compare(dashContentList.currentIndex, 0); | ||
2576 | 218 | } | ||
2577 | 219 | |||
2578 | 220 | function test_temp_scope_dash_overview_all_search_temp_scope_favorite_from_all() { | ||
2579 | 221 | // Wait for stuff to be loaded | ||
2580 | 222 | tryCompare(scopes, "loaded", true); | ||
2581 | 223 | var dashContentList = findChild(dash, "dashContentList"); | ||
2582 | 224 | tryCompare(dashContentList, "count", 6); | ||
2583 | 225 | var mockScope1Loader = findChild(dash, "MockScope1 loader"); | ||
2584 | 226 | tryCompareFunction(function() { return mockScope1Loader.item != null; }, true); | ||
2585 | 227 | |||
2586 | 228 | // Swipe right to Apps scope | ||
2587 | 229 | touchFlick(dash, dash.width - 1, units.gu(1), dash.width - units.gu(10), units.gu(1)); | ||
2588 | 230 | tryCompare(dashContentList, "contentX", dashContentList.width); | ||
2589 | 231 | tryCompare(dashContentList, "currentIndex", 1); | ||
2590 | 232 | |||
2591 | 233 | // Click on card that opens temp scope | ||
2592 | 234 | var dashCategory2 = findChild(dashContentList.currentItem, "dashCategory2"); | ||
2593 | 235 | var card2 = findChild(dashCategory2, "delegate2"); | ||
2594 | 236 | waitForRendering(card2); | ||
2595 | 237 | mouseClick(card2, card2.width / 2, card2.height / 2); | ||
2596 | 238 | |||
2597 | 239 | // Wait for temp scope to be there | ||
2598 | 240 | var dashTempScopeItem = findChild(dash, "dashTempScopeItem"); | ||
2599 | 241 | tryCompare(dashTempScopeItem, "x", 0); | ||
2600 | 242 | |||
2601 | 243 | // Show the overview | ||
2602 | 244 | touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18)); | ||
2603 | 245 | var overviewController = findInvisibleChild(dash, "overviewController"); | ||
2604 | 246 | tryCompare(overviewController, "progress", 1); | ||
2605 | 247 | |||
2606 | 248 | // Make sure tab is where it should | ||
2607 | 249 | var scopesOverview = findChild(dash, "scopesOverview"); | ||
2608 | 250 | compare(scopesOverview.currentTab, 1); | ||
2609 | 251 | |||
2610 | 252 | // Do a search | ||
2611 | 253 | var scopesOverviewPageHeader = findChild(scopesOverview, "scopesOverviewPageHeader"); | ||
2612 | 254 | var searchButton = findChild(scopesOverviewPageHeader, "search_header_button"); | ||
2613 | 255 | mouseClick(searchButton, 0, 0); | ||
2614 | 256 | |||
2615 | 257 | // Type something | ||
2616 | 258 | keyClick(Qt.Key_H); | ||
2617 | 259 | |||
2618 | 260 | // Check results grid is there and the other lists are not | ||
2619 | 261 | var searchResultsViewer = findChild(scopesOverview, "searchResultsViewer"); | ||
2620 | 262 | var scopesOverviewRepeater = findChild(dash, "scopesOverviewRepeater"); | ||
2621 | 263 | tryCompare(searchResultsViewer, "opacity", 1); | ||
2622 | 264 | tryCompare(scopesOverviewRepeater, "count", 0); | ||
2623 | 265 | |||
2624 | 266 | // Click on a temp scope in the search | ||
2625 | 267 | var dashCategorysearchA = findChild(searchResultsViewer, "dashCategorysearchA"); | ||
2626 | 268 | var cardTempScope = findChild(dashCategorysearchA, "delegate2"); | ||
2627 | 269 | waitForRendering(cardTempScope); | ||
2628 | 270 | mouseClick(cardTempScope, cardTempScope.width / 2, cardTempScope.height / 2); | ||
2629 | 271 | |||
2630 | 272 | // Check the bottom edge (overview) is disabled from temp scope | ||
2631 | 273 | var overviewDragHandle = findChild(dash, "overviewDragHandle"); | ||
2632 | 274 | compare(overviewDragHandle.enabled, false); | ||
2633 | 275 | |||
2634 | 276 | // Check temp scope is there | ||
2635 | 277 | var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem"); | ||
2636 | 278 | tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope != null; }, true); | ||
2637 | 279 | tryCompare(scopesOverviewTempScopeItem, "enabled", true); | ||
2638 | 280 | |||
2639 | 281 | // Go back | ||
2640 | 282 | var scopesOverviewTempScopeItemHeader = findChild(scopesOverviewTempScopeItem, "scopePageHeader"); | ||
2641 | 283 | var backButton = findChild(findChild(scopesOverviewTempScopeItemHeader, "innerPageHeader"), "backButton"); | ||
2642 | 284 | mouseClick(backButton, 0, 0); | ||
2643 | 285 | |||
2644 | 286 | // Check temp scope is gone | ||
2645 | 287 | var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem"); | ||
2646 | 288 | tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope == null; }, true); | ||
2647 | 289 | tryCompare(scopesOverviewTempScopeItem, "enabled", false); | ||
2648 | 290 | |||
2649 | 291 | // Press on a favorite | ||
2650 | 292 | var dashCategorysearchB = findChild(searchResultsViewer, "dashCategorysearchB"); | ||
2651 | 293 | var cardFavSearch = findChild(dashCategorysearchB, "delegate3"); | ||
2652 | 294 | mouseClick(cardFavSearch, 0, 0); | ||
2653 | 295 | |||
2654 | 296 | // Check the dash overview is gone | ||
2655 | 297 | tryCompare(overviewController, "progress", 0); | ||
2656 | 298 | |||
2657 | 299 | // Original list went to the favorite | ||
2658 | 300 | compare(dashContentList.currentIndex, 0); | ||
2659 | 301 | } | ||
2660 | 94 | } | 302 | } |
2661 | 95 | } | 303 | } |
2662 | 96 | 304 | ||
2663 | === modified file 'tests/qmltests/Dash/tst_DashContent.qml' | |||
2664 | --- tests/qmltests/Dash/tst_DashContent.qml 2014-07-21 13:28:35 +0000 | |||
2665 | +++ tests/qmltests/Dash/tst_DashContent.qml 2014-07-29 11:27:22 +0000 | |||
2666 | @@ -73,7 +73,7 @@ | |||
2667 | 73 | function loadScopes() { | 73 | function loadScopes() { |
2668 | 74 | scopeLoadedSpy.clear(); | 74 | scopeLoadedSpy.clear(); |
2669 | 75 | scopesModel.load(); | 75 | scopesModel.load(); |
2671 | 76 | tryCompare(scopeLoadedSpy, "count", 4); | 76 | tryCompare(scopeLoadedSpy, "count", 10); |
2672 | 77 | } | 77 | } |
2673 | 78 | 78 | ||
2674 | 79 | function init() { | 79 | function init() { |
2675 | @@ -117,7 +117,8 @@ | |||
2676 | 117 | 117 | ||
2677 | 118 | loadScopes(); | 118 | loadScopes(); |
2678 | 119 | 119 | ||
2680 | 120 | verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5); | 120 | compare(dashContentList.count, 10); |
2681 | 121 | verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < dashContentList.count); | ||
2682 | 121 | } | 122 | } |
2683 | 122 | 123 | ||
2684 | 123 | function test_show_header_on_list_movement() { | 124 | function test_show_header_on_list_movement() { |
2685 | @@ -173,7 +174,7 @@ | |||
2686 | 173 | 174 | ||
2687 | 174 | // test greater than scope count. | 175 | // test greater than scope count. |
2688 | 175 | var currentScopeIndex = dashContent.currentIndex; | 176 | var currentScopeIndex = dashContent.currentIndex; |
2690 | 176 | dashContent.setCurrentScopeAtIndex(8, true, false); | 177 | dashContent.setCurrentScopeAtIndex(18, true, false); |
2691 | 177 | compare(dashContent.currentIndex, currentScopeIndex, "Scope should not change if changing to greater index than count"); | 178 | compare(dashContent.currentIndex, currentScopeIndex, "Scope should not change if changing to greater index than count"); |
2692 | 178 | } | 179 | } |
2693 | 179 | 180 | ||
2694 | @@ -380,5 +381,17 @@ | |||
2695 | 380 | mouseClick(allButton, 0, 0); | 381 | mouseClick(allButton, 0, 0); |
2696 | 381 | tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2"); | 382 | tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2"); |
2697 | 382 | } | 383 | } |
2698 | 384 | |||
2699 | 385 | function test_searchHint() { | ||
2700 | 386 | var dashContentList = findChild(dashContent, "dashContentList"); | ||
2701 | 387 | verify(dashContentList !== null); | ||
2702 | 388 | var scope = findChild(dashContent, "MockScope1 loader"); | ||
2703 | 389 | waitForRendering(scope); | ||
2704 | 390 | |||
2705 | 391 | var categoryListView = findChild(scope, "categoryListView"); | ||
2706 | 392 | waitForRendering(categoryListView); | ||
2707 | 393 | |||
2708 | 394 | compare(categoryListView.pageHeader.searchHint, "Search People"); | ||
2709 | 395 | } | ||
2710 | 383 | } | 396 | } |
2711 | 384 | } | 397 | } |
I think we could add a simple test here to make sure the value from the scope ends up in the placeholderText.