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
=== added file 'Components/IconUtil.js'
--- Components/IconUtil.js 1970-01-01 00:00:00 +0000
+++ Components/IconUtil.js 2013-06-19 20:05:35 +0000
@@ -0,0 +1,42 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17.pragma library
18
19// FIXME: a quick hack to get icons out of gicons and fallback to
20// base icon for annotated icons. Doesn't correctly handle all icons.
21// Proper global solution needed.
22function from_gicon(name) {
23 var icon_name = name;
24 var annotated_re = /^. UnityProtocolAnnotatedIcon/;
25 if (annotated_re.test(name)) {
26 var base_icon_re = /'base-icon':.+?'(.+?)'/;
27 var base_icon = name.toString().match(base_icon_re);
28 icon_name = base_icon[1];
29 }
30 else {
31 var themed_re = /^. GThemedIcon\s*([^\s]+)\s*/;
32 var themed = name.match(themed_re);
33 if (themed) {
34 return "image://gicon/" + themed[1];
35 }
36 }
37 var remote_re = /^http/;
38 if (remote_re.test(icon_name)) {
39 return icon_name;
40 }
41 return "image://gicon/" + icon_name;
42}
043
=== modified file 'Dash/Apps/ApplicationsFilterGrid.qml'
--- Dash/Apps/ApplicationsFilterGrid.qml 2013-06-05 22:03:08 +0000
+++ Dash/Apps/ApplicationsFilterGrid.qml 2013-06-19 20:05:35 +0000
@@ -35,7 +35,7 @@
35 objectName: "delegate" + index35 objectName: "delegate" + index
36 Application {36 Application {
37 id: application37 id: application
38 desktopFile: model.column_6 ? stripProtocol(model.column_6) : model.desktopFile // FIXME: this is temporary38 desktopFile: model.column_7 ? stripProtocol(model.column_7) : model.desktopFile // FIXME: this is temporary
3939
40 function stripProtocol(uri) {40 function stripProtocol(uri) {
41 var chunks = uri.split('file://')41 var chunks = uri.split('file://')
@@ -47,7 +47,7 @@
4747
48 width: filterGrid.cellWidth48 width: filterGrid.cellWidth
49 height: filterGrid.cellHeight49 height: filterGrid.cellHeight
50 text: model.column_4 ? model.column_4 : application.name // FIXME: this is temporary50 text: model.column_5 ? model.column_5 : application.name // FIXME: this is temporary
51 imageWidth: units.gu(8)51 imageWidth: units.gu(8)
52 imageHeight: units.gu(7.5)52 imageHeight: units.gu(7.5)
53 source: icon.indexOf("/") == -1 ? "image://gicon/" + icon : icon53 source: icon.indexOf("/") == -1 ? "image://gicon/" + icon : icon
5454
=== modified file 'Dash/Dash.qml'
--- Dash/Dash.qml 2013-06-07 09:22:34 +0000
+++ Dash/Dash.qml 2013-06-19 20:05:35 +0000
@@ -24,36 +24,36 @@
24 id: dash24 id: dash
2525
26 property alias contentProgress: dashContent.contentProgress26 property alias contentProgress: dashContent.contentProgress
27 property string showLensOnLoaded: "home.lens"27 property string showScopeOnLoaded: "home.scope"
28 property real contentScale: 1.028 property real contentScale: 1.0
2929
30 width: units.gu(40)30 width: units.gu(40)
31 height: units.gu(71)31 height: units.gu(71)
3232
33 function setCurrentLens(lensId, animate, reset) {33 function setCurrentScope(scopeId, animate, reset) {
34 var lensIndex = filteredLenses.findFirst(Lenses.RoleId, lensId)34 var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId)
3535
36 if (lensIndex == -1) {36 if (scopeIndex == -1) {
37 console.warn("No match for lens with id: %1".arg(lensId))37 console.warn("No match for scope with id: %1".arg(scopeId))
38 return38 return
39 }39 }
4040
41 if (lensIndex == dashContent.currentIndex && !reset) {41 if (scopeIndex == dashContent.currentIndex && !reset) {
42 // the lens is already the current one42 // the scope is already the current one
43 return43 return
44 }44 }
4545
46 dashContent.setCurrentLensAtIndex(lensIndex, animate, reset)46 dashContent.setCurrentScopeAtIndex(scopeIndex, animate, reset)
47 }47 }
4848
49 SortFilterProxyModel {49 SortFilterProxyModel {
50 id: filteredLenses50 id: filteredScopes
51 model: Lenses {51 model: Scopes {
52 id: lenses52 id: scopes
53 }53 }
54 dynamicSortFilter: true54 dynamicSortFilter: true
5555
56 filterRole: Lenses.RoleVisible56 filterRole: Scopes.RoleVisible
57 filterRegExp: RegExp("^true$")57 filterRegExp: RegExp("^true$")
58 }58 }
5959
@@ -61,17 +61,17 @@
61 id: dashContent61 id: dashContent
62 objectName: "dashContent"62 objectName: "dashContent"
63 anchors.fill: parent63 anchors.fill: parent
64 model: filteredLenses64 model: filteredScopes
65 lenses: lenses65 scopes: scopes
66 onMovementStarted: dashbar.startNavigation()66 onMovementStarted: dashbar.startNavigation()
67 onMovementEnded: dashbar.stopNavigation()67 onMovementEnded: dashbar.stopNavigation()
68 onContentFlickStarted: dashbar.finishNavigation()68 onContentFlickStarted: dashbar.finishNavigation()
69 onContentEndReached: dashbar.finishNavigation()69 onContentEndReached: dashbar.finishNavigation()
70 onPreviewShown: dashbar.finishNavigation()70 onPreviewShown: dashbar.finishNavigation()
71 onLensLoaded: {71 onScopeLoaded: {
72 if (lensId == dash.showLensOnLoaded) {72 if (scopeId == dash.showScopeOnLoaded) {
73 dash.setCurrentLens(lensId, false, false)73 dash.setCurrentScope(scopeId, false, false)
74 dash.showLensOnLoaded = ""74 dash.showScopeOnLoaded = ""
75 }75 }
76 }76 }
77 scale: dash.contentScale77 scale: dash.contentScale
@@ -84,9 +84,9 @@
84 anchors.bottom: parent.bottom84 anchors.bottom: parent.bottom
85 anchors.left: parent.left85 anchors.left: parent.left
86 anchors.right: parent.right86 anchors.right: parent.right
87 model: filteredLenses87 model: filteredScopes
88 currentIndex: dashContent.currentIndex88 currentIndex: dashContent.currentIndex
89 onItemSelected: dashContent.setCurrentLensAtIndex(index, true, false)89 onItemSelected: dashContent.setCurrentScopeAtIndex(index, true, false)
90 opacity: dash.contentScale == 1.0 ? 1.0 : 0.090 opacity: dash.contentScale == 1.0 ? 1.0 : 0.0
91 Behavior on opacity { NumberAnimation { easing.type: Easing.OutQuad; duration: 150 } }91 Behavior on opacity { NumberAnimation { easing.type: Easing.OutQuad; duration: 150 } }
92 }92 }
9393
=== modified file 'Dash/DashApps.qml'
--- Dash/DashApps.qml 2013-06-05 22:03:08 +0000
+++ Dash/DashApps.qml 2013-06-19 20:05:35 +0000
@@ -21,8 +21,8 @@
21import "../Components/ListItems"21import "../Components/ListItems"
22import "Apps"22import "Apps"
2323
24LensView {24ScopeView {
25 id: lensView25 id: scopeView
2626
27 // FIXME: a way to aggregate these models would be ideal27 // FIXME: a way to aggregate these models would be ideal
28 property var mainStageApplicationsModel: shell.applicationManager.mainStageApplications28 property var mainStageApplicationsModel: shell.applicationManager.mainStageApplications
@@ -40,7 +40,7 @@
40 }40 }
4141
42 Binding {42 Binding {
43 target: lensView.lens43 target: scopeView.scope
44 property: "searchQuery"44 property: "searchQuery"
45 value: pageHeader.searchQuery45 value: pageHeader.searchQuery
46 }46 }
@@ -86,7 +86,7 @@
86 dynamicSortFilter: true86 dynamicSortFilter: true
87 filterRole: 2 // this is the category id for each result87 filterRole: 2 // this is the category id for each result
88 filterRegExp: /^3$/ // only proxy items that are category 3 - Installed88 filterRegExp: /^3$/ // only proxy items that are category 3 - Installed
89 model: dashContent.lenses.get("applications.lens").results89 model: dashContent.scopes.get("applications.scope").results
90 }90 }
9191
92 property var categoryModels: {92 property var categoryModels: {
@@ -177,7 +177,7 @@
177 width: categoryView.width177 width: categoryView.width
178 text: i18n.tr("Apps")178 text: i18n.tr("Apps")
179 searchEntryEnabled: true179 searchEntryEnabled: true
180 searchHistory: lensView.searchHistory180 searchHistory: scopeView.searchHistory
181 }181 }
182 }182 }
183}183}
184184
=== modified file 'Dash/DashBar.qml'
--- Dash/DashBar.qml 2013-06-05 22:03:08 +0000
+++ Dash/DashBar.qml 2013-06-19 20:05:35 +0000
@@ -26,7 +26,7 @@
2626
27 property int lineHeight: units.dp(2)27 property int lineHeight: units.dp(2)
28 property int itemSize: units.gu(7)28 property int itemSize: units.gu(7)
29 property int iconSize: units.gu(2.5)29 property int iconSize: units.gu(3.5)
3030
31 signal itemSelected(int index)31 signal itemSelected(int index)
3232
@@ -97,14 +97,9 @@
9797
98 Image {98 Image {
99 anchors.centerIn: parent99 anchors.centerIn: parent
100 /* FIXME: should be 'source: lens.iconHint' but the100 source: scope.iconHint
101 lenses do not contain the right icons yet101 sourceSize { width: iconSize; height: iconSize }
102 */
103 source: "graphics/lensIcons/%1.png".arg(lens.name)
104 height: iconSize
105 width: iconSize
106 // opacity: index == currentIndex ? 1 : 1 // same opacity for now102 // opacity: index == currentIndex ? 1 : 1 // same opacity for now
107 smooth: true
108 }103 }
109 }104 }
110 }105 }
111106
=== modified file 'Dash/DashContent.qml'
--- Dash/DashContent.qml 2013-06-11 10:36:55 +0000
+++ Dash/DashContent.qml 2013-06-19 20:05:35 +0000
@@ -24,34 +24,34 @@
24 height: units.gu(71)24 height: units.gu(71)
2525
26 property var model: null26 property var model: null
27 property var lenses: null27 property var scopes: null
28 property real contentProgress: Math.max(0, Math.min(dashContentList.contentX / (dashContentList.contentWidth - dashContentList.width), units.dp(1)))28 property real contentProgress: Math.max(0, Math.min(dashContentList.contentX / (dashContentList.contentWidth - dashContentList.width), units.dp(1)))
29 property alias currentIndex: dashContentList.currentIndex29 property alias currentIndex: dashContentList.currentIndex
3030
31 property LensDelegateMapper lensMapper : LensDelegateMapper {}31 property ScopeDelegateMapper scopeMapper : ScopeDelegateMapper {}
3232
33 signal movementStarted()33 signal movementStarted()
34 signal movementEnded()34 signal movementEnded()
35 signal contentFlickStarted()35 signal contentFlickStarted()
36 signal contentEndReached()36 signal contentEndReached()
37 signal previewShown()37 signal previewShown()
38 signal lensLoaded(string lensId)38 signal scopeLoaded(string scopeId)
39 signal positionedAtBeginning()39 signal positionedAtBeginning()
4040
41 // If we set the current lens index before the lenses have been added,41 // If we set the current scope index before the scopes have been added,
42 // then we need to wait until the loaded signals gets emitted from the lenses42 // then we need to wait until the loaded signals gets emitted from the scopes
43 property var set_current_index: undefined43 property var set_current_index: undefined
44 Connections {44 Connections {
45 target: lenses45 target: scopes
46 onLoadedChanged: {46 onLoadedChanged: {
47 if (lenses.loaded && set_current_index != undefined) {47 if (scopes.loaded && set_current_index != undefined) {
48 setCurrentLensAtIndex(set_current_index[0], set_current_index[1], set_current_index[2]);48 setCurrentScopeAtIndex(set_current_index[0], set_current_index[1], set_current_index[2]);
49 set_current_index = undefined;49 set_current_index = undefined;
50 }50 }
51 }51 }
52 }52 }
5353
54 function setCurrentLensAtIndex(index, animate, reset) {54 function setCurrentScopeAtIndex(index, animate, reset) {
55 var storedMoveDuration = dashContentList.highlightMoveDuration55 var storedMoveDuration = dashContentList.highlightMoveDuration
56 var storedMoveSpeed = dashContentList.highlightMoveVelocity56 var storedMoveSpeed = dashContentList.highlightMoveVelocity
57 if (!animate) {57 if (!animate) {
@@ -59,8 +59,8 @@
59 dashContentList.highlightMoveDuration = 059 dashContentList.highlightMoveDuration = 0
60 }60 }
6161
62 // if the lenses haven't loaded yet, then wait until they are.62 // if the scopes haven't loaded yet, then wait until they are.
63 if (!lenses.loaded) {63 if (!scopes.loaded) {
64 set_current_index = [ index, animate, reset ]64 set_current_index = [ index, animate, reset ]
65 return;65 return;
66 }66 }
@@ -85,7 +85,7 @@
85 id: dashContentList85 id: dashContentList
86 objectName: "dashContentList"86 objectName: "dashContentList"
8787
88 interactive: dashContent.lenses.loaded88 interactive: dashContent.scopes.loaded
8989
90 anchors.fill: parent90 anchors.fill: parent
91 model: dashContent.model91 model: dashContent.model
@@ -97,7 +97,7 @@
97 highlightMoveDuration: 25097 highlightMoveDuration: 250
98 highlightRangeMode: ListView.StrictlyEnforceRange98 highlightRangeMode: ListView.StrictlyEnforceRange
99 /* FIXME: workaround rendering issue due to use of ShaderEffectSource in99 /* FIXME: workaround rendering issue due to use of ShaderEffectSource in
100 UbuntuShape. While switching from the home lens to the People lens the100 UbuntuShape. While switching from the home scope to the People scope the
101 rendering would block midway.101 rendering would block midway.
102 */102 */
103 cacheBuffer: 2147483647103 cacheBuffer: 2147483647
@@ -107,7 +107,7 @@
107 // If the number of items is less than the current index, then need to reset to another item.107 // If the number of items is less than the current index, then need to reset to another item.
108 onCountChanged: {108 onCountChanged: {
109 if (currentIndex >= count)109 if (currentIndex >= count)
110 dashContent.setCurrentLensAtIndex(count-1, true, true)110 dashContent.setCurrentScopeAtIndex(count-1, true, true)
111 }111 }
112112
113 delegate:113 delegate:
@@ -115,14 +115,15 @@
115 width: ListView.view.width115 width: ListView.view.width
116 height: ListView.view.height116 height: ListView.view.height
117 asynchronous: true117 asynchronous: true
118 source: lensMapper.map(lens.id)118 source: scopeMapper.map(scope.id)
119
119 onLoaded: {120 onLoaded: {
120 item.lens = Qt.binding(function() { return lens })121 item.scope = Qt.binding(function() { return scope })
121 item.isCurrent = Qt.binding(function() { return ListView.isCurrentItem })122 item.isCurrent = Qt.binding(function() { return ListView.isCurrentItem })
122 item.searchHistory = Qt.binding(function() { return shell.searchHistory })123 item.searchHistory = Qt.binding(function() { return shell.searchHistory })
123 dashContentList.movementStarted.connect(item.movementStarted)124 dashContentList.movementStarted.connect(item.movementStarted)
124 dashContent.positionedAtBeginning.connect(item.positionedAtBeginning)125 dashContent.positionedAtBeginning.connect(item.positionedAtBeginning)
125 dashContent.lensLoaded(item.lens.id)126 dashContent.scopeLoaded(item.scope.id)
126 }127 }
127 Connections {128 Connections {
128 target: item129 target: item
129130
=== modified file 'Dash/DashHome.qml'
--- Dash/DashHome.qml 2013-06-05 22:03:08 +0000
+++ Dash/DashHome.qml 2013-06-19 20:05:35 +0000
@@ -23,9 +23,8 @@
23import "Apps"23import "Apps"
24import "Video"24import "Video"
25import "Music"25import "Music"
26import "People"
2726
28LensView {27ScopeView {
29 id: root28 id: root
3029
31 onMovementStarted: listView.showHeader()30 onMovementStarted: listView.showHeader()
@@ -34,20 +33,12 @@
34 id: categoryListModel33 id: categoryListModel
35 // specifies page's content categories, type of delegate and model used in each category34 // specifies page's content categories, type of delegate and model used in each category
36 ListElement { category: "Frequent Apps"; component: "AppsGrid"; modelName: "AppsModel" }35 ListElement { category: "Frequent Apps"; component: "AppsGrid"; modelName: "AppsModel" }
37 ListElement { category: "Favourite People"; component: "PeopleCarousel"; modelName: "FavouriteModel" }
38 ListElement { category: "People Recently in Touch"; component: "PeopleGrid"; modelName: "RecentModel" }
39 ListElement { category: "Recent Music"; component: "MusicGrid"; modelName: "MusicModel" }36 ListElement { category: "Recent Music"; component: "MusicGrid"; modelName: "MusicModel" }
40 ListElement { category: "Videos Popular Online"; component: "VideosGrid"; modelName: "VideosModel" }37 ListElement { category: "Videos Popular Online"; component: "VideosGrid"; modelName: "VideosModel" }
41 function getCategory(category1) {38 function getCategory(category1) {
42 if (category1 === "Frequent Apps") {39 if (category1 === "Frequent Apps") {
43 return i18n.tr("Frequent Apps");40 return i18n.tr("Frequent Apps");
44 }41 }
45 if (category1 === "Favourite People") {
46 return i18n.tr("Favourite People");
47 }
48 if (category1 === "People Recently in Touch") {
49 return i18n.tr("People Recently in Touch");
50 }
51 if (category1 === "Recent Music") {42 if (category1 === "Recent Music") {
52 return i18n.tr("Recent Music");43 return i18n.tr("Recent Music");
53 }44 }
@@ -90,33 +81,24 @@
90 }81 }
9182
92 Component.onCompleted: {83 Component.onCompleted: {
93 var lens = dashContent.lenses.get("people.lens")84 var scope = dashContent.scopes.get("mockmusicmaster.scope")
94 if (lens) {85 if (scope) {
95 favouritesFilter.model = dashContent.lenses.get("people.lens").results86 musicFilter.model = dashContent.scopes.get("mockmusicmaster.scope").results
96 recentFilter.model = dashContent.lenses.get("people.lens").results87 }
97 }88 scope = dashContent.scopes.get("mockvideosmaster.scope")
98 lens = dashContent.lenses.get("mockmusic.lens")89 if (scope) {
99 if (lens) {90 videosFilter.model = dashContent.scopes.get("mockvideosmaster.scope").results
100 musicFilter.model = dashContent.lenses.get("mockmusic.lens").results
101 }
102 lens = dashContent.lenses.get("mockvideos.lens")
103 if (lens) {
104 videosFilter.model = dashContent.lenses.get("mockvideos.lens").results
105 }91 }
106 }92 }
10793
108 Connections {94 Connections {
109 target: dashContent95 target: dashContent
110 onLensLoaded: switch (lensId) {96 onScopeLoaded: switch (scopeId) {
111 case "people.lens":97 case "mockmusicmaster.scope":
112 favouritesFilter.model = dashContent.lenses.get("people.lens").results98 musicFilter.model = dashContent.scopes.get("mockmusicmaster.scope").results
113 recentFilter.model = dashContent.lenses.get("people.lens").results99 break;
114 break;100 case "mockvideosmaster.scope":
115 case "mockmusic.lens":101 videosFilter.model = dashContent.scopes.get("mockvideosmaster.scope").results
116 musicFilter.model = dashContent.lenses.get("mockmusic.lens").results
117 break;
118 case "mockvideos.lens":
119 videosFilter.model = dashContent.lenses.get("mockvideos.lens").results
120 break;102 break;
121 }103 }
122 }104 }
@@ -140,14 +122,10 @@
140 }122 }
141 }123 }
142124
143 Component { id: peopleCarousel; PeopleCarousel {} }
144 Component { id: peopleGrid; PeopleFilterGrid {} }
145 Component { id: musicGrid; MusicFilterGrid {} }125 Component { id: musicGrid; MusicFilterGrid {} }
146 Component { id: videosGrid; VideosFilterGrid {} }126 Component { id: videosGrid; VideosFilterGrid {} }
147 property var componentModels: {127 property var componentModels: {
148 "AppsGrid": applicationsFilterGrid,128 "AppsGrid": applicationsFilterGrid,
149 "PeopleCarousel": peopleCarousel,
150 "PeopleGrid": peopleGrid,
151 "MusicGrid": musicGrid,129 "MusicGrid": musicGrid,
152 "VideosGrid": videosGrid,130 "VideosGrid": videosGrid,
153 }131 }
@@ -171,7 +149,7 @@
171 onLoaded: {149 onLoaded: {
172 item.model = categoryModels[modelName]150 item.model = categoryModels[modelName]
173151
174 //FIXME: workaround for lack of previews for videos in Home lens.152 //FIXME: workaround for lack of previews for videos in Home scope.
175 //Need to connect to the clicked() signal here and act upon it here instead.153 //Need to connect to the clicked() signal here and act upon it here instead.
176 if (component === "VideosGrid") {154 if (component === "VideosGrid") {
177 function playVideo(index, data) {155 function playVideo(index, data) {
178156
=== modified file 'Dash/DashMusic.qml'
--- Dash/DashMusic.qml 2013-06-08 13:44:29 +0000
+++ Dash/DashMusic.qml 2013-06-19 20:05:35 +0000
@@ -20,8 +20,8 @@
20import "../Components/ListItems" as ListItems20import "../Components/ListItems" as ListItems
21import "Music"21import "Music"
2222
23LensView {23ScopeView {
24 id: lensView24 id: scopeView
2525
26 property var categoryNames: [26 property var categoryNames: [
27 i18n.tr("Featured"),27 i18n.tr("Featured"),
@@ -37,7 +37,7 @@
37 onMovementStarted: categoryView.showHeader()37 onMovementStarted: categoryView.showHeader()
3838
39 Binding {39 Binding {
40 target: lensView.lens40 target: scopeView.scope
41 property: "searchQuery"41 property: "searchQuery"
42 value: pageHeader.searchQuery42 value: pageHeader.searchQuery
43 }43 }
@@ -59,7 +59,7 @@
5959
60 function getRenderer(categoryId) {60 function getRenderer(categoryId) {
61 switch (categoryId) {61 switch (categoryId) {
62 case 0: return musicCarousel62 case 1: return musicCarousel
63 default: return musicFilterGrid63 default: return musicFilterGrid
64 }64 }
65 }65 }
@@ -67,7 +67,7 @@
67 ListViewWithPageHeader {67 ListViewWithPageHeader {
68 id: categoryView68 id: categoryView
69 anchors.fill: parent69 anchors.fill: parent
70 model: lensView.categories70 model: scopeView.categories
7171
72 onAtYEndChanged: if (atYEnd) endReached()72 onAtYEndChanged: if (atYEnd) endReached()
73 onMovingChanged: if (moving && atYEnd) endReached()73 onMovingChanged: if (moving && atYEnd) endReached()
@@ -80,7 +80,7 @@
8080
81 Loader {81 Loader {
82 anchors { top: parent.top; left: parent.left; right: parent.right }82 anchors { top: parent.top; left: parent.left; right: parent.right }
83 sourceComponent: lensView.getRenderer(base.categoryId)83 sourceComponent: scopeView.getRenderer(base.categoryId)
84 onLoaded: {84 onLoaded: {
85 item.model = results85 item.model = results
86 }86 }
@@ -98,7 +98,7 @@
98 width: categoryView.width98 width: categoryView.width
99 text: i18n.tr("Music")99 text: i18n.tr("Music")
100 searchEntryEnabled: true100 searchEntryEnabled: true
101 searchHistory: lensView.searchHistory101 searchHistory: scopeView.searchHistory
102 }102 }
103 }103 }
104}104}
105105
=== removed file 'Dash/DashPeople.qml'
--- Dash/DashPeople.qml 2013-06-08 13:44:29 +0000
+++ Dash/DashPeople.qml 1970-01-01 00:00:00 +0000
@@ -1,235 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import Dee 3.0
20import Unity 0.1
21import Utils 0.1
22import "../Components"
23import "../Components/ListItems" as ListItems
24import "People"
25
26LensView {
27 id: lensView
28 property alias previewShown: previewLoader.onScreen
29
30 property var categoryNames: [
31 i18n.tr("Favourites"),
32 i18n.tr("Recently in touch"),
33 i18n.tr("New Contacts"),
34 i18n.tr("A-Z")
35 ]
36
37 onIsCurrentChanged: {
38 pageHeader.resetSearch();
39 }
40
41 onMovementStarted: categoryView.showHeader()
42
43 Binding {
44 target: lensView.lens
45 property: "searchQuery"
46 value: pageHeader.searchQuery
47 }
48
49 Connections {
50 target: panel
51 onSearchClicked: if (isCurrent) {
52 pageHeader.triggerSearch()
53 categoryView.showHeader()
54 }
55 }
56
57 OpenEffect {
58 id: effect
59 anchors {
60 fill: parent
61 bottomMargin: -bottomOverflow
62 }
63 sourceItem: categoryView
64
65 enabled: gap > 0.0
66
67 topGapPx: (1 - gap) * positionPx
68 topOpacity: (1 - gap * 1.2)
69 bottomGapPx: positionPx + gap * (targetBottomGapPx - positionPx)
70 bottomOverflow: units.gu(20)
71 bottomOpacity: 1 - (gap * 0.8)
72
73 property int targetBottomGapPx: height - units.gu(8) - bottomOverflow
74 property real gap: previewLoader.open ? 1.0 : 0.0
75
76 Behavior on gap {
77 NumberAnimation {
78 duration: 200
79 easing.type: Easing.InOutQuad
80 onRunningChanged: {
81 if (!previewLoader.open && !running) {
82 previewLoader.onScreen = false;
83 }
84 }
85 }
86 }
87 }
88
89 ListViewWithPageHeader {
90 id: categoryView
91 anchors.fill: parent
92 model: lensView.categories
93 onAtYEndChanged: if (atYEnd) endReached()
94 onMovingChanged: if (moving && atYEnd) endReached()
95 clipListView: !previewLoader.onScreen
96
97 delegate: ListItems.Base {
98 id: base
99 property int categoryIndex: index
100 property int categoryId: id
101 highlightWhenPressed: false
102
103 Loader {
104 width: categoryView.width
105 sourceComponent: base.categoryId == 0 ? peopleCarouselComponent : peopleGridComponent
106
107 onLoaded: {
108 item.categoryId = Qt.binding(function() { return base.categoryId; })
109 item.categoryIndex = Qt.binding(function() { return base.categoryIndex; })
110 item.model = results;
111 }
112 }
113 }
114
115 sectionProperty: "name"
116 sectionDelegate: ListItems.Header {
117 width: categoryView.width
118 text: i18n.tr(section)
119 }
120 pageHeader: PageHeader {
121 id: pageHeader
122 width: categoryView.width
123 text: i18n.tr("People")
124 searchEntryEnabled: true
125 searchHistory: lensView.searchHistory
126 }
127 }
128
129 Component {
130 id: peopleCarouselComponent
131 PeopleCarousel {
132 id: peopleCarousel
133
134 property int categoryId
135 property int categoryIndex
136
137 onClicked: {
138 effect.positionPx = mapToItem(categoryView, 0, itemY).y;
139 previewData.model = delegateItem.dataModel;
140 previewData.uri = delegateItem.dataModel.uri;
141 previewLoader.open = true;
142 }
143 }
144 }
145
146 Component {
147 id: peopleGridComponent
148 PeopleFilterGrid {
149 id: peopleGrid
150
151 property int categoryIndex
152
153 onClicked: {
154 if (peopleGrid.columnCount == 1) {
155 if (categoryIndex >= categoryView.model.count -1 && index >= peopleGrid.model.count - 1) {
156 effect.positionPx = mapToItem(categoryView, 0, itemY).y;
157 } else {
158 effect.positionPx = mapToItem(categoryView, 0, itemY + peopleGrid.cellHeight).y
159 }
160 } else {
161 effect.positionPx = mapToItem(categoryView, 0, itemY).y
162 }
163 previewData.model = data;
164 previewData.uri = data.uri
165 previewLoader.open = true;
166 }
167 }
168 }
169
170 Loader {
171 id: previewLoader
172 height: effect.bottomGapPx - effect.topGapPx
173 anchors {
174 top: parent.top
175 topMargin: effect.topGapPx
176 left: parent.left
177 right: parent.right
178 }
179 sourceComponent: onScreen ? previewComponent : undefined
180
181 property bool open: false
182 property bool onScreen: false
183 property QtObject videoItem
184
185 onOpenChanged: {
186 if (open) {
187 onScreen = true
188 }
189 }
190
191 onLoaded: {
192 if (previewData.ready) {
193 item.model = previewData;
194 }
195 }
196 }
197
198 Component {
199 id: previewComponent
200
201 PeoplePreview {
202 id: preview
203 anchors.fill: parent
204 forceSquare: true
205 onClose: {
206 open = false;
207 }
208 }
209 }
210
211 PeoplePreviewData {
212 id: previewData
213 lens: lensView.lens
214 property Data model
215
216 onError: previewLoader.open = false
217 onReadyChanged: {
218 if (previewLoader.item) {
219 previewLoader.item.model = ready ? previewData : undefined
220 }
221 }
222 }
223
224 // TODO: Move as InverseMouseArea to DashPreview
225 MouseArea {
226 enabled: previewLoader.onScreen
227 anchors {
228 fill: parent
229 topMargin: effect.bottomGapPx
230 }
231 onClicked: {
232 previewLoader.open = false;
233 }
234 }
235}
2360
=== modified file 'Dash/DashVideos.qml'
--- Dash/DashVideos.qml 2013-06-08 13:44:29 +0000
+++ Dash/DashVideos.qml 2013-06-19 20:05:35 +0000
@@ -20,8 +20,8 @@
20import "../Components/ListItems" as ListItems20import "../Components/ListItems" as ListItems
21import "Video"21import "Video"
2222
23LensView {23ScopeView {
24 id: lensView24 id: scopeView
25 property alias previewShown: previewLoader.onScreen25 property alias previewShown: previewLoader.onScreen
2626
27 property var categoryNames: [27 property var categoryNames: [
@@ -38,7 +38,7 @@
38 onMovementStarted: categoryView.showHeader()38 onMovementStarted: categoryView.showHeader()
3939
40 Binding {40 Binding {
41 target: lensView.lens41 target: scopeView.scope
42 property: "searchQuery"42 property: "searchQuery"
43 value: pageHeader.searchQuery43 value: pageHeader.searchQuery
44 }44 }
@@ -60,7 +60,7 @@
6060
61 function getRenderer(categoryId) {61 function getRenderer(categoryId) {
62 switch (categoryId) {62 switch (categoryId) {
63 case 0: return videosCarousel63 case 1: return videosCarousel
64 default: return videosFilterGrid64 default: return videosFilterGrid
65 }65 }
66 }66 }
@@ -100,7 +100,7 @@
100 ListViewWithPageHeader {100 ListViewWithPageHeader {
101 id: categoryView101 id: categoryView
102 anchors.fill: parent102 anchors.fill: parent
103 model: lensView.categories103 model: scopeView.categories
104 clipListView: !previewLoader.onScreen104 clipListView: !previewLoader.onScreen
105105
106 onAtYEndChanged: if (atYEnd) endReached()106 onAtYEndChanged: if (atYEnd) endReached()
@@ -115,7 +115,7 @@
115 Loader {115 Loader {
116 id: loader116 id: loader
117 anchors { top: parent.top; left: parent.left; right: parent.right }117 anchors { top: parent.top; left: parent.left; right: parent.right }
118 sourceComponent: lensView.getRenderer(base.categoryId)118 sourceComponent: scopeView.getRenderer(base.categoryId)
119 onLoaded: {119 onLoaded: {
120 item.model = results120 item.model = results
121 }121 }
@@ -127,9 +127,9 @@
127 var dataItem;127 var dataItem;
128 // VideosCarousel and VideosFilterGrid have different128 // VideosCarousel and VideosFilterGrid have different
129 // clicked signals, accomodate for that129 // clicked signals, accomodate for that
130 if (categoryId == 0) {130 if (categoryId == 1) {
131 var fileUri = delegateItem.model.column_0.replace(/^[^:]+:/, "")131 var fileUri = delegateItem.model.column_0.replace(/^[^:]+:/, "")
132 dataItem = {fileUri: fileUri, nfoUri: delegateItem.model.column_5}132 dataItem = {fileUri: fileUri, nfoUri: delegateItem.model.column_6}
133 } else {133 } else {
134 dataItem = data;134 dataItem = data;
135 }135 }
@@ -154,7 +154,7 @@
154 width: categoryView.width154 width: categoryView.width
155 text: i18n.tr("Videos")155 text: i18n.tr("Videos")
156 searchEntryEnabled: true156 searchEntryEnabled: true
157 searchHistory: lensView.searchHistory157 searchHistory: scopeView.searchHistory
158 }158 }
159 }159 }
160160
161161
=== renamed file 'Dash/GenericLensView.qml' => 'Dash/GenericScopeView.qml'
--- Dash/GenericLensView.qml 2013-06-05 22:03:08 +0000
+++ Dash/GenericScopeView.qml 2013-06-19 20:05:35 +0000
@@ -18,9 +18,10 @@
18import Ubuntu.Components 0.118import Ubuntu.Components 0.1
19import "../Components"19import "../Components"
20import "../Components/ListItems" as ListItems20import "../Components/ListItems" as ListItems
21import "../Components/IconUtil.js" as IconUtil
2122
22LensView {23ScopeView {
23 id: lensView24 id: scopeView
2425
25 onIsCurrentChanged: {26 onIsCurrentChanged: {
26 pageHeader.resetSearch();27 pageHeader.resetSearch();
@@ -29,7 +30,7 @@
29 onMovementStarted: categoryView.showHeader()30 onMovementStarted: categoryView.showHeader()
3031
31 Binding {32 Binding {
32 target: lensView.lens33 target: scopeView.scope
33 property: "searchQuery"34 property: "searchQuery"
34 value: pageHeader.searchQuery35 value: pageHeader.searchQuery
35 }36 }
@@ -45,7 +46,7 @@
45 ListViewWithPageHeader {46 ListViewWithPageHeader {
46 id: categoryView47 id: categoryView
47 anchors.fill: parent48 anchors.fill: parent
48 model: lensView.categories49 model: scopeView.categories
49 onAtYEndChanged: if (atYEnd) endReached()50 onAtYEndChanged: if (atYEnd) endReached()
50 onMovingChanged: if (moving && atYEnd) endReached()51 onMovingChanged: if (moving && atYEnd) endReached()
5152
@@ -71,10 +72,10 @@
71 delegate: Tile {72 delegate: Tile {
72 width: filtergrid.cellWidth73 width: filtergrid.cellWidth
73 height: filtergrid.cellHeight74 height: filtergrid.cellHeight
74 text: column_4 ? column_4 : "" // FIXME: this shouldn't be necessary75 text: column_5 ? column_5 : "" // FIXME: this shouldn't be necessary
75 imageWidth: units.gu(11)76 imageWidth: units.gu(11)
76 imageHeight: units.gu(16)77 imageHeight: units.gu(16)
77 source: column_1 ? column_1 : "" // FIXME: ditto78 source: column_1 ? IconUtil.from_gicon(column_1) : "" // FIXME: ditto
78 }79 }
79 }80 }
80 }81 }
@@ -88,7 +89,7 @@
88 id: pageHeader89 id: pageHeader
89 objectName: "pageHeader"90 objectName: "pageHeader"
90 width: categoryView.width91 width: categoryView.width
91 text: lensView.lens.name92 text: scopeView.scope.name
92 searchEntryEnabled: true93 searchEntryEnabled: true
93 }94 }
94 }95 }
9596
=== modified file 'Dash/Music/MusicFilterGrid.qml'
--- Dash/Music/MusicFilterGrid.qml 2013-06-05 22:03:08 +0000
+++ Dash/Music/MusicFilterGrid.qml 2013-06-19 20:05:35 +0000
@@ -38,8 +38,8 @@
38 height: filterGrid.cellHeight38 height: filterGrid.cellHeight
39 iconWidth: filterGrid.iconWidth39 iconWidth: filterGrid.iconWidth
40 iconHeight: filterGrid.iconHeight40 iconHeight: filterGrid.iconHeight
41 artist: model.column_441 artist: model.column_5
42 album: model.column_542 album: model.column_6
43 source: model.column_143 source: model.column_1
44 onClicked: {44 onClicked: {
45 filterGrid.clicked(index);45 filterGrid.clicked(index);
4646
=== removed directory 'Dash/People'
=== removed file 'Dash/People/CarouselDelegatePeople.qml'
--- Dash/People/CarouselDelegatePeople.qml 2013-06-05 22:03:08 +0000
+++ Dash/People/CarouselDelegatePeople.qml 1970-01-01 00:00:00 +0000
@@ -1,166 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
20
21BaseCarouselDelegate {
22 id: item
23
24 property var dataModel
25 readonly property real frameHeight: Math.max(height / 3.6, units.gu(5.5))
26
27 UbuntuShape {
28 anchors.fill: parent
29 radius: "medium"
30 borderSource: ""
31 image: Image {
32 asynchronous: true
33 sourceSize { width: item.width; height: item.height }
34 source: dataModel.avatar ? dataModel.avatar : ""
35 fillMode: Image.PreserveAspectCrop
36 }
37 }
38
39 Component {
40 id: component_frame
41 Item {
42 id: frame
43
44 BorderImage {
45 // TODO This will go away once we have 'clip: true' in UbuntuShape
46 anchors.centerIn: parent
47 width: parent.width + units.gu(1.5)
48 height: parent.height + units.gu(1.5)
49 visible: labelRemotePost.visible
50 opacity: 0.9
51 source: "graphics/bottomshape.sci"
52 }
53
54 property bool showRemoteDetails: true
55 // To decide if the remote icon and time should be shown, its once layed out to do so.
56 // Then it's checked if everything fits in the frame size. If not, showRemoteDetails is set false
57 // Using bindings to do so cause a binding loop
58 function checkSizeForRemoteDetails() {
59 showRemoteDetails = true
60 showRemoteDetails = (frame.height - column.minimumHeight) >= labelRemotePostTime.height
61 }
62
63 Item {
64 id: remoteSourceIconContainer
65
66 // TODO use proper asset and get rid of these dimensions
67 width: units.gu(3)
68 height: units.gu(4)
69 visible: showRemoteDetails
70
71 Image {
72 anchors.centerIn: parent
73 anchors.horizontalCenterOffset: units.gu(1)
74 source: dataModel.remoteSourceIcon ? dataModel.remoteSourceIcon : ""
75 fillMode: Image.PreserveAspectFit
76 }
77 }
78
79 Column {
80 id: column
81
82 property real minimumHeight: labelName.height + labelRemotePost.height + anchors.topMargin + anchors.bottomMargin
83
84 anchors {
85 left: remoteSourceIconContainer.visible ? remoteSourceIconContainer.right : parent.left
86 right: parent.right
87 top: remoteSourceIconContainer.visible ? parent.top : undefined
88 verticalCenter: remoteSourceIconContainer.visible ? undefined : parent.verticalCenter
89 margins: units.gu(1)
90 }
91
92 Label {
93 id: labelName
94
95 width: parent.width
96 text: dataModel.name ? dataModel.name : ""
97 color: "white"
98 fontSize: "x-small"
99 elide: Text.ElideRight
100 font.weight: Font.Bold
101 onTextChanged: checkSizeForRemoteDetails()
102 }
103
104 Label {
105 id: labelRemotePost
106
107 width: parent.width
108 text: dataModel.remotePost ? dataModel.remotePost : ""
109 color: "white"
110 opacity: 0.8
111 fontSize: "xx-small"
112 elide: Text.ElideRight
113 maximumLineCount: 2
114 wrapMode: Text.WordWrap
115 onTextChanged: checkSizeForRemoteDetails()
116 }
117
118 Label {
119 id: labelRemotePostTime
120
121 width: parent.width
122 text: model.remotePostTime ? model.remotePostTime : ""
123 color: "white"
124 opacity: 0.5
125 fontSize: "xx-small"
126 elide: Text.ElideRight
127 visible: showRemoteDetails
128 onTextChanged: checkSizeForRemoteDetails()
129 }
130 }
131
132 onHeightChanged: checkSizeForRemoteDetails()
133 onWidthChanged: checkSizeForRemoteDetails()
134 Component.onCompleted: checkSizeForRemoteDetails()
135 }
136 }
137
138 Loader {
139 id: loader_frame
140
141 anchors {
142 left: parent.left
143 right: parent.right
144 bottom: parent.bottom
145 }
146 height: item.frameHeight
147 opacity: item.explicitlyScaled ? 1.0 : 0
148
149 Behavior on opacity {
150 NumberAnimation {
151 duration: 250
152 easing.type: Easing.InOutQuad
153 }
154 }
155
156 sourceComponent: opacity > 0 ? component_frame : undefined
157 }
158
159 BorderImage {
160 anchors.centerIn: parent
161 opacity: 0.6
162 source: "../../Components/graphics/non-selected.sci"
163 width: parent.width + units.gu(1.5)
164 height: parent.height + units.gu(1.5)
165 }
166}
1670
=== removed file 'Dash/People/Data.qml'
--- Dash/People/Data.qml 2013-06-05 22:03:08 +0000
+++ Dash/People/Data.qml 1970-01-01 00:00:00 +0000
@@ -1,71 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Dee 3.0
19
20DeeVariantText {
21 property string uri
22 property string name
23 property url avatar
24 property var emails: ListModel {}
25 property var phones: ListModel {}
26 property string presenceStatus
27 property string presenceMessage
28 property url remoteSourceIcon
29 property string remotePost
30 property bool favorite
31 property bool recent
32 property url statusIcon
33 property string status: remotePost ? remotePost : presenceMessage
34 property url recentIcon
35 property string recentTime
36
37 statusIcon: switch(presenceStatus) {
38 case "offline": "graphics/icon_offline.png"; break
39 // FIXME random for now, as we don't get actual presence data on the phone
40 case "":
41 var r = Math.random();
42 if (r >= 0.7) "graphics/icon_online.png"
43 else if (r >= 0.4) "graphics/icon_offline.png"
44 else "graphics/icon_unknown.png"
45 break;
46 default: "graphics/icon_online.png"
47 }
48
49 onValueChanged: {
50 for (var i in value) switch (value[i][0]) {
51 case "presence-message": presenceMessage = value[i][1]; break
52 case "presence-status": presenceStatus = value[i][1]; break
53 case "remote-source-icon": remoteSourceIcon = value[i][1]; break
54 case "remote-post": remotePost = value[i][1]; break
55 case "recent-icon": recentIcon = value[i][1]; break
56 case "recent-time": recentTime = value[i][1]; break
57 case "phone": phones.append({"type": generateType(), "number": value[i][1]}); break
58 case "email": emails.append({"type": generateType(), "address": value[i][1]}); break
59 }
60 }
61
62 // FIXME: random for now, as we don't have multiple phone numbers in the backend yet
63 function generateType() {
64 var phoneType = "";
65 var r = Math.random();
66 if (r >= 0.7) phoneType = "Private";
67 else if (r >= 0.4) phoneType = "Mobile";
68 else phoneType = "Work";
69 return phoneType;
70 }
71}
720
=== removed file 'Dash/People/Delegate.qml'
--- Dash/People/Delegate.qml 2013-06-05 22:03:08 +0000
+++ Dash/People/Delegate.qml 1970-01-01 00:00:00 +0000
@@ -1,167 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
20import "../../Components/Time.js" as Time
21
22Item {
23 id: peopleView
24
25 property var dataModel
26
27 property int __spacing: units.gu(1)
28
29 /* Select what is shown in the subtitle
30 data: phone number or email address
31 status: social media presence status
32 */
33 property string subtitleType: "data"
34 height: subtitleType == "data" && detailsLabel.lineCount < 2 ? units.gu(10) : units.gu(11.5)
35
36 Row {
37 id: row
38 anchors {
39 left: parent.left
40 right: parent.right
41 leftMargin: units.gu(2)
42 rightMargin: units.gu(4)
43 top: parent.top
44 topMargin: units.gu(2)
45 }
46 spacing: __spacing
47
48 UbuntuShape {
49 id: avatar
50 anchors { top: parent.top }
51 width: units.gu(6)
52 height: units.gu(6)
53 image: Image {
54 width: units.gu(6)
55 source: peopleView.dataModel.avatar
56 sourceSize { width: avatar.width; height: avatar.height }
57 fillMode: Image.PreserveAspectCrop
58 smooth: true
59 asynchronous: true
60 cache: false
61 }
62 }
63
64 Grid {
65 spacing: units.gu(0.5)
66 width: parent.width - x
67 columns: 2
68
69 Item {
70 height: units.gu(2)
71 width: units.gu(2)
72
73 Image {
74 id: statusImage
75 source: peopleView.dataModel.statusIcon
76 width: units.gu(1.5)
77 height: units.gu(1.5)
78 fillMode: Image.PreserveAspectFit
79 smooth: true
80 anchors.verticalCenter: parent.verticalCenter
81 }
82 }
83
84 Label {
85 id: nameLabel
86 elide: Text.ElideRight
87 text: peopleView.dataModel.name
88 color: "#f3f3e7"
89 style: Text.Raised
90 styleColor: "black"
91 font.weight: Font.DemiBold;
92 opacity: 0.9;
93 }
94
95 Image {
96 source: switch(peopleView.subtitleType) {
97 case "data":
98 return peopleView.dataModel.remoteSourceIcon;
99 case "status":
100 return peopleView.dataModel.recent ? peopleView.dataModel.recentIcon : "";
101 }
102
103 width: units.gu(1.5)
104 height: units.gu(1.5)
105 fillMode: Image.PreserveAspectFit
106 smooth: true
107 }
108
109 Label {
110 id: detailsLabel
111 width: parent.width - x
112 elide: Text.ElideRight
113 text: switch (peopleView.subtitleType) {
114 case "data":
115 if (peopleView.dataModel.phones && peopleView.dataModel.phones.count > 0) {
116 return peopleView.dataModel.phones.get(0).number;
117 } else if (peopleView.dataModel.emails && peopleView.dataModel.emails.count > 0) {
118 return peopleView.dataModel.emails.get(0).address;
119 }
120 return "";
121 case "status":
122 return peopleView.dataModel.status;
123 }
124 color: "#f3f3e7"
125 style: Text.Raised
126 styleColor: "black"
127 opacity: 0.7;
128 fontSize: "small";
129 wrapMode: Text.WordWrap;
130 maximumLineCount: 2;
131 }
132
133 Item {
134 height: units.gu(2)
135 width: units.gu(1.5)
136
137 // Placeholder
138 }
139
140 Label {
141 width: parent.width - x
142 elide: Text.ElideRight
143 text: switch (peopleView.subtitleType) {
144 case "data":
145 if (peopleView.dataModel.phones && peopleView.dataModel.phones.count > 0) {
146 return peopleView.dataModel.phones.get(0).type;
147 } else if (peopleView.dataModel.emails && peopleView.dataModel.emails.count > 0) {
148 return peopleView.dataModel.emails.get(0).type;
149 }
150 return "";
151 case "status":
152 if (peopleView.dataModel.recent) {
153 var time = Time.readableFromNow(peopleView.dataModel.recentTime);
154 return time ? time : peopleView.dataModel.recentTime;
155 } else {
156 return peopleView.dataModel.status
157 }
158 }
159 color: "#8f8f88"
160 style: Text.Raised
161 styleColor: "black"
162 opacity: 0.7;
163 fontSize: "x-small";
164 }
165 }
166 }
167}
1680
=== removed file 'Dash/People/PeopleCarousel.qml'
--- Dash/People/PeopleCarousel.qml 2013-06-05 22:03:08 +0000
+++ Dash/People/PeopleCarousel.qml 1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import "../../Components"
19
20Carousel {
21 id: peopleCarousel
22 tileAspectRatio: 1
23 minimumTileWidth: units.gu(13)
24 itemComponent: carouselDelegatePeople
25 selectedItemScaleFactor: 1.2
26 cacheBuffer: 1404 // 18px * 13gu * 6
27 height: implicitHeight + units.gu(6)
28
29 Component {
30 id: carouselDelegatePeople
31 CarouselDelegatePeople {
32 dataModel: data
33
34 Data {
35 id: data
36 uri: model.column_0
37 text: model.column_5
38 name: model.column_4
39 avatar: model.column_1
40 }
41 }
42 }
43}
440
=== removed file 'Dash/People/PeopleFilterGrid.qml'
--- Dash/People/PeopleFilterGrid.qml 2013-06-05 22:03:08 +0000
+++ Dash/People/PeopleFilterGrid.qml 1970-01-01 00:00:00 +0000
@@ -1,74 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import "../../Components"
19import "../../Components/ListItems" as ListItems
20
21FilterGrid {
22 id: filterGrid
23
24 filter: true
25 minimumHorizontalSpacing: 0
26 delegateWidth: units.gu(40)
27 delegateHeight: showStatusMessage ? units.gu(11.5) : units.gu(10)
28 verticalSpacing: 0
29 collapsedRowCount: 50 / columns
30 expandable: false
31
32 property int categoryId
33 property bool showStatusMessage: categoryId == 1 || categoryId == 2
34
35 readonly property int columnCount: width / cellWidth
36
37 signal clicked(int index, variant data, real itemY)
38
39 delegate: ListItems.Base {
40 id: tile
41 objectName: "delegate" + index
42 width: filterGrid.cellWidth
43 showDivider: index < Math.floor((filterGrid.model.count-1) / filterGrid.columnCount) * filterGrid.columnCount
44
45 onClicked: {
46 filterGrid.clicked(index, data, tile.y);
47 }
48
49 Delegate {
50 width: filterGrid.cellWidth
51 height: filterGrid.cellHeight
52 // This caches the Delegate into FBO because:
53 // - People data Delegates are slow because of their item count
54 // - FilterGrid is "height: childrenRect.height" so all delegates are always loaded
55 // TODO: Optimize this by:
56 // - not loading all delegates all the time and remove layer.enabled and/or
57 // - destroy whole lens when not visible/needed to free the GPU memory
58 layer.enabled: true
59
60 dataModel: data
61 subtitleType: filterGrid.showStatusMessage ? "status" : "data"
62
63 Data {
64 id: data
65 uri: column_0
66 text: column_5
67 name: column_4
68 avatar: column_1
69 favorite: filterGrid.categoryId == 0
70 recent: filterGrid.showStatusMessage
71 }
72 }
73 }
74}
750
=== removed file 'Dash/People/PeoplePreview.qml'
--- Dash/People/PeoplePreview.qml 2013-06-05 22:03:08 +0000
+++ Dash/People/PeoplePreview.qml 1970-01-01 00:00:00 +0000
@@ -1,124 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
20import "../../Components/ListItems" as ListItems
21import ".."
22import "Preview"
23
24DashPreview {
25 id: preview
26
27 property var model: undefined
28
29 title: (model && model.displayName) ? model.displayName : ""
30 url: (model && model.avatar) ? model.avatar : ""
31 previewWidthRatio: 0.34
32
33
34 description: Grid {
35 spacing: columns > 1 ? units.gu(2) : 0
36 columns: preview.narrowMode || width < units.gu(60) ? 1 : 2
37 property int columnWidth: columns > 1 ? (width - spacing * (columns - 1)) / columns : width
38 anchors {
39 left: parent.left
40 right: parent.right
41 }
42
43 Status {
44 id: status
45 objectName: "statusField"
46 width: parent.columnWidth
47 visible: preview.model != undefined && preview.model.status != undefined
48 model: preview.model
49 property int index: 1
50 // FIXME that should trigger the action on the lens/scope, when there's support
51 onClicked: shell.activateApplication("/usr/share/applications/%1-webapp.desktop".arg(model.statusService), "--homepage=%1".arg(model.statusPostUri))
52 }
53
54
55 Column {
56 id: descriptionColumn
57 width: parent.columnWidth
58
59
60 Column {
61 anchors {
62 left: parent.left
63 right: parent.right
64 }
65
66 Repeater {
67 model: preview.model ? preview.model.phoneNumbers : undefined
68
69 delegate: Phone {
70 objectName: "phoneField" + index
71 model: preview.model
72 // FIXME these should trigger actions on the lens/scope, when there's support
73 onPhoneClicked: shell.activateApplication("/usr/share/applications/phone-app.desktop", "call://%1".arg(number.replace(/[^\d\+]/g, "")))
74 onTextClicked: shell.activateApplication("/usr/share/applications/phone-app.desktop", "message://%1".arg(number.replace(/[^\d\+]/g, "")))
75 }
76 }
77 }
78
79 Column {
80 anchors {
81 left: parent.left
82 right: parent.right
83 }
84
85 Repeater {
86 model: preview.model ? preview.model.emailAddresses : undefined
87 delegate: Generic {
88 objectName: "emailField" + index
89 type: "email"
90 }
91 }
92 }
93
94 Column {
95 anchors {
96 left: parent.left
97 right: parent.right
98 }
99
100 Repeater {
101 model: preview.model ? preview.model.imAccounts : undefined
102 delegate: Generic {
103 objectName: "imField" + index
104 type: "imAccount"
105 }
106 }
107 }
108
109 Column {
110 anchors {
111 left: parent.left
112 right: parent.right
113 }
114
115 Repeater {
116 model: preview.model ? preview.model.addresses : undefined
117 delegate: Address {
118 objectName: "addressField" + index
119 }
120 }
121 }
122 }
123 }
124}
1250
=== removed directory 'Dash/People/Preview'
=== removed file 'Dash/People/Preview/Address.qml'
--- Dash/People/Preview/Address.qml 2013-06-05 22:03:08 +0000
+++ Dash/People/Preview/Address.qml 1970-01-01 00:00:00 +0000
@@ -1,74 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20Base {
21 id: root
22
23 Item {
24 anchors {
25 left: parent.left
26 right: parent.right
27 leftMargin: units.gu(2)
28 rightMargin: units.gu(4)
29 }
30 height: childrenRect.height + units.gu(2.5)
31
32 Label {
33 id: typeLabel
34 anchors {
35 top: parent.top
36 topMargin: units.gu(1)
37 }
38 text: type
39 elide: Text.ElideRight
40 color: "#f3f3e7"
41 style: Text.Raised
42 styleColor: "black"
43 font.capitalization: Font.Capitalize
44 opacity: 0.7;
45 fontSize: "small"
46 }
47
48 Label {
49 id: contentLabel
50 anchors {
51 left: parent.left
52 right: parent.right
53 top: typeLabel.bottom
54 topMargin: units.gu(0.5)
55 }
56 text: {
57 var fields = [street, poBox, extension, locality, region, postalCode, country, addressFormat]
58 var parts = []
59 for (var k in fields) {
60 if (fields[k]) parts.push(fields[k])
61 }
62 return parts.join("\n")
63 }
64 elide: Text.ElideRight
65 color: "#f3f3e7"
66 style: Text.Raised
67 styleColor: "black"
68 opacity: 0.9;
69 fontSize: "large"
70 wrapMode: Text.WordWrap
71 font.weight: Font.Light
72 }
73 }
74}
750
=== removed file 'Dash/People/Preview/Base.qml'
--- Dash/People/Preview/Base.qml 2013-06-05 22:03:08 +0000
+++ Dash/People/Preview/Base.qml 1970-01-01 00:00:00 +0000
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import "../../../Components/ListItems"
19
20Base {
21 property var model
22}
230
=== removed file 'Dash/People/Preview/Generic.qml'
--- Dash/People/Preview/Generic.qml 2013-06-05 22:03:08 +0000
+++ Dash/People/Preview/Generic.qml 1970-01-01 00:00:00 +0000
@@ -1,80 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20Base {
21 id: root
22
23 property string type
24
25 Item {
26 anchors {
27 left: parent.left
28 right: parent.right
29 leftMargin: units.gu(2)
30 rightMargin: units.gu(4)
31 }
32 height: childrenRect.height + units.gu(2.5)
33
34 Label {
35 id: typeLabel
36 anchors {
37 top: parent.top
38 topMargin: units.gu(1)
39 }
40 text: switch (root.type) {
41 case "email":
42 case "address": type; break
43 case "imAccount": protocol; break
44 default: type
45 }
46 elide: Text.ElideRight
47 color: "#f3f3e7"
48 style: Text.Raised
49 styleColor: "black"
50 font.capitalization: Font.Capitalize
51 opacity: 0.7;
52 fontSize: "small"
53 }
54
55 Label {
56 id: contentLabel
57 anchors {
58 left: parent.left
59 right: parent.right
60 top: typeLabel.bottom
61 topMargin: units.gu(0.5)
62 }
63 text: switch (root.type) {
64 case "email":
65 case "address":
66 case "imAccount": address; break
67 default: text
68 }
69 elide: Text.ElideRight
70 color: "#f3f3e7"
71 style: Text.Raised
72 styleColor: "black"
73 opacity: 0.9;
74 fontSize: "large"
75 wrapMode: Text.WordWrap
76 maximumLineCount: 2
77 font.weight: Font.Light
78 }
79 }
80}
810
=== removed file 'Dash/People/Preview/Phone.qml'
--- Dash/People/Preview/Phone.qml 2013-06-05 22:03:08 +0000
+++ Dash/People/Preview/Phone.qml 1970-01-01 00:00:00 +0000
@@ -1,108 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../../Components/ListItems" as ListItems
20
21Base {
22 id: root
23 highlightWhenPressed: false
24
25 signal phoneClicked
26 signal textClicked
27
28 Row {
29 height: phoneButton.height
30 anchors {
31 left: parent.left
32 right: parent.right
33 }
34 AbstractButton {
35 id: phoneButton
36 width: parent.width - units.gu(7)
37 height: Math.max(units.gu(8), phoneColumn.height + units.gu(2))
38 Column {
39 id: phoneColumn
40 spacing: units.gu(0.5)
41 anchors {
42 top: parent.top
43 topMargin: units.gu(1)
44 left: parent.left
45 leftMargin: units.gu(2)
46 right: parent.right
47 }
48 Label {
49 text: {
50 var parts = []
51 if (location) parts.push(location)
52 if (type && type != "voice") parts.push(type)
53 if (parts.length == 0) return "other"
54 return parts.join(" ")
55 }
56 elide: Text.ElideRight
57 color: "#f3f3e7"
58 style: Text.Raised
59 styleColor: "black"
60 font.capitalization: Font.Capitalize
61 opacity: 0.7;
62 fontSize: "small"
63 }
64 Label {
65 width: parent.width
66 text: number
67 elide: Text.ElideRight
68 color: "#f3f3e7"
69 style: Text.Raised
70 styleColor: "black"
71 opacity: 0.9;
72 fontSize: "large"
73 wrapMode: Text.WordWrap
74 maximumLineCount: 2
75 font.weight: Font.Light
76 }
77 }
78
79 ListItems.Highlight {
80 anchors.fill: parent
81 pressed: phoneButton.pressed
82 }
83
84 onClicked: phoneClicked()
85 }
86
87 AbstractButton {
88 id: textButton
89 width: units.gu(7)
90 height: parent.height
91
92 Image {
93 anchors.centerIn: parent
94 width: units.gu(4)
95 height: units.gu(4)
96 source: "../graphics/icon_write_text.png"
97 fillMode: Image.PreserveAspectFit
98 }
99
100 ListItems.Highlight {
101 anchors.fill: parent
102 pressed: textButton.pressed
103 }
104
105 onClicked: textClicked()
106 }
107 }
108}
1090
=== removed file 'Dash/People/Preview/Status.qml'
--- Dash/People/Preview/Status.qml 2013-06-05 22:03:08 +0000
+++ Dash/People/Preview/Status.qml 1970-01-01 00:00:00 +0000
@@ -1,97 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../../Components/Time.js" as Time
20
21Base {
22 id: root
23
24 Item {
25 anchors {
26 left: parent.left
27 right: parent.right
28 leftMargin: units.gu(2)
29 rightMargin: units.gu(4)
30 }
31 height: childrenRect.height
32
33 Label {
34 id: typeLabel
35 anchors {
36 top: parent.top
37 topMargin: units.gu(1)
38 }
39 text: "Status"
40 elide: Text.ElideRight
41 color: "#f3f3e7"
42 style: Text.Raised
43 styleColor: "black"
44 font.capitalization: Font.Capitalize
45 opacity: 0.7;
46 fontSize: "small"
47 }
48
49 Label {
50 id: contentLabel
51 anchors {
52 left: parent.left
53 right: parent.right
54 top: typeLabel.bottom
55 topMargin: units.gu(0.5)
56 }
57 text: root.model ? root.model.status : ""
58 elide: Text.ElideRight
59 color: "#f3f3e7"
60 style: Text.Raised
61 styleColor: "black"
62 opacity: 0.9;
63 fontSize: "large"
64 wrapMode: Text.WordWrap
65 maximumLineCount: 6
66 font.weight: Font.Light
67 }
68
69 Row {
70 anchors {
71 top: contentLabel.bottom
72 topMargin: units.gu(1)
73 }
74 height: statusText.height + units.gu(2.5)
75 spacing: units.gu(1)
76 Image {
77 width: units.gu(2)
78 height: units.gu(2)
79 fillMode: Image.PreserveAspectFit
80 source: root.model ? root.model.statusServiceIcon : ""
81 }
82 Label {
83 id: statusText
84 text: if (root.model) {
85 var time = Time.readableFromNow(root.model.statusTime);
86 return time ? time : root.model.statusTime;
87 } else return "";
88 elide: Text.ElideRight
89 color: "#f3f3e7"
90 style: Text.Raised
91 styleColor: "black"
92 opacity: 0.7;
93 fontSize: "small"
94 }
95 }
96 }
97}
980
=== removed directory 'Dash/People/graphics'
=== removed file 'Dash/People/graphics/bottomshape@18.png'
99Binary 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 differ1Binary 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
=== removed file 'Dash/People/graphics/bottomshape@18.sci'
--- Dash/People/graphics/bottomshape@18.sci 2013-06-05 22:03:08 +0000
+++ Dash/People/graphics/bottomshape@18.sci 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
1border.left: 54
2border.top: 60
3border.bottom: 60
4border.right: 54
5source: bottomshape@18.png
60
=== removed file 'Dash/People/graphics/icon_facebook@18.png'
7Binary 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 differ1Binary 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
=== removed file 'Dash/People/graphics/icon_offline@18.png'
8Binary 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 differ2Binary 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
=== removed file 'Dash/People/graphics/icon_online@18.png'
9Binary 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 differ3Binary 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
=== removed file 'Dash/People/graphics/icon_twitter@18.png'
10Binary 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 differ4Binary 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
=== removed file 'Dash/People/graphics/icon_unknown@18.png'
11Binary 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 differ5Binary 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
=== removed file 'Dash/People/graphics/icon_write_text@18.png'
12Binary 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 differ6Binary 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
=== removed file 'Dash/People/graphics/star_favourite@18.png'
13Binary 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 differ7Binary 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
=== removed file 'Dash/People/graphics/star_not_favourite@18.png'
14Binary 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 differ8Binary 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
=== renamed file 'Dash/LensDelegateMapper.qml' => 'Dash/ScopeDelegateMapper.qml'
--- Dash/LensDelegateMapper.qml 2013-06-07 09:22:34 +0000
+++ Dash/ScopeDelegateMapper.qml 2013-06-19 20:05:35 +0000
@@ -17,19 +17,18 @@
17import QtQuick 2.017import QtQuick 2.0
1818
19QtObject {19QtObject {
20 property var lensDelegateMapping: {"mockmusic.lens": "DashMusic.qml",20 property var scopeDelegateMapping: {"mockmusicmaster.scope": "DashMusic.qml",
21 "applications.lens": "DashApps.qml",21 "applications.scope": "DashApps.qml",
22 "home.lens": "DashHome.qml",22 "home.scope": "DashHome.qml",
23 "mockvideos.lens": "DashVideos.qml",23 "mockvideosmaster.scope": "DashVideos.qml"
24 "people.lens": "DashPeople.qml",
25 }24 }
26 property string genericLens: "GenericLensView.qml"25 property string genericScope: "GenericScopeView.qml"
2726
28 function map(lensId) {27 function map(scopeId) {
29 var customLens = lensDelegateMapping[lensId]28 var customScope = scopeDelegateMapping[scopeId]
30 if (customLens != undefined) {29 if (customScope != undefined) {
31 return customLens30 return customScope
32 }31 }
33 return genericLens32 return genericScope
34 }33 }
35}34}
3635
=== renamed file 'Dash/LensView.qml' => 'Dash/ScopeView.qml'
--- Dash/LensView.qml 2013-06-05 22:03:08 +0000
+++ Dash/ScopeView.qml 2013-06-19 20:05:35 +0000
@@ -19,7 +19,7 @@
19import Unity 0.119import Unity 0.1
2020
21FocusScope {21FocusScope {
22 property Lens lens22 property Scope scope
23 property SortFilterProxyModel categories: categoryFilter23 property SortFilterProxyModel categories: categoryFilter
24 property bool isCurrent24 property bool isCurrent
25 property ListModel searchHistory25 property ListModel searchHistory
@@ -29,17 +29,17 @@
29 signal positionedAtBeginning29 signal positionedAtBeginning
3030
31 // FIXME delay the search so that daemons have time to settle31 // FIXME delay the search so that daemons have time to settle
32 onLensChanged: timer.restart()32 onScopeChanged: timer.restart()
3333
34 Timer {34 Timer {
35 id: timer35 id: timer
36 interval: 200036 interval: 2000
37 onTriggered: lens.searchQuery = ""37 onTriggered: scope.searchQuery = ""
38 }38 }
3939
40 SortFilterProxyModel {40 SortFilterProxyModel {
41 id: categoryFilter41 id: categoryFilter
42 model: lens.categories42 model: scope.categories
43 dynamicSortFilter: true43 dynamicSortFilter: true
44 filterRole: Categories.RoleCount44 filterRole: Categories.RoleCount
45 filterRegExp: /^0$/45 filterRegExp: /^0$/
4646
=== modified file 'Dash/Video/VideosFilterGrid.qml'
--- Dash/Video/VideosFilterGrid.qml 2013-06-05 22:03:08 +0000
+++ Dash/Video/VideosFilterGrid.qml 2013-06-19 20:05:35 +0000
@@ -37,14 +37,14 @@
37 objectName: "delegate" + index37 objectName: "delegate" + index
38 width: filtergrid.cellWidth38 width: filtergrid.cellWidth
39 height: filtergrid.cellHeight39 height: filtergrid.cellHeight
40 text: model.column_440 text: model.column_5
41 imageWidth: filtergrid.iconWidth41 imageWidth: filtergrid.iconWidth
42 imageHeight: filtergrid.iconHeight42 imageHeight: filtergrid.iconHeight
43 source: model.column_143 source: model.column_1
44 fillMode: Image.PreserveAspectCrop44 fillMode: Image.PreserveAspectCrop
45 onClicked: {45 onClicked: {
46 var fileUri = model.column_0.replace(/^[^:]+:/, "")46 var fileUri = model.column_0.replace(/^[^:]+:/, "")
47 var data = {fileUri: fileUri, nfoUri: model.column_5}47 var data = {fileUri: fileUri, nfoUri: model.column_6}
48 filtergrid.clicked(index, data, tile.y);48 filtergrid.clicked(index, data, tile.y);
49 }49 }
50 }50 }
5151
=== removed directory 'Dash/graphics/lensIcons'
=== removed file 'Dash/graphics/lensIcons/Applications@18.png'
52Binary 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 differ52Binary 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
=== removed file 'Dash/graphics/lensIcons/Home@18.png'
53Binary 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 differ53Binary 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
=== removed file 'Dash/graphics/lensIcons/Music@18.png'
54Binary 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 differ54Binary 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
=== removed file 'Dash/graphics/lensIcons/People@18.png'
55Binary 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 differ55Binary 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
=== removed file 'Dash/graphics/lensIcons/Videos@18.png'
56Binary 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 differ56Binary 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
=== modified file 'Shell.qml'
--- Shell.qml 2013-06-19 18:10:57 +0000
+++ Shell.qml 2013-06-19 20:05:35 +0000
@@ -552,14 +552,14 @@
552 greeter.hide()552 greeter.hide()
553 // Animate if moving between application and dash553 // Animate if moving between application and dash
554 if (!stages.shown) {554 if (!stages.shown) {
555 dash.setCurrentLens("home.lens", true, false)555 dash.setCurrentScope("home.scope", true, false)
556 } else {556 } else {
557 dash.setCurrentLens("home.lens", false, false)557 dash.setCurrentScope("home.scope", false, false)
558 }558 }
559 stages.hide();559 stages.hide();
560 }560 }
561 onDash: {561 onDash: {
562 dash.setCurrentLens("applications.lens", true, false)562 dash.setCurrentScope("applications.scope", true, false)
563 stages.hide();563 stages.hide();
564 }564 }
565 onLauncherApplicationSelected:{565 onLauncherApplicationSelected:{
566566
=== modified file 'build_unity'
--- build_unity 2013-06-07 10:36:14 +0000
+++ build_unity 2013-06-19 20:05:35 +0000
@@ -6,11 +6,10 @@
6UPDATE=false6UPDATE=false
7CLEAN=false7CLEAN=false
8NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))8NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))
9LENSES="applications mockmusic mockvideos"
109
11# verified working revisions10# verified working revisions
12LIBUNITY_REV=21511LIBUNITY_REV=228
13UNITY_REV=326012UNITY_REV=3343
14HUD_REV=25213HUD_REV=252
1514
16usage() {15usage() {
@@ -53,12 +52,12 @@
5352
54branch_libunity() {53branch_libunity() {
55 echo "Branching libunity.."54 echo "Branching libunity.."
56 bzr branch lp:libunity/phablet $TARGET_DIR/libunity || exit 855 bzr branch lp:libunity $TARGET_DIR/libunity || exit 8
57}56}
5857
59branch_unity() {58branch_unity() {
60 echo "Branching Unity.."59 echo "Branching Unity.."
61 bzr branch lp:unity/phablet-mods $TARGET_DIR/unity || exit 960 bzr branch lp:unity $TARGET_DIR/unity || exit 9
62}61}
6362
64branch_hud() {63branch_hud() {
@@ -92,7 +91,7 @@
92 mkdir $TARGET_DIR/libunity/build91 mkdir $TARGET_DIR/libunity/build
93 cd $TARGET_DIR/libunity/build92 cd $TARGET_DIR/libunity/build
9493
95 ../autogen.sh --prefix $BUILD_DIR --disable-debug || exit 1594 ../autogen.sh --prefix $BUILD_DIR --disable-debug --with-pygi-overrides-dir=$BUILD_DIR/gi-overrides || exit 15
9695
97 echo "Building libunity and installing in " $BUILD_DIR96 echo "Building libunity and installing in " $BUILD_DIR
98 make -j$NUM_JOBS install || exit 1697 make -j$NUM_JOBS install || exit 16
@@ -136,14 +135,6 @@
136135
137}136}
138137
139link_lenses() {
140 echo "Linking system lenses.."
141 mkdir -p $BUILD_DIR/share/unity/lenses/
142 for LENS in $LENSES; do
143 [ -e $BUILD_DIR/share/unity/lenses/$LENS ] || ln -ivs /usr/share/unity/lenses/$LENS $BUILD_DIR/share/unity/lenses/$LENS
144 done
145}
146
147if $SETUP; then138if $SETUP; then
148 echo "Setting up environment for building Unity.."139 echo "Setting up environment for building Unity.."
149 install_utils140 install_utils
@@ -163,6 +154,5 @@
163 compile_libunity154 compile_libunity
164 compile_unity_core155 compile_unity_core
165 compile_hud156 compile_hud
166 link_lenses
167fi157fi
168158
169159
=== modified file 'debian/changelog'
--- debian/changelog 2013-06-05 22:03:08 +0000
+++ debian/changelog 2013-06-19 20:05:35 +0000
@@ -1,3 +1,9 @@
1unity8 (7.81.0) UNRELEASED; urgency=low
2
3 * New version with support for smart scopes.
4
5 -- Michał Sawicz <michal.sawicz@canonical.com> Fri, 14 Jun 2013 12:56:17 +0200
6
1unity8 (7.80.0) saucy; urgency=low7unity8 (7.80.0) saucy; urgency=low
28
3 * Rename to unity8.9 * Rename to unity8.
410
=== modified file 'debian/control'
--- debian/control 2013-06-19 15:25:39 +0000
+++ debian/control 2013-06-19 20:05:35 +0000
@@ -11,7 +11,7 @@
11 libgles2-mesa-dev[armhf],11 libgles2-mesa-dev[armhf],
12 libhud-client2-dev,12 libhud-client2-dev,
13 libpulse-dev,13 libpulse-dev,
14 libunity-core-6.0-dev,14 libunity-core-6.0-dev (<< 7.80),
15 libxcb1-dev,15 libxcb1-dev,
16 pkg-config,16 pkg-config,
17 python3,17 python3,
@@ -51,6 +51,8 @@
51 indicators-client-plugin-network (>= 0.6.1),51 indicators-client-plugin-network (>= 0.6.1),
52 indicators-client-plugin-power (>= 0.6.1),52 indicators-client-plugin-power (>= 0.6.1),
53 indicators-client-plugin-sound (>= 0.6.1),53 indicators-client-plugin-sound (>= 0.6.1),
54 unity-scope-home,
55 unity-lens-applications,
54Description: Ubuntu QML shell56Description: Ubuntu QML shell
55 The Ubuntu QML shell is the primary user interface for Ubuntu devices.57 The Ubuntu QML shell is the primary user interface for Ubuntu devices.
5658
5759
=== modified file 'plugins/Unity/CMakeLists.txt'
--- plugins/Unity/CMakeLists.txt 2013-06-05 22:03:08 +0000
+++ plugins/Unity/CMakeLists.txt 2013-06-19 20:05:35 +0000
@@ -13,11 +13,10 @@
1313
14set(QMLPLUGIN_SRC14set(QMLPLUGIN_SRC
15 ../Utils/qsortfilterproxymodelqml.cpp # FIXME evaluate a more generic approach for using other plugins15 ../Utils/qsortfilterproxymodelqml.cpp # FIXME evaluate a more generic approach for using other plugins
16 lens.cpp16 scope.cpp
17 lenses.cpp17 scopes.cpp
18 categories.cpp18 categories.cpp
19 categoryfilter.cpp19 categoryfilter.cpp
20 peoplepreviewdata.cpp
21 plugin.cpp20 plugin.cpp
22 bottombarvisibilitycommunicatorshell.cpp21 bottombarvisibilitycommunicatorshell.cpp
23 launchermodel.cpp22 launchermodel.cpp
2423
=== modified file 'plugins/Unity/categories.cpp'
--- plugins/Unity/categories.cpp 2013-06-05 22:03:08 +0000
+++ plugins/Unity/categories.cpp 2013-06-19 20:05:35 +0000
@@ -24,7 +24,6 @@
24Categories::Categories(QObject* parent)24Categories::Categories(QObject* parent)
25 : DeeListModel(parent)25 : DeeListModel(parent)
26 , m_resultModel(0)26 , m_resultModel(0)
27 , m_globalResultModel(0)
28{27{
29 // FIXME: need to clean up unused filters on countChanged28 // FIXME: need to clean up unused filters on countChanged
30 m_roles[Categories::RoleId] = "id";29 m_roles[Categories::RoleId] = "id";
@@ -33,9 +32,7 @@
33 m_roles[Categories::RoleRenderer] = "renderer";32 m_roles[Categories::RoleRenderer] = "renderer";
34 m_roles[Categories::RoleHints] = "hints";33 m_roles[Categories::RoleHints] = "hints";
35 m_roles[Categories::RoleResults] = "results";34 m_roles[Categories::RoleResults] = "results";
36 m_roles[Categories::RoleGlobalResults] = "globalResults";
37 m_roles[Categories::RoleCount] = "count";35 m_roles[Categories::RoleCount] = "count";
38 m_roles[Categories::RoleGlobalCount] = "globalCount";
3936
40 // TODO This should not be needed but accumulatting the count changes37 // TODO This should not be needed but accumulatting the count changes
41 // makes the visualization more stable and also makes crashes on fast38 // makes the visualization more stable and also makes crashes on fast
@@ -48,7 +45,6 @@
48Categories::~Categories()45Categories::~Categories()
49{46{
50 qDeleteAll(m_filters);47 qDeleteAll(m_filters);
51 qDeleteAll(m_globalFilters);
52}48}
5349
54CategoryFilter*50CategoryFilter*
@@ -66,21 +62,6 @@
66 return m_filters[index];62 return m_filters[index];
67}63}
6864
69CategoryFilter*
70Categories::getGlobalFilter(int index) const
71{
72 if (!m_globalFilters.contains(index)) {
73 CategoryFilter* filter = new CategoryFilter();
74 connect(filter, SIGNAL(countChanged()), this, SLOT(onGlobalCountChanged()));
75 filter->setModel(m_globalResultModel);
76 filter->setIndex(index);
77
78 m_globalFilters.insert(index, filter);
79 }
80
81 return m_globalFilters[index];
82}
83
84void65void
85Categories::setResultModel(DeeListModel* model)66Categories::setResultModel(DeeListModel* model)
86{67{
@@ -96,20 +77,6 @@
96}77}
9778
98void79void
99Categories::setGlobalResultModel(DeeListModel* model)
100{
101 if (model != m_globalResultModel) {
102 m_globalResultModel = model;
103
104 Q_FOREACH(CategoryFilter* filter, m_globalFilters) {
105 filter->setModel(m_globalResultModel);
106 }
107
108 Q_EMIT globalResultModelChanged(m_globalResultModel);
109 }
110}
111
112void
113Categories::onCountChanged()80Categories::onCountChanged()
114{81{
115 CategoryFilter* filter = qobject_cast<CategoryFilter*>(sender());82 CategoryFilter* filter = qobject_cast<CategoryFilter*>(sender());
@@ -131,18 +98,6 @@
131 m_timerFilters.clear();98 m_timerFilters.clear();
132}99}
133100
134void
135Categories::onGlobalCountChanged()
136{
137 CategoryFilter* filter = qobject_cast<CategoryFilter*>(sender());
138 if (filter) {
139 QModelIndex changedIndex = index(filter->index());
140 QVector<int> roles;
141 roles.append(Categories::RoleGlobalCount);
142 Q_EMIT dataChanged(changedIndex, changedIndex, roles);
143 }
144}
145
146QHash<int, QByteArray>101QHash<int, QByteArray>
147Categories::roleNames() const102Categories::roleNames() const
148{103{
@@ -159,23 +114,18 @@
159 if (role == RoleId) {114 if (role == RoleId) {
160 return QVariant::fromValue(index.row());115 return QVariant::fromValue(index.row());
161 } else if (role == RoleName) {116 } else if (role == RoleName) {
162 return QVariant::fromValue(DeeListModel::data(index, 0));117 return QVariant::fromValue(DeeListModel::data(index, 1)); //DISPLAY_NAME
163 } else if (role == RoleIcon) {118 } else if (role == RoleIcon) {
164 return QVariant::fromValue(DeeListModel::data(index, 1));119 return QVariant::fromValue(DeeListModel::data(index, 2)); //ICON_HINT
165 } else if (role == RoleRenderer) {120 } else if (role == RoleRenderer) {
166 return QVariant::fromValue(DeeListModel::data(index, 2));121 return QVariant::fromValue(DeeListModel::data(index, 3)); //RENDERER_NAME
167 } else if (role == RoleHints) {122 } else if (role == RoleHints) {
168 return QVariant::fromValue(DeeListModel::data(index, 3));123 return QVariant::fromValue(DeeListModel::data(index, 4)); //HINTS
169 } else if (role == RoleResults) {124 } else if (role == RoleResults) {
170 return QVariant::fromValue(getFilter(index.row()));125 return QVariant::fromValue(getFilter(index.row()));
171 } else if (role == RoleGlobalResults) {
172 return QVariant::fromValue(getGlobalFilter(index.row()));
173 } else if (role == RoleCount) {126 } else if (role == RoleCount) {
174 CategoryFilter* filter = getFilter(index.row());127 CategoryFilter* filter = getFilter(index.row());
175 return QVariant::fromValue(filter->rowCount());128 return QVariant::fromValue(filter->rowCount());
176 } else if (role == RoleGlobalCount) {
177 QSortFilterProxyModel* filter = getGlobalFilter(index.row());
178 return QVariant::fromValue(filter->rowCount());
179 } else {129 } else {
180 return QVariant();130 return QVariant();
181 }131 }
182132
=== modified file 'plugins/Unity/categories.h'
--- plugins/Unity/categories.h 2013-06-05 22:03:08 +0000
+++ plugins/Unity/categories.h 2013-06-19 20:05:35 +0000
@@ -36,7 +36,6 @@
36 Q_ENUMS(Roles)36 Q_ENUMS(Roles)
3737
38 Q_PROPERTY(DeeListModel* resultModel READ resultModel WRITE setResultModel NOTIFY resultModelChanged)38 Q_PROPERTY(DeeListModel* resultModel READ resultModel WRITE setResultModel NOTIFY resultModelChanged)
39 Q_PROPERTY(DeeListModel* globalResultModel READ globalResultModel WRITE setResultModel NOTIFY globalResultModelChanged)
4039
41public:40public:
42 explicit Categories(QObject* parent = 0);41 explicit Categories(QObject* parent = 0);
@@ -49,9 +48,7 @@
49 RoleRenderer,48 RoleRenderer,
50 RoleHints,49 RoleHints,
51 RoleResults,50 RoleResults,
52 RoleGlobalResults,51 RoleCount
53 RoleCount,
54 RoleGlobalCount
55 };52 };
5653
57 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;54 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
@@ -60,32 +57,25 @@
6057
61 /* getters */58 /* getters */
62 DeeListModel* resultModel() { return m_resultModel; }59 DeeListModel* resultModel() { return m_resultModel; }
63 DeeListModel* globalResultModel() { return m_globalResultModel; }
6460
65 /* setters */61 /* setters */
66 void setResultModel(DeeListModel*);62 void setResultModel(DeeListModel*);
67 void setGlobalResultModel(DeeListModel*);
6863
69Q_SIGNALS:64Q_SIGNALS:
70 void resultModelChanged(DeeListModel*);65 void resultModelChanged(DeeListModel*);
71 void globalResultModelChanged(DeeListModel*);
7266
73private Q_SLOTS:67private Q_SLOTS:
74 void onCountChanged();68 void onCountChanged();
75 void onGlobalCountChanged();
76 void onEmitCountChanged();69 void onEmitCountChanged();
7770
78private:71private:
79 CategoryFilter* getFilter(int index) const;72 CategoryFilter* getFilter(int index) const;
80 CategoryFilter* getGlobalFilter(int index) const;
8173
82 QTimer m_timer;74 QTimer m_timer;
83 QSet<CategoryFilter*> m_timerFilters;75 QSet<CategoryFilter*> m_timerFilters;
84 QHash<int, QByteArray> m_roles;76 QHash<int, QByteArray> m_roles;
85 DeeListModel* m_resultModel;77 DeeListModel* m_resultModel;
86 DeeListModel* m_globalResultModel;
87 mutable QMap<int, CategoryFilter*> m_filters;78 mutable QMap<int, CategoryFilter*> m_filters;
88 mutable QMap<int, CategoryFilter*> m_globalFilters;
89};79};
9080
91#endif // CATEGORIES_H81#endif // CATEGORIES_H
9282
=== removed file 'plugins/Unity/peoplepreviewdata.cpp'
--- plugins/Unity/peoplepreviewdata.cpp 2013-06-05 22:03:08 +0000
+++ plugins/Unity/peoplepreviewdata.cpp 1970-01-01 00:00:00 +0000
@@ -1,438 +0,0 @@
1/*
2 * Copyright (C) 2012 Canonical, Ltd.
3 *
4 * Authors:
5 * Guenter Schwann <guenter.schwann@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "peoplepreviewdata.h"
21
22#include <QDebug>
23
24#include "lens.h"
25
26static void phoneAppend(QQmlListProperty<PeoplePhoneData> *property, PeoplePhoneData *val)
27{
28 Q_UNUSED(val);
29 Q_UNUSED(property);
30}
31static PeoplePhoneData *phoneAt(QQmlListProperty<PeoplePhoneData> *property, int index)
32{
33 PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
34 return d->phoneNumberList().at(index);
35}
36static int phoneCount(QQmlListProperty<PeoplePhoneData> *property)
37{
38 PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
39 return d->phoneNumberList().count();
40}
41static void phoneClear(QQmlListProperty<PeoplePhoneData> *property)
42{
43 Q_UNUSED(property);
44}
45
46static void emailAppend(QQmlListProperty<PeopleAddressData> *property, PeopleAddressData *val)
47{
48 Q_UNUSED(val);
49 Q_UNUSED(property);
50}
51static PeopleAddressData *emailAt(QQmlListProperty<PeopleAddressData> *property, int index)
52{
53 PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
54 return d->emailAddressesList().at(index);
55}
56static int emailCount(QQmlListProperty<PeopleAddressData> *property)
57{
58 PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
59 return d->emailAddressesList().count();
60}
61static void emailClear(QQmlListProperty<PeopleAddressData> *property)
62{
63 Q_UNUSED(property);
64}
65
66static void imAppend(QQmlListProperty<PeopleIMData> *property, PeopleIMData *val)
67{
68 Q_UNUSED(val);
69 Q_UNUSED(property);
70}
71static PeopleIMData *imAt(QQmlListProperty<PeopleIMData> *property, int index)
72{
73 PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
74 return d->imAccountsList().at(index);
75}
76static int imCount(QQmlListProperty<PeopleIMData> *property)
77{
78 PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
79 return d->imAccountsList().count();
80}
81static void imClear(QQmlListProperty<PeopleIMData> *property)
82{
83 Q_UNUSED(property);
84}
85
86static void addressAppend(QQmlListProperty<PeopleAddressData> *property, PeopleAddressData *val)
87{
88 Q_UNUSED(val);
89 Q_UNUSED(property);
90}
91static PeopleAddressData *addressAt(QQmlListProperty<PeopleAddressData> *property, int index)
92{
93 PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
94 return d->addressesList().at(index);
95}
96static int addressCount(QQmlListProperty<PeopleAddressData> *property)
97{
98 PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
99 return d->addressesList().count();
100}
101static void addressClear(QQmlListProperty<PeopleAddressData> *property)
102{
103 Q_UNUSED(property);
104}
105
106
107using namespace unity;
108
109PeoplePreviewData::PeoplePreviewData(QObject *parent)
110: QObject(parent)
111, m_lens(0)
112, m_ready(false)
113{
114}
115
116PeoplePreviewData::~PeoplePreviewData()
117{
118 clearData();
119}
120
121Lens *PeoplePreviewData::lens() const
122{
123 return m_lens;
124}
125
126void PeoplePreviewData::setLens(Lens *lens)
127{
128 if (lens == m_lens)
129 return;
130
131 setReady(false);
132
133 if (m_lensConnection.connected())
134 m_lensConnection.disconnect();
135
136 m_lens = lens;
137 m_lensConnection = m_lens->unityLens()->preview_ready.connect(
138 sigc::mem_fun(this, &PeoplePreviewData::setUnityPreview));
139 Q_EMIT lensChanged();
140
141 if (!m_uri.isEmpty() && !m_lens)
142 getPeoplePreview();
143}
144
145QString PeoplePreviewData::uri() const
146{
147 return m_uri;
148}
149
150void PeoplePreviewData::setUri(const QString &uri)
151{
152 if (uri == m_uri)
153 return;
154
155 setReady(false);
156
157 m_uri = uri;
158 Q_EMIT uriChanged();
159 if (!m_uri.isEmpty() && m_lens)
160 getPeoplePreview();
161}
162
163bool PeoplePreviewData::ready() const
164{
165 return m_ready;
166}
167
168void PeoplePreviewData::setReady(const bool &ready)
169{
170 if (ready == m_ready)
171 return;
172
173 m_ready = ready;
174 Q_EMIT readyChanged();
175}
176
177QString PeoplePreviewData::renderName() const
178{
179 if (!m_unityPreview)
180 return QLatin1String("");
181
182 return QString::fromStdString(m_unityPreview->renderer_name());
183}
184
185QString PeoplePreviewData::title() const
186{
187 if (!m_unityPreview)
188 return QLatin1String("");
189
190 return QString::fromStdString(m_unityPreview->title());
191}
192
193QString PeoplePreviewData::subTitle() const
194{
195 if (!m_unityPreview)
196 return QLatin1String("");
197
198 return QString::fromStdString(m_unityPreview->subtitle());
199}
200
201QString PeoplePreviewData::description() const
202{
203 if (!m_unityPreview)
204 return QLatin1String("");
205
206 return QString::fromStdString(m_unityPreview->description());
207}
208
209QString PeoplePreviewData::imageSource() const
210{
211 if (!m_unityPreview)
212 return QLatin1String("");
213
214 return QString::fromStdString(m_unityPreview->image_source_uri());
215}
216
217QQmlListProperty<PeoplePhoneData> PeoplePreviewData::phoneNumbers()
218{
219 return QQmlListProperty<PeoplePhoneData> (this, this,
220 phoneAppend,
221 phoneCount,
222 phoneAt,
223 phoneClear);
224}
225
226QQmlListProperty<PeopleAddressData> PeoplePreviewData::emailAddresses()
227{
228 return QQmlListProperty<PeopleAddressData> (this, this,
229 emailAppend,
230 emailCount,
231 emailAt,
232 emailClear);
233}
234
235QQmlListProperty<PeopleIMData> PeoplePreviewData::imAccounts()
236{
237 return QQmlListProperty<PeopleIMData> (this, this,
238 imAppend,
239 imCount,
240 imAt,
241 imClear);
242}
243
244QString PeoplePreviewData::displayName() const
245{
246 if (!m_unityPreview)
247 return QLatin1String("");
248
249 return QString::fromStdString(m_unityPreview->display_name());
250}
251
252QString PeoplePreviewData::status() const
253{
254 if (!m_unityPreview)
255 return QLatin1String("");
256
257 return QString::fromStdString(m_unityPreview->status());
258}
259
260QString PeoplePreviewData::statusTime() const
261{
262 if (!m_unityPreview)
263 return QLatin1String("");
264
265 return QString::fromStdString(m_unityPreview->status_time());
266}
267
268QString PeoplePreviewData::statusService() const
269{
270 if (!m_unityPreview)
271 return QLatin1String("");
272
273 return QString::fromStdString(m_unityPreview->status_service());
274}
275
276QString PeoplePreviewData::statusServiceIcon() const
277{
278 if (!m_unityPreview)
279 return QLatin1String("");
280
281 glib::Object<GIcon> icon = m_unityPreview->status_service_icon();
282 if (!icon)
283 return QLatin1String("");
284
285 return QString(g_icon_to_string(icon));
286}
287
288QString PeoplePreviewData::statusPostUri() const
289{
290 if (!m_unityPreview)
291 return QLatin1String("");
292
293 return QString::fromStdString(m_unityPreview->status_post_uri());
294}
295
296QQmlListProperty<PeopleAddressData> PeoplePreviewData::addresses()
297{
298 return QQmlListProperty<PeopleAddressData> (this, this,
299 addressAppend,
300 addressCount,
301 addressAt,
302 addressClear);
303}
304
305QString PeoplePreviewData::avatar() const
306{
307 if (!m_unityPreview)
308 return QLatin1String("");
309
310 glib::Object<GIcon> avatar = m_unityPreview->avatar();
311 if (!avatar)
312 return QLatin1String("");
313
314 return QString(g_icon_to_string(avatar));
315}
316
317void PeoplePreviewData::getPeoplePreview()
318{
319 m_lens->unityLens()->Preview(m_uri.toStdString());
320}
321
322void PeoplePreviewData::setUnityPreview(std::string const& uri, dash::Preview::Ptr const& preview)
323{
324 if (uri != m_uri.toStdString())
325 return;
326
327 dash::PeoplePreview::Ptr peoplePtr = std::dynamic_pointer_cast<dash::PeoplePreview>(preview);
328 if (peoplePtr == nullptr) {
329 qWarning() << "Backend returned a dash::Preview that isn't a dash::PeoplePreview";
330 Q_EMIT error();
331 return;
332 }
333
334 clearData();
335 m_unityPreview = peoplePtr;
336 getPhoneData();
337 getEmailAddresses();
338 getImAccounts();
339 getAddresses();
340
341 Q_EMIT renderNameChanged();
342 Q_EMIT titleChanged();
343 Q_EMIT subTitleChanged();
344 Q_EMIT descriptionChanged();
345 Q_EMIT imageSourceChanged();
346 Q_EMIT phoneNumbersChanged();
347 Q_EMIT emailAddressesChanged();
348 Q_EMIT imAccountsChanged();
349 Q_EMIT displayNameChanged();
350 Q_EMIT statusChanged();
351 Q_EMIT statusTimeChanged();
352 Q_EMIT statusServiceChanged();
353 Q_EMIT addressesChanged();
354 Q_EMIT avatarChanged();
355
356 setReady(true);
357}
358
359void PeoplePreviewData::clearData()
360{
361 while (!m_phoneList.empty()) {
362 PeoplePhoneData *phone = m_phoneList.takeLast();
363 delete phone;
364 }
365 while (!m_emailList.empty()) {
366 PeopleAddressData *email = m_emailList.takeLast();
367 delete email;
368 }
369 while (!m_imList.empty()) {
370 PeopleIMData *im = m_imList.takeLast();
371 delete im;
372 }
373 while (!m_addressList.empty()) {
374 PeopleAddressData *address = m_addressList.takeLast();
375 delete address;
376 }
377}
378
379void PeoplePreviewData::getPhoneData()
380{
381 dash::PeoplePreview::PhonePtrList uPhoneList;
382 uPhoneList = m_unityPreview->GetPhone();
383
384 for (size_t i=0; i<uPhoneList.size(); ++i) {
385 PeoplePhoneData *phone = new PeoplePhoneData;
386 phone->m_type = QString::fromStdString(uPhoneList[i]->type);
387 phone->m_location = QString::fromStdString(uPhoneList[i]->location);
388 phone->m_number = QString::fromStdString(uPhoneList[i]->number);
389 m_phoneList.append(phone);
390 }
391}
392
393void PeoplePreviewData::getEmailAddresses()
394{
395 dash::PeoplePreview::EmailPtrList uEmailList;
396 uEmailList = m_unityPreview->GetEmail();
397
398 for (size_t i=0; i<uEmailList.size(); ++i) {
399 PeopleAddressData *email = new PeopleAddressData;
400 email->m_type = QString::fromStdString(uEmailList[i]->type);
401 email->m_address = QString::fromStdString(uEmailList[i]->address);
402 m_emailList.append(email);
403 }
404}
405
406void PeoplePreviewData::getImAccounts()
407{
408 dash::PeoplePreview::IMAccountPtrList uIMList;
409 uIMList = m_unityPreview->GetIMAccount();
410
411 for (size_t i=0; i<uIMList.size(); ++i) {
412 PeopleIMData *im = new PeopleIMData;
413 im->m_protocol = QString::fromStdString(uIMList[i]->protocol);
414 im->m_address = QString::fromStdString(uIMList[i]->address);
415 m_imList.append(im);
416 }
417}
418
419void PeoplePreviewData::getAddresses()
420{
421 dash::PeoplePreview::AddressPtrList uAddressList;
422 uAddressList = m_unityPreview->GetAddress();
423
424 for (size_t i=0; i<uAddressList.size(); ++i) {
425 PeopleAddressData *address = new PeopleAddressData;
426 address->m_type = QString::fromStdString(uAddressList[i]->type);
427 address->m_address = QString::fromStdString(uAddressList[i]->address);
428 address->m_poBox = QString::fromStdString(uAddressList[i]->po_box);
429 address->m_extension = QString::fromStdString(uAddressList[i]->extension);
430 address->m_street = QString::fromStdString(uAddressList[i]->street);
431 address->m_locality = QString::fromStdString(uAddressList[i]->locality);
432 address->m_region = QString::fromStdString(uAddressList[i]->region);
433 address->m_postalCode = QString::fromStdString(uAddressList[i]->postal_code);
434 address->m_country = QString::fromStdString(uAddressList[i]->country);
435 address->m_addressFormat = QString::fromStdString(uAddressList[i]->address_format);
436 m_addressList.append(address);
437 }
438}
4390
=== removed file 'plugins/Unity/peoplepreviewdata.h'
--- plugins/Unity/peoplepreviewdata.h 2013-06-05 22:03:08 +0000
+++ plugins/Unity/peoplepreviewdata.h 1970-01-01 00:00:00 +0000
@@ -1,251 +0,0 @@
1/*
2 * Copyright (C) 2012 Canonical, Ltd.
3 *
4 * Authors:
5 * Guenter Schwann <guenter.schwann@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef PEOPLEPREVIEWDATA_H
21#define PEOPLEPREVIEWDATA_H
22
23#include <QList>
24#include <QObject>
25#include <qqmllist.h>
26#include <QString>
27
28// libunity-core
29#include <UnityCore/PeoplePreview.h>
30
31#include <sigc++/connection.h>
32
33class Lens;
34
35/*!
36 * \brief The PeoplePhoneData class stores the data for one phone number
37 */
38class PeoplePhoneData : public QObject
39{
40 Q_OBJECT
41 Q_PROPERTY(QString type READ type NOTIFY typeChanged)
42 Q_PROPERTY(QString location READ location NOTIFY locationChanged)
43 Q_PROPERTY(QString number READ number NOTIFY numberChanged)
44
45Q_SIGNALS:
46 void typeChanged();
47 void locationChanged();
48 void numberChanged();
49
50public:
51 explicit PeoplePhoneData(QObject *parent = 0) : QObject(parent) {}
52 QString type() const { return m_type; }
53 QString location() const { return m_location; }
54 QString number() const { return m_number; }
55
56private:
57 QString m_type;
58 QString m_location;
59 QString m_number;
60 friend class PeoplePreviewData;
61};
62
63/*!
64 * \brief The PeopleAddressData class stores the data for one single post/email address
65 */
66class PeopleAddressData : public QObject
67{
68 Q_OBJECT
69 Q_PROPERTY(QString type READ type NOTIFY typeChanged)
70 Q_PROPERTY(QString address READ address NOTIFY addressChanged)
71 Q_PROPERTY(QString poBox READ poBox NOTIFY poBoxChanged)
72 Q_PROPERTY(QString extension READ extension NOTIFY extensionChanged)
73 Q_PROPERTY(QString street READ street NOTIFY streetChanged)
74 Q_PROPERTY(QString locality READ locality NOTIFY localityChanged)
75 Q_PROPERTY(QString region READ region NOTIFY regionChanged)
76 Q_PROPERTY(QString postalCode READ postalCode NOTIFY postalCodeChanged)
77 Q_PROPERTY(QString country READ country NOTIFY countryChanged)
78 Q_PROPERTY(QString addressFormat READ addressFormat NOTIFY addressFormatChanged)
79
80Q_SIGNALS:
81 void typeChanged();
82 void addressChanged();
83 void poBoxChanged();
84 void extensionChanged();
85 void streetChanged();
86 void localityChanged();
87 void regionChanged();
88 void postalCodeChanged();
89 void countryChanged();
90 void addressFormatChanged();
91
92public:
93 explicit PeopleAddressData(QObject *parent = 0) : QObject(parent) {}
94 QString type() const { return m_type; }
95 QString address() const { return m_address; }
96 QString poBox() const { return m_poBox; }
97 QString extension() const { return m_extension; }
98 QString street() const { return m_street; }
99 QString locality() const { return m_locality; }
100 QString region() const { return m_region; }
101 QString postalCode() const { return m_postalCode; }
102 QString country() const { return m_country; }
103 QString addressFormat() const { return m_addressFormat; }
104
105private:
106 QString m_type;
107 QString m_address;
108 QString m_poBox;
109 QString m_extension;
110 QString m_street;
111 QString m_locality;
112 QString m_region;
113 QString m_postalCode;
114 QString m_country;
115 QString m_addressFormat;
116 friend class PeoplePreviewData;
117};
118
119/*!
120 * \brief The PeopleIMData class stores the data for one single post/email address
121 */
122class PeopleIMData : public QObject
123{
124 Q_OBJECT
125 Q_PROPERTY(QString protocol READ protocol NOTIFY protocolChanged)
126 Q_PROPERTY(QString address READ address NOTIFY addressChanged)
127
128Q_SIGNALS:
129 void protocolChanged();
130 void addressChanged();
131
132public:
133 explicit PeopleIMData(QObject *parent = 0) : QObject(parent) {}
134 QString protocol() const { return m_protocol; }
135 QString address() const { return m_address; }
136
137private:
138 QString m_protocol;
139 QString m_address;
140 friend class PeoplePreviewData;
141};
142
143
144/*!
145 * \brief The PeoplePreviewData class providing information for one person
146 */
147class PeoplePreviewData : public QObject
148{
149 Q_OBJECT
150
151 // These properties need to be set from QML
152 Q_PROPERTY(Lens* lens READ lens WRITE setLens NOTIFY lensChanged)
153 Q_PROPERTY(QString uri READ uri WRITE setUri NOTIFY uriChanged)
154 // Read only properties containing general Preview information
155 Q_PROPERTY(bool ready READ ready NOTIFY readyChanged)
156 Q_PROPERTY(QString renderName READ renderName NOTIFY renderNameChanged)
157 Q_PROPERTY(QString title READ title NOTIFY titleChanged)
158 Q_PROPERTY(QString subTitle READ subTitle NOTIFY subTitleChanged)
159 Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
160 Q_PROPERTY(QString imageSource READ imageSource NOTIFY imageSourceChanged)
161 // Read only properties containing PeoplePreview specific information
162 Q_PROPERTY(QString displayName READ displayName NOTIFY displayNameChanged)
163 Q_PROPERTY(QQmlListProperty<PeopleAddressData> emailAddresses READ emailAddresses NOTIFY emailAddressesChanged)
164 Q_PROPERTY(QQmlListProperty<PeoplePhoneData> phoneNumbers READ phoneNumbers NOTIFY phoneNumbersChanged)
165 Q_PROPERTY(QQmlListProperty<PeopleIMData> imAccounts READ imAccounts NOTIFY imAccountsChanged)
166 Q_PROPERTY(QString status READ status NOTIFY statusChanged)
167 Q_PROPERTY(QString statusTime READ statusTime NOTIFY statusTimeChanged)
168 Q_PROPERTY(QString statusService READ statusService NOTIFY statusServiceChanged)
169 Q_PROPERTY(QString statusServiceIcon READ statusServiceIcon NOTIFY statusServiceIconChanged)
170 Q_PROPERTY(QString statusPostUri READ statusPostUri NOTIFY statusPostUriChanged)
171 Q_PROPERTY(QQmlListProperty<PeopleAddressData> addresses READ addresses NOTIFY addressesChanged)
172 Q_PROPERTY(QString avatar READ avatar NOTIFY avatarChanged)
173
174public:
175 PeoplePreviewData(QObject *parent = 0);
176 ~PeoplePreviewData();
177
178 void setUnityPeoplePreview(const unity::dash::Preview::Ptr& preview);
179 void setLens(Lens *lens);
180 void setUri(const QString &uri);
181
182 Lens *lens() const;
183 QString uri() const;
184 bool ready() const;
185 QString renderName() const;
186 QString title() const;
187 QString subTitle() const;
188 QString description() const;
189 QString imageSource() const;
190 QString displayName() const;
191 QQmlListProperty<PeoplePhoneData> phoneNumbers();
192 QQmlListProperty<PeopleAddressData> emailAddresses();
193 QQmlListProperty<PeopleIMData> imAccounts();
194 QString status() const;
195 QString statusTime() const;
196 QString statusService() const;
197 QString statusServiceIcon() const;
198 QString statusPostUri() const;
199 QQmlListProperty<PeopleAddressData> addresses();
200 QString avatar() const;
201
202 QList<PeoplePhoneData*> &phoneNumberList() { return m_phoneList; }
203 QList<PeopleAddressData*> &emailAddressesList() { return m_emailList; }
204 QList<PeopleIMData*> &imAccountsList() { return m_imList; }
205 QList<PeopleAddressData*> &addressesList() { return m_addressList; }
206
207Q_SIGNALS:
208 void lensChanged();
209 void uriChanged();
210 void readyChanged();
211 void renderNameChanged();
212 void titleChanged();
213 void subTitleChanged();
214 void descriptionChanged();
215 void imageSourceChanged();
216 void displayNameChanged();
217 void phoneNumbersChanged();
218 void emailAddressesChanged();
219 void imAccountsChanged();
220 void statusChanged();
221 void statusTimeChanged();
222 void statusServiceChanged();
223 void statusServiceIconChanged();
224 void statusPostUriChanged();
225 void addressesChanged();
226 void avatarChanged();
227 void error();
228
229private:
230 void setReady(const bool &ready);
231 void getPeoplePreview();
232 void setUnityPreview(std::string const& uri, unity::dash::Preview::Ptr const& preview);
233 void clearData();
234 void getPhoneData();
235 void getEmailAddresses();
236 void getImAccounts();
237 void getAddresses();
238
239 Lens *m_lens;
240 sigc::connection m_lensConnection;
241 QString m_uri;
242 bool m_ready;
243 unity::dash::PeoplePreview::Ptr m_unityPreview;
244
245 QList<PeoplePhoneData*> m_phoneList;
246 QList<PeopleAddressData*> m_addressList;
247 QList<PeopleIMData*> m_imList;
248 QList<PeopleAddressData*> m_emailList;
249};
250
251#endif // PEOPLEPREVIEWDATA_H
2520
=== modified file 'plugins/Unity/plugin.cpp'
--- plugins/Unity/plugin.cpp 2013-06-05 22:03:08 +0000
+++ plugins/Unity/plugin.cpp 2013-06-19 20:05:35 +0000
@@ -24,11 +24,10 @@
24#include "plugin.h"24#include "plugin.h"
2525
26// local26// local
27#include "lens.h"27#include "scope.h"
28#include "lenses.h"28#include "scopes.h"
29#include "categories.h"29#include "categories.h"
30#include "categoryfilter.h"30#include "categoryfilter.h"
31#include "peoplepreviewdata.h"
32#include "bottombarvisibilitycommunicatorshell.h"31#include "bottombarvisibilitycommunicatorshell.h"
33#include "launchermodel.h"32#include "launchermodel.h"
3433
@@ -41,15 +40,11 @@
41void UnityPlugin::registerTypes(const char *uri)40void UnityPlugin::registerTypes(const char *uri)
42{41{
43 Q_ASSERT(uri == QLatin1String("Unity"));42 Q_ASSERT(uri == QLatin1String("Unity"));
44 qmlRegisterType<Lens>(uri, 0, 1, "Lens");43 qmlRegisterType<Scope>(uri, 0, 1, "Scope");
45 qmlRegisterType<Lenses>(uri, 0, 1, "Lenses");44 qmlRegisterType<Scopes>(uri, 0, 1, "Scopes");
46 qmlRegisterType<Categories>(uri, 0, 1, "Categories");45 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
47 qmlRegisterType<CategoryFilter>(uri, 0, 1, "CategoryFilter");46 qmlRegisterType<CategoryFilter>(uri, 0, 1, "CategoryFilter");
48 qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");47 qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");
49 qmlRegisterType<PeoplePreviewData>(uri, 0, 1, "PeoplePreviewData");
50 qmlRegisterType<PeoplePhoneData>(uri, 0, 1, "PeoplePhoneData");
51 qmlRegisterType<PeopleAddressData>(uri, 0, 1, "PeopleAddressData");
52 qmlRegisterType<PeopleIMData>(uri, 0, 1, "PeopleIMData");
53 qmlRegisterType<LauncherModel>(uri, 0, 1, "LauncherModel");48 qmlRegisterType<LauncherModel>(uri, 0, 1, "LauncherModel");
54 qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", "Can't create new Launcher Items in QML. Get them from the LauncherModel.");49 qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", "Can't create new Launcher Items in QML. Get them from the LauncherModel.");
55 qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");50 qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
5651
=== renamed file 'plugins/Unity/lens.cpp' => 'plugins/Unity/scope.cpp'
--- plugins/Unity/lens.cpp 2013-06-05 22:03:08 +0000
+++ plugins/Unity/scope.cpp 2013-06-19 20:05:35 +0000
@@ -18,7 +18,7 @@
18 */18 */
1919
20// Self20// Self
21#include "lens.h"21#include "scope.h"
22#include "categories.h"22#include "categories.h"
2323
24// Qt24// Qt
@@ -28,113 +28,76 @@
2828
29#include <libintl.h>29#include <libintl.h>
3030
31Lens::Lens(QObject *parent) :31Scope::Scope(QObject *parent) :
32 QObject(parent)32 QObject(parent)
33{33{
34 m_results = new DeeListModel(this);34 m_results = new DeeListModel(this);
35 m_globalResults = new DeeListModel(this);
36 m_categories = new Categories(this);35 m_categories = new Categories(this);
3736
38 m_categories->setResultModel(m_results);37 m_categories->setResultModel(m_results);
39 m_categories->setGlobalResultModel(m_globalResults);38}
40}39
4140QString Scope::id() const
42QString Lens::id() const41{
43{42 return QString::fromStdString(m_unityScope->id());
44 return QString::fromStdString(m_unityLens->id());43}
45}44
4645QString Scope::name() const
47QString Lens::dbusName() const46{
48{47 return QString::fromStdString(m_unityScope->name());
49 return QString::fromStdString(m_unityLens->dbus_name());48}
50}49
5150QString Scope::iconHint() const
52QString Lens::dbusPath() const51{
53{52 return QString::fromStdString(m_unityScope->icon_hint());
54 return QString::fromStdString(m_unityLens->dbus_path());53}
55}54
5655QString Scope::description() const
57QString Lens::name() const56{
58{57 return QString::fromStdString(m_unityScope->description());
59 return QString::fromStdString(m_unityLens->name());58}
60}59
6160QString Scope::searchHint() const
62QString Lens::iconHint() const61{
63{62 return QString::fromStdString(m_unityScope->search_hint());
64 return QString::fromStdString(m_unityLens->icon_hint());63}
65}64
6665bool Scope::visible() const
67QString Lens::description() const66{
68{67 return m_unityScope->visible();
69 return QString::fromStdString(m_unityLens->description());68}
70}69
7170QString Scope::shortcut() const
72QString Lens::searchHint() const71{
73{72 return QString::fromStdString(m_unityScope->shortcut());
74 return QString::fromStdString(m_unityLens->search_hint());73}
75}74
7675bool Scope::connected() const
77bool Lens::visible() const76{
78{77 return m_unityScope->connected();
79 return m_unityLens->visible();78}
80}79
8180DeeListModel* Scope::results() const
82bool Lens::searchInGlobal() const
83{
84 return m_unityLens->search_in_global();
85}
86
87QString Lens::shortcut() const
88{
89 return QString::fromStdString(m_unityLens->shortcut());
90}
91
92bool Lens::connected() const
93{
94 return m_unityLens->connected();
95}
96
97DeeListModel* Lens::results() const
98{81{
99 return m_results;82 return m_results;
100}83}
10184
102DeeListModel* Lens::globalResults() const85Categories* Scope::categories() const
103{
104 return m_globalResults;
105}
106
107Categories* Lens::categories() const
108{86{
109 return m_categories;87 return m_categories;
110}88}
11189
112Lens::ViewType Lens::viewType() const90QString Scope::searchQuery() const
113{
114 return (Lens::ViewType) m_unityLens->view_type();
115}
116
117QString Lens::searchQuery() const
118{91{
119 return m_searchQuery;92 return m_searchQuery;
120}93}
12194
122QString Lens::globalSearchQuery() const95QString Scope::noResultsHint() const
123{
124 return m_globalSearchQuery;
125}
126
127QString Lens::noResultsHint() const
128{96{
129 return m_noResultsHint;97 return m_noResultsHint;
130}98}
13199
132void Lens::setViewType(const Lens::ViewType& viewType)100void Scope::setSearchQuery(const QString& search_query)
133{
134 m_unityLens->view_type = (unity::dash::ViewType) viewType;
135}
136
137void Lens::setSearchQuery(const QString& search_query)
138{101{
139 /* Checking for m_searchQuery.isNull() which returns true only when the string102 /* Checking for m_searchQuery.isNull() which returns true only when the string
140 has never been set is necessary because when search_query is the empty103 has never been set is necessary because when search_query is the empty
@@ -143,48 +106,37 @@
143 */106 */
144 if (m_searchQuery.isNull() || search_query != m_searchQuery) {107 if (m_searchQuery.isNull() || search_query != m_searchQuery) {
145 m_searchQuery = search_query;108 m_searchQuery = search_query;
146 m_unityLens->Search(search_query.toStdString(), sigc::mem_fun(this, &Lens::searchFinished));109 m_unityScope->Search(search_query.toStdString(), sigc::mem_fun(this, &Scope::searchFinished));
147 Q_EMIT searchQueryChanged();110 Q_EMIT searchQueryChanged();
148 }111 }
149}112}
150113
151void Lens::setGlobalSearchQuery(const QString& search_query)114void Scope::setNoResultsHint(const QString& hint) {
152{
153 /* Checking for m_globalSearchQuery.isNull() which returns true only when the string
154 has never been set is necessary because when search_query is the empty
155 string ("") and m_globalSearchQuery is the null string,
156 search_query != m_globalSearchQuery is still true.
157 */
158 if (m_globalSearchQuery.isNull() || search_query != m_globalSearchQuery) {
159 m_globalSearchQuery = search_query;
160 m_unityLens->GlobalSearch(search_query.toStdString(), sigc::mem_fun(this, &Lens::globalSearchFinished));
161 Q_EMIT globalSearchQueryChanged();
162 }
163}
164
165void Lens::setNoResultsHint(const QString& hint) {
166 if (hint != m_noResultsHint) {115 if (hint != m_noResultsHint) {
167 m_noResultsHint = hint;116 m_noResultsHint = hint;
168 Q_EMIT noResultsHintChanged();117 Q_EMIT noResultsHintChanged();
169 }118 }
170}119}
171120
172void Lens::activate(const QString& uri)121void Scope::activate(const QString& /*uri*/)
173{122{
174 m_unityLens->Activate(QByteArray::fromPercentEncoding(uri.toUtf8()).constData());123 // TODO:
124 // we need to create unity::dash::LocalResult (see UnityCore/Result.h) and pass it to Activate;
125 // this requires entire row from the model, so we need row index rather than uri.
126 // m_unityScope->Activate(QByteArray::fromPercentEncoding(uri.toUtf8()).constData());
175}127}
176128
177void Lens::onActivated(std::string const& uri, unity::dash::HandledType type, unity::dash::Lens::Hints const&)129void Scope::onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const&)
178{130{
179 if (type == unity::dash::NOT_HANDLED) {131 if (type == unity::dash::NOT_HANDLED) {
180 fallbackActivate(QString::fromStdString(uri));132 fallbackActivate(QString::fromStdString(result.uri));
181 }133 }
182}134}
183135
184void Lens::fallbackActivate(const QString& uri)136void Scope::fallbackActivate(const QString& uri)
185{137{
186 /* FIXME: stripping all content before the first column because for some138 /* FIXME: stripping all content before the first column because for some
187 reason the lenses give uri with junk content at their beginning.139 reason the scopes give uri with junk content at their beginning.
188 */140 */
189 QString tweakedUri = uri;141 QString tweakedUri = uri;
190 int firstColumnAt = tweakedUri.indexOf(":");142 int firstColumnAt = tweakedUri.indexOf(":");
@@ -215,118 +167,101 @@
215 QDesktopServices::openUrl(url);167 QDesktopServices::openUrl(url);
216}168}
217169
218void Lens::setUnityLens(const unity::dash::Lens::Ptr& lens)170void Scope::setUnityScope(const unity::dash::Scope::Ptr& scope)
219{171{
220 m_unityLens = lens;172 m_unityScope = scope;
221173
222 if (QString::fromStdString(m_unityLens->results()->swarm_name) == QString(":local")) {174 if (QString::fromStdString(m_unityScope->results()->swarm_name) == QString(":local")) {
223 m_results->setModel(m_unityLens->results()->model());175 m_results->setModel(m_unityScope->results()->model());
224 } else {176 } else {
225 m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));177 m_results->setName(QString::fromStdString(m_unityScope->results()->swarm_name));
226 }178 }
227 if (QString::fromStdString(m_unityLens->global_results()->swarm_name) == QString(":local")) {179
228 m_globalResults->setModel(m_unityLens->global_results()->model());180 if (QString::fromStdString(m_unityScope->categories()->swarm_name) == QString(":local")) {
229 } else {181 m_categories->setModel(m_unityScope->categories()->model());
230 m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));182 } else {
231 }183 m_categories->setName(QString::fromStdString(m_unityScope->categories()->swarm_name));
232 if (QString::fromStdString(m_unityLens->categories()->swarm_name) == QString(":local")) {
233 m_categories->setModel(m_unityLens->categories()->model());
234 } else {
235 m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
236 }184 }
237185
238 /* Property change signals */186 /* Property change signals */
239 m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged));187 m_unityScope->id.changed.connect(sigc::mem_fun(this, &Scope::idChanged));
240 m_unityLens->dbus_name.changed.connect(sigc::mem_fun(this, &Lens::dbusNameChanged));188 m_unityScope->name.changed.connect(sigc::mem_fun(this, &Scope::nameChanged));
241 m_unityLens->dbus_path.changed.connect(sigc::mem_fun(this, &Lens::dbusPathChanged));189 m_unityScope->icon_hint.changed.connect(sigc::mem_fun(this, &Scope::iconHintChanged));
242 m_unityLens->name.changed.connect(sigc::mem_fun(this, &Lens::nameChanged));190 m_unityScope->description.changed.connect(sigc::mem_fun(this, &Scope::descriptionChanged));
243 m_unityLens->icon_hint.changed.connect(sigc::mem_fun(this, &Lens::iconHintChanged));191 m_unityScope->search_hint.changed.connect(sigc::mem_fun(this, &Scope::searchHintChanged));
244 m_unityLens->description.changed.connect(sigc::mem_fun(this, &Lens::descriptionChanged));192 m_unityScope->visible.changed.connect(sigc::mem_fun(this, &Scope::visibleChanged));
245 m_unityLens->search_hint.changed.connect(sigc::mem_fun(this, &Lens::searchHintChanged));193 m_unityScope->shortcut.changed.connect(sigc::mem_fun(this, &Scope::shortcutChanged));
246 m_unityLens->visible.changed.connect(sigc::mem_fun(this, &Lens::visibleChanged));194 m_unityScope->connected.changed.connect(sigc::mem_fun(this, &Scope::connectedChanged));
247 m_unityLens->search_in_global.changed.connect(sigc::mem_fun(this, &Lens::searchInGlobalChanged));195 m_unityScope->results.changed.connect(sigc::mem_fun(this, &Scope::onResultsChanged));
248 m_unityLens->shortcut.changed.connect(sigc::mem_fun(this, &Lens::shortcutChanged));196 m_unityScope->results()->swarm_name.changed.connect(sigc::mem_fun(this, &Scope::onResultsSwarmNameChanged));
249 m_unityLens->connected.changed.connect(sigc::mem_fun(this, &Lens::connectedChanged));197 m_unityScope->results()->model.changed.connect(sigc::mem_fun(this, &Scope::onResultsModelChanged));
250 m_unityLens->results.changed.connect(sigc::mem_fun(this, &Lens::onResultsChanged));198 m_unityScope->categories()->model.changed.connect(sigc::mem_fun(this, &Scope::onCategoriesModelChanged));
251 m_unityLens->results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onResultsSwarmNameChanged));199 m_unityScope->categories.changed.connect(sigc::mem_fun(this, &Scope::onCategoriesChanged));
252 m_unityLens->global_results.changed.connect(sigc::mem_fun(this, &Lens::onGlobalResultsChanged));200 m_unityScope->categories()->swarm_name.changed.connect(sigc::mem_fun(this, &Scope::onCategoriesSwarmNameChanged));
253 m_unityLens->global_results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onGlobalResultsSwarmNameChanged));
254 m_unityLens->categories.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesChanged));
255 m_unityLens->categories()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesSwarmNameChanged));
256 m_unityLens->view_type.changed.connect(sigc::mem_fun(this, &Lens::onViewTypeChanged));
257
258 /* Signals forwarding */201 /* Signals forwarding */
259 connect(this, SIGNAL(searchFinished(unity::dash::Lens::Hints const &, unity::glib::Error const &)), SLOT(onSearchFinished(unity::dash::Lens::Hints const &)));202 connect(this, SIGNAL(searchFinished(const std::string &, unity::glib::HintsMap const &, unity::glib::Error const &)), SLOT(onSearchFinished(const std::string &, unity::glib::HintsMap const &)));
260203
261 /* FIXME: signal should be forwarded instead of calling the handler directly */204 /* FIXME: signal should be forwarded instead of calling the handler directly */
262 m_unityLens->activated.connect(sigc::mem_fun(this, &Lens::onActivated));205 m_unityScope->activated.connect(sigc::mem_fun(this, &Scope::onActivated));
263206
264 /* Synchronize local states with m_unityLens right now and whenever207 /* Synchronize local states with m_unityScope right now and whenever
265 m_unityLens becomes connected */208 m_unityScope becomes connected */
266 /* FIXME: should emit change notification signals for all properties */209 /* FIXME: should emit change notification signals for all properties */
267 connect(this, SIGNAL(connectedChanged(bool)), SLOT(synchronizeStates()));210 connect(this, SIGNAL(connectedChanged(bool)), SLOT(synchronizeStates()));
268 synchronizeStates();211 synchronizeStates();
269}212}
270213
271unity::dash::Lens::Ptr Lens::unityLens() const214unity::dash::Scope::Ptr Scope::unityScope() const
272{215{
273 return m_unityLens;216 return m_unityScope;
274}217}
275218
276void Lens::synchronizeStates()219void Scope::synchronizeStates()
277{220{
278 if (connected()) {221 if (connected()) {
279 /* Forward local states to m_unityLens */222 /* Forward local states to m_unityScope */
280 if (!m_searchQuery.isNull()) {223 if (!m_searchQuery.isNull()) {
281 m_unityLens->Search(m_searchQuery.toStdString());224 m_unityScope->Search(m_searchQuery.toStdString());
282 }
283 if (!m_globalSearchQuery.isNull()) {
284 m_unityLens->GlobalSearch(m_globalSearchQuery.toStdString());
285 }225 }
286 }226 }
287}227}
288228
289void Lens::onResultsSwarmNameChanged(const std::string& /* swarm_name */)229void Scope::onResultsSwarmNameChanged(const std::string& /* swarm_name */)
290{230{
291 m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));231 m_results->setName(QString::fromStdString(m_unityScope->results()->swarm_name));
292}232}
293233
294void Lens::onResultsChanged(const unity::dash::Results::Ptr& /* results */)234void Scope::onResultsChanged(const unity::dash::Results::Ptr& /* results */)
295{235{
296 m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));236 m_results->setName(QString::fromStdString(m_unityScope->results()->swarm_name));
297}237}
298238
299void Lens::onGlobalResultsSwarmNameChanged(const std::string& /* swarm_name */)239void Scope::onResultsModelChanged(unity::glib::Object<DeeModel> /* model */)
300{240{
301 m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));241 m_results->setModel(m_unityScope->results()->model());
302}242}
303243
304void Lens::onGlobalResultsChanged(const unity::dash::Results::Ptr& /* global_results */)244void Scope::onCategoriesSwarmNameChanged(const std::string& /* swarm_name */)
305{245{
306 m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));246 m_categories->setName(QString::fromStdString(m_unityScope->categories()->swarm_name));
307}247}
308248
309void Lens::onCategoriesSwarmNameChanged(const std::string& /* swarm_name */)249void Scope::onCategoriesChanged(const unity::dash::Categories::Ptr& /* categories */)
310{250{
311 m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));251 m_categories->setName(QString::fromStdString(m_unityScope->categories()->swarm_name));
312}252}
313253
314void Lens::onCategoriesChanged(const unity::dash::Categories::Ptr& /* categories */)254void Scope::onCategoriesModelChanged(unity::glib::Object<DeeModel> model)
315{255{
316 m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));256 m_categories->setModel(model);
317}257}
318258
319void Lens::onViewTypeChanged(unity::dash::ViewType viewType)259void Scope::onSearchFinished(const std::string& /* query */, unity::glib::HintsMap const &hints)
320{
321 Q_EMIT viewTypeChanged( (Lens::ViewType) viewType);
322}
323
324void Lens::onSearchFinished(unity::dash::Lens::Hints const &hints)
325{260{
326 QString hint;261 QString hint;
327262
328 if (!m_unityLens->results()->count()) {263 if (!m_unityScope->results()->count()) {
329 unity::dash::Lens::Hints::const_iterator it = hints.find("no-results-hint");264 unity::glib::HintsMap::const_iterator it = hints.find("no-results-hint");
330 if (it != hints.end()) {265 if (it != hints.end()) {
331 hint = QString::fromStdString(it->second.GetString());266 hint = QString::fromStdString(it->second.GetString());
332 } else {267 } else {
333268
=== renamed file 'plugins/Unity/lens.h' => 'plugins/Unity/scope.h'
--- plugins/Unity/lens.h 2013-06-05 22:03:08 +0000
+++ plugins/Unity/scope.h 2013-06-19 20:05:35 +0000
@@ -17,8 +17,8 @@
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */18 */
1919
20#ifndef LENS_H20#ifndef SCOPE_H
21#define LENS_H21#define SCOPE_H
2222
23// Qt23// Qt
24#include <QObject>24#include <QObject>
@@ -26,76 +26,56 @@
26#include <QMetaType>26#include <QMetaType>
2727
28// libunity-core28// libunity-core
29#include <UnityCore/Lens.h>29#include <UnityCore/Scope.h>
30#include <UnityCore/Results.h>
3031
31// dee-qt32// dee-qt
32#include "deelistmodel.h"33#include "deelistmodel.h"
3334
34class Categories;35class Categories;
3536
36class Lens : public QObject37class Scope : public QObject
37{38{
38 Q_OBJECT39 Q_OBJECT
39 Q_ENUMS(ViewType)
4040
41 Q_PROPERTY(QString id READ id NOTIFY idChanged)41 Q_PROPERTY(QString id READ id NOTIFY idChanged)
42 Q_PROPERTY(QString dbusName READ dbusName NOTIFY dbusNameChanged)
43 Q_PROPERTY(QString dbusPath READ dbusPath NOTIFY dbusPathChanged)
44 Q_PROPERTY(QString name READ name NOTIFY nameChanged)42 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
45 Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)43 Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)
46 Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)44 Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
47 Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged)45 Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged)
48 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)46 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
49 Q_PROPERTY(bool searchInGlobal READ searchInGlobal NOTIFY searchInGlobalChanged)
50 Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged)47 Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged)
51 Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged)48 Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged)
52 Q_PROPERTY(DeeListModel* results READ results NOTIFY resultsChanged)49 Q_PROPERTY(DeeListModel* results READ results NOTIFY resultsChanged)
53 Q_PROPERTY(DeeListModel* globalResults READ globalResults NOTIFY globalResultsChanged)
54 Q_PROPERTY(Categories* categories READ categories NOTIFY categoriesChanged)50 Q_PROPERTY(Categories* categories READ categories NOTIFY categoriesChanged)
55 Q_PROPERTY(ViewType viewType READ viewType WRITE setViewType NOTIFY viewTypeChanged)
5651
57 Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)52 Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
58 Q_PROPERTY(QString globalSearchQuery READ globalSearchQuery WRITE setGlobalSearchQuery NOTIFY globalSearchQueryChanged)
59 Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged)53 Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged)
6054
61public:55public:
62 explicit Lens(QObject *parent = 0);56 explicit Scope(QObject *parent = 0);
63
64 enum ViewType {
65 Hidden,
66 HomeView,
67 LensView
68 };
6957
70 /* getters */58 /* getters */
71 QString id() const;59 QString id() const;
72 QString dbusName() const;
73 QString dbusPath() const;
74 QString name() const;60 QString name() const;
75 QString iconHint() const;61 QString iconHint() const;
76 QString description() const;62 QString description() const;
77 QString searchHint() const;63 QString searchHint() const;
78 bool visible() const;64 bool visible() const;
79 bool searchInGlobal() const;
80 QString shortcut() const;65 QString shortcut() const;
81 bool connected() const;66 bool connected() const;
82 DeeListModel* results() const;67 DeeListModel* results() const;
83 DeeListModel* globalResults() const;
84 Categories* categories() const;68 Categories* categories() const;
85 ViewType viewType() const;
86 QString searchQuery() const;69 QString searchQuery() const;
87 QString globalSearchQuery() const;
88 QString noResultsHint() const;70 QString noResultsHint() const;
8971
90 /* setters */72 /* setters */
91 void setViewType(const ViewType& viewType);
92 void setSearchQuery(const QString& search_query);73 void setSearchQuery(const QString& search_query);
93 void setGlobalSearchQuery(const QString& search_query);
94 void setNoResultsHint(const QString& hint);74 void setNoResultsHint(const QString& hint);
9575
96 Q_INVOKABLE void activate(const QString& uri);76 Q_INVOKABLE void activate(const QString& uri);
97 void setUnityLens(const unity::dash::Lens::Ptr& lens);77 void setUnityScope(const unity::dash::Scope::Ptr& scope);
98 unity::dash::Lens::Ptr unityLens() const;78 unity::dash::Scope::Ptr unityScope() const;
9979
100Q_SIGNALS:80Q_SIGNALS:
101 void idChanged(const std::string&);81 void idChanged(const std::string&);
@@ -106,44 +86,36 @@
106 void descriptionChanged(const std::string&);86 void descriptionChanged(const std::string&);
107 void searchHintChanged(const std::string&);87 void searchHintChanged(const std::string&);
108 void visibleChanged(bool);88 void visibleChanged(bool);
109 void searchInGlobalChanged(bool);
110 void shortcutChanged(const std::string&);89 void shortcutChanged(const std::string&);
111 void connectedChanged(bool);90 void connectedChanged(bool);
112 void resultsChanged();91 void resultsChanged();
113 void globalResultsChanged();
114 void categoriesChanged();92 void categoriesChanged();
115 void viewTypeChanged(ViewType);93 void searchFinished(const std::string&, unity::glib::HintsMap const&, unity::glib::Error const&);
116 void searchFinished(unity::dash::Lens::Hints const&, unity::glib::Error const&);
117 void globalSearchFinished(unity::dash::Lens::Hints const&, unity::glib::Error const&);
118 void searchQueryChanged();94 void searchQueryChanged();
119 void globalSearchQueryChanged();
120 void noResultsHintChanged();95 void noResultsHintChanged();
12196
122private Q_SLOTS:97private Q_SLOTS:
123 void synchronizeStates();98 void synchronizeStates();
124 void onSearchFinished(unity::dash::Lens::Hints const &);99 void onSearchFinished(const std::string &, unity::glib::HintsMap const &);
125100
126private:101private:
127 void onResultsSwarmNameChanged(const std::string&);102 void onResultsSwarmNameChanged(const std::string&);
128 void onResultsChanged(const unity::dash::Results::Ptr&);103 void onResultsChanged(const unity::dash::Results::Ptr&);
129 void onGlobalResultsSwarmNameChanged(const std::string&);104 void onResultsModelChanged(unity::glib::Object<DeeModel>);
130 void onGlobalResultsChanged(const unity::dash::Results::Ptr&);
131 void onCategoriesSwarmNameChanged(const std::string&);105 void onCategoriesSwarmNameChanged(const std::string&);
106 void onCategoriesModelChanged(unity::glib::Object<DeeModel>);
132 void onCategoriesChanged(const unity::dash::Categories::Ptr&);107 void onCategoriesChanged(const unity::dash::Categories::Ptr&);
133 void onViewTypeChanged(unity::dash::ViewType);
134108
135 void onActivated(std::string const& uri, unity::dash::HandledType type, unity::dash::Lens::Hints const&);109 void onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const&);
136 void fallbackActivate(const QString& uri);110 void fallbackActivate(const QString& uri);
137111
138 unity::dash::Lens::Ptr m_unityLens;112 unity::dash::Scope::Ptr m_unityScope;
139 DeeListModel* m_results;113 DeeListModel* m_results;
140 DeeListModel* m_globalResults;
141 Categories* m_categories;114 Categories* m_categories;
142 QString m_searchQuery;115 QString m_searchQuery;
143 QString m_globalSearchQuery;
144 QString m_noResultsHint;116 QString m_noResultsHint;
145};117};
146118
147Q_DECLARE_METATYPE(Lens*)119Q_DECLARE_METATYPE(Scope*)
148120
149#endif // LENS_H121#endif // SCOPE_H
150122
=== renamed file 'plugins/Unity/lenses.cpp' => 'plugins/Unity/scopes.cpp'
--- plugins/Unity/lenses.cpp 2013-06-05 22:03:08 +0000
+++ plugins/Unity/scopes.cpp 2013-06-19 20:05:35 +0000
@@ -18,49 +18,44 @@
18 */18 */
1919
20// Self20// Self
21#include "lenses.h"21#include "scopes.h"
2222
23// Local23// Local
24#include "lens.h"24#include "scope.h"
2525
26// Qt26// Qt
27#include <QDebug>27#include <QDebug>
28#include <QtCore/QStringList>28#include <QtCore/QStringList>
29#include <QtGui/QKeySequence>29#include <QtGui/QKeySequence>
3030
31// libunity-core31Scopes::Scopes(QObject *parent)
32#include <UnityCore/FilesystemLenses.h>
33#include <UnityCore/HomeLens.h>
34
35Lenses::Lenses(QObject *parent)
36 : QAbstractListModel(parent)32 : QAbstractListModel(parent)
37 , m_unityLenses(std::make_shared<unity::dash::FilesystemLenses>())33 , m_unityScopes(std::make_shared<unity::dash::GSettingsScopes>())
38 , m_homeLens(std::make_shared<unity::dash::HomeLens>(QString::fromUtf8(dgettext("unity", "Home")).toStdString(),
39 QString::fromUtf8(dgettext("unity", "Home screen")).toStdString(),
40 QString::fromUtf8(dgettext("unity", "Search")).toStdString()))
41 , m_loaded(false)34 , m_loaded(false)
42{35{
43 m_roles[Lenses::RoleLens] = "lens";36 m_roles[Scopes::RoleScope] = "scope";
44 m_roles[Lenses::RoleId] = "id";37 m_roles[Scopes::RoleId] = "id";
45 m_roles[Lenses::RoleVisible] = "visible";38 m_roles[Scopes::RoleVisible] = "visible";
4639
47 m_homeLens->AddLenses(m_unityLenses);40 m_unityScopes->scope_added.connect(sigc::mem_fun(this, &Scopes::onScopeAdded));
48 std::dynamic_pointer_cast<unity::dash::FilesystemLenses>(m_unityLenses)->lenses_loaded.connect(sigc::mem_fun(this, &Lenses::onLensesLoaded));41 m_unityScopes->scope_removed.connect(sigc::mem_fun(this, &Scopes::onScopeRemoved));
42 m_unityScopes->scopes_reordered.connect(sigc::mem_fun(this, &Scopes::onScopesReordered));
43 m_unityScopes->LoadScopes();
49}44}
5045
51QHash<int, QByteArray> Lenses::roleNames() const46QHash<int, QByteArray> Scopes::roleNames() const
52{47{
53 return m_roles;48 return m_roles;
54}49}
5550
56int Lenses::rowCount(const QModelIndex& parent) const51int Scopes::rowCount(const QModelIndex& parent) const
57{52{
58 Q_UNUSED(parent)53 Q_UNUSED(parent)
5954
60 return m_lenses.count();55 return m_scopes.count();
61}56}
6257
63QVariant Lenses::data(const QModelIndex& index, int role) const58QVariant Scopes::data(const QModelIndex& index, int role) const
64{59{
65 Q_UNUSED(role)60 Q_UNUSED(role)
6661
@@ -68,115 +63,114 @@
68 return QVariant();63 return QVariant();
69 }64 }
7065
71 Lens* lens = m_lenses.at(index.row());66 Scope* scope = m_scopes.at(index.row());
7267
73 if (role == Lenses::RoleLens) {68 if (role == Scopes::RoleScope) {
74 return QVariant::fromValue(lens);69 return QVariant::fromValue(scope);
75 } else if (role == Lenses::RoleId) {70 } else if (role == Scopes::RoleId) {
76 return QVariant::fromValue(lens->id());71 return QVariant::fromValue(scope->id());
77 } else if (role == Lenses::RoleVisible) {72 } else if (role == Scopes::RoleVisible) {
78 return QVariant::fromValue(lens->visible());73 return QVariant::fromValue(scope->visible());
79 } else {74 } else {
80 return QVariant();75 return QVariant();
81 }76 }
82}77}
8378
84QVariant Lenses::get(int row) const79QVariant Scopes::get(int row) const
85{80{
86 return data(QAbstractListModel::index(row), 0);81 return data(QAbstractListModel::index(row), 0);
87}82}
8883
89QVariant Lenses::get(const QString& lens_id) const84QVariant Scopes::get(const QString& scope_id) const
90{85{
91 Q_FOREACH(Lens* lens, m_lenses) {86 Q_FOREACH(Scope* scope, m_scopes) {
92 if (lens->id() == lens_id) {87 if (scope->id() == scope_id) {
93 return QVariant::fromValue(lens);88 return QVariant::fromValue(scope);
94 }89 }
95 }90 }
9691
97 return QVariant();92 return QVariant();
98}93}
9994
100bool Lenses::loaded() const95bool Scopes::loaded() const
101{96{
102 return m_loaded;97 return m_loaded;
103}98}
10499
105void Lenses::onLensAdded(const unity::dash::Lens::Ptr& lens)100void Scopes::onScopeAdded(const unity::dash::Scope::Ptr& scope, int /*position*/)
106{101{
107 int index = m_lenses.count();102 int index = m_scopes.count();
108 beginInsertRows(QModelIndex(), index, index);103 beginInsertRows(QModelIndex(), index, index);
109 addUnityLens(lens);104 addUnityScope(scope);
110 endInsertRows();105 endInsertRows();
111}106
112107 // FIXME: do only once after all loaded?
113void Lenses::onLensesLoaded()
114{
115 /* FIXME: this is temporary code that is required on mobile to order
116 the lenses according to the design.
117 */
118 QStringList staticLenses;
119 staticLenses << "mockmusic.lens" << "people.lens" << "home.lens" << "applications.lens" << "mockvideos.lens";
120
121 // not all the lenses are guaranteed to go into the model (only if their UnitCore counterparts exist);
122 // so build up a list of the valid ones, then add them later.
123 QList<unity::dash::Lens::Ptr> added_lenses;
124
125 // add statically ordered lenses
126 Q_FOREACH(QString lensId, staticLenses) {
127 if (lensId == "home.lens") {
128 added_lenses << m_homeLens;
129 } else {
130 unity::dash::Lens::Ptr lens = m_unityLenses->GetLens(lensId.toStdString());
131 if (lens != NULL) {
132 added_lenses << lens;
133 }
134 }
135 }
136
137 // add remaining lenses
138 unity::dash::Lenses::LensList lensesList = m_unityLenses->GetLenses();
139 for(auto it = lensesList.begin(); it != lensesList.end(); ++it) {
140 unity::dash::Lens::Ptr lens = (*it);
141 if (!staticLenses.contains(QString::fromStdString(lens->id))) {
142 added_lenses << lens;
143 }
144 }
145
146 if (added_lenses.count() > 0) {
147 int index = rowCount();
148 beginInsertRows(QModelIndex(), index, index+added_lenses.count()-1);
149 Q_FOREACH(unity::dash::Lens::Ptr lens, added_lenses) {
150 addUnityLens(lens);
151 }
152 endInsertRows();
153 }
154
155 m_loaded = true;108 m_loaded = true;
156 Q_EMIT loadedChanged(m_loaded);109 Q_EMIT loadedChanged(m_loaded);
157110}
158 // listen to dynamically added lenses111
159 m_homeLens->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded));112void Scopes::onScopesLoaded()
160}113{
161114}
162void Lenses::onLensPropertyChanged()115
163{116void Scopes::onScopeRemoved(const unity::dash::Scope::Ptr& scope)
164 QModelIndex lensIndex = index(m_lenses.indexOf(qobject_cast<Lens*>(sender())));117{
165 Q_EMIT dataChanged(lensIndex, lensIndex);118 auto id = QString::fromStdString(scope->id);
166}119 auto index = findScopeById(id);
167120 if (index >= 0) {
168void Lenses::addUnityLens(const unity::dash::Lens::Ptr& unity_lens)121 beginRemoveRows(QModelIndex(), index, index);
169{122 removeUnityScope(index);
170 Lens* lens = new Lens(this);123 endRemoveRows();
171 lens->setUnityLens(unity_lens);124
125 Q_EMIT scopeRemoved(id, index);
126 }
127}
128
129void Scopes::onScopesReordered(const unity::dash::Scopes::ScopeList& scopes)
130{
131 // FIXME Should use beginMoveRows()/endMoveRows() to not recreate the UI for every scope.
132 beginResetModel();
133
134 // remove existing scopes
135 for (auto i=m_scopes.count()-1; i>=0; i--) {
136 removeUnityScope(i);
137 }
138
139 // re-create scopes
140 for (uint i=0; i<scopes.size(); i++) {
141 addUnityScope(scopes[i]);
142 }
143 endResetModel();
144}
145
146void Scopes::onScopePropertyChanged()
147{
148 QModelIndex scopeIndex = index(m_scopes.indexOf(qobject_cast<Scope*>(sender())));
149 Q_EMIT dataChanged(scopeIndex, scopeIndex);
150}
151
152void Scopes::addUnityScope(const unity::dash::Scope::Ptr& unity_scope)
153{
154 Scope* scope = new Scope(this);
155 scope->setUnityScope(unity_scope);
172 /* DOCME */156 /* DOCME */
173 QObject::connect(lens, SIGNAL(visibleChanged(bool)), this, SLOT(onLensPropertyChanged()));157 QObject::connect(scope, SIGNAL(visibleChanged(bool)), this, SLOT(onScopePropertyChanged()));
174 m_lenses.append(lens);158 m_scopes.append(scope);
175}159}
176160
177void Lenses::removeUnityLens(int index)161void Scopes::removeUnityScope(int index)
178{162{
179 Lens* lens = m_lenses.takeAt(index);163 Scope* scope = m_scopes.takeAt(index);
180164
181 delete lens;165 delete scope;
166}
167
168int Scopes::findScopeById(const QString& scope_id)
169{
170 for (int i=0; i<m_scopes.count(); i++) {
171 if (m_scopes[i]->id() == scope_id) {
172 return i;
173 }
174 }
175 return -1;
182}176}
183177
=== renamed file 'plugins/Unity/lenses.h' => 'plugins/Unity/scopes.h'
--- plugins/Unity/lenses.h 2013-06-05 22:03:08 +0000
+++ plugins/Unity/scopes.h 2013-06-19 20:05:35 +0000
@@ -17,29 +17,29 @@
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */18 */
1919
20#ifndef LENSES_H20#ifndef SCOPES_H
21#define LENSES_H21#define SCOPES_H
2222
23// Qt23// Qt
24#include <QAbstractListModel>24#include <QAbstractListModel>
25#include <QList>25#include <QList>
2626
27// libunity-core27// libunity-core
28#include <UnityCore/Lens.h>28#include <UnityCore/Scope.h>
29#include <UnityCore/HomeLens.h>29#include <UnityCore/GSettingsScopes.h>
3030
31namespace unity31namespace unity
32{32{
33namespace dash33namespace dash
34{34{
35class Lenses;35class Scopes;
36}36}
37}37}
3838
39class Hotkey;39class Hotkey;
40class Lens;40class Scope;
4141
42class Lenses : public QAbstractListModel42class Scopes : public QAbstractListModel
43{43{
44 Q_OBJECT44 Q_OBJECT
4545
@@ -48,11 +48,11 @@
48 Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)48 Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
4949
50public:50public:
51 explicit Lenses(QObject *parent = 0);51 explicit Scopes(QObject *parent = 0);
52 ~Lenses() = default;52 ~Scopes() = default;
5353
54 enum Roles {54 enum Roles {
55 RoleLens,55 RoleScope,
56 RoleId,56 RoleId,
57 RoleVisible57 RoleVisible
58 };58 };
@@ -61,30 +61,34 @@
61 Q_INVOKABLE int rowCount(const QModelIndex& parent = QModelIndex()) const;61 Q_INVOKABLE int rowCount(const QModelIndex& parent = QModelIndex()) const;
6262
63 Q_INVOKABLE QVariant get(int row) const;63 Q_INVOKABLE QVariant get(int row) const;
64 Q_INVOKABLE QVariant get(const QString& lens_id) const;64 Q_INVOKABLE QVariant get(const QString& scope_id) const;
6565
66 QHash<int, QByteArray> roleNames() const;66 QHash<int, QByteArray> roleNames() const;
6767
68 bool loaded() const;68 bool loaded() const;
6969
70Q_SIGNALS:70Q_SIGNALS:
71 void activateLensRequested(const QString& lens_id);71 void activateScopeRequested(const QString& scope_id);
72 void loadedChanged(bool loaded);72 void loadedChanged(bool loaded);
73 void scopeRemoved(const QString& scope_id, int index);
7374
74private Q_SLOTS:75private Q_SLOTS:
75 void onLensAdded(const unity::dash::Lens::Ptr& lens);76 void onScopesLoaded();
76 void onLensesLoaded();77 void onScopeAdded(const unity::dash::Scope::Ptr& scope, int position);
77 void onLensPropertyChanged();78 void onScopeRemoved(const unity::dash::Scope::Ptr& scope);
79 void onScopesReordered(const unity::dash::Scopes::ScopeList& scopes);
80 void onScopePropertyChanged();
7881
79private:82private:
80 unity::dash::Lenses::Ptr m_unityLenses;83 unity::dash::GSettingsScopesReader::Ptr m_scopesReader;
81 unity::dash::HomeLens::Ptr m_homeLens;84 unity::dash::Scopes::Ptr m_unityScopes;
82 QList<Lens*> m_lenses;85 QList<Scope*> m_scopes;
83 QHash<int, QByteArray> m_roles;86 QHash<int, QByteArray> m_roles;
84 bool m_loaded;87 bool m_loaded;
8588
86 void addUnityLens(const unity::dash::Lens::Ptr& unity_lens);89 void addUnityScope(const unity::dash::Scope::Ptr& unity_scope);
87 void removeUnityLens(int index);90 void removeUnityScope(int index);
91 int findScopeById(const QString& scope_id);
88};92};
8993
90#endif // LENSES_H94#endif // SCOPES_H
9195
=== modified file 'po/unity8.pot'
--- po/unity8.pot 2013-06-19 15:07:15 +0000
+++ po/unity8.pot 2013-06-19 20:05:35 +0000
@@ -109,27 +109,19 @@
109msgid "Apps"109msgid "Apps"
110msgstr ""110msgstr ""
111111
112#: Dash/DashHome.qml:40
113msgid "Frequent Apps"
114msgstr ""
115
112#: Dash/DashHome.qml:43116#: Dash/DashHome.qml:43
113msgid "Frequent Apps"117msgid "Recent Music"
114msgstr ""118msgstr ""
115119
116#: Dash/DashHome.qml:46120#: Dash/DashHome.qml:46
117msgid "Favourite People"
118msgstr ""
119
120#: Dash/DashHome.qml:49
121msgid "People Recently in Touch"
122msgstr ""
123
124#: Dash/DashHome.qml:52
125msgid "Recent Music"
126msgstr ""
127
128#: Dash/DashHome.qml:55
129msgid "Videos Popular Online"121msgid "Videos Popular Online"
130msgstr ""122msgstr ""
131123
132#: Dash/DashHome.qml:197 plugins/Unity/lenses.cpp:38124#: Dash/DashHome.qml:175
133msgid "Home"125msgid "Home"
134msgstr ""126msgstr ""
135127
@@ -153,26 +145,6 @@
153msgid "Music"145msgid "Music"
154msgstr ""146msgstr ""
155147
156#: Dash/DashPeople.qml:31
157msgid "Favourites"
158msgstr ""
159
160#: Dash/DashPeople.qml:32
161msgid "Recently in touch"
162msgstr ""
163
164#: Dash/DashPeople.qml:33
165msgid "New Contacts"
166msgstr ""
167
168#: Dash/DashPeople.qml:34
169msgid "A-Z"
170msgstr ""
171
172#: Dash/DashPeople.qml:123
173msgid "People"
174msgstr ""
175
176#: Dash/DashVideos.qml:31148#: Dash/DashVideos.qml:31
177msgid "Popular Online"149msgid "Popular Online"
178msgstr ""150msgstr ""
@@ -234,16 +206,17 @@
234msgid "Flight mode"206msgid "Flight mode"
235msgstr ""207msgstr ""
236208
237#: Panel/SearchIndicator.qml:26 plugins/Unity/lenses.cpp:40209#: Panel/SearchIndicator.qml:26
238msgid "Search"210msgid "Search"
239msgstr ""211msgstr ""
240212
241#: plugins/Unity/lens.cpp:333213#: plugins/Unity/scope.cpp:268
242msgid "Sorry, there is nothing that matches your search."214msgid "Sorry, there is nothing that matches your search."
243msgstr ""215msgstr ""
244216
245#: plugins/Unity/lenses.cpp:39217#: Shell.qml:380
246msgid "Home screen"218#, qt-format
219msgid "Please enter %1:"
247msgstr ""220msgstr ""
248221
249#: Shell.qml:380222#: Shell.qml:380
250223
=== modified file 'tests/autopilot/unity8/tests/helpers.py'
--- tests/autopilot/unity8/tests/helpers.py 2013-06-05 22:03:08 +0000
+++ tests/autopilot/unity8/tests/helpers.py 2013-06-19 20:05:35 +0000
@@ -71,7 +71,7 @@
71 self.touch.drag(start_x, start_y, stop_x, stop_y)71 self.touch.drag(start_x, start_y, stop_x, stop_y)
7272
73 # Because the shell loads up lots of stuff, unlocking the greeter can73 # Because the shell loads up lots of stuff, unlocking the greeter can
74 # be a bit stuttery while lenses are still consuming all resources.74 # be a bit stuttery while scopes are still consuming all resources.
75 # Give it another (max retries) chance75 # Give it another (max retries) chance
76 try:76 try:
77 self.assertThat(greeter.created, Eventually(Equals(False)))77 self.assertThat(greeter.created, Eventually(Equals(False)))
7878
=== modified file 'tests/autopilot/unity8/tests/testhud.py'
--- tests/autopilot/unity8/tests/testhud.py 2013-06-11 15:45:45 +0000
+++ tests/autopilot/unity8/tests/testhud.py 2013-06-19 20:05:35 +0000
@@ -73,7 +73,7 @@
73 super(TestHud, self).setUp("%sx%s" % (self.app_width / divisor, self.app_height / divisor), "%s" % (self.grid_unit_px / divisor))73 super(TestHud, self).setUp("%sx%s" % (self.app_width / divisor, self.app_height / divisor), "%s" % (self.grid_unit_px / divisor))
7474
75 dash = self.main_window.get_dash()75 dash = self.main_window.get_dash()
76 self.assertThat(dash.showLensOnLoaded, Eventually(Equals(""), timeout=30))76 self.assertThat(dash.showScopeOnLoaded, Eventually(Equals(""), timeout=30))
7777
78 def test_show_hud(self):78 def test_show_hud(self):
79 hud = self.main_window.get_hud()79 hud = self.main_window.get_hud()
8080
=== modified file 'tests/autopilot/unity8/tests/testlockscreen.py'
--- tests/autopilot/unity8/tests/testlockscreen.py 2013-06-12 07:59:03 +0000
+++ tests/autopilot/unity8/tests/testlockscreen.py 2013-06-19 20:05:35 +0000
@@ -71,7 +71,7 @@
71 super(TestLockscreens, self).setUp("%sx%s" % (self.app_width / divisor, self.app_height / divisor), "%s" % (self.grid_unit_px / divisor))71 super(TestLockscreens, self).setUp("%sx%s" % (self.app_width / divisor, self.app_height / divisor), "%s" % (self.grid_unit_px / divisor))
7272
73 dash = self.main_window.get_dash()73 dash = self.main_window.get_dash()
74 self.assertThat(dash.showLensOnLoaded, Eventually(Equals(""), timeout=30))74 self.assertThat(dash.showScopeOnLoaded, Eventually(Equals(""), timeout=30))
7575
76 def test_unlock(self):76 def test_unlock(self):
77 self.unlock_greeter()77 self.unlock_greeter()
7878
=== modified file 'tests/qmltests/CMakeLists.txt'
--- tests/qmltests/CMakeLists.txt 2013-06-19 18:10:57 +0000
+++ tests/qmltests/CMakeLists.txt 2013-06-19 20:05:35 +0000
@@ -41,13 +41,11 @@
41add_qml_test(Dash DashBar IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})41add_qml_test(Dash DashBar IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
42add_qml_test(Dash DashContent IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS})42add_qml_test(Dash DashContent IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS})
43add_qml_test(Dash DashPreview)43add_qml_test(Dash DashPreview)
44add_qml_test(Dash GenericLensView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})44add_qml_test(Dash GenericScopeView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
45add_qml_test(Dash LensView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/plugins)45add_qml_test(Dash ScopeView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/plugins)
46add_qml_test(Dash PeoplePreview)
47add_qml_test(Dash FilterGrids IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_SOURCE_DIR}/plugins46add_qml_test(Dash FilterGrids IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_SOURCE_DIR}/plugins
48 ${CMAKE_BINARY_DIR}/tests/mocks)47 ${CMAKE_BINARY_DIR}/tests/mocks)
49add_qml_test(Dash/Apps RunningApplicationsGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)48add_qml_test(Dash/Apps RunningApplicationsGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
50add_qml_test(Dash/People PeopleFilterGrid IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_SOURCE_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
51add_qml_test(Greeter Lockscreen IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_BINARY_DIR}/tests/mocks49add_qml_test(Greeter Lockscreen IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_BINARY_DIR}/tests/mocks
52 PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")50 PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")
53add_qml_test(Greeter Tablet IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_BINARY_DIR}/tests/mocks51add_qml_test(Greeter Tablet IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_BINARY_DIR}/tests/mocks
5452
=== removed directory 'tests/qmltests/Dash/People'
=== removed file 'tests/qmltests/Dash/People/tst_PeopleFilterGrid.qml'
--- tests/qmltests/Dash/People/tst_PeopleFilterGrid.qml 2013-06-05 22:03:08 +0000
+++ tests/qmltests/Dash/People/tst_PeopleFilterGrid.qml 1970-01-01 00:00:00 +0000
@@ -1,154 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import QtTest 1.0
19import ".."
20import "../.."
21import "../../../../Dash/People"
22import Ubuntu.Components 0.1
23import Unity.Test 0.1 as UT
24
25Item {
26 id: root
27 width: units.gu(120)
28 height: units.gu(40)
29
30 PeopleFilterGrid {
31 id: peopleFilterGrid
32 anchors.fill: parent
33 model: mockModel
34 }
35
36 SignalSpy {
37 id: signalSpy
38 target: peopleFilterGrid
39 signalName: "clicked"
40 }
41
42 ListModel {
43 id: mockModel
44
45 ListElement {
46 column_0: 'user://001'
47 column_1: "gtk-apply"
48 column_2: ""
49 column_3: ""
50 column_4: "User 1"
51 column_5: "Text 1"
52 }
53
54 ListElement {
55 column_0: 'user://002'
56 column_1: "gtk-apply"
57 column_2: ""
58 column_3: ""
59 column_4: "User 2"
60 column_5: "Text 2"
61 }
62
63 ListElement {
64 column_0: 'user://003'
65 column_1: "gtk-apply"
66 column_2: ""
67 column_3: ""
68 column_4: "User 3"
69 column_5: "Text 3"
70 }
71
72 ListElement {
73 column_0: 'user://004'
74 column_1: "gtk-apply"
75 column_2: ""
76 column_3: ""
77 column_4: "User 4"
78 column_5: "Text 4"
79 }
80
81 ListElement {
82 column_0: 'user://005'
83 column_1: "gtk-apply"
84 column_2: ""
85 column_3: ""
86 column_4: "User 5"
87 column_5: "Text 5"
88 }
89
90 }
91
92 UT.UnityTestCase {
93 id: testCase
94 name: "DashPeopleFilterGrid"
95 when: windowShown
96
97 function init() {
98 }
99
100 function test_clickCell_data() {
101 return [
102 {
103 x: peopleFilterGrid.minimumHorizontalSpacing+peopleFilterGrid.cellWidth/2,
104 y: peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight/2,
105 index: 0,
106 uri: "user://001"
107 },
108 {
109 x: 2*peopleFilterGrid.minimumHorizontalSpacing+peopleFilterGrid.cellWidth+peopleFilterGrid.cellWidth/2,
110 y: peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight/2,
111 index: 1,
112 uri: "user://002"
113 },
114 {
115 x: 3*peopleFilterGrid.minimumHorizontalSpacing+2*peopleFilterGrid.cellWidth+peopleFilterGrid.cellWidth/2,
116 y: peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight/2,
117 index: 2,
118 uri: "user://003"
119 },
120 {
121 x: peopleFilterGrid.minimumHorizontalSpacing+peopleFilterGrid.cellWidth/2,
122 y: 2*peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight+peopleFilterGrid.cellHeight/2,
123 index: 3,
124 uri: "user://004"
125 },
126 {
127 x: 2*peopleFilterGrid.minimumHorizontalSpacing+peopleFilterGrid.cellWidth+peopleFilterGrid.cellWidth/2,
128 y: 2*peopleFilterGrid.verticalSpacing+peopleFilterGrid.cellHeight+peopleFilterGrid.cellHeight/2,
129 index: 4,
130 uri: "user://005"
131 },
132 ]
133 }
134
135 function test_columns() {
136 compare(peopleFilterGrid.columns,3)
137 }
138
139 function test_clickCell(data) {
140 tryCompare(peopleFilterGrid, "flicking", false)
141 tryCompare(peopleFilterGrid, "moving", false)
142 signalSpy.clear()
143 wait(peopleFilterGrid.pressDelay > 0 ? peopleFilterGrid.pressDelay : 5)
144 mouseClick(peopleFilterGrid, data.x, data.y)
145 tryCompare(peopleFilterGrid, "flicking", false)
146 tryCompare(peopleFilterGrid, "moving", false)
147 compare(signalSpy.count, 1)
148 compare(signalSpy.signalArguments.length, 1, "signalArguments.length != 1")
149 compare(signalSpy.signalArguments[0][0], data.index)
150 compare(signalSpy.signalArguments[0][1]["uri"], data.uri)
151 }
152
153 }
154}
1550
=== renamed file 'tests/qmltests/Dash/qml/FakeLensView.qml' => 'tests/qmltests/Dash/qml/FakeScopeView.qml'
--- tests/qmltests/Dash/qml/FakeLensView.qml 2013-06-11 10:36:55 +0000
+++ tests/qmltests/Dash/qml/FakeScopeView.qml 2013-06-19 20:05:35 +0000
@@ -18,8 +18,8 @@
18import Unity 0.118import Unity 0.1
1919
20FocusScope {20FocusScope {
21 id: fakeLensView21 id: fakeScopeView
22 property Lens lens : null22 property Scope scope : null
23 property bool isCurrent : false23 property bool isCurrent : false
2424
25 property ListModel searchHistory25 property ListModel searchHistory
@@ -31,18 +31,18 @@
31 property alias backColor : back.color31 property alias backColor : back.color
3232
33 onEndReached: {33 onEndReached: {
34 if (shell != undefined && shell.lensStatus != undefined) {34 if (shell != undefined && shell.scopeStatus != undefined) {
35 shell.lensStatus[lens.id].endReached++;35 shell.scopeStatus[scope.id].endReached++;
36 }36 }
37 }37 }
38 onMovementStarted: {38 onMovementStarted: {
39 if (shell != undefined && shell.lensStatus != undefined) {39 if (shell != undefined && shell.scopeStatus != undefined) {
40 shell.lensStatus[lens.id].movementStarted++;40 shell.scopeStatus[scope.id].movementStarted++;
41 }41 }
42 }42 }
43 onPositionedAtBeginning: {43 onPositionedAtBeginning: {
44 if (shell != undefined && shell.lensStatus != undefined) {44 if (shell != undefined && shell.scopeStatus != undefined) {
45 shell.lensStatus[lens.id].positionedAtBeginning++;45 shell.scopeStatus[scope.id].positionedAtBeginning++;
46 }46 }
47 }47 }
4848
@@ -68,7 +68,7 @@
68 ListView {68 ListView {
69 id: listView69 id: listView
70 anchors.fill: parent70 anchors.fill: parent
71 model: lens ? lens.categories : null71 model: scope ? scope.categories : null
72 orientation: ListView.Vertical72 orientation: ListView.Vertical
7373
74 delegate: Column {74 delegate: Column {
7575
=== renamed file 'tests/qmltests/Dash/qml/fake_generic_lensView.qml' => 'tests/qmltests/Dash/qml/fake_generic_scopeView.qml'
--- tests/qmltests/Dash/qml/fake_generic_lensView.qml 2013-06-11 10:36:55 +0000
+++ tests/qmltests/Dash/qml/fake_generic_scopeView.qml 2013-06-19 20:05:35 +0000
@@ -16,9 +16,9 @@
1616
17import QtQuick 2.017import QtQuick 2.0
1818
19FakeLensView {19FakeScopeView {
20 id: fake_generic_lensView20 id: fake_generic_scopeView
21 objectName: "fake_generic_lensView"21 objectName: "fake_generic_scopeView"
2222
23 backColor: "#D0D0D0"23 backColor: "#D0D0D0"
24}24}
2525
=== renamed file 'tests/qmltests/Dash/qml/fake_lensView1.qml' => 'tests/qmltests/Dash/qml/fake_scopeView1.qml'
--- tests/qmltests/Dash/qml/fake_lensView1.qml 2013-06-11 10:36:55 +0000
+++ tests/qmltests/Dash/qml/fake_scopeView1.qml 2013-06-19 20:05:35 +0000
@@ -16,9 +16,9 @@
1616
17import QtQuick 2.017import QtQuick 2.0
1818
19FakeLensView {19FakeScopeView {
20 id: fake_lensView120 id: fake_scopeView1
21 objectName: "fake_lensView1"21 objectName: "fake_scopeView1"
2222
23 backColor: "#909090"23 backColor: "#909090"
24}24}
2525
=== renamed file 'tests/qmltests/Dash/qml/fake_lensView2.qml' => 'tests/qmltests/Dash/qml/fake_scopeView2.qml'
--- tests/qmltests/Dash/qml/fake_lensView2.qml 2013-06-11 10:36:55 +0000
+++ tests/qmltests/Dash/qml/fake_scopeView2.qml 2013-06-19 20:05:35 +0000
@@ -16,9 +16,9 @@
1616
17import QtQuick 2.017import QtQuick 2.0
1818
19FakeLensView {19FakeScopeView {
20 id: fake_lensView220 id: fake_scopeView2
21 objectName: "fake_lensView2"21 objectName: "fake_scopeView2"
2222
23 backColor: "#A0A0A0"23 backColor: "#A0A0A0"
24}24}
2525
=== renamed file 'tests/qmltests/Dash/qml/fake_lensView3.qml' => 'tests/qmltests/Dash/qml/fake_scopeView3.qml'
--- tests/qmltests/Dash/qml/fake_lensView3.qml 2013-06-11 10:36:55 +0000
+++ tests/qmltests/Dash/qml/fake_scopeView3.qml 2013-06-19 20:05:35 +0000
@@ -16,9 +16,9 @@
1616
17import QtQuick 2.017import QtQuick 2.0
1818
19FakeLensView {19FakeScopeView {
20 id: fake_lensView320 id: fake_scopeView3
21 objectName: "fake_lensView3"21 objectName: "fake_scopeView3"
2222
23 backColor: "#B0B0B0"23 backColor: "#B0B0B0"
24}24}
2525
=== renamed file 'tests/qmltests/Dash/qml/fake_lensView4.qml' => 'tests/qmltests/Dash/qml/fake_scopeView4.qml'
--- tests/qmltests/Dash/qml/fake_lensView4.qml 2013-06-11 10:36:55 +0000
+++ tests/qmltests/Dash/qml/fake_scopeView4.qml 2013-06-19 20:05:35 +0000
@@ -16,9 +16,9 @@
1616
17import QtQuick 2.017import QtQuick 2.0
1818
19FakeLensView {19FakeScopeView {
20 id: fake_lensView420 id: fake_scopeView4
21 objectName: "fake_lensView4"21 objectName: "fake_scopeView4"
2222
23 backColor: "#C0C0C0"23 backColor: "#C0C0C0"
24}24}
2525
=== modified file 'tests/qmltests/Dash/tst_Dash.qml'
--- tests/qmltests/Dash/tst_Dash.qml 2013-06-11 10:36:55 +0000
+++ tests/qmltests/Dash/tst_Dash.qml 2013-06-19 20:05:35 +0000
@@ -30,79 +30,79 @@
30 Dash {30 Dash {
31 id: dash31 id: dash
32 anchors.fill: parent32 anchors.fill: parent
33 showLensOnLoaded: "MockLens2"33 showScopeOnLoaded: "MockScope2"
34 }34 }
3535
36 LensDelegateMapper {36 ScopeDelegateMapper {
37 id: lensDelegateMapper37 id: scopeDelegateMapper
38 lensDelegateMapping: {38 scopeDelegateMapping: {
39 "MockLens1": "../tests/qmltests/Dash/qml/fake_lensView1.qml",39 "MockScope1": "../tests/qmltests/Dash/qml/fake_scopeView1.qml",
40 "MockLens2": "../tests/qmltests/Dash/qml/fake_lensView2.qml",40 "MockScope2": "../tests/qmltests/Dash/qml/fake_scopeView2.qml",
41 "MockLens3": "../tests/qmltests/Dash/qml/fake_lensView3.qml",41 "MockScope3": "../tests/qmltests/Dash/qml/fake_scopeView3.qml",
42 "MockLens4": "../tests/qmltests/Dash/qml/fake_lensView4.qml"42 "MockScope4": "../tests/qmltests/Dash/qml/fake_scopeView4.qml"
43 }43 }
44 genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"44 genericScope: "../tests/qmltests/Dash/qml/fake_generic_scopeView.qml"
45 }45 }
4646
47 UT.UnityTestCase {47 UT.UnityTestCase {
48 name: "Dash"48 name: "Dash"
49 when: windowShown49 when: windowShown
5050
51 property var lenses51 property var scopes
5252
53 Component.onCompleted: {53 Component.onCompleted: {
54 var dashContent = findChild(dash, "dashContent");54 var dashContent = findChild(dash, "dashContent");
55 dashContent.lensMapper = lensDelegateMapper;55 dashContent.scopeMapper = scopeDelegateMapper;
56 lenses = dashContent.lenses;56 scopes = dashContent.scopes;
57 }57 }
5858
59 function init() {59 function init() {
60 // clear and reload the lenses.60 // clear and reload the scopes.
61 lenses.clear();61 scopes.clear();
62 var dashContentList = findChild(dash, "dashContentList");62 var dashContentList = findChild(dash, "dashContentList");
63 verify(dashContentList != undefined);63 verify(dashContentList != undefined);
64 tryCompare(dashContentList, "count", 0);64 tryCompare(dashContentList, "count", 0);
65 lenses.load();65 scopes.load();
66 }66 }
6767
68 function get_lens_data() {68 function get_scope_data() {
69 return [69 return [
70 { tag: "MockLens1", visualIndex: 0, shouldBeVisible: true },70 { tag: "MockScope1", visualIndex: 0, shouldBeVisible: true },
71 { tag: "MockLens2", visualIndex: -1, shouldBeVisible: false },71 { tag: "MockScope2", visualIndex: -1, shouldBeVisible: false },
72 { tag: "MockLens3", visualIndex: 1, shouldBeVisible: true },72 { tag: "MockScope3", visualIndex: 1, shouldBeVisible: true },
73 { tag: "MockLens4", visualIndex: 2, shouldBeVisible: true },73 { tag: "MockScope4", visualIndex: 2, shouldBeVisible: true },
74 { tag: "MockLens5", visualIndex: 3, shouldBeVisible: true },74 { tag: "MockScope5", visualIndex: 3, shouldBeVisible: true },
75 ]75 ]
76 }76 }
7777
78 function test_set_current_lens_data() {78 function test_set_current_scope_data() {
79 return get_lens_data()79 return get_scope_data()
80 }80 }
8181
82 function test_set_current_lens(data) {82 function test_set_current_scope(data) {
83 // wait for lenses to load83 // wait for scopes to load
84 tryCompare(lenses, "loaded", true);84 tryCompare(scopes, "loaded", true);
8585
86 var dashbar = findChild(dash, "dashbar");86 var dashbar = findChild(dash, "dashbar");
87 verify(dashbar != undefined)87 verify(dashbar != undefined)
88 var dashContent = findChild(dash, "dashContent");88 var dashContent = findChild(dash, "dashContent");
89 var current_index = dashContent.currentIndex;89 var current_index = dashContent.currentIndex;
9090
91 dash.setCurrentLens(data.tag, true /* animate */, false /* reset */);91 dash.setCurrentScope(data.tag, true /* animate */, false /* reset */);
92 compare(dashContent.currentIndex, data.shouldBeVisible ? data.visualIndex : current_index);92 compare(dashContent.currentIndex, data.shouldBeVisible ? data.visualIndex : current_index);
93 compare(dashbar.currentIndex, data.shouldBeVisible ? data.visualIndex : current_index);93 compare(dashbar.currentIndex, data.shouldBeVisible ? data.visualIndex : current_index);
94 }94 }
9595
96 function test_show_lens_on_load_data() {96 function test_show_scope_on_load_data() {
97 return get_lens_data()97 return get_scope_data()
98 }98 }
9999
100 function test_show_lens_on_load(data) {100 function test_show_scope_on_load(data) {
101 if (data.shouldBeVisible == false) {101 if (data.shouldBeVisible == false) {
102 console.log("Not testing " + data.tag + ": not visible");102 console.log("Not testing " + data.tag + ": not visible");
103 return;103 return;
104 }104 }
105 dash.showLensOnLoaded = data.tag105 dash.showScopeOnLoaded = data.tag
106106
107 var dashContentList = findChild(dash, "dashContentList");107 var dashContentList = findChild(dash, "dashContentList");
108 verify(dashContentList != undefined);108 verify(dashContentList != undefined);
@@ -110,7 +110,7 @@
110 }110 }
111111
112 function test_dash_bar_set_index_connection_data() {112 function test_dash_bar_set_index_connection_data() {
113 return get_lens_data()113 return get_scope_data()
114 }114 }
115115
116 function test_dash_bar_set_index_connection(data) {116 function test_dash_bar_set_index_connection(data) {
@@ -118,8 +118,8 @@
118 console.log("Not testing " + data.tag + ": not visible");118 console.log("Not testing " + data.tag + ": not visible");
119 return;119 return;
120 }120 }
121 // wait for lenses to load121 // wait for scopes to load
122 tryCompare(lenses, "loaded", true);122 tryCompare(scopes, "loaded", true);
123123
124 var dashbar = findChild(dash, "dashbar");124 var dashbar = findChild(dash, "dashbar");
125 verify(dashbar != undefined)125 verify(dashbar != undefined)
126126
=== modified file 'tests/qmltests/Dash/tst_DashBar.qml'
--- tests/qmltests/Dash/tst_DashBar.qml 2013-06-05 22:03:08 +0000
+++ tests/qmltests/Dash/tst_DashBar.qml 2013-06-19 20:05:35 +0000
@@ -34,12 +34,12 @@
34 right: parent.right34 right: parent.right
35 bottom: parent.bottom35 bottom: parent.bottom
36 }36 }
37 model: lenses37 model: scopes
38 onItemSelected: currentIndex = index38 onItemSelected: currentIndex = index
39 }39 }
4040
41 Lenses {41 Scopes {
42 id: lenses42 id: scopes
43 }43 }
4444
45 SignalSpy {45 SignalSpy {
@@ -50,7 +50,7 @@
5050
51 UT.UnityTestCase {51 UT.UnityTestCase {
52 name: "DashBar"52 name: "DashBar"
53 when: lenses.loaded53 when: scopes.loaded
5454
55 property alias model: dashBar.model55 property alias model: dashBar.model
56 property alias currentIndex: dashBar.currentIndex56 property alias currentIndex: dashBar.currentIndex
5757
=== modified file 'tests/qmltests/Dash/tst_DashContent.qml'
--- tests/qmltests/Dash/tst_DashContent.qml 2013-06-11 10:36:55 +0000
+++ tests/qmltests/Dash/tst_DashContent.qml 2013-06-19 20:05:35 +0000
@@ -28,60 +28,60 @@
2828
29 property ListModel searchHistory: ListModel {}29 property ListModel searchHistory: ListModel {}
3030
31 property var lensStatus: {31 property var scopeStatus: {
32 'MockLens1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },32 'MockScope1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
33 'MockLens2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },33 'MockScope2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
34 'MockLens3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },34 'MockScope3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
35 'MockLens4': { 'movementStarted': 0, 'positionedAtBeginning': 0 },35 'MockScope4': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
36 'MockLens5': { 'movementStarted': 0, 'positionedAtBeginning': 0 }36 'MockScope5': { 'movementStarted': 0, 'positionedAtBeginning': 0 }
37 }37 }
3838
39 Lenses {39 Scopes {
40 id: lensesModel40 id: scopesModel
41 }41 }
4242
43 DashContent {43 DashContent {
44 id: dashContent44 id: dashContent
45 anchors.fill: parent45 anchors.fill: parent
4646
47 model: lensesModel47 model: scopesModel
48 lenses : lensesModel48 scopes : scopesModel
4949
50 lensMapper : lensDelegateMapper50 scopeMapper : scopeDelegateMapper
51 }51 }
5252
53 LensDelegateMapper {53 ScopeDelegateMapper {
54 id: lensDelegateMapper54 id: scopeDelegateMapper
55 lensDelegateMapping: {55 scopeDelegateMapping: {
56 "MockLens1": "../tests/qmltests/Dash/qml/fake_lensView1.qml",56 "MockScope1": "../tests/qmltests/Dash/qml/fake_scopeView1.qml",
57 "MockLens2": "../tests/qmltests/Dash/qml/fake_lensView2.qml",57 "MockScope2": "../tests/qmltests/Dash/qml/fake_scopeView2.qml",
58 "MockLens3": "../tests/qmltests/Dash/qml/fake_lensView3.qml",58 "MockScope3": "../tests/qmltests/Dash/qml/fake_scopeView3.qml",
59 "MockLens4": "../tests/qmltests/Dash/qml/fake_lensView4.qml"59 "MockScope4": "../tests/qmltests/Dash/qml/fake_scopeView4.qml"
60 }60 }
61 genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"61 genericScope: "../tests/qmltests/Dash/qml/fake_generic_scopeView.qml"
62 }62 }
6363
64 function clear_lens_status() {64 function clear_scope_status() {
65 lensStatus["MockLens1"].movementStarted = 0;65 scopeStatus["MockScope1"].movementStarted = 0;
66 lensStatus["MockLens1"].positionedAtBeginning = 0;66 scopeStatus["MockScope1"].positionedAtBeginning = 0;
6767
68 lensStatus["MockLens2"].movementStarted = 0;68 scopeStatus["MockScope2"].movementStarted = 0;
69 lensStatus["MockLens2"].positionedAtBeginning = 0;69 scopeStatus["MockScope2"].positionedAtBeginning = 0;
7070
71 lensStatus["MockLens3"].movementStarted = 0;71 scopeStatus["MockScope3"].movementStarted = 0;
72 lensStatus["MockLens3"].positionedAtBeginning = 0;72 scopeStatus["MockScope3"].positionedAtBeginning = 0;
7373
74 lensStatus["MockLens4"].movementStarted = 0;74 scopeStatus["MockScope4"].movementStarted = 0;
75 lensStatus["MockLens4"].positionedAtBeginning = 0;75 scopeStatus["MockScope4"].positionedAtBeginning = 0;
7676
77 lensStatus["MockLens5"].movementStarted = 0;77 scopeStatus["MockScope5"].movementStarted = 0;
78 lensStatus["MockLens5"].positionedAtBeginning = 0;78 scopeStatus["MockScope5"].positionedAtBeginning = 0;
79 }79 }
8080
81 SignalSpy {81 SignalSpy {
82 id: lensLoadedSpy82 id: scopeLoadedSpy
83 target: dashContent83 target: dashContent
84 signalName: "lensLoaded"84 signalName: "scopeLoaded"
85 }85 }
8686
87 SignalSpy {87 SignalSpy {
@@ -101,78 +101,81 @@
101 when: windowShown101 when: windowShown
102102
103 function init() {103 function init() {
104 lensLoadedSpy.clear();104 scopeLoadedSpy.clear();
105 movementStartedSpy.clear();105 movementStartedSpy.clear();
106 contentEndReachedSpy.clear()106 contentEndReachedSpy.clear()
107 clear_lens_status();107 clear_scope_status();
108108
109 // clear, wait for dahs to empty and load lenses.109 // clear, wait for dahs to empty and load scopes.
110 var dashContentList = findChild(dashContent, "dashContentList");110 var dashContentList = findChild(dashContent, "dashContentList");
111 verify(dashContentList != undefined)111 verify(dashContentList != undefined)
112 lensesModel.clear();112 scopesModel.clear();
113 tryCompare(dashContentList, "count", 0);113 tryCompare(dashContentList, "count", 0);
114 lensesModel.load();114 scopesModel.load();
115 }115 }
116116
117 function test_movement_started_signal() {117 function test_movement_started_signal() {
118 dashContent.setCurrentLensAtIndex(3, true, false);118 dashContent.setCurrentScopeAtIndex(3, true, false);
119119
120 var dashContentList = findChild(dashContent, "dashContentList");120 var dashContentList = findChild(dashContent, "dashContentList");
121 verify(dashContentList != undefined)121 verify(dashContentList != undefined)
122 tryCompare(lensLoadedSpy, "count", 5);122
123 tryCompare(scopeLoadedSpy, "count", 5);
123124
124 dashContentList.movementStarted();125 dashContentList.movementStarted();
126
125 compare(movementStartedSpy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");127 compare(movementStartedSpy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
126 compare(lensStatus["MockLens1"].movementStarted, 1, "MockLens1 should have emitted movementStarted signal when content list did.");128 compare(scopeStatus["MockScope1"].movementStarted, 1, "MockScope1 should have emitted movementStarted signal when content list did.");
127 compare(lensStatus["MockLens2"].movementStarted, 1, "MockLens2 should have emitted movementStarted signal when content list did.");129 compare(scopeStatus["MockScope2"].movementStarted, 1, "MockScope2 should have emitted movementStarted signal when content list did.");
128 compare(lensStatus["MockLens3"].movementStarted, 1, "MockLens3 should have emitted movementStarted signal when content list did.");130 compare(scopeStatus["MockScope3"].movementStarted, 1, "MockScope3 should have emitted movementStarted signal when content list did.");
129 compare(lensStatus["MockLens4"].movementStarted, 1, "MockLens4 should have emitted movementStarted signal when content list did.");131 compare(scopeStatus["MockScope4"].movementStarted, 1, "MockScope4 should have emitted movementStarted signal when content list did.");
130 compare(lensStatus["MockLens5"].movementStarted, 1, "MockLens5 should have emitted movementStarted signal when content list did.");132 compare(scopeStatus["MockScope5"].movementStarted, 1, "MockScope5 should have emitted movementStarted signal when content list did.");
131 }133 }
132134
133 function test_positioned_at_beginning_signal() {135 function test_positioned_at_beginning_signal() {
134 dashContent.setCurrentLensAtIndex(3, true, false);136 dashContent.setCurrentScopeAtIndex(3, true, false);
135137
136 tryCompare(lensLoadedSpy, "count", 5);138 tryCompare(scopeLoadedSpy, "count", 5);
137139
138 dashContent.positionedAtBeginning();140 dashContent.positionedAtBeginning();
139 compare(lensStatus["MockLens1"].positionedAtBeginning, 1, "MockLens1 should have emitted positionedAtBeginning signal when DashContent did.");141 compare(scopeStatus["MockScope1"].positionedAtBeginning, 1, "MockScope1 should have emitted positionedAtBeginning signal when DashContent did.");
140 compare(lensStatus["MockLens2"].positionedAtBeginning, 1, "MockLens2 should have emitted positionedAtBeginning signal when DashContent did.");142 compare(scopeStatus["MockScope2"].positionedAtBeginning, 1, "MockScope2 should have emitted positionedAtBeginning signal when DashContent did.");
141 compare(lensStatus["MockLens3"].positionedAtBeginning, 1, "MockLens3 should have emitted positionedAtBeginning signal when DashContent did.");143 compare(scopeStatus["MockScope3"].positionedAtBeginning, 1, "MockScope3 should have emitted positionedAtBeginning signal when DashContent did.");
142 compare(lensStatus["MockLens4"].positionedAtBeginning, 1, "MockLens4 should have emitted positionedAtBeginning signal when DashContent did.");144 compare(scopeStatus["MockScope4"].positionedAtBeginning, 1, "MockScope4 should have emitted positionedAtBeginning signal when DashContent did.");
143 compare(lensStatus["MockLens5"].positionedAtBeginning, 1, "MockLens5 should have emitted positionedAtBeginning signal when DashContent did.");145 compare(scopeStatus["MockScope5"].positionedAtBeginning, 1, "MockScope5 should have emitted positionedAtBeginning signal when DashContent did.");
144 }146 }
145147
146 function test_lens_loaded() {148 function test_scope_loaded() {
147 tryCompare(lensLoadedSpy, "count", 5);149 tryCompare(scopeLoadedSpy, "count", 5);
148 }150 }
149151
150 function test_content_end_reached() {152 function test_content_end_reached() {
151 var dashContentList = findChild(dashContent, "dashContentList");153 var dashContentList = findChild(dashContent, "dashContentList");
152 verify(dashContentList != undefined);154 verify(dashContentList != undefined);
153 tryCompare(lensLoadedSpy, "count", 5);
154155
155 dashContent.setCurrentLensAtIndex(0, true, false);156 tryCompare(scopeLoadedSpy, "count", 5);
157 dashContent.setCurrentScopeAtIndex(0, true, false);
156 dashContentList.currentItem.item.endReached();158 dashContentList.currentItem.item.endReached();
157159
158 compare(contentEndReachedSpy.count, 1);160 compare(contentEndReachedSpy.count, 1);
159 }161 }
160162
161 // This tests that setting the current lens index will end up at the correct index even if163 // This tests that setting the current scope index will end up at the correct index even if
162 // the lenses are loaded asynchrounsly.164 // the scopes are loaded asynchrounsly.
163 function test_set_current_lens_index_async() {165 function test_set_current_scope_index_async() {
164 verify(lensesModel.loaded == false);166 verify(scopesModel.loaded == false);
165167
166 // next index is 1 if current is -1, otherwise it's current + 1168 // next index is 1 if current is -1, otherwise it's current + 1
167 var next_index = ((dashContent.currentIndex == -1 ? 0 : dashContent.currentIndex) + 1) % 5169 var next_index = ((dashContent.currentIndex == -1 ? 0 : dashContent.currentIndex) + 1) % 5
168170
169 dashContent.setCurrentLensAtIndex(next_index, true, false);171 dashContent.setCurrentScopeAtIndex(next_index, true, false);
170 tryCompare(dashContent, "currentIndex", next_index);172 tryCompare(dashContent, "currentIndex", next_index);
171 verify(lensesModel.loaded == true);173 verify(scopesModel.loaded == true);
172174
173 // test greater than lens count.175 // test greater than scope count.
174 dashContent.setCurrentLensAtIndex(lensesModel.count, true, false);176 var currentScopeIndex = dashContent.currentIndex;
175 compare(dashContent.currentIndex, 4);177 dashContent.setCurrentScopeAtIndex(scopesModel.count, true, false);
178 compare(dashContent.currentIndex, currentScopeIndex, "Scope should not change if changing to greater index than count");
176 }179 }
177180
178 function get_current_item_object_name() {181 function get_current_item_object_name() {
@@ -187,18 +190,18 @@
187 return "";190 return "";
188 }191 }
189192
190 function test_lens_mapping_data() {193 function test_scope_mapping_data() {
191 return [194 return [
192 {tag: "index0", index: 0, objectName: "fake_lensView1"},195 {tag: "index0", index: 0, objectName: "fake_scopeView1"},
193 {tag: "index1", index: 1, objectName: "fake_lensView2"},196 {tag: "index1", index: 1, objectName: "fake_scopeView2"},
194 {tag: "index2", index: 2, objectName: "fake_lensView3"},197 {tag: "index2", index: 2, objectName: "fake_scopeView3"},
195 {tag: "index3", index: 3, objectName: "fake_lensView4"},198 {tag: "index3", index: 3, objectName: "fake_scopeView4"},
196 {tag: "index4", index: 4, objectName: "fake_generic_lensView"}199 {tag: "index4", index: 4, objectName: "fake_generic_scopeView"}
197 ]200 ]
198 }201 }
199202
200 function test_lens_mapping(data) {203 function test_scope_mapping(data) {
201 dashContent.setCurrentLensAtIndex(data.index, true, false);204 dashContent.setCurrentScopeAtIndex(data.index, true, false);
202 tryCompareFunction(get_current_item_object_name, data.objectName)205 tryCompareFunction(get_current_item_object_name, data.objectName)
203 }206 }
204207
205208
=== modified file 'tests/qmltests/Dash/tst_FilterGrids.qml'
--- tests/qmltests/Dash/tst_FilterGrids.qml 2013-06-05 22:03:08 +0000
+++ tests/qmltests/Dash/tst_FilterGrids.qml 2013-06-19 20:05:35 +0000
@@ -108,7 +108,6 @@
108 function test_clicked_signal_data() {108 function test_clicked_signal_data() {
109 return [109 return [
110 {tag: "VideosFilterGrid", component: "Video/VideosFilterGrid.qml"},110 {tag: "VideosFilterGrid", component: "Video/VideosFilterGrid.qml"},
111 {tag: "PeopleFilterGrid", component: "People/PeopleFilterGrid.qml"},
112 {tag: "MusicFilterGrid", component: "Music/MusicFilterGrid.qml"},111 {tag: "MusicFilterGrid", component: "Music/MusicFilterGrid.qml"},
113 {tag: "ApplicationsFilterGrid", component: "Apps/ApplicationsFilterGrid.qml"}112 {tag: "ApplicationsFilterGrid", component: "Apps/ApplicationsFilterGrid.qml"}
114 ]113 ]
115114
=== renamed file 'tests/qmltests/Dash/tst_GenericLensView.qml' => 'tests/qmltests/Dash/tst_GenericScopeView.qml'
--- tests/qmltests/Dash/tst_GenericLensView.qml 2013-06-05 22:03:08 +0000
+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2013-06-19 20:05:35 +0000
@@ -26,27 +26,27 @@
26 width: units.gu(120)26 width: units.gu(120)
27 height: units.gu(80)27 height: units.gu(80)
2828
29 Lenses {29 Scopes {
30 id: lenses30 id: scopes
31 }31 }
3232
33 GenericLensView {33 GenericScopeView {
34 id: genericLensView34 id: genericScopeView
35 anchors.fill: parent35 anchors.fill: parent
3636
37 UT.UnityTestCase {37 UT.UnityTestCase {
38 name: "GenericLensView"38 name: "GenericScopeView"
39 when: lenses.loaded39 when: scopes.loaded
4040
41 function init() {41 function init() {
42 genericLensView.lens = lenses.get(0)42 genericScopeView.scope = scopes.get(0)
43 }43 }
4444
45 function test_isCurrent() {45 function test_isCurrent() {
46 var pageHeader = findChild(genericLensView, "pageHeader");46 var pageHeader = findChild(genericScopeView, "pageHeader");
47 genericLensView.isCurrent = true47 genericScopeView.isCurrent = true
48 pageHeader.searchQuery = "test"48 pageHeader.searchQuery = "test"
49 genericLensView.isCurrent = false49 genericScopeView.isCurrent = false
50 tryCompare(pageHeader, "searchQuery", "")50 tryCompare(pageHeader, "searchQuery", "")
51 }51 }
52 }52 }
5353
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: