Merge lp:~stolowski/unity-api/filters-iface into lp:unity-api

Proposed by Paweł Stołowski on 2015-03-13
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
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) 2015-03-25 Approve on 2015-11-04
PS Jenkins bot continuous-integration Approve on 2015-10-26
Unity Team 2015-03-13 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.

To post a comment you must log in.
Albert Astals Cid (aacid) wrote :

I'd say we need to rename the id property to filterId, QML doesn't like people taking the id keyword

Q_PROPERTY(OptionSelectorOptionsInterface* options READ options) needs a changed signal, otherwise QML will complain when i bind it to a property

review: Needs Fixing
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(OptionSelectorOptionsInterface* options READ options) needs a
> 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

review: Needs Fixing
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?

review: Needs Fixing
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

review: Needs Fixing
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.

review: Approve
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

review: Needs Fixing
Albert Astals Cid (aacid) wrote :

Should we remove the altNav* from here too?

review: Needs Information
194. By Paweł Stołowski on 2015-09-28

Merged all-label-role

195. By Paweł Stołowski on 2015-09-29

Removed unused alt nav properties/methods

196. By Paweł Stołowski on 2015-10-09

Fully-qualified filterType property

197. By Paweł Stołowski on 2015-10-26

Merged trunk

Albert Astals Cid (aacid) wrote :

Looks good to me.

review: Approve
198. By Paweł Stołowski on 2015-11-06

Merged trunk

199. By Paweł Stołowski on 2015-11-16

Merged license-check

200. By Paweł Stołowski on 2015-11-17

Added title to filter base

201. By Paweł Stołowski on 2015-11-23

Method for resetting filters to defaults

202. By Paweł Stołowski on 2015-11-23

Merged trunk

203. By Paweł Stołowski on 2015-11-25

Merged trunk

204. By Paweł Stołowski on 2015-12-08

Merged trunk

205. By Paweł Stołowski on 2015-12-15

Merged trunk

206. By Paweł Stołowski on 2016-01-11

Merged trunk

207. By Paweł Stołowski on 2016-01-11

Bump

208. By Paweł Stołowski on 2016-02-19

Merged trunk

209. By Paweł Stołowski on 2016-03-07

Merged trunk

210. By Paweł Stołowski on 2016-03-07

Bump

211. By Paweł Stołowski on 2016-03-11

No changelog change:

Unmerged revisions

Preview Diff

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

Subscribers

People subscribed via source and target branches

to all changes: