Merge lp:~unity-team/unity/8.new-libunity into lp:unity/8.0

Proposed by Michał Sawicz
Status: Merged
Approved by: Ricardo Salveti
Approved revision: no longer in the source branch.
Merged at revision: 31
Proposed branch: lp:~unity-team/unity/8.new-libunity
Merge into: lp:unity/8.0
Diff against target: 5742 lines (+706/-3241)
66 files modified
Components/IconUtil.js (+42/-0)
Dash/Apps/ApplicationsFilterGrid.qml (+2/-2)
Dash/Dash.qml (+27/-27)
Dash/DashApps.qml (+5/-5)
Dash/DashBar.qml (+3/-8)
Dash/DashContent.qml (+18/-17)
Dash/DashHome.qml (+15/-37)
Dash/DashMusic.qml (+7/-7)
Dash/DashPeople.qml (+0/-235)
Dash/DashVideos.qml (+9/-9)
Dash/GenericScopeView.qml (+8/-7)
Dash/Music/MusicFilterGrid.qml (+2/-2)
Dash/People/CarouselDelegatePeople.qml (+0/-166)
Dash/People/Data.qml (+0/-71)
Dash/People/Delegate.qml (+0/-167)
Dash/People/PeopleCarousel.qml (+0/-43)
Dash/People/PeopleFilterGrid.qml (+0/-74)
Dash/People/PeoplePreview.qml (+0/-124)
Dash/People/Preview/Address.qml (+0/-74)
Dash/People/Preview/Base.qml (+0/-22)
Dash/People/Preview/Generic.qml (+0/-80)
Dash/People/Preview/Phone.qml (+0/-108)
Dash/People/Preview/Status.qml (+0/-97)
Dash/People/graphics/bottomshape@18.sci (+0/-5)
Dash/ScopeDelegateMapper.qml (+10/-11)
Dash/ScopeView.qml (+4/-4)
Dash/Video/VideosFilterGrid.qml (+2/-2)
Shell.qml (+3/-3)
build_unity (+5/-15)
debian/changelog (+6/-0)
debian/control (+3/-1)
plugins/Unity/CMakeLists.txt (+2/-3)
plugins/Unity/categories.cpp (+4/-54)
plugins/Unity/categories.h (+1/-11)
plugins/Unity/peoplepreviewdata.cpp (+0/-438)
plugins/Unity/peoplepreviewdata.h (+0/-251)
plugins/Unity/plugin.cpp (+4/-9)
plugins/Unity/scope.cpp (+129/-194)
plugins/Unity/scope.h (+16/-44)
plugins/Unity/scopes.cpp (+98/-104)
plugins/Unity/scopes.h (+25/-21)
po/unity8.pot (+11/-38)
tests/autopilot/unity8/tests/helpers.py (+1/-1)
tests/autopilot/unity8/tests/testhud.py (+1/-1)
tests/autopilot/unity8/tests/testlockscreen.py (+1/-1)
tests/qmltests/CMakeLists.txt (+2/-4)
tests/qmltests/Dash/People/tst_PeopleFilterGrid.qml (+0/-154)
tests/qmltests/Dash/qml/FakeScopeView.qml (+9/-9)
tests/qmltests/Dash/qml/fake_generic_scopeView.qml (+3/-3)
tests/qmltests/Dash/qml/fake_scopeView1.qml (+3/-3)
tests/qmltests/Dash/qml/fake_scopeView2.qml (+3/-3)
tests/qmltests/Dash/qml/fake_scopeView3.qml (+3/-3)
tests/qmltests/Dash/qml/fake_scopeView4.qml (+3/-3)
tests/qmltests/Dash/tst_Dash.qml (+34/-34)
tests/qmltests/Dash/tst_DashBar.qml (+4/-4)
tests/qmltests/Dash/tst_DashContent.qml (+79/-76)
tests/qmltests/Dash/tst_FilterGrids.qml (+0/-1)
tests/qmltests/Dash/tst_GenericScopeView.qml (+10/-10)
tests/qmltests/Dash/tst_PeoplePreview.qml (+0/-254)
tests/qmltests/Dash/tst_ScopeView.qml (+12/-12)
tests/qmltests/plugins/Unity/CMakeLists.txt (+2/-2)
tests/qmltests/plugins/Unity/fake_scope.cpp (+15/-13)
tests/qmltests/plugins/Unity/fake_scope.h (+6/-6)
tests/qmltests/plugins/Unity/fake_scopes.cpp (+38/-38)
tests/qmltests/plugins/Unity/fake_scopes.h (+13/-13)
tests/qmltests/plugins/Unity/fake_unity_plugin.cpp (+3/-3)
To merge this branch: bzr merge lp:~unity-team/unity/8.new-libunity
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
Michał Sawicz Approve
PS Jenkins bot (community) continuous-integration Approve
Michael Zanetti (community) Approve
Review via email: mp+167733@code.launchpad.net

This proposal supersedes a proposal from 2013-06-06.

Commit message

First cut at porting phablet code to the new scopes API.

Description of the change

First cut at porting phablet code to the new scopes API. Please note that it needs lp:~stolowski/demo-assets/new-api and
lp:~stolowski/phablet-extras/unity-lens-mock-new-api

Here is a short note about how to get it running:
https://docs.google.com/a/canonical.com/document/d/1aNB6kfLOMq0asyxiSLahakfLU5si6V5RqxBuacMB0-U/edit

Please note that there are some 'issues' caused by the transition to the new API that I think are out of scope for this MP and should be handled as we move forward:
- shell needs to handle AnnotatedIcon (icon + price ribbon overlay), for now I implemented a simple fallback (just an icon).
- some themed icons are not loaded (mostly mime-type icons).

Also note that customized Home and Apps are disabled at the moment. Instead, you will see the real Home Scope content (Home is now a real scope in the backed, rather then a special case in UnityCore) and the desktop version of Apps (applications.scope) if present. We have a branch of applications scope that merges recent App scope changes with phablet apps mod. It needs to land in saucy for Apps to work on the phone.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

We might need to (build)depend on libunity, libunity-core < 7.80 so that we pick up the saucy version, at least until we drop the modded versions from 13.04.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ying-Chun Liu (paulliu) wrote :

I got the same jenkins error before. I have to build it against the latest UnityCore. Like modify the build script to UNITY_REV=3326.
Is that an issue here?

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

W dniu 10.06.2013 15:19, Ying-Chun Liu pisze:
> I got the same jenkins error before. I have to build it against the latest UnityCore. Like modify the build script to UNITY_REV=3326.
> Is that an issue here?

The build script isn't used here. But the unity packages didn't get
updated in the cache or something. Triggering a rebuild.

--
Michał Sawicz <email address hidden>
Canonical Services Ltd.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

* please move from_gicon(name) out into a separate .js file for use in all the Tiles and Carousel*Delegates
* please complete the s/lens/scope/g, there's lenses mentioned all over the place - in tests/, too
* is there a header from which we could take the column ids in categories.cpp?
* "TODO needs model row" does that mean the whole row? row index? is it still needed, btw? you said we were moving away from scope-side activation?
* #include <UnityCore/Variant.h> not needed?
* #include <UnityCore/Results.h> Result.h should be enough?
* is ViewType::HomeView still used?
* should we make sure ViewType and ScopeViewType enums are in sync?
* Scopes::onScopeRemoved and ::onScopesReordered - we should probably implement those?

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

--- debian/control 2013-06-05 22:03:08 +0000
158 +++ debian/control 2013-06-07 15:37:31 +0000
159 @@ -11,7 +11,7 @@
160 libgles2-mesa-dev[armhf],
161 libhud-client2-dev,
162 libpulse-dev,
163 - libunity-core-6.0-dev,
164 + libunity-core-6.0-dev (<7.80),

Should be libunity-core-6.0-dev (<< 7.80)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

The resulting package has a Depends:

libunity-core-6.0-5 (>= 4.14.2)

... can we please bump libunity-core SONAME, so that we're actually depending on the right version of the libs?

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Yeah, and there's the conflicts that I mentioned now...

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

3914 + // is this QML-friendly? Shall it be more robust (beginMoveRows)?

Unfortunately it is not. Well, it doesn't crash anything or the like, but will destroy all the views for the model and build them up again. Very expensive operation. begin/endMoveRows() instead moves them without destroying and recreating.

Same for

3917 + // remove existing scopes
3918 + for (auto i=m_scopes.count()-1; i>=0; i--) {
3919 + removeUnityScope(i);
3920 + }
3921 +
3922 + // re-create scopes
3923 + for (uint i=0; i<scopes.size(); i++) {
3924 + addUnityScope(scopes[i]);
3925 + }

While Scope doesn't seem to be the most expensive class, it's still a lot more energy wasted then just reordering it in the list.

review: Needs Fixing
Revision history for this message
Michael Zanetti (mzanetti) wrote :

206 - /* FIXME: should be 'source: lens.iconHint' but the
207 - lenses do not contain the right icons yet
208 + /* FIXME: should be 'source: scope.iconHint' but the
209 + scopes do not contain the right icons yet
210 */

Not sure what the state is, but just in case the new scopes would allow to get rid of such FIXME's, please make sure to either directly fix it if its straight forward, or to modify the FIXME comment in a way its obvious for us that we can get rid of it now.

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

looks good to me now

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) :
review: Approve
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Good, tested, working fine :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'Components/IconUtil.js'
2--- Components/IconUtil.js 1970-01-01 00:00:00 +0000
3+++ Components/IconUtil.js 2013-06-19 20:05:35 +0000
4@@ -0,0 +1,42 @@
5+/*
6+ * Copyright (C) 2013 Canonical, Ltd.
7+ *
8+ * This program is free software; you can redistribute it and/or modify
9+ * it under the terms of the GNU General Public License as published by
10+ * the Free Software Foundation; version 3.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ */
20+
21+.pragma library
22+
23+// FIXME: a quick hack to get icons out of gicons and fallback to
24+// base icon for annotated icons. Doesn't correctly handle all icons.
25+// Proper global solution needed.
26+function from_gicon(name) {
27+ var icon_name = name;
28+ var annotated_re = /^. UnityProtocolAnnotatedIcon/;
29+ if (annotated_re.test(name)) {
30+ var base_icon_re = /'base-icon':.+?'(.+?)'/;
31+ var base_icon = name.toString().match(base_icon_re);
32+ icon_name = base_icon[1];
33+ }
34+ else {
35+ var themed_re = /^. GThemedIcon\s*([^\s]+)\s*/;
36+ var themed = name.match(themed_re);
37+ if (themed) {
38+ return "image://gicon/" + themed[1];
39+ }
40+ }
41+ var remote_re = /^http/;
42+ if (remote_re.test(icon_name)) {
43+ return icon_name;
44+ }
45+ return "image://gicon/" + icon_name;
46+}
47
48=== modified file 'Dash/Apps/ApplicationsFilterGrid.qml'
49--- Dash/Apps/ApplicationsFilterGrid.qml 2013-06-05 22:03:08 +0000
50+++ Dash/Apps/ApplicationsFilterGrid.qml 2013-06-19 20:05:35 +0000
51@@ -35,7 +35,7 @@
52 objectName: "delegate" + index
53 Application {
54 id: application
55- desktopFile: model.column_6 ? stripProtocol(model.column_6) : model.desktopFile // FIXME: this is temporary
56+ desktopFile: model.column_7 ? stripProtocol(model.column_7) : model.desktopFile // FIXME: this is temporary
57
58 function stripProtocol(uri) {
59 var chunks = uri.split('file://')
60@@ -47,7 +47,7 @@
61
62 width: filterGrid.cellWidth
63 height: filterGrid.cellHeight
64- text: model.column_4 ? model.column_4 : application.name // FIXME: this is temporary
65+ text: model.column_5 ? model.column_5 : application.name // FIXME: this is temporary
66 imageWidth: units.gu(8)
67 imageHeight: units.gu(7.5)
68 source: icon.indexOf("/") == -1 ? "image://gicon/" + icon : icon
69
70=== modified file 'Dash/Dash.qml'
71--- Dash/Dash.qml 2013-06-07 09:22:34 +0000
72+++ Dash/Dash.qml 2013-06-19 20:05:35 +0000
73@@ -24,36 +24,36 @@
74 id: dash
75
76 property alias contentProgress: dashContent.contentProgress
77- property string showLensOnLoaded: "home.lens"
78+ property string showScopeOnLoaded: "home.scope"
79 property real contentScale: 1.0
80
81 width: units.gu(40)
82 height: units.gu(71)
83
84- function setCurrentLens(lensId, animate, reset) {
85- var lensIndex = filteredLenses.findFirst(Lenses.RoleId, lensId)
86-
87- if (lensIndex == -1) {
88- console.warn("No match for lens with id: %1".arg(lensId))
89- return
90- }
91-
92- if (lensIndex == dashContent.currentIndex && !reset) {
93- // the lens is already the current one
94- return
95- }
96-
97- dashContent.setCurrentLensAtIndex(lensIndex, animate, reset)
98+ function setCurrentScope(scopeId, animate, reset) {
99+ var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId)
100+
101+ if (scopeIndex == -1) {
102+ console.warn("No match for scope with id: %1".arg(scopeId))
103+ return
104+ }
105+
106+ if (scopeIndex == dashContent.currentIndex && !reset) {
107+ // the scope is already the current one
108+ return
109+ }
110+
111+ dashContent.setCurrentScopeAtIndex(scopeIndex, animate, reset)
112 }
113
114 SortFilterProxyModel {
115- id: filteredLenses
116- model: Lenses {
117- id: lenses
118+ id: filteredScopes
119+ model: Scopes {
120+ id: scopes
121 }
122 dynamicSortFilter: true
123
124- filterRole: Lenses.RoleVisible
125+ filterRole: Scopes.RoleVisible
126 filterRegExp: RegExp("^true$")
127 }
128
129@@ -61,17 +61,17 @@
130 id: dashContent
131 objectName: "dashContent"
132 anchors.fill: parent
133- model: filteredLenses
134- lenses: lenses
135+ model: filteredScopes
136+ scopes: scopes
137 onMovementStarted: dashbar.startNavigation()
138 onMovementEnded: dashbar.stopNavigation()
139 onContentFlickStarted: dashbar.finishNavigation()
140 onContentEndReached: dashbar.finishNavigation()
141 onPreviewShown: dashbar.finishNavigation()
142- onLensLoaded: {
143- if (lensId == dash.showLensOnLoaded) {
144- dash.setCurrentLens(lensId, false, false)
145- dash.showLensOnLoaded = ""
146+ onScopeLoaded: {
147+ if (scopeId == dash.showScopeOnLoaded) {
148+ dash.setCurrentScope(scopeId, false, false)
149+ dash.showScopeOnLoaded = ""
150 }
151 }
152 scale: dash.contentScale
153@@ -84,9 +84,9 @@
154 anchors.bottom: parent.bottom
155 anchors.left: parent.left
156 anchors.right: parent.right
157- model: filteredLenses
158+ model: filteredScopes
159 currentIndex: dashContent.currentIndex
160- onItemSelected: dashContent.setCurrentLensAtIndex(index, true, false)
161+ onItemSelected: dashContent.setCurrentScopeAtIndex(index, true, false)
162 opacity: dash.contentScale == 1.0 ? 1.0 : 0.0
163 Behavior on opacity { NumberAnimation { easing.type: Easing.OutQuad; duration: 150 } }
164 }
165
166=== modified file 'Dash/DashApps.qml'
167--- Dash/DashApps.qml 2013-06-05 22:03:08 +0000
168+++ Dash/DashApps.qml 2013-06-19 20:05:35 +0000
169@@ -21,8 +21,8 @@
170 import "../Components/ListItems"
171 import "Apps"
172
173-LensView {
174- id: lensView
175+ScopeView {
176+ id: scopeView
177
178 // FIXME: a way to aggregate these models would be ideal
179 property var mainStageApplicationsModel: shell.applicationManager.mainStageApplications
180@@ -40,7 +40,7 @@
181 }
182
183 Binding {
184- target: lensView.lens
185+ target: scopeView.scope
186 property: "searchQuery"
187 value: pageHeader.searchQuery
188 }
189@@ -86,7 +86,7 @@
190 dynamicSortFilter: true
191 filterRole: 2 // this is the category id for each result
192 filterRegExp: /^3$/ // only proxy items that are category 3 - Installed
193- model: dashContent.lenses.get("applications.lens").results
194+ model: dashContent.scopes.get("applications.scope").results
195 }
196
197 property var categoryModels: {
198@@ -177,7 +177,7 @@
199 width: categoryView.width
200 text: i18n.tr("Apps")
201 searchEntryEnabled: true
202- searchHistory: lensView.searchHistory
203+ searchHistory: scopeView.searchHistory
204 }
205 }
206 }
207
208=== modified file 'Dash/DashBar.qml'
209--- Dash/DashBar.qml 2013-06-05 22:03:08 +0000
210+++ Dash/DashBar.qml 2013-06-19 20:05:35 +0000
211@@ -26,7 +26,7 @@
212
213 property int lineHeight: units.dp(2)
214 property int itemSize: units.gu(7)
215- property int iconSize: units.gu(2.5)
216+ property int iconSize: units.gu(3.5)
217
218 signal itemSelected(int index)
219
220@@ -97,14 +97,9 @@
221
222 Image {
223 anchors.centerIn: parent
224- /* FIXME: should be 'source: lens.iconHint' but the
225- lenses do not contain the right icons yet
226- */
227- source: "graphics/lensIcons/%1.png".arg(lens.name)
228- height: iconSize
229- width: iconSize
230+ source: scope.iconHint
231+ sourceSize { width: iconSize; height: iconSize }
232 // opacity: index == currentIndex ? 1 : 1 // same opacity for now
233- smooth: true
234 }
235 }
236 }
237
238=== modified file 'Dash/DashContent.qml'
239--- Dash/DashContent.qml 2013-06-11 10:36:55 +0000
240+++ Dash/DashContent.qml 2013-06-19 20:05:35 +0000
241@@ -24,34 +24,34 @@
242 height: units.gu(71)
243
244 property var model: null
245- property var lenses: null
246+ property var scopes: null
247 property real contentProgress: Math.max(0, Math.min(dashContentList.contentX / (dashContentList.contentWidth - dashContentList.width), units.dp(1)))
248 property alias currentIndex: dashContentList.currentIndex
249
250- property LensDelegateMapper lensMapper : LensDelegateMapper {}
251+ property ScopeDelegateMapper scopeMapper : ScopeDelegateMapper {}
252
253 signal movementStarted()
254 signal movementEnded()
255 signal contentFlickStarted()
256 signal contentEndReached()
257 signal previewShown()
258- signal lensLoaded(string lensId)
259+ signal scopeLoaded(string scopeId)
260 signal positionedAtBeginning()
261
262- // If we set the current lens index before the lenses have been added,
263- // then we need to wait until the loaded signals gets emitted from the lenses
264+ // If we set the current scope index before the scopes have been added,
265+ // then we need to wait until the loaded signals gets emitted from the scopes
266 property var set_current_index: undefined
267 Connections {
268- target: lenses
269+ target: scopes
270 onLoadedChanged: {
271- if (lenses.loaded && set_current_index != undefined) {
272- setCurrentLensAtIndex(set_current_index[0], set_current_index[1], set_current_index[2]);
273+ if (scopes.loaded && set_current_index != undefined) {
274+ setCurrentScopeAtIndex(set_current_index[0], set_current_index[1], set_current_index[2]);
275 set_current_index = undefined;
276 }
277 }
278 }
279
280- function setCurrentLensAtIndex(index, animate, reset) {
281+ function setCurrentScopeAtIndex(index, animate, reset) {
282 var storedMoveDuration = dashContentList.highlightMoveDuration
283 var storedMoveSpeed = dashContentList.highlightMoveVelocity
284 if (!animate) {
285@@ -59,8 +59,8 @@
286 dashContentList.highlightMoveDuration = 0
287 }
288
289- // if the lenses haven't loaded yet, then wait until they are.
290- if (!lenses.loaded) {
291+ // if the scopes haven't loaded yet, then wait until they are.
292+ if (!scopes.loaded) {
293 set_current_index = [ index, animate, reset ]
294 return;
295 }
296@@ -85,7 +85,7 @@
297 id: dashContentList
298 objectName: "dashContentList"
299
300- interactive: dashContent.lenses.loaded
301+ interactive: dashContent.scopes.loaded
302
303 anchors.fill: parent
304 model: dashContent.model
305@@ -97,7 +97,7 @@
306 highlightMoveDuration: 250
307 highlightRangeMode: ListView.StrictlyEnforceRange
308 /* FIXME: workaround rendering issue due to use of ShaderEffectSource in
309- UbuntuShape. While switching from the home lens to the People lens the
310+ UbuntuShape. While switching from the home scope to the People scope the
311 rendering would block midway.
312 */
313 cacheBuffer: 2147483647
314@@ -107,7 +107,7 @@
315 // If the number of items is less than the current index, then need to reset to another item.
316 onCountChanged: {
317 if (currentIndex >= count)
318- dashContent.setCurrentLensAtIndex(count-1, true, true)
319+ dashContent.setCurrentScopeAtIndex(count-1, true, true)
320 }
321
322 delegate:
323@@ -115,14 +115,15 @@
324 width: ListView.view.width
325 height: ListView.view.height
326 asynchronous: true
327- source: lensMapper.map(lens.id)
328+ source: scopeMapper.map(scope.id)
329+
330 onLoaded: {
331- item.lens = Qt.binding(function() { return lens })
332+ item.scope = Qt.binding(function() { return scope })
333 item.isCurrent = Qt.binding(function() { return ListView.isCurrentItem })
334 item.searchHistory = Qt.binding(function() { return shell.searchHistory })
335 dashContentList.movementStarted.connect(item.movementStarted)
336 dashContent.positionedAtBeginning.connect(item.positionedAtBeginning)
337- dashContent.lensLoaded(item.lens.id)
338+ dashContent.scopeLoaded(item.scope.id)
339 }
340 Connections {
341 target: item
342
343=== modified file 'Dash/DashHome.qml'
344--- Dash/DashHome.qml 2013-06-05 22:03:08 +0000
345+++ Dash/DashHome.qml 2013-06-19 20:05:35 +0000
346@@ -23,9 +23,8 @@
347 import "Apps"
348 import "Video"
349 import "Music"
350-import "People"
351
352-LensView {
353+ScopeView {
354 id: root
355
356 onMovementStarted: listView.showHeader()
357@@ -34,20 +33,12 @@
358 id: categoryListModel
359 // specifies page's content categories, type of delegate and model used in each category
360 ListElement { category: "Frequent Apps"; component: "AppsGrid"; modelName: "AppsModel" }
361- ListElement { category: "Favourite People"; component: "PeopleCarousel"; modelName: "FavouriteModel" }
362- ListElement { category: "People Recently in Touch"; component: "PeopleGrid"; modelName: "RecentModel" }
363 ListElement { category: "Recent Music"; component: "MusicGrid"; modelName: "MusicModel" }
364 ListElement { category: "Videos Popular Online"; component: "VideosGrid"; modelName: "VideosModel" }
365 function getCategory(category1) {
366 if (category1 === "Frequent Apps") {
367 return i18n.tr("Frequent Apps");
368 }
369- if (category1 === "Favourite People") {
370- return i18n.tr("Favourite People");
371- }
372- if (category1 === "People Recently in Touch") {
373- return i18n.tr("People Recently in Touch");
374- }
375 if (category1 === "Recent Music") {
376 return i18n.tr("Recent Music");
377 }
378@@ -90,33 +81,24 @@
379 }
380
381 Component.onCompleted: {
382- var lens = dashContent.lenses.get("people.lens")
383- if (lens) {
384- favouritesFilter.model = dashContent.lenses.get("people.lens").results
385- recentFilter.model = dashContent.lenses.get("people.lens").results
386- }
387- lens = dashContent.lenses.get("mockmusic.lens")
388- if (lens) {
389- musicFilter.model = dashContent.lenses.get("mockmusic.lens").results
390- }
391- lens = dashContent.lenses.get("mockvideos.lens")
392- if (lens) {
393- videosFilter.model = dashContent.lenses.get("mockvideos.lens").results
394+ var scope = dashContent.scopes.get("mockmusicmaster.scope")
395+ if (scope) {
396+ musicFilter.model = dashContent.scopes.get("mockmusicmaster.scope").results
397+ }
398+ scope = dashContent.scopes.get("mockvideosmaster.scope")
399+ if (scope) {
400+ videosFilter.model = dashContent.scopes.get("mockvideosmaster.scope").results
401 }
402 }
403
404 Connections {
405 target: dashContent
406- onLensLoaded: switch (lensId) {
407- case "people.lens":
408- favouritesFilter.model = dashContent.lenses.get("people.lens").results
409- recentFilter.model = dashContent.lenses.get("people.lens").results
410- break;
411- case "mockmusic.lens":
412- musicFilter.model = dashContent.lenses.get("mockmusic.lens").results
413- break;
414- case "mockvideos.lens":
415- videosFilter.model = dashContent.lenses.get("mockvideos.lens").results
416+ onScopeLoaded: switch (scopeId) {
417+ case "mockmusicmaster.scope":
418+ musicFilter.model = dashContent.scopes.get("mockmusicmaster.scope").results
419+ break;
420+ case "mockvideosmaster.scope":
421+ videosFilter.model = dashContent.scopes.get("mockvideosmaster.scope").results
422 break;
423 }
424 }
425@@ -140,14 +122,10 @@
426 }
427 }
428
429- Component { id: peopleCarousel; PeopleCarousel {} }
430- Component { id: peopleGrid; PeopleFilterGrid {} }
431 Component { id: musicGrid; MusicFilterGrid {} }
432 Component { id: videosGrid; VideosFilterGrid {} }
433 property var componentModels: {
434 "AppsGrid": applicationsFilterGrid,
435- "PeopleCarousel": peopleCarousel,
436- "PeopleGrid": peopleGrid,
437 "MusicGrid": musicGrid,
438 "VideosGrid": videosGrid,
439 }
440@@ -171,7 +149,7 @@
441 onLoaded: {
442 item.model = categoryModels[modelName]
443
444- //FIXME: workaround for lack of previews for videos in Home lens.
445+ //FIXME: workaround for lack of previews for videos in Home scope.
446 //Need to connect to the clicked() signal here and act upon it here instead.
447 if (component === "VideosGrid") {
448 function playVideo(index, data) {
449
450=== modified file 'Dash/DashMusic.qml'
451--- Dash/DashMusic.qml 2013-06-08 13:44:29 +0000
452+++ Dash/DashMusic.qml 2013-06-19 20:05:35 +0000
453@@ -20,8 +20,8 @@
454 import "../Components/ListItems" as ListItems
455 import "Music"
456
457-LensView {
458- id: lensView
459+ScopeView {
460+ id: scopeView
461
462 property var categoryNames: [
463 i18n.tr("Featured"),
464@@ -37,7 +37,7 @@
465 onMovementStarted: categoryView.showHeader()
466
467 Binding {
468- target: lensView.lens
469+ target: scopeView.scope
470 property: "searchQuery"
471 value: pageHeader.searchQuery
472 }
473@@ -59,7 +59,7 @@
474
475 function getRenderer(categoryId) {
476 switch (categoryId) {
477- case 0: return musicCarousel
478+ case 1: return musicCarousel
479 default: return musicFilterGrid
480 }
481 }
482@@ -67,7 +67,7 @@
483 ListViewWithPageHeader {
484 id: categoryView
485 anchors.fill: parent
486- model: lensView.categories
487+ model: scopeView.categories
488
489 onAtYEndChanged: if (atYEnd) endReached()
490 onMovingChanged: if (moving && atYEnd) endReached()
491@@ -80,7 +80,7 @@
492
493 Loader {
494 anchors { top: parent.top; left: parent.left; right: parent.right }
495- sourceComponent: lensView.getRenderer(base.categoryId)
496+ sourceComponent: scopeView.getRenderer(base.categoryId)
497 onLoaded: {
498 item.model = results
499 }
500@@ -98,7 +98,7 @@
501 width: categoryView.width
502 text: i18n.tr("Music")
503 searchEntryEnabled: true
504- searchHistory: lensView.searchHistory
505+ searchHistory: scopeView.searchHistory
506 }
507 }
508 }
509
510=== removed file 'Dash/DashPeople.qml'
511--- Dash/DashPeople.qml 2013-06-08 13:44:29 +0000
512+++ Dash/DashPeople.qml 1970-01-01 00:00:00 +0000
513@@ -1,235 +0,0 @@
514-/*
515- * Copyright (C) 2013 Canonical, Ltd.
516- *
517- * This program is free software; you can redistribute it and/or modify
518- * it under the terms of the GNU General Public License as published by
519- * the Free Software Foundation; version 3.
520- *
521- * This program is distributed in the hope that it will be useful,
522- * but WITHOUT ANY WARRANTY; without even the implied warranty of
523- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
524- * GNU General Public License for more details.
525- *
526- * You should have received a copy of the GNU General Public License
527- * along with this program. If not, see <http://www.gnu.org/licenses/>.
528- */
529-
530-import QtQuick 2.0
531-import Ubuntu.Components 0.1
532-import Dee 3.0
533-import Unity 0.1
534-import Utils 0.1
535-import "../Components"
536-import "../Components/ListItems" as ListItems
537-import "People"
538-
539-LensView {
540- id: lensView
541- property alias previewShown: previewLoader.onScreen
542-
543- property var categoryNames: [
544- i18n.tr("Favourites"),
545- i18n.tr("Recently in touch"),
546- i18n.tr("New Contacts"),
547- i18n.tr("A-Z")
548- ]
549-
550- onIsCurrentChanged: {
551- pageHeader.resetSearch();
552- }
553-
554- onMovementStarted: categoryView.showHeader()
555-
556- Binding {
557- target: lensView.lens
558- property: "searchQuery"
559- value: pageHeader.searchQuery
560- }
561-
562- Connections {
563- target: panel
564- onSearchClicked: if (isCurrent) {
565- pageHeader.triggerSearch()
566- categoryView.showHeader()
567- }
568- }
569-
570- OpenEffect {
571- id: effect
572- anchors {
573- fill: parent
574- bottomMargin: -bottomOverflow
575- }
576- sourceItem: categoryView
577-
578- enabled: gap > 0.0
579-
580- topGapPx: (1 - gap) * positionPx
581- topOpacity: (1 - gap * 1.2)
582- bottomGapPx: positionPx + gap * (targetBottomGapPx - positionPx)
583- bottomOverflow: units.gu(20)
584- bottomOpacity: 1 - (gap * 0.8)
585-
586- property int targetBottomGapPx: height - units.gu(8) - bottomOverflow
587- property real gap: previewLoader.open ? 1.0 : 0.0
588-
589- Behavior on gap {
590- NumberAnimation {
591- duration: 200
592- easing.type: Easing.InOutQuad
593- onRunningChanged: {
594- if (!previewLoader.open && !running) {
595- previewLoader.onScreen = false;
596- }
597- }
598- }
599- }
600- }
601-
602- ListViewWithPageHeader {
603- id: categoryView
604- anchors.fill: parent
605- model: lensView.categories
606- onAtYEndChanged: if (atYEnd) endReached()
607- onMovingChanged: if (moving && atYEnd) endReached()
608- clipListView: !previewLoader.onScreen
609-
610- delegate: ListItems.Base {
611- id: base
612- property int categoryIndex: index
613- property int categoryId: id
614- highlightWhenPressed: false
615-
616- Loader {
617- width: categoryView.width
618- sourceComponent: base.categoryId == 0 ? peopleCarouselComponent : peopleGridComponent
619-
620- onLoaded: {
621- item.categoryId = Qt.binding(function() { return base.categoryId; })
622- item.categoryIndex = Qt.binding(function() { return base.categoryIndex; })
623- item.model = results;
624- }
625- }
626- }
627-
628- sectionProperty: "name"
629- sectionDelegate: ListItems.Header {
630- width: categoryView.width
631- text: i18n.tr(section)
632- }
633- pageHeader: PageHeader {
634- id: pageHeader
635- width: categoryView.width
636- text: i18n.tr("People")
637- searchEntryEnabled: true
638- searchHistory: lensView.searchHistory
639- }
640- }
641-
642- Component {
643- id: peopleCarouselComponent
644- PeopleCarousel {
645- id: peopleCarousel
646-
647- property int categoryId
648- property int categoryIndex
649-
650- onClicked: {
651- effect.positionPx = mapToItem(categoryView, 0, itemY).y;
652- previewData.model = delegateItem.dataModel;
653- previewData.uri = delegateItem.dataModel.uri;
654- previewLoader.open = true;
655- }
656- }
657- }
658-
659- Component {
660- id: peopleGridComponent
661- PeopleFilterGrid {
662- id: peopleGrid
663-
664- property int categoryIndex
665-
666- onClicked: {
667- if (peopleGrid.columnCount == 1) {
668- if (categoryIndex >= categoryView.model.count -1 && index >= peopleGrid.model.count - 1) {
669- effect.positionPx = mapToItem(categoryView, 0, itemY).y;
670- } else {
671- effect.positionPx = mapToItem(categoryView, 0, itemY + peopleGrid.cellHeight).y
672- }
673- } else {
674- effect.positionPx = mapToItem(categoryView, 0, itemY).y
675- }
676- previewData.model = data;
677- previewData.uri = data.uri
678- previewLoader.open = true;
679- }
680- }
681- }
682-
683- Loader {
684- id: previewLoader
685- height: effect.bottomGapPx - effect.topGapPx
686- anchors {
687- top: parent.top
688- topMargin: effect.topGapPx
689- left: parent.left
690- right: parent.right
691- }
692- sourceComponent: onScreen ? previewComponent : undefined
693-
694- property bool open: false
695- property bool onScreen: false
696- property QtObject videoItem
697-
698- onOpenChanged: {
699- if (open) {
700- onScreen = true
701- }
702- }
703-
704- onLoaded: {
705- if (previewData.ready) {
706- item.model = previewData;
707- }
708- }
709- }
710-
711- Component {
712- id: previewComponent
713-
714- PeoplePreview {
715- id: preview
716- anchors.fill: parent
717- forceSquare: true
718- onClose: {
719- open = false;
720- }
721- }
722- }
723-
724- PeoplePreviewData {
725- id: previewData
726- lens: lensView.lens
727- property Data model
728-
729- onError: previewLoader.open = false
730- onReadyChanged: {
731- if (previewLoader.item) {
732- previewLoader.item.model = ready ? previewData : undefined
733- }
734- }
735- }
736-
737- // TODO: Move as InverseMouseArea to DashPreview
738- MouseArea {
739- enabled: previewLoader.onScreen
740- anchors {
741- fill: parent
742- topMargin: effect.bottomGapPx
743- }
744- onClicked: {
745- previewLoader.open = false;
746- }
747- }
748-}
749
750=== modified file 'Dash/DashVideos.qml'
751--- Dash/DashVideos.qml 2013-06-08 13:44:29 +0000
752+++ Dash/DashVideos.qml 2013-06-19 20:05:35 +0000
753@@ -20,8 +20,8 @@
754 import "../Components/ListItems" as ListItems
755 import "Video"
756
757-LensView {
758- id: lensView
759+ScopeView {
760+ id: scopeView
761 property alias previewShown: previewLoader.onScreen
762
763 property var categoryNames: [
764@@ -38,7 +38,7 @@
765 onMovementStarted: categoryView.showHeader()
766
767 Binding {
768- target: lensView.lens
769+ target: scopeView.scope
770 property: "searchQuery"
771 value: pageHeader.searchQuery
772 }
773@@ -60,7 +60,7 @@
774
775 function getRenderer(categoryId) {
776 switch (categoryId) {
777- case 0: return videosCarousel
778+ case 1: return videosCarousel
779 default: return videosFilterGrid
780 }
781 }
782@@ -100,7 +100,7 @@
783 ListViewWithPageHeader {
784 id: categoryView
785 anchors.fill: parent
786- model: lensView.categories
787+ model: scopeView.categories
788 clipListView: !previewLoader.onScreen
789
790 onAtYEndChanged: if (atYEnd) endReached()
791@@ -115,7 +115,7 @@
792 Loader {
793 id: loader
794 anchors { top: parent.top; left: parent.left; right: parent.right }
795- sourceComponent: lensView.getRenderer(base.categoryId)
796+ sourceComponent: scopeView.getRenderer(base.categoryId)
797 onLoaded: {
798 item.model = results
799 }
800@@ -127,9 +127,9 @@
801 var dataItem;
802 // VideosCarousel and VideosFilterGrid have different
803 // clicked signals, accomodate for that
804- if (categoryId == 0) {
805+ if (categoryId == 1) {
806 var fileUri = delegateItem.model.column_0.replace(/^[^:]+:/, "")
807- dataItem = {fileUri: fileUri, nfoUri: delegateItem.model.column_5}
808+ dataItem = {fileUri: fileUri, nfoUri: delegateItem.model.column_6}
809 } else {
810 dataItem = data;
811 }
812@@ -154,7 +154,7 @@
813 width: categoryView.width
814 text: i18n.tr("Videos")
815 searchEntryEnabled: true
816- searchHistory: lensView.searchHistory
817+ searchHistory: scopeView.searchHistory
818 }
819 }
820
821
822=== renamed file 'Dash/GenericLensView.qml' => 'Dash/GenericScopeView.qml'
823--- Dash/GenericLensView.qml 2013-06-05 22:03:08 +0000
824+++ Dash/GenericScopeView.qml 2013-06-19 20:05:35 +0000
825@@ -18,9 +18,10 @@
826 import Ubuntu.Components 0.1
827 import "../Components"
828 import "../Components/ListItems" as ListItems
829+import "../Components/IconUtil.js" as IconUtil
830
831-LensView {
832- id: lensView
833+ScopeView {
834+ id: scopeView
835
836 onIsCurrentChanged: {
837 pageHeader.resetSearch();
838@@ -29,7 +30,7 @@
839 onMovementStarted: categoryView.showHeader()
840
841 Binding {
842- target: lensView.lens
843+ target: scopeView.scope
844 property: "searchQuery"
845 value: pageHeader.searchQuery
846 }
847@@ -45,7 +46,7 @@
848 ListViewWithPageHeader {
849 id: categoryView
850 anchors.fill: parent
851- model: lensView.categories
852+ model: scopeView.categories
853 onAtYEndChanged: if (atYEnd) endReached()
854 onMovingChanged: if (moving && atYEnd) endReached()
855
856@@ -71,10 +72,10 @@
857 delegate: Tile {
858 width: filtergrid.cellWidth
859 height: filtergrid.cellHeight
860- text: column_4 ? column_4 : "" // FIXME: this shouldn't be necessary
861+ text: column_5 ? column_5 : "" // FIXME: this shouldn't be necessary
862 imageWidth: units.gu(11)
863 imageHeight: units.gu(16)
864- source: column_1 ? column_1 : "" // FIXME: ditto
865+ source: column_1 ? IconUtil.from_gicon(column_1) : "" // FIXME: ditto
866 }
867 }
868 }
869@@ -88,7 +89,7 @@
870 id: pageHeader
871 objectName: "pageHeader"
872 width: categoryView.width
873- text: lensView.lens.name
874+ text: scopeView.scope.name
875 searchEntryEnabled: true
876 }
877 }
878
879=== modified file 'Dash/Music/MusicFilterGrid.qml'
880--- Dash/Music/MusicFilterGrid.qml 2013-06-05 22:03:08 +0000
881+++ Dash/Music/MusicFilterGrid.qml 2013-06-19 20:05:35 +0000
882@@ -38,8 +38,8 @@
883 height: filterGrid.cellHeight
884 iconWidth: filterGrid.iconWidth
885 iconHeight: filterGrid.iconHeight
886- artist: model.column_4
887- album: model.column_5
888+ artist: model.column_5
889+ album: model.column_6
890 source: model.column_1
891 onClicked: {
892 filterGrid.clicked(index);
893
894=== removed directory 'Dash/People'
895=== removed file 'Dash/People/CarouselDelegatePeople.qml'
896--- Dash/People/CarouselDelegatePeople.qml 2013-06-05 22:03:08 +0000
897+++ Dash/People/CarouselDelegatePeople.qml 1970-01-01 00:00:00 +0000
898@@ -1,166 +0,0 @@
899-/*
900- * Copyright (C) 2013 Canonical, Ltd.
901- *
902- * This program is free software; you can redistribute it and/or modify
903- * it under the terms of the GNU General Public License as published by
904- * the Free Software Foundation; version 3.
905- *
906- * This program is distributed in the hope that it will be useful,
907- * but WITHOUT ANY WARRANTY; without even the implied warranty of
908- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
909- * GNU General Public License for more details.
910- *
911- * You should have received a copy of the GNU General Public License
912- * along with this program. If not, see <http://www.gnu.org/licenses/>.
913- */
914-
915-import QtQuick 2.0
916-import Ubuntu.Components 0.1
917-import "../../Components"
918-
919-BaseCarouselDelegate {
920- id: item
921-
922- property var dataModel
923- readonly property real frameHeight: Math.max(height / 3.6, units.gu(5.5))
924-
925- UbuntuShape {
926- anchors.fill: parent
927- radius: "medium"
928- borderSource: ""
929- image: Image {
930- asynchronous: true
931- sourceSize { width: item.width; height: item.height }
932- source: dataModel.avatar ? dataModel.avatar : ""
933- fillMode: Image.PreserveAspectCrop
934- }
935- }
936-
937- Component {
938- id: component_frame
939- Item {
940- id: frame
941-
942- BorderImage {
943- // TODO This will go away once we have 'clip: true' in UbuntuShape
944- anchors.centerIn: parent
945- width: parent.width + units.gu(1.5)
946- height: parent.height + units.gu(1.5)
947- visible: labelRemotePost.visible
948- opacity: 0.9
949- source: "graphics/bottomshape.sci"
950- }
951-
952- property bool showRemoteDetails: true
953- // To decide if the remote icon and time should be shown, its once layed out to do so.
954- // Then it's checked if everything fits in the frame size. If not, showRemoteDetails is set false
955- // Using bindings to do so cause a binding loop
956- function checkSizeForRemoteDetails() {
957- showRemoteDetails = true
958- showRemoteDetails = (frame.height - column.minimumHeight) >= labelRemotePostTime.height
959- }
960-
961- Item {
962- id: remoteSourceIconContainer
963-
964- // TODO use proper asset and get rid of these dimensions
965- width: units.gu(3)
966- height: units.gu(4)
967- visible: showRemoteDetails
968-
969- Image {
970- anchors.centerIn: parent
971- anchors.horizontalCenterOffset: units.gu(1)
972- source: dataModel.remoteSourceIcon ? dataModel.remoteSourceIcon : ""
973- fillMode: Image.PreserveAspectFit
974- }
975- }
976-
977- Column {
978- id: column
979-
980- property real minimumHeight: labelName.height + labelRemotePost.height + anchors.topMargin + anchors.bottomMargin
981-
982- anchors {
983- left: remoteSourceIconContainer.visible ? remoteSourceIconContainer.right : parent.left
984- right: parent.right
985- top: remoteSourceIconContainer.visible ? parent.top : undefined
986- verticalCenter: remoteSourceIconContainer.visible ? undefined : parent.verticalCenter
987- margins: units.gu(1)
988- }
989-
990- Label {
991- id: labelName
992-
993- width: parent.width
994- text: dataModel.name ? dataModel.name : ""
995- color: "white"
996- fontSize: "x-small"
997- elide: Text.ElideRight
998- font.weight: Font.Bold
999- onTextChanged: checkSizeForRemoteDetails()
1000- }
1001-
1002- Label {
1003- id: labelRemotePost
1004-
1005- width: parent.width
1006- text: dataModel.remotePost ? dataModel.remotePost : ""
1007- color: "white"
1008- opacity: 0.8
1009- fontSize: "xx-small"
1010- elide: Text.ElideRight
1011- maximumLineCount: 2
1012- wrapMode: Text.WordWrap
1013- onTextChanged: checkSizeForRemoteDetails()
1014- }
1015-
1016- Label {
1017- id: labelRemotePostTime
1018-
1019- width: parent.width
1020- text: model.remotePostTime ? model.remotePostTime : ""
1021- color: "white"
1022- opacity: 0.5
1023- fontSize: "xx-small"
1024- elide: Text.ElideRight
1025- visible: showRemoteDetails
1026- onTextChanged: checkSizeForRemoteDetails()
1027- }
1028- }
1029-
1030- onHeightChanged: checkSizeForRemoteDetails()
1031- onWidthChanged: checkSizeForRemoteDetails()
1032- Component.onCompleted: checkSizeForRemoteDetails()
1033- }
1034- }
1035-
1036- Loader {
1037- id: loader_frame
1038-
1039- anchors {
1040- left: parent.left
1041- right: parent.right
1042- bottom: parent.bottom
1043- }
1044- height: item.frameHeight
1045- opacity: item.explicitlyScaled ? 1.0 : 0
1046-
1047- Behavior on opacity {
1048- NumberAnimation {
1049- duration: 250
1050- easing.type: Easing.InOutQuad
1051- }
1052- }
1053-
1054- sourceComponent: opacity > 0 ? component_frame : undefined
1055- }
1056-
1057- BorderImage {
1058- anchors.centerIn: parent
1059- opacity: 0.6
1060- source: "../../Components/graphics/non-selected.sci"
1061- width: parent.width + units.gu(1.5)
1062- height: parent.height + units.gu(1.5)
1063- }
1064-}
1065
1066=== removed file 'Dash/People/Data.qml'
1067--- Dash/People/Data.qml 2013-06-05 22:03:08 +0000
1068+++ Dash/People/Data.qml 1970-01-01 00:00:00 +0000
1069@@ -1,71 +0,0 @@
1070-/*
1071- * Copyright (C) 2013 Canonical, Ltd.
1072- *
1073- * This program is free software; you can redistribute it and/or modify
1074- * it under the terms of the GNU General Public License as published by
1075- * the Free Software Foundation; version 3.
1076- *
1077- * This program is distributed in the hope that it will be useful,
1078- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1079- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1080- * GNU General Public License for more details.
1081- *
1082- * You should have received a copy of the GNU General Public License
1083- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1084- */
1085-
1086-import QtQuick 2.0
1087-import Dee 3.0
1088-
1089-DeeVariantText {
1090- property string uri
1091- property string name
1092- property url avatar
1093- property var emails: ListModel {}
1094- property var phones: ListModel {}
1095- property string presenceStatus
1096- property string presenceMessage
1097- property url remoteSourceIcon
1098- property string remotePost
1099- property bool favorite
1100- property bool recent
1101- property url statusIcon
1102- property string status: remotePost ? remotePost : presenceMessage
1103- property url recentIcon
1104- property string recentTime
1105-
1106- statusIcon: switch(presenceStatus) {
1107- case "offline": "graphics/icon_offline.png"; break
1108- // FIXME random for now, as we don't get actual presence data on the phone
1109- case "":
1110- var r = Math.random();
1111- if (r >= 0.7) "graphics/icon_online.png"
1112- else if (r >= 0.4) "graphics/icon_offline.png"
1113- else "graphics/icon_unknown.png"
1114- break;
1115- default: "graphics/icon_online.png"
1116- }
1117-
1118- onValueChanged: {
1119- for (var i in value) switch (value[i][0]) {
1120- case "presence-message": presenceMessage = value[i][1]; break
1121- case "presence-status": presenceStatus = value[i][1]; break
1122- case "remote-source-icon": remoteSourceIcon = value[i][1]; break
1123- case "remote-post": remotePost = value[i][1]; break
1124- case "recent-icon": recentIcon = value[i][1]; break
1125- case "recent-time": recentTime = value[i][1]; break
1126- case "phone": phones.append({"type": generateType(), "number": value[i][1]}); break
1127- case "email": emails.append({"type": generateType(), "address": value[i][1]}); break
1128- }
1129- }
1130-
1131- // FIXME: random for now, as we don't have multiple phone numbers in the backend yet
1132- function generateType() {
1133- var phoneType = "";
1134- var r = Math.random();
1135- if (r >= 0.7) phoneType = "Private";
1136- else if (r >= 0.4) phoneType = "Mobile";
1137- else phoneType = "Work";
1138- return phoneType;
1139- }
1140-}
1141
1142=== removed file 'Dash/People/Delegate.qml'
1143--- Dash/People/Delegate.qml 2013-06-05 22:03:08 +0000
1144+++ Dash/People/Delegate.qml 1970-01-01 00:00:00 +0000
1145@@ -1,167 +0,0 @@
1146-/*
1147- * Copyright (C) 2013 Canonical, Ltd.
1148- *
1149- * This program is free software; you can redistribute it and/or modify
1150- * it under the terms of the GNU General Public License as published by
1151- * the Free Software Foundation; version 3.
1152- *
1153- * This program is distributed in the hope that it will be useful,
1154- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1155- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1156- * GNU General Public License for more details.
1157- *
1158- * You should have received a copy of the GNU General Public License
1159- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1160- */
1161-
1162-import QtQuick 2.0
1163-import Ubuntu.Components 0.1
1164-import "../../Components"
1165-import "../../Components/Time.js" as Time
1166-
1167-Item {
1168- id: peopleView
1169-
1170- property var dataModel
1171-
1172- property int __spacing: units.gu(1)
1173-
1174- /* Select what is shown in the subtitle
1175- data: phone number or email address
1176- status: social media presence status
1177- */
1178- property string subtitleType: "data"
1179- height: subtitleType == "data" && detailsLabel.lineCount < 2 ? units.gu(10) : units.gu(11.5)
1180-
1181- Row {
1182- id: row
1183- anchors {
1184- left: parent.left
1185- right: parent.right
1186- leftMargin: units.gu(2)
1187- rightMargin: units.gu(4)
1188- top: parent.top
1189- topMargin: units.gu(2)
1190- }
1191- spacing: __spacing
1192-
1193- UbuntuShape {
1194- id: avatar
1195- anchors { top: parent.top }
1196- width: units.gu(6)
1197- height: units.gu(6)
1198- image: Image {
1199- width: units.gu(6)
1200- source: peopleView.dataModel.avatar
1201- sourceSize { width: avatar.width; height: avatar.height }
1202- fillMode: Image.PreserveAspectCrop
1203- smooth: true
1204- asynchronous: true
1205- cache: false
1206- }
1207- }
1208-
1209- Grid {
1210- spacing: units.gu(0.5)
1211- width: parent.width - x
1212- columns: 2
1213-
1214- Item {
1215- height: units.gu(2)
1216- width: units.gu(2)
1217-
1218- Image {
1219- id: statusImage
1220- source: peopleView.dataModel.statusIcon
1221- width: units.gu(1.5)
1222- height: units.gu(1.5)
1223- fillMode: Image.PreserveAspectFit
1224- smooth: true
1225- anchors.verticalCenter: parent.verticalCenter
1226- }
1227- }
1228-
1229- Label {
1230- id: nameLabel
1231- elide: Text.ElideRight
1232- text: peopleView.dataModel.name
1233- color: "#f3f3e7"
1234- style: Text.Raised
1235- styleColor: "black"
1236- font.weight: Font.DemiBold;
1237- opacity: 0.9;
1238- }
1239-
1240- Image {
1241- source: switch(peopleView.subtitleType) {
1242- case "data":
1243- return peopleView.dataModel.remoteSourceIcon;
1244- case "status":
1245- return peopleView.dataModel.recent ? peopleView.dataModel.recentIcon : "";
1246- }
1247-
1248- width: units.gu(1.5)
1249- height: units.gu(1.5)
1250- fillMode: Image.PreserveAspectFit
1251- smooth: true
1252- }
1253-
1254- Label {
1255- id: detailsLabel
1256- width: parent.width - x
1257- elide: Text.ElideRight
1258- text: switch (peopleView.subtitleType) {
1259- case "data":
1260- if (peopleView.dataModel.phones && peopleView.dataModel.phones.count > 0) {
1261- return peopleView.dataModel.phones.get(0).number;
1262- } else if (peopleView.dataModel.emails && peopleView.dataModel.emails.count > 0) {
1263- return peopleView.dataModel.emails.get(0).address;
1264- }
1265- return "";
1266- case "status":
1267- return peopleView.dataModel.status;
1268- }
1269- color: "#f3f3e7"
1270- style: Text.Raised
1271- styleColor: "black"
1272- opacity: 0.7;
1273- fontSize: "small";
1274- wrapMode: Text.WordWrap;
1275- maximumLineCount: 2;
1276- }
1277-
1278- Item {
1279- height: units.gu(2)
1280- width: units.gu(1.5)
1281-
1282- // Placeholder
1283- }
1284-
1285- Label {
1286- width: parent.width - x
1287- elide: Text.ElideRight
1288- text: switch (peopleView.subtitleType) {
1289- case "data":
1290- if (peopleView.dataModel.phones && peopleView.dataModel.phones.count > 0) {
1291- return peopleView.dataModel.phones.get(0).type;
1292- } else if (peopleView.dataModel.emails && peopleView.dataModel.emails.count > 0) {
1293- return peopleView.dataModel.emails.get(0).type;
1294- }
1295- return "";
1296- case "status":
1297- if (peopleView.dataModel.recent) {
1298- var time = Time.readableFromNow(peopleView.dataModel.recentTime);
1299- return time ? time : peopleView.dataModel.recentTime;
1300- } else {
1301- return peopleView.dataModel.status
1302- }
1303- }
1304- color: "#8f8f88"
1305- style: Text.Raised
1306- styleColor: "black"
1307- opacity: 0.7;
1308- fontSize: "x-small";
1309- }
1310- }
1311- }
1312-}
1313
1314=== removed file 'Dash/People/PeopleCarousel.qml'
1315--- Dash/People/PeopleCarousel.qml 2013-06-05 22:03:08 +0000
1316+++ Dash/People/PeopleCarousel.qml 1970-01-01 00:00:00 +0000
1317@@ -1,43 +0,0 @@
1318-/*
1319- * Copyright (C) 2013 Canonical, Ltd.
1320- *
1321- * This program is free software; you can redistribute it and/or modify
1322- * it under the terms of the GNU General Public License as published by
1323- * the Free Software Foundation; version 3.
1324- *
1325- * This program is distributed in the hope that it will be useful,
1326- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1327- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1328- * GNU General Public License for more details.
1329- *
1330- * You should have received a copy of the GNU General Public License
1331- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1332- */
1333-
1334-import QtQuick 2.0
1335-import "../../Components"
1336-
1337-Carousel {
1338- id: peopleCarousel
1339- tileAspectRatio: 1
1340- minimumTileWidth: units.gu(13)
1341- itemComponent: carouselDelegatePeople
1342- selectedItemScaleFactor: 1.2
1343- cacheBuffer: 1404 // 18px * 13gu * 6
1344- height: implicitHeight + units.gu(6)
1345-
1346- Component {
1347- id: carouselDelegatePeople
1348- CarouselDelegatePeople {
1349- dataModel: data
1350-
1351- Data {
1352- id: data
1353- uri: model.column_0
1354- text: model.column_5
1355- name: model.column_4
1356- avatar: model.column_1
1357- }
1358- }
1359- }
1360-}
1361
1362=== removed file 'Dash/People/PeopleFilterGrid.qml'
1363--- Dash/People/PeopleFilterGrid.qml 2013-06-05 22:03:08 +0000
1364+++ Dash/People/PeopleFilterGrid.qml 1970-01-01 00:00:00 +0000
1365@@ -1,74 +0,0 @@
1366-/*
1367- * Copyright (C) 2013 Canonical, Ltd.
1368- *
1369- * This program is free software; you can redistribute it and/or modify
1370- * it under the terms of the GNU General Public License as published by
1371- * the Free Software Foundation; version 3.
1372- *
1373- * This program is distributed in the hope that it will be useful,
1374- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1375- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1376- * GNU General Public License for more details.
1377- *
1378- * You should have received a copy of the GNU General Public License
1379- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1380- */
1381-
1382-import QtQuick 2.0
1383-import "../../Components"
1384-import "../../Components/ListItems" as ListItems
1385-
1386-FilterGrid {
1387- id: filterGrid
1388-
1389- filter: true
1390- minimumHorizontalSpacing: 0
1391- delegateWidth: units.gu(40)
1392- delegateHeight: showStatusMessage ? units.gu(11.5) : units.gu(10)
1393- verticalSpacing: 0
1394- collapsedRowCount: 50 / columns
1395- expandable: false
1396-
1397- property int categoryId
1398- property bool showStatusMessage: categoryId == 1 || categoryId == 2
1399-
1400- readonly property int columnCount: width / cellWidth
1401-
1402- signal clicked(int index, variant data, real itemY)
1403-
1404- delegate: ListItems.Base {
1405- id: tile
1406- objectName: "delegate" + index
1407- width: filterGrid.cellWidth
1408- showDivider: index < Math.floor((filterGrid.model.count-1) / filterGrid.columnCount) * filterGrid.columnCount
1409-
1410- onClicked: {
1411- filterGrid.clicked(index, data, tile.y);
1412- }
1413-
1414- Delegate {
1415- width: filterGrid.cellWidth
1416- height: filterGrid.cellHeight
1417- // This caches the Delegate into FBO because:
1418- // - People data Delegates are slow because of their item count
1419- // - FilterGrid is "height: childrenRect.height" so all delegates are always loaded
1420- // TODO: Optimize this by:
1421- // - not loading all delegates all the time and remove layer.enabled and/or
1422- // - destroy whole lens when not visible/needed to free the GPU memory
1423- layer.enabled: true
1424-
1425- dataModel: data
1426- subtitleType: filterGrid.showStatusMessage ? "status" : "data"
1427-
1428- Data {
1429- id: data
1430- uri: column_0
1431- text: column_5
1432- name: column_4
1433- avatar: column_1
1434- favorite: filterGrid.categoryId == 0
1435- recent: filterGrid.showStatusMessage
1436- }
1437- }
1438- }
1439-}
1440
1441=== removed file 'Dash/People/PeoplePreview.qml'
1442--- Dash/People/PeoplePreview.qml 2013-06-05 22:03:08 +0000
1443+++ Dash/People/PeoplePreview.qml 1970-01-01 00:00:00 +0000
1444@@ -1,124 +0,0 @@
1445-/*
1446- * Copyright (C) 2013 Canonical, Ltd.
1447- *
1448- * This program is free software; you can redistribute it and/or modify
1449- * it under the terms of the GNU General Public License as published by
1450- * the Free Software Foundation; version 3.
1451- *
1452- * This program is distributed in the hope that it will be useful,
1453- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1454- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1455- * GNU General Public License for more details.
1456- *
1457- * You should have received a copy of the GNU General Public License
1458- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1459- */
1460-
1461-import QtQuick 2.0
1462-import Ubuntu.Components 0.1
1463-import "../../Components"
1464-import "../../Components/ListItems" as ListItems
1465-import ".."
1466-import "Preview"
1467-
1468-DashPreview {
1469- id: preview
1470-
1471- property var model: undefined
1472-
1473- title: (model && model.displayName) ? model.displayName : ""
1474- url: (model && model.avatar) ? model.avatar : ""
1475- previewWidthRatio: 0.34
1476-
1477-
1478- description: Grid {
1479- spacing: columns > 1 ? units.gu(2) : 0
1480- columns: preview.narrowMode || width < units.gu(60) ? 1 : 2
1481- property int columnWidth: columns > 1 ? (width - spacing * (columns - 1)) / columns : width
1482- anchors {
1483- left: parent.left
1484- right: parent.right
1485- }
1486-
1487- Status {
1488- id: status
1489- objectName: "statusField"
1490- width: parent.columnWidth
1491- visible: preview.model != undefined && preview.model.status != undefined
1492- model: preview.model
1493- property int index: 1
1494- // FIXME that should trigger the action on the lens/scope, when there's support
1495- onClicked: shell.activateApplication("/usr/share/applications/%1-webapp.desktop".arg(model.statusService), "--homepage=%1".arg(model.statusPostUri))
1496- }
1497-
1498-
1499- Column {
1500- id: descriptionColumn
1501- width: parent.columnWidth
1502-
1503-
1504- Column {
1505- anchors {
1506- left: parent.left
1507- right: parent.right
1508- }
1509-
1510- Repeater {
1511- model: preview.model ? preview.model.phoneNumbers : undefined
1512-
1513- delegate: Phone {
1514- objectName: "phoneField" + index
1515- model: preview.model
1516- // FIXME these should trigger actions on the lens/scope, when there's support
1517- onPhoneClicked: shell.activateApplication("/usr/share/applications/phone-app.desktop", "call://%1".arg(number.replace(/[^\d\+]/g, "")))
1518- onTextClicked: shell.activateApplication("/usr/share/applications/phone-app.desktop", "message://%1".arg(number.replace(/[^\d\+]/g, "")))
1519- }
1520- }
1521- }
1522-
1523- Column {
1524- anchors {
1525- left: parent.left
1526- right: parent.right
1527- }
1528-
1529- Repeater {
1530- model: preview.model ? preview.model.emailAddresses : undefined
1531- delegate: Generic {
1532- objectName: "emailField" + index
1533- type: "email"
1534- }
1535- }
1536- }
1537-
1538- Column {
1539- anchors {
1540- left: parent.left
1541- right: parent.right
1542- }
1543-
1544- Repeater {
1545- model: preview.model ? preview.model.imAccounts : undefined
1546- delegate: Generic {
1547- objectName: "imField" + index
1548- type: "imAccount"
1549- }
1550- }
1551- }
1552-
1553- Column {
1554- anchors {
1555- left: parent.left
1556- right: parent.right
1557- }
1558-
1559- Repeater {
1560- model: preview.model ? preview.model.addresses : undefined
1561- delegate: Address {
1562- objectName: "addressField" + index
1563- }
1564- }
1565- }
1566- }
1567- }
1568-}
1569
1570=== removed directory 'Dash/People/Preview'
1571=== removed file 'Dash/People/Preview/Address.qml'
1572--- Dash/People/Preview/Address.qml 2013-06-05 22:03:08 +0000
1573+++ Dash/People/Preview/Address.qml 1970-01-01 00:00:00 +0000
1574@@ -1,74 +0,0 @@
1575-/*
1576- * Copyright (C) 2013 Canonical, Ltd.
1577- *
1578- * This program is free software; you can redistribute it and/or modify
1579- * it under the terms of the GNU General Public License as published by
1580- * the Free Software Foundation; version 3.
1581- *
1582- * This program is distributed in the hope that it will be useful,
1583- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1584- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1585- * GNU General Public License for more details.
1586- *
1587- * You should have received a copy of the GNU General Public License
1588- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1589- */
1590-
1591-import QtQuick 2.0
1592-import Ubuntu.Components 0.1
1593-
1594-Base {
1595- id: root
1596-
1597- Item {
1598- anchors {
1599- left: parent.left
1600- right: parent.right
1601- leftMargin: units.gu(2)
1602- rightMargin: units.gu(4)
1603- }
1604- height: childrenRect.height + units.gu(2.5)
1605-
1606- Label {
1607- id: typeLabel
1608- anchors {
1609- top: parent.top
1610- topMargin: units.gu(1)
1611- }
1612- text: type
1613- elide: Text.ElideRight
1614- color: "#f3f3e7"
1615- style: Text.Raised
1616- styleColor: "black"
1617- font.capitalization: Font.Capitalize
1618- opacity: 0.7;
1619- fontSize: "small"
1620- }
1621-
1622- Label {
1623- id: contentLabel
1624- anchors {
1625- left: parent.left
1626- right: parent.right
1627- top: typeLabel.bottom
1628- topMargin: units.gu(0.5)
1629- }
1630- text: {
1631- var fields = [street, poBox, extension, locality, region, postalCode, country, addressFormat]
1632- var parts = []
1633- for (var k in fields) {
1634- if (fields[k]) parts.push(fields[k])
1635- }
1636- return parts.join("\n")
1637- }
1638- elide: Text.ElideRight
1639- color: "#f3f3e7"
1640- style: Text.Raised
1641- styleColor: "black"
1642- opacity: 0.9;
1643- fontSize: "large"
1644- wrapMode: Text.WordWrap
1645- font.weight: Font.Light
1646- }
1647- }
1648-}
1649
1650=== removed file 'Dash/People/Preview/Base.qml'
1651--- Dash/People/Preview/Base.qml 2013-06-05 22:03:08 +0000
1652+++ Dash/People/Preview/Base.qml 1970-01-01 00:00:00 +0000
1653@@ -1,22 +0,0 @@
1654-/*
1655- * Copyright (C) 2013 Canonical, Ltd.
1656- *
1657- * This program is free software; you can redistribute it and/or modify
1658- * it under the terms of the GNU General Public License as published by
1659- * the Free Software Foundation; version 3.
1660- *
1661- * This program is distributed in the hope that it will be useful,
1662- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1663- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1664- * GNU General Public License for more details.
1665- *
1666- * You should have received a copy of the GNU General Public License
1667- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1668- */
1669-
1670-import QtQuick 2.0
1671-import "../../../Components/ListItems"
1672-
1673-Base {
1674- property var model
1675-}
1676
1677=== removed file 'Dash/People/Preview/Generic.qml'
1678--- Dash/People/Preview/Generic.qml 2013-06-05 22:03:08 +0000
1679+++ Dash/People/Preview/Generic.qml 1970-01-01 00:00:00 +0000
1680@@ -1,80 +0,0 @@
1681-/*
1682- * Copyright (C) 2013 Canonical, Ltd.
1683- *
1684- * This program is free software; you can redistribute it and/or modify
1685- * it under the terms of the GNU General Public License as published by
1686- * the Free Software Foundation; version 3.
1687- *
1688- * This program is distributed in the hope that it will be useful,
1689- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1690- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1691- * GNU General Public License for more details.
1692- *
1693- * You should have received a copy of the GNU General Public License
1694- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1695- */
1696-
1697-import QtQuick 2.0
1698-import Ubuntu.Components 0.1
1699-
1700-Base {
1701- id: root
1702-
1703- property string type
1704-
1705- Item {
1706- anchors {
1707- left: parent.left
1708- right: parent.right
1709- leftMargin: units.gu(2)
1710- rightMargin: units.gu(4)
1711- }
1712- height: childrenRect.height + units.gu(2.5)
1713-
1714- Label {
1715- id: typeLabel
1716- anchors {
1717- top: parent.top
1718- topMargin: units.gu(1)
1719- }
1720- text: switch (root.type) {
1721- case "email":
1722- case "address": type; break
1723- case "imAccount": protocol; break
1724- default: type
1725- }
1726- elide: Text.ElideRight
1727- color: "#f3f3e7"
1728- style: Text.Raised
1729- styleColor: "black"
1730- font.capitalization: Font.Capitalize
1731- opacity: 0.7;
1732- fontSize: "small"
1733- }
1734-
1735- Label {
1736- id: contentLabel
1737- anchors {
1738- left: parent.left
1739- right: parent.right
1740- top: typeLabel.bottom
1741- topMargin: units.gu(0.5)
1742- }
1743- text: switch (root.type) {
1744- case "email":
1745- case "address":
1746- case "imAccount": address; break
1747- default: text
1748- }
1749- elide: Text.ElideRight
1750- color: "#f3f3e7"
1751- style: Text.Raised
1752- styleColor: "black"
1753- opacity: 0.9;
1754- fontSize: "large"
1755- wrapMode: Text.WordWrap
1756- maximumLineCount: 2
1757- font.weight: Font.Light
1758- }
1759- }
1760-}
1761
1762=== removed file 'Dash/People/Preview/Phone.qml'
1763--- Dash/People/Preview/Phone.qml 2013-06-05 22:03:08 +0000
1764+++ Dash/People/Preview/Phone.qml 1970-01-01 00:00:00 +0000
1765@@ -1,108 +0,0 @@
1766-/*
1767- * Copyright (C) 2013 Canonical, Ltd.
1768- *
1769- * This program is free software; you can redistribute it and/or modify
1770- * it under the terms of the GNU General Public License as published by
1771- * the Free Software Foundation; version 3.
1772- *
1773- * This program is distributed in the hope that it will be useful,
1774- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1775- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1776- * GNU General Public License for more details.
1777- *
1778- * You should have received a copy of the GNU General Public License
1779- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1780- */
1781-
1782-import QtQuick 2.0
1783-import Ubuntu.Components 0.1
1784-import "../../../Components/ListItems" as ListItems
1785-
1786-Base {
1787- id: root
1788- highlightWhenPressed: false
1789-
1790- signal phoneClicked
1791- signal textClicked
1792-
1793- Row {
1794- height: phoneButton.height
1795- anchors {
1796- left: parent.left
1797- right: parent.right
1798- }
1799- AbstractButton {
1800- id: phoneButton
1801- width: parent.width - units.gu(7)
1802- height: Math.max(units.gu(8), phoneColumn.height + units.gu(2))
1803- Column {
1804- id: phoneColumn
1805- spacing: units.gu(0.5)
1806- anchors {
1807- top: parent.top
1808- topMargin: units.gu(1)
1809- left: parent.left
1810- leftMargin: units.gu(2)
1811- right: parent.right
1812- }
1813- Label {
1814- text: {
1815- var parts = []
1816- if (location) parts.push(location)
1817- if (type && type != "voice") parts.push(type)
1818- if (parts.length == 0) return "other"
1819- return parts.join(" ")
1820- }
1821- elide: Text.ElideRight
1822- color: "#f3f3e7"
1823- style: Text.Raised
1824- styleColor: "black"
1825- font.capitalization: Font.Capitalize
1826- opacity: 0.7;
1827- fontSize: "small"
1828- }
1829- Label {
1830- width: parent.width
1831- text: number
1832- elide: Text.ElideRight
1833- color: "#f3f3e7"
1834- style: Text.Raised
1835- styleColor: "black"
1836- opacity: 0.9;
1837- fontSize: "large"
1838- wrapMode: Text.WordWrap
1839- maximumLineCount: 2
1840- font.weight: Font.Light
1841- }
1842- }
1843-
1844- ListItems.Highlight {
1845- anchors.fill: parent
1846- pressed: phoneButton.pressed
1847- }
1848-
1849- onClicked: phoneClicked()
1850- }
1851-
1852- AbstractButton {
1853- id: textButton
1854- width: units.gu(7)
1855- height: parent.height
1856-
1857- Image {
1858- anchors.centerIn: parent
1859- width: units.gu(4)
1860- height: units.gu(4)
1861- source: "../graphics/icon_write_text.png"
1862- fillMode: Image.PreserveAspectFit
1863- }
1864-
1865- ListItems.Highlight {
1866- anchors.fill: parent
1867- pressed: textButton.pressed
1868- }
1869-
1870- onClicked: textClicked()
1871- }
1872- }
1873-}
1874
1875=== removed file 'Dash/People/Preview/Status.qml'
1876--- Dash/People/Preview/Status.qml 2013-06-05 22:03:08 +0000
1877+++ Dash/People/Preview/Status.qml 1970-01-01 00:00:00 +0000
1878@@ -1,97 +0,0 @@
1879-/*
1880- * Copyright (C) 2013 Canonical, Ltd.
1881- *
1882- * This program is free software; you can redistribute it and/or modify
1883- * it under the terms of the GNU General Public License as published by
1884- * the Free Software Foundation; version 3.
1885- *
1886- * This program is distributed in the hope that it will be useful,
1887- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1888- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1889- * GNU General Public License for more details.
1890- *
1891- * You should have received a copy of the GNU General Public License
1892- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1893- */
1894-
1895-import QtQuick 2.0
1896-import Ubuntu.Components 0.1
1897-import "../../../Components/Time.js" as Time
1898-
1899-Base {
1900- id: root
1901-
1902- Item {
1903- anchors {
1904- left: parent.left
1905- right: parent.right
1906- leftMargin: units.gu(2)
1907- rightMargin: units.gu(4)
1908- }
1909- height: childrenRect.height
1910-
1911- Label {
1912- id: typeLabel
1913- anchors {
1914- top: parent.top
1915- topMargin: units.gu(1)
1916- }
1917- text: "Status"
1918- elide: Text.ElideRight
1919- color: "#f3f3e7"
1920- style: Text.Raised
1921- styleColor: "black"
1922- font.capitalization: Font.Capitalize
1923- opacity: 0.7;
1924- fontSize: "small"
1925- }
1926-
1927- Label {
1928- id: contentLabel
1929- anchors {
1930- left: parent.left
1931- right: parent.right
1932- top: typeLabel.bottom
1933- topMargin: units.gu(0.5)
1934- }
1935- text: root.model ? root.model.status : ""
1936- elide: Text.ElideRight
1937- color: "#f3f3e7"
1938- style: Text.Raised
1939- styleColor: "black"
1940- opacity: 0.9;
1941- fontSize: "large"
1942- wrapMode: Text.WordWrap
1943- maximumLineCount: 6
1944- font.weight: Font.Light
1945- }
1946-
1947- Row {
1948- anchors {
1949- top: contentLabel.bottom
1950- topMargin: units.gu(1)
1951- }
1952- height: statusText.height + units.gu(2.5)
1953- spacing: units.gu(1)
1954- Image {
1955- width: units.gu(2)
1956- height: units.gu(2)
1957- fillMode: Image.PreserveAspectFit
1958- source: root.model ? root.model.statusServiceIcon : ""
1959- }
1960- Label {
1961- id: statusText
1962- text: if (root.model) {
1963- var time = Time.readableFromNow(root.model.statusTime);
1964- return time ? time : root.model.statusTime;
1965- } else return "";
1966- elide: Text.ElideRight
1967- color: "#f3f3e7"
1968- style: Text.Raised
1969- styleColor: "black"
1970- opacity: 0.7;
1971- fontSize: "small"
1972- }
1973- }
1974- }
1975-}
1976
1977=== removed directory 'Dash/People/graphics'
1978=== removed file 'Dash/People/graphics/bottomshape@18.png'
1979Binary files Dash/People/graphics/bottomshape@18.png 2013-06-05 22:03:08 +0000 and Dash/People/graphics/bottomshape@18.png 1970-01-01 00:00:00 +0000 differ
1980=== removed file 'Dash/People/graphics/bottomshape@18.sci'
1981--- Dash/People/graphics/bottomshape@18.sci 2013-06-05 22:03:08 +0000
1982+++ Dash/People/graphics/bottomshape@18.sci 1970-01-01 00:00:00 +0000
1983@@ -1,5 +0,0 @@
1984-border.left: 54
1985-border.top: 60
1986-border.bottom: 60
1987-border.right: 54
1988-source: bottomshape@18.png
1989
1990=== removed file 'Dash/People/graphics/icon_facebook@18.png'
1991Binary files Dash/People/graphics/icon_facebook@18.png 2013-06-05 22:03:08 +0000 and Dash/People/graphics/icon_facebook@18.png 1970-01-01 00:00:00 +0000 differ
1992=== removed file 'Dash/People/graphics/icon_offline@18.png'
1993Binary files Dash/People/graphics/icon_offline@18.png 2013-06-05 22:03:08 +0000 and Dash/People/graphics/icon_offline@18.png 1970-01-01 00:00:00 +0000 differ
1994=== removed file 'Dash/People/graphics/icon_online@18.png'
1995Binary files Dash/People/graphics/icon_online@18.png 2013-06-05 22:03:08 +0000 and Dash/People/graphics/icon_online@18.png 1970-01-01 00:00:00 +0000 differ
1996=== removed file 'Dash/People/graphics/icon_twitter@18.png'
1997Binary files Dash/People/graphics/icon_twitter@18.png 2013-06-05 22:03:08 +0000 and Dash/People/graphics/icon_twitter@18.png 1970-01-01 00:00:00 +0000 differ
1998=== removed file 'Dash/People/graphics/icon_unknown@18.png'
1999Binary files Dash/People/graphics/icon_unknown@18.png 2013-06-05 22:03:08 +0000 and Dash/People/graphics/icon_unknown@18.png 1970-01-01 00:00:00 +0000 differ
2000=== removed file 'Dash/People/graphics/icon_write_text@18.png'
2001Binary files Dash/People/graphics/icon_write_text@18.png 2013-06-05 22:03:08 +0000 and Dash/People/graphics/icon_write_text@18.png 1970-01-01 00:00:00 +0000 differ
2002=== removed file 'Dash/People/graphics/star_favourite@18.png'
2003Binary files Dash/People/graphics/star_favourite@18.png 2013-06-05 22:03:08 +0000 and Dash/People/graphics/star_favourite@18.png 1970-01-01 00:00:00 +0000 differ
2004=== removed file 'Dash/People/graphics/star_not_favourite@18.png'
2005Binary files Dash/People/graphics/star_not_favourite@18.png 2013-06-05 22:03:08 +0000 and Dash/People/graphics/star_not_favourite@18.png 1970-01-01 00:00:00 +0000 differ
2006=== renamed file 'Dash/LensDelegateMapper.qml' => 'Dash/ScopeDelegateMapper.qml'
2007--- Dash/LensDelegateMapper.qml 2013-06-07 09:22:34 +0000
2008+++ Dash/ScopeDelegateMapper.qml 2013-06-19 20:05:35 +0000
2009@@ -17,19 +17,18 @@
2010 import QtQuick 2.0
2011
2012 QtObject {
2013- property var lensDelegateMapping: {"mockmusic.lens": "DashMusic.qml",
2014- "applications.lens": "DashApps.qml",
2015- "home.lens": "DashHome.qml",
2016- "mockvideos.lens": "DashVideos.qml",
2017- "people.lens": "DashPeople.qml",
2018+ property var scopeDelegateMapping: {"mockmusicmaster.scope": "DashMusic.qml",
2019+ "applications.scope": "DashApps.qml",
2020+ "home.scope": "DashHome.qml",
2021+ "mockvideosmaster.scope": "DashVideos.qml"
2022 }
2023- property string genericLens: "GenericLensView.qml"
2024+ property string genericScope: "GenericScopeView.qml"
2025
2026- function map(lensId) {
2027- var customLens = lensDelegateMapping[lensId]
2028- if (customLens != undefined) {
2029- return customLens
2030+ function map(scopeId) {
2031+ var customScope = scopeDelegateMapping[scopeId]
2032+ if (customScope != undefined) {
2033+ return customScope
2034 }
2035- return genericLens
2036+ return genericScope
2037 }
2038 }
2039
2040=== renamed file 'Dash/LensView.qml' => 'Dash/ScopeView.qml'
2041--- Dash/LensView.qml 2013-06-05 22:03:08 +0000
2042+++ Dash/ScopeView.qml 2013-06-19 20:05:35 +0000
2043@@ -19,7 +19,7 @@
2044 import Unity 0.1
2045
2046 FocusScope {
2047- property Lens lens
2048+ property Scope scope
2049 property SortFilterProxyModel categories: categoryFilter
2050 property bool isCurrent
2051 property ListModel searchHistory
2052@@ -29,17 +29,17 @@
2053 signal positionedAtBeginning
2054
2055 // FIXME delay the search so that daemons have time to settle
2056- onLensChanged: timer.restart()
2057+ onScopeChanged: timer.restart()
2058
2059 Timer {
2060 id: timer
2061 interval: 2000
2062- onTriggered: lens.searchQuery = ""
2063+ onTriggered: scope.searchQuery = ""
2064 }
2065
2066 SortFilterProxyModel {
2067 id: categoryFilter
2068- model: lens.categories
2069+ model: scope.categories
2070 dynamicSortFilter: true
2071 filterRole: Categories.RoleCount
2072 filterRegExp: /^0$/
2073
2074=== modified file 'Dash/Video/VideosFilterGrid.qml'
2075--- Dash/Video/VideosFilterGrid.qml 2013-06-05 22:03:08 +0000
2076+++ Dash/Video/VideosFilterGrid.qml 2013-06-19 20:05:35 +0000
2077@@ -37,14 +37,14 @@
2078 objectName: "delegate" + index
2079 width: filtergrid.cellWidth
2080 height: filtergrid.cellHeight
2081- text: model.column_4
2082+ text: model.column_5
2083 imageWidth: filtergrid.iconWidth
2084 imageHeight: filtergrid.iconHeight
2085 source: model.column_1
2086 fillMode: Image.PreserveAspectCrop
2087 onClicked: {
2088 var fileUri = model.column_0.replace(/^[^:]+:/, "")
2089- var data = {fileUri: fileUri, nfoUri: model.column_5}
2090+ var data = {fileUri: fileUri, nfoUri: model.column_6}
2091 filtergrid.clicked(index, data, tile.y);
2092 }
2093 }
2094
2095=== removed directory 'Dash/graphics/lensIcons'
2096=== removed file 'Dash/graphics/lensIcons/Applications@18.png'
2097Binary files Dash/graphics/lensIcons/Applications@18.png 2013-06-05 22:03:08 +0000 and Dash/graphics/lensIcons/Applications@18.png 1970-01-01 00:00:00 +0000 differ
2098=== removed file 'Dash/graphics/lensIcons/Home@18.png'
2099Binary files Dash/graphics/lensIcons/Home@18.png 2013-06-05 22:03:08 +0000 and Dash/graphics/lensIcons/Home@18.png 1970-01-01 00:00:00 +0000 differ
2100=== removed file 'Dash/graphics/lensIcons/Music@18.png'
2101Binary files Dash/graphics/lensIcons/Music@18.png 2013-06-05 22:03:08 +0000 and Dash/graphics/lensIcons/Music@18.png 1970-01-01 00:00:00 +0000 differ
2102=== removed file 'Dash/graphics/lensIcons/People@18.png'
2103Binary files Dash/graphics/lensIcons/People@18.png 2013-06-05 22:03:08 +0000 and Dash/graphics/lensIcons/People@18.png 1970-01-01 00:00:00 +0000 differ
2104=== removed file 'Dash/graphics/lensIcons/Videos@18.png'
2105Binary files Dash/graphics/lensIcons/Videos@18.png 2013-06-05 22:03:08 +0000 and Dash/graphics/lensIcons/Videos@18.png 1970-01-01 00:00:00 +0000 differ
2106=== modified file 'Shell.qml'
2107--- Shell.qml 2013-06-19 18:10:57 +0000
2108+++ Shell.qml 2013-06-19 20:05:35 +0000
2109@@ -552,14 +552,14 @@
2110 greeter.hide()
2111 // Animate if moving between application and dash
2112 if (!stages.shown) {
2113- dash.setCurrentLens("home.lens", true, false)
2114+ dash.setCurrentScope("home.scope", true, false)
2115 } else {
2116- dash.setCurrentLens("home.lens", false, false)
2117+ dash.setCurrentScope("home.scope", false, false)
2118 }
2119 stages.hide();
2120 }
2121 onDash: {
2122- dash.setCurrentLens("applications.lens", true, false)
2123+ dash.setCurrentScope("applications.scope", true, false)
2124 stages.hide();
2125 }
2126 onLauncherApplicationSelected:{
2127
2128=== modified file 'build_unity'
2129--- build_unity 2013-06-07 10:36:14 +0000
2130+++ build_unity 2013-06-19 20:05:35 +0000
2131@@ -6,11 +6,10 @@
2132 UPDATE=false
2133 CLEAN=false
2134 NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))
2135-LENSES="applications mockmusic mockvideos"
2136
2137 # verified working revisions
2138-LIBUNITY_REV=215
2139-UNITY_REV=3260
2140+LIBUNITY_REV=228
2141+UNITY_REV=3343
2142 HUD_REV=252
2143
2144 usage() {
2145@@ -53,12 +52,12 @@
2146
2147 branch_libunity() {
2148 echo "Branching libunity.."
2149- bzr branch lp:libunity/phablet $TARGET_DIR/libunity || exit 8
2150+ bzr branch lp:libunity $TARGET_DIR/libunity || exit 8
2151 }
2152
2153 branch_unity() {
2154 echo "Branching Unity.."
2155- bzr branch lp:unity/phablet-mods $TARGET_DIR/unity || exit 9
2156+ bzr branch lp:unity $TARGET_DIR/unity || exit 9
2157 }
2158
2159 branch_hud() {
2160@@ -92,7 +91,7 @@
2161 mkdir $TARGET_DIR/libunity/build
2162 cd $TARGET_DIR/libunity/build
2163
2164- ../autogen.sh --prefix $BUILD_DIR --disable-debug || exit 15
2165+ ../autogen.sh --prefix $BUILD_DIR --disable-debug --with-pygi-overrides-dir=$BUILD_DIR/gi-overrides || exit 15
2166
2167 echo "Building libunity and installing in " $BUILD_DIR
2168 make -j$NUM_JOBS install || exit 16
2169@@ -136,14 +135,6 @@
2170
2171 }
2172
2173-link_lenses() {
2174- echo "Linking system lenses.."
2175- mkdir -p $BUILD_DIR/share/unity/lenses/
2176- for LENS in $LENSES; do
2177- [ -e $BUILD_DIR/share/unity/lenses/$LENS ] || ln -ivs /usr/share/unity/lenses/$LENS $BUILD_DIR/share/unity/lenses/$LENS
2178- done
2179-}
2180-
2181 if $SETUP; then
2182 echo "Setting up environment for building Unity.."
2183 install_utils
2184@@ -163,6 +154,5 @@
2185 compile_libunity
2186 compile_unity_core
2187 compile_hud
2188- link_lenses
2189 fi
2190
2191
2192=== modified file 'debian/changelog'
2193--- debian/changelog 2013-06-05 22:03:08 +0000
2194+++ debian/changelog 2013-06-19 20:05:35 +0000
2195@@ -1,3 +1,9 @@
2196+unity8 (7.81.0) UNRELEASED; urgency=low
2197+
2198+ * New version with support for smart scopes.
2199+
2200+ -- Michał Sawicz <michal.sawicz@canonical.com> Fri, 14 Jun 2013 12:56:17 +0200
2201+
2202 unity8 (7.80.0) saucy; urgency=low
2203
2204 * Rename to unity8.
2205
2206=== modified file 'debian/control'
2207--- debian/control 2013-06-19 15:25:39 +0000
2208+++ debian/control 2013-06-19 20:05:35 +0000
2209@@ -11,7 +11,7 @@
2210 libgles2-mesa-dev[armhf],
2211 libhud-client2-dev,
2212 libpulse-dev,
2213- libunity-core-6.0-dev,
2214+ libunity-core-6.0-dev (<< 7.80),
2215 libxcb1-dev,
2216 pkg-config,
2217 python3,
2218@@ -51,6 +51,8 @@
2219 indicators-client-plugin-network (>= 0.6.1),
2220 indicators-client-plugin-power (>= 0.6.1),
2221 indicators-client-plugin-sound (>= 0.6.1),
2222+ unity-scope-home,
2223+ unity-lens-applications,
2224 Description: Ubuntu QML shell
2225 The Ubuntu QML shell is the primary user interface for Ubuntu devices.
2226
2227
2228=== modified file 'plugins/Unity/CMakeLists.txt'
2229--- plugins/Unity/CMakeLists.txt 2013-06-05 22:03:08 +0000
2230+++ plugins/Unity/CMakeLists.txt 2013-06-19 20:05:35 +0000
2231@@ -13,11 +13,10 @@
2232
2233 set(QMLPLUGIN_SRC
2234 ../Utils/qsortfilterproxymodelqml.cpp # FIXME evaluate a more generic approach for using other plugins
2235- lens.cpp
2236- lenses.cpp
2237+ scope.cpp
2238+ scopes.cpp
2239 categories.cpp
2240 categoryfilter.cpp
2241- peoplepreviewdata.cpp
2242 plugin.cpp
2243 bottombarvisibilitycommunicatorshell.cpp
2244 launchermodel.cpp
2245
2246=== modified file 'plugins/Unity/categories.cpp'
2247--- plugins/Unity/categories.cpp 2013-06-05 22:03:08 +0000
2248+++ plugins/Unity/categories.cpp 2013-06-19 20:05:35 +0000
2249@@ -24,7 +24,6 @@
2250 Categories::Categories(QObject* parent)
2251 : DeeListModel(parent)
2252 , m_resultModel(0)
2253- , m_globalResultModel(0)
2254 {
2255 // FIXME: need to clean up unused filters on countChanged
2256 m_roles[Categories::RoleId] = "id";
2257@@ -33,9 +32,7 @@
2258 m_roles[Categories::RoleRenderer] = "renderer";
2259 m_roles[Categories::RoleHints] = "hints";
2260 m_roles[Categories::RoleResults] = "results";
2261- m_roles[Categories::RoleGlobalResults] = "globalResults";
2262 m_roles[Categories::RoleCount] = "count";
2263- m_roles[Categories::RoleGlobalCount] = "globalCount";
2264
2265 // TODO This should not be needed but accumulatting the count changes
2266 // makes the visualization more stable and also makes crashes on fast
2267@@ -48,7 +45,6 @@
2268 Categories::~Categories()
2269 {
2270 qDeleteAll(m_filters);
2271- qDeleteAll(m_globalFilters);
2272 }
2273
2274 CategoryFilter*
2275@@ -66,21 +62,6 @@
2276 return m_filters[index];
2277 }
2278
2279-CategoryFilter*
2280-Categories::getGlobalFilter(int index) const
2281-{
2282- if (!m_globalFilters.contains(index)) {
2283- CategoryFilter* filter = new CategoryFilter();
2284- connect(filter, SIGNAL(countChanged()), this, SLOT(onGlobalCountChanged()));
2285- filter->setModel(m_globalResultModel);
2286- filter->setIndex(index);
2287-
2288- m_globalFilters.insert(index, filter);
2289- }
2290-
2291- return m_globalFilters[index];
2292-}
2293-
2294 void
2295 Categories::setResultModel(DeeListModel* model)
2296 {
2297@@ -96,20 +77,6 @@
2298 }
2299
2300 void
2301-Categories::setGlobalResultModel(DeeListModel* model)
2302-{
2303- if (model != m_globalResultModel) {
2304- m_globalResultModel = model;
2305-
2306- Q_FOREACH(CategoryFilter* filter, m_globalFilters) {
2307- filter->setModel(m_globalResultModel);
2308- }
2309-
2310- Q_EMIT globalResultModelChanged(m_globalResultModel);
2311- }
2312-}
2313-
2314-void
2315 Categories::onCountChanged()
2316 {
2317 CategoryFilter* filter = qobject_cast<CategoryFilter*>(sender());
2318@@ -131,18 +98,6 @@
2319 m_timerFilters.clear();
2320 }
2321
2322-void
2323-Categories::onGlobalCountChanged()
2324-{
2325- CategoryFilter* filter = qobject_cast<CategoryFilter*>(sender());
2326- if (filter) {
2327- QModelIndex changedIndex = index(filter->index());
2328- QVector<int> roles;
2329- roles.append(Categories::RoleGlobalCount);
2330- Q_EMIT dataChanged(changedIndex, changedIndex, roles);
2331- }
2332-}
2333-
2334 QHash<int, QByteArray>
2335 Categories::roleNames() const
2336 {
2337@@ -159,23 +114,18 @@
2338 if (role == RoleId) {
2339 return QVariant::fromValue(index.row());
2340 } else if (role == RoleName) {
2341- return QVariant::fromValue(DeeListModel::data(index, 0));
2342+ return QVariant::fromValue(DeeListModel::data(index, 1)); //DISPLAY_NAME
2343 } else if (role == RoleIcon) {
2344- return QVariant::fromValue(DeeListModel::data(index, 1));
2345+ return QVariant::fromValue(DeeListModel::data(index, 2)); //ICON_HINT
2346 } else if (role == RoleRenderer) {
2347- return QVariant::fromValue(DeeListModel::data(index, 2));
2348+ return QVariant::fromValue(DeeListModel::data(index, 3)); //RENDERER_NAME
2349 } else if (role == RoleHints) {
2350- return QVariant::fromValue(DeeListModel::data(index, 3));
2351+ return QVariant::fromValue(DeeListModel::data(index, 4)); //HINTS
2352 } else if (role == RoleResults) {
2353 return QVariant::fromValue(getFilter(index.row()));
2354- } else if (role == RoleGlobalResults) {
2355- return QVariant::fromValue(getGlobalFilter(index.row()));
2356 } else if (role == RoleCount) {
2357 CategoryFilter* filter = getFilter(index.row());
2358 return QVariant::fromValue(filter->rowCount());
2359- } else if (role == RoleGlobalCount) {
2360- QSortFilterProxyModel* filter = getGlobalFilter(index.row());
2361- return QVariant::fromValue(filter->rowCount());
2362 } else {
2363 return QVariant();
2364 }
2365
2366=== modified file 'plugins/Unity/categories.h'
2367--- plugins/Unity/categories.h 2013-06-05 22:03:08 +0000
2368+++ plugins/Unity/categories.h 2013-06-19 20:05:35 +0000
2369@@ -36,7 +36,6 @@
2370 Q_ENUMS(Roles)
2371
2372 Q_PROPERTY(DeeListModel* resultModel READ resultModel WRITE setResultModel NOTIFY resultModelChanged)
2373- Q_PROPERTY(DeeListModel* globalResultModel READ globalResultModel WRITE setResultModel NOTIFY globalResultModelChanged)
2374
2375 public:
2376 explicit Categories(QObject* parent = 0);
2377@@ -49,9 +48,7 @@
2378 RoleRenderer,
2379 RoleHints,
2380 RoleResults,
2381- RoleGlobalResults,
2382- RoleCount,
2383- RoleGlobalCount
2384+ RoleCount
2385 };
2386
2387 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
2388@@ -60,32 +57,25 @@
2389
2390 /* getters */
2391 DeeListModel* resultModel() { return m_resultModel; }
2392- DeeListModel* globalResultModel() { return m_globalResultModel; }
2393
2394 /* setters */
2395 void setResultModel(DeeListModel*);
2396- void setGlobalResultModel(DeeListModel*);
2397
2398 Q_SIGNALS:
2399 void resultModelChanged(DeeListModel*);
2400- void globalResultModelChanged(DeeListModel*);
2401
2402 private Q_SLOTS:
2403 void onCountChanged();
2404- void onGlobalCountChanged();
2405 void onEmitCountChanged();
2406
2407 private:
2408 CategoryFilter* getFilter(int index) const;
2409- CategoryFilter* getGlobalFilter(int index) const;
2410
2411 QTimer m_timer;
2412 QSet<CategoryFilter*> m_timerFilters;
2413 QHash<int, QByteArray> m_roles;
2414 DeeListModel* m_resultModel;
2415- DeeListModel* m_globalResultModel;
2416 mutable QMap<int, CategoryFilter*> m_filters;
2417- mutable QMap<int, CategoryFilter*> m_globalFilters;
2418 };
2419
2420 #endif // CATEGORIES_H
2421
2422=== removed file 'plugins/Unity/peoplepreviewdata.cpp'
2423--- plugins/Unity/peoplepreviewdata.cpp 2013-06-05 22:03:08 +0000
2424+++ plugins/Unity/peoplepreviewdata.cpp 1970-01-01 00:00:00 +0000
2425@@ -1,438 +0,0 @@
2426-/*
2427- * Copyright (C) 2012 Canonical, Ltd.
2428- *
2429- * Authors:
2430- * Guenter Schwann <guenter.schwann@canonical.com>
2431- *
2432- * This program is free software; you can redistribute it and/or modify
2433- * it under the terms of the GNU General Public License as published by
2434- * the Free Software Foundation; version 3.
2435- *
2436- * This program is distributed in the hope that it will be useful,
2437- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2438- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2439- * GNU General Public License for more details.
2440- *
2441- * You should have received a copy of the GNU General Public License
2442- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2443- */
2444-
2445-#include "peoplepreviewdata.h"
2446-
2447-#include <QDebug>
2448-
2449-#include "lens.h"
2450-
2451-static void phoneAppend(QQmlListProperty<PeoplePhoneData> *property, PeoplePhoneData *val)
2452-{
2453- Q_UNUSED(val);
2454- Q_UNUSED(property);
2455-}
2456-static PeoplePhoneData *phoneAt(QQmlListProperty<PeoplePhoneData> *property, int index)
2457-{
2458- PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
2459- return d->phoneNumberList().at(index);
2460-}
2461-static int phoneCount(QQmlListProperty<PeoplePhoneData> *property)
2462-{
2463- PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
2464- return d->phoneNumberList().count();
2465-}
2466-static void phoneClear(QQmlListProperty<PeoplePhoneData> *property)
2467-{
2468- Q_UNUSED(property);
2469-}
2470-
2471-static void emailAppend(QQmlListProperty<PeopleAddressData> *property, PeopleAddressData *val)
2472-{
2473- Q_UNUSED(val);
2474- Q_UNUSED(property);
2475-}
2476-static PeopleAddressData *emailAt(QQmlListProperty<PeopleAddressData> *property, int index)
2477-{
2478- PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
2479- return d->emailAddressesList().at(index);
2480-}
2481-static int emailCount(QQmlListProperty<PeopleAddressData> *property)
2482-{
2483- PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
2484- return d->emailAddressesList().count();
2485-}
2486-static void emailClear(QQmlListProperty<PeopleAddressData> *property)
2487-{
2488- Q_UNUSED(property);
2489-}
2490-
2491-static void imAppend(QQmlListProperty<PeopleIMData> *property, PeopleIMData *val)
2492-{
2493- Q_UNUSED(val);
2494- Q_UNUSED(property);
2495-}
2496-static PeopleIMData *imAt(QQmlListProperty<PeopleIMData> *property, int index)
2497-{
2498- PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
2499- return d->imAccountsList().at(index);
2500-}
2501-static int imCount(QQmlListProperty<PeopleIMData> *property)
2502-{
2503- PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
2504- return d->imAccountsList().count();
2505-}
2506-static void imClear(QQmlListProperty<PeopleIMData> *property)
2507-{
2508- Q_UNUSED(property);
2509-}
2510-
2511-static void addressAppend(QQmlListProperty<PeopleAddressData> *property, PeopleAddressData *val)
2512-{
2513- Q_UNUSED(val);
2514- Q_UNUSED(property);
2515-}
2516-static PeopleAddressData *addressAt(QQmlListProperty<PeopleAddressData> *property, int index)
2517-{
2518- PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
2519- return d->addressesList().at(index);
2520-}
2521-static int addressCount(QQmlListProperty<PeopleAddressData> *property)
2522-{
2523- PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
2524- return d->addressesList().count();
2525-}
2526-static void addressClear(QQmlListProperty<PeopleAddressData> *property)
2527-{
2528- Q_UNUSED(property);
2529-}
2530-
2531-
2532-using namespace unity;
2533-
2534-PeoplePreviewData::PeoplePreviewData(QObject *parent)
2535-: QObject(parent)
2536-, m_lens(0)
2537-, m_ready(false)
2538-{
2539-}
2540-
2541-PeoplePreviewData::~PeoplePreviewData()
2542-{
2543- clearData();
2544-}
2545-
2546-Lens *PeoplePreviewData::lens() const
2547-{
2548- return m_lens;
2549-}
2550-
2551-void PeoplePreviewData::setLens(Lens *lens)
2552-{
2553- if (lens == m_lens)
2554- return;
2555-
2556- setReady(false);
2557-
2558- if (m_lensConnection.connected())
2559- m_lensConnection.disconnect();
2560-
2561- m_lens = lens;
2562- m_lensConnection = m_lens->unityLens()->preview_ready.connect(
2563- sigc::mem_fun(this, &PeoplePreviewData::setUnityPreview));
2564- Q_EMIT lensChanged();
2565-
2566- if (!m_uri.isEmpty() && !m_lens)
2567- getPeoplePreview();
2568-}
2569-
2570-QString PeoplePreviewData::uri() const
2571-{
2572- return m_uri;
2573-}
2574-
2575-void PeoplePreviewData::setUri(const QString &uri)
2576-{
2577- if (uri == m_uri)
2578- return;
2579-
2580- setReady(false);
2581-
2582- m_uri = uri;
2583- Q_EMIT uriChanged();
2584- if (!m_uri.isEmpty() && m_lens)
2585- getPeoplePreview();
2586-}
2587-
2588-bool PeoplePreviewData::ready() const
2589-{
2590- return m_ready;
2591-}
2592-
2593-void PeoplePreviewData::setReady(const bool &ready)
2594-{
2595- if (ready == m_ready)
2596- return;
2597-
2598- m_ready = ready;
2599- Q_EMIT readyChanged();
2600-}
2601-
2602-QString PeoplePreviewData::renderName() const
2603-{
2604- if (!m_unityPreview)
2605- return QLatin1String("");
2606-
2607- return QString::fromStdString(m_unityPreview->renderer_name());
2608-}
2609-
2610-QString PeoplePreviewData::title() const
2611-{
2612- if (!m_unityPreview)
2613- return QLatin1String("");
2614-
2615- return QString::fromStdString(m_unityPreview->title());
2616-}
2617-
2618-QString PeoplePreviewData::subTitle() const
2619-{
2620- if (!m_unityPreview)
2621- return QLatin1String("");
2622-
2623- return QString::fromStdString(m_unityPreview->subtitle());
2624-}
2625-
2626-QString PeoplePreviewData::description() const
2627-{
2628- if (!m_unityPreview)
2629- return QLatin1String("");
2630-
2631- return QString::fromStdString(m_unityPreview->description());
2632-}
2633-
2634-QString PeoplePreviewData::imageSource() const
2635-{
2636- if (!m_unityPreview)
2637- return QLatin1String("");
2638-
2639- return QString::fromStdString(m_unityPreview->image_source_uri());
2640-}
2641-
2642-QQmlListProperty<PeoplePhoneData> PeoplePreviewData::phoneNumbers()
2643-{
2644- return QQmlListProperty<PeoplePhoneData> (this, this,
2645- phoneAppend,
2646- phoneCount,
2647- phoneAt,
2648- phoneClear);
2649-}
2650-
2651-QQmlListProperty<PeopleAddressData> PeoplePreviewData::emailAddresses()
2652-{
2653- return QQmlListProperty<PeopleAddressData> (this, this,
2654- emailAppend,
2655- emailCount,
2656- emailAt,
2657- emailClear);
2658-}
2659-
2660-QQmlListProperty<PeopleIMData> PeoplePreviewData::imAccounts()
2661-{
2662- return QQmlListProperty<PeopleIMData> (this, this,
2663- imAppend,
2664- imCount,
2665- imAt,
2666- imClear);
2667-}
2668-
2669-QString PeoplePreviewData::displayName() const
2670-{
2671- if (!m_unityPreview)
2672- return QLatin1String("");
2673-
2674- return QString::fromStdString(m_unityPreview->display_name());
2675-}
2676-
2677-QString PeoplePreviewData::status() const
2678-{
2679- if (!m_unityPreview)
2680- return QLatin1String("");
2681-
2682- return QString::fromStdString(m_unityPreview->status());
2683-}
2684-
2685-QString PeoplePreviewData::statusTime() const
2686-{
2687- if (!m_unityPreview)
2688- return QLatin1String("");
2689-
2690- return QString::fromStdString(m_unityPreview->status_time());
2691-}
2692-
2693-QString PeoplePreviewData::statusService() const
2694-{
2695- if (!m_unityPreview)
2696- return QLatin1String("");
2697-
2698- return QString::fromStdString(m_unityPreview->status_service());
2699-}
2700-
2701-QString PeoplePreviewData::statusServiceIcon() const
2702-{
2703- if (!m_unityPreview)
2704- return QLatin1String("");
2705-
2706- glib::Object<GIcon> icon = m_unityPreview->status_service_icon();
2707- if (!icon)
2708- return QLatin1String("");
2709-
2710- return QString(g_icon_to_string(icon));
2711-}
2712-
2713-QString PeoplePreviewData::statusPostUri() const
2714-{
2715- if (!m_unityPreview)
2716- return QLatin1String("");
2717-
2718- return QString::fromStdString(m_unityPreview->status_post_uri());
2719-}
2720-
2721-QQmlListProperty<PeopleAddressData> PeoplePreviewData::addresses()
2722-{
2723- return QQmlListProperty<PeopleAddressData> (this, this,
2724- addressAppend,
2725- addressCount,
2726- addressAt,
2727- addressClear);
2728-}
2729-
2730-QString PeoplePreviewData::avatar() const
2731-{
2732- if (!m_unityPreview)
2733- return QLatin1String("");
2734-
2735- glib::Object<GIcon> avatar = m_unityPreview->avatar();
2736- if (!avatar)
2737- return QLatin1String("");
2738-
2739- return QString(g_icon_to_string(avatar));
2740-}
2741-
2742-void PeoplePreviewData::getPeoplePreview()
2743-{
2744- m_lens->unityLens()->Preview(m_uri.toStdString());
2745-}
2746-
2747-void PeoplePreviewData::setUnityPreview(std::string const& uri, dash::Preview::Ptr const& preview)
2748-{
2749- if (uri != m_uri.toStdString())
2750- return;
2751-
2752- dash::PeoplePreview::Ptr peoplePtr = std::dynamic_pointer_cast<dash::PeoplePreview>(preview);
2753- if (peoplePtr == nullptr) {
2754- qWarning() << "Backend returned a dash::Preview that isn't a dash::PeoplePreview";
2755- Q_EMIT error();
2756- return;
2757- }
2758-
2759- clearData();
2760- m_unityPreview = peoplePtr;
2761- getPhoneData();
2762- getEmailAddresses();
2763- getImAccounts();
2764- getAddresses();
2765-
2766- Q_EMIT renderNameChanged();
2767- Q_EMIT titleChanged();
2768- Q_EMIT subTitleChanged();
2769- Q_EMIT descriptionChanged();
2770- Q_EMIT imageSourceChanged();
2771- Q_EMIT phoneNumbersChanged();
2772- Q_EMIT emailAddressesChanged();
2773- Q_EMIT imAccountsChanged();
2774- Q_EMIT displayNameChanged();
2775- Q_EMIT statusChanged();
2776- Q_EMIT statusTimeChanged();
2777- Q_EMIT statusServiceChanged();
2778- Q_EMIT addressesChanged();
2779- Q_EMIT avatarChanged();
2780-
2781- setReady(true);
2782-}
2783-
2784-void PeoplePreviewData::clearData()
2785-{
2786- while (!m_phoneList.empty()) {
2787- PeoplePhoneData *phone = m_phoneList.takeLast();
2788- delete phone;
2789- }
2790- while (!m_emailList.empty()) {
2791- PeopleAddressData *email = m_emailList.takeLast();
2792- delete email;
2793- }
2794- while (!m_imList.empty()) {
2795- PeopleIMData *im = m_imList.takeLast();
2796- delete im;
2797- }
2798- while (!m_addressList.empty()) {
2799- PeopleAddressData *address = m_addressList.takeLast();
2800- delete address;
2801- }
2802-}
2803-
2804-void PeoplePreviewData::getPhoneData()
2805-{
2806- dash::PeoplePreview::PhonePtrList uPhoneList;
2807- uPhoneList = m_unityPreview->GetPhone();
2808-
2809- for (size_t i=0; i<uPhoneList.size(); ++i) {
2810- PeoplePhoneData *phone = new PeoplePhoneData;
2811- phone->m_type = QString::fromStdString(uPhoneList[i]->type);
2812- phone->m_location = QString::fromStdString(uPhoneList[i]->location);
2813- phone->m_number = QString::fromStdString(uPhoneList[i]->number);
2814- m_phoneList.append(phone);
2815- }
2816-}
2817-
2818-void PeoplePreviewData::getEmailAddresses()
2819-{
2820- dash::PeoplePreview::EmailPtrList uEmailList;
2821- uEmailList = m_unityPreview->GetEmail();
2822-
2823- for (size_t i=0; i<uEmailList.size(); ++i) {
2824- PeopleAddressData *email = new PeopleAddressData;
2825- email->m_type = QString::fromStdString(uEmailList[i]->type);
2826- email->m_address = QString::fromStdString(uEmailList[i]->address);
2827- m_emailList.append(email);
2828- }
2829-}
2830-
2831-void PeoplePreviewData::getImAccounts()
2832-{
2833- dash::PeoplePreview::IMAccountPtrList uIMList;
2834- uIMList = m_unityPreview->GetIMAccount();
2835-
2836- for (size_t i=0; i<uIMList.size(); ++i) {
2837- PeopleIMData *im = new PeopleIMData;
2838- im->m_protocol = QString::fromStdString(uIMList[i]->protocol);
2839- im->m_address = QString::fromStdString(uIMList[i]->address);
2840- m_imList.append(im);
2841- }
2842-}
2843-
2844-void PeoplePreviewData::getAddresses()
2845-{
2846- dash::PeoplePreview::AddressPtrList uAddressList;
2847- uAddressList = m_unityPreview->GetAddress();
2848-
2849- for (size_t i=0; i<uAddressList.size(); ++i) {
2850- PeopleAddressData *address = new PeopleAddressData;
2851- address->m_type = QString::fromStdString(uAddressList[i]->type);
2852- address->m_address = QString::fromStdString(uAddressList[i]->address);
2853- address->m_poBox = QString::fromStdString(uAddressList[i]->po_box);
2854- address->m_extension = QString::fromStdString(uAddressList[i]->extension);
2855- address->m_street = QString::fromStdString(uAddressList[i]->street);
2856- address->m_locality = QString::fromStdString(uAddressList[i]->locality);
2857- address->m_region = QString::fromStdString(uAddressList[i]->region);
2858- address->m_postalCode = QString::fromStdString(uAddressList[i]->postal_code);
2859- address->m_country = QString::fromStdString(uAddressList[i]->country);
2860- address->m_addressFormat = QString::fromStdString(uAddressList[i]->address_format);
2861- m_addressList.append(address);
2862- }
2863-}
2864
2865=== removed file 'plugins/Unity/peoplepreviewdata.h'
2866--- plugins/Unity/peoplepreviewdata.h 2013-06-05 22:03:08 +0000
2867+++ plugins/Unity/peoplepreviewdata.h 1970-01-01 00:00:00 +0000
2868@@ -1,251 +0,0 @@
2869-/*
2870- * Copyright (C) 2012 Canonical, Ltd.
2871- *
2872- * Authors:
2873- * Guenter Schwann <guenter.schwann@canonical.com>
2874- *
2875- * This program is free software; you can redistribute it and/or modify
2876- * it under the terms of the GNU General Public License as published by
2877- * the Free Software Foundation; version 3.
2878- *
2879- * This program is distributed in the hope that it will be useful,
2880- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2881- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2882- * GNU General Public License for more details.
2883- *
2884- * You should have received a copy of the GNU General Public License
2885- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2886- */
2887-
2888-#ifndef PEOPLEPREVIEWDATA_H
2889-#define PEOPLEPREVIEWDATA_H
2890-
2891-#include <QList>
2892-#include <QObject>
2893-#include <qqmllist.h>
2894-#include <QString>
2895-
2896-// libunity-core
2897-#include <UnityCore/PeoplePreview.h>
2898-
2899-#include <sigc++/connection.h>
2900-
2901-class Lens;
2902-
2903-/*!
2904- * \brief The PeoplePhoneData class stores the data for one phone number
2905- */
2906-class PeoplePhoneData : public QObject
2907-{
2908- Q_OBJECT
2909- Q_PROPERTY(QString type READ type NOTIFY typeChanged)
2910- Q_PROPERTY(QString location READ location NOTIFY locationChanged)
2911- Q_PROPERTY(QString number READ number NOTIFY numberChanged)
2912-
2913-Q_SIGNALS:
2914- void typeChanged();
2915- void locationChanged();
2916- void numberChanged();
2917-
2918-public:
2919- explicit PeoplePhoneData(QObject *parent = 0) : QObject(parent) {}
2920- QString type() const { return m_type; }
2921- QString location() const { return m_location; }
2922- QString number() const { return m_number; }
2923-
2924-private:
2925- QString m_type;
2926- QString m_location;
2927- QString m_number;
2928- friend class PeoplePreviewData;
2929-};
2930-
2931-/*!
2932- * \brief The PeopleAddressData class stores the data for one single post/email address
2933- */
2934-class PeopleAddressData : public QObject
2935-{
2936- Q_OBJECT
2937- Q_PROPERTY(QString type READ type NOTIFY typeChanged)
2938- Q_PROPERTY(QString address READ address NOTIFY addressChanged)
2939- Q_PROPERTY(QString poBox READ poBox NOTIFY poBoxChanged)
2940- Q_PROPERTY(QString extension READ extension NOTIFY extensionChanged)
2941- Q_PROPERTY(QString street READ street NOTIFY streetChanged)
2942- Q_PROPERTY(QString locality READ locality NOTIFY localityChanged)
2943- Q_PROPERTY(QString region READ region NOTIFY regionChanged)
2944- Q_PROPERTY(QString postalCode READ postalCode NOTIFY postalCodeChanged)
2945- Q_PROPERTY(QString country READ country NOTIFY countryChanged)
2946- Q_PROPERTY(QString addressFormat READ addressFormat NOTIFY addressFormatChanged)
2947-
2948-Q_SIGNALS:
2949- void typeChanged();
2950- void addressChanged();
2951- void poBoxChanged();
2952- void extensionChanged();
2953- void streetChanged();
2954- void localityChanged();
2955- void regionChanged();
2956- void postalCodeChanged();
2957- void countryChanged();
2958- void addressFormatChanged();
2959-
2960-public:
2961- explicit PeopleAddressData(QObject *parent = 0) : QObject(parent) {}
2962- QString type() const { return m_type; }
2963- QString address() const { return m_address; }
2964- QString poBox() const { return m_poBox; }
2965- QString extension() const { return m_extension; }
2966- QString street() const { return m_street; }
2967- QString locality() const { return m_locality; }
2968- QString region() const { return m_region; }
2969- QString postalCode() const { return m_postalCode; }
2970- QString country() const { return m_country; }
2971- QString addressFormat() const { return m_addressFormat; }
2972-
2973-private:
2974- QString m_type;
2975- QString m_address;
2976- QString m_poBox;
2977- QString m_extension;
2978- QString m_street;
2979- QString m_locality;
2980- QString m_region;
2981- QString m_postalCode;
2982- QString m_country;
2983- QString m_addressFormat;
2984- friend class PeoplePreviewData;
2985-};
2986-
2987-/*!
2988- * \brief The PeopleIMData class stores the data for one single post/email address
2989- */
2990-class PeopleIMData : public QObject
2991-{
2992- Q_OBJECT
2993- Q_PROPERTY(QString protocol READ protocol NOTIFY protocolChanged)
2994- Q_PROPERTY(QString address READ address NOTIFY addressChanged)
2995-
2996-Q_SIGNALS:
2997- void protocolChanged();
2998- void addressChanged();
2999-
3000-public:
3001- explicit PeopleIMData(QObject *parent = 0) : QObject(parent) {}
3002- QString protocol() const { return m_protocol; }
3003- QString address() const { return m_address; }
3004-
3005-private:
3006- QString m_protocol;
3007- QString m_address;
3008- friend class PeoplePreviewData;
3009-};
3010-
3011-
3012-/*!
3013- * \brief The PeoplePreviewData class providing information for one person
3014- */
3015-class PeoplePreviewData : public QObject
3016-{
3017- Q_OBJECT
3018-
3019- // These properties need to be set from QML
3020- Q_PROPERTY(Lens* lens READ lens WRITE setLens NOTIFY lensChanged)
3021- Q_PROPERTY(QString uri READ uri WRITE setUri NOTIFY uriChanged)
3022- // Read only properties containing general Preview information
3023- Q_PROPERTY(bool ready READ ready NOTIFY readyChanged)
3024- Q_PROPERTY(QString renderName READ renderName NOTIFY renderNameChanged)
3025- Q_PROPERTY(QString title READ title NOTIFY titleChanged)
3026- Q_PROPERTY(QString subTitle READ subTitle NOTIFY subTitleChanged)
3027- Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
3028- Q_PROPERTY(QString imageSource READ imageSource NOTIFY imageSourceChanged)
3029- // Read only properties containing PeoplePreview specific information
3030- Q_PROPERTY(QString displayName READ displayName NOTIFY displayNameChanged)
3031- Q_PROPERTY(QQmlListProperty<PeopleAddressData> emailAddresses READ emailAddresses NOTIFY emailAddressesChanged)
3032- Q_PROPERTY(QQmlListProperty<PeoplePhoneData> phoneNumbers READ phoneNumbers NOTIFY phoneNumbersChanged)
3033- Q_PROPERTY(QQmlListProperty<PeopleIMData> imAccounts READ imAccounts NOTIFY imAccountsChanged)
3034- Q_PROPERTY(QString status READ status NOTIFY statusChanged)
3035- Q_PROPERTY(QString statusTime READ statusTime NOTIFY statusTimeChanged)
3036- Q_PROPERTY(QString statusService READ statusService NOTIFY statusServiceChanged)
3037- Q_PROPERTY(QString statusServiceIcon READ statusServiceIcon NOTIFY statusServiceIconChanged)
3038- Q_PROPERTY(QString statusPostUri READ statusPostUri NOTIFY statusPostUriChanged)
3039- Q_PROPERTY(QQmlListProperty<PeopleAddressData> addresses READ addresses NOTIFY addressesChanged)
3040- Q_PROPERTY(QString avatar READ avatar NOTIFY avatarChanged)
3041-
3042-public:
3043- PeoplePreviewData(QObject *parent = 0);
3044- ~PeoplePreviewData();
3045-
3046- void setUnityPeoplePreview(const unity::dash::Preview::Ptr& preview);
3047- void setLens(Lens *lens);
3048- void setUri(const QString &uri);
3049-
3050- Lens *lens() const;
3051- QString uri() const;
3052- bool ready() const;
3053- QString renderName() const;
3054- QString title() const;
3055- QString subTitle() const;
3056- QString description() const;
3057- QString imageSource() const;
3058- QString displayName() const;
3059- QQmlListProperty<PeoplePhoneData> phoneNumbers();
3060- QQmlListProperty<PeopleAddressData> emailAddresses();
3061- QQmlListProperty<PeopleIMData> imAccounts();
3062- QString status() const;
3063- QString statusTime() const;
3064- QString statusService() const;
3065- QString statusServiceIcon() const;
3066- QString statusPostUri() const;
3067- QQmlListProperty<PeopleAddressData> addresses();
3068- QString avatar() const;
3069-
3070- QList<PeoplePhoneData*> &phoneNumberList() { return m_phoneList; }
3071- QList<PeopleAddressData*> &emailAddressesList() { return m_emailList; }
3072- QList<PeopleIMData*> &imAccountsList() { return m_imList; }
3073- QList<PeopleAddressData*> &addressesList() { return m_addressList; }
3074-
3075-Q_SIGNALS:
3076- void lensChanged();
3077- void uriChanged();
3078- void readyChanged();
3079- void renderNameChanged();
3080- void titleChanged();
3081- void subTitleChanged();
3082- void descriptionChanged();
3083- void imageSourceChanged();
3084- void displayNameChanged();
3085- void phoneNumbersChanged();
3086- void emailAddressesChanged();
3087- void imAccountsChanged();
3088- void statusChanged();
3089- void statusTimeChanged();
3090- void statusServiceChanged();
3091- void statusServiceIconChanged();
3092- void statusPostUriChanged();
3093- void addressesChanged();
3094- void avatarChanged();
3095- void error();
3096-
3097-private:
3098- void setReady(const bool &ready);
3099- void getPeoplePreview();
3100- void setUnityPreview(std::string const& uri, unity::dash::Preview::Ptr const& preview);
3101- void clearData();
3102- void getPhoneData();
3103- void getEmailAddresses();
3104- void getImAccounts();
3105- void getAddresses();
3106-
3107- Lens *m_lens;
3108- sigc::connection m_lensConnection;
3109- QString m_uri;
3110- bool m_ready;
3111- unity::dash::PeoplePreview::Ptr m_unityPreview;
3112-
3113- QList<PeoplePhoneData*> m_phoneList;
3114- QList<PeopleAddressData*> m_addressList;
3115- QList<PeopleIMData*> m_imList;
3116- QList<PeopleAddressData*> m_emailList;
3117-};
3118-
3119-#endif // PEOPLEPREVIEWDATA_H
3120
3121=== modified file 'plugins/Unity/plugin.cpp'
3122--- plugins/Unity/plugin.cpp 2013-06-05 22:03:08 +0000
3123+++ plugins/Unity/plugin.cpp 2013-06-19 20:05:35 +0000
3124@@ -24,11 +24,10 @@
3125 #include "plugin.h"
3126
3127 // local
3128-#include "lens.h"
3129-#include "lenses.h"
3130+#include "scope.h"
3131+#include "scopes.h"
3132 #include "categories.h"
3133 #include "categoryfilter.h"
3134-#include "peoplepreviewdata.h"
3135 #include "bottombarvisibilitycommunicatorshell.h"
3136 #include "launchermodel.h"
3137
3138@@ -41,15 +40,11 @@
3139 void UnityPlugin::registerTypes(const char *uri)
3140 {
3141 Q_ASSERT(uri == QLatin1String("Unity"));
3142- qmlRegisterType<Lens>(uri, 0, 1, "Lens");
3143- qmlRegisterType<Lenses>(uri, 0, 1, "Lenses");
3144+ qmlRegisterType<Scope>(uri, 0, 1, "Scope");
3145+ qmlRegisterType<Scopes>(uri, 0, 1, "Scopes");
3146 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
3147 qmlRegisterType<CategoryFilter>(uri, 0, 1, "CategoryFilter");
3148 qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");
3149- qmlRegisterType<PeoplePreviewData>(uri, 0, 1, "PeoplePreviewData");
3150- qmlRegisterType<PeoplePhoneData>(uri, 0, 1, "PeoplePhoneData");
3151- qmlRegisterType<PeopleAddressData>(uri, 0, 1, "PeopleAddressData");
3152- qmlRegisterType<PeopleIMData>(uri, 0, 1, "PeopleIMData");
3153 qmlRegisterType<LauncherModel>(uri, 0, 1, "LauncherModel");
3154 qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", "Can't create new Launcher Items in QML. Get them from the LauncherModel.");
3155 qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
3156
3157=== renamed file 'plugins/Unity/lens.cpp' => 'plugins/Unity/scope.cpp'
3158--- plugins/Unity/lens.cpp 2013-06-05 22:03:08 +0000
3159+++ plugins/Unity/scope.cpp 2013-06-19 20:05:35 +0000
3160@@ -18,7 +18,7 @@
3161 */
3162
3163 // Self
3164-#include "lens.h"
3165+#include "scope.h"
3166 #include "categories.h"
3167
3168 // Qt
3169@@ -28,113 +28,76 @@
3170
3171 #include <libintl.h>
3172
3173-Lens::Lens(QObject *parent) :
3174+Scope::Scope(QObject *parent) :
3175 QObject(parent)
3176 {
3177 m_results = new DeeListModel(this);
3178- m_globalResults = new DeeListModel(this);
3179 m_categories = new Categories(this);
3180
3181 m_categories->setResultModel(m_results);
3182- m_categories->setGlobalResultModel(m_globalResults);
3183-}
3184-
3185-QString Lens::id() const
3186-{
3187- return QString::fromStdString(m_unityLens->id());
3188-}
3189-
3190-QString Lens::dbusName() const
3191-{
3192- return QString::fromStdString(m_unityLens->dbus_name());
3193-}
3194-
3195-QString Lens::dbusPath() const
3196-{
3197- return QString::fromStdString(m_unityLens->dbus_path());
3198-}
3199-
3200-QString Lens::name() const
3201-{
3202- return QString::fromStdString(m_unityLens->name());
3203-}
3204-
3205-QString Lens::iconHint() const
3206-{
3207- return QString::fromStdString(m_unityLens->icon_hint());
3208-}
3209-
3210-QString Lens::description() const
3211-{
3212- return QString::fromStdString(m_unityLens->description());
3213-}
3214-
3215-QString Lens::searchHint() const
3216-{
3217- return QString::fromStdString(m_unityLens->search_hint());
3218-}
3219-
3220-bool Lens::visible() const
3221-{
3222- return m_unityLens->visible();
3223-}
3224-
3225-bool Lens::searchInGlobal() const
3226-{
3227- return m_unityLens->search_in_global();
3228-}
3229-
3230-QString Lens::shortcut() const
3231-{
3232- return QString::fromStdString(m_unityLens->shortcut());
3233-}
3234-
3235-bool Lens::connected() const
3236-{
3237- return m_unityLens->connected();
3238-}
3239-
3240-DeeListModel* Lens::results() const
3241+}
3242+
3243+QString Scope::id() const
3244+{
3245+ return QString::fromStdString(m_unityScope->id());
3246+}
3247+
3248+QString Scope::name() const
3249+{
3250+ return QString::fromStdString(m_unityScope->name());
3251+}
3252+
3253+QString Scope::iconHint() const
3254+{
3255+ return QString::fromStdString(m_unityScope->icon_hint());
3256+}
3257+
3258+QString Scope::description() const
3259+{
3260+ return QString::fromStdString(m_unityScope->description());
3261+}
3262+
3263+QString Scope::searchHint() const
3264+{
3265+ return QString::fromStdString(m_unityScope->search_hint());
3266+}
3267+
3268+bool Scope::visible() const
3269+{
3270+ return m_unityScope->visible();
3271+}
3272+
3273+QString Scope::shortcut() const
3274+{
3275+ return QString::fromStdString(m_unityScope->shortcut());
3276+}
3277+
3278+bool Scope::connected() const
3279+{
3280+ return m_unityScope->connected();
3281+}
3282+
3283+DeeListModel* Scope::results() const
3284 {
3285 return m_results;
3286 }
3287
3288-DeeListModel* Lens::globalResults() const
3289-{
3290- return m_globalResults;
3291-}
3292-
3293-Categories* Lens::categories() const
3294+Categories* Scope::categories() const
3295 {
3296 return m_categories;
3297 }
3298
3299-Lens::ViewType Lens::viewType() const
3300-{
3301- return (Lens::ViewType) m_unityLens->view_type();
3302-}
3303-
3304-QString Lens::searchQuery() const
3305+QString Scope::searchQuery() const
3306 {
3307 return m_searchQuery;
3308 }
3309
3310-QString Lens::globalSearchQuery() const
3311-{
3312- return m_globalSearchQuery;
3313-}
3314-
3315-QString Lens::noResultsHint() const
3316+QString Scope::noResultsHint() const
3317 {
3318 return m_noResultsHint;
3319 }
3320
3321-void Lens::setViewType(const Lens::ViewType& viewType)
3322-{
3323- m_unityLens->view_type = (unity::dash::ViewType) viewType;
3324-}
3325-
3326-void Lens::setSearchQuery(const QString& search_query)
3327+void Scope::setSearchQuery(const QString& search_query)
3328 {
3329 /* Checking for m_searchQuery.isNull() which returns true only when the string
3330 has never been set is necessary because when search_query is the empty
3331@@ -143,48 +106,37 @@
3332 */
3333 if (m_searchQuery.isNull() || search_query != m_searchQuery) {
3334 m_searchQuery = search_query;
3335- m_unityLens->Search(search_query.toStdString(), sigc::mem_fun(this, &Lens::searchFinished));
3336+ m_unityScope->Search(search_query.toStdString(), sigc::mem_fun(this, &Scope::searchFinished));
3337 Q_EMIT searchQueryChanged();
3338 }
3339 }
3340
3341-void Lens::setGlobalSearchQuery(const QString& search_query)
3342-{
3343- /* Checking for m_globalSearchQuery.isNull() which returns true only when the string
3344- has never been set is necessary because when search_query is the empty
3345- string ("") and m_globalSearchQuery is the null string,
3346- search_query != m_globalSearchQuery is still true.
3347- */
3348- if (m_globalSearchQuery.isNull() || search_query != m_globalSearchQuery) {
3349- m_globalSearchQuery = search_query;
3350- m_unityLens->GlobalSearch(search_query.toStdString(), sigc::mem_fun(this, &Lens::globalSearchFinished));
3351- Q_EMIT globalSearchQueryChanged();
3352- }
3353-}
3354-
3355-void Lens::setNoResultsHint(const QString& hint) {
3356+void Scope::setNoResultsHint(const QString& hint) {
3357 if (hint != m_noResultsHint) {
3358 m_noResultsHint = hint;
3359 Q_EMIT noResultsHintChanged();
3360 }
3361 }
3362
3363-void Lens::activate(const QString& uri)
3364+void Scope::activate(const QString& /*uri*/)
3365 {
3366- m_unityLens->Activate(QByteArray::fromPercentEncoding(uri.toUtf8()).constData());
3367+ // TODO:
3368+ // we need to create unity::dash::LocalResult (see UnityCore/Result.h) and pass it to Activate;
3369+ // this requires entire row from the model, so we need row index rather than uri.
3370+ // m_unityScope->Activate(QByteArray::fromPercentEncoding(uri.toUtf8()).constData());
3371 }
3372
3373-void Lens::onActivated(std::string const& uri, unity::dash::HandledType type, unity::dash::Lens::Hints const&)
3374+void Scope::onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const&)
3375 {
3376 if (type == unity::dash::NOT_HANDLED) {
3377- fallbackActivate(QString::fromStdString(uri));
3378+ fallbackActivate(QString::fromStdString(result.uri));
3379 }
3380 }
3381
3382-void Lens::fallbackActivate(const QString& uri)
3383+void Scope::fallbackActivate(const QString& uri)
3384 {
3385 /* FIXME: stripping all content before the first column because for some
3386- reason the lenses give uri with junk content at their beginning.
3387+ reason the scopes give uri with junk content at their beginning.
3388 */
3389 QString tweakedUri = uri;
3390 int firstColumnAt = tweakedUri.indexOf(":");
3391@@ -215,118 +167,101 @@
3392 QDesktopServices::openUrl(url);
3393 }
3394
3395-void Lens::setUnityLens(const unity::dash::Lens::Ptr& lens)
3396+void Scope::setUnityScope(const unity::dash::Scope::Ptr& scope)
3397 {
3398- m_unityLens = lens;
3399-
3400- if (QString::fromStdString(m_unityLens->results()->swarm_name) == QString(":local")) {
3401- m_results->setModel(m_unityLens->results()->model());
3402- } else {
3403- m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
3404- }
3405- if (QString::fromStdString(m_unityLens->global_results()->swarm_name) == QString(":local")) {
3406- m_globalResults->setModel(m_unityLens->global_results()->model());
3407- } else {
3408- m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
3409- }
3410- if (QString::fromStdString(m_unityLens->categories()->swarm_name) == QString(":local")) {
3411- m_categories->setModel(m_unityLens->categories()->model());
3412- } else {
3413- m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
3414+ m_unityScope = scope;
3415+
3416+ if (QString::fromStdString(m_unityScope->results()->swarm_name) == QString(":local")) {
3417+ m_results->setModel(m_unityScope->results()->model());
3418+ } else {
3419+ m_results->setName(QString::fromStdString(m_unityScope->results()->swarm_name));
3420+ }
3421+
3422+ if (QString::fromStdString(m_unityScope->categories()->swarm_name) == QString(":local")) {
3423+ m_categories->setModel(m_unityScope->categories()->model());
3424+ } else {
3425+ m_categories->setName(QString::fromStdString(m_unityScope->categories()->swarm_name));
3426 }
3427
3428 /* Property change signals */
3429- m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged));
3430- m_unityLens->dbus_name.changed.connect(sigc::mem_fun(this, &Lens::dbusNameChanged));
3431- m_unityLens->dbus_path.changed.connect(sigc::mem_fun(this, &Lens::dbusPathChanged));
3432- m_unityLens->name.changed.connect(sigc::mem_fun(this, &Lens::nameChanged));
3433- m_unityLens->icon_hint.changed.connect(sigc::mem_fun(this, &Lens::iconHintChanged));
3434- m_unityLens->description.changed.connect(sigc::mem_fun(this, &Lens::descriptionChanged));
3435- m_unityLens->search_hint.changed.connect(sigc::mem_fun(this, &Lens::searchHintChanged));
3436- m_unityLens->visible.changed.connect(sigc::mem_fun(this, &Lens::visibleChanged));
3437- m_unityLens->search_in_global.changed.connect(sigc::mem_fun(this, &Lens::searchInGlobalChanged));
3438- m_unityLens->shortcut.changed.connect(sigc::mem_fun(this, &Lens::shortcutChanged));
3439- m_unityLens->connected.changed.connect(sigc::mem_fun(this, &Lens::connectedChanged));
3440- m_unityLens->results.changed.connect(sigc::mem_fun(this, &Lens::onResultsChanged));
3441- m_unityLens->results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onResultsSwarmNameChanged));
3442- m_unityLens->global_results.changed.connect(sigc::mem_fun(this, &Lens::onGlobalResultsChanged));
3443- m_unityLens->global_results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onGlobalResultsSwarmNameChanged));
3444- m_unityLens->categories.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesChanged));
3445- m_unityLens->categories()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesSwarmNameChanged));
3446- m_unityLens->view_type.changed.connect(sigc::mem_fun(this, &Lens::onViewTypeChanged));
3447-
3448+ m_unityScope->id.changed.connect(sigc::mem_fun(this, &Scope::idChanged));
3449+ m_unityScope->name.changed.connect(sigc::mem_fun(this, &Scope::nameChanged));
3450+ m_unityScope->icon_hint.changed.connect(sigc::mem_fun(this, &Scope::iconHintChanged));
3451+ m_unityScope->description.changed.connect(sigc::mem_fun(this, &Scope::descriptionChanged));
3452+ m_unityScope->search_hint.changed.connect(sigc::mem_fun(this, &Scope::searchHintChanged));
3453+ m_unityScope->visible.changed.connect(sigc::mem_fun(this, &Scope::visibleChanged));
3454+ m_unityScope->shortcut.changed.connect(sigc::mem_fun(this, &Scope::shortcutChanged));
3455+ m_unityScope->connected.changed.connect(sigc::mem_fun(this, &Scope::connectedChanged));
3456+ m_unityScope->results.changed.connect(sigc::mem_fun(this, &Scope::onResultsChanged));
3457+ m_unityScope->results()->swarm_name.changed.connect(sigc::mem_fun(this, &Scope::onResultsSwarmNameChanged));
3458+ m_unityScope->results()->model.changed.connect(sigc::mem_fun(this, &Scope::onResultsModelChanged));
3459+ m_unityScope->categories()->model.changed.connect(sigc::mem_fun(this, &Scope::onCategoriesModelChanged));
3460+ m_unityScope->categories.changed.connect(sigc::mem_fun(this, &Scope::onCategoriesChanged));
3461+ m_unityScope->categories()->swarm_name.changed.connect(sigc::mem_fun(this, &Scope::onCategoriesSwarmNameChanged));
3462 /* Signals forwarding */
3463- connect(this, SIGNAL(searchFinished(unity::dash::Lens::Hints const &, unity::glib::Error const &)), SLOT(onSearchFinished(unity::dash::Lens::Hints const &)));
3464+ connect(this, SIGNAL(searchFinished(const std::string &, unity::glib::HintsMap const &, unity::glib::Error const &)), SLOT(onSearchFinished(const std::string &, unity::glib::HintsMap const &)));
3465
3466 /* FIXME: signal should be forwarded instead of calling the handler directly */
3467- m_unityLens->activated.connect(sigc::mem_fun(this, &Lens::onActivated));
3468+ m_unityScope->activated.connect(sigc::mem_fun(this, &Scope::onActivated));
3469
3470- /* Synchronize local states with m_unityLens right now and whenever
3471- m_unityLens becomes connected */
3472+ /* Synchronize local states with m_unityScope right now and whenever
3473+ m_unityScope becomes connected */
3474 /* FIXME: should emit change notification signals for all properties */
3475 connect(this, SIGNAL(connectedChanged(bool)), SLOT(synchronizeStates()));
3476 synchronizeStates();
3477 }
3478
3479-unity::dash::Lens::Ptr Lens::unityLens() const
3480+unity::dash::Scope::Ptr Scope::unityScope() const
3481 {
3482- return m_unityLens;
3483+ return m_unityScope;
3484 }
3485
3486-void Lens::synchronizeStates()
3487+void Scope::synchronizeStates()
3488 {
3489 if (connected()) {
3490- /* Forward local states to m_unityLens */
3491+ /* Forward local states to m_unityScope */
3492 if (!m_searchQuery.isNull()) {
3493- m_unityLens->Search(m_searchQuery.toStdString());
3494- }
3495- if (!m_globalSearchQuery.isNull()) {
3496- m_unityLens->GlobalSearch(m_globalSearchQuery.toStdString());
3497+ m_unityScope->Search(m_searchQuery.toStdString());
3498 }
3499 }
3500 }
3501
3502-void Lens::onResultsSwarmNameChanged(const std::string& /* swarm_name */)
3503-{
3504- m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
3505-}
3506-
3507-void Lens::onResultsChanged(const unity::dash::Results::Ptr& /* results */)
3508-{
3509- m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
3510-}
3511-
3512-void Lens::onGlobalResultsSwarmNameChanged(const std::string& /* swarm_name */)
3513-{
3514- m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
3515-}
3516-
3517-void Lens::onGlobalResultsChanged(const unity::dash::Results::Ptr& /* global_results */)
3518-{
3519- m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
3520-}
3521-
3522-void Lens::onCategoriesSwarmNameChanged(const std::string& /* swarm_name */)
3523-{
3524- m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
3525-}
3526-
3527-void Lens::onCategoriesChanged(const unity::dash::Categories::Ptr& /* categories */)
3528-{
3529- m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
3530-}
3531-
3532-void Lens::onViewTypeChanged(unity::dash::ViewType viewType)
3533-{
3534- Q_EMIT viewTypeChanged( (Lens::ViewType) viewType);
3535-}
3536-
3537-void Lens::onSearchFinished(unity::dash::Lens::Hints const &hints)
3538+void Scope::onResultsSwarmNameChanged(const std::string& /* swarm_name */)
3539+{
3540+ m_results->setName(QString::fromStdString(m_unityScope->results()->swarm_name));
3541+}
3542+
3543+void Scope::onResultsChanged(const unity::dash::Results::Ptr& /* results */)
3544+{
3545+ m_results->setName(QString::fromStdString(m_unityScope->results()->swarm_name));
3546+}
3547+
3548+void Scope::onResultsModelChanged(unity::glib::Object<DeeModel> /* model */)
3549+{
3550+ m_results->setModel(m_unityScope->results()->model());
3551+}
3552+
3553+void Scope::onCategoriesSwarmNameChanged(const std::string& /* swarm_name */)
3554+{
3555+ m_categories->setName(QString::fromStdString(m_unityScope->categories()->swarm_name));
3556+}
3557+
3558+void Scope::onCategoriesChanged(const unity::dash::Categories::Ptr& /* categories */)
3559+{
3560+ m_categories->setName(QString::fromStdString(m_unityScope->categories()->swarm_name));
3561+}
3562+
3563+void Scope::onCategoriesModelChanged(unity::glib::Object<DeeModel> model)
3564+{
3565+ m_categories->setModel(model);
3566+}
3567+
3568+void Scope::onSearchFinished(const std::string& /* query */, unity::glib::HintsMap const &hints)
3569 {
3570 QString hint;
3571
3572- if (!m_unityLens->results()->count()) {
3573- unity::dash::Lens::Hints::const_iterator it = hints.find("no-results-hint");
3574+ if (!m_unityScope->results()->count()) {
3575+ unity::glib::HintsMap::const_iterator it = hints.find("no-results-hint");
3576 if (it != hints.end()) {
3577 hint = QString::fromStdString(it->second.GetString());
3578 } else {
3579
3580=== renamed file 'plugins/Unity/lens.h' => 'plugins/Unity/scope.h'
3581--- plugins/Unity/lens.h 2013-06-05 22:03:08 +0000
3582+++ plugins/Unity/scope.h 2013-06-19 20:05:35 +0000
3583@@ -17,8 +17,8 @@
3584 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3585 */
3586
3587-#ifndef LENS_H
3588-#define LENS_H
3589+#ifndef SCOPE_H
3590+#define SCOPE_H
3591
3592 // Qt
3593 #include <QObject>
3594@@ -26,76 +26,56 @@
3595 #include <QMetaType>
3596
3597 // libunity-core
3598-#include <UnityCore/Lens.h>
3599+#include <UnityCore/Scope.h>
3600+#include <UnityCore/Results.h>
3601
3602 // dee-qt
3603 #include "deelistmodel.h"
3604
3605 class Categories;
3606
3607-class Lens : public QObject
3608+class Scope : public QObject
3609 {
3610 Q_OBJECT
3611- Q_ENUMS(ViewType)
3612
3613 Q_PROPERTY(QString id READ id NOTIFY idChanged)
3614- Q_PROPERTY(QString dbusName READ dbusName NOTIFY dbusNameChanged)
3615- Q_PROPERTY(QString dbusPath READ dbusPath NOTIFY dbusPathChanged)
3616 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
3617 Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)
3618 Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
3619 Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged)
3620 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
3621- Q_PROPERTY(bool searchInGlobal READ searchInGlobal NOTIFY searchInGlobalChanged)
3622 Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged)
3623 Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged)
3624 Q_PROPERTY(DeeListModel* results READ results NOTIFY resultsChanged)
3625- Q_PROPERTY(DeeListModel* globalResults READ globalResults NOTIFY globalResultsChanged)
3626 Q_PROPERTY(Categories* categories READ categories NOTIFY categoriesChanged)
3627- Q_PROPERTY(ViewType viewType READ viewType WRITE setViewType NOTIFY viewTypeChanged)
3628
3629 Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
3630- Q_PROPERTY(QString globalSearchQuery READ globalSearchQuery WRITE setGlobalSearchQuery NOTIFY globalSearchQueryChanged)
3631 Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged)
3632
3633 public:
3634- explicit Lens(QObject *parent = 0);
3635-
3636- enum ViewType {
3637- Hidden,
3638- HomeView,
3639- LensView
3640- };
3641+ explicit Scope(QObject *parent = 0);
3642
3643 /* getters */
3644 QString id() const;
3645- QString dbusName() const;
3646- QString dbusPath() const;
3647 QString name() const;
3648 QString iconHint() const;
3649 QString description() const;
3650 QString searchHint() const;
3651 bool visible() const;
3652- bool searchInGlobal() const;
3653 QString shortcut() const;
3654 bool connected() const;
3655 DeeListModel* results() const;
3656- DeeListModel* globalResults() const;
3657 Categories* categories() const;
3658- ViewType viewType() const;
3659 QString searchQuery() const;
3660- QString globalSearchQuery() const;
3661 QString noResultsHint() const;
3662
3663 /* setters */
3664- void setViewType(const ViewType& viewType);
3665 void setSearchQuery(const QString& search_query);
3666- void setGlobalSearchQuery(const QString& search_query);
3667 void setNoResultsHint(const QString& hint);
3668
3669 Q_INVOKABLE void activate(const QString& uri);
3670- void setUnityLens(const unity::dash::Lens::Ptr& lens);
3671- unity::dash::Lens::Ptr unityLens() const;
3672+ void setUnityScope(const unity::dash::Scope::Ptr& scope);
3673+ unity::dash::Scope::Ptr unityScope() const;
3674
3675 Q_SIGNALS:
3676 void idChanged(const std::string&);
3677@@ -106,44 +86,36 @@
3678 void descriptionChanged(const std::string&);
3679 void searchHintChanged(const std::string&);
3680 void visibleChanged(bool);
3681- void searchInGlobalChanged(bool);
3682 void shortcutChanged(const std::string&);
3683 void connectedChanged(bool);
3684 void resultsChanged();
3685- void globalResultsChanged();
3686 void categoriesChanged();
3687- void viewTypeChanged(ViewType);
3688- void searchFinished(unity::dash::Lens::Hints const&, unity::glib::Error const&);
3689- void globalSearchFinished(unity::dash::Lens::Hints const&, unity::glib::Error const&);
3690+ void searchFinished(const std::string&, unity::glib::HintsMap const&, unity::glib::Error const&);
3691 void searchQueryChanged();
3692- void globalSearchQueryChanged();
3693 void noResultsHintChanged();
3694
3695 private Q_SLOTS:
3696 void synchronizeStates();
3697- void onSearchFinished(unity::dash::Lens::Hints const &);
3698+ void onSearchFinished(const std::string &, unity::glib::HintsMap const &);
3699
3700 private:
3701 void onResultsSwarmNameChanged(const std::string&);
3702 void onResultsChanged(const unity::dash::Results::Ptr&);
3703- void onGlobalResultsSwarmNameChanged(const std::string&);
3704- void onGlobalResultsChanged(const unity::dash::Results::Ptr&);
3705+ void onResultsModelChanged(unity::glib::Object<DeeModel>);
3706 void onCategoriesSwarmNameChanged(const std::string&);
3707+ void onCategoriesModelChanged(unity::glib::Object<DeeModel>);
3708 void onCategoriesChanged(const unity::dash::Categories::Ptr&);
3709- void onViewTypeChanged(unity::dash::ViewType);
3710
3711- void onActivated(std::string const& uri, unity::dash::HandledType type, unity::dash::Lens::Hints const&);
3712+ void onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const&);
3713 void fallbackActivate(const QString& uri);
3714
3715- unity::dash::Lens::Ptr m_unityLens;
3716+ unity::dash::Scope::Ptr m_unityScope;
3717 DeeListModel* m_results;
3718- DeeListModel* m_globalResults;
3719 Categories* m_categories;
3720 QString m_searchQuery;
3721- QString m_globalSearchQuery;
3722 QString m_noResultsHint;
3723 };
3724
3725-Q_DECLARE_METATYPE(Lens*)
3726+Q_DECLARE_METATYPE(Scope*)
3727
3728-#endif // LENS_H
3729+#endif // SCOPE_H
3730
3731=== renamed file 'plugins/Unity/lenses.cpp' => 'plugins/Unity/scopes.cpp'
3732--- plugins/Unity/lenses.cpp 2013-06-05 22:03:08 +0000
3733+++ plugins/Unity/scopes.cpp 2013-06-19 20:05:35 +0000
3734@@ -18,49 +18,44 @@
3735 */
3736
3737 // Self
3738-#include "lenses.h"
3739+#include "scopes.h"
3740
3741 // Local
3742-#include "lens.h"
3743+#include "scope.h"
3744
3745 // Qt
3746 #include <QDebug>
3747 #include <QtCore/QStringList>
3748 #include <QtGui/QKeySequence>
3749
3750-// libunity-core
3751-#include <UnityCore/FilesystemLenses.h>
3752-#include <UnityCore/HomeLens.h>
3753-
3754-Lenses::Lenses(QObject *parent)
3755+Scopes::Scopes(QObject *parent)
3756 : QAbstractListModel(parent)
3757- , m_unityLenses(std::make_shared<unity::dash::FilesystemLenses>())
3758- , m_homeLens(std::make_shared<unity::dash::HomeLens>(QString::fromUtf8(dgettext("unity", "Home")).toStdString(),
3759- QString::fromUtf8(dgettext("unity", "Home screen")).toStdString(),
3760- QString::fromUtf8(dgettext("unity", "Search")).toStdString()))
3761+ , m_unityScopes(std::make_shared<unity::dash::GSettingsScopes>())
3762 , m_loaded(false)
3763 {
3764- m_roles[Lenses::RoleLens] = "lens";
3765- m_roles[Lenses::RoleId] = "id";
3766- m_roles[Lenses::RoleVisible] = "visible";
3767+ m_roles[Scopes::RoleScope] = "scope";
3768+ m_roles[Scopes::RoleId] = "id";
3769+ m_roles[Scopes::RoleVisible] = "visible";
3770
3771- m_homeLens->AddLenses(m_unityLenses);
3772- std::dynamic_pointer_cast<unity::dash::FilesystemLenses>(m_unityLenses)->lenses_loaded.connect(sigc::mem_fun(this, &Lenses::onLensesLoaded));
3773+ m_unityScopes->scope_added.connect(sigc::mem_fun(this, &Scopes::onScopeAdded));
3774+ m_unityScopes->scope_removed.connect(sigc::mem_fun(this, &Scopes::onScopeRemoved));
3775+ m_unityScopes->scopes_reordered.connect(sigc::mem_fun(this, &Scopes::onScopesReordered));
3776+ m_unityScopes->LoadScopes();
3777 }
3778
3779-QHash<int, QByteArray> Lenses::roleNames() const
3780+QHash<int, QByteArray> Scopes::roleNames() const
3781 {
3782 return m_roles;
3783 }
3784
3785-int Lenses::rowCount(const QModelIndex& parent) const
3786+int Scopes::rowCount(const QModelIndex& parent) const
3787 {
3788 Q_UNUSED(parent)
3789
3790- return m_lenses.count();
3791+ return m_scopes.count();
3792 }
3793
3794-QVariant Lenses::data(const QModelIndex& index, int role) const
3795+QVariant Scopes::data(const QModelIndex& index, int role) const
3796 {
3797 Q_UNUSED(role)
3798
3799@@ -68,115 +63,114 @@
3800 return QVariant();
3801 }
3802
3803- Lens* lens = m_lenses.at(index.row());
3804+ Scope* scope = m_scopes.at(index.row());
3805
3806- if (role == Lenses::RoleLens) {
3807- return QVariant::fromValue(lens);
3808- } else if (role == Lenses::RoleId) {
3809- return QVariant::fromValue(lens->id());
3810- } else if (role == Lenses::RoleVisible) {
3811- return QVariant::fromValue(lens->visible());
3812+ if (role == Scopes::RoleScope) {
3813+ return QVariant::fromValue(scope);
3814+ } else if (role == Scopes::RoleId) {
3815+ return QVariant::fromValue(scope->id());
3816+ } else if (role == Scopes::RoleVisible) {
3817+ return QVariant::fromValue(scope->visible());
3818 } else {
3819 return QVariant();
3820 }
3821 }
3822
3823-QVariant Lenses::get(int row) const
3824+QVariant Scopes::get(int row) const
3825 {
3826 return data(QAbstractListModel::index(row), 0);
3827 }
3828
3829-QVariant Lenses::get(const QString& lens_id) const
3830+QVariant Scopes::get(const QString& scope_id) const
3831 {
3832- Q_FOREACH(Lens* lens, m_lenses) {
3833- if (lens->id() == lens_id) {
3834- return QVariant::fromValue(lens);
3835+ Q_FOREACH(Scope* scope, m_scopes) {
3836+ if (scope->id() == scope_id) {
3837+ return QVariant::fromValue(scope);
3838 }
3839 }
3840
3841 return QVariant();
3842 }
3843
3844-bool Lenses::loaded() const
3845+bool Scopes::loaded() const
3846 {
3847 return m_loaded;
3848 }
3849
3850-void Lenses::onLensAdded(const unity::dash::Lens::Ptr& lens)
3851+void Scopes::onScopeAdded(const unity::dash::Scope::Ptr& scope, int /*position*/)
3852 {
3853- int index = m_lenses.count();
3854+ int index = m_scopes.count();
3855 beginInsertRows(QModelIndex(), index, index);
3856- addUnityLens(lens);
3857+ addUnityScope(scope);
3858 endInsertRows();
3859-}
3860-
3861-void Lenses::onLensesLoaded()
3862-{
3863- /* FIXME: this is temporary code that is required on mobile to order
3864- the lenses according to the design.
3865- */
3866- QStringList staticLenses;
3867- staticLenses << "mockmusic.lens" << "people.lens" << "home.lens" << "applications.lens" << "mockvideos.lens";
3868-
3869- // not all the lenses are guaranteed to go into the model (only if their UnitCore counterparts exist);
3870- // so build up a list of the valid ones, then add them later.
3871- QList<unity::dash::Lens::Ptr> added_lenses;
3872-
3873- // add statically ordered lenses
3874- Q_FOREACH(QString lensId, staticLenses) {
3875- if (lensId == "home.lens") {
3876- added_lenses << m_homeLens;
3877- } else {
3878- unity::dash::Lens::Ptr lens = m_unityLenses->GetLens(lensId.toStdString());
3879- if (lens != NULL) {
3880- added_lenses << lens;
3881- }
3882- }
3883- }
3884-
3885- // add remaining lenses
3886- unity::dash::Lenses::LensList lensesList = m_unityLenses->GetLenses();
3887- for(auto it = lensesList.begin(); it != lensesList.end(); ++it) {
3888- unity::dash::Lens::Ptr lens = (*it);
3889- if (!staticLenses.contains(QString::fromStdString(lens->id))) {
3890- added_lenses << lens;
3891- }
3892- }
3893-
3894- if (added_lenses.count() > 0) {
3895- int index = rowCount();
3896- beginInsertRows(QModelIndex(), index, index+added_lenses.count()-1);
3897- Q_FOREACH(unity::dash::Lens::Ptr lens, added_lenses) {
3898- addUnityLens(lens);
3899- }
3900- endInsertRows();
3901- }
3902-
3903+
3904+ // FIXME: do only once after all loaded?
3905 m_loaded = true;
3906 Q_EMIT loadedChanged(m_loaded);
3907-
3908- // listen to dynamically added lenses
3909- m_homeLens->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded));
3910-}
3911-
3912-void Lenses::onLensPropertyChanged()
3913-{
3914- QModelIndex lensIndex = index(m_lenses.indexOf(qobject_cast<Lens*>(sender())));
3915- Q_EMIT dataChanged(lensIndex, lensIndex);
3916-}
3917-
3918-void Lenses::addUnityLens(const unity::dash::Lens::Ptr& unity_lens)
3919-{
3920- Lens* lens = new Lens(this);
3921- lens->setUnityLens(unity_lens);
3922+}
3923+
3924+void Scopes::onScopesLoaded()
3925+{
3926+}
3927+
3928+void Scopes::onScopeRemoved(const unity::dash::Scope::Ptr& scope)
3929+{
3930+ auto id = QString::fromStdString(scope->id);
3931+ auto index = findScopeById(id);
3932+ if (index >= 0) {
3933+ beginRemoveRows(QModelIndex(), index, index);
3934+ removeUnityScope(index);
3935+ endRemoveRows();
3936+
3937+ Q_EMIT scopeRemoved(id, index);
3938+ }
3939+}
3940+
3941+void Scopes::onScopesReordered(const unity::dash::Scopes::ScopeList& scopes)
3942+{
3943+ // FIXME Should use beginMoveRows()/endMoveRows() to not recreate the UI for every scope.
3944+ beginResetModel();
3945+
3946+ // remove existing scopes
3947+ for (auto i=m_scopes.count()-1; i>=0; i--) {
3948+ removeUnityScope(i);
3949+ }
3950+
3951+ // re-create scopes
3952+ for (uint i=0; i<scopes.size(); i++) {
3953+ addUnityScope(scopes[i]);
3954+ }
3955+ endResetModel();
3956+}
3957+
3958+void Scopes::onScopePropertyChanged()
3959+{
3960+ QModelIndex scopeIndex = index(m_scopes.indexOf(qobject_cast<Scope*>(sender())));
3961+ Q_EMIT dataChanged(scopeIndex, scopeIndex);
3962+}
3963+
3964+void Scopes::addUnityScope(const unity::dash::Scope::Ptr& unity_scope)
3965+{
3966+ Scope* scope = new Scope(this);
3967+ scope->setUnityScope(unity_scope);
3968 /* DOCME */
3969- QObject::connect(lens, SIGNAL(visibleChanged(bool)), this, SLOT(onLensPropertyChanged()));
3970- m_lenses.append(lens);
3971-}
3972-
3973-void Lenses::removeUnityLens(int index)
3974-{
3975- Lens* lens = m_lenses.takeAt(index);
3976-
3977- delete lens;
3978+ QObject::connect(scope, SIGNAL(visibleChanged(bool)), this, SLOT(onScopePropertyChanged()));
3979+ m_scopes.append(scope);
3980+}
3981+
3982+void Scopes::removeUnityScope(int index)
3983+{
3984+ Scope* scope = m_scopes.takeAt(index);
3985+
3986+ delete scope;
3987+}
3988+
3989+int Scopes::findScopeById(const QString& scope_id)
3990+{
3991+ for (int i=0; i<m_scopes.count(); i++) {
3992+ if (m_scopes[i]->id() == scope_id) {
3993+ return i;
3994+ }
3995+ }
3996+ return -1;
3997 }
3998
3999=== renamed file 'plugins/Unity/lenses.h' => 'plugins/Unity/scopes.h'
4000--- plugins/Unity/lenses.h 2013-06-05 22:03:08 +0000
4001+++ plugins/Unity/scopes.h 2013-06-19 20:05:35 +0000
4002@@ -17,29 +17,29 @@
4003 * along with this program. If not, see <http://www.gnu.org/licenses/>.
4004 */
4005
4006-#ifndef LENSES_H
4007-#define LENSES_H
4008+#ifndef SCOPES_H
4009+#define SCOPES_H
4010
4011 // Qt
4012 #include <QAbstractListModel>
4013 #include <QList>
4014
4015 // libunity-core
4016-#include <UnityCore/Lens.h>
4017-#include <UnityCore/HomeLens.h>
4018+#include <UnityCore/Scope.h>
4019+#include <UnityCore/GSettingsScopes.h>
4020
4021 namespace unity
4022 {
4023 namespace dash
4024 {
4025-class Lenses;
4026+class Scopes;
4027 }
4028 }
4029
4030 class Hotkey;
4031-class Lens;
4032+class Scope;
4033
4034-class Lenses : public QAbstractListModel
4035+class Scopes : public QAbstractListModel
4036 {
4037 Q_OBJECT
4038
4039@@ -48,11 +48,11 @@
4040 Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
4041
4042 public:
4043- explicit Lenses(QObject *parent = 0);
4044- ~Lenses() = default;
4045+ explicit Scopes(QObject *parent = 0);
4046+ ~Scopes() = default;
4047
4048 enum Roles {
4049- RoleLens,
4050+ RoleScope,
4051 RoleId,
4052 RoleVisible
4053 };
4054@@ -61,30 +61,34 @@
4055 Q_INVOKABLE int rowCount(const QModelIndex& parent = QModelIndex()) const;
4056
4057 Q_INVOKABLE QVariant get(int row) const;
4058- Q_INVOKABLE QVariant get(const QString& lens_id) const;
4059+ Q_INVOKABLE QVariant get(const QString& scope_id) const;
4060
4061 QHash<int, QByteArray> roleNames() const;
4062
4063 bool loaded() const;
4064
4065 Q_SIGNALS:
4066- void activateLensRequested(const QString& lens_id);
4067+ void activateScopeRequested(const QString& scope_id);
4068 void loadedChanged(bool loaded);
4069+ void scopeRemoved(const QString& scope_id, int index);
4070
4071 private Q_SLOTS:
4072- void onLensAdded(const unity::dash::Lens::Ptr& lens);
4073- void onLensesLoaded();
4074- void onLensPropertyChanged();
4075+ void onScopesLoaded();
4076+ void onScopeAdded(const unity::dash::Scope::Ptr& scope, int position);
4077+ void onScopeRemoved(const unity::dash::Scope::Ptr& scope);
4078+ void onScopesReordered(const unity::dash::Scopes::ScopeList& scopes);
4079+ void onScopePropertyChanged();
4080
4081 private:
4082- unity::dash::Lenses::Ptr m_unityLenses;
4083- unity::dash::HomeLens::Ptr m_homeLens;
4084- QList<Lens*> m_lenses;
4085+ unity::dash::GSettingsScopesReader::Ptr m_scopesReader;
4086+ unity::dash::Scopes::Ptr m_unityScopes;
4087+ QList<Scope*> m_scopes;
4088 QHash<int, QByteArray> m_roles;
4089 bool m_loaded;
4090
4091- void addUnityLens(const unity::dash::Lens::Ptr& unity_lens);
4092- void removeUnityLens(int index);
4093+ void addUnityScope(const unity::dash::Scope::Ptr& unity_scope);
4094+ void removeUnityScope(int index);
4095+ int findScopeById(const QString& scope_id);
4096 };
4097
4098-#endif // LENSES_H
4099+#endif // SCOPES_H
4100
4101=== modified file 'po/unity8.pot'
4102--- po/unity8.pot 2013-06-19 15:07:15 +0000
4103+++ po/unity8.pot 2013-06-19 20:05:35 +0000
4104@@ -109,27 +109,19 @@
4105 msgid "Apps"
4106 msgstr ""
4107
4108+#: Dash/DashHome.qml:40
4109+msgid "Frequent Apps"
4110+msgstr ""
4111+
4112 #: Dash/DashHome.qml:43
4113-msgid "Frequent Apps"
4114+msgid "Recent Music"
4115 msgstr ""
4116
4117 #: Dash/DashHome.qml:46
4118-msgid "Favourite People"
4119-msgstr ""
4120-
4121-#: Dash/DashHome.qml:49
4122-msgid "People Recently in Touch"
4123-msgstr ""
4124-
4125-#: Dash/DashHome.qml:52
4126-msgid "Recent Music"
4127-msgstr ""
4128-
4129-#: Dash/DashHome.qml:55
4130 msgid "Videos Popular Online"
4131 msgstr ""
4132
4133-#: Dash/DashHome.qml:197 plugins/Unity/lenses.cpp:38
4134+#: Dash/DashHome.qml:175
4135 msgid "Home"
4136 msgstr ""
4137
4138@@ -153,26 +145,6 @@
4139 msgid "Music"
4140 msgstr ""
4141
4142-#: Dash/DashPeople.qml:31
4143-msgid "Favourites"
4144-msgstr ""
4145-
4146-#: Dash/DashPeople.qml:32
4147-msgid "Recently in touch"
4148-msgstr ""
4149-
4150-#: Dash/DashPeople.qml:33
4151-msgid "New Contacts"
4152-msgstr ""
4153-
4154-#: Dash/DashPeople.qml:34
4155-msgid "A-Z"
4156-msgstr ""
4157-
4158-#: Dash/DashPeople.qml:123
4159-msgid "People"
4160-msgstr ""
4161-
4162 #: Dash/DashVideos.qml:31
4163 msgid "Popular Online"
4164 msgstr ""
4165@@ -234,16 +206,17 @@
4166 msgid "Flight mode"
4167 msgstr ""
4168
4169-#: Panel/SearchIndicator.qml:26 plugins/Unity/lenses.cpp:40
4170+#: Panel/SearchIndicator.qml:26
4171 msgid "Search"
4172 msgstr ""
4173
4174-#: plugins/Unity/lens.cpp:333
4175+#: plugins/Unity/scope.cpp:268
4176 msgid "Sorry, there is nothing that matches your search."
4177 msgstr ""
4178
4179-#: plugins/Unity/lenses.cpp:39
4180-msgid "Home screen"
4181+#: Shell.qml:380
4182+#, qt-format
4183+msgid "Please enter %1:"
4184 msgstr ""
4185
4186 #: Shell.qml:380
4187
4188=== modified file 'tests/autopilot/unity8/tests/helpers.py'
4189--- tests/autopilot/unity8/tests/helpers.py 2013-06-05 22:03:08 +0000
4190+++ tests/autopilot/unity8/tests/helpers.py 2013-06-19 20:05:35 +0000
4191@@ -71,7 +71,7 @@
4192 self.touch.drag(start_x, start_y, stop_x, stop_y)
4193
4194 # Because the shell loads up lots of stuff, unlocking the greeter can
4195- # be a bit stuttery while lenses are still consuming all resources.
4196+ # be a bit stuttery while scopes are still consuming all resources.
4197 # Give it another (max retries) chance
4198 try:
4199 self.assertThat(greeter.created, Eventually(Equals(False)))
4200
4201=== modified file 'tests/autopilot/unity8/tests/testhud.py'
4202--- tests/autopilot/unity8/tests/testhud.py 2013-06-11 15:45:45 +0000
4203+++ tests/autopilot/unity8/tests/testhud.py 2013-06-19 20:05:35 +0000
4204@@ -73,7 +73,7 @@
4205 super(TestHud, self).setUp("%sx%s" % (self.app_width / divisor, self.app_height / divisor), "%s" % (self.grid_unit_px / divisor))
4206
4207 dash = self.main_window.get_dash()
4208- self.assertThat(dash.showLensOnLoaded, Eventually(Equals(""), timeout=30))
4209+ self.assertThat(dash.showScopeOnLoaded, Eventually(Equals(""), timeout=30))
4210
4211 def test_show_hud(self):
4212 hud = self.main_window.get_hud()
4213
4214=== modified file 'tests/autopilot/unity8/tests/testlockscreen.py'
4215--- tests/autopilot/unity8/tests/testlockscreen.py 2013-06-12 07:59:03 +0000
4216+++ tests/autopilot/unity8/tests/testlockscreen.py 2013-06-19 20:05:35 +0000
4217@@ -71,7 +71,7 @@
4218 super(TestLockscreens, self).setUp("%sx%s" % (self.app_width / divisor, self.app_height / divisor), "%s" % (self.grid_unit_px / divisor))
4219
4220 dash = self.main_window.get_dash()
4221- self.assertThat(dash.showLensOnLoaded, Eventually(Equals(""), timeout=30))
4222+ self.assertThat(dash.showScopeOnLoaded, Eventually(Equals(""), timeout=30))
4223
4224 def test_unlock(self):
4225 self.unlock_greeter()
4226
4227=== modified file 'tests/qmltests/CMakeLists.txt'
4228--- tests/qmltests/CMakeLists.txt 2013-06-19 18:10:57 +0000
4229+++ tests/qmltests/CMakeLists.txt 2013-06-19 20:05:35 +0000
4230@@ -41,13 +41,11 @@
4231 add_qml_test(Dash DashBar IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
4232 add_qml_test(Dash DashContent IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS})
4233 add_qml_test(Dash DashPreview)
4234-add_qml_test(Dash GenericLensView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
4235-add_qml_test(Dash LensView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/plugins)
4236-add_qml_test(Dash PeoplePreview)
4237+add_qml_test(Dash GenericScopeView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
4238+add_qml_test(Dash ScopeView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/plugins)
4239 add_qml_test(Dash FilterGrids IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_SOURCE_DIR}/plugins
4240 ${CMAKE_BINARY_DIR}/tests/mocks)
4241 add_qml_test(Dash/Apps RunningApplicationsGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
4242-add_qml_test(Dash/People PeopleFilterGrid IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_SOURCE_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
4243 add_qml_test(Greeter Lockscreen IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_BINARY_DIR}/tests/mocks
4244 PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")
4245 add_qml_test(Greeter Tablet IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_BINARY_DIR}/tests/mocks
4246
4247=== removed directory 'tests/qmltests/Dash/People'
4248=== removed file 'tests/qmltests/Dash/People/tst_PeopleFilterGrid.qml'
4249--- tests/qmltests/Dash/People/tst_PeopleFilterGrid.qml 2013-06-05 22:03:08 +0000
4250+++ tests/qmltests/Dash/People/tst_PeopleFilterGrid.qml 1970-01-01 00:00:00 +0000
4251@@ -1,154 +0,0 @@
4252-/*
4253- * Copyright 2013 Canonical Ltd.
4254- *
4255- * This program is free software; you can redistribute it and/or modify
4256- * it under the terms of the GNU General Public License as published by
4257- * the Free Software Foundation; version 3.
4258- *
4259- * This program is distributed in the hope that it will be useful,
4260- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4261- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4262- * GNU General Public License for more details.
4263- *
4264- * You should have received a copy of the GNU General Public License
4265- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4266- */
4267-
4268-import QtQuick 2.0
4269-import QtTest 1.0
4270-import ".."
4271-import "../.."
4272-import "../../../../Dash/People"
4273-import Ubuntu.Components 0.1
4274-import Unity.Test 0.1 as UT
4275-
4276-Item {
4277- id: root
4278- width: units.gu(120)
4279- height: units.gu(40)
4280-
4281- PeopleFilterGrid {
4282- id: peopleFilterGrid
4283- anchors.fill: parent
4284- model: mockModel
4285- }
4286-
4287- SignalSpy {
4288- id: signalSpy
4289- target: peopleFilterGrid
4290- signalName: "clicked"
4291- }
4292-
4293- ListModel {
4294- id: mockModel
4295-
4296- ListElement {
4297- column_0: 'user://001'
4298- column_1: "gtk-apply"
4299- column_2: ""
4300- column_3: ""
4301- column_4: "User 1"
4302- column_5: "Text 1"
4303- }
4304-
4305- ListElement {
4306- column_0: 'user://002'
4307- column_1: "gtk-apply"
4308- column_2: ""
4309- column_3: ""
4310- column_4: "User 2"
4311- column_5: "Text 2"
4312- }
4313-
4314- ListElement {
4315- column_0: 'user://003'
4316- column_1: "gtk-apply"
4317- column_2: ""
4318- column_3: ""
4319- column_4: "User 3"
4320- column_5: "Text 3"
4321- }
4322-
4323- ListElement {
4324- column_0: 'user://004'
4325- column_1: "gtk-apply"
4326- column_2: ""
4327- column_3: ""
4328- column_4: "User 4"
4329- column_5: "Text 4"
4330- }
4331-
4332- ListElement {
4333- column_0: 'user://005'
4334- column_1: "gtk-apply"
4335- column_2: ""
4336- column_3: ""
4337- column_4: "User 5"
4338- column_5: "Text 5"
4339- }
4340-
4341- }
4342-
4343- UT.UnityTestCase {
4344- id: testCase
4345- name: "DashPeopleFilterGrid"
4346- when: windowShown
4347-
4348- function init() {
4349- }
4350-
4351- function test_clickCell_data() {
4352- return [
4353- {
4354- x: peopleFilterGrid.minimumHorizontalSpacing+peopleFilterGrid.cellWidth/2,
4355- y: peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight/2,
4356- index: 0,
4357- uri: "user://001"
4358- },
4359- {
4360- x: 2*peopleFilterGrid.minimumHorizontalSpacing+peopleFilterGrid.cellWidth+peopleFilterGrid.cellWidth/2,
4361- y: peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight/2,
4362- index: 1,
4363- uri: "user://002"
4364- },
4365- {
4366- x: 3*peopleFilterGrid.minimumHorizontalSpacing+2*peopleFilterGrid.cellWidth+peopleFilterGrid.cellWidth/2,
4367- y: peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight/2,
4368- index: 2,
4369- uri: "user://003"
4370- },
4371- {
4372- x: peopleFilterGrid.minimumHorizontalSpacing+peopleFilterGrid.cellWidth/2,
4373- y: 2*peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight+peopleFilterGrid.cellHeight/2,
4374- index: 3,
4375- uri: "user://004"
4376- },
4377- {
4378- x: 2*peopleFilterGrid.minimumHorizontalSpacing+peopleFilterGrid.cellWidth+peopleFilterGrid.cellWidth/2,
4379- y: 2*peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight+peopleFilterGrid.cellHeight/2,
4380- index: 4,
4381- uri: "user://005"
4382- },
4383- ]
4384- }
4385-
4386- function test_columns() {
4387- compare(peopleFilterGrid.columns,3)
4388- }
4389-
4390- function test_clickCell(data) {
4391- tryCompare(peopleFilterGrid, "flicking", false)
4392- tryCompare(peopleFilterGrid, "moving", false)
4393- signalSpy.clear()
4394- wait(peopleFilterGrid.pressDelay > 0 ? peopleFilterGrid.pressDelay : 5)
4395- mouseClick(peopleFilterGrid, data.x, data.y)
4396- tryCompare(peopleFilterGrid, "flicking", false)
4397- tryCompare(peopleFilterGrid, "moving", false)
4398- compare(signalSpy.count, 1)
4399- compare(signalSpy.signalArguments.length, 1, "signalArguments.length != 1")
4400- compare(signalSpy.signalArguments[0][0], data.index)
4401- compare(signalSpy.signalArguments[0][1]["uri"], data.uri)
4402- }
4403-
4404- }
4405-}
4406
4407=== renamed file 'tests/qmltests/Dash/qml/FakeLensView.qml' => 'tests/qmltests/Dash/qml/FakeScopeView.qml'
4408--- tests/qmltests/Dash/qml/FakeLensView.qml 2013-06-11 10:36:55 +0000
4409+++ tests/qmltests/Dash/qml/FakeScopeView.qml 2013-06-19 20:05:35 +0000
4410@@ -18,8 +18,8 @@
4411 import Unity 0.1
4412
4413 FocusScope {
4414- id: fakeLensView
4415- property Lens lens : null
4416+ id: fakeScopeView
4417+ property Scope scope : null
4418 property bool isCurrent : false
4419
4420 property ListModel searchHistory
4421@@ -31,18 +31,18 @@
4422 property alias backColor : back.color
4423
4424 onEndReached: {
4425- if (shell != undefined && shell.lensStatus != undefined) {
4426- shell.lensStatus[lens.id].endReached++;
4427+ if (shell != undefined && shell.scopeStatus != undefined) {
4428+ shell.scopeStatus[scope.id].endReached++;
4429 }
4430 }
4431 onMovementStarted: {
4432- if (shell != undefined && shell.lensStatus != undefined) {
4433- shell.lensStatus[lens.id].movementStarted++;
4434+ if (shell != undefined && shell.scopeStatus != undefined) {
4435+ shell.scopeStatus[scope.id].movementStarted++;
4436 }
4437 }
4438 onPositionedAtBeginning: {
4439- if (shell != undefined && shell.lensStatus != undefined) {
4440- shell.lensStatus[lens.id].positionedAtBeginning++;
4441+ if (shell != undefined && shell.scopeStatus != undefined) {
4442+ shell.scopeStatus[scope.id].positionedAtBeginning++;
4443 }
4444 }
4445
4446@@ -68,7 +68,7 @@
4447 ListView {
4448 id: listView
4449 anchors.fill: parent
4450- model: lens ? lens.categories : null
4451+ model: scope ? scope.categories : null
4452 orientation: ListView.Vertical
4453
4454 delegate: Column {
4455
4456=== renamed file 'tests/qmltests/Dash/qml/fake_generic_lensView.qml' => 'tests/qmltests/Dash/qml/fake_generic_scopeView.qml'
4457--- tests/qmltests/Dash/qml/fake_generic_lensView.qml 2013-06-11 10:36:55 +0000
4458+++ tests/qmltests/Dash/qml/fake_generic_scopeView.qml 2013-06-19 20:05:35 +0000
4459@@ -16,9 +16,9 @@
4460
4461 import QtQuick 2.0
4462
4463-FakeLensView {
4464- id: fake_generic_lensView
4465- objectName: "fake_generic_lensView"
4466+FakeScopeView {
4467+ id: fake_generic_scopeView
4468+ objectName: "fake_generic_scopeView"
4469
4470 backColor: "#D0D0D0"
4471 }
4472
4473=== renamed file 'tests/qmltests/Dash/qml/fake_lensView1.qml' => 'tests/qmltests/Dash/qml/fake_scopeView1.qml'
4474--- tests/qmltests/Dash/qml/fake_lensView1.qml 2013-06-11 10:36:55 +0000
4475+++ tests/qmltests/Dash/qml/fake_scopeView1.qml 2013-06-19 20:05:35 +0000
4476@@ -16,9 +16,9 @@
4477
4478 import QtQuick 2.0
4479
4480-FakeLensView {
4481- id: fake_lensView1
4482- objectName: "fake_lensView1"
4483+FakeScopeView {
4484+ id: fake_scopeView1
4485+ objectName: "fake_scopeView1"
4486
4487 backColor: "#909090"
4488 }
4489
4490=== renamed file 'tests/qmltests/Dash/qml/fake_lensView2.qml' => 'tests/qmltests/Dash/qml/fake_scopeView2.qml'
4491--- tests/qmltests/Dash/qml/fake_lensView2.qml 2013-06-11 10:36:55 +0000
4492+++ tests/qmltests/Dash/qml/fake_scopeView2.qml 2013-06-19 20:05:35 +0000
4493@@ -16,9 +16,9 @@
4494
4495 import QtQuick 2.0
4496
4497-FakeLensView {
4498- id: fake_lensView2
4499- objectName: "fake_lensView2"
4500+FakeScopeView {
4501+ id: fake_scopeView2
4502+ objectName: "fake_scopeView2"
4503
4504 backColor: "#A0A0A0"
4505 }
4506
4507=== renamed file 'tests/qmltests/Dash/qml/fake_lensView3.qml' => 'tests/qmltests/Dash/qml/fake_scopeView3.qml'
4508--- tests/qmltests/Dash/qml/fake_lensView3.qml 2013-06-11 10:36:55 +0000
4509+++ tests/qmltests/Dash/qml/fake_scopeView3.qml 2013-06-19 20:05:35 +0000
4510@@ -16,9 +16,9 @@
4511
4512 import QtQuick 2.0
4513
4514-FakeLensView {
4515- id: fake_lensView3
4516- objectName: "fake_lensView3"
4517+FakeScopeView {
4518+ id: fake_scopeView3
4519+ objectName: "fake_scopeView3"
4520
4521 backColor: "#B0B0B0"
4522 }
4523
4524=== renamed file 'tests/qmltests/Dash/qml/fake_lensView4.qml' => 'tests/qmltests/Dash/qml/fake_scopeView4.qml'
4525--- tests/qmltests/Dash/qml/fake_lensView4.qml 2013-06-11 10:36:55 +0000
4526+++ tests/qmltests/Dash/qml/fake_scopeView4.qml 2013-06-19 20:05:35 +0000
4527@@ -16,9 +16,9 @@
4528
4529 import QtQuick 2.0
4530
4531-FakeLensView {
4532- id: fake_lensView4
4533- objectName: "fake_lensView4"
4534+FakeScopeView {
4535+ id: fake_scopeView4
4536+ objectName: "fake_scopeView4"
4537
4538 backColor: "#C0C0C0"
4539 }
4540
4541=== modified file 'tests/qmltests/Dash/tst_Dash.qml'
4542--- tests/qmltests/Dash/tst_Dash.qml 2013-06-11 10:36:55 +0000
4543+++ tests/qmltests/Dash/tst_Dash.qml 2013-06-19 20:05:35 +0000
4544@@ -30,79 +30,79 @@
4545 Dash {
4546 id: dash
4547 anchors.fill: parent
4548- showLensOnLoaded: "MockLens2"
4549+ showScopeOnLoaded: "MockScope2"
4550 }
4551
4552- LensDelegateMapper {
4553- id: lensDelegateMapper
4554- lensDelegateMapping: {
4555- "MockLens1": "../tests/qmltests/Dash/qml/fake_lensView1.qml",
4556- "MockLens2": "../tests/qmltests/Dash/qml/fake_lensView2.qml",
4557- "MockLens3": "../tests/qmltests/Dash/qml/fake_lensView3.qml",
4558- "MockLens4": "../tests/qmltests/Dash/qml/fake_lensView4.qml"
4559+ ScopeDelegateMapper {
4560+ id: scopeDelegateMapper
4561+ scopeDelegateMapping: {
4562+ "MockScope1": "../tests/qmltests/Dash/qml/fake_scopeView1.qml",
4563+ "MockScope2": "../tests/qmltests/Dash/qml/fake_scopeView2.qml",
4564+ "MockScope3": "../tests/qmltests/Dash/qml/fake_scopeView3.qml",
4565+ "MockScope4": "../tests/qmltests/Dash/qml/fake_scopeView4.qml"
4566 }
4567- genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
4568+ genericScope: "../tests/qmltests/Dash/qml/fake_generic_scopeView.qml"
4569 }
4570
4571 UT.UnityTestCase {
4572 name: "Dash"
4573 when: windowShown
4574
4575- property var lenses
4576+ property var scopes
4577
4578 Component.onCompleted: {
4579 var dashContent = findChild(dash, "dashContent");
4580- dashContent.lensMapper = lensDelegateMapper;
4581- lenses = dashContent.lenses;
4582+ dashContent.scopeMapper = scopeDelegateMapper;
4583+ scopes = dashContent.scopes;
4584 }
4585
4586 function init() {
4587- // clear and reload the lenses.
4588- lenses.clear();
4589+ // clear and reload the scopes.
4590+ scopes.clear();
4591 var dashContentList = findChild(dash, "dashContentList");
4592 verify(dashContentList != undefined);
4593 tryCompare(dashContentList, "count", 0);
4594- lenses.load();
4595+ scopes.load();
4596 }
4597
4598- function get_lens_data() {
4599+ function get_scope_data() {
4600 return [
4601- { tag: "MockLens1", visualIndex: 0, shouldBeVisible: true },
4602- { tag: "MockLens2", visualIndex: -1, shouldBeVisible: false },
4603- { tag: "MockLens3", visualIndex: 1, shouldBeVisible: true },
4604- { tag: "MockLens4", visualIndex: 2, shouldBeVisible: true },
4605- { tag: "MockLens5", visualIndex: 3, shouldBeVisible: true },
4606+ { tag: "MockScope1", visualIndex: 0, shouldBeVisible: true },
4607+ { tag: "MockScope2", visualIndex: -1, shouldBeVisible: false },
4608+ { tag: "MockScope3", visualIndex: 1, shouldBeVisible: true },
4609+ { tag: "MockScope4", visualIndex: 2, shouldBeVisible: true },
4610+ { tag: "MockScope5", visualIndex: 3, shouldBeVisible: true },
4611 ]
4612 }
4613
4614- function test_set_current_lens_data() {
4615- return get_lens_data()
4616+ function test_set_current_scope_data() {
4617+ return get_scope_data()
4618 }
4619
4620- function test_set_current_lens(data) {
4621- // wait for lenses to load
4622- tryCompare(lenses, "loaded", true);
4623+ function test_set_current_scope(data) {
4624+ // wait for scopes to load
4625+ tryCompare(scopes, "loaded", true);
4626
4627 var dashbar = findChild(dash, "dashbar");
4628 verify(dashbar != undefined)
4629 var dashContent = findChild(dash, "dashContent");
4630 var current_index = dashContent.currentIndex;
4631
4632- dash.setCurrentLens(data.tag, true /* animate */, false /* reset */);
4633+ dash.setCurrentScope(data.tag, true /* animate */, false /* reset */);
4634 compare(dashContent.currentIndex, data.shouldBeVisible ? data.visualIndex : current_index);
4635 compare(dashbar.currentIndex, data.shouldBeVisible ? data.visualIndex : current_index);
4636 }
4637
4638- function test_show_lens_on_load_data() {
4639- return get_lens_data()
4640+ function test_show_scope_on_load_data() {
4641+ return get_scope_data()
4642 }
4643
4644- function test_show_lens_on_load(data) {
4645+ function test_show_scope_on_load(data) {
4646 if (data.shouldBeVisible == false) {
4647 console.log("Not testing " + data.tag + ": not visible");
4648 return;
4649 }
4650- dash.showLensOnLoaded = data.tag
4651+ dash.showScopeOnLoaded = data.tag
4652
4653 var dashContentList = findChild(dash, "dashContentList");
4654 verify(dashContentList != undefined);
4655@@ -110,7 +110,7 @@
4656 }
4657
4658 function test_dash_bar_set_index_connection_data() {
4659- return get_lens_data()
4660+ return get_scope_data()
4661 }
4662
4663 function test_dash_bar_set_index_connection(data) {
4664@@ -118,8 +118,8 @@
4665 console.log("Not testing " + data.tag + ": not visible");
4666 return;
4667 }
4668- // wait for lenses to load
4669- tryCompare(lenses, "loaded", true);
4670+ // wait for scopes to load
4671+ tryCompare(scopes, "loaded", true);
4672
4673 var dashbar = findChild(dash, "dashbar");
4674 verify(dashbar != undefined)
4675
4676=== modified file 'tests/qmltests/Dash/tst_DashBar.qml'
4677--- tests/qmltests/Dash/tst_DashBar.qml 2013-06-05 22:03:08 +0000
4678+++ tests/qmltests/Dash/tst_DashBar.qml 2013-06-19 20:05:35 +0000
4679@@ -34,12 +34,12 @@
4680 right: parent.right
4681 bottom: parent.bottom
4682 }
4683- model: lenses
4684+ model: scopes
4685 onItemSelected: currentIndex = index
4686 }
4687
4688- Lenses {
4689- id: lenses
4690+ Scopes {
4691+ id: scopes
4692 }
4693
4694 SignalSpy {
4695@@ -50,7 +50,7 @@
4696
4697 UT.UnityTestCase {
4698 name: "DashBar"
4699- when: lenses.loaded
4700+ when: scopes.loaded
4701
4702 property alias model: dashBar.model
4703 property alias currentIndex: dashBar.currentIndex
4704
4705=== modified file 'tests/qmltests/Dash/tst_DashContent.qml'
4706--- tests/qmltests/Dash/tst_DashContent.qml 2013-06-11 10:36:55 +0000
4707+++ tests/qmltests/Dash/tst_DashContent.qml 2013-06-19 20:05:35 +0000
4708@@ -28,60 +28,60 @@
4709
4710 property ListModel searchHistory: ListModel {}
4711
4712- property var lensStatus: {
4713- 'MockLens1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
4714- 'MockLens2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
4715- 'MockLens3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
4716- 'MockLens4': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
4717- 'MockLens5': { 'movementStarted': 0, 'positionedAtBeginning': 0 }
4718+ property var scopeStatus: {
4719+ 'MockScope1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
4720+ 'MockScope2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
4721+ 'MockScope3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
4722+ 'MockScope4': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
4723+ 'MockScope5': { 'movementStarted': 0, 'positionedAtBeginning': 0 }
4724 }
4725
4726- Lenses {
4727- id: lensesModel
4728+ Scopes {
4729+ id: scopesModel
4730 }
4731
4732 DashContent {
4733 id: dashContent
4734 anchors.fill: parent
4735
4736- model: lensesModel
4737- lenses : lensesModel
4738+ model: scopesModel
4739+ scopes : scopesModel
4740
4741- lensMapper : lensDelegateMapper
4742+ scopeMapper : scopeDelegateMapper
4743 }
4744
4745- LensDelegateMapper {
4746- id: lensDelegateMapper
4747- lensDelegateMapping: {
4748- "MockLens1": "../tests/qmltests/Dash/qml/fake_lensView1.qml",
4749- "MockLens2": "../tests/qmltests/Dash/qml/fake_lensView2.qml",
4750- "MockLens3": "../tests/qmltests/Dash/qml/fake_lensView3.qml",
4751- "MockLens4": "../tests/qmltests/Dash/qml/fake_lensView4.qml"
4752+ ScopeDelegateMapper {
4753+ id: scopeDelegateMapper
4754+ scopeDelegateMapping: {
4755+ "MockScope1": "../tests/qmltests/Dash/qml/fake_scopeView1.qml",
4756+ "MockScope2": "../tests/qmltests/Dash/qml/fake_scopeView2.qml",
4757+ "MockScope3": "../tests/qmltests/Dash/qml/fake_scopeView3.qml",
4758+ "MockScope4": "../tests/qmltests/Dash/qml/fake_scopeView4.qml"
4759 }
4760- genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
4761+ genericScope: "../tests/qmltests/Dash/qml/fake_generic_scopeView.qml"
4762 }
4763
4764- function clear_lens_status() {
4765- lensStatus["MockLens1"].movementStarted = 0;
4766- lensStatus["MockLens1"].positionedAtBeginning = 0;
4767-
4768- lensStatus["MockLens2"].movementStarted = 0;
4769- lensStatus["MockLens2"].positionedAtBeginning = 0;
4770-
4771- lensStatus["MockLens3"].movementStarted = 0;
4772- lensStatus["MockLens3"].positionedAtBeginning = 0;
4773-
4774- lensStatus["MockLens4"].movementStarted = 0;
4775- lensStatus["MockLens4"].positionedAtBeginning = 0;
4776-
4777- lensStatus["MockLens5"].movementStarted = 0;
4778- lensStatus["MockLens5"].positionedAtBeginning = 0;
4779+ function clear_scope_status() {
4780+ scopeStatus["MockScope1"].movementStarted = 0;
4781+ scopeStatus["MockScope1"].positionedAtBeginning = 0;
4782+
4783+ scopeStatus["MockScope2"].movementStarted = 0;
4784+ scopeStatus["MockScope2"].positionedAtBeginning = 0;
4785+
4786+ scopeStatus["MockScope3"].movementStarted = 0;
4787+ scopeStatus["MockScope3"].positionedAtBeginning = 0;
4788+
4789+ scopeStatus["MockScope4"].movementStarted = 0;
4790+ scopeStatus["MockScope4"].positionedAtBeginning = 0;
4791+
4792+ scopeStatus["MockScope5"].movementStarted = 0;
4793+ scopeStatus["MockScope5"].positionedAtBeginning = 0;
4794 }
4795
4796 SignalSpy {
4797- id: lensLoadedSpy
4798+ id: scopeLoadedSpy
4799 target: dashContent
4800- signalName: "lensLoaded"
4801+ signalName: "scopeLoaded"
4802 }
4803
4804 SignalSpy {
4805@@ -101,78 +101,81 @@
4806 when: windowShown
4807
4808 function init() {
4809- lensLoadedSpy.clear();
4810+ scopeLoadedSpy.clear();
4811 movementStartedSpy.clear();
4812 contentEndReachedSpy.clear()
4813- clear_lens_status();
4814+ clear_scope_status();
4815
4816- // clear, wait for dahs to empty and load lenses.
4817+ // clear, wait for dahs to empty and load scopes.
4818 var dashContentList = findChild(dashContent, "dashContentList");
4819 verify(dashContentList != undefined)
4820- lensesModel.clear();
4821+ scopesModel.clear();
4822 tryCompare(dashContentList, "count", 0);
4823- lensesModel.load();
4824+ scopesModel.load();
4825 }
4826
4827 function test_movement_started_signal() {
4828- dashContent.setCurrentLensAtIndex(3, true, false);
4829+ dashContent.setCurrentScopeAtIndex(3, true, false);
4830
4831 var dashContentList = findChild(dashContent, "dashContentList");
4832 verify(dashContentList != undefined)
4833- tryCompare(lensLoadedSpy, "count", 5);
4834+
4835+ tryCompare(scopeLoadedSpy, "count", 5);
4836
4837 dashContentList.movementStarted();
4838+
4839 compare(movementStartedSpy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
4840- compare(lensStatus["MockLens1"].movementStarted, 1, "MockLens1 should have emitted movementStarted signal when content list did.");
4841- compare(lensStatus["MockLens2"].movementStarted, 1, "MockLens2 should have emitted movementStarted signal when content list did.");
4842- compare(lensStatus["MockLens3"].movementStarted, 1, "MockLens3 should have emitted movementStarted signal when content list did.");
4843- compare(lensStatus["MockLens4"].movementStarted, 1, "MockLens4 should have emitted movementStarted signal when content list did.");
4844- compare(lensStatus["MockLens5"].movementStarted, 1, "MockLens5 should have emitted movementStarted signal when content list did.");
4845+ compare(scopeStatus["MockScope1"].movementStarted, 1, "MockScope1 should have emitted movementStarted signal when content list did.");
4846+ compare(scopeStatus["MockScope2"].movementStarted, 1, "MockScope2 should have emitted movementStarted signal when content list did.");
4847+ compare(scopeStatus["MockScope3"].movementStarted, 1, "MockScope3 should have emitted movementStarted signal when content list did.");
4848+ compare(scopeStatus["MockScope4"].movementStarted, 1, "MockScope4 should have emitted movementStarted signal when content list did.");
4849+ compare(scopeStatus["MockScope5"].movementStarted, 1, "MockScope5 should have emitted movementStarted signal when content list did.");
4850 }
4851
4852 function test_positioned_at_beginning_signal() {
4853- dashContent.setCurrentLensAtIndex(3, true, false);
4854+ dashContent.setCurrentScopeAtIndex(3, true, false);
4855
4856- tryCompare(lensLoadedSpy, "count", 5);
4857+ tryCompare(scopeLoadedSpy, "count", 5);
4858
4859 dashContent.positionedAtBeginning();
4860- compare(lensStatus["MockLens1"].positionedAtBeginning, 1, "MockLens1 should have emitted positionedAtBeginning signal when DashContent did.");
4861- compare(lensStatus["MockLens2"].positionedAtBeginning, 1, "MockLens2 should have emitted positionedAtBeginning signal when DashContent did.");
4862- compare(lensStatus["MockLens3"].positionedAtBeginning, 1, "MockLens3 should have emitted positionedAtBeginning signal when DashContent did.");
4863- compare(lensStatus["MockLens4"].positionedAtBeginning, 1, "MockLens4 should have emitted positionedAtBeginning signal when DashContent did.");
4864- compare(lensStatus["MockLens5"].positionedAtBeginning, 1, "MockLens5 should have emitted positionedAtBeginning signal when DashContent did.");
4865+ compare(scopeStatus["MockScope1"].positionedAtBeginning, 1, "MockScope1 should have emitted positionedAtBeginning signal when DashContent did.");
4866+ compare(scopeStatus["MockScope2"].positionedAtBeginning, 1, "MockScope2 should have emitted positionedAtBeginning signal when DashContent did.");
4867+ compare(scopeStatus["MockScope3"].positionedAtBeginning, 1, "MockScope3 should have emitted positionedAtBeginning signal when DashContent did.");
4868+ compare(scopeStatus["MockScope4"].positionedAtBeginning, 1, "MockScope4 should have emitted positionedAtBeginning signal when DashContent did.");
4869+ compare(scopeStatus["MockScope5"].positionedAtBeginning, 1, "MockScope5 should have emitted positionedAtBeginning signal when DashContent did.");
4870 }
4871
4872- function test_lens_loaded() {
4873- tryCompare(lensLoadedSpy, "count", 5);
4874+ function test_scope_loaded() {
4875+ tryCompare(scopeLoadedSpy, "count", 5);
4876 }
4877
4878 function test_content_end_reached() {
4879 var dashContentList = findChild(dashContent, "dashContentList");
4880 verify(dashContentList != undefined);
4881- tryCompare(lensLoadedSpy, "count", 5);
4882
4883- dashContent.setCurrentLensAtIndex(0, true, false);
4884+ tryCompare(scopeLoadedSpy, "count", 5);
4885+ dashContent.setCurrentScopeAtIndex(0, true, false);
4886 dashContentList.currentItem.item.endReached();
4887
4888 compare(contentEndReachedSpy.count, 1);
4889 }
4890
4891- // This tests that setting the current lens index will end up at the correct index even if
4892- // the lenses are loaded asynchrounsly.
4893- function test_set_current_lens_index_async() {
4894- verify(lensesModel.loaded == false);
4895+ // This tests that setting the current scope index will end up at the correct index even if
4896+ // the scopes are loaded asynchrounsly.
4897+ function test_set_current_scope_index_async() {
4898+ verify(scopesModel.loaded == false);
4899
4900 // next index is 1 if current is -1, otherwise it's current + 1
4901 var next_index = ((dashContent.currentIndex == -1 ? 0 : dashContent.currentIndex) + 1) % 5
4902
4903- dashContent.setCurrentLensAtIndex(next_index, true, false);
4904+ dashContent.setCurrentScopeAtIndex(next_index, true, false);
4905 tryCompare(dashContent, "currentIndex", next_index);
4906- verify(lensesModel.loaded == true);
4907+ verify(scopesModel.loaded == true);
4908
4909- // test greater than lens count.
4910- dashContent.setCurrentLensAtIndex(lensesModel.count, true, false);
4911- compare(dashContent.currentIndex, 4);
4912+ // test greater than scope count.
4913+ var currentScopeIndex = dashContent.currentIndex;
4914+ dashContent.setCurrentScopeAtIndex(scopesModel.count, true, false);
4915+ compare(dashContent.currentIndex, currentScopeIndex, "Scope should not change if changing to greater index than count");
4916 }
4917
4918 function get_current_item_object_name() {
4919@@ -187,18 +190,18 @@
4920 return "";
4921 }
4922
4923- function test_lens_mapping_data() {
4924+ function test_scope_mapping_data() {
4925 return [
4926- {tag: "index0", index: 0, objectName: "fake_lensView1"},
4927- {tag: "index1", index: 1, objectName: "fake_lensView2"},
4928- {tag: "index2", index: 2, objectName: "fake_lensView3"},
4929- {tag: "index3", index: 3, objectName: "fake_lensView4"},
4930- {tag: "index4", index: 4, objectName: "fake_generic_lensView"}
4931+ {tag: "index0", index: 0, objectName: "fake_scopeView1"},
4932+ {tag: "index1", index: 1, objectName: "fake_scopeView2"},
4933+ {tag: "index2", index: 2, objectName: "fake_scopeView3"},
4934+ {tag: "index3", index: 3, objectName: "fake_scopeView4"},
4935+ {tag: "index4", index: 4, objectName: "fake_generic_scopeView"}
4936 ]
4937 }
4938
4939- function test_lens_mapping(data) {
4940- dashContent.setCurrentLensAtIndex(data.index, true, false);
4941+ function test_scope_mapping(data) {
4942+ dashContent.setCurrentScopeAtIndex(data.index, true, false);
4943 tryCompareFunction(get_current_item_object_name, data.objectName)
4944 }
4945
4946
4947=== modified file 'tests/qmltests/Dash/tst_FilterGrids.qml'
4948--- tests/qmltests/Dash/tst_FilterGrids.qml 2013-06-05 22:03:08 +0000
4949+++ tests/qmltests/Dash/tst_FilterGrids.qml 2013-06-19 20:05:35 +0000
4950@@ -108,7 +108,6 @@
4951 function test_clicked_signal_data() {
4952 return [
4953 {tag: "VideosFilterGrid", component: "Video/VideosFilterGrid.qml"},
4954- {tag: "PeopleFilterGrid", component: "People/PeopleFilterGrid.qml"},
4955 {tag: "MusicFilterGrid", component: "Music/MusicFilterGrid.qml"},
4956 {tag: "ApplicationsFilterGrid", component: "Apps/ApplicationsFilterGrid.qml"}
4957 ]
4958
4959=== renamed file 'tests/qmltests/Dash/tst_GenericLensView.qml' => 'tests/qmltests/Dash/tst_GenericScopeView.qml'
4960--- tests/qmltests/Dash/tst_GenericLensView.qml 2013-06-05 22:03:08 +0000
4961+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2013-06-19 20:05:35 +0000
4962@@ -26,27 +26,27 @@
4963 width: units.gu(120)
4964 height: units.gu(80)
4965
4966- Lenses {
4967- id: lenses
4968+ Scopes {
4969+ id: scopes
4970 }
4971
4972- GenericLensView {
4973- id: genericLensView
4974+ GenericScopeView {
4975+ id: genericScopeView
4976 anchors.fill: parent
4977
4978 UT.UnityTestCase {
4979- name: "GenericLensView"
4980- when: lenses.loaded
4981+ name: "GenericScopeView"
4982+ when: scopes.loaded
4983
4984 function init() {
4985- genericLensView.lens = lenses.get(0)
4986+ genericScopeView.scope = scopes.get(0)
4987 }
4988
4989 function test_isCurrent() {
4990- var pageHeader = findChild(genericLensView, "pageHeader");
4991- genericLensView.isCurrent = true
4992+ var pageHeader = findChild(genericScopeView, "pageHeader");
4993+ genericScopeView.isCurrent = true
4994 pageHeader.searchQuery = "test"
4995- genericLensView.isCurrent = false
4996+ genericScopeView.isCurrent = false
4997 tryCompare(pageHeader, "searchQuery", "")
4998 }
4999 }
5000
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: