Merge lp:~unity-team/unity8/scope-settings into lp:unity8
- scope-settings
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Michał Sawicz |
Approved revision: | 1151 |
Merged at revision: | 1214 |
Proposed branch: | lp:~unity-team/unity8/scope-settings |
Merge into: | lp:unity8 |
Prerequisite: | lp:~unity-team/unity8/alt_nav_support |
Diff against target: |
1676 lines (+1093/-74) 28 files modified
qml/Dash/Dash.qml (+1/-1) qml/Dash/DashContent.qml (+4/-4) qml/Dash/GenericScopeView.qml (+67/-26) qml/Dash/PageHeader.qml (+9/-3) qml/Dash/PreviewListView.qml (+11/-1) qml/Dash/ScopeSettings/ScopeSetting.qml (+37/-0) qml/Dash/ScopeSettings/ScopeSettingBoolean.qml (+61/-0) qml/Dash/ScopeSettings/ScopeSettingList.qml (+50/-0) qml/Dash/ScopeSettings/ScopeSettingNumber.qml (+21/-0) qml/Dash/ScopeSettings/ScopeSettingString.qml (+83/-0) qml/Dash/ScopeSettings/ScopeSettingsWidgetFactory.qml (+57/-0) qml/Dash/ScopeSettingsPage.qml (+62/-0) qml/Dash/ScopesOverview.qml (+2/-0) tests/autopilot/unity8/shell/emulators/dash.py (+5/-5) tests/mocks/Unity/CMakeLists.txt (+2/-0) tests/mocks/Unity/fake_scope.cpp (+3/-1) tests/mocks/Unity/fake_scope.h (+1/-0) tests/mocks/Unity/fake_settingsmodel.cpp (+95/-0) tests/mocks/Unity/fake_settingsmodel.h (+54/-0) tests/mocks/Unity/fake_unity_plugin.cpp (+2/-0) tests/qmltests/CMakeLists.txt (+5/-0) tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml (+1/-1) tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingBoolean.qml (+62/-0) tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingList.qml (+84/-0) tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingNumber.qml (+98/-0) tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingString.qml (+88/-0) tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingsWidgetFactory.qml (+65/-0) tests/qmltests/Dash/tst_GenericScopeView.qml (+63/-32) |
To merge this branch: | bzr merge lp:~unity-team/unity8/scope-settings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Michał Sawicz | Approve | ||
Review via email: mp+232296@code.launchpad.net |
This proposal supersedes a proposal from 2014-08-08.
Commit message
Add scope settings UI
Accessible through the page header in scope pages on supported scopes.
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
No
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* Did you make sure that your branch does not contain spurious tags?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
n/a
* If you changed the UI, has there been a design review?
There are no final designs yet, but this is consistent with the rest of the UI
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1114
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1115
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1116
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
Please delete tag 7.85+14.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1117
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1120
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1121
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1122
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
You need to disable dash overview when in settings.
Fields don't get focus when tapped on list item.
I assume there's no way to override the color of:
- labels in ItemSelector
- checkbox? should it?
Previews are always opened starting at the first one, not the one clicked. Rebase on lp:~saviq/unity8/fix-horizontal-list-activation and add tests to ensure which item is opened. Doesn't even conflict (but you do need to replace previewListView with subPageLoader).
More to come.
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
See inline.
Didn't review tests yet, will review after other review comments are addressed.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1123
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1126
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1127
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1129
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1129
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1129
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Andrea Cimitan (cimi) : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1132
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1133
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1134
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
See inline. There's a bunch of unanswered comments in the previous review, please answer them too.
Re: shown split or separate, I'd rather merge them unless there's a real reason why not to.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1136
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1140
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Andrea Cimitan (cimi) : Posted in a previous version of this proposal | # |
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
Do we really only want to show this once the loader is ready? There will be a delay between user tapping and the page going in on screen? OTOH that gives us protection from a broken subpage, so maybe that's fine...
Otherwise see inline.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1141
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1144
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1147
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1149
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) : | # |
- 1150. By Andrea Cimitan
-
Add link to bug
- 1151. By Andrea Cimitan
-
Fixed indent
Michał Sawicz (saviq) wrote : | # |
* Did you perform an exploratory manual test run of the code change and any related functionality?
Y, works!
* Did CI run pass? If not, please explain why.
Y
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1150
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'qml/Dash/Dash.qml' | |||
2 | --- qml/Dash/Dash.qml 2014-08-08 09:41:13 +0000 | |||
3 | +++ qml/Dash/Dash.qml 2014-08-27 08:28:24 +0000 | |||
4 | @@ -341,7 +341,7 @@ | |||
5 | 341 | objectName: "overviewDragHandle" | 341 | objectName: "overviewDragHandle" |
6 | 342 | z: 1 | 342 | z: 1 |
7 | 343 | direction: Direction.Upwards | 343 | direction: Direction.Upwards |
9 | 344 | enabled: !dashContent.previewShown && | 344 | enabled: !dashContent.subPageShown && |
10 | 345 | dashContent.currentScope && | 345 | dashContent.currentScope && |
11 | 346 | dashContent.currentScope.searchQuery == "" && | 346 | dashContent.currentScope.searchQuery == "" && |
12 | 347 | (overviewController.progress == 0 || dragging) | 347 | (overviewController.progress == 0 || dragging) |
13 | 348 | 348 | ||
14 | === modified file 'qml/Dash/DashContent.qml' | |||
15 | --- qml/Dash/DashContent.qml 2014-08-08 08:47:36 +0000 | |||
16 | +++ qml/Dash/DashContent.qml 2014-08-27 08:28:24 +0000 | |||
17 | @@ -27,8 +27,8 @@ | |||
18 | 27 | readonly property alias currentIndex: dashContentList.currentIndex | 27 | readonly property alias currentIndex: dashContentList.currentIndex |
19 | 28 | readonly property string currentScopeId: dashContentList.currentItem ? dashContentList.currentItem.scopeId : "" | 28 | readonly property string currentScopeId: dashContentList.currentItem ? dashContentList.currentItem.scopeId : "" |
20 | 29 | readonly property var currentScope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null | 29 | readonly property var currentScope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null |
23 | 30 | readonly property bool previewShown: dashContentList.currentItem && dashContentList.currentItem.item ? | 30 | readonly property bool subPageShown: dashContentList.currentItem && dashContentList.currentItem.item ? |
24 | 31 | dashContentList.currentItem.item.previewShown : false | 31 | dashContentList.currentItem.item.subPageShown : false |
25 | 32 | readonly property bool processing: dashContentList.currentItem && dashContentList.currentItem.item | 32 | readonly property bool processing: dashContentList.currentItem && dashContentList.currentItem.item |
26 | 33 | && dashContentList.currentItem.item.processing || false | 33 | && dashContentList.currentItem.item.processing || false |
27 | 34 | readonly property bool pageHeaderTotallyVisible: dashContentList.currentItem && dashContentList.currentItem.item | 34 | readonly property bool pageHeaderTotallyVisible: dashContentList.currentItem && dashContentList.currentItem.item |
28 | @@ -96,8 +96,7 @@ | |||
29 | 96 | id: dashContentList | 96 | id: dashContentList |
30 | 97 | objectName: "dashContentList" | 97 | objectName: "dashContentList" |
31 | 98 | 98 | ||
34 | 99 | interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving && !currentItem.navigationShown | 99 | interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving && !currentItem.navigationShown && !currentItem.subPageShown |
33 | 100 | |||
35 | 101 | anchors.fill: parent | 100 | anchors.fill: parent |
36 | 102 | orientation: ListView.Horizontal | 101 | orientation: ListView.Horizontal |
37 | 103 | boundsBehavior: Flickable.DragAndOvershootBounds | 102 | boundsBehavior: Flickable.DragAndOvershootBounds |
38 | @@ -137,6 +136,7 @@ | |||
39 | 137 | 136 | ||
40 | 138 | readonly property bool moving: item ? item.moving : false | 137 | readonly property bool moving: item ? item.moving : false |
41 | 139 | readonly property bool navigationShown: item ? item.navigationShown : false | 138 | readonly property bool navigationShown: item ? item.navigationShown : false |
42 | 139 | readonly property bool subPageShown: item ? item.subPageShown : false | ||
43 | 140 | readonly property var categoryView: item ? item.categoryView : null | 140 | readonly property var categoryView: item ? item.categoryView : null |
44 | 141 | readonly property var theScope: scope | 141 | readonly property var theScope: scope |
45 | 142 | 142 | ||
46 | 143 | 143 | ||
47 | === modified file 'qml/Dash/GenericScopeView.qml' | |||
48 | --- qml/Dash/GenericScopeView.qml 2014-08-27 08:28:24 +0000 | |||
49 | +++ qml/Dash/GenericScopeView.qml 2014-08-27 08:28:24 +0000 | |||
50 | @@ -34,7 +34,7 @@ | |||
51 | 34 | property bool enableHeightBehaviorOnNextCreation: false | 34 | property bool enableHeightBehaviorOnNextCreation: false |
52 | 35 | property var categoryView: categoryView | 35 | property var categoryView: categoryView |
53 | 36 | property bool showPageHeader: true | 36 | property bool showPageHeader: true |
55 | 37 | readonly property alias previewShown: previewListView.open | 37 | readonly property alias subPageShown: subPageLoader.subPageShown |
56 | 38 | property int paginationCount: 0 | 38 | property int paginationCount: 0 |
57 | 39 | property int paginationIndex: 0 | 39 | property int paginationIndex: 0 |
58 | 40 | property alias pageHeaderTotallyVisible: categoryView.pageHeaderTotallyVisible | 40 | property alias pageHeaderTotallyVisible: categoryView.pageHeaderTotallyVisible |
59 | @@ -43,7 +43,7 @@ | |||
60 | 43 | style: scope ? scope.customizations : {} | 43 | style: scope ? scope.customizations : {} |
61 | 44 | } | 44 | } |
62 | 45 | 45 | ||
64 | 46 | readonly property bool processing: scope ? scope.searchInProgress || previewListView.processing : false | 46 | readonly property bool processing: scope ? scope.searchInProgress || subPageLoader.processing : false |
65 | 47 | 47 | ||
66 | 48 | signal backClicked() | 48 | signal backClicked() |
67 | 49 | 49 | ||
68 | @@ -56,7 +56,7 @@ | |||
69 | 56 | } | 56 | } |
70 | 57 | 57 | ||
71 | 58 | function closePreview() { | 58 | function closePreview() { |
73 | 59 | previewListView.open = false; | 59 | subPageLoader.closeSubPage() |
74 | 60 | } | 60 | } |
75 | 61 | 61 | ||
76 | 62 | function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) { | 62 | function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) { |
77 | @@ -80,19 +80,19 @@ | |||
78 | 80 | if (limitedCategoryItemCount > 0) { | 80 | if (limitedCategoryItemCount > 0) { |
79 | 81 | previewLimitModel.model = resultsModel; | 81 | previewLimitModel.model = resultsModel; |
80 | 82 | previewLimitModel.limit = limitedCategoryItemCount; | 82 | previewLimitModel.limit = limitedCategoryItemCount; |
82 | 83 | previewListView.model = previewLimitModel; | 83 | subPageLoader.model = previewLimitModel; |
83 | 84 | } else { | 84 | } else { |
85 | 85 | previewListView.model = resultsModel; | 85 | subPageLoader.model = resultsModel; |
86 | 86 | } | 86 | } |
90 | 87 | previewListView.currentIndex = -1; | 87 | subPageLoader.initialIndex = -1; |
91 | 88 | previewListView.currentIndex = index; | 88 | subPageLoader.initialIndex = index; |
92 | 89 | previewListView.open = true; | 89 | subPageLoader.openSubPage("preview"); |
93 | 90 | } | 90 | } |
94 | 91 | 91 | ||
95 | 92 | Binding { | 92 | Binding { |
96 | 93 | target: scope | 93 | target: scope |
97 | 94 | property: "isActive" | 94 | property: "isActive" |
99 | 95 | value: isCurrent && !previewListView.open | 95 | value: isCurrent && !subPageLoader.open |
100 | 96 | } | 96 | } |
101 | 97 | 97 | ||
102 | 98 | SortFilterProxyModel { | 98 | SortFilterProxyModel { |
103 | @@ -105,10 +105,10 @@ | |||
104 | 105 | } | 105 | } |
105 | 106 | 106 | ||
106 | 107 | onIsCurrentChanged: { | 107 | onIsCurrentChanged: { |
108 | 108 | if (showPageHeader) { | 108 | if (pageHeaderLoader.item && showPageHeader) { |
109 | 109 | pageHeaderLoader.item.resetSearch(); | 109 | pageHeaderLoader.item.resetSearch(); |
110 | 110 | } | 110 | } |
112 | 111 | previewListView.open = false; | 111 | subPageLoader.closeSubPage(); |
113 | 112 | } | 112 | } |
114 | 113 | 113 | ||
115 | 114 | Binding { | 114 | Binding { |
116 | @@ -127,8 +127,8 @@ | |||
117 | 127 | 127 | ||
118 | 128 | Connections { | 128 | Connections { |
119 | 129 | target: scopeView.scope | 129 | target: scopeView.scope |
122 | 130 | onShowDash: previewListView.open = false; | 130 | onShowDash: subPageLoader.closeSubPage() |
123 | 131 | onHideDash: previewListView.open = false; | 131 | onHideDash: subPageLoader.closeSubPage() |
124 | 132 | } | 132 | } |
125 | 133 | 133 | ||
126 | 134 | Rectangle { | 134 | Rectangle { |
127 | @@ -141,7 +141,7 @@ | |||
128 | 141 | id: categoryView | 141 | id: categoryView |
129 | 142 | objectName: "categoryListView" | 142 | objectName: "categoryListView" |
130 | 143 | 143 | ||
132 | 144 | x: previewListView.open ? -width : 0 | 144 | x: subPageLoader.open ? -width : 0 |
133 | 145 | Behavior on x { UbuntuNumberAnimation { } } | 145 | Behavior on x { UbuntuNumberAnimation { } } |
134 | 146 | width: parent.width | 146 | width: parent.width |
135 | 147 | height: floatingSeeLess.visible ? parent.height - floatingSeeLess.height + floatingSeeLess.yOffset | 147 | height: floatingSeeLess.visible ? parent.height - floatingSeeLess.height + floatingSeeLess.yOffset |
136 | @@ -149,7 +149,7 @@ | |||
137 | 149 | clip: height != parent.height | 149 | clip: height != parent.height |
138 | 150 | 150 | ||
139 | 151 | model: scopeView.categories | 151 | model: scopeView.categories |
141 | 152 | forceNoClip: previewListView.open | 152 | forceNoClip: subPageLoader.open |
142 | 153 | pixelAligned: true | 153 | pixelAligned: true |
143 | 154 | interactive: !navigationShown | 154 | interactive: !navigationShown |
144 | 155 | 155 | ||
145 | @@ -294,10 +294,10 @@ | |||
146 | 294 | // If the filter animation will be seen start it, otherwise, just flip the switch | 294 | // If the filter animation will be seen start it, otherwise, just flip the switch |
147 | 295 | var shrinkingVisible = !shouldExpand && y + item.collapsedHeight + seeAll.height < categoryView.height; | 295 | var shrinkingVisible = !shouldExpand && y + item.collapsedHeight + seeAll.height < categoryView.height; |
148 | 296 | var growingVisible = shouldExpand && y + height < categoryView.height; | 296 | var growingVisible = shouldExpand && y + height < categoryView.height; |
150 | 297 | if (!previewListView.open || shouldExpand) { | 297 | if (!subPageLoader.open || shouldExpand) { |
151 | 298 | var animate = shrinkingVisible || growingVisible; | 298 | var animate = shrinkingVisible || growingVisible; |
152 | 299 | baseItem.expand(shouldExpand, animate) | 299 | baseItem.expand(shouldExpand, animate) |
154 | 300 | if (shouldExpand && !previewListView.open) { | 300 | if (shouldExpand && !subPageLoader.open) { |
155 | 301 | categoryView.maximizeVisibleArea(index, item.expandedHeight + seeAll.height); | 301 | categoryView.maximizeVisibleArea(index, item.expandedHeight + seeAll.height); |
156 | 302 | } | 302 | } |
157 | 303 | } | 303 | } |
158 | @@ -428,6 +428,7 @@ | |||
159 | 428 | searchHint: scopeView.scope && scopeView.scope.searchHint || i18n.tr("Search") | 428 | searchHint: scopeView.scope && scopeView.scope.searchHint || i18n.tr("Search") |
160 | 429 | showBackButton: scopeView.hasBackAction | 429 | showBackButton: scopeView.hasBackAction |
161 | 430 | searchEntryEnabled: true | 430 | searchEntryEnabled: true |
162 | 431 | settingsEnabled: scopeView.scope && scopeView.scope.settings && scopeView.scope.settings.count > 0 || false | ||
163 | 431 | scopeStyle: scopeView.scopeStyle | 432 | scopeStyle: scopeView.scopeStyle |
164 | 432 | paginationCount: scopeView.paginationCount | 433 | paginationCount: scopeView.paginationCount |
165 | 433 | paginationIndex: scopeView.paginationIndex | 434 | paginationIndex: scopeView.paginationIndex |
166 | @@ -441,6 +442,7 @@ | |||
167 | 441 | } | 442 | } |
168 | 442 | 443 | ||
169 | 443 | onBackClicked: scopeView.backClicked() | 444 | onBackClicked: scopeView.backClicked() |
170 | 445 | onSettingsClicked: subPageLoader.openSubPage("settings") | ||
171 | 444 | } | 446 | } |
172 | 445 | } | 447 | } |
173 | 446 | } | 448 | } |
174 | @@ -501,21 +503,60 @@ | |||
175 | 501 | id: previewLimitModel | 503 | id: previewLimitModel |
176 | 502 | } | 504 | } |
177 | 503 | 505 | ||
181 | 504 | PreviewListView { | 506 | Loader { |
182 | 505 | id: previewListView | 507 | id: subPageLoader |
183 | 506 | objectName: "previewListView" | 508 | objectName: "subPageLoader" |
184 | 507 | visible: x != width | 509 | visible: x != width |
185 | 508 | scope: scopeView.scope | ||
186 | 509 | scopeStyle: scopeView.scopeStyle | ||
187 | 510 | width: parent.width | 510 | width: parent.width |
188 | 511 | height: parent.height | 511 | height: parent.height |
189 | 512 | anchors.left: categoryView.right | 512 | anchors.left: categoryView.right |
190 | 513 | 513 | ||
194 | 514 | onOpenChanged: { | 514 | property bool open: false |
195 | 515 | if (showPageHeader) { | 515 | property var scope: scopeView.scope |
196 | 516 | pageHeaderLoader.item.unfocus(); | 516 | property var scopeStyle: scopeView.scopeStyle |
197 | 517 | property int initialIndex: -1 | ||
198 | 518 | property var model: null | ||
199 | 519 | |||
200 | 520 | readonly property bool processing: item && item.processing || false | ||
201 | 521 | readonly property int count: item && item.count || 0 | ||
202 | 522 | readonly property int currentIndex: item && item.currentIndex || 0 | ||
203 | 523 | readonly property var currentItem: item && item.currentItem || null | ||
204 | 524 | |||
205 | 525 | property string subPage: "" | ||
206 | 526 | readonly property bool subPageShown: visible && status === Loader.Ready | ||
207 | 527 | |||
208 | 528 | function openSubPage(page) { | ||
209 | 529 | subPage = page; | ||
210 | 530 | } | ||
211 | 531 | |||
212 | 532 | function closeSubPage() { | ||
213 | 533 | open = false; | ||
214 | 534 | } | ||
215 | 535 | |||
216 | 536 | source: switch(subPage) { | ||
217 | 537 | case "preview": return "PreviewListView.qml"; | ||
218 | 538 | case "settings": return "ScopeSettingsPage.qml"; | ||
219 | 539 | default: return ""; | ||
220 | 540 | } | ||
221 | 541 | |||
222 | 542 | onLoaded: { | ||
223 | 543 | item.scope = Qt.binding(function() { return subPageLoader.scope; } ) | ||
224 | 544 | item.scopeStyle = Qt.binding(function() { return subPageLoader.scopeStyle; } ) | ||
225 | 545 | if (subPage == "preview") { | ||
226 | 546 | item.open = Qt.binding(function() { return subPageLoader.open; } ) | ||
227 | 547 | item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex; } ) | ||
228 | 548 | item.model = Qt.binding(function() { return subPageLoader.model; } ) | ||
229 | 517 | } | 549 | } |
230 | 550 | open = true; | ||
231 | 551 | } | ||
232 | 552 | |||
233 | 553 | onOpenChanged: pageHeaderLoader.item.unfocus() | ||
234 | 554 | |||
235 | 555 | onVisibleChanged: if (!visible) subPage = "" | ||
236 | 556 | |||
237 | 557 | Connections { | ||
238 | 558 | target: subPageLoader.item | ||
239 | 559 | onBackClicked: subPageLoader.closeSubPage() | ||
240 | 518 | } | 560 | } |
241 | 519 | } | 561 | } |
242 | 520 | |||
243 | 521 | } | 562 | } |
244 | 522 | 563 | ||
245 | === modified file 'qml/Dash/PageHeader.qml' | |||
246 | --- qml/Dash/PageHeader.qml 2014-08-27 08:28:24 +0000 | |||
247 | +++ qml/Dash/PageHeader.qml 2014-08-27 08:28:24 +0000 | |||
248 | @@ -31,6 +31,7 @@ | |||
249 | 31 | property string title | 31 | property string title |
250 | 32 | 32 | ||
251 | 33 | property bool searchEntryEnabled: false | 33 | property bool searchEntryEnabled: false |
252 | 34 | property bool settingsEnabled: false | ||
253 | 34 | property ListModel searchHistory: SearchHistoryModel | 35 | property ListModel searchHistory: SearchHistoryModel |
254 | 35 | property alias searchQuery: searchTextField.text | 36 | property alias searchQuery: searchTextField.text |
255 | 36 | property alias searchHint: searchTextField.placeholderText | 37 | property alias searchHint: searchTextField.placeholderText |
256 | @@ -44,6 +45,7 @@ | |||
257 | 44 | property var scopeStyle: null | 45 | property var scopeStyle: null |
258 | 45 | 46 | ||
259 | 46 | signal backClicked() | 47 | signal backClicked() |
260 | 48 | signal settingsClicked() | ||
261 | 47 | 49 | ||
262 | 48 | onScopeStyleChanged: refreshLogo() | 50 | onScopeStyleChanged: refreshLogo() |
263 | 49 | onSearchQueryChanged: { | 51 | onSearchQueryChanged: { |
264 | @@ -246,9 +248,7 @@ | |||
265 | 246 | backAction: Action { | 248 | backAction: Action { |
266 | 247 | iconName: "back" | 249 | iconName: "back" |
267 | 248 | visible: root.showBackButton | 250 | visible: root.showBackButton |
271 | 249 | onTriggered: { | 251 | onTriggered: root.backClicked() |
269 | 250 | root.backClicked(); | ||
270 | 251 | } | ||
272 | 252 | } | 252 | } |
273 | 253 | 253 | ||
274 | 254 | actions: [ | 254 | actions: [ |
275 | @@ -260,6 +260,12 @@ | |||
276 | 260 | headerContainer.showSearch = true; | 260 | headerContainer.showSearch = true; |
277 | 261 | searchTextField.forceActiveFocus(); | 261 | searchTextField.forceActiveFocus(); |
278 | 262 | } | 262 | } |
279 | 263 | }, | ||
280 | 264 | Action { | ||
281 | 265 | objectName: "settings" | ||
282 | 266 | iconName: "settings" | ||
283 | 267 | visible: root.settingsEnabled | ||
284 | 268 | onTriggered: root.settingsClicked() | ||
285 | 263 | } | 269 | } |
286 | 264 | ] | 270 | ] |
287 | 265 | } | 271 | } |
288 | 266 | 272 | ||
289 | === modified file 'qml/Dash/PreviewListView.qml' | |||
290 | --- qml/Dash/PreviewListView.qml 2014-08-27 08:28:24 +0000 | |||
291 | +++ qml/Dash/PreviewListView.qml 2014-08-27 08:28:24 +0000 | |||
292 | @@ -23,6 +23,7 @@ | |||
293 | 23 | Item { | 23 | Item { |
294 | 24 | id: root | 24 | id: root |
295 | 25 | 25 | ||
296 | 26 | property int initialIndex: -1 | ||
297 | 26 | property var scope: null | 27 | property var scope: null |
298 | 27 | property var scopeStyle: null | 28 | property var scopeStyle: null |
299 | 28 | 29 | ||
300 | @@ -37,6 +38,8 @@ | |||
301 | 37 | readonly property bool processing: currentItem && (!currentItem.previewModel.loaded | 38 | readonly property bool processing: currentItem && (!currentItem.previewModel.loaded |
302 | 38 | || currentItem.previewModel.processingAction) | 39 | || currentItem.previewModel.processingAction) |
303 | 39 | 40 | ||
304 | 41 | signal backClicked() | ||
305 | 42 | |||
306 | 40 | PageHeader { | 43 | PageHeader { |
307 | 41 | id: header | 44 | id: header |
308 | 42 | objectName: "pageHeader" | 45 | objectName: "pageHeader" |
309 | @@ -46,7 +49,7 @@ | |||
310 | 46 | searchEntryEnabled: false | 49 | searchEntryEnabled: false |
311 | 47 | scopeStyle: root.scopeStyle | 50 | scopeStyle: root.scopeStyle |
312 | 48 | 51 | ||
314 | 49 | onBackClicked: root.open = false | 52 | onBackClicked: root.backClicked() |
315 | 50 | } | 53 | } |
316 | 51 | 54 | ||
317 | 52 | ListView { | 55 | ListView { |
318 | @@ -80,6 +83,13 @@ | |||
319 | 80 | } | 83 | } |
320 | 81 | } | 84 | } |
321 | 82 | 85 | ||
322 | 86 | onCountChanged: { | ||
323 | 87 | if (count > 0 && initialIndex >= 0) { | ||
324 | 88 | currentIndex = initialIndex; | ||
325 | 89 | initialIndex = -1; | ||
326 | 90 | } | ||
327 | 91 | } | ||
328 | 92 | |||
329 | 83 | delegate: Previews.Preview { | 93 | delegate: Previews.Preview { |
330 | 84 | id: preview | 94 | id: preview |
331 | 85 | objectName: "preview" + index | 95 | objectName: "preview" + index |
332 | 86 | 96 | ||
333 | === added directory 'qml/Dash/ScopeSettings' | |||
334 | === added file 'qml/Dash/ScopeSettings/ScopeSetting.qml' | |||
335 | --- qml/Dash/ScopeSettings/ScopeSetting.qml 1970-01-01 00:00:00 +0000 | |||
336 | +++ qml/Dash/ScopeSettings/ScopeSetting.qml 2014-08-27 08:28:24 +0000 | |||
337 | @@ -0,0 +1,37 @@ | |||
338 | 1 | /* | ||
339 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
340 | 3 | * | ||
341 | 4 | * This program is free software; you can redistribute it and/or modify | ||
342 | 5 | * it under the terms of the GNU General Public License as published by | ||
343 | 6 | * the Free Software Foundation; version 3. | ||
344 | 7 | * | ||
345 | 8 | * This program is distributed in the hope that it will be useful, | ||
346 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
347 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
348 | 11 | * GNU General Public License for more details. | ||
349 | 12 | * | ||
350 | 13 | * You should have received a copy of the GNU General Public License | ||
351 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
352 | 15 | */ | ||
353 | 16 | |||
354 | 17 | import QtQuick 2.2 | ||
355 | 18 | import Ubuntu.Components 1.1 | ||
356 | 19 | |||
357 | 20 | /*! Interface for settings widgets. */ | ||
358 | 21 | |||
359 | 22 | Item { | ||
360 | 23 | //! The ScopeStyle component. | ||
361 | 24 | property var scopeStyle: null | ||
362 | 25 | |||
363 | 26 | //! Variable used to contain widget's data | ||
364 | 27 | property var widgetData: null | ||
365 | 28 | |||
366 | 29 | /*! \brief This signal should be emitted when a setting action was updated. | ||
367 | 30 | * | ||
368 | 31 | * \param value the new setting value. | ||
369 | 32 | */ | ||
370 | 33 | signal updated(var value) | ||
371 | 34 | |||
372 | 35 | //! \internal | ||
373 | 36 | readonly property real settingMargins: units.gu(2) | ||
374 | 37 | } | ||
375 | 0 | 38 | ||
376 | === added file 'qml/Dash/ScopeSettings/ScopeSettingBoolean.qml' | |||
377 | --- qml/Dash/ScopeSettings/ScopeSettingBoolean.qml 1970-01-01 00:00:00 +0000 | |||
378 | +++ qml/Dash/ScopeSettings/ScopeSettingBoolean.qml 2014-08-27 08:28:24 +0000 | |||
379 | @@ -0,0 +1,61 @@ | |||
380 | 1 | /* | ||
381 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
382 | 3 | * | ||
383 | 4 | * This program is free software; you can redistribute it and/or modify | ||
384 | 5 | * it under the terms of the GNU General Public License as published by | ||
385 | 6 | * the Free Software Foundation; version 3. | ||
386 | 7 | * | ||
387 | 8 | * This program is distributed in the hope that it will be useful, | ||
388 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
389 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
390 | 11 | * GNU General Public License for more details. | ||
391 | 12 | * | ||
392 | 13 | * You should have received a copy of the GNU General Public License | ||
393 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
394 | 15 | */ | ||
395 | 16 | |||
396 | 17 | import QtQuick 2.2 | ||
397 | 18 | import Ubuntu.Components 1.1 | ||
398 | 19 | import Ubuntu.Components.ListItems 1.0 as ListItem | ||
399 | 20 | |||
400 | 21 | ScopeSetting { | ||
401 | 22 | id: root | ||
402 | 23 | height: listItem.height | ||
403 | 24 | |||
404 | 25 | ListItem.Empty { | ||
405 | 26 | id: listItem | ||
406 | 27 | |||
407 | 28 | onClicked: { | ||
408 | 29 | control.checked = !control.checked; | ||
409 | 30 | updated(control.checked); | ||
410 | 31 | } | ||
411 | 32 | |||
412 | 33 | Label { | ||
413 | 34 | anchors { | ||
414 | 35 | left: parent.left | ||
415 | 36 | leftMargin: settingMargins | ||
416 | 37 | right: control.left | ||
417 | 38 | rightMargin: units.gu(1) | ||
418 | 39 | verticalCenter: parent.verticalCenter | ||
419 | 40 | } | ||
420 | 41 | text: widgetData.displayName | ||
421 | 42 | elide: Text.ElideMiddle | ||
422 | 43 | maximumLineCount: 2 | ||
423 | 44 | wrapMode: Text.Wrap | ||
424 | 45 | color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText | ||
425 | 46 | } | ||
426 | 47 | |||
427 | 48 | CheckBox { | ||
428 | 49 | id: control | ||
429 | 50 | objectName: "control" | ||
430 | 51 | anchors { | ||
431 | 52 | right: parent.right | ||
432 | 53 | rightMargin: settingMargins | ||
433 | 54 | verticalCenter: parent.verticalCenter | ||
434 | 55 | } | ||
435 | 56 | checked: widgetData.value | ||
436 | 57 | |||
437 | 58 | onTriggered: root.updated(checked) | ||
438 | 59 | } | ||
439 | 60 | } | ||
440 | 61 | } | ||
441 | 0 | 62 | ||
442 | === added file 'qml/Dash/ScopeSettings/ScopeSettingList.qml' | |||
443 | --- qml/Dash/ScopeSettings/ScopeSettingList.qml 1970-01-01 00:00:00 +0000 | |||
444 | +++ qml/Dash/ScopeSettings/ScopeSettingList.qml 2014-08-27 08:28:24 +0000 | |||
445 | @@ -0,0 +1,50 @@ | |||
446 | 1 | /* | ||
447 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
448 | 3 | * | ||
449 | 4 | * This program is free software; you can redistribute it and/or modify | ||
450 | 5 | * it under the terms of the GNU General Public License as published by | ||
451 | 6 | * the Free Software Foundation; version 3. | ||
452 | 7 | * | ||
453 | 8 | * This program is distributed in the hope that it will be useful, | ||
454 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
455 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
456 | 11 | * GNU General Public License for more details. | ||
457 | 12 | * | ||
458 | 13 | * You should have received a copy of the GNU General Public License | ||
459 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
460 | 15 | */ | ||
461 | 16 | |||
462 | 17 | import QtQuick 2.2 | ||
463 | 18 | import Ubuntu.Components 1.1 | ||
464 | 19 | import Ubuntu.Components.ListItems 1.0 as ListItem | ||
465 | 20 | |||
466 | 21 | ScopeSetting { | ||
467 | 22 | id: root | ||
468 | 23 | |||
469 | 24 | // FIXME workaround for: https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1355830 | ||
470 | 25 | height: listItem.currentlyExpanded ? listItem.itemHeight * widgetData.properties["values"].length + units.gu(6) : listItem.height | ||
471 | 26 | |||
472 | 27 | property int initialValue: -1 | ||
473 | 28 | |||
474 | 29 | ListItem.ItemSelector { | ||
475 | 30 | id: listItem | ||
476 | 31 | objectName: "control" | ||
477 | 32 | anchors { | ||
478 | 33 | left: parent.left | ||
479 | 34 | right: parent.right | ||
480 | 35 | } | ||
481 | 36 | text: widgetData.displayName | ||
482 | 37 | model: widgetData.properties["values"] | ||
483 | 38 | |||
484 | 39 | onSelectedIndexChanged: { | ||
485 | 40 | if (root.initialValue >= 0) { | ||
486 | 41 | var tmpValue = root.initialValue; | ||
487 | 42 | root.initialValue = -1; | ||
488 | 43 | selectedIndex = tmpValue; | ||
489 | 44 | return; | ||
490 | 45 | } | ||
491 | 46 | |||
492 | 47 | root.updated(selectedIndex); | ||
493 | 48 | } | ||
494 | 49 | } | ||
495 | 50 | } | ||
496 | 0 | 51 | ||
497 | === added file 'qml/Dash/ScopeSettings/ScopeSettingNumber.qml' | |||
498 | --- qml/Dash/ScopeSettings/ScopeSettingNumber.qml 1970-01-01 00:00:00 +0000 | |||
499 | +++ qml/Dash/ScopeSettings/ScopeSettingNumber.qml 2014-08-27 08:28:24 +0000 | |||
500 | @@ -0,0 +1,21 @@ | |||
501 | 1 | /* | ||
502 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
503 | 3 | * | ||
504 | 4 | * This program is free software; you can redistribute it and/or modify | ||
505 | 5 | * it under the terms of the GNU General Public License as published by | ||
506 | 6 | * the Free Software Foundation; version 3. | ||
507 | 7 | * | ||
508 | 8 | * This program is distributed in the hope that it will be useful, | ||
509 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
510 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
511 | 11 | * GNU General Public License for more details. | ||
512 | 12 | * | ||
513 | 13 | * You should have received a copy of the GNU General Public License | ||
514 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
515 | 15 | */ | ||
516 | 16 | |||
517 | 17 | import QtQuick 2.2 | ||
518 | 18 | |||
519 | 19 | ScopeSettingString { | ||
520 | 20 | mode: "number" | ||
521 | 21 | } | ||
522 | 0 | 22 | ||
523 | === added file 'qml/Dash/ScopeSettings/ScopeSettingString.qml' | |||
524 | --- qml/Dash/ScopeSettings/ScopeSettingString.qml 1970-01-01 00:00:00 +0000 | |||
525 | +++ qml/Dash/ScopeSettings/ScopeSettingString.qml 2014-08-27 08:28:24 +0000 | |||
526 | @@ -0,0 +1,83 @@ | |||
527 | 1 | /* | ||
528 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
529 | 3 | * | ||
530 | 4 | * This program is free software; you can redistribute it and/or modify | ||
531 | 5 | * it under the terms of the GNU General Public License as published by | ||
532 | 6 | * the Free Software Foundation; version 3. | ||
533 | 7 | * | ||
534 | 8 | * This program is distributed in the hope that it will be useful, | ||
535 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
536 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
537 | 11 | * GNU General Public License for more details. | ||
538 | 12 | * | ||
539 | 13 | * You should have received a copy of the GNU General Public License | ||
540 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
541 | 15 | */ | ||
542 | 16 | |||
543 | 17 | import QtQuick 2.2 | ||
544 | 18 | import Ubuntu.Components 1.1 | ||
545 | 19 | import Ubuntu.Components.ListItems 1.0 as ListItem | ||
546 | 20 | |||
547 | 21 | ScopeSetting { | ||
548 | 22 | id: root | ||
549 | 23 | height: listItem.height | ||
550 | 24 | |||
551 | 25 | property string mode: "string" | ||
552 | 26 | |||
553 | 27 | ListItem.Empty { | ||
554 | 28 | id: listItem | ||
555 | 29 | onClicked: { | ||
556 | 30 | control.forceActiveFocus(); | ||
557 | 31 | control.selectAll(); | ||
558 | 32 | } | ||
559 | 33 | |||
560 | 34 | Label { | ||
561 | 35 | id: label | ||
562 | 36 | anchors { | ||
563 | 37 | left: parent.left | ||
564 | 38 | leftMargin: settingMargins | ||
565 | 39 | right: control.left | ||
566 | 40 | rightMargin: units.gu(1) | ||
567 | 41 | verticalCenter: parent.verticalCenter | ||
568 | 42 | } | ||
569 | 43 | text: widgetData.displayName | ||
570 | 44 | elide: Text.ElideMiddle | ||
571 | 45 | maximumLineCount: 2 | ||
572 | 46 | wrapMode: Text.Wrap | ||
573 | 47 | color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText | ||
574 | 48 | } | ||
575 | 49 | |||
576 | 50 | TextField { | ||
577 | 51 | id: control | ||
578 | 52 | objectName: "control" | ||
579 | 53 | anchors { | ||
580 | 54 | right: parent.right | ||
581 | 55 | rightMargin: settingMargins | ||
582 | 56 | verticalCenter: parent.verticalCenter | ||
583 | 57 | } | ||
584 | 58 | width: root.mode == "number" ? units.gu(8) : units.gu(12) | ||
585 | 59 | text: widgetData.value | ||
586 | 60 | color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.fieldText | ||
587 | 61 | validator: root.mode == "number" ? doubleValidator : null | ||
588 | 62 | hasClearButton: root.mode == "number" ? false : true | ||
589 | 63 | |||
590 | 64 | DoubleValidator { | ||
591 | 65 | id: doubleValidator | ||
592 | 66 | } | ||
593 | 67 | |||
594 | 68 | function updateText() { | ||
595 | 69 | if (acceptableInput) { | ||
596 | 70 | text = displayText; | ||
597 | 71 | root.updated(text); | ||
598 | 72 | } | ||
599 | 73 | } | ||
600 | 74 | |||
601 | 75 | onAccepted: updateText() | ||
602 | 76 | onActiveFocusChanged: { | ||
603 | 77 | if (!activeFocus) { | ||
604 | 78 | updateText(); | ||
605 | 79 | } | ||
606 | 80 | } | ||
607 | 81 | } | ||
608 | 82 | } | ||
609 | 83 | } | ||
610 | 0 | 84 | ||
611 | === added file 'qml/Dash/ScopeSettings/ScopeSettingsWidgetFactory.qml' | |||
612 | --- qml/Dash/ScopeSettings/ScopeSettingsWidgetFactory.qml 1970-01-01 00:00:00 +0000 | |||
613 | +++ qml/Dash/ScopeSettings/ScopeSettingsWidgetFactory.qml 2014-08-27 08:28:24 +0000 | |||
614 | @@ -0,0 +1,57 @@ | |||
615 | 1 | /* | ||
616 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
617 | 3 | * | ||
618 | 4 | * This program is free software; you can redistribute it and/or modify | ||
619 | 5 | * it under the terms of the GNU General Public License as published by | ||
620 | 6 | * the Free Software Foundation; version 3. | ||
621 | 7 | * | ||
622 | 8 | * This program is distributed in the hope that it will be useful, | ||
623 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
624 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
625 | 11 | * GNU General Public License for more details. | ||
626 | 12 | * | ||
627 | 13 | * You should have received a copy of the GNU General Public License | ||
628 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
629 | 15 | */ | ||
630 | 16 | |||
631 | 17 | import QtQuick 2.2 | ||
632 | 18 | |||
633 | 19 | //! \brief This component loads the widgets based on type. | ||
634 | 20 | |||
635 | 21 | Loader { | ||
636 | 22 | id: root | ||
637 | 23 | |||
638 | 24 | //! The ScopeStyle component. | ||
639 | 25 | property var scopeStyle: null | ||
640 | 26 | |||
641 | 27 | //! Variable used to contain widget's data | ||
642 | 28 | property var widgetData: null | ||
643 | 29 | |||
644 | 30 | //! Triggered signal forwarded from the widgets. | ||
645 | 31 | signal updated(var value) | ||
646 | 32 | |||
647 | 33 | source: widgetSource | ||
648 | 34 | |||
649 | 35 | //! \cond private | ||
650 | 36 | property url widgetSource: { | ||
651 | 37 | switch (widgetData.type) { | ||
652 | 38 | case "boolean": return "ScopeSettingBoolean.qml"; | ||
653 | 39 | case "list": return "ScopeSettingList.qml"; | ||
654 | 40 | case "number": return "ScopeSettingNumber.qml"; | ||
655 | 41 | case "string": return "ScopeSettingString.qml"; | ||
656 | 42 | default: return ""; | ||
657 | 43 | } | ||
658 | 44 | } | ||
659 | 45 | //! \endcond | ||
660 | 46 | |||
661 | 47 | onLoaded: { | ||
662 | 48 | if (item.hasOwnProperty("initialValue")) item.initialValue = root.widgetData.value; | ||
663 | 49 | item.widgetData = Qt.binding(function() { return root.widgetData; } ) | ||
664 | 50 | item.scopeStyle = Qt.binding(function() { return root.scopeStyle; } ) | ||
665 | 51 | } | ||
666 | 52 | |||
667 | 53 | Connections { | ||
668 | 54 | target: root.item | ||
669 | 55 | onUpdated: if (value !== widgetData.value) root.updated(value) | ||
670 | 56 | } | ||
671 | 57 | } | ||
672 | 0 | 58 | ||
673 | === added file 'qml/Dash/ScopeSettingsPage.qml' | |||
674 | --- qml/Dash/ScopeSettingsPage.qml 1970-01-01 00:00:00 +0000 | |||
675 | +++ qml/Dash/ScopeSettingsPage.qml 2014-08-27 08:28:24 +0000 | |||
676 | @@ -0,0 +1,62 @@ | |||
677 | 1 | /* | ||
678 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
679 | 3 | * | ||
680 | 4 | * This program is free software; you can redistribute it and/or modify | ||
681 | 5 | * it under the terms of the GNU General Public License as published by | ||
682 | 6 | * the Free Software Foundation; version 3. | ||
683 | 7 | * | ||
684 | 8 | * This program is distributed in the hope that it will be useful, | ||
685 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
686 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
687 | 11 | * GNU General Public License for more details. | ||
688 | 12 | * | ||
689 | 13 | * You should have received a copy of the GNU General Public License | ||
690 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
691 | 15 | */ | ||
692 | 16 | |||
693 | 17 | import QtQuick 2.2 | ||
694 | 18 | import Ubuntu.Components 1.1 | ||
695 | 19 | import Unity 0.2 | ||
696 | 20 | import "../Components" | ||
697 | 21 | import "ScopeSettings" | ||
698 | 22 | |||
699 | 23 | Item { | ||
700 | 24 | id: root | ||
701 | 25 | |||
702 | 26 | property var scope: null | ||
703 | 27 | property var scopeStyle: null | ||
704 | 28 | |||
705 | 29 | signal backClicked() | ||
706 | 30 | |||
707 | 31 | PageHeader { | ||
708 | 32 | id: header | ||
709 | 33 | objectName: "pageHeader" | ||
710 | 34 | width: parent.width | ||
711 | 35 | title: scope ? scope.name : "" | ||
712 | 36 | showBackButton: true | ||
713 | 37 | scopeStyle: root.scopeStyle | ||
714 | 38 | |||
715 | 39 | onBackClicked: root.backClicked() | ||
716 | 40 | } | ||
717 | 41 | |||
718 | 42 | ListView { | ||
719 | 43 | id: scopeSettings | ||
720 | 44 | objectName: "scopeSettings" | ||
721 | 45 | anchors { | ||
722 | 46 | top: header.bottom | ||
723 | 47 | bottom: parent.bottom | ||
724 | 48 | left: parent.left | ||
725 | 49 | right: parent.right | ||
726 | 50 | } | ||
727 | 51 | model: root.scope ? root.scope.settings : null | ||
728 | 52 | |||
729 | 53 | delegate: ScopeSettingsWidgetFactory { | ||
730 | 54 | objectName: "scopeSettingItem" + index | ||
731 | 55 | width: root.width | ||
732 | 56 | widgetData: model | ||
733 | 57 | scopeStyle: root.scopeStyle | ||
734 | 58 | |||
735 | 59 | onUpdated: model.value = value; | ||
736 | 60 | } | ||
737 | 61 | } | ||
738 | 62 | } | ||
739 | 0 | 63 | ||
740 | === modified file 'qml/Dash/ScopesOverview.qml' | |||
741 | --- qml/Dash/ScopesOverview.qml 2014-08-27 08:28:24 +0000 | |||
742 | +++ qml/Dash/ScopesOverview.qml 2014-08-27 08:28:24 +0000 | |||
743 | @@ -468,6 +468,8 @@ | |||
744 | 468 | width: parent.width | 468 | width: parent.width |
745 | 469 | height: parent.height | 469 | height: parent.height |
746 | 470 | anchors.left: scopesOverviewContent.right | 470 | anchors.left: scopesOverviewContent.right |
747 | 471 | |||
748 | 472 | onBackClicked: open = false | ||
749 | 471 | } | 473 | } |
750 | 472 | 474 | ||
751 | 473 | Item { | 475 | Item { |
752 | 474 | 476 | ||
753 | === modified file 'tests/autopilot/unity8/shell/emulators/dash.py' | |||
754 | --- tests/autopilot/unity8/shell/emulators/dash.py 2014-08-14 01:29:20 +0000 | |||
755 | +++ tests/autopilot/unity8/shell/emulators/dash.py 2014-08-27 08:28:24 +0000 | |||
756 | @@ -140,10 +140,9 @@ | |||
757 | 140 | 140 | ||
758 | 141 | def enter_search_query(self, query): | 141 | def enter_search_query(self, query): |
759 | 142 | current_header = self._get_current_page_header() | 142 | current_header = self._get_current_page_header() |
764 | 143 | self.pointing_device.move(current_header.globalRect.x + | 143 | search_button = current_header.select_single(objectName="search_header_button") |
765 | 144 | current_header.width - current_header.height / 4, | 144 | self.pointing_device.move(search_button.globalRect.x + search_button.width / 2, |
766 | 145 | current_header.globalRect.y + | 145 | search_button.globalRect.y + search_button.height / 2) |
763 | 146 | current_header.height / 4) | ||
767 | 147 | self.pointing_device.click() | 146 | self.pointing_device.click() |
768 | 148 | headerContainer = current_header.select_single( | 147 | headerContainer = current_header.select_single( |
769 | 149 | objectName="headerContainer") | 148 | objectName="headerContainer") |
770 | @@ -186,7 +185,8 @@ | |||
771 | 186 | # --elopio - 2014-1-14 | 185 | # --elopio - 2014-1-14 |
772 | 187 | self.click_scope_item(category, app_name) | 186 | self.click_scope_item(category, app_name) |
773 | 188 | preview_list = self.wait_select_single( | 187 | preview_list = self.wait_select_single( |
775 | 189 | 'PreviewListView', objectName='previewListView') | 188 | 'QQuickLoader', objectName='subPageLoader') |
776 | 189 | preview_list.subPageShown.wait_for(True) | ||
777 | 190 | preview_list.x.wait_for(0) | 190 | preview_list.x.wait_for(0) |
778 | 191 | return preview_list.select_single( | 191 | return preview_list.select_single( |
779 | 192 | Preview, objectName='preview{}'.format(preview_list.currentIndex)) | 192 | Preview, objectName='preview{}'.format(preview_list.currentIndex)) |
780 | 193 | 193 | ||
781 | === modified file 'tests/mocks/Unity/CMakeLists.txt' | |||
782 | --- tests/mocks/Unity/CMakeLists.txt 2014-08-25 10:05:13 +0000 | |||
783 | +++ tests/mocks/Unity/CMakeLists.txt 2014-08-27 08:28:24 +0000 | |||
784 | @@ -24,6 +24,7 @@ | |||
785 | 24 | fake_scope.cpp | 24 | fake_scope.cpp |
786 | 25 | fake_scopes.cpp | 25 | fake_scopes.cpp |
787 | 26 | fake_scopesoverview.cpp | 26 | fake_scopesoverview.cpp |
788 | 27 | fake_settingsmodel.cpp | ||
789 | 27 | fake_categories.cpp | 28 | fake_categories.cpp |
790 | 28 | fake_navigation.cpp | 29 | fake_navigation.cpp |
791 | 29 | fake_resultsmodel.cpp | 30 | fake_resultsmodel.cpp |
792 | @@ -39,6 +40,7 @@ | |||
793 | 39 | ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ResultsModelInterface.h | 40 | ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ResultsModelInterface.h |
794 | 40 | ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ScopeInterface.h | 41 | ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ScopeInterface.h |
795 | 41 | ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ScopesInterface.h | 42 | ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ScopesInterface.h |
796 | 43 | ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/SettingsModelInterface.h | ||
797 | 42 | ) | 44 | ) |
798 | 43 | 45 | ||
799 | 44 | add_library(FakeUnityQml MODULE ${UnityQML_SOURCES}) | 46 | add_library(FakeUnityQml MODULE ${UnityQML_SOURCES}) |
800 | 45 | 47 | ||
801 | === modified file 'tests/mocks/Unity/fake_scope.cpp' | |||
802 | --- tests/mocks/Unity/fake_scope.cpp 2014-08-27 08:28:24 +0000 | |||
803 | +++ tests/mocks/Unity/fake_scope.cpp 2014-08-27 08:28:24 +0000 | |||
804 | @@ -22,6 +22,7 @@ | |||
805 | 22 | #include "fake_navigation.h" | 22 | #include "fake_navigation.h" |
806 | 23 | #include "fake_resultsmodel.h" | 23 | #include "fake_resultsmodel.h" |
807 | 24 | #include "fake_scopes.h" | 24 | #include "fake_scopes.h" |
808 | 25 | #include "fake_settingsmodel.h" | ||
809 | 25 | 26 | ||
810 | 26 | Scope::Scope(Scopes* parent) : Scope(QString(), QString(), false, parent) | 27 | Scope::Scope(Scopes* parent) : Scope(QString(), QString(), false, parent) |
811 | 27 | { | 28 | { |
812 | @@ -39,6 +40,7 @@ | |||
813 | 39 | , m_previewRendererName("preview-generic") | 40 | , m_previewRendererName("preview-generic") |
814 | 40 | , m_categories(new Categories(categories, this)) | 41 | , m_categories(new Categories(categories, this)) |
815 | 41 | , m_openScope(nullptr) | 42 | , m_openScope(nullptr) |
816 | 43 | , m_settings(new SettingsModel(this)) | ||
817 | 42 | { | 44 | { |
818 | 43 | } | 45 | } |
819 | 44 | 46 | ||
820 | @@ -94,7 +96,7 @@ | |||
821 | 94 | 96 | ||
822 | 95 | unity::shell::scopes::SettingsModelInterface* Scope::settings() const | 97 | unity::shell::scopes::SettingsModelInterface* Scope::settings() const |
823 | 96 | { | 98 | { |
825 | 97 | return nullptr; | 99 | return m_settings; |
826 | 98 | } | 100 | } |
827 | 99 | 101 | ||
828 | 100 | QString Scope::noResultsHint() const | 102 | QString Scope::noResultsHint() const |
829 | 101 | 103 | ||
830 | === modified file 'tests/mocks/Unity/fake_scope.h' | |||
831 | --- tests/mocks/Unity/fake_scope.h 2014-08-07 08:52:59 +0000 | |||
832 | +++ tests/mocks/Unity/fake_scope.h 2014-08-27 08:28:24 +0000 | |||
833 | @@ -96,6 +96,7 @@ | |||
834 | 96 | 96 | ||
835 | 97 | unity::shell::scopes::CategoriesInterface* m_categories; | 97 | unity::shell::scopes::CategoriesInterface* m_categories; |
836 | 98 | unity::shell::scopes::ScopeInterface* m_openScope; | 98 | unity::shell::scopes::ScopeInterface* m_openScope; |
837 | 99 | unity::shell::scopes::SettingsModelInterface* m_settings; | ||
838 | 99 | }; | 100 | }; |
839 | 100 | 101 | ||
840 | 101 | #endif // FAKE_SCOPE_H | 102 | #endif // FAKE_SCOPE_H |
841 | 102 | 103 | ||
842 | === added file 'tests/mocks/Unity/fake_settingsmodel.cpp' | |||
843 | --- tests/mocks/Unity/fake_settingsmodel.cpp 1970-01-01 00:00:00 +0000 | |||
844 | +++ tests/mocks/Unity/fake_settingsmodel.cpp 2014-08-27 08:28:24 +0000 | |||
845 | @@ -0,0 +1,95 @@ | |||
846 | 1 | /* | ||
847 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
848 | 3 | * | ||
849 | 4 | * This program is free software; you can redistribute it and/or modify | ||
850 | 5 | * it under the terms of the GNU General Public License as published by | ||
851 | 6 | * the Free Software Foundation; version 3. | ||
852 | 7 | * | ||
853 | 8 | * This program is distributed in the hope that it will be useful, | ||
854 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
855 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
856 | 11 | * GNU General Public License for more details. | ||
857 | 12 | * | ||
858 | 13 | * You should have received a copy of the GNU General Public License | ||
859 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
860 | 15 | */ | ||
861 | 16 | |||
862 | 17 | #include "fake_settingsmodel.h" | ||
863 | 18 | |||
864 | 19 | SettingsModel::SettingsModel(QObject* parent) : | ||
865 | 20 | SettingsModelInterface(parent) { | ||
866 | 21 | { | ||
867 | 22 | QVariantMap parameters; | ||
868 | 23 | m_data << QSharedPointer<Data>(new Data("boolean-setting", "Boolean Setting", "boolean", parameters, true)); | ||
869 | 24 | } | ||
870 | 25 | { | ||
871 | 26 | QVariantMap parameters; | ||
872 | 27 | parameters["values"] = QVariantList() << "First" << "Second" << "Third"; | ||
873 | 28 | m_data << QSharedPointer<Data>(new Data("list-setting", "List Setting", "list", parameters, 1)); | ||
874 | 29 | } | ||
875 | 30 | { | ||
876 | 31 | QVariantMap parameters; | ||
877 | 32 | m_data << QSharedPointer<Data>(new Data("number-setting", "Number Setting", "number", parameters, 1.23)); | ||
878 | 33 | } | ||
879 | 34 | { | ||
880 | 35 | QVariantMap parameters; | ||
881 | 36 | m_data << QSharedPointer<Data>(new Data("string-setting", "String Setting", "string", parameters, "flibble")); | ||
882 | 37 | } | ||
883 | 38 | } | ||
884 | 39 | |||
885 | 40 | QVariant SettingsModel::data(const QModelIndex& index, int role) const { | ||
886 | 41 | int row = index.row(); | ||
887 | 42 | QVariant result; | ||
888 | 43 | |||
889 | 44 | if (row < m_data.size()) { | ||
890 | 45 | auto data = m_data[row]; | ||
891 | 46 | |||
892 | 47 | switch (role) { | ||
893 | 48 | case Roles::RoleSettingId: | ||
894 | 49 | result = data->id; | ||
895 | 50 | break; | ||
896 | 51 | case Roles::RoleDisplayName: | ||
897 | 52 | result = data->displayName; | ||
898 | 53 | break; | ||
899 | 54 | case Roles::RoleType: | ||
900 | 55 | result = data->type; | ||
901 | 56 | break; | ||
902 | 57 | case Roles::RoleProperties: | ||
903 | 58 | result = data->properties; | ||
904 | 59 | break; | ||
905 | 60 | case Roles::RoleValue: { | ||
906 | 61 | result = data->value; | ||
907 | 62 | break; | ||
908 | 63 | } | ||
909 | 64 | default: | ||
910 | 65 | break; | ||
911 | 66 | } | ||
912 | 67 | } | ||
913 | 68 | |||
914 | 69 | return result; | ||
915 | 70 | } | ||
916 | 71 | |||
917 | 72 | bool SettingsModel::setData(const QModelIndex &index, const QVariant &value, int role) { | ||
918 | 73 | int row = index.row(); | ||
919 | 74 | if (row < m_data.size()) { | ||
920 | 75 | switch (role) { | ||
921 | 76 | case SettingsModelInterface::RoleValue: { | ||
922 | 77 | auto data = m_data[row]; | ||
923 | 78 | data->value = value; | ||
924 | 79 | return true; | ||
925 | 80 | } | ||
926 | 81 | default: | ||
927 | 82 | break; | ||
928 | 83 | } | ||
929 | 84 | } | ||
930 | 85 | |||
931 | 86 | return false; | ||
932 | 87 | } | ||
933 | 88 | |||
934 | 89 | int SettingsModel::rowCount(const QModelIndex&) const { | ||
935 | 90 | return count(); | ||
936 | 91 | } | ||
937 | 92 | |||
938 | 93 | int SettingsModel::count() const { | ||
939 | 94 | return m_data.size(); | ||
940 | 95 | } | ||
941 | 0 | 96 | ||
942 | === added file 'tests/mocks/Unity/fake_settingsmodel.h' | |||
943 | --- tests/mocks/Unity/fake_settingsmodel.h 1970-01-01 00:00:00 +0000 | |||
944 | +++ tests/mocks/Unity/fake_settingsmodel.h 2014-08-27 08:28:24 +0000 | |||
945 | @@ -0,0 +1,54 @@ | |||
946 | 1 | /* | ||
947 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
948 | 3 | * | ||
949 | 4 | * This program is free software; you can redistribute it and/or modify | ||
950 | 5 | * it under the terms of the GNU General Public License as published by | ||
951 | 6 | * the Free Software Foundation; version 3. | ||
952 | 7 | * | ||
953 | 8 | * This program is distributed in the hope that it will be useful, | ||
954 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
955 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
956 | 11 | * GNU General Public License for more details. | ||
957 | 12 | * | ||
958 | 13 | * You should have received a copy of the GNU General Public License | ||
959 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
960 | 15 | */ | ||
961 | 16 | |||
962 | 17 | #ifndef FAKE_SETTINGSMODEL_H | ||
963 | 18 | #define FAKE_SETTINGSMODEL_H | ||
964 | 19 | |||
965 | 20 | #include <unity/shell/scopes/SettingsModelInterface.h> | ||
966 | 21 | |||
967 | 22 | #include <QList> | ||
968 | 23 | #include <QSharedPointer> | ||
969 | 24 | |||
970 | 25 | class SettingsModel: public unity::shell::scopes::SettingsModelInterface { | ||
971 | 26 | Q_OBJECT | ||
972 | 27 | |||
973 | 28 | struct Data { | ||
974 | 29 | QString id; | ||
975 | 30 | QString displayName; | ||
976 | 31 | QString type; | ||
977 | 32 | QVariant properties; | ||
978 | 33 | QVariant value; | ||
979 | 34 | |||
980 | 35 | Data(QString const& id_, QString const& displayName_, | ||
981 | 36 | QString const& type_, QVariant const& properties_, | ||
982 | 37 | QVariant const& value_) : | ||
983 | 38 | id(id_), displayName(displayName_), type(type_), | ||
984 | 39 | properties(properties_), value(value_) {} | ||
985 | 40 | }; | ||
986 | 41 | |||
987 | 42 | public: | ||
988 | 43 | explicit SettingsModel(QObject* parent = 0); | ||
989 | 44 | ~SettingsModel() = default; | ||
990 | 45 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||
991 | 46 | bool setData(const QModelIndex&index, const QVariant& value, int role = Qt::EditRole) override; | ||
992 | 47 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||
993 | 48 | int count() const override; | ||
994 | 49 | |||
995 | 50 | protected: | ||
996 | 51 | QList<QSharedPointer<Data>> m_data; | ||
997 | 52 | }; | ||
998 | 53 | |||
999 | 54 | #endif // FAKE_SETTINGSMODEL_H | ||
1000 | 0 | 55 | ||
1001 | === modified file 'tests/mocks/Unity/fake_unity_plugin.cpp' | |||
1002 | --- tests/mocks/Unity/fake_unity_plugin.cpp 2014-08-11 09:57:29 +0000 | |||
1003 | +++ tests/mocks/Unity/fake_unity_plugin.cpp 2014-08-27 08:28:24 +0000 | |||
1004 | @@ -26,6 +26,7 @@ | |||
1005 | 26 | #include "fake_previewmodel.h" | 26 | #include "fake_previewmodel.h" |
1006 | 27 | #include "fake_previewwidgetmodel.h" | 27 | #include "fake_previewwidgetmodel.h" |
1007 | 28 | #include "fake_resultsmodel.h" | 28 | #include "fake_resultsmodel.h" |
1008 | 29 | #include "fake_settingsmodel.h" | ||
1009 | 29 | 30 | ||
1010 | 30 | // External | 31 | // External |
1011 | 31 | #include <glib-object.h> | 32 | #include <glib-object.h> |
1012 | @@ -43,6 +44,7 @@ | |||
1013 | 43 | qmlRegisterType<Scopes>(uri, 0, 2, "Scopes"); | 44 | qmlRegisterType<Scopes>(uri, 0, 2, "Scopes"); |
1014 | 44 | qmlRegisterType<Scope>(uri, 0, 2, "MockScope"); | 45 | qmlRegisterType<Scope>(uri, 0, 2, "MockScope"); |
1015 | 45 | qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Scope object in QML."); | 46 | qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Scope object in QML."); |
1016 | 47 | qmlRegisterUncreatableType<unity::shell::scopes::SettingsModelInterface>(uri, 0, 2, "SettingsModel", "Can't create SettingsModel object in QML."); | ||
1017 | 46 | qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML."); | 48 | qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML."); |
1018 | 47 | qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML."); | 49 | qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML."); |
1019 | 48 | qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance."); | 50 | qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance."); |
1020 | 49 | 51 | ||
1021 | === modified file 'tests/qmltests/CMakeLists.txt' | |||
1022 | --- tests/qmltests/CMakeLists.txt 2014-08-27 08:28:24 +0000 | |||
1023 | +++ tests/qmltests/CMakeLists.txt 2014-08-27 08:28:24 +0000 | |||
1024 | @@ -55,6 +55,11 @@ | |||
1025 | 55 | add_qml_test(Dash/Previews PreviewVideoPlayback) | 55 | add_qml_test(Dash/Previews PreviewVideoPlayback) |
1026 | 56 | add_qml_test(Dash/Previews PreviewWidgetFactory) | 56 | add_qml_test(Dash/Previews PreviewWidgetFactory) |
1027 | 57 | add_qml_test(Dash/Previews PreviewZoomableImage) | 57 | add_qml_test(Dash/Previews PreviewZoomableImage) |
1028 | 58 | add_qml_test(Dash/ScopeSettings ScopeSettingBoolean) | ||
1029 | 59 | add_qml_test(Dash/ScopeSettings ScopeSettingList) | ||
1030 | 60 | add_qml_test(Dash/ScopeSettings ScopeSettingNumber) | ||
1031 | 61 | add_qml_test(Dash/ScopeSettings ScopeSettingString) | ||
1032 | 62 | add_qml_test(Dash/ScopeSettings ScopeSettingsWidgetFactory) | ||
1033 | 58 | add_qml_test(Greeter Lockscreen ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full") | 63 | add_qml_test(Greeter Lockscreen ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full") |
1034 | 59 | add_qml_test(Greeter MultiGreeter ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full") | 64 | add_qml_test(Greeter MultiGreeter ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full") |
1035 | 60 | add_qml_test(Greeter SingleGreeter ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single") | 65 | add_qml_test(Greeter SingleGreeter ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single") |
1036 | 61 | 66 | ||
1037 | === modified file 'tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml' | |||
1038 | --- tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml 2014-08-27 08:28:24 +0000 | |||
1039 | +++ tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml 2014-08-27 08:28:24 +0000 | |||
1040 | @@ -94,7 +94,7 @@ | |||
1041 | 94 | factory.widgetData = { type: data.type }; | 94 | factory.widgetData = { type: data.type }; |
1042 | 95 | factory.widgetType = data.type; | 95 | factory.widgetType = data.type; |
1043 | 96 | 96 | ||
1045 | 97 | verify(("" + factory.source).indexOf(data.source) != -1); | 97 | verify((String(factory.source)).indexOf(data.source) != -1); |
1046 | 98 | } | 98 | } |
1047 | 99 | } | 99 | } |
1048 | 100 | } | 100 | } |
1049 | 101 | 101 | ||
1050 | === added directory 'tests/qmltests/Dash/ScopeSettings' | |||
1051 | === added file 'tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingBoolean.qml' | |||
1052 | --- tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingBoolean.qml 1970-01-01 00:00:00 +0000 | |||
1053 | +++ tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingBoolean.qml 2014-08-27 08:28:24 +0000 | |||
1054 | @@ -0,0 +1,62 @@ | |||
1055 | 1 | /* | ||
1056 | 2 | * Copyright 2014 Canonical Ltd. | ||
1057 | 3 | * | ||
1058 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1059 | 5 | * it under the terms of the GNU General Public License as published by | ||
1060 | 6 | * the Free Software Foundation; version 3. | ||
1061 | 7 | * | ||
1062 | 8 | * This program is distributed in the hope that it will be useful, | ||
1063 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1064 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1065 | 11 | * GNU General Public License for more details. | ||
1066 | 12 | * | ||
1067 | 13 | * You should have received a copy of the GNU General Public License | ||
1068 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1069 | 15 | */ | ||
1070 | 16 | |||
1071 | 17 | import QtQuick 2.0 | ||
1072 | 18 | import Ubuntu.Components 1.1 | ||
1073 | 19 | import QtTest 1.0 | ||
1074 | 20 | import "../../../../qml/Dash/ScopeSettings" | ||
1075 | 21 | import Unity.Test 0.1 as UT | ||
1076 | 22 | |||
1077 | 23 | Rectangle { | ||
1078 | 24 | id: root | ||
1079 | 25 | width: units.gu(40) | ||
1080 | 26 | height: units.gu(80) | ||
1081 | 27 | |||
1082 | 28 | property var settingData: { | ||
1083 | 29 | "displayName" : "Mock boolean setting", | ||
1084 | 30 | "value": true | ||
1085 | 31 | } | ||
1086 | 32 | |||
1087 | 33 | ScopeSettingBoolean { | ||
1088 | 34 | id: scopeSetting | ||
1089 | 35 | widgetData: settingData | ||
1090 | 36 | width: parent.width | ||
1091 | 37 | } | ||
1092 | 38 | |||
1093 | 39 | SignalSpy { | ||
1094 | 40 | id: spy | ||
1095 | 41 | target: scopeSetting | ||
1096 | 42 | signalName: "updated" | ||
1097 | 43 | } | ||
1098 | 44 | |||
1099 | 45 | UT.UnityTestCase { | ||
1100 | 46 | id: testCase | ||
1101 | 47 | name: "ScopeSettingBoolean" | ||
1102 | 48 | when: windowShown | ||
1103 | 49 | |||
1104 | 50 | function test_updated() { | ||
1105 | 51 | var control = findChild(scopeSetting, "control"); | ||
1106 | 52 | mouseClick(control, control.width / 2, control.height / 2); | ||
1107 | 53 | spy.wait(); | ||
1108 | 54 | compare(spy.signalArguments[0][0], false); | ||
1109 | 55 | |||
1110 | 56 | spy.clear(); | ||
1111 | 57 | mouseClick(scopeSetting, scopeSetting.width / 2, scopeSetting.height / 2); | ||
1112 | 58 | spy.wait(); | ||
1113 | 59 | compare(spy.signalArguments[0][0], true); | ||
1114 | 60 | } | ||
1115 | 61 | } | ||
1116 | 62 | } | ||
1117 | 0 | 63 | ||
1118 | === added file 'tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingList.qml' | |||
1119 | --- tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingList.qml 1970-01-01 00:00:00 +0000 | |||
1120 | +++ tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingList.qml 2014-08-27 08:28:24 +0000 | |||
1121 | @@ -0,0 +1,84 @@ | |||
1122 | 1 | /* | ||
1123 | 2 | * Copyright 2014 Canonical Ltd. | ||
1124 | 3 | * | ||
1125 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1126 | 5 | * it under the terms of the GNU General Public License as published by | ||
1127 | 6 | * the Free Software Foundation; version 3. | ||
1128 | 7 | * | ||
1129 | 8 | * This program is distributed in the hope that it will be useful, | ||
1130 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1131 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1132 | 11 | * GNU General Public License for more details. | ||
1133 | 12 | * | ||
1134 | 13 | * You should have received a copy of the GNU General Public License | ||
1135 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1136 | 15 | */ | ||
1137 | 16 | |||
1138 | 17 | import QtQuick 2.0 | ||
1139 | 18 | import Ubuntu.Components 1.1 | ||
1140 | 19 | import QtTest 1.0 | ||
1141 | 20 | import "../../../../qml/Dash/ScopeSettings" | ||
1142 | 21 | import Unity.Test 0.1 as UT | ||
1143 | 22 | |||
1144 | 23 | Rectangle { | ||
1145 | 24 | id: root | ||
1146 | 25 | width: units.gu(40) | ||
1147 | 26 | height: units.gu(80) | ||
1148 | 27 | |||
1149 | 28 | property var settingData: { | ||
1150 | 29 | "displayName" : "Mock list setting", | ||
1151 | 30 | "properties": { "values" : [ "first", "second", "third" ] } | ||
1152 | 31 | } | ||
1153 | 32 | |||
1154 | 33 | ScopeSettingList { | ||
1155 | 34 | id: scopeSetting | ||
1156 | 35 | width: parent.width | ||
1157 | 36 | widgetData: settingData | ||
1158 | 37 | } | ||
1159 | 38 | |||
1160 | 39 | SignalSpy { | ||
1161 | 40 | id: spy | ||
1162 | 41 | target: scopeSetting | ||
1163 | 42 | signalName: "updated" | ||
1164 | 43 | } | ||
1165 | 44 | |||
1166 | 45 | UT.UnityTestCase { | ||
1167 | 46 | id: testCase | ||
1168 | 47 | name: "ScopeSettingList" | ||
1169 | 48 | when: windowShown | ||
1170 | 49 | |||
1171 | 50 | property var control: findChild(scopeSetting, "control") | ||
1172 | 51 | |||
1173 | 52 | function cleanup() { | ||
1174 | 53 | control.selectedIndex = 0; | ||
1175 | 54 | spy.clear(); | ||
1176 | 55 | } | ||
1177 | 56 | |||
1178 | 57 | function test_initialValue() { | ||
1179 | 58 | // there's no initialIndex, so we workaround, testing is difficult too https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1362031 | ||
1180 | 59 | var newObject = Qt.createQmlObject('import "../../../../qml/Dash/ScopeSettings" \n\ | ||
1181 | 60 | ScopeSettingList { initialValue: 2; }', root, "dynamicScopeSettingList"); | ||
1182 | 61 | newObject.widgetData = settingData; | ||
1183 | 62 | var controlDynamic = findChild(newObject, "control"); | ||
1184 | 63 | tryCompare(controlDynamic, "selectedIndex", 2); | ||
1185 | 64 | } | ||
1186 | 65 | |||
1187 | 66 | function test_updated_data() { | ||
1188 | 67 | return [ | ||
1189 | 68 | { tag: "current", index: 0, updated: false }, | ||
1190 | 69 | { tag: "second", index: 1, updated: true }, | ||
1191 | 70 | { tag: "third", index: 2, updated: true } | ||
1192 | 71 | ] | ||
1193 | 72 | } | ||
1194 | 73 | |||
1195 | 74 | function test_updated(data) { | ||
1196 | 75 | control.selectedIndex = data.index; | ||
1197 | 76 | if (data.updated) { | ||
1198 | 77 | spy.wait(); | ||
1199 | 78 | compare(spy.signalArguments[0][0], data.index); | ||
1200 | 79 | } else { | ||
1201 | 80 | compare(spy.count, 0); | ||
1202 | 81 | } | ||
1203 | 82 | } | ||
1204 | 83 | } | ||
1205 | 84 | } | ||
1206 | 0 | 85 | ||
1207 | === added file 'tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingNumber.qml' | |||
1208 | --- tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingNumber.qml 1970-01-01 00:00:00 +0000 | |||
1209 | +++ tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingNumber.qml 2014-08-27 08:28:24 +0000 | |||
1210 | @@ -0,0 +1,98 @@ | |||
1211 | 1 | /* | ||
1212 | 2 | * Copyright 2014 Canonical Ltd. | ||
1213 | 3 | * | ||
1214 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1215 | 5 | * it under the terms of the GNU General Public License as published by | ||
1216 | 6 | * the Free Software Foundation; version 3. | ||
1217 | 7 | * | ||
1218 | 8 | * This program is distributed in the hope that it will be useful, | ||
1219 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1220 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1221 | 11 | * GNU General Public License for more details. | ||
1222 | 12 | * | ||
1223 | 13 | * You should have received a copy of the GNU General Public License | ||
1224 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1225 | 15 | */ | ||
1226 | 16 | |||
1227 | 17 | import QtQuick 2.0 | ||
1228 | 18 | import Ubuntu.Components 1.1 | ||
1229 | 19 | import QtTest 1.0 | ||
1230 | 20 | import "../../../../qml/Dash/ScopeSettings" | ||
1231 | 21 | import Unity.Test 0.1 as UT | ||
1232 | 22 | |||
1233 | 23 | Rectangle { | ||
1234 | 24 | id: root | ||
1235 | 25 | width: units.gu(40) | ||
1236 | 26 | height: units.gu(80) | ||
1237 | 27 | |||
1238 | 28 | property var settingData: { | ||
1239 | 29 | "displayName" : "Mock number setting", | ||
1240 | 30 | "value": 0.2 | ||
1241 | 31 | } | ||
1242 | 32 | |||
1243 | 33 | ScopeSettingNumber { | ||
1244 | 34 | id: scopeSetting | ||
1245 | 35 | widgetData: settingData | ||
1246 | 36 | width: parent.width | ||
1247 | 37 | } | ||
1248 | 38 | |||
1249 | 39 | SignalSpy { | ||
1250 | 40 | id: spy | ||
1251 | 41 | target: scopeSetting | ||
1252 | 42 | signalName: "updated" | ||
1253 | 43 | } | ||
1254 | 44 | |||
1255 | 45 | UT.UnityTestCase { | ||
1256 | 46 | id: testCase | ||
1257 | 47 | name: "ScopeSettingNumber" | ||
1258 | 48 | when: windowShown | ||
1259 | 49 | |||
1260 | 50 | property var control: findChild(scopeSetting, "control") | ||
1261 | 51 | property real newNumber: 11.7 | ||
1262 | 52 | |||
1263 | 53 | function cleanup() { | ||
1264 | 54 | control.focus = false; | ||
1265 | 55 | control.text = settingData.value; | ||
1266 | 56 | spy.clear(); | ||
1267 | 57 | } | ||
1268 | 58 | |||
1269 | 59 | function test_updated_on_unfocus() { | ||
1270 | 60 | mouseClick(control, control.width / 2, control.height / 2); | ||
1271 | 61 | control.selectAll(); | ||
1272 | 62 | control.cut(); | ||
1273 | 63 | control.insert(0, newNumber); | ||
1274 | 64 | control.focus = false; | ||
1275 | 65 | spy.wait(); | ||
1276 | 66 | verify(spy.signalArguments[0][0] == newNumber); | ||
1277 | 67 | } | ||
1278 | 68 | |||
1279 | 69 | function test_updated_on_accepted() { | ||
1280 | 70 | mouseClick(control, control.width / 2, control.height / 2); | ||
1281 | 71 | control.selectAll(); | ||
1282 | 72 | control.cut(); | ||
1283 | 73 | control.insert(0, newNumber); | ||
1284 | 74 | control.accepted(); | ||
1285 | 75 | spy.wait(); | ||
1286 | 76 | verify(spy.signalArguments[0][0] == newNumber); | ||
1287 | 77 | } | ||
1288 | 78 | |||
1289 | 79 | function test_selection_on_listitem_click() { | ||
1290 | 80 | mouseClick(scopeSetting, 0, scopeSetting.height / 2); | ||
1291 | 81 | compare(control.focus, true); | ||
1292 | 82 | // we're checking that selectAll() is being called by omitting it here | ||
1293 | 83 | control.cut(); | ||
1294 | 84 | control.insert(0, newNumber); | ||
1295 | 85 | verify(control.displayText == newNumber); | ||
1296 | 86 | } | ||
1297 | 87 | |||
1298 | 88 | function test_unacceptable_input() { | ||
1299 | 89 | mouseClick(control, control.width / 2, control.height / 2); | ||
1300 | 90 | control.selectAll(); | ||
1301 | 91 | control.cut(); | ||
1302 | 92 | control.insert(0, "not valid"); | ||
1303 | 93 | control.accepted(); | ||
1304 | 94 | compare(spy.count, 0); | ||
1305 | 95 | compare(control.displayText, ""); | ||
1306 | 96 | } | ||
1307 | 97 | } | ||
1308 | 98 | } | ||
1309 | 0 | 99 | ||
1310 | === added file 'tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingString.qml' | |||
1311 | --- tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingString.qml 1970-01-01 00:00:00 +0000 | |||
1312 | +++ tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingString.qml 2014-08-27 08:28:24 +0000 | |||
1313 | @@ -0,0 +1,88 @@ | |||
1314 | 1 | /* | ||
1315 | 2 | * Copyright 2014 Canonical Ltd. | ||
1316 | 3 | * | ||
1317 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1318 | 5 | * it under the terms of the GNU General Public License as published by | ||
1319 | 6 | * the Free Software Foundation; version 3. | ||
1320 | 7 | * | ||
1321 | 8 | * This program is distributed in the hope that it will be useful, | ||
1322 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1323 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1324 | 11 | * GNU General Public License for more details. | ||
1325 | 12 | * | ||
1326 | 13 | * You should have received a copy of the GNU General Public License | ||
1327 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1328 | 15 | */ | ||
1329 | 16 | |||
1330 | 17 | import QtQuick 2.0 | ||
1331 | 18 | import Ubuntu.Components 1.1 | ||
1332 | 19 | import QtTest 1.0 | ||
1333 | 20 | import "../../../../qml/Dash/ScopeSettings" | ||
1334 | 21 | import Unity.Test 0.1 as UT | ||
1335 | 22 | |||
1336 | 23 | Rectangle { | ||
1337 | 24 | id: root | ||
1338 | 25 | width: units.gu(40) | ||
1339 | 26 | height: units.gu(80) | ||
1340 | 27 | |||
1341 | 28 | property var settingData: { | ||
1342 | 29 | "displayName" : "Mock string setting", | ||
1343 | 30 | "value": "mock string" | ||
1344 | 31 | } | ||
1345 | 32 | |||
1346 | 33 | ScopeSettingString { | ||
1347 | 34 | id: scopeSetting | ||
1348 | 35 | widgetData: settingData | ||
1349 | 36 | width: parent.width | ||
1350 | 37 | } | ||
1351 | 38 | |||
1352 | 39 | SignalSpy { | ||
1353 | 40 | id: spy | ||
1354 | 41 | target: scopeSetting | ||
1355 | 42 | signalName: "updated" | ||
1356 | 43 | } | ||
1357 | 44 | |||
1358 | 45 | UT.UnityTestCase { | ||
1359 | 46 | id: testCase | ||
1360 | 47 | name: "ScopeSettingString" | ||
1361 | 48 | when: windowShown | ||
1362 | 49 | |||
1363 | 50 | property var control: findChild(scopeSetting, "control") | ||
1364 | 51 | property string newText: "new text to compare" | ||
1365 | 52 | |||
1366 | 53 | function cleanup() { | ||
1367 | 54 | control.focus = false; | ||
1368 | 55 | control.text = settingData.value; | ||
1369 | 56 | spy.clear(); | ||
1370 | 57 | } | ||
1371 | 58 | |||
1372 | 59 | function test_updated_on_unfocus() { | ||
1373 | 60 | mouseClick(control, control.width / 2, control.height / 2); | ||
1374 | 61 | control.selectAll(); | ||
1375 | 62 | control.cut(); | ||
1376 | 63 | control.insert(0, newText); | ||
1377 | 64 | control.focus = false; | ||
1378 | 65 | spy.wait(); | ||
1379 | 66 | compare(spy.signalArguments[0][0], newText); | ||
1380 | 67 | } | ||
1381 | 68 | |||
1382 | 69 | function test_updated_on_accepted() { | ||
1383 | 70 | mouseClick(control, control.width / 2, control.height / 2); | ||
1384 | 71 | control.selectAll(); | ||
1385 | 72 | control.cut(); | ||
1386 | 73 | control.insert(0, newText); | ||
1387 | 74 | control.accepted(); | ||
1388 | 75 | spy.wait(); | ||
1389 | 76 | compare(spy.signalArguments[0][0], newText); | ||
1390 | 77 | } | ||
1391 | 78 | |||
1392 | 79 | function test_selection_on_listitem_click() { | ||
1393 | 80 | mouseClick(scopeSetting, 0, scopeSetting.height / 2); | ||
1394 | 81 | compare(control.focus, true); | ||
1395 | 82 | // we're checking that selectAll() is being called by omitting it here | ||
1396 | 83 | control.cut(); | ||
1397 | 84 | control.insert(0, newText); | ||
1398 | 85 | compare(control.displayText, newText); | ||
1399 | 86 | } | ||
1400 | 87 | } | ||
1401 | 88 | } | ||
1402 | 0 | 89 | ||
1403 | === added file 'tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingsWidgetFactory.qml' | |||
1404 | --- tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingsWidgetFactory.qml 1970-01-01 00:00:00 +0000 | |||
1405 | +++ tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingsWidgetFactory.qml 2014-08-27 08:28:24 +0000 | |||
1406 | @@ -0,0 +1,65 @@ | |||
1407 | 1 | /* | ||
1408 | 2 | * Copyright 2014 Canonical Ltd. | ||
1409 | 3 | * | ||
1410 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1411 | 5 | * it under the terms of the GNU General Public License as published by | ||
1412 | 6 | * the Free Software Foundation; version 3. | ||
1413 | 7 | * | ||
1414 | 8 | * This program is distributed in the hope that it will be useful, | ||
1415 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1416 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1417 | 11 | * GNU General Public License for more details. | ||
1418 | 12 | * | ||
1419 | 13 | * You should have received a copy of the GNU General Public License | ||
1420 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1421 | 15 | */ | ||
1422 | 16 | |||
1423 | 17 | import QtQuick 2.0 | ||
1424 | 18 | import Ubuntu.Components 1.1 | ||
1425 | 19 | import QtTest 1.0 | ||
1426 | 20 | import "../../../../qml/Dash/ScopeSettings" | ||
1427 | 21 | import Unity.Test 0.1 as UT | ||
1428 | 22 | |||
1429 | 23 | Rectangle { | ||
1430 | 24 | id: root | ||
1431 | 25 | width: units.gu(40) | ||
1432 | 26 | height: units.gu(80) | ||
1433 | 27 | |||
1434 | 28 | property var settingData: { | ||
1435 | 29 | "type": "", | ||
1436 | 30 | "displayName" : "Mock setting", | ||
1437 | 31 | "value": "1", | ||
1438 | 32 | "properties": { "values" : [ "first", "second", "third" ] } | ||
1439 | 33 | } | ||
1440 | 34 | |||
1441 | 35 | ScopeSettingsWidgetFactory { | ||
1442 | 36 | id: scopeSettingsWidgetFactory | ||
1443 | 37 | anchors { | ||
1444 | 38 | left: parent.left | ||
1445 | 39 | right: parent.right | ||
1446 | 40 | } | ||
1447 | 41 | } | ||
1448 | 42 | |||
1449 | 43 | UT.UnityTestCase { | ||
1450 | 44 | id: testCase | ||
1451 | 45 | name: "ScopeSettingWidgetFactory" | ||
1452 | 46 | when: windowShown | ||
1453 | 47 | |||
1454 | 48 | function test_mapping_data() { | ||
1455 | 49 | return [ | ||
1456 | 50 | { tag: "Boolean", type: "boolean", source: "ScopeSettingBoolean.qml" }, | ||
1457 | 51 | { tag: "List", type: "list", source: "ScopeSettingList.qml" }, | ||
1458 | 52 | { tag: "Number", type: "number", source: "ScopeSettingNumber.qml" }, | ||
1459 | 53 | { tag: "String", type: "string", source: "ScopeSettingString.qml" } | ||
1460 | 54 | ]; | ||
1461 | 55 | } | ||
1462 | 56 | |||
1463 | 57 | function test_mapping(data) { | ||
1464 | 58 | var newSettingData = settingData; | ||
1465 | 59 | newSettingData.type = data.type; | ||
1466 | 60 | scopeSettingsWidgetFactory.widgetData = newSettingData; | ||
1467 | 61 | |||
1468 | 62 | verify((String(scopeSettingsWidgetFactory.source)).indexOf(data.source) != -1); | ||
1469 | 63 | } | ||
1470 | 64 | } | ||
1471 | 65 | } | ||
1472 | 0 | 66 | ||
1473 | === modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml' | |||
1474 | --- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-27 08:28:24 +0000 | |||
1475 | +++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-27 08:28:24 +0000 | |||
1476 | @@ -39,6 +39,8 @@ | |||
1477 | 39 | 39 | ||
1478 | 40 | Scopes { | 40 | Scopes { |
1479 | 41 | id: scopes | 41 | id: scopes |
1480 | 42 | // for tryGenericScopeView | ||
1481 | 43 | onLoadedChanged: if (loaded) genericScopeView.scope = scopes.getScope(2); | ||
1482 | 42 | } | 44 | } |
1483 | 43 | 45 | ||
1484 | 44 | SignalSpy { | 46 | SignalSpy { |
1485 | @@ -59,7 +61,7 @@ | |||
1486 | 59 | name: "GenericScopeView" | 61 | name: "GenericScopeView" |
1487 | 60 | when: scopes.loaded && windowShown | 62 | when: scopes.loaded && windowShown |
1488 | 61 | 63 | ||
1490 | 62 | property Item previewListView: findChild(genericScopeView, "previewListView") | 64 | property Item subPageLoader: findChild(genericScopeView, "subPageLoader") |
1491 | 63 | property Item header: findChild(genericScopeView, "scopePageHeader") | 65 | property Item header: findChild(genericScopeView, "scopePageHeader") |
1492 | 64 | 66 | ||
1493 | 65 | function init() { | 67 | function init() { |
1494 | @@ -94,24 +96,24 @@ | |||
1495 | 94 | tryCompare(genericScopeView.scope, "isActive", false) | 96 | tryCompare(genericScopeView.scope, "isActive", false) |
1496 | 95 | genericScopeView.isCurrent = true | 97 | genericScopeView.isCurrent = true |
1497 | 96 | tryCompare(genericScopeView.scope, "isActive", true) | 98 | tryCompare(genericScopeView.scope, "isActive", true) |
1499 | 97 | testCase.previewListView.open = true | 99 | testCase.subPageLoader.open = true |
1500 | 98 | tryCompare(genericScopeView.scope, "isActive", false) | 100 | tryCompare(genericScopeView.scope, "isActive", false) |
1502 | 99 | testCase.previewListView.open = false | 101 | testCase.subPageLoader.open = false |
1503 | 100 | tryCompare(genericScopeView.scope, "isActive", true) | 102 | tryCompare(genericScopeView.scope, "isActive", true) |
1504 | 101 | genericScopeView.isCurrent = false | 103 | genericScopeView.isCurrent = false |
1505 | 102 | tryCompare(genericScopeView.scope, "isActive", false) | 104 | tryCompare(genericScopeView.scope, "isActive", false) |
1506 | 103 | } | 105 | } |
1507 | 104 | 106 | ||
1508 | 105 | function test_showDash() { | 107 | function test_showDash() { |
1510 | 106 | testCase.previewListView.open = true; | 108 | testCase.subPageLoader.open = true; |
1511 | 107 | genericScopeView.scope.showDash(); | 109 | genericScopeView.scope.showDash(); |
1513 | 108 | tryCompare(testCase.previewListView, "open", false); | 110 | tryCompare(testCase.subPageLoader, "open", false); |
1514 | 109 | } | 111 | } |
1515 | 110 | 112 | ||
1516 | 111 | function test_hideDash() { | 113 | function test_hideDash() { |
1518 | 112 | testCase.previewListView.open = true; | 114 | testCase.subPageLoader.open = true; |
1519 | 113 | genericScopeView.scope.hideDash(); | 115 | genericScopeView.scope.hideDash(); |
1521 | 114 | tryCompare(testCase.previewListView, "open", false); | 116 | tryCompare(testCase.subPageLoader, "open", false); |
1522 | 115 | } | 117 | } |
1523 | 116 | 118 | ||
1524 | 117 | function test_searchQuery() { | 119 | function test_searchQuery() { |
1525 | @@ -214,7 +216,7 @@ | |||
1526 | 214 | 216 | ||
1527 | 215 | openPreview(4, 0); | 217 | openPreview(4, 0); |
1528 | 216 | 218 | ||
1530 | 217 | compare(testCase.previewListView.count, 12, "There should only be 12 items in preview."); | 219 | compare(testCase.subPageLoader.count, 12, "There should only be 12 items in preview."); |
1531 | 218 | 220 | ||
1532 | 219 | closePreview(); | 221 | closePreview(); |
1533 | 220 | } | 222 | } |
1534 | @@ -276,19 +278,21 @@ | |||
1535 | 276 | true); | 278 | true); |
1536 | 277 | var tile = findChild(findChild(genericScopeView, category), "delegate"+delegate); | 279 | var tile = findChild(findChild(genericScopeView, category), "delegate"+delegate); |
1537 | 278 | mouseClick(tile, tile.width / 2, tile.height / 2); | 280 | mouseClick(tile, tile.width / 2, tile.height / 2); |
1540 | 279 | tryCompare(testCase.previewListView, "open", true); | 281 | tryCompare(testCase.subPageLoader, "open", true); |
1541 | 280 | tryCompare(testCase.previewListView, "x", 0); | 282 | tryCompare(testCase.subPageLoader, "x", 0); |
1542 | 281 | } | 283 | } |
1543 | 282 | 284 | ||
1544 | 283 | function closePreview() { | 285 | function closePreview() { |
1546 | 284 | var closePreviewMouseArea = findChild(genericScopeView, "innerPageHeader"); | 286 | var closePreviewMouseArea = findChild(subPageLoader.item, "pageHeader"); |
1547 | 285 | mouseClick(closePreviewMouseArea, units.gu(2), units.gu(2)); | 287 | mouseClick(closePreviewMouseArea, units.gu(2), units.gu(2)); |
1548 | 286 | 288 | ||
1550 | 287 | tryCompare(testCase.previewListView, "open", false); | 289 | tryCompare(testCase.subPageLoader, "open", false); |
1551 | 290 | tryCompare(testCase.subPageLoader, "visible", false); | ||
1552 | 288 | } | 291 | } |
1553 | 289 | 292 | ||
1554 | 290 | function test_previewOpenClose() { | 293 | function test_previewOpenClose() { |
1556 | 291 | tryCompare(testCase.previewListView, "open", false); | 294 | tryCompare(testCase.subPageLoader, "open", false); |
1557 | 295 | tryCompare(testCase.subPageLoader, "visible", false); | ||
1558 | 292 | 296 | ||
1559 | 293 | var categoryListView = findChild(genericScopeView, "categoryListView"); | 297 | var categoryListView = findChild(genericScopeView, "categoryListView"); |
1560 | 294 | categoryListView.positionAtBeginning(); | 298 | categoryListView.positionAtBeginning(); |
1561 | @@ -300,7 +304,7 @@ | |||
1562 | 300 | function test_showPreviewCarousel() { | 304 | function test_showPreviewCarousel() { |
1563 | 301 | var category = scrollToCategory("dashCategory1"); | 305 | var category = scrollToCategory("dashCategory1"); |
1564 | 302 | 306 | ||
1566 | 303 | tryCompare(testCase.previewListView, "open", false); | 307 | tryCompare(testCase.subPageLoader, "open", false); |
1567 | 304 | 308 | ||
1568 | 305 | var tile = findChild(category, "carouselDelegate1"); | 309 | var tile = findChild(category, "carouselDelegate1"); |
1569 | 306 | verify(tile, "Could not find delegate"); | 310 | verify(tile, "Could not find delegate"); |
1570 | @@ -308,14 +312,14 @@ | |||
1571 | 308 | mouseClick(tile, tile.width / 2, tile.height / 2); | 312 | mouseClick(tile, tile.width / 2, tile.height / 2); |
1572 | 309 | tryCompare(tile, "explicitlyScaled", true); | 313 | tryCompare(tile, "explicitlyScaled", true); |
1573 | 310 | mouseClick(tile, tile.width / 2, tile.height / 2); | 314 | mouseClick(tile, tile.width / 2, tile.height / 2); |
1576 | 311 | tryCompare(testCase.previewListView, "open", true); | 315 | tryCompare(testCase.subPageLoader, "open", true); |
1577 | 312 | tryCompare(testCase.previewListView, "x", 0); | 316 | tryCompare(testCase.subPageLoader, "x", 0); |
1578 | 313 | 317 | ||
1579 | 314 | closePreview(); | 318 | closePreview(); |
1580 | 315 | 319 | ||
1581 | 316 | mousePress(tile, tile.width / 2, tile.height / 2); | 320 | mousePress(tile, tile.width / 2, tile.height / 2); |
1584 | 317 | tryCompare(testCase.previewListView, "open", true); | 321 | tryCompare(testCase.subPageLoader, "open", true); |
1585 | 318 | tryCompare(testCase.previewListView, "x", 0); | 322 | tryCompare(testCase.subPageLoader, "x", 0); |
1586 | 319 | mouseRelease(tile, tile.width / 2, tile.height / 2); | 323 | mouseRelease(tile, tile.width / 2, tile.height / 2); |
1587 | 320 | 324 | ||
1588 | 321 | closePreview(); | 325 | closePreview(); |
1589 | @@ -324,20 +328,20 @@ | |||
1590 | 324 | function test_showPreviewHorizontalList() { | 328 | function test_showPreviewHorizontalList() { |
1591 | 325 | var category = scrollToCategory("dashCategory18"); | 329 | var category = scrollToCategory("dashCategory18"); |
1592 | 326 | 330 | ||
1594 | 327 | tryCompare(testCase.previewListView, "open", false); | 331 | tryCompare(testCase.subPageLoader, "open", false); |
1595 | 328 | 332 | ||
1596 | 329 | var tile = findChild(category, "delegate1"); | 333 | var tile = findChild(category, "delegate1"); |
1597 | 330 | verify(tile, "Could not find delegate"); | 334 | verify(tile, "Could not find delegate"); |
1598 | 331 | 335 | ||
1599 | 332 | mouseClick(tile, tile.width / 2, tile.height / 2); | 336 | mouseClick(tile, tile.width / 2, tile.height / 2); |
1602 | 333 | tryCompare(testCase.previewListView, "open", true); | 337 | tryCompare(testCase.subPageLoader, "open", true); |
1603 | 334 | tryCompare(testCase.previewListView, "x", 0); | 338 | tryCompare(testCase.subPageLoader, "x", 0); |
1604 | 335 | 339 | ||
1605 | 336 | closePreview(); | 340 | closePreview(); |
1606 | 337 | 341 | ||
1607 | 338 | mousePress(tile, tile.width / 2, tile.height / 2); | 342 | mousePress(tile, tile.width / 2, tile.height / 2); |
1610 | 339 | tryCompare(testCase.previewListView, "open", true); | 343 | tryCompare(testCase.subPageLoader, "open", true); |
1611 | 340 | tryCompare(testCase.previewListView, "x", 0); | 344 | tryCompare(testCase.subPageLoader, "x", 0); |
1612 | 341 | mouseRelease(tile, tile.width / 2, tile.height / 2); | 345 | mouseRelease(tile, tile.width / 2, tile.height / 2); |
1613 | 342 | 346 | ||
1614 | 343 | closePreview(); | 347 | closePreview(); |
1615 | @@ -347,25 +351,52 @@ | |||
1616 | 347 | var categoryListView = findChild(genericScopeView, "categoryListView"); | 351 | var categoryListView = findChild(genericScopeView, "categoryListView"); |
1617 | 348 | categoryListView.positionAtBeginning(); | 352 | categoryListView.positionAtBeginning(); |
1618 | 349 | 353 | ||
1621 | 350 | tryCompare(testCase.previewListView, "open", false); | 354 | tryCompare(testCase.subPageLoader, "open", false); |
1620 | 351 | var previewListViewList = findChild(previewListView, "listView"); | ||
1622 | 352 | 355 | ||
1623 | 353 | openPreview(); | 356 | openPreview(); |
1624 | 357 | var previewListViewList = findChild(subPageLoader.item, "listView"); | ||
1625 | 354 | 358 | ||
1626 | 355 | // flick to the next previews | 359 | // flick to the next previews |
1631 | 356 | tryCompare(testCase.previewListView, "count", 15); | 360 | tryCompare(testCase.subPageLoader, "count", 15); |
1632 | 357 | for (var i = 1; i < testCase.previewListView.count; ++i) { | 361 | for (var i = 1; i < testCase.subPageLoader.count; ++i) { |
1633 | 358 | mouseFlick(testCase.previewListView, testCase.previewListView.width - units.gu(1), | 362 | mouseFlick(testCase.subPageLoader.item, testCase.subPageLoader.width - units.gu(1), |
1634 | 359 | testCase.previewListView.height / 2, | 363 | testCase.subPageLoader.height / 2, |
1635 | 360 | units.gu(2), | 364 | units.gu(2), |
1637 | 361 | testCase.previewListView.height / 2); | 365 | testCase.subPageLoader.height / 2); |
1638 | 362 | tryCompare(previewListViewList, "moving", false); | 366 | tryCompare(previewListViewList, "moving", false); |
1641 | 363 | tryCompare(testCase.previewListView.currentItem, "objectName", "preview" + i); | 367 | tryCompare(testCase.subPageLoader.currentItem, "objectName", "preview" + i); |
1640 | 364 | |||
1642 | 365 | } | 368 | } |
1643 | 366 | closePreview(); | 369 | closePreview(); |
1644 | 367 | } | 370 | } |
1645 | 368 | 371 | ||
1646 | 372 | function test_settingsOpenClose() { | ||
1647 | 373 | waitForRendering(genericScopeView); | ||
1648 | 374 | verify(header, "Could not find the header."); | ||
1649 | 375 | var innerHeader = findChild(header, "innerPageHeader"); | ||
1650 | 376 | verify(innerHeader, "Could not find the inner header"); | ||
1651 | 377 | |||
1652 | 378 | // open | ||
1653 | 379 | tryCompare(testCase.subPageLoader, "open", false); | ||
1654 | 380 | tryCompare(testCase.subPageLoader, "visible", false); | ||
1655 | 381 | var settings = findChild(innerHeader, "settings_header_button"); | ||
1656 | 382 | mouseClick(settings, settings.width / 2, settings.height / 2); | ||
1657 | 383 | tryCompare(testCase.subPageLoader, "open", true); | ||
1658 | 384 | tryCompareFunction(function() { return (String(subPageLoader.source)).indexOf("ScopeSettingsPage.qml") != -1; }, true); | ||
1659 | 385 | tryCompare(genericScopeView, "subPageShown", true); | ||
1660 | 386 | compare(testCase.subPageLoader.subPage, "settings"); | ||
1661 | 387 | tryCompare(testCase.subPageLoader, "x", 0); | ||
1662 | 388 | |||
1663 | 389 | // close | ||
1664 | 390 | var settingsHeader = findChild(testCase.subPageLoader.item, "pageHeader"); | ||
1665 | 391 | mouseClick(settingsHeader, units.gu(2), units.gu(2)); | ||
1666 | 392 | tryCompare(testCase.subPageLoader, "open", false); | ||
1667 | 393 | tryCompare(genericScopeView, "subPageShown", false); | ||
1668 | 394 | var categoryListView = findChild(genericScopeView, "categoryListView"); | ||
1669 | 395 | tryCompare(categoryListView, "x", 0); | ||
1670 | 396 | tryCompare(testCase.subPageLoader, "visible", false); | ||
1671 | 397 | tryCompare(testCase.subPageLoader, "source", ""); | ||
1672 | 398 | } | ||
1673 | 399 | |||
1674 | 369 | function test_header_style_data() { | 400 | function test_header_style_data() { |
1675 | 370 | return [ | 401 | return [ |
1676 | 371 | { tag: "Default", index: 0, foreground: UbuntuColors.darkGrey, background: "color:///#f5f5f5", logo: "" }, | 402 | { tag: "Default", index: 0, foreground: UbuntuColors.darkGrey, background: "color:///#f5f5f5", logo: "" }, |
FAILED: Continuous integration, rev:1113 jenkins. qa.ubuntu. com/job/ unity8- ci/3844/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/3273/ console jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- utopic/ 846/console jenkins. qa.ubuntu. com/job/ unity8- utopic- amd64-ci/ 938/console jenkins. qa.ubuntu. com/job/ unity8- utopic- armhf-ci/ 938/console jenkins. qa.ubuntu. com/job/ unity8- utopic- i386-ci/ 938/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/4518/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity8- ci/3844/ rebuild
http://