Merge lp:~stolowski/unity-api/filters-iface into lp:unity-api
- filters-iface
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~stolowski/unity-api/filters-iface |
Merge into: | lp:unity-api |
Diff against target: |
1158 lines (+763/-49) 22 files modified
debian/changelog (+7/-0) debian/control (+1/-0) include/unity/shell/scopes/CMakeLists.txt (+1/-1) include/unity/shell/scopes/FilterBaseInterface.h (+60/-0) include/unity/shell/scopes/FiltersInterface.h (+74/-0) include/unity/shell/scopes/NavigationInterface.h (+2/-0) include/unity/shell/scopes/OptionSelectorFilterInterface.h (+67/-0) include/unity/shell/scopes/OptionSelectorOptionsInterface.h (+66/-0) include/unity/shell/scopes/ScopeInterface.h (+38/-22) test/copyright/check_copyright.sh (+5/-0) test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt (+7/-0) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp (+2/-0) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.cpp (+51/-0) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.h (+40/-0) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.cpp (+57/-0) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.h (+45/-0) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp (+25/-17) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h (+7/-6) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.cpp (+53/-0) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.h (+36/-0) test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp (+8/-0) test/qmltest/unity/shell/scopes/tst_Scopes.qml (+111/-3) |
To merge this branch: | bzr merge lp:~stolowski/unity-api/filters-iface |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Albert Astals Cid (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Unity Team | Pending | ||
Review via email: mp+252890@code.launchpad.net |
This proposal has been superseded by a proposal from 2015-11-18.
Commit message
Base interfaces for filters.
Description of the change
Base interfaces for filters.
NOTE: Decided no to land yet till designs are closer to be finalized.
Paweł Stołowski (stolowski) wrote : | # |
> I'd say we need to rename the id property to filterId, QML doesn't like people
> taking the id keyword
>
> Q_PROPERTY(
> changed signal, otherwise QML will complain when i bind it to a property
Ok, done.
Albert Astals Cid (aacid) wrote : | # |
Actually i was wrong about the NOTIFY signal what it needed was a CONSTANT marker as do need it both of
Q_PROPERTY(QString filterId READ filterId)
Q_PROPERTY(QString filterType READ filterType)
Sorry i didn't realize before
Paweł Stołowski (stolowski) wrote : | # |
> Actually i was wrong about the NOTIFY signal what it needed was a CONSTANT
> marker as do need it both of
> Q_PROPERTY(QString filterId READ filterId)
> Q_PROPERTY(QString filterType READ filterType)
>
> Sorry i didn't realize before
No problem, updated.
Albert Astals Cid (aacid) wrote : | # |
Also make filterType property be an enum instead of a string as discussed on IRC?
Paweł Stołowski (stolowski) wrote : | # |
> Also make filterType property be an enum instead of a string as discussed on
> IRC?
Right.. thanks for catching it! Fixed.
Albert Astals Cid (aacid) wrote : | # |
New a few more Verifier { } added to tst_Scopes.qml to verify the mocks you created are actually returning the stuff it should
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:182
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:189
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
The Verifiers have been added, can't remember anything else more that i wanted fixed nor can see on checking the code.
Albert Astals Cid (aacid) wrote : | # |
Back to needs review since lots of things happened since may :D
Albert Astals Cid (aacid) wrote : | # |
You forgot a
>>>>>>> MERGE-SOURCE
in the changelog file
Albert Astals Cid (aacid) wrote : | # |
Should we remove the altNav* from here too?
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:193
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 194. By Paweł Stołowski
-
Merged all-label-role
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:194
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 195. By Paweł Stołowski
-
Removed unused alt nav properties/methods
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:195
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 196. By Paweł Stołowski
-
Fully-qualified filterType property
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:196
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 197. By Paweł Stołowski
-
Merged trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:197
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Looks good to me.
- 198. By Paweł Stołowski
-
Merged trunk
- 199. By Paweł Stołowski
-
Merged license-check
- 200. By Paweł Stołowski
-
Added title to filter base
- 201. By Paweł Stołowski
-
Method for resetting filters to defaults
- 202. By Paweł Stołowski
-
Merged trunk
- 203. By Paweł Stołowski
-
Merged trunk
- 204. By Paweł Stołowski
-
Merged trunk
- 205. By Paweł Stołowski
-
Merged trunk
- 206. By Paweł Stołowski
-
Merged trunk
- 207. By Paweł Stołowski
-
Bump
- 208. By Paweł Stołowski
-
Merged trunk
- 209. By Paweł Stołowski
-
Merged trunk
- 210. By Paweł Stołowski
-
Bump
- 211. By Paweł Stołowski
-
No changelog change:
Unmerged revisions
Preview Diff
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2015-11-02 11:23:43 +0000 | |||
3 | +++ debian/changelog 2015-11-17 14:58:53 +0000 | |||
4 | @@ -1,3 +1,10 @@ | |||
5 | 1 | unity-api (7.103+15.10.20150903-0ubuntu1) UNRELEASED; urgency=medium | ||
6 | 2 | |||
7 | 3 | * Added Filters interface. | ||
8 | 4 | * Added allLabel role to the scopes NavigationInterface. | ||
9 | 5 | |||
10 | 6 | -- Pawel Stolowski <pawel.stolowski@canonical.com> Mon, 28 Sep 2015 11:16:45 +0200 | ||
11 | 7 | |||
12 | 1 | unity-api (7.102+16.04.20151102-0ubuntu1) xenial; urgency=medium | 8 | unity-api (7.102+16.04.20151102-0ubuntu1) xenial; urgency=medium |
13 | 2 | 9 | ||
14 | 3 | [ Nick Dedekind ] | 10 | [ Nick Dedekind ] |
15 | 4 | 11 | ||
16 | === modified file 'debian/control' | |||
17 | --- debian/control 2015-07-20 09:35:04 +0000 | |||
18 | +++ debian/control 2015-11-17 14:58:53 +0000 | |||
19 | @@ -4,6 +4,7 @@ | |||
20 | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
21 | 5 | Build-Depends: cmake, | 5 | Build-Depends: cmake, |
22 | 6 | debhelper (>= 9), | 6 | debhelper (>= 9), |
23 | 7 | devscripts, | ||
24 | 7 | doxygen, | 8 | doxygen, |
25 | 8 | # To allow cross-compiling to work, we append :native | 9 | # To allow cross-compiling to work, we append :native |
26 | 9 | # to g++-4.9 so we don't try to run armhf g++ | 10 | # to g++-4.9 so we don't try to run armhf g++ |
27 | 10 | 11 | ||
28 | === modified file 'include/unity/shell/scopes/CMakeLists.txt' | |||
29 | --- include/unity/shell/scopes/CMakeLists.txt 2015-09-15 09:15:11 +0000 | |||
30 | +++ include/unity/shell/scopes/CMakeLists.txt 2015-11-17 14:58:53 +0000 | |||
31 | @@ -7,7 +7,7 @@ | |||
32 | 7 | 7 | ||
33 | 8 | set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) | 8 | set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) |
34 | 9 | 9 | ||
36 | 10 | set(VERSION 7) | 10 | set(VERSION 8) |
37 | 11 | set(PKGCONFIG_NAME "unity-shell-scopes") | 11 | set(PKGCONFIG_NAME "unity-shell-scopes") |
38 | 12 | set(PKGCONFIG_DESCRIPTION "Unity shell Scopes APIs") | 12 | set(PKGCONFIG_DESCRIPTION "Unity shell Scopes APIs") |
39 | 13 | set(PKGCONFIG_REQUIRES "Qt5Core") | 13 | set(PKGCONFIG_REQUIRES "Qt5Core") |
40 | 14 | 14 | ||
41 | === added file 'include/unity/shell/scopes/FilterBaseInterface.h' | |||
42 | --- include/unity/shell/scopes/FilterBaseInterface.h 1970-01-01 00:00:00 +0000 | |||
43 | +++ include/unity/shell/scopes/FilterBaseInterface.h 2015-11-17 14:58:53 +0000 | |||
44 | @@ -0,0 +1,60 @@ | |||
45 | 1 | /* | ||
46 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
47 | 3 | * | ||
48 | 4 | * This program is free software; you can redistribute it and/or modify | ||
49 | 5 | * it under the terms of the GNU General Public License as published by | ||
50 | 6 | * the Free Software Foundation; version 3. | ||
51 | 7 | * | ||
52 | 8 | * This program is distributed in the hope that it will be useful, | ||
53 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
54 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
55 | 11 | * GNU General Public License for more details. | ||
56 | 12 | * | ||
57 | 13 | * You should have received a copy of the GNU General Public License | ||
58 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
59 | 15 | */ | ||
60 | 16 | |||
61 | 17 | #ifndef UNITY_SHELL_SCOPES_FILTERBASEINTERHACE_H | ||
62 | 18 | #define UNITY_SHELL_SCOPES_FILTERBASEINTERHACE_H | ||
63 | 19 | |||
64 | 20 | #include "FiltersInterface.h" | ||
65 | 21 | #include <QObject> | ||
66 | 22 | |||
67 | 23 | namespace unity | ||
68 | 24 | { | ||
69 | 25 | namespace shell | ||
70 | 26 | { | ||
71 | 27 | namespace scopes | ||
72 | 28 | { | ||
73 | 29 | |||
74 | 30 | class UNITY_API FilterBaseInterface : public QObject | ||
75 | 31 | { | ||
76 | 32 | Q_OBJECT | ||
77 | 33 | |||
78 | 34 | public: | ||
79 | 35 | |||
80 | 36 | Q_PROPERTY(QString filterId READ filterId CONSTANT) | ||
81 | 37 | Q_PROPERTY(QString title READ title NOTIFY titleChanged) | ||
82 | 38 | Q_PROPERTY(unity::shell::scopes::FiltersInterface::FilterType filterType READ filterType CONSTANT) | ||
83 | 39 | |||
84 | 40 | virtual QString filterId() const = 0; | ||
85 | 41 | virtual QString title() const = 0; | ||
86 | 42 | virtual FiltersInterface::FilterType filterType() const = 0; | ||
87 | 43 | virtual QString filterTag() const = 0; | ||
88 | 44 | |||
89 | 45 | Q_SIGNALS: | ||
90 | 46 | void titleChanged(); | ||
91 | 47 | |||
92 | 48 | protected: | ||
93 | 49 | /// @cond | ||
94 | 50 | explicit FilterBaseInterface(QObject* parent = 0) : QObject(parent) {} | ||
95 | 51 | /// @endcond | ||
96 | 52 | }; | ||
97 | 53 | |||
98 | 54 | } | ||
99 | 55 | } | ||
100 | 56 | } | ||
101 | 57 | |||
102 | 58 | Q_DECLARE_METATYPE(unity::shell::scopes::FilterBaseInterface*) | ||
103 | 59 | |||
104 | 60 | #endif | ||
105 | 0 | 61 | ||
106 | === added file 'include/unity/shell/scopes/FiltersInterface.h' | |||
107 | --- include/unity/shell/scopes/FiltersInterface.h 1970-01-01 00:00:00 +0000 | |||
108 | +++ include/unity/shell/scopes/FiltersInterface.h 2015-11-17 14:58:53 +0000 | |||
109 | @@ -0,0 +1,74 @@ | |||
110 | 1 | /* | ||
111 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
112 | 3 | * | ||
113 | 4 | * This program is free software; you can redistribute it and/or modify | ||
114 | 5 | * it under the terms of the GNU General Public License as published by | ||
115 | 6 | * the Free Software Foundation; version 3. | ||
116 | 7 | * | ||
117 | 8 | * This program is distributed in the hope that it will be useful, | ||
118 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
119 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
120 | 11 | * GNU General Public License for more details. | ||
121 | 12 | * | ||
122 | 13 | * You should have received a copy of the GNU General Public License | ||
123 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
124 | 15 | */ | ||
125 | 16 | |||
126 | 17 | #ifndef UNITY_SHELL_SCOPES_FILTERSINTERFACE_H | ||
127 | 18 | #define UNITY_SHELL_SCOPES_FILTERSINTERFACE_H | ||
128 | 19 | |||
129 | 20 | #include <unity/SymbolExport.h> | ||
130 | 21 | |||
131 | 22 | #include <QAbstractListModel> | ||
132 | 23 | |||
133 | 24 | namespace unity | ||
134 | 25 | { | ||
135 | 26 | namespace shell | ||
136 | 27 | { | ||
137 | 28 | namespace scopes | ||
138 | 29 | { | ||
139 | 30 | |||
140 | 31 | class UNITY_API FiltersInterface : public QAbstractListModel | ||
141 | 32 | { | ||
142 | 33 | Q_OBJECT | ||
143 | 34 | |||
144 | 35 | Q_ENUMS(Roles) | ||
145 | 36 | Q_ENUMS(FilterType) | ||
146 | 37 | |||
147 | 38 | public: | ||
148 | 39 | enum Roles { | ||
149 | 40 | RoleFilterId = Qt::UserRole + 1, | ||
150 | 41 | RoleFilterType, | ||
151 | 42 | RoleFilter | ||
152 | 43 | }; | ||
153 | 44 | |||
154 | 45 | enum FilterType { | ||
155 | 46 | Invalid, | ||
156 | 47 | OptionSelectorFilter, | ||
157 | 48 | RangeInputFilter | ||
158 | 49 | // TODO add remaining filters | ||
159 | 50 | }; | ||
160 | 51 | |||
161 | 52 | QHash<int, QByteArray> roleNames() const override | ||
162 | 53 | { | ||
163 | 54 | QHash<int, QByteArray> roles; | ||
164 | 55 | roles[RoleFilterId] = "id"; | ||
165 | 56 | roles[RoleFilterType] = "type"; | ||
166 | 57 | roles[RoleFilter] = "filter"; | ||
167 | 58 | return roles; | ||
168 | 59 | } | ||
169 | 60 | |||
170 | 61 | protected: | ||
171 | 62 | /// @cond | ||
172 | 63 | explicit FiltersInterface(QObject* parent = 0) : QAbstractListModel(parent) {} | ||
173 | 64 | /// @endcond | ||
174 | 65 | }; | ||
175 | 66 | |||
176 | 67 | } | ||
177 | 68 | |||
178 | 69 | } | ||
179 | 70 | } | ||
180 | 71 | |||
181 | 72 | Q_DECLARE_METATYPE(unity::shell::scopes::FiltersInterface*) | ||
182 | 73 | |||
183 | 74 | #endif | ||
184 | 0 | 75 | ||
185 | === modified file 'include/unity/shell/scopes/NavigationInterface.h' | |||
186 | --- include/unity/shell/scopes/NavigationInterface.h 2014-08-04 13:58:53 +0000 | |||
187 | +++ include/unity/shell/scopes/NavigationInterface.h 2015-11-17 14:58:53 +0000 | |||
188 | @@ -94,6 +94,7 @@ | |||
189 | 94 | enum Roles { | 94 | enum Roles { |
190 | 95 | RoleNavigationId, | 95 | RoleNavigationId, |
191 | 96 | RoleLabel, | 96 | RoleLabel, |
192 | 97 | RoleAllLabel, | ||
193 | 97 | RoleHasChildren, | 98 | RoleHasChildren, |
194 | 98 | RoleIsActive | 99 | RoleIsActive |
195 | 99 | }; | 100 | }; |
196 | @@ -113,6 +114,7 @@ | |||
197 | 113 | QHash<int, QByteArray> roles; | 114 | QHash<int, QByteArray> roles; |
198 | 114 | roles[RoleNavigationId] = "navigationId"; | 115 | roles[RoleNavigationId] = "navigationId"; |
199 | 115 | roles[RoleLabel] = "label"; | 116 | roles[RoleLabel] = "label"; |
200 | 117 | roles[RoleAllLabel] = "allLabel"; | ||
201 | 116 | roles[RoleHasChildren] = "hasChildren"; | 118 | roles[RoleHasChildren] = "hasChildren"; |
202 | 117 | roles[RoleIsActive] = "isActive"; | 119 | roles[RoleIsActive] = "isActive"; |
203 | 118 | return roles; | 120 | return roles; |
204 | 119 | 121 | ||
205 | === added file 'include/unity/shell/scopes/OptionSelectorFilterInterface.h' | |||
206 | --- include/unity/shell/scopes/OptionSelectorFilterInterface.h 1970-01-01 00:00:00 +0000 | |||
207 | +++ include/unity/shell/scopes/OptionSelectorFilterInterface.h 2015-11-17 14:58:53 +0000 | |||
208 | @@ -0,0 +1,67 @@ | |||
209 | 1 | /* | ||
210 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
211 | 3 | * | ||
212 | 4 | * This program is free software; you can redistribute it and/or modify | ||
213 | 5 | * it under the terms of the GNU General Public License as published by | ||
214 | 6 | * the Free Software Foundation; version 3. | ||
215 | 7 | * | ||
216 | 8 | * This program is distributed in the hope that it will be useful, | ||
217 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
218 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
219 | 11 | * GNU General Public License for more details. | ||
220 | 12 | * | ||
221 | 13 | * You should have received a copy of the GNU General Public License | ||
222 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
223 | 15 | */ | ||
224 | 16 | |||
225 | 17 | #ifndef UNITY_SHELL_SCOPES_OPTIONSELECTORFILTERINTERFACE_H | ||
226 | 18 | #define UNITY_SHELL_SCOPES_OPTIONSELECTORFILTERINTERFACE_H | ||
227 | 19 | |||
228 | 20 | #include <unity/SymbolExport.h> | ||
229 | 21 | |||
230 | 22 | #include "FilterBaseInterface.h" | ||
231 | 23 | #include "OptionSelectorOptionsInterface.h" | ||
232 | 24 | |||
233 | 25 | namespace unity | ||
234 | 26 | { | ||
235 | 27 | namespace shell | ||
236 | 28 | { | ||
237 | 29 | namespace scopes | ||
238 | 30 | { | ||
239 | 31 | |||
240 | 32 | class UNITY_API OptionSelectorFilterInterface : public FilterBaseInterface | ||
241 | 33 | { | ||
242 | 34 | Q_OBJECT | ||
243 | 35 | |||
244 | 36 | public: | ||
245 | 37 | Q_PROPERTY(QString label READ label NOTIFY labelChanged) | ||
246 | 38 | Q_PROPERTY(bool multiSelect READ multiSelect NOTIFY multiSelectChanged) | ||
247 | 39 | Q_PROPERTY(unity::shell::scopes::OptionSelectorOptionsInterface* options READ options CONSTANT) | ||
248 | 40 | |||
249 | 41 | FiltersInterface::FilterType filterType() const override | ||
250 | 42 | { | ||
251 | 43 | return FiltersInterface::OptionSelectorFilter; | ||
252 | 44 | } | ||
253 | 45 | |||
254 | 46 | virtual QString label() const = 0; | ||
255 | 47 | virtual bool multiSelect() const = 0; | ||
256 | 48 | virtual OptionSelectorOptionsInterface* options() const = 0; | ||
257 | 49 | |||
258 | 50 | Q_SIGNALS: | ||
259 | 51 | void labelChanged(const QString&); | ||
260 | 52 | void multiSelectChanged(bool); | ||
261 | 53 | |||
262 | 54 | protected: | ||
263 | 55 | /// @cond | ||
264 | 56 | explicit OptionSelectorFilterInterface(QObject* parent = 0) : FilterBaseInterface(parent) {} | ||
265 | 57 | /// @endcond | ||
266 | 58 | }; | ||
267 | 59 | |||
268 | 60 | } | ||
269 | 61 | |||
270 | 62 | } | ||
271 | 63 | } | ||
272 | 64 | |||
273 | 65 | Q_DECLARE_METATYPE(unity::shell::scopes::OptionSelectorFilterInterface*) | ||
274 | 66 | |||
275 | 67 | #endif | ||
276 | 0 | 68 | ||
277 | === added file 'include/unity/shell/scopes/OptionSelectorOptionsInterface.h' | |||
278 | --- include/unity/shell/scopes/OptionSelectorOptionsInterface.h 1970-01-01 00:00:00 +0000 | |||
279 | +++ include/unity/shell/scopes/OptionSelectorOptionsInterface.h 2015-11-17 14:58:53 +0000 | |||
280 | @@ -0,0 +1,66 @@ | |||
281 | 1 | /* | ||
282 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
283 | 3 | * | ||
284 | 4 | * This program is free software; you can redistribute it and/or modify | ||
285 | 5 | * it under the terms of the GNU General Public License as published by | ||
286 | 6 | * the Free Software Foundation; version 3. | ||
287 | 7 | * | ||
288 | 8 | * This program is distributed in the hope that it will be useful, | ||
289 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
290 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
291 | 11 | * GNU General Public License for more details. | ||
292 | 12 | * | ||
293 | 13 | * You should have received a copy of the GNU General Public License | ||
294 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
295 | 15 | */ | ||
296 | 16 | |||
297 | 17 | #ifndef UNITY_SHELL_SCOPES_OPTIONSELECTOROPTIONSINTERFACE_H | ||
298 | 18 | #define UNITY_SHELL_SCOPES_OPTIONSELECTOROPTIONSINTERFACE_H | ||
299 | 19 | |||
300 | 20 | #include <unity/SymbolExport.h> | ||
301 | 21 | #include <QAbstractListModel> | ||
302 | 22 | |||
303 | 23 | namespace unity | ||
304 | 24 | { | ||
305 | 25 | namespace shell | ||
306 | 26 | { | ||
307 | 27 | namespace scopes | ||
308 | 28 | { | ||
309 | 29 | |||
310 | 30 | class UNITY_API OptionSelectorOptionsInterface : public QAbstractListModel | ||
311 | 31 | { | ||
312 | 32 | Q_OBJECT | ||
313 | 33 | |||
314 | 34 | Q_ENUMS(OptionRoles) | ||
315 | 35 | |||
316 | 36 | public: | ||
317 | 37 | enum Roles { | ||
318 | 38 | RoleOptionId = Qt::UserRole + 1, | ||
319 | 39 | RoleOptionLabel, | ||
320 | 40 | RoleOptionChecked | ||
321 | 41 | }; | ||
322 | 42 | |||
323 | 43 | Q_INVOKABLE virtual void setChecked(int index, bool checked) = 0; | ||
324 | 44 | |||
325 | 45 | QHash<int, QByteArray> roleNames() const override | ||
326 | 46 | { | ||
327 | 47 | QHash<int, QByteArray> roles; | ||
328 | 48 | roles[RoleOptionId] = "id"; | ||
329 | 49 | roles[RoleOptionLabel] = "label"; | ||
330 | 50 | roles[RoleOptionChecked] = "checked"; | ||
331 | 51 | return roles; | ||
332 | 52 | } | ||
333 | 53 | |||
334 | 54 | protected: | ||
335 | 55 | /// @cond | ||
336 | 56 | explicit OptionSelectorOptionsInterface(QObject* parent = 0) : QAbstractListModel(parent) {} | ||
337 | 57 | /// @endcond | ||
338 | 58 | }; | ||
339 | 59 | |||
340 | 60 | } | ||
341 | 61 | } | ||
342 | 62 | } | ||
343 | 63 | |||
344 | 64 | Q_DECLARE_METATYPE(unity::shell::scopes::OptionSelectorOptionsInterface*) | ||
345 | 65 | |||
346 | 66 | #endif | ||
347 | 0 | 67 | ||
348 | === modified file 'include/unity/shell/scopes/ScopeInterface.h' | |||
349 | --- include/unity/shell/scopes/ScopeInterface.h 2015-09-15 09:15:11 +0000 | |||
350 | +++ include/unity/shell/scopes/ScopeInterface.h 2015-11-17 14:58:53 +0000 | |||
351 | @@ -33,6 +33,8 @@ | |||
352 | 33 | class PreviewStackInterface; | 33 | class PreviewStackInterface; |
353 | 34 | class NavigationInterface; | 34 | class NavigationInterface; |
354 | 35 | class SettingsModelInterface; | 35 | class SettingsModelInterface; |
355 | 36 | class FiltersInterface; | ||
356 | 37 | class FilterBaseInterface; | ||
357 | 36 | 38 | ||
358 | 37 | /** | 39 | /** |
359 | 38 | * @brief Object representing scope instance, which exposes model(s) with results. | 40 | * @brief Object representing scope instance, which exposes model(s) with results. |
360 | @@ -93,6 +95,11 @@ | |||
361 | 93 | Q_PROPERTY(unity::shell::scopes::SettingsModelInterface* settings READ settings NOTIFY settingsChanged) | 95 | Q_PROPERTY(unity::shell::scopes::SettingsModelInterface* settings READ settings NOTIFY settingsChanged) |
362 | 94 | 96 | ||
363 | 95 | /** | 97 | /** |
364 | 98 | * @brief | ||
365 | 99 | */ | ||
366 | 100 | Q_PROPERTY(unity::shell::scopes::FilterBaseInterface* primaryNavigationFilter READ primaryNavigationFilter NOTIFY primaryNavigationFilterChanged) | ||
367 | 101 | |||
368 | 102 | /** | ||
369 | 96 | * @brief Current search query. | 103 | * @brief Current search query. |
370 | 97 | * | 104 | * |
371 | 98 | * Writing to this property issues a new search to the scope. | 105 | * Writing to this property issues a new search to the scope. |
372 | @@ -129,16 +136,6 @@ | |||
373 | 129 | Q_PROPERTY(bool hasNavigation READ hasNavigation NOTIFY hasNavigationChanged) | 136 | Q_PROPERTY(bool hasNavigation READ hasNavigation NOTIFY hasNavigationChanged) |
374 | 130 | 137 | ||
375 | 131 | /** | 138 | /** |
376 | 132 | * @brief String specifying currently selected sort order | ||
377 | 133 | */ | ||
378 | 134 | Q_PROPERTY(QString currentAltNavigationId READ currentAltNavigationId NOTIFY currentAltNavigationIdChanged) | ||
379 | 135 | |||
380 | 136 | /** | ||
381 | 137 | * @brief Boolean specifying whether current query has sort order. | ||
382 | 138 | */ | ||
383 | 139 | Q_PROPERTY(bool hasAltNavigation READ hasAltNavigation NOTIFY hasAltNavigationChanged) | ||
384 | 140 | |||
385 | 141 | /** | ||
386 | 142 | * @brief VariantMap with customization properties | 139 | * @brief VariantMap with customization properties |
387 | 143 | */ | 140 | */ |
388 | 144 | Q_PROPERTY(QVariantMap customizations READ customizations NOTIFY customizationsChanged) | 141 | Q_PROPERTY(QVariantMap customizations READ customizations NOTIFY customizationsChanged) |
389 | @@ -148,6 +145,21 @@ | |||
390 | 148 | */ | 145 | */ |
391 | 149 | Q_PROPERTY(unity::shell::scopes::ScopeInterface::Status status READ status NOTIFY statusChanged) | 146 | Q_PROPERTY(unity::shell::scopes::ScopeInterface::Status status READ status NOTIFY statusChanged) |
392 | 150 | 147 | ||
393 | 148 | /** | ||
394 | 149 | * @brief Filters model for the scope. | ||
395 | 150 | */ | ||
396 | 151 | Q_PROPERTY(unity::shell::scopes::FiltersInterface* filters READ filters NOTIFY filtersChanged) | ||
397 | 152 | |||
398 | 153 | /** | ||
399 | 154 | * @brief Label for the currently active top level navigation (department or primary filter). | ||
400 | 155 | */ | ||
401 | 156 | Q_PROPERTY(QString primaryNavigationTag READ primaryNavigationTag NOTIFY primaryNavigationTagChanged) | ||
402 | 157 | |||
403 | 158 | /** | ||
404 | 159 | * @brief The number of currently selected filters. | ||
405 | 160 | */ | ||
406 | 161 | Q_PROPERTY(int activeFiltersCount READ activeFiltersCount NOTIFY activeFiltersCountChanged) | ||
407 | 162 | |||
408 | 151 | protected: | 163 | protected: |
409 | 152 | /// @cond | 164 | /// @cond |
410 | 153 | explicit ScopeInterface(QObject* parent = 0) : QObject(parent) { } | 165 | explicit ScopeInterface(QObject* parent = 0) : QObject(parent) { } |
411 | @@ -176,16 +188,18 @@ | |||
412 | 176 | virtual bool favorite() const = 0; | 188 | virtual bool favorite() const = 0; |
413 | 177 | virtual CategoriesInterface* categories() const = 0; | 189 | virtual CategoriesInterface* categories() const = 0; |
414 | 178 | virtual SettingsModelInterface* settings() const = 0; | 190 | virtual SettingsModelInterface* settings() const = 0; |
415 | 191 | virtual FilterBaseInterface* primaryNavigationFilter() const = 0; | ||
416 | 179 | virtual QString searchQuery() const = 0; | 192 | virtual QString searchQuery() const = 0; |
417 | 180 | virtual QString noResultsHint() const = 0; | 193 | virtual QString noResultsHint() const = 0; |
418 | 181 | virtual QString formFactor() const = 0; | 194 | virtual QString formFactor() const = 0; |
419 | 182 | virtual bool isActive() const = 0; | 195 | virtual bool isActive() const = 0; |
420 | 183 | virtual QString currentNavigationId() const = 0; | 196 | virtual QString currentNavigationId() const = 0; |
421 | 184 | virtual bool hasNavigation() const = 0; | 197 | virtual bool hasNavigation() const = 0; |
422 | 185 | virtual QString currentAltNavigationId() const = 0; | ||
423 | 186 | virtual bool hasAltNavigation() const = 0; | ||
424 | 187 | virtual Status status() const = 0; | 198 | virtual Status status() const = 0; |
425 | 188 | virtual QVariantMap customizations() const = 0; | 199 | virtual QVariantMap customizations() const = 0; |
426 | 200 | virtual FiltersInterface* filters() const = 0; | ||
427 | 201 | virtual QString primaryNavigationTag() const = 0; | ||
428 | 202 | virtual int activeFiltersCount() const = 0; | ||
429 | 189 | 203 | ||
430 | 190 | /* setters */ | 204 | /* setters */ |
431 | 191 | virtual void setSearchQuery(const QString& search_query) = 0; | 205 | virtual void setSearchQuery(const QString& search_query) = 0; |
432 | @@ -224,14 +238,9 @@ | |||
433 | 224 | Q_INVOKABLE virtual unity::shell::scopes::NavigationInterface* getNavigation(QString const& navigationId) = 0; | 238 | Q_INVOKABLE virtual unity::shell::scopes::NavigationInterface* getNavigation(QString const& navigationId) = 0; |
434 | 225 | 239 | ||
435 | 226 | /** | 240 | /** |
444 | 227 | * @brief Get a NavigationInterface instance for the passed altNavigationId. | 241 | * @brief Request change to the current navigation id. |
445 | 228 | */ | 242 | */ |
446 | 229 | Q_INVOKABLE virtual unity::shell::scopes::NavigationInterface* getAltNavigation(QString const& altNavigationId) = 0; | 243 | Q_INVOKABLE virtual void setNavigationState(QString const& navId) = 0; |
439 | 230 | |||
440 | 231 | /** | ||
441 | 232 | * @brief Request change to the current navigation or altNavigation id. | ||
442 | 233 | */ | ||
443 | 234 | Q_INVOKABLE virtual void setNavigationState(QString const& navId, bool altNavigation) = 0; | ||
447 | 235 | 244 | ||
448 | 236 | /** | 245 | /** |
449 | 237 | * @brief Execute canned query. | 246 | * @brief Execute canned query. |
450 | @@ -243,6 +252,11 @@ | |||
451 | 243 | */ | 252 | */ |
452 | 244 | Q_INVOKABLE virtual void refresh() = 0; | 253 | Q_INVOKABLE virtual void refresh() = 0; |
453 | 245 | 254 | ||
454 | 255 | /** | ||
455 | 256 | * @brief Reset primary navigation filter and its tag in the search bar. | ||
456 | 257 | */ | ||
457 | 258 | Q_INVOKABLE virtual void resetPrimaryNavigationTag() = 0; | ||
458 | 259 | |||
459 | 246 | Q_SIGNALS: | 260 | Q_SIGNALS: |
460 | 247 | // @cond | 261 | // @cond |
461 | 248 | void idChanged(); | 262 | void idChanged(); |
462 | @@ -261,11 +275,13 @@ | |||
463 | 261 | void isActiveChanged(); | 275 | void isActiveChanged(); |
464 | 262 | void hasNavigationChanged(); | 276 | void hasNavigationChanged(); |
465 | 263 | void currentNavigationIdChanged(); | 277 | void currentNavigationIdChanged(); |
466 | 264 | void hasAltNavigationChanged(); | ||
467 | 265 | void currentAltNavigationIdChanged(); | ||
468 | 266 | void customizationsChanged(); | 278 | void customizationsChanged(); |
469 | 267 | void statusChanged(); | 279 | void statusChanged(); |
470 | 268 | void detailsChanged(); | 280 | void detailsChanged(); |
471 | 281 | void filtersChanged(); | ||
472 | 282 | void primaryNavigationTagChanged(); | ||
473 | 283 | void activeFiltersCountChanged(); | ||
474 | 284 | void primaryNavigationFilterChanged(); | ||
475 | 269 | // @endcond | 285 | // @endcond |
476 | 270 | 286 | ||
477 | 271 | // signals triggered by activate(..) or preview(..) requests. | 287 | // signals triggered by activate(..) or preview(..) requests. |
478 | 272 | 288 | ||
479 | === modified file 'test/copyright/check_copyright.sh' | |||
480 | --- test/copyright/check_copyright.sh 2013-06-26 23:47:34 +0000 | |||
481 | +++ test/copyright/check_copyright.sh 2015-11-17 14:58:53 +0000 | |||
482 | @@ -33,6 +33,11 @@ | |||
483 | 33 | [ $# -lt 1 ] && usage | 33 | [ $# -lt 1 ] && usage |
484 | 34 | [ $# -gt 2 ] && usage | 34 | [ $# -gt 2 ] && usage |
485 | 35 | 35 | ||
486 | 36 | |||
487 | 37 | # TODO: Temporary hack to work around broken licensecheck on xenial. Remove this once that is fixed. | ||
488 | 38 | distro=$(lsb_release -c -s) | ||
489 | 39 | [ "$distro" = "xenial" ] && exit 0 | ||
490 | 40 | |||
491 | 36 | ignore_pat="\\.sci$|CMakeFiles" | 41 | ignore_pat="\\.sci$|CMakeFiles" |
492 | 37 | 42 | ||
493 | 38 | # | 43 | # |
494 | 39 | 44 | ||
495 | === modified file 'test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt' | |||
496 | --- test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt 2014-07-25 15:17:40 +0000 | |||
497 | +++ test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt 2015-11-17 14:58:53 +0000 | |||
498 | @@ -20,7 +20,14 @@ | |||
499 | 20 | Mocks/MockScope.cpp | 20 | Mocks/MockScope.cpp |
500 | 21 | Mocks/MockScopes.cpp | 21 | Mocks/MockScopes.cpp |
501 | 22 | Mocks/MockSettingsModel.cpp | 22 | Mocks/MockSettingsModel.cpp |
502 | 23 | Mocks/MockFiltersModel.cpp | ||
503 | 24 | Mocks/MockOptionSelectorFilter.cpp | ||
504 | 25 | Mocks/MockSelectorOptions.cpp | ||
505 | 23 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/CategoriesInterface.h | 26 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/CategoriesInterface.h |
506 | 27 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/FiltersInterface.h | ||
507 | 28 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/FilterBaseInterface.h | ||
508 | 29 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/OptionSelectorFilterInterface.h | ||
509 | 30 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/OptionSelectorOptionsInterface.h | ||
510 | 24 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/NavigationInterface.h | 31 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/NavigationInterface.h |
511 | 25 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/ResultsModelInterface.h | 32 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/ResultsModelInterface.h |
512 | 26 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/PreviewModelInterface.h | 33 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/PreviewModelInterface.h |
513 | 27 | 34 | ||
514 | === modified file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp' | |||
515 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp 2014-08-04 13:58:53 +0000 | |||
516 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp 2015-11-17 14:58:53 +0000 | |||
517 | @@ -79,6 +79,8 @@ | |||
518 | 79 | return "child"; | 79 | return "child"; |
519 | 80 | case RoleLabel: | 80 | case RoleLabel: |
520 | 81 | return "Child Clothes"; | 81 | return "Child Clothes"; |
521 | 82 | case RoleAllLabel: | ||
522 | 83 | return "All Child Clothes"; | ||
523 | 82 | case RoleHasChildren: | 84 | case RoleHasChildren: |
524 | 83 | return true; | 85 | return true; |
525 | 84 | case RoleIsActive: | 86 | case RoleIsActive: |
526 | 85 | 87 | ||
527 | === added file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.cpp' | |||
528 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.cpp 1970-01-01 00:00:00 +0000 | |||
529 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.cpp 2015-11-17 14:58:53 +0000 | |||
530 | @@ -0,0 +1,51 @@ | |||
531 | 1 | /* | ||
532 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
533 | 3 | * | ||
534 | 4 | * This program is free software; you can redistribute it and/or modify | ||
535 | 5 | * it under the terms of the GNU General Public License as published by | ||
536 | 6 | * the Free Software Foundation; version 3. | ||
537 | 7 | * | ||
538 | 8 | * This program is distributed in the hope that it will be useful, | ||
539 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
540 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
541 | 11 | * GNU General Public License for more details. | ||
542 | 12 | * | ||
543 | 13 | * You should have received a copy of the GNU General Public License | ||
544 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
545 | 15 | */ | ||
546 | 16 | |||
547 | 17 | #include "MockFiltersModel.h" | ||
548 | 18 | #include "MockOptionSelectorFilter.h" | ||
549 | 19 | |||
550 | 20 | MockFiltersModel::MockFiltersModel(unity::shell::scopes::ScopeInterface *parent) | ||
551 | 21 | : unity::shell::scopes::FiltersInterface(parent) | ||
552 | 22 | { | ||
553 | 23 | MockOptionSelectorFilter *f = new MockOptionSelectorFilter("f1", "Filter 1", false, this); | ||
554 | 24 | m_filters.append(f); // owned by parent, so no need to manage it | ||
555 | 25 | } | ||
556 | 26 | |||
557 | 27 | QVariant MockFiltersModel::data(const QModelIndex& index, int role) const | ||
558 | 28 | { | ||
559 | 29 | if (index.row() >= 0 && index.row() < m_filters.count()) | ||
560 | 30 | { | ||
561 | 31 | auto filter = m_filters.at(index.row()); | ||
562 | 32 | switch (role) | ||
563 | 33 | { | ||
564 | 34 | case Qt::DisplayRole: | ||
565 | 35 | case unity::shell::scopes::FiltersInterface::RoleFilterId: | ||
566 | 36 | return QVariant(filter->filterId()); | ||
567 | 37 | case unity::shell::scopes::FiltersInterface::RoleFilterType: | ||
568 | 38 | return QVariant(static_cast<int>(filter->filterType())); | ||
569 | 39 | case unity::shell::scopes::FiltersInterface::RoleFilter: | ||
570 | 40 | return QVariant::fromValue(filter); | ||
571 | 41 | default: | ||
572 | 42 | return QVariant(); | ||
573 | 43 | } | ||
574 | 44 | } | ||
575 | 45 | return QVariant(); | ||
576 | 46 | } | ||
577 | 47 | |||
578 | 48 | int MockFiltersModel::rowCount(const QModelIndex&) const | ||
579 | 49 | { | ||
580 | 50 | return m_filters.count(); | ||
581 | 51 | } | ||
582 | 0 | 52 | ||
583 | === added file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.h' | |||
584 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.h 1970-01-01 00:00:00 +0000 | |||
585 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.h 2015-11-17 14:58:53 +0000 | |||
586 | @@ -0,0 +1,40 @@ | |||
587 | 1 | /* | ||
588 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
589 | 3 | * | ||
590 | 4 | * This program is free software; you can redistribute it and/or modify | ||
591 | 5 | * it under the terms of the GNU General Public License as published by | ||
592 | 6 | * the Free Software Foundation; version 3. | ||
593 | 7 | * | ||
594 | 8 | * This program is distributed in the hope that it will be useful, | ||
595 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
596 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
597 | 11 | * GNU General Public License for more details. | ||
598 | 12 | * | ||
599 | 13 | * You should have received a copy of the GNU General Public License | ||
600 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
601 | 15 | */ | ||
602 | 16 | |||
603 | 17 | #ifndef MOCKFILTERS_H | ||
604 | 18 | #define MOCKFILTERS_H | ||
605 | 19 | |||
606 | 20 | #include <unity/shell/scopes/FiltersInterface.h> | ||
607 | 21 | #include <unity/shell/scopes/FilterBaseInterface.h> | ||
608 | 22 | #include <unity/shell/scopes/ScopeInterface.h> | ||
609 | 23 | |||
610 | 24 | #include <QList> | ||
611 | 25 | |||
612 | 26 | class MockFiltersModel : public unity::shell::scopes::FiltersInterface | ||
613 | 27 | { | ||
614 | 28 | Q_OBJECT | ||
615 | 29 | |||
616 | 30 | public: | ||
617 | 31 | explicit MockFiltersModel(unity::shell::scopes::ScopeInterface *parent = 0); | ||
618 | 32 | |||
619 | 33 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||
620 | 34 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||
621 | 35 | |||
622 | 36 | private: | ||
623 | 37 | QList<unity::shell::scopes::FilterBaseInterface*> m_filters; | ||
624 | 38 | }; | ||
625 | 39 | |||
626 | 40 | #endif // MOCKDEPARTMENT_H | ||
627 | 0 | 41 | ||
628 | === added file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.cpp' | |||
629 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.cpp 1970-01-01 00:00:00 +0000 | |||
630 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.cpp 2015-11-17 14:58:53 +0000 | |||
631 | @@ -0,0 +1,57 @@ | |||
632 | 1 | /* | ||
633 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
634 | 3 | * | ||
635 | 4 | * This program is free software; you can redistribute it and/or modify | ||
636 | 5 | * it under the terms of the GNU General Public License as published by | ||
637 | 6 | * the Free Software Foundation; version 3. | ||
638 | 7 | * | ||
639 | 8 | * This program is distributed in the hope that it will be useful, | ||
640 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
641 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
642 | 11 | * GNU General Public License for more details. | ||
643 | 12 | * | ||
644 | 13 | * You should have received a copy of the GNU General Public License | ||
645 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
646 | 15 | */ | ||
647 | 16 | |||
648 | 17 | #include "MockOptionSelectorFilter.h" | ||
649 | 18 | |||
650 | 19 | MockOptionSelectorFilter::MockOptionSelectorFilter(const QString &id, const QString &title, const QString &label, bool multi, QObject *parent) | ||
651 | 20 | : unity::shell::scopes::OptionSelectorFilterInterface(parent), | ||
652 | 21 | m_id(id), | ||
653 | 22 | m_title(title), | ||
654 | 23 | m_label(label), | ||
655 | 24 | m_multiSelect(multi), | ||
656 | 25 | m_options(new MockSelectorOptions(2, this)) | ||
657 | 26 | { | ||
658 | 27 | } | ||
659 | 28 | |||
660 | 29 | QString MockOptionSelectorFilter::filterId() const | ||
661 | 30 | { | ||
662 | 31 | return m_id; | ||
663 | 32 | } | ||
664 | 33 | |||
665 | 34 | QString MockOptionSelectorFilter::title() const | ||
666 | 35 | { | ||
667 | 36 | return m_title; | ||
668 | 37 | } | ||
669 | 38 | |||
670 | 39 | QString MockOptionSelectorFilter::label() const | ||
671 | 40 | { | ||
672 | 41 | return m_label; | ||
673 | 42 | } | ||
674 | 43 | |||
675 | 44 | bool MockOptionSelectorFilter::multiSelect() const | ||
676 | 45 | { | ||
677 | 46 | return m_multiSelect; | ||
678 | 47 | } | ||
679 | 48 | |||
680 | 49 | unity::shell::scopes::OptionSelectorOptionsInterface* MockOptionSelectorFilter::options() const | ||
681 | 50 | { | ||
682 | 51 | return m_options; | ||
683 | 52 | } | ||
684 | 53 | |||
685 | 54 | QString MockOptionSelectorFilter::filterTag() const | ||
686 | 55 | { | ||
687 | 56 | return ""; | ||
688 | 57 | } | ||
689 | 0 | 58 | ||
690 | === added file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.h' | |||
691 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.h 1970-01-01 00:00:00 +0000 | |||
692 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.h 2015-11-17 14:58:53 +0000 | |||
693 | @@ -0,0 +1,45 @@ | |||
694 | 1 | /* | ||
695 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
696 | 3 | * | ||
697 | 4 | * This program is free software; you can redistribute it and/or modify | ||
698 | 5 | * it under the terms of the GNU General Public License as published by | ||
699 | 6 | * the Free Software Foundation; version 3. | ||
700 | 7 | * | ||
701 | 8 | * This program is distributed in the hope that it will be useful, | ||
702 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
703 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
704 | 11 | * GNU General Public License for more details. | ||
705 | 12 | * | ||
706 | 13 | * You should have received a copy of the GNU General Public License | ||
707 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
708 | 15 | */ | ||
709 | 16 | |||
710 | 17 | #ifndef MOCKOPTIONSELECTORFILTER_H | ||
711 | 18 | #define MOCKOPTIONSELECTORFILTER_H | ||
712 | 19 | |||
713 | 20 | #include <unity/shell/scopes/OptionSelectorFilterInterface.h> | ||
714 | 21 | #include <unity/shell/scopes/FiltersInterface.h> | ||
715 | 22 | #include "MockSelectorOptions.h" | ||
716 | 23 | |||
717 | 24 | class MockOptionSelectorFilter : public unity::shell::scopes::OptionSelectorFilterInterface | ||
718 | 25 | { | ||
719 | 26 | Q_OBJECT | ||
720 | 27 | |||
721 | 28 | public: | ||
722 | 29 | MockOptionSelectorFilter(const QString &id, const QString& title, const QString &label, bool multi, QObject *parent = 0); | ||
723 | 30 | QString filterId() const override; | ||
724 | 31 | QString title() const override; | ||
725 | 32 | QString label() const override; | ||
726 | 33 | bool multiSelect() const override; | ||
727 | 34 | unity::shell::scopes::OptionSelectorOptionsInterface* options() const override; | ||
728 | 35 | QString filterTag() const override; | ||
729 | 36 | |||
730 | 37 | private: | ||
731 | 38 | QString m_id; | ||
732 | 39 | QString m_title; | ||
733 | 40 | QString m_label; | ||
734 | 41 | bool m_multiSelect; | ||
735 | 42 | MockSelectorOptions *m_options; | ||
736 | 43 | }; | ||
737 | 44 | |||
738 | 45 | #endif | ||
739 | 0 | 46 | ||
740 | === modified file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp' | |||
741 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp 2015-09-15 09:15:11 +0000 | |||
742 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp 2015-11-17 14:58:53 +0000 | |||
743 | @@ -19,6 +19,7 @@ | |||
744 | 19 | #include "MockPreviewStack.h" | 19 | #include "MockPreviewStack.h" |
745 | 20 | #include "MockDepartment.h" | 20 | #include "MockDepartment.h" |
746 | 21 | #include "MockSettingsModel.h" | 21 | #include "MockSettingsModel.h" |
747 | 22 | #include "MockFiltersModel.h" | ||
748 | 22 | 23 | ||
749 | 23 | MockScope::MockScope(QObject* parent) : MockScope(QString(), QString(), parent) | 24 | MockScope::MockScope(QObject* parent) : MockScope(QString(), QString(), parent) |
750 | 24 | { | 25 | { |
751 | @@ -34,6 +35,7 @@ | |||
752 | 34 | , m_previewRendererName("preview-generic") | 35 | , m_previewRendererName("preview-generic") |
753 | 35 | , m_categories(new MockCategories(20, this)) | 36 | , m_categories(new MockCategories(20, this)) |
754 | 36 | , m_settings(new MockSettingsModel(this)) | 37 | , m_settings(new MockSettingsModel(this)) |
755 | 38 | , m_filters(new MockFiltersModel(this)) | ||
756 | 37 | { | 39 | { |
757 | 38 | } | 40 | } |
758 | 39 | 41 | ||
759 | @@ -69,10 +71,6 @@ | |||
760 | 69 | return m_currentDepartmentId; | 71 | return m_currentDepartmentId; |
761 | 70 | } | 72 | } |
762 | 71 | 73 | ||
763 | 72 | QString MockScope::currentAltNavigationId() const { | ||
764 | 73 | return m_currentAltDepartmentId; | ||
765 | 74 | } | ||
766 | 75 | |||
767 | 76 | bool MockScope::searchInProgress() const { | 74 | bool MockScope::searchInProgress() const { |
768 | 77 | return m_searching; | 75 | return m_searching; |
769 | 78 | } | 76 | } |
770 | @@ -85,6 +83,14 @@ | |||
771 | 85 | return m_settings; | 83 | return m_settings; |
772 | 86 | } | 84 | } |
773 | 87 | 85 | ||
774 | 86 | unity::shell::scopes::FiltersInterface* MockScope::filters() const { | ||
775 | 87 | return m_filters; | ||
776 | 88 | } | ||
777 | 89 | |||
778 | 90 | unity::shell::scopes::FilterBaseInterface* MockScope::primaryNavigationFilter() const { | ||
779 | 91 | return nullptr; | ||
780 | 92 | } | ||
781 | 93 | |||
782 | 88 | QString MockScope::noResultsHint() const { | 94 | QString MockScope::noResultsHint() const { |
783 | 89 | return m_noResultsHint; | 95 | return m_noResultsHint; |
784 | 90 | } | 96 | } |
785 | @@ -105,10 +111,6 @@ | |||
786 | 105 | return m_hasNavigation; | 111 | return m_hasNavigation; |
787 | 106 | } | 112 | } |
788 | 107 | 113 | ||
789 | 108 | bool MockScope::hasAltNavigation() const { | ||
790 | 109 | return m_hasAltNavigation; | ||
791 | 110 | } | ||
792 | 111 | |||
793 | 112 | QVariantMap MockScope::customizations() const { | 114 | QVariantMap MockScope::customizations() const { |
794 | 113 | return m_customizations; | 115 | return m_customizations; |
795 | 114 | } | 116 | } |
796 | @@ -182,17 +184,9 @@ | |||
797 | 182 | return new MockDepartment(); | 184 | return new MockDepartment(); |
798 | 183 | } | 185 | } |
799 | 184 | 186 | ||
808 | 185 | unity::shell::scopes::NavigationInterface* MockScope::getAltNavigation(QString const& navigationId) | 187 | void MockScope::setNavigationState(QString const& navId) |
801 | 186 | { | ||
802 | 187 | Q_UNUSED(navigationId); | ||
803 | 188 | |||
804 | 189 | return new MockDepartment(); | ||
805 | 190 | } | ||
806 | 191 | |||
807 | 192 | void MockScope::setNavigationState(QString const& navId, bool altNavigation) | ||
809 | 193 | { | 188 | { |
810 | 194 | Q_UNUSED(navId); | 189 | Q_UNUSED(navId); |
811 | 195 | Q_UNUSED(altNavigation); | ||
812 | 196 | } | 190 | } |
813 | 197 | 191 | ||
814 | 198 | void MockScope::cancelActivation() | 192 | void MockScope::cancelActivation() |
815 | @@ -212,3 +206,17 @@ | |||
816 | 212 | void MockScope::refresh() | 206 | void MockScope::refresh() |
817 | 213 | { | 207 | { |
818 | 214 | } | 208 | } |
819 | 209 | |||
820 | 210 | QString MockScope::primaryNavigationTag() const | ||
821 | 211 | { | ||
822 | 212 | return ""; | ||
823 | 213 | } | ||
824 | 214 | |||
825 | 215 | void MockScope::resetPrimaryNavigationTag() | ||
826 | 216 | { | ||
827 | 217 | } | ||
828 | 218 | |||
829 | 219 | int MockScope::activeFiltersCount() const | ||
830 | 220 | { | ||
831 | 221 | return 0; | ||
832 | 222 | } | ||
833 | 215 | 223 | ||
834 | === modified file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h' | |||
835 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h 2015-09-15 09:15:11 +0000 | |||
836 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h 2015-11-17 14:58:53 +0000 | |||
837 | @@ -38,16 +38,18 @@ | |||
838 | 38 | bool searchInProgress() const override; | 38 | bool searchInProgress() const override; |
839 | 39 | unity::shell::scopes::CategoriesInterface* categories() const override; | 39 | unity::shell::scopes::CategoriesInterface* categories() const override; |
840 | 40 | unity::shell::scopes::SettingsModelInterface* settings() const override; | 40 | unity::shell::scopes::SettingsModelInterface* settings() const override; |
841 | 41 | unity::shell::scopes::FiltersInterface* filters() const override; | ||
842 | 42 | unity::shell::scopes::FilterBaseInterface* primaryNavigationFilter() const override; | ||
843 | 41 | QString searchQuery() const override; | 43 | QString searchQuery() const override; |
844 | 42 | QString noResultsHint() const override; | 44 | QString noResultsHint() const override; |
845 | 43 | QString formFactor() const override; | 45 | QString formFactor() const override; |
846 | 44 | bool isActive() const override; | 46 | bool isActive() const override; |
847 | 45 | bool hasNavigation() const override; | 47 | bool hasNavigation() const override; |
848 | 46 | QString currentNavigationId() const override; | 48 | QString currentNavigationId() const override; |
849 | 47 | bool hasAltNavigation() const override; | ||
850 | 48 | QString currentAltNavigationId() const override; | ||
851 | 49 | QVariantMap customizations() const override; | 49 | QVariantMap customizations() const override; |
852 | 50 | Status status() const override; | 50 | Status status() const override; |
853 | 51 | QString primaryNavigationTag() const override; | ||
854 | 52 | int activeFiltersCount() const override; | ||
855 | 51 | 53 | ||
856 | 52 | /* setters */ | 54 | /* setters */ |
857 | 53 | void setName(const QString& name); | 55 | void setName(const QString& name); |
858 | @@ -62,10 +64,10 @@ | |||
859 | 62 | Q_INVOKABLE void cancelActivation() override; | 64 | Q_INVOKABLE void cancelActivation() override; |
860 | 63 | Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override; | 65 | Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override; |
861 | 64 | Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& departmentId) override; | 66 | Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& departmentId) override; |
864 | 65 | Q_INVOKABLE unity::shell::scopes::NavigationInterface* getAltNavigation(QString const& departmentId) override; | 67 | Q_INVOKABLE void setNavigationState(QString const& navId) override; |
863 | 66 | Q_INVOKABLE void setNavigationState(QString const& navId, bool altNavigation) override; | ||
865 | 67 | Q_INVOKABLE void performQuery(QString const& cannedQuery) override; | 68 | Q_INVOKABLE void performQuery(QString const& cannedQuery) override; |
866 | 68 | Q_INVOKABLE void refresh() override; | 69 | Q_INVOKABLE void refresh() override; |
867 | 70 | Q_INVOKABLE void resetPrimaryNavigationTag() override; | ||
868 | 69 | 71 | ||
869 | 70 | protected: | 72 | protected: |
870 | 71 | QString m_id; | 73 | QString m_id; |
871 | @@ -76,18 +78,17 @@ | |||
872 | 76 | QString m_noResultsHint; | 78 | QString m_noResultsHint; |
873 | 77 | QString m_formFactor; | 79 | QString m_formFactor; |
874 | 78 | QString m_currentDepartmentId; | 80 | QString m_currentDepartmentId; |
875 | 79 | QString m_currentAltDepartmentId; | ||
876 | 80 | bool m_favorite; | 81 | bool m_favorite; |
877 | 81 | bool m_searching; | 82 | bool m_searching; |
878 | 82 | bool m_isActive; | 83 | bool m_isActive; |
879 | 83 | bool m_hasNavigation; | 84 | bool m_hasNavigation; |
880 | 84 | bool m_hasAltNavigation; | ||
881 | 85 | QVariantMap m_customizations; | 85 | QVariantMap m_customizations; |
882 | 86 | 86 | ||
883 | 87 | QString m_previewRendererName; | 87 | QString m_previewRendererName; |
884 | 88 | 88 | ||
885 | 89 | unity::shell::scopes::CategoriesInterface* m_categories; | 89 | unity::shell::scopes::CategoriesInterface* m_categories; |
886 | 90 | unity::shell::scopes::SettingsModelInterface* m_settings; | 90 | unity::shell::scopes::SettingsModelInterface* m_settings; |
887 | 91 | unity::shell::scopes::FiltersInterface* m_filters; | ||
888 | 91 | }; | 92 | }; |
889 | 92 | 93 | ||
890 | 93 | #endif | 94 | #endif |
891 | 94 | 95 | ||
892 | === added file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.cpp' | |||
893 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.cpp 1970-01-01 00:00:00 +0000 | |||
894 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.cpp 2015-11-17 14:58:53 +0000 | |||
895 | @@ -0,0 +1,53 @@ | |||
896 | 1 | /* | ||
897 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
898 | 3 | * | ||
899 | 4 | * This program is free software; you can redistribute it and/or modify | ||
900 | 5 | * it under the terms of the GNU General Public License as published by | ||
901 | 6 | * the Free Software Foundation; version 3. | ||
902 | 7 | * | ||
903 | 8 | * This program is distributed in the hope that it will be useful, | ||
904 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
905 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
906 | 11 | * GNU General Public License for more details. | ||
907 | 12 | * | ||
908 | 13 | * You should have received a copy of the GNU General Public License | ||
909 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
910 | 15 | */ | ||
911 | 16 | |||
912 | 17 | #include "MockSelectorOptions.h" | ||
913 | 18 | |||
914 | 19 | MockSelectorOptions::MockSelectorOptions(int num, QObject *parent) | ||
915 | 20 | : unity::shell::scopes::OptionSelectorOptionsInterface(parent), | ||
916 | 21 | m_numOfOptions(num) | ||
917 | 22 | { | ||
918 | 23 | } | ||
919 | 24 | |||
920 | 25 | QVariant MockSelectorOptions::data(const QModelIndex& index, int role) const | ||
921 | 26 | { | ||
922 | 27 | if (index.row() >= 0 && index.row() < m_numOfOptions) | ||
923 | 28 | { | ||
924 | 29 | switch (role) | ||
925 | 30 | { | ||
926 | 31 | case unity::shell::scopes::OptionSelectorOptionsInterface::RoleOptionId: | ||
927 | 32 | return QVariant(QString("option") + QString::number(index.row())); | ||
928 | 33 | case Qt::DisplayRole: | ||
929 | 34 | case unity::shell::scopes::OptionSelectorOptionsInterface::RoleOptionLabel: | ||
930 | 35 | return QVariant(QString("Option") + QString::number(index.row())); | ||
931 | 36 | case unity::shell::scopes::OptionSelectorOptionsInterface::RoleOptionChecked: | ||
932 | 37 | return QVariant(false); | ||
933 | 38 | default: | ||
934 | 39 | return QVariant(); | ||
935 | 40 | } | ||
936 | 41 | } | ||
937 | 42 | return QVariant(); | ||
938 | 43 | } | ||
939 | 44 | |||
940 | 45 | int MockSelectorOptions::rowCount(const QModelIndex&) const | ||
941 | 46 | { | ||
942 | 47 | return m_numOfOptions; | ||
943 | 48 | } | ||
944 | 49 | |||
945 | 50 | void MockSelectorOptions::setChecked(int, bool) | ||
946 | 51 | { | ||
947 | 52 | qFatal("Using un-implemented setChecked() method"); | ||
948 | 53 | } | ||
949 | 0 | 54 | ||
950 | === added file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.h' | |||
951 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.h 1970-01-01 00:00:00 +0000 | |||
952 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.h 2015-11-17 14:58:53 +0000 | |||
953 | @@ -0,0 +1,36 @@ | |||
954 | 1 | /* | ||
955 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
956 | 3 | * | ||
957 | 4 | * This program is free software; you can redistribute it and/or modify | ||
958 | 5 | * it under the terms of the GNU General Public License as published by | ||
959 | 6 | * the Free Software Foundation; version 3. | ||
960 | 7 | * | ||
961 | 8 | * This program is distributed in the hope that it will be useful, | ||
962 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
963 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
964 | 11 | * GNU General Public License for more details. | ||
965 | 12 | * | ||
966 | 13 | * You should have received a copy of the GNU General Public License | ||
967 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
968 | 15 | */ | ||
969 | 16 | |||
970 | 17 | #ifndef MOCKOPTIONSELECTOROPTIONS_H | ||
971 | 18 | #define MOCKOPTIONSELECTOROPTIONS_H | ||
972 | 19 | |||
973 | 20 | #include <unity/shell/scopes/OptionSelectorOptionsInterface.h> | ||
974 | 21 | |||
975 | 22 | class MockSelectorOptions : public unity::shell::scopes::OptionSelectorOptionsInterface | ||
976 | 23 | { | ||
977 | 24 | Q_OBJECT | ||
978 | 25 | |||
979 | 26 | public: | ||
980 | 27 | MockSelectorOptions(int num = 2, QObject *parent = 0); | ||
981 | 28 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||
982 | 29 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||
983 | 30 | void setChecked(int index, bool checked) override; | ||
984 | 31 | |||
985 | 32 | private: | ||
986 | 33 | int m_numOfOptions; | ||
987 | 34 | }; | ||
988 | 35 | |||
989 | 36 | #endif | ||
990 | 0 | 37 | ||
991 | === modified file 'test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp' | |||
992 | --- test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp 2014-07-25 15:17:40 +0000 | |||
993 | +++ test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp 2015-11-17 14:58:53 +0000 | |||
994 | @@ -26,6 +26,10 @@ | |||
995 | 26 | #include "PreviewWidgetModelInterface.h" | 26 | #include "PreviewWidgetModelInterface.h" |
996 | 27 | #include "PreviewStackInterface.h" | 27 | #include "PreviewStackInterface.h" |
997 | 28 | #include "SettingsModelInterface.h" | 28 | #include "SettingsModelInterface.h" |
998 | 29 | #include "FiltersInterface.h" | ||
999 | 30 | #include "FilterBaseInterface.h" | ||
1000 | 31 | #include "OptionSelectorOptionsInterface.h" | ||
1001 | 32 | #include "OptionSelectorFilterInterface.h" | ||
1002 | 29 | #include "Mocks/MockScopes.h" | 33 | #include "Mocks/MockScopes.h" |
1003 | 30 | #include "Mocks/MockScope.h" | 34 | #include "Mocks/MockScope.h" |
1004 | 31 | 35 | ||
1005 | @@ -40,4 +44,8 @@ | |||
1006 | 40 | qmlRegisterUncreatableType<unity::shell::scopes::PreviewWidgetModelInterface>(uri, 0, 2, "PreviewWidgetModel", "Can't create new PreviewWidgetModel in QML. Get them from PreviewModel instance."); | 44 | qmlRegisterUncreatableType<unity::shell::scopes::PreviewWidgetModelInterface>(uri, 0, 2, "PreviewWidgetModel", "Can't create new PreviewWidgetModel in QML. Get them from PreviewModel instance."); |
1007 | 41 | qmlRegisterUncreatableType<unity::shell::scopes::PreviewStackInterface>(uri, 0, 2, "PreviewStack", "Can't create new PreviewStack in QML. Get them from Scope instance."); | 45 | qmlRegisterUncreatableType<unity::shell::scopes::PreviewStackInterface>(uri, 0, 2, "PreviewStack", "Can't create new PreviewStack in QML. Get them from Scope instance."); |
1008 | 42 | qmlRegisterUncreatableType<unity::shell::scopes::SettingsModelInterface>(uri, 0, 2, "Settings", "Can't create new Settings in QML. Get them from Scope instance."); | 46 | qmlRegisterUncreatableType<unity::shell::scopes::SettingsModelInterface>(uri, 0, 2, "Settings", "Can't create new Settings in QML. Get them from Scope instance."); |
1009 | 47 | qmlRegisterUncreatableType<unity::shell::scopes::FilterBaseInterface>(uri, 0, 2, "FilterBase", "Can't create new Filter in QML. Get them from Filters instance."); | ||
1010 | 48 | qmlRegisterUncreatableType<unity::shell::scopes::FiltersInterface>(uri, 0, 2, "Filters", "Can't create new Filters in QML. Get them from Scope instance."); | ||
1011 | 49 | qmlRegisterUncreatableType<unity::shell::scopes::OptionSelectorOptionsInterface>(uri, 0, 2, "OptionSelectorOptions", "Can't create new OptionSelectorOptions in QML. Get them from OptionSelectorFilter instance."); | ||
1012 | 50 | qmlRegisterUncreatableType<unity::shell::scopes::OptionSelectorFilterInterface>(uri, 0, 2, "OptionSelectorFilter", "Can't create new OptionSelectorFilter in QML. Get them from Scope instance."); | ||
1013 | 43 | } | 51 | } |
1014 | 44 | 52 | ||
1015 | === modified file 'test/qmltest/unity/shell/scopes/tst_Scopes.qml' | |||
1016 | --- test/qmltest/unity/shell/scopes/tst_Scopes.qml 2015-09-15 09:15:11 +0000 | |||
1017 | +++ test/qmltest/unity/shell/scopes/tst_Scopes.qml 2015-11-17 14:58:53 +0000 | |||
1018 | @@ -122,14 +122,13 @@ | |||
1019 | 122 | { tag: "Item.properties[favorite]", constant: "favorite", type: "boolean" }, | 122 | { tag: "Item.properties[favorite]", constant: "favorite", type: "boolean" }, |
1020 | 123 | { tag: "Item.properties[shortcut]", constant: "shortcut", type: "string" }, | 123 | { tag: "Item.properties[shortcut]", constant: "shortcut", type: "string" }, |
1021 | 124 | { tag: "Item.properties[categories]", constant: "categories", type: "object" }, | 124 | { tag: "Item.properties[categories]", constant: "categories", type: "object" }, |
1022 | 125 | { tag: "Item.properties[filters]", constant: "filters", type: "object" }, | ||
1023 | 125 | { tag: "Item.properties[searchQuery]", constant: "searchQuery", type: "string" }, | 126 | { tag: "Item.properties[searchQuery]", constant: "searchQuery", type: "string" }, |
1024 | 126 | { tag: "Item.properties[noResultsHint]", constant: "noResultsHint", type: "string" }, | 127 | { tag: "Item.properties[noResultsHint]", constant: "noResultsHint", type: "string" }, |
1025 | 127 | { tag: "Item.properties[formFactor]", constant: "formFactor", type: "string" }, | 128 | { tag: "Item.properties[formFactor]", constant: "formFactor", type: "string" }, |
1026 | 128 | { tag: "Item.properties[isActive]", constant: "isActive", type: "boolean" }, | 129 | { tag: "Item.properties[isActive]", constant: "isActive", type: "boolean" }, |
1027 | 129 | { tag: "Item.properties[currentNavigationId]", constant: "currentNavigationId", type: "string" }, | 130 | { tag: "Item.properties[currentNavigationId]", constant: "currentNavigationId", type: "string" }, |
1028 | 130 | { tag: "Item.properties[hasNavigation]", constant: "hasNavigation", type: "boolean" }, | 131 | { tag: "Item.properties[hasNavigation]", constant: "hasNavigation", type: "boolean" }, |
1029 | 131 | { tag: "Item.properties[currentAltNavigationId]", constant: "currentAltNavigationId", type: "string" }, | ||
1030 | 132 | { tag: "Item.properties[hasAltNavigation]", constant: "hasAltNavigation", type: "boolean" }, | ||
1031 | 133 | { tag: "Item.properties[customizations]", constant: "customizations", type: "object" }, | 132 | { tag: "Item.properties[customizations]", constant: "customizations", type: "object" }, |
1032 | 134 | { tag: "Item.properties[status]", constant: "status", type: "number" } | 133 | { tag: "Item.properties[status]", constant: "status", type: "number" } |
1033 | 135 | ]; | 134 | ]; |
1034 | @@ -156,7 +155,6 @@ | |||
1035 | 156 | { tag: "Model.methods[performQuery]", method: "performQuery" }, | 155 | { tag: "Model.methods[performQuery]", method: "performQuery" }, |
1036 | 157 | { tag: "Model.methods[refresh]", method: "refresh" }, | 156 | { tag: "Model.methods[refresh]", method: "refresh" }, |
1037 | 158 | { tag: "Model.methods[getNavigation]", method: "getNavigation" }, | 157 | { tag: "Model.methods[getNavigation]", method: "getNavigation" }, |
1038 | 159 | { tag: "Model.methods[getAltNavigation]", method: "getAltNavigation" }, | ||
1039 | 160 | { tag: "Model.methods[setNavigationState]", method: "setNavigationState" }, | 158 | { tag: "Model.methods[setNavigationState]", method: "setNavigationState" }, |
1040 | 161 | ]; | 159 | ]; |
1041 | 162 | } | 160 | } |
1042 | @@ -169,6 +167,116 @@ | |||
1043 | 169 | } | 167 | } |
1044 | 170 | 168 | ||
1045 | 171 | Verifier { | 169 | Verifier { |
1046 | 170 | id: filtersVerifier | ||
1047 | 171 | |||
1048 | 172 | Repeater { | ||
1049 | 173 | id: filtersRepeater | ||
1050 | 174 | model: root.scope.filters | ||
1051 | 175 | delegate: Item { | ||
1052 | 176 | property var roles: model | ||
1053 | 177 | } | ||
1054 | 178 | } | ||
1055 | 179 | |||
1056 | 180 | function test_filters(data) { | ||
1057 | 181 | object = filtersRepeater.model; | ||
1058 | 182 | name = "Filters"; | ||
1059 | 183 | verifyData(data); | ||
1060 | 184 | } | ||
1061 | 185 | |||
1062 | 186 | function test_filters_data() { | ||
1063 | 187 | return [ | ||
1064 | 188 | { tag: "Filters[object]", type: "object" }, | ||
1065 | 189 | { tag: "Filters[FiltersInterface]", type: "unity::shell::scopes::FiltersInterface" }, | ||
1066 | 190 | ]; | ||
1067 | 191 | } | ||
1068 | 192 | |||
1069 | 193 | function test_filters_roles(data) { | ||
1070 | 194 | object = filtersRepeater.itemAt(0).roles; | ||
1071 | 195 | name = "Filters"; | ||
1072 | 196 | verifyData(data); | ||
1073 | 197 | } | ||
1074 | 198 | |||
1075 | 199 | function test_filters_roles_data() { | ||
1076 | 200 | return [ | ||
1077 | 201 | { tag: "Model.roles[id]", role: "id", type: "string" }, | ||
1078 | 202 | { tag: "Model.roles[type]", role: "type", type: "number" }, | ||
1079 | 203 | { tag: "Model.roles[filter]", role: "filter", type: "unity::shell::scopes::FilterBaseInterface" }, | ||
1080 | 204 | ]; | ||
1081 | 205 | } | ||
1082 | 206 | } | ||
1083 | 207 | |||
1084 | 208 | Verifier { | ||
1085 | 209 | id: optionSelectorFilterVerifier | ||
1086 | 210 | |||
1087 | 211 | function test_option_selector_filter(data) { | ||
1088 | 212 | object = filtersRepeater.itemAt(0).roles.filter; | ||
1089 | 213 | name = "Filter"; | ||
1090 | 214 | verifyData(data); | ||
1091 | 215 | } | ||
1092 | 216 | |||
1093 | 217 | function test_option_selector_filter_data() { | ||
1094 | 218 | return [ | ||
1095 | 219 | { tag: "Filter[object]", type: "object" }, | ||
1096 | 220 | { tag: "Filter[OptionSelectorFilterInterface]", type: "unity::shell::scopes::OptionSelectorFilterInterface" }, | ||
1097 | 221 | ]; | ||
1098 | 222 | } | ||
1099 | 223 | |||
1100 | 224 | function test_option_selector_filter_properties_data() { | ||
1101 | 225 | return [ | ||
1102 | 226 | { tag: "Filter.properties[filterId]", constant: "filterId", type: "string" }, | ||
1103 | 227 | { tag: "Filter.properties[label]", constant: "label", type: "string" }, | ||
1104 | 228 | { tag: "Filter.properties[multiSelect]", constant: "multiSelect", type: "boolean" }, | ||
1105 | 229 | { tag: "Filter.properties[options]", constant: "options", type: "object" }, | ||
1106 | 230 | ]; | ||
1107 | 231 | } | ||
1108 | 232 | |||
1109 | 233 | function test_option_selector_filter_properties(data) { | ||
1110 | 234 | object = filtersRepeater.itemAt(0).roles.filter; | ||
1111 | 235 | name = "Filter"; | ||
1112 | 236 | verifyData(data); | ||
1113 | 237 | } | ||
1114 | 238 | |||
1115 | 239 | function test_options_data() { | ||
1116 | 240 | return [ | ||
1117 | 241 | { tag: "Options[object]", type: "object" }, | ||
1118 | 242 | { tag: "Options[OptionSelectorOptionsInterface]", type: "unity::shell::scopes::OptionSelectorOptionsInterface" }, | ||
1119 | 243 | ]; | ||
1120 | 244 | } | ||
1121 | 245 | |||
1122 | 246 | function test_options(data) { | ||
1123 | 247 | object = filtersRepeater.itemAt(0).roles.filter.options; | ||
1124 | 248 | name = "Options"; | ||
1125 | 249 | verifyData(data); | ||
1126 | 250 | } | ||
1127 | 251 | } | ||
1128 | 252 | |||
1129 | 253 | Verifier { | ||
1130 | 254 | id: optionSelectorFilterOptionsVerifier | ||
1131 | 255 | |||
1132 | 256 | Repeater { | ||
1133 | 257 | id: optionsRepeater | ||
1134 | 258 | model: filtersRepeater.count > 0 ? filtersRepeater.itemAt(0).roles.filter.options : undefined | ||
1135 | 259 | delegate: Item { | ||
1136 | 260 | property var roles: model | ||
1137 | 261 | } | ||
1138 | 262 | } | ||
1139 | 263 | |||
1140 | 264 | function test_option_selector_filter_options_roles_data() { | ||
1141 | 265 | return [ | ||
1142 | 266 | { tag: "Model.roles[id]", role: "id", type: "string" }, | ||
1143 | 267 | { tag: "Model.roles[label]", role: "label", type: "string" }, | ||
1144 | 268 | { tag: "Model.roles[checked]", role: "checked", type: "boolean" }, | ||
1145 | 269 | ]; | ||
1146 | 270 | } | ||
1147 | 271 | |||
1148 | 272 | function test_option_selector_filter_options_roles(data) { | ||
1149 | 273 | object = optionsRepeater.itemAt(0).roles; | ||
1150 | 274 | name = "Options"; | ||
1151 | 275 | verifyData(data); | ||
1152 | 276 | } | ||
1153 | 277 | } | ||
1154 | 278 | |||
1155 | 279 | Verifier { | ||
1156 | 172 | id: categoriesVerifier | 280 | id: categoriesVerifier |
1157 | 173 | 281 | ||
1158 | 174 | Repeater { | 282 | Repeater { |
I'd say we need to rename the id property to filterId, QML doesn't like people taking the id keyword
Q_PROPERTY( OptionSelectorO ptionsInterface * options READ options) needs a changed signal, otherwise QML will complain when i bind it to a property