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