From 98cb672c269f9619b092b4f9a88069bc847aa85d Mon Sep 17 00:00:00 2001 From: Marius Gripsgard Date: Sat, 27 Apr 2019 00:11:54 +0200 Subject: [PATCH] Kill scope api and clean up (#12) This kills the scope api part, and also does some cleanups. --- .bzr-builddeb/default.conf | 2 - .bzrignore => .gitignore | 1 + CMakeLists.txt | 2 +- CTestCustom.cmake.in | 4 - debian/control | 4 +- ...ity-api0.install => libunity-api1.install} | 0 include/unity/shell/CMakeLists.txt | 1 - include/unity/shell/scopes/CMakeLists.txt | 22 - .../unity/shell/scopes/CategoriesInterface.h | 95 --- .../scopes/ExpandableFilterWidgetInterface.h | 59 -- .../unity/shell/scopes/FilterBaseInterface.h | 60 -- include/unity/shell/scopes/FiltersInterface.h | 75 --- .../unity/shell/scopes/NavigationInterface.h | 143 ---- .../scopes/OptionSelectorFilterInterface.h | 67 -- .../scopes/OptionSelectorOptionsInterface.h | 65 -- .../shell/scopes/PreviewModelInterface.h | 113 ---- .../scopes/PreviewWidgetModelInterface.h | 74 --- .../shell/scopes/RangeInputFilterInterface.h | 90 --- .../shell/scopes/ResultsModelInterface.h | 118 ---- include/unity/shell/scopes/ScopeInterface.h | 349 ---------- include/unity/shell/scopes/ScopesInterface.h | 130 ---- .../shell/scopes/SettingsModelInterface.h | 91 --- .../shell/scopes/ValueSliderFilterInterface.h | 73 --- .../shell/scopes/ValueSliderValuesInterface.h | 61 -- src/CMakeLists.txt | 2 +- src/unity/api/CMakeLists.txt | 1 - src/unity/api/scopes/CMakeLists.txt | 6 - src/unity/api/scopes/internal/CMakeLists.txt | 4 - test/copyright/check_copyright.sh | 2 +- test/gtest/unity/CMakeLists.txt | 1 - test/gtest/unity/scopes/CMakeLists.txt | 0 test/qmltest/mocks/CMakeLists.txt | 1 - .../mocks/plugins/Unity/Scopes/CMakeLists.txt | 57 -- .../Unity/Scopes/Mocks/MockCategories.cpp | 88 --- .../Unity/Scopes/Mocks/MockCategories.h | 44 -- .../Unity/Scopes/Mocks/MockDepartment.cpp | 91 --- .../Unity/Scopes/Mocks/MockDepartment.h | 46 -- .../Unity/Scopes/Mocks/MockFiltersModel.cpp | 51 -- .../Unity/Scopes/Mocks/MockFiltersModel.h | 40 -- .../Scopes/Mocks/MockOptionSelectorFilter.cpp | 57 -- .../Scopes/Mocks/MockOptionSelectorFilter.h | 45 -- .../Unity/Scopes/Mocks/MockPreviewModel.cpp | 73 --- .../Unity/Scopes/Mocks/MockPreviewModel.h | 45 -- .../Scopes/Mocks/MockPreviewWidgetModel.cpp | 68 -- .../Scopes/Mocks/MockPreviewWidgetModel.h | 41 -- .../Unity/Scopes/Mocks/MockResultsModel.cpp | 75 --- .../Unity/Scopes/Mocks/MockResultsModel.h | 46 -- .../plugins/Unity/Scopes/Mocks/MockScope.cpp | 237 ------- .../plugins/Unity/Scopes/Mocks/MockScope.h | 97 --- .../plugins/Unity/Scopes/Mocks/MockScopes.cpp | 99 --- .../plugins/Unity/Scopes/Mocks/MockScopes.h | 55 -- .../Scopes/Mocks/MockSelectorOptions.cpp | 53 -- .../Unity/Scopes/Mocks/MockSelectorOptions.h | 36 - .../Unity/Scopes/Mocks/MockSettingsModel.cpp | 101 --- .../Unity/Scopes/Mocks/MockSettingsModel.h | 65 -- .../plugins/Unity/Scopes/TestScopesPlugin.cpp | 51 -- .../plugins/Unity/Scopes/TestScopesPlugin.h | 32 - .../qmltest/mocks/plugins/Unity/Scopes/qmldir | 2 - test/qmltest/unity/shell/CMakeLists.txt | 1 - .../qmltest/unity/shell/scopes/tst_Scopes.qml | 617 ------------------ 60 files changed, 6 insertions(+), 4023 deletions(-) delete mode 100644 .bzr-builddeb/default.conf rename .bzrignore => .gitignore (95%) rename debian/{libunity-api0.install => libunity-api1.install} (100%) delete mode 100644 include/unity/shell/scopes/CMakeLists.txt delete mode 100644 include/unity/shell/scopes/CategoriesInterface.h delete mode 100644 include/unity/shell/scopes/ExpandableFilterWidgetInterface.h delete mode 100644 include/unity/shell/scopes/FilterBaseInterface.h delete mode 100644 include/unity/shell/scopes/FiltersInterface.h delete mode 100644 include/unity/shell/scopes/NavigationInterface.h delete mode 100644 include/unity/shell/scopes/OptionSelectorFilterInterface.h delete mode 100644 include/unity/shell/scopes/OptionSelectorOptionsInterface.h delete mode 100644 include/unity/shell/scopes/PreviewModelInterface.h delete mode 100644 include/unity/shell/scopes/PreviewWidgetModelInterface.h delete mode 100644 include/unity/shell/scopes/RangeInputFilterInterface.h delete mode 100644 include/unity/shell/scopes/ResultsModelInterface.h delete mode 100644 include/unity/shell/scopes/ScopeInterface.h delete mode 100644 include/unity/shell/scopes/ScopesInterface.h delete mode 100644 include/unity/shell/scopes/SettingsModelInterface.h delete mode 100644 include/unity/shell/scopes/ValueSliderFilterInterface.h delete mode 100644 include/unity/shell/scopes/ValueSliderValuesInterface.h delete mode 100644 src/unity/api/scopes/CMakeLists.txt delete mode 100644 src/unity/api/scopes/internal/CMakeLists.txt delete mode 100644 test/gtest/unity/scopes/CMakeLists.txt delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockCategories.cpp delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockCategories.h delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.h delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.cpp delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.h delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.cpp delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.h delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewModel.cpp delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewModel.h delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewWidgetModel.cpp delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewWidgetModel.h delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockResultsModel.cpp delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockResultsModel.h delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.cpp delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.h delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.cpp delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.h delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSettingsModel.cpp delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSettingsModel.h delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.h delete mode 100644 test/qmltest/mocks/plugins/Unity/Scopes/qmldir delete mode 100644 test/qmltest/unity/shell/scopes/tst_Scopes.qml diff --git a/.bzr-builddeb/default.conf b/.bzr-builddeb/default.conf deleted file mode 100644 index 6c96a98..0000000 --- a/.bzr-builddeb/default.conf +++ /dev/null @@ -1,2 +0,0 @@ -[BUILDDEB] -split = True diff --git a/.bzrignore b/.gitignore similarity index 95% rename from .bzrignore rename to .gitignore index ab4e30a..cf4a539 100644 --- a/.bzrignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.cproject /.settings /.pydevproject +*.qmlc \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 593fa52..a2bc931 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,7 +125,7 @@ endif() # API version set(UNITY_API_MAJOR 0) set(UNITY_API_MINOR 1) -set(UNITY_API_MICRO 6) +set(UNITY_API_MICRO 7) set(UNITY_API_VERSION "${UNITY_API_MAJOR}.${UNITY_API_MINOR}.${UNITY_API_MICRO}") # API library diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index e9d74b4..526e290 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -8,16 +8,12 @@ SET(CTEST_CUSTOM_MEMCHECK_IGNORE stand-alone-unity-internal-headers stand-alone-unity-api-headers stand-alone-unity-api-internal-headers - stand-alone-unity-scopes-headers - stand-alone-unity-scopes-internal-headers stand-alone-unity-util-headers stand-alone-unity-util-internal-headers clean-public-unity-headers clean-public-unity-internal-headers clean-public-unity-api-headers clean-public-unity-api-internal-headers - clean-public-unity-scopes-headers - clean-public-unity-scopes-internal-headers clean-public-unity-util-headers clean-public-unity-util-internal-headers copyright diff --git a/debian/control b/debian/control index 998ac8a..66a6d18 100644 --- a/debian/control +++ b/debian/control @@ -31,7 +31,7 @@ Homepage: https://launchpad.net/unity-api Vcs-Bzr: lp:unity-api Vcs-Browser: https://code.launchpad.net/unity-api -Package: libunity-api0 +Package: libunity-api1 Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends}, @@ -44,7 +44,7 @@ Package: libunity-api-dev Section: libdevel Architecture: any Multi-Arch: same -Depends: libunity-api0 (= ${binary:Version}), +Depends: libunity-api1 (= ${binary:Version}), ${misc:Depends}, Description: Header files for Unity API Library to integrate with the Unity shell (dev files) diff --git a/debian/libunity-api0.install b/debian/libunity-api1.install similarity index 100% rename from debian/libunity-api0.install rename to debian/libunity-api1.install diff --git a/include/unity/shell/CMakeLists.txt b/include/unity/shell/CMakeLists.txt index 1df5e6f..df52450 100644 --- a/include/unity/shell/CMakeLists.txt +++ b/include/unity/shell/CMakeLists.txt @@ -1,7 +1,6 @@ add_subdirectory(notifications) add_subdirectory(launcher) add_subdirectory(application) -add_subdirectory(scopes) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") diff --git a/include/unity/shell/scopes/CMakeLists.txt b/include/unity/shell/scopes/CMakeLists.txt deleted file mode 100644 index e4a6268..0000000 --- a/include/unity/shell/scopes/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -set(INCLUDE_INSTALL_DIR include/unity/shell/scopes) - -file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") -file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") - -install(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}) - -set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) - -set(VERSION 12) -set(PKGCONFIG_NAME "unity-shell-scopes") -set(PKGCONFIG_DESCRIPTION "Unity shell Scopes APIs") -set(PKGCONFIG_REQUIRES "Qt5Core") -set(PKGCONFIG_FILE unity-shell-scopes.pc) - -configure_file(${CMAKE_SOURCE_DIR}/data/unity-shell-api.pc.in - ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} @ONLY -) - -install(FILES ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig -) diff --git a/include/unity/shell/scopes/CategoriesInterface.h b/include/unity/shell/scopes/CategoriesInterface.h deleted file mode 100644 index 0bc434e..0000000 --- a/include/unity/shell/scopes/CategoriesInterface.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_CATEGORESINTERFACE_H -#define UNITY_SHELL_SCOPES_CATEGORESINTERFACE_H - -#include - -#include - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -/** - * @brief A list of categories for a particular search. - * - * This model exposes all categories and their properties (including the results model - * itself) associated with a particular search. - */ -class UNITY_API CategoriesInterface : public QAbstractListModel -{ - Q_OBJECT - -protected: - /// @cond - explicit CategoriesInterface(QObject* parent = 0) : QAbstractListModel(parent) { } - /// @endcond - -public: - /** - * @brief The roles supported by this model. - */ - enum Roles { - RoleCategoryId, - RoleName, - RoleIcon, - RoleRawRendererTemplate, - RoleRenderer, - RoleComponents, - RoleHeaderLink, - RoleResults, - RoleCount - }; - Q_ENUM(Roles) - - /** - * @brief Override definition of a category by passing a custom JSON string. - * - * A method that helps with scope development, where the renderer definition can - * be overridden from within the shell. - */ - Q_INVOKABLE virtual bool overrideCategoryJson(QString const& categoryId, QString const& json) = 0; - - // @cond - QHash roleNames() const override - { - QHash roles; - roles[RoleCategoryId] = "categoryId"; - roles[RoleName] = "name"; - roles[RoleIcon] = "icon"; - roles[RoleRawRendererTemplate] = "rawRendererTemplate"; - roles[RoleRenderer] = "renderer"; - roles[RoleComponents] = "components"; - roles[RoleHeaderLink] = "headerLink"; - roles[RoleResults] = "results"; - roles[RoleCount] = "count"; - return roles; - } - // @endcond -}; - -} -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::CategoriesInterface*) - -#endif diff --git a/include/unity/shell/scopes/ExpandableFilterWidgetInterface.h b/include/unity/shell/scopes/ExpandableFilterWidgetInterface.h deleted file mode 100644 index 387681f..0000000 --- a/include/unity/shell/scopes/ExpandableFilterWidgetInterface.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2016 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_EXPANDABLEFILTERWIDGETINTERFACE_H -#define UNITY_SHELL_SCOPES_EXPANDABLEFILTERWIDGETINTERFACE_H - -#include - -#include "FilterBaseInterface.h" -#include "FiltersInterface.h" - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -class UNITY_API ExpandableFilterWidgetInterface : public FilterBaseInterface -{ - Q_OBJECT - -public: - Q_PROPERTY(unity::shell::scopes::FiltersInterface* filters READ filters CONSTANT) - - FiltersInterface::FilterType filterType() const override - { - return FiltersInterface::ExpandableFilterWidget; - } - - virtual FiltersInterface* filters() const = 0; - -protected: - /// @cond - explicit ExpandableFilterWidgetInterface(QObject* parent = 0) : FilterBaseInterface(parent) {} - /// @endcond -}; - -} - -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::ExpandableFilterWidgetInterface *) - -#endif diff --git a/include/unity/shell/scopes/FilterBaseInterface.h b/include/unity/shell/scopes/FilterBaseInterface.h deleted file mode 100644 index 1c546e9..0000000 --- a/include/unity/shell/scopes/FilterBaseInterface.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_FILTERBASEINTERHACE_H -#define UNITY_SHELL_SCOPES_FILTERBASEINTERHACE_H - -#include "FiltersInterface.h" -#include - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -class UNITY_API FilterBaseInterface : public QObject -{ - Q_OBJECT - - public: - - Q_PROPERTY(QString filterId READ filterId CONSTANT) - Q_PROPERTY(QString title READ title NOTIFY titleChanged) - Q_PROPERTY(unity::shell::scopes::FiltersInterface::FilterType filterType READ filterType CONSTANT) - - virtual QString filterId() const = 0; - virtual QString title() const = 0; - virtual FiltersInterface::FilterType filterType() const = 0; - virtual QString filterTag() const = 0; - - Q_SIGNALS: - void titleChanged(); - - protected: - /// @cond - explicit FilterBaseInterface(QObject* parent = 0) : QObject(parent) {} - /// @endcond -}; - -} -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::FilterBaseInterface*) - -#endif diff --git a/include/unity/shell/scopes/FiltersInterface.h b/include/unity/shell/scopes/FiltersInterface.h deleted file mode 100644 index ec40137..0000000 --- a/include/unity/shell/scopes/FiltersInterface.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_FILTERSINTERFACE_H -#define UNITY_SHELL_SCOPES_FILTERSINTERFACE_H - -#include - -#include - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -class UNITY_API FiltersInterface : public QAbstractListModel -{ - Q_OBJECT - -public: - enum Roles { - RoleFilterId = Qt::UserRole + 1, - RoleFilterType, - RoleFilter - }; - Q_ENUM(Roles) - - enum FilterType { - Invalid, - OptionSelectorFilter, - RangeInputFilter, - ValueSliderFilter, - ExpandableFilterWidget - // TODO add remaining filters - }; - Q_ENUM(FilterType) - - QHash roleNames() const override - { - QHash roles; - roles[RoleFilterId] = "id"; - roles[RoleFilterType] = "type"; - roles[RoleFilter] = "filter"; - return roles; - } - -protected: - /// @cond - explicit FiltersInterface(QObject* parent = 0) : QAbstractListModel(parent) {} - /// @endcond -}; - -} - -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::FiltersInterface*) - -#endif diff --git a/include/unity/shell/scopes/NavigationInterface.h b/include/unity/shell/scopes/NavigationInterface.h deleted file mode 100644 index a1021af..0000000 --- a/include/unity/shell/scopes/NavigationInterface.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_NAVIGATIONINTERFACE_H -#define UNITY_SHELL_SCOPES_NAVIGATIONINTERFACE_H - -#include - -#include - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -/** - * @brief Object representing department instance, which exposes model(s) with results. - */ -class UNITY_API NavigationInterface : public QAbstractListModel -{ - Q_OBJECT - - /** - * @brief Id of the navigation. - */ - Q_PROPERTY(QString navigationId READ navigationId NOTIFY navigationIdChanged) - - /** - * @brief Label of the navigation. - */ - Q_PROPERTY(QString label READ label NOTIFY labelChanged) - - /** - * @brief Label for "All Button" of the navigation. - */ - Q_PROPERTY(QString allLabel READ allLabel NOTIFY allLabelChanged) - - /** - * @brief Parent Id of the navigation. - */ - Q_PROPERTY(QString parentNavigationId READ parentNavigationId NOTIFY parentNavigationIdChanged) - - /** - * @brief Parent label of the navigation. - */ - Q_PROPERTY(QString parentLabel READ parentLabel NOTIFY parentLabelChanged) - - /** - * @brief Is the model of the navigation completely loaded? - */ - Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged) - - /** - * @brief Is this deparment the root navigation? - */ - Q_PROPERTY(bool isRoot READ isRoot NOTIFY isRootChanged) - - /** - * @brief Is this a hidden navigation? - */ - Q_PROPERTY(bool hidden READ hidden NOTIFY hiddenChanged) - - /** - * @brief Number of items of the navigation. - */ - Q_PROPERTY(int count READ count NOTIFY countChanged) - -protected: - /// @cond - explicit NavigationInterface(QObject* parent = 0) : QAbstractListModel(parent) { } - /// @endcond - -public: - /** - * @brief The roles supported by this model. - */ - enum Roles { - RoleNavigationId, - RoleLabel, - RoleAllLabel, - RoleHasChildren, - RoleIsActive - }; - Q_ENUM(Roles) - - // @cond - virtual QString navigationId() const = 0; - virtual QString label() const = 0; - virtual QString allLabel() const = 0; - virtual QString parentNavigationId() const = 0; - virtual QString parentLabel() const = 0; - virtual bool loaded() const = 0; - virtual bool isRoot() const = 0; - virtual bool hidden() const = 0; - virtual int count() const = 0; - QHash roleNames() const override - { - QHash roles; - roles[RoleNavigationId] = "navigationId"; - roles[RoleLabel] = "label"; - roles[RoleAllLabel] = "allLabel"; - roles[RoleHasChildren] = "hasChildren"; - roles[RoleIsActive] = "isActive"; - return roles; - } - // @endcond - -Q_SIGNALS: - // @cond - void navigationIdChanged(); - void labelChanged(); - void allLabelChanged(); - void parentNavigationIdChanged(); - void parentLabelChanged(); - void loadedChanged(); - void isRootChanged(); - void hiddenChanged(); - void countChanged(); - // @endcond -}; - -} -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::NavigationInterface*) - -#endif diff --git a/include/unity/shell/scopes/OptionSelectorFilterInterface.h b/include/unity/shell/scopes/OptionSelectorFilterInterface.h deleted file mode 100644 index 78acbd7..0000000 --- a/include/unity/shell/scopes/OptionSelectorFilterInterface.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_OPTIONSELECTORFILTERINTERFACE_H -#define UNITY_SHELL_SCOPES_OPTIONSELECTORFILTERINTERFACE_H - -#include - -#include "FilterBaseInterface.h" -#include "OptionSelectorOptionsInterface.h" - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -class UNITY_API OptionSelectorFilterInterface : public FilterBaseInterface -{ - Q_OBJECT - -public: - Q_PROPERTY(QString label READ label NOTIFY labelChanged) - Q_PROPERTY(bool multiSelect READ multiSelect NOTIFY multiSelectChanged) - Q_PROPERTY(unity::shell::scopes::OptionSelectorOptionsInterface* options READ options CONSTANT) - - FiltersInterface::FilterType filterType() const override - { - return FiltersInterface::OptionSelectorFilter; - } - - virtual QString label() const = 0; - virtual bool multiSelect() const = 0; - virtual OptionSelectorOptionsInterface* options() const = 0; - -Q_SIGNALS: - void labelChanged(const QString&); - void multiSelectChanged(bool); - -protected: - /// @cond - explicit OptionSelectorFilterInterface(QObject* parent = 0) : FilterBaseInterface(parent) {} - /// @endcond -}; - -} - -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::OptionSelectorFilterInterface*) - -#endif diff --git a/include/unity/shell/scopes/OptionSelectorOptionsInterface.h b/include/unity/shell/scopes/OptionSelectorOptionsInterface.h deleted file mode 100644 index c2f6261..0000000 --- a/include/unity/shell/scopes/OptionSelectorOptionsInterface.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_OPTIONSELECTOROPTIONSINTERFACE_H -#define UNITY_SHELL_SCOPES_OPTIONSELECTOROPTIONSINTERFACE_H - -#include -#include - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -class UNITY_API OptionSelectorOptionsInterface : public QAbstractListModel -{ - Q_OBJECT - -public: - enum Roles { - RoleOptionId = Qt::UserRole + 1, - RoleOptionLabel, - RoleOptionChecked - }; - Q_ENUM(Roles) - - Q_INVOKABLE virtual void setChecked(int index, bool checked) = 0; - - QHash roleNames() const override - { - QHash roles; - roles[RoleOptionId] = "id"; - roles[RoleOptionLabel] = "label"; - roles[RoleOptionChecked] = "checked"; - return roles; - } - -protected: - /// @cond - explicit OptionSelectorOptionsInterface(QObject* parent = 0) : QAbstractListModel(parent) {} - /// @endcond -}; - -} -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::OptionSelectorOptionsInterface*) - -#endif diff --git a/include/unity/shell/scopes/PreviewModelInterface.h b/include/unity/shell/scopes/PreviewModelInterface.h deleted file mode 100644 index 31d8eb4..0000000 --- a/include/unity/shell/scopes/PreviewModelInterface.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_PREVIEWMODELINTERFACE_H -#define UNITY_SHELL_SCOPES_PREVIEWMODELINTERFACE_H - -#include - -#include - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -/** - * @brief A list of PreviewWidgetModelInterface instances. - * - * This model exposes a number of PreviewWidgetModelInterface instances based on - * the value of widgetColumnCount property. - */ -class UNITY_API PreviewModelInterface : public QAbstractListModel -{ - Q_OBJECT - - /** - * @brief Number of column models this preview should expose. - * - * Previews can be laid out in a different number of columns - for example the number - * of desired columns can change when changing orientation of the display and - * therefore there's more horizontal space available. - */ - Q_PROPERTY(int widgetColumnCount READ widgetColumnCount WRITE setWidgetColumnCount NOTIFY widgetColumnCountChanged) - - /** - * @brief Boolean specifying whether loading this preview finished. - */ - Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged) - - /** - * @brief Boolean specifying whether an action is currently being performed. - * - * Performing an action in a preview often involves communicating to a scope and - * as such can take a while. It's safer to disable all actions while value of this - * property is true. - */ - Q_PROPERTY(bool processingAction READ processingAction NOTIFY processingActionChanged) - -protected: - /// @cond - explicit PreviewModelInterface(QObject* parent = 0) : QAbstractListModel(parent) { } - /// @endcond - -public: - /** - * @brief The roles supported by this model. - */ - enum Roles { - RoleColumnModel - }; - Q_ENUM(Roles) - - // @cond - virtual void setWidgetColumnCount(int count) = 0; - virtual int widgetColumnCount() const = 0; - virtual bool loaded() const = 0; - virtual bool processingAction() const = 0; - QHash roleNames() const override - { - QHash roles; - roles[RoleColumnModel] = "columnModel"; - return roles; - } - // @endcond - -Q_SIGNALS: - // @cond - void widgetColumnCountChanged(); - void loadedChanged(); - void processingActionChanged(); - // @endcond - - /** - * @brief Signal emitted when user triggers an action. - * - * This signal is emitted when user triggers an action - the parameters are widget - * id, action id and properties of the widget/action. - */ - void triggered(QString const&, QString const&, QVariantMap const&); -}; - -} -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::PreviewModelInterface*) - -#endif diff --git a/include/unity/shell/scopes/PreviewWidgetModelInterface.h b/include/unity/shell/scopes/PreviewWidgetModelInterface.h deleted file mode 100644 index 449e672..0000000 --- a/include/unity/shell/scopes/PreviewWidgetModelInterface.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_PREVIEWWIDGETMODELINTERFACE_H -#define UNITY_SHELL_SCOPES_PREVIEWWIDGETMODELINTERFACE_H - -#include - -#include - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -/** - * @brief A list of widgets in a preview. - * - * This model exposes all the widgets that belong to a particular column in a preview. - */ -class UNITY_API PreviewWidgetModelInterface : public QAbstractListModel -{ - Q_OBJECT - -protected: - /// @cond - explicit PreviewWidgetModelInterface(QObject* parent = 0) : QAbstractListModel(parent) { } - /// @endcond - -public: - /** - * @brief The roles supported by this model. - */ - enum Roles { - RoleWidgetId, - RoleType, - RoleProperties - }; - Q_ENUM(Roles) - - // @cond - QHash roleNames() const override - { - QHash roles; - roles[RoleWidgetId] = "widgetId"; - roles[RoleType] = "type"; - roles[RoleProperties] = "properties"; - return roles; - } - // @endcond -}; - -} -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::PreviewWidgetModelInterface*) - -#endif diff --git a/include/unity/shell/scopes/RangeInputFilterInterface.h b/include/unity/shell/scopes/RangeInputFilterInterface.h deleted file mode 100644 index 54bc0e5..0000000 --- a/include/unity/shell/scopes/RangeInputFilterInterface.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_RANGEINPUTFILTERINTERFACE_H -#define UNITY_SHELL_SCOPES_RANGEINPUTFILTERINTERFACE_H - -#include - -#include "FilterBaseInterface.h" - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -class UNITY_API RangeInputFilterInterface : public FilterBaseInterface -{ - Q_OBJECT - -public: - Q_PROPERTY(double startValue READ startValue WRITE setStartValue NOTIFY startValueChanged) - Q_PROPERTY(double endValue READ endValue WRITE setEndValue NOTIFY endValueChanged) - Q_PROPERTY(QString startPrefixLabel READ startPrefixLabel NOTIFY startPrefixLabelChanged) - Q_PROPERTY(QString startPostfixLabel READ startPostfixLabel NOTIFY startPostfixLabelChanged) - Q_PROPERTY(QString centralLabel READ centralLabel NOTIFY centralLabelChanged) - Q_PROPERTY(QString endPrefixLabel READ endPrefixLabel NOTIFY endPrefixLabelChanged) - Q_PROPERTY(QString endPostfixLabel READ endPostfixLabel NOTIFY endPostfixLabelChanged) - Q_PROPERTY(bool hasStartValue READ hasStartValue NOTIFY hasStartValueChanged) - Q_PROPERTY(bool hasEndValue READ hasEndValue NOTIFY hasEndValueChanged) - - FiltersInterface::FilterType filterType() const override - { - return FiltersInterface::RangeInputFilter; - } - - virtual double startValue() const = 0; - virtual double endValue() const = 0; - virtual void setStartValue(double value) = 0; - virtual void setEndValue(double value) = 0; - virtual QString startPrefixLabel() const = 0; - virtual QString startPostfixLabel() const = 0; - virtual QString centralLabel() const = 0; - virtual QString endPrefixLabel() const = 0; - virtual QString endPostfixLabel() const = 0; - virtual bool hasStartValue() const = 0; - virtual bool hasEndValue() const = 0; - - Q_INVOKABLE virtual void eraseStartValue() = 0; - Q_INVOKABLE virtual void eraseEndValue() = 0; - -Q_SIGNALS: - void startValueChanged(); - void endValueChanged(); - void hasStartValueChanged(); - void hasEndValueChanged(); - void startPrefixLabelChanged(); - void startPostfixLabelChanged(); - void centralLabelChanged(); - void endPrefixLabelChanged(); - void endPostfixLabelChanged(); - -protected: - /// @cond - explicit RangeInputFilterInterface(QObject* parent = 0) : FilterBaseInterface(parent) {} - /// @endcond -}; - -} - -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::RangeInputFilterInterface*) - -#endif diff --git a/include/unity/shell/scopes/ResultsModelInterface.h b/include/unity/shell/scopes/ResultsModelInterface.h deleted file mode 100644 index 5601efe..0000000 --- a/include/unity/shell/scopes/ResultsModelInterface.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_RESULTSMODELINTERFACE_H -#define UNITY_SHELL_SCOPES_RESULTSMODELINTERFACE_H - -#include - -#include - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -/** - * @brief A model of scope results for a particular category. - */ -class UNITY_API ResultsModelInterface : public QAbstractListModel -{ - Q_OBJECT - - /** - * @brief Id of associated category. - */ - Q_PROPERTY(QString categoryId READ categoryId WRITE setCategoryId NOTIFY categoryIdChanged) - - /** - * @brief Number of items in the model. - */ - Q_PROPERTY(int count READ count NOTIFY countChanged) - -protected: - /// @cond - explicit ResultsModelInterface(QObject* parent = 0) : QAbstractListModel(parent) { } - /// @endcond - -public: - /** - * @brief The Roles supported by this model. - */ - enum Roles { - RoleUri, - RoleCategoryId, - RoleDndUri, - RoleResult, - // card components - RoleTitle, - RoleArt, - RoleSubtitle, - RoleMascot, - RoleEmblem, - RoleSummary, - RoleAttributes, - RoleBackground, - RoleOverlayColor, - RoleQuickPreviewData, ///< Data for UI quick previewing. In case of audio should contain uri and duration - RoleSocialActions ///< Data for social actions (in-card actions such as "+1"). - }; - Q_ENUM(Roles) - - // @cond - virtual QString categoryId() const = 0; - virtual int count() const = 0; - - virtual void setCategoryId(QString const& id) = 0; - QHash roleNames() const override - { - QHash roles; - roles[RoleUri] = "uri"; - roles[RoleCategoryId] = "categoryId"; - roles[RoleDndUri] = "dndUri"; - roles[RoleQuickPreviewData] = "quickPreviewData"; - roles[RoleResult] = "result"; - roles[RoleTitle] = "title"; - roles[RoleArt] = "art"; - roles[RoleSubtitle] = "subtitle"; - roles[RoleMascot] = "mascot"; - roles[RoleEmblem] = "emblem"; - roles[RoleSummary] = "summary"; - roles[RoleAttributes] = "attributes"; - roles[RoleBackground] = "background"; - roles[RoleOverlayColor] = "overlayColor"; - roles[RoleSocialActions] = "socialActions"; - return roles; - } - - // @endcond - -Q_SIGNALS: - // @cond - void categoryIdChanged(); - void countChanged(); - // @endcond -}; - -} -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::ResultsModelInterface*) - -#endif diff --git a/include/unity/shell/scopes/ScopeInterface.h b/include/unity/shell/scopes/ScopeInterface.h deleted file mode 100644 index 4fb168a..0000000 --- a/include/unity/shell/scopes/ScopeInterface.h +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_SCOPEINTERFACE_H -#define UNITY_SHELL_SCOPES_SCOPEINTERFACE_H - -#include - -#include -#include - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -class CategoriesInterface; -class PreviewModelInterface; -class NavigationInterface; -class SettingsModelInterface; -class FiltersInterface; -class FilterBaseInterface; - -/** - * @brief Object representing scope instance, which exposes model(s) with results. - */ -class UNITY_API ScopeInterface : public QObject -{ - Q_OBJECT - - /** - * @brief Id of the scope. - */ - Q_PROPERTY(QString id READ id NOTIFY idChanged) - - /** - * @brief Display name of the scope. - */ - Q_PROPERTY(QString name READ name NOTIFY nameChanged) - - /** - * @brief URI to scope's icon. - */ - Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged) - - /** - * @brief Description of the scope. - */ - Q_PROPERTY(QString description READ description NOTIFY descriptionChanged) - - /** - * @brief Hint to display in the search field. - */ - Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged) - - /** - * @brief Boolean specifying whether a search is currently running. - */ - Q_PROPERTY(bool searchInProgress READ searchInProgress NOTIFY searchInProgressChanged) - - /** - * @brief Boolean specifying whether an activation request is currently running. - */ - Q_PROPERTY(bool activationInProgress READ activationInProgress NOTIFY activationInProgressChanged) - - /** - * @brief Boolean specifying whether the scope is favourited. - */ - Q_PROPERTY(bool favorite READ favorite WRITE setFavorite NOTIFY favoriteChanged) - /** - * @brief Keyboard shortcut used to summon the scope. - */ - Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged) - - /** - * @brief Categories model for scope's results. - */ - Q_PROPERTY(unity::shell::scopes::CategoriesInterface* categories READ categories NOTIFY categoriesChanged) - - /** - * @brief Settings model for the scope. - */ - Q_PROPERTY(unity::shell::scopes::SettingsModelInterface* settings READ settings NOTIFY settingsChanged) - - /** - * @brief - */ - Q_PROPERTY(unity::shell::scopes::FilterBaseInterface* primaryNavigationFilter READ primaryNavigationFilter NOTIFY primaryNavigationFilterChanged) - - /** - * @brief Current search query. - * - * Writing to this property issues a new search to the scope. - */ - Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged) - - /** - * @brief Message to display when there are no results after a search. - */ - Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged) - - /** - * @brief Form factor which is sent with search queries. - * - * Form factor is one of scope inputs and be used by it to fine-tune the results. - * - * TODO Document the supported for factors - */ - Q_PROPERTY(QString formFactor READ formFactor WRITE setFormFactor NOTIFY formFactorChanged) - - /** - * @brief Boolean specifying whether the scope is currently active. - */ - Q_PROPERTY(bool isActive READ isActive WRITE setActive NOTIFY isActiveChanged) - - /** - * @brief String specifying currently selected department - */ - Q_PROPERTY(QString currentNavigationId READ currentNavigationId NOTIFY currentNavigationIdChanged) - - /** - * @brief Boolean specifying whether current query has departments. - */ - Q_PROPERTY(bool hasNavigation READ hasNavigation NOTIFY hasNavigationChanged) - - /** - * @brief VariantMap with customization properties - */ - Q_PROPERTY(QVariantMap customizations READ customizations NOTIFY customizationsChanged) - - /** - * @brief Enum representing the status of the scope. - */ - Q_PROPERTY(unity::shell::scopes::ScopeInterface::Status status READ status NOTIFY statusChanged) - - /** - * @brief Filters model for the scope. - */ - Q_PROPERTY(unity::shell::scopes::FiltersInterface* filters READ filters NOTIFY filtersChanged) - - /** - * @brief Label for the currently active top level navigation (department or primary filter). - */ - Q_PROPERTY(QString primaryNavigationTag READ primaryNavigationTag NOTIFY primaryNavigationTagChanged) - - /** - * @brief The number of currently selected filters. - */ - Q_PROPERTY(int activeFiltersCount READ activeFiltersCount NOTIFY activeFiltersCountChanged) - -protected: - /// @cond - explicit ScopeInterface(QObject* parent = 0) : QObject(parent) { } - /// @endcond - -public: - /** - * @brief Status info code following the last operation - */ - enum class Status - { - Okay, // Everything is fine - NoInternet, // No Internet access - NoLocationData, // No location data available - Unknown, // A code unknown to the run-time was used - }; - Q_ENUM(Status) - - // @cond - virtual QString id() const = 0; - virtual QString name() const = 0; - virtual QString iconHint() const = 0; - virtual QString description() const = 0; - virtual QString searchHint() const = 0; - virtual QString shortcut() const = 0; - virtual bool searchInProgress() const = 0; - virtual bool activationInProgress() const = 0; - virtual bool favorite() const = 0; - virtual CategoriesInterface* categories() const = 0; - virtual SettingsModelInterface* settings() const = 0; - virtual FilterBaseInterface* primaryNavigationFilter() const = 0; - virtual QString searchQuery() const = 0; - virtual QString noResultsHint() const = 0; - virtual QString formFactor() const = 0; - virtual bool isActive() const = 0; - virtual QString currentNavigationId() const = 0; - virtual bool hasNavigation() const = 0; - virtual Status status() const = 0; - virtual QVariantMap customizations() const = 0; - virtual FiltersInterface* filters() const = 0; - virtual QString primaryNavigationTag() const = 0; - virtual int activeFiltersCount() const = 0; - - /* setters */ - virtual void setSearchQuery(const QString& search_query) = 0; - virtual void setNoResultsHint(const QString& hint) = 0; - virtual void setFormFactor(const QString& form_factor) = 0; - virtual void setActive(const bool) = 0; - virtual void setFavorite(const bool) = 0; - // @endcond - - /** - * @brief Method used to activate a result. - */ - Q_INVOKABLE virtual void activate(QVariant const& result, QString const& categoryId) = 0; - - /** - * @brief Method used to preview a result. - * - * Returns a new PreviewModelInterface instance. It's caller's responsibility - * to free it. - */ - Q_INVOKABLE virtual unity::shell::scopes::PreviewModelInterface* preview(QVariant const& result, QString const& categoryId) = 0; - - /** - * @brief Cancels the current activation. - */ - Q_INVOKABLE virtual void cancelActivation() = 0; - - /** - * @brief Closes the temporary scope which got opened when openScope was emitted. - */ - Q_INVOKABLE virtual void closeScope(unity::shell::scopes::ScopeInterface* scope) = 0; - - /** - * @brief Get a NavigationInterface instance for the passed navigationId. - */ - Q_INVOKABLE virtual unity::shell::scopes::NavigationInterface* getNavigation(QString const& navigationId) = 0; - - /** - * @brief Request change to the current navigation id. - */ - Q_INVOKABLE virtual void setNavigationState(QString const& navId) = 0; - - /** - * @brief Execute canned query. - */ - Q_INVOKABLE virtual void performQuery(QString const& cannedQuery) = 0; - - /** - * @brief Force refresh of the scope contents. - */ - Q_INVOKABLE virtual void refresh() = 0; - - /** - * @brief Reset primary navigation filter and its tag in the search bar. - */ - Q_INVOKABLE virtual void resetPrimaryNavigationTag() = 0; - - /** - * @brief Reset filters to default values. - */ - Q_INVOKABLE virtual void resetFilters() = 0; - - /* - * @brief Method used to activate an action of a result. - */ - Q_INVOKABLE virtual void activateAction(QVariant const& result, QString const& categoryId, QString const& actionId) = 0; - -Q_SIGNALS: - // @cond - void idChanged(); - void nameChanged(); - void iconHintChanged(); - void descriptionChanged(); - void searchHintChanged(); - void searchInProgressChanged(); - void activationInProgressChanged(); - void favoriteChanged(); - void shortcutChanged(); - void categoriesChanged(); - void settingsChanged(); - void searchQueryChanged(); - void noResultsHintChanged(); - void formFactorChanged(); - void isActiveChanged(); - void hasNavigationChanged(); - void currentNavigationIdChanged(); - void customizationsChanged(); - void statusChanged(); - void detailsChanged(); - void filtersChanged(); - void primaryNavigationTagChanged(); - void activeFiltersCountChanged(); - void primaryNavigationFilterChanged(); - // @endcond - - // signals triggered by activate(..) or preview(..) requests. - /** - * @brief Signal requesting to show the dash. - * - * This signal is usually emitted after activating a result. - */ - void showDash(); - - /** - * @brief Signal requesting to hide the dash. - * - * This signal is usually emitted after activating a result. - */ - void hideDash(); - - /** - * @brief Signal requesting to open a uri. - * - * This signal is usually emitted after activating a result. - */ - void gotoUri(QString const& uri); - - /** - * @brief Signal requesting to preview a result. - * - * This signal is usually emitted after activating a result. - */ - void previewRequested(QVariant const& result); - - /** - * @brief Signal requesting to change the currently focused scope. - */ - void gotoScope(QString const& scopeId); - - /** - * @brief Signal requesting to show a temporary scope. - */ - void openScope(unity::shell::scopes::ScopeInterface* scope); -}; - -} -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::ScopeInterface*) - -#endif diff --git a/include/unity/shell/scopes/ScopesInterface.h b/include/unity/shell/scopes/ScopesInterface.h deleted file mode 100644 index 1cb2b2a..0000000 --- a/include/unity/shell/scopes/ScopesInterface.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_SCOPESINTERFACE_H -#define UNITY_SHELL_SCOPES_SCOPESINTERFACE_H - -#include - -#include - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -class ScopeInterface; - -/** - * @brief A list of scopes to display in the UI. - * - * This model exposes information about scopes that should be shown by the dash. - */ -class UNITY_API ScopesInterface : public QAbstractListModel -{ - Q_OBJECT - - /** - * @brief Boolean indicating whether asynchronous populating of the model finished. - */ - Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged) - - /** - * @brief Interger specifying how many items are in the model. - */ - Q_PROPERTY(int count READ count NOTIFY countChanged) - - /** - * @brief Scope instance representing the overview scope. - * - * Scope instance representing the overview scope, note that it might be null while scopes are not loaded. - */ - Q_PROPERTY(unity::shell::scopes::ScopeInterface* overviewScope READ overviewScope NOTIFY overviewScopeChanged) - -protected: - /// @cond - explicit ScopesInterface(QObject* parent = 0) : QAbstractListModel(parent) { } - /// @endcond - -public: - /** - * @brief Roles supported by the model. - */ - enum Roles { - RoleScope, - RoleId, - RoleTitle - }; - Q_ENUM(Roles) - - /** - * @brief Get ScopeInterface instance associated with a row. - * - * Returns ScopeInterface instance associated with a row or null when - * supplied with incorrect index. - */ - Q_INVOKABLE virtual unity::shell::scopes::ScopeInterface* getScope(int row) const = 0; - - /** - * @brief Get ScopeInterface instance by scope id. - * - * Returns ScopeInterface instance which with the supplied scope id or null. - */ - Q_INVOKABLE virtual unity::shell::scopes::ScopeInterface* getScope(QString const& scopeId) const = 0; - - /** - * @brief Set the favorite bit of the given scope. - */ - Q_INVOKABLE virtual void setFavorite(QString const& scopeId, bool favorite) = 0; - - /** - * @brief Move the given favorite scope to the given index. - */ - Q_INVOKABLE virtual void moveFavoriteTo(QString const& scopeId, int index) = 0; - - // @cond - virtual bool loaded() const = 0; - virtual int count() const = 0; - virtual unity::shell::scopes::ScopeInterface* overviewScope() const = 0; - QHash roleNames() const override - { - QHash roles; - roles[RoleScope] = "scope"; - roles[RoleId] = "id"; - roles[RoleTitle] = "title"; - return roles; - } - // @endcond - - Q_INVOKABLE virtual void closeScope(unity::shell::scopes::ScopeInterface* scope) = 0; - -Q_SIGNALS: - // @cond - void loadedChanged(); - void countChanged(); - void overviewScopeChanged(); - // @endcond -}; - -} -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::ScopesInterface*) - -#endif diff --git a/include/unity/shell/scopes/SettingsModelInterface.h b/include/unity/shell/scopes/SettingsModelInterface.h deleted file mode 100644 index 4c3478c..0000000 --- a/include/unity/shell/scopes/SettingsModelInterface.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_SETTINGSMODELINTERFACE_H -#define UNITY_SHELL_SCOPES_SETTINGSMODELINTERFACE_H - -#include - -#include - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -class UNITY_API SettingsModelInterface: public QAbstractListModel -{ -Q_OBJECT - -/** - * @brief Integer representing the number of setting elements in the model. - */ -Q_PROPERTY(int count READ count NOTIFY countChanged) - -protected: - /// @cond - explicit SettingsModelInterface(QObject* parent = 0) - : QAbstractListModel(parent) - { - } - /// @endcond - -public: - virtual ~SettingsModelInterface() = default; - - virtual int count() const = 0; - - /** - * @brief The roles supported by this model. - */ - enum Roles - { - RoleSettingId, - RoleDisplayName, - RoleType, - RoleProperties, - RoleValue - }; - Q_ENUM(Roles) - - // @cond - QHash roleNames() const override - { - QHash roles; - roles[RoleSettingId] = "settingId"; - roles[RoleDisplayName] = "displayName"; - roles[RoleType] = "type"; - roles[RoleProperties] = "properties"; - roles[RoleValue] = "value"; - return roles; - } - // @endcond - -Q_SIGNALS: - // @cond - void countChanged(); - // @endcond -}; - -} -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::SettingsModelInterface*) - -#endif /* UNITY_SHELL_SCOPES_SETTINGSMODELINTERFACE_H */ diff --git a/include/unity/shell/scopes/ValueSliderFilterInterface.h b/include/unity/shell/scopes/ValueSliderFilterInterface.h deleted file mode 100644 index a7b3055..0000000 --- a/include/unity/shell/scopes/ValueSliderFilterInterface.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_VALUESLIDERFILTERINTERFACE_H -#define UNITY_SHELL_SCOPES_VALUESLIDERFILTERINTERFACE_H - -#include - -#include "FilterBaseInterface.h" -#include "ValueSliderValuesInterface.h" - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -class UNITY_API ValueSliderFilterInterface : public FilterBaseInterface -{ - Q_OBJECT - -public: - Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged) - Q_PROPERTY(unity::shell::scopes::ValueSliderValuesInterface* values READ values NOTIFY valuesChanged) - Q_PROPERTY(double minValue READ minValue NOTIFY minValueChanged) - Q_PROPERTY(double maxValue READ maxValue NOTIFY maxValueChanged) - -public: - FiltersInterface::FilterType filterType() const override - { - return FiltersInterface::ValueSliderFilter; - } - - virtual double value() const = 0; - virtual void setValue(double) = 0; - virtual double minValue() const = 0; - virtual double maxValue() const = 0; - virtual ValueSliderValuesInterface* values() const = 0; - -Q_SIGNALS: - void valueChanged(); - void valuesChanged(); - void minValueChanged(); - void maxValueChanged(); - -protected: - /// @cond - explicit ValueSliderFilterInterface(QObject* parent = 0) : FilterBaseInterface(parent) {} - /// @endcond -}; - -} - -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::ValueSliderFilterInterface*) - -#endif diff --git a/include/unity/shell/scopes/ValueSliderValuesInterface.h b/include/unity/shell/scopes/ValueSliderValuesInterface.h deleted file mode 100644 index f9ff722..0000000 --- a/include/unity/shell/scopes/ValueSliderValuesInterface.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UNITY_SHELL_SCOPES_VALUESLIDERVALUESINTERFACE_H -#define UNITY_SHELL_SCOPES_VALUESLIDERVALUESINTERFACE_H - -#include -#include - -namespace unity -{ -namespace shell -{ -namespace scopes -{ - -class UNITY_API ValueSliderValuesInterface : public QAbstractListModel -{ - Q_OBJECT - -public: - enum Roles { - RoleValue = Qt::UserRole + 1, - RoleLabel - }; - Q_ENUM(Roles) - - QHash roleNames() const override - { - QHash roles; - roles[RoleValue] = "value"; - roles[RoleLabel] = "label"; - return roles; - } - -protected: - /// @cond - explicit ValueSliderValuesInterface(QObject* parent = 0) : QAbstractListModel(parent) {} - /// @endcond -}; - -} -} -} - -Q_DECLARE_METATYPE(unity::shell::scopes::ValueSliderValuesInterface*) - -#endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a03204c..258e8e8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,7 +15,7 @@ set_target_properties(${UNITY_API_LIB_OBJ} PROPERTIES COMPILE_FLAGS "-fPIC") add_pch(pch/unityapi_pch.hh ${UNITY_API_LIB_OBJ}) # Use the object files to make the shared library. -set(UNITY_API_SOVERSION 0) +set(UNITY_API_SOVERSION 1) add_library(${UNITY_API_LIB} SHARED $) set_target_properties(${UNITY_API_LIB} PROPERTIES VERSION "${UNITY_API_MAJOR}.${UNITY_API_MINOR}" diff --git a/src/unity/api/CMakeLists.txt b/src/unity/api/CMakeLists.txt index 79d2a4f..05d6b9e 100644 --- a/src/unity/api/CMakeLists.txt +++ b/src/unity/api/CMakeLists.txt @@ -1,5 +1,4 @@ add_subdirectory(internal) -add_subdirectory(scopes) set(API_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp diff --git a/src/unity/api/scopes/CMakeLists.txt b/src/unity/api/scopes/CMakeLists.txt deleted file mode 100644 index 1735f40..0000000 --- a/src/unity/api/scopes/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_subdirectory(internal) - -set(SCOPES_SRC -) - -set(UNITY_API_LIB_SRC ${UNITY_API_LIB_SRC} ${SCOPES_SRC} PARENT_SCOPE) diff --git a/src/unity/api/scopes/internal/CMakeLists.txt b/src/unity/api/scopes/internal/CMakeLists.txt deleted file mode 100644 index bfa86f1..0000000 --- a/src/unity/api/scopes/internal/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(SCOPES_INTERNAL_SRC -) - -set(UNITY_API_LIB_SRC ${UNITY_API_LIB_SRC} ${SCOPES_INTERNAL_SRC} PARENT_SCOPE) diff --git a/test/copyright/check_copyright.sh b/test/copyright/check_copyright.sh index 5890336..33d0f40 100755 --- a/test/copyright/check_copyright.sh +++ b/test/copyright/check_copyright.sh @@ -34,7 +34,7 @@ usage() [ $# -gt 2 ] && usage -ignore_pat="\\.sci$|\\.bzr|\\.txt$|CMakeFiles|debian|qmldir|valgrind-suppress|astyle-config|\\.cmake$|\\.ini$|\\.in$|Jenkinsfile" +ignore_pat="\\.sci$|\\.git|\\.txt$|CMakeFiles|debian|qmldir|valgrind-suppress|astyle-config|\\.cmake$|\\.ini$|\\.in$|Jenkinsfile|build|\\.qmlc$" # # We don't use the -i option of licensecheck to add ignore_dir to the pattern because Jenkins creates directories diff --git a/test/gtest/unity/CMakeLists.txt b/test/gtest/unity/CMakeLists.txt index ba98298..230692b 100644 --- a/test/gtest/unity/CMakeLists.txt +++ b/test/gtest/unity/CMakeLists.txt @@ -1,5 +1,4 @@ add_subdirectory(api) -add_subdirectory(scopes) add_subdirectory(util) add_executable(Exceptions_test Exceptions_test.cpp) diff --git a/test/gtest/unity/scopes/CMakeLists.txt b/test/gtest/unity/scopes/CMakeLists.txt deleted file mode 100644 index e69de29..0000000 diff --git a/test/qmltest/mocks/CMakeLists.txt b/test/qmltest/mocks/CMakeLists.txt index 3ccd9ba..e39f9c6 100644 --- a/test/qmltest/mocks/CMakeLists.txt +++ b/test/qmltest/mocks/CMakeLists.txt @@ -1,4 +1,3 @@ add_subdirectory(plugins/Unity/Notifications) add_subdirectory(plugins/Unity/Launcher) add_subdirectory(plugins/Unity/Application) -add_subdirectory(plugins/Unity/Scopes) diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt b/test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt deleted file mode 100644 index c06a361..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -include_directories( - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes - ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_definitions(-DQT_NO_KEYWORDS) -set(CMAKE_AUTOMOC ON) - -find_package(Qt5Core REQUIRED) -find_package(Qt5Quick REQUIRED) -find_package(Qt5Qml REQUIRED) - -set(ScopesMocks_SOURCES - Mocks/MockCategories.cpp - Mocks/MockDepartment.cpp - Mocks/MockResultsModel.cpp - Mocks/MockPreviewModel.cpp - Mocks/MockPreviewWidgetModel.cpp - Mocks/MockScope.cpp - Mocks/MockScopes.cpp - Mocks/MockSettingsModel.cpp - Mocks/MockFiltersModel.cpp - Mocks/MockOptionSelectorFilter.cpp - Mocks/MockSelectorOptions.cpp - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/CategoriesInterface.h - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/FiltersInterface.h - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/FilterBaseInterface.h - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/OptionSelectorFilterInterface.h - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/OptionSelectorOptionsInterface.h - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/RangeInputFilterInterface.h - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/NavigationInterface.h - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/ResultsModelInterface.h - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/PreviewModelInterface.h - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/PreviewWidgetModelInterface.h - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/ScopeInterface.h - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/ScopesInterface.h - ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/SettingsModelInterface.h -) - -add_library(ScopesMocks SHARED ${ScopesMocks_SOURCES}) - -target_link_libraries(ScopesMocks Qt5::Core) - -set(TestScopesPlugin_SOURCES - TestScopesPlugin.cpp -) - -add_library(TestScopesPlugin MODULE ${TestScopesPlugin_SOURCES}) - -target_link_libraries(TestScopesPlugin Qt5::Core Qt5::Quick) - -target_link_libraries(TestScopesPlugin ScopesMocks) - -add_custom_target(TestScopesPluginQmldir ALL - COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" "${CMAKE_CURRENT_BINARY_DIR}" - DEPENDS qmldir -) diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockCategories.cpp b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockCategories.cpp deleted file mode 100644 index a5d5eae..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockCategories.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * Author: Nick Dedekind - */ - -// self -#include "MockCategories.h" - -#include "MockResultsModel.h" - -MockCategories::MockCategories(int category_count, QObject* parent) - : unity::shell::scopes::CategoriesInterface(parent) - , m_category_count(category_count) -{ -} - -int MockCategories::rowCount(const QModelIndex& /*parent*/) const -{ - return m_category_count; -} - -bool MockCategories::overrideCategoryJson(QString const& , QString const& ) -{ - qFatal("Using un-implemented MockCategories::overrideCategoryJson"); - return false; -} - -QVariant -MockCategories::data(const QModelIndex& index, int role) const -{ - if (!index.isValid()) { - return QVariant(); - } - - MockResultsModel *resultsModel = m_resultsModels[index.row()]; - if (!resultsModel) { - resultsModel = new MockResultsModel(15, index.row()); - m_resultsModels[index.row()] = resultsModel; - } - switch (role) { - case RoleCategoryId: - return QString("%1").arg(index.row()); - case RoleName: - return QString("Category %1").arg(index.row()); - case RoleIcon: - return "gtk-apply"; - case RoleRawRendererTemplate: - return QString(); - case RoleRenderer: - { - QVariantMap map; - map["category-layout"] = index.row() % 2 == 0 ? "grid" : "carousel"; - map["card-size"] = "small"; - return map; - } - case RoleComponents: - { - QVariantMap map, artMap; - artMap["aspect-ratio"] = "1.0"; - artMap["field"] = "art"; - map["art"] = artMap; - map["title"] = "HOLA"; - return map; - } - case RoleHeaderLink: - return QString(); - case RoleResults: - return QVariant::fromValue(resultsModel); - case RoleCount: - return resultsModel->rowCount(); - default: - qFatal("Using un-implemented Categories role"); - return QVariant(); - } -} diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockCategories.h b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockCategories.h deleted file mode 100644 index f341506..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockCategories.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef MOCKCATEGORIES_H -#define MOCKCATEGORIES_H - -#include - -// Qt -#include - -class MockResultsModel; - -class MockCategories : public unity::shell::scopes::CategoriesInterface -{ - Q_OBJECT - -public: - MockCategories(int category_count, QObject* parent = 0); - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - int rowCount(const QModelIndex& parent = QModelIndex()) const override; - - Q_INVOKABLE bool overrideCategoryJson(QString const& categoryId, QString const& json) override; - -private: - mutable QHash m_resultsModels; - int m_category_count; -}; - -#endif diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp deleted file mode 100644 index b8bc708..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// self -#include "MockDepartment.h" - -MockDepartment::MockDepartment(QObject* parent) - : unity::shell::scopes::NavigationInterface(parent) -{ -} - -QString MockDepartment::navigationId() const -{ - return "root"; -} - -QString MockDepartment::label() const -{ - return "All Departments"; -} - -QString MockDepartment::allLabel() const -{ - return "All Departments"; -} - -QString MockDepartment::parentNavigationId() const -{ - return QString(); -} - -QString MockDepartment::parentLabel() const -{ - return QString(); -} - -bool MockDepartment::loaded() const -{ - return true; -} - -bool MockDepartment::isRoot() const -{ - return true; -} - -bool MockDepartment::hidden() const -{ - return false; -} - -int MockDepartment::count() const -{ - return rowCount(); -} - -int MockDepartment::rowCount(const QModelIndex&) const -{ - return 1; -} - -QVariant MockDepartment::data(const QModelIndex& /*index*/, int role) const -{ - switch (role) { - case RoleNavigationId: - return "child"; - case RoleLabel: - return "Child Clothes"; - case RoleAllLabel: - return "All Child Clothes"; - case RoleHasChildren: - return true; - case RoleIsActive: - return false; - default: - return QVariant(); - } -} diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.h b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.h deleted file mode 100644 index dd638c4..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#ifndef MOCKDEPARTMENT_H -#define MOCKDEPARTMENT_H - -#include - -#include - -class MockDepartment : public unity::shell::scopes::NavigationInterface -{ - Q_OBJECT - -public: - explicit MockDepartment(QObject* parent = 0); - - QString navigationId() const override; - QString label() const override; - QString allLabel() const override; - QString parentNavigationId() const override; - QString parentLabel() const override; - bool loaded() const override; - bool isRoot() const override; - bool hidden() const override; - int count() const override; - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - int rowCount(const QModelIndex& parent = QModelIndex()) const override; -}; - -#endif // MOCKDEPARTMENT_H diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.cpp b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.cpp deleted file mode 100644 index 748d375..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "MockFiltersModel.h" -#include "MockOptionSelectorFilter.h" - -MockFiltersModel::MockFiltersModel(unity::shell::scopes::ScopeInterface *parent) - : unity::shell::scopes::FiltersInterface(parent) -{ - MockOptionSelectorFilter *f = new MockOptionSelectorFilter("f1", "Filter 1 title", "Filter 1 label", false, this); - m_filters.append(f); // owned by parent, so no need to manage it -} - -QVariant MockFiltersModel::data(const QModelIndex& index, int role) const -{ - if (index.row() >= 0 && index.row() < m_filters.count()) - { - auto filter = m_filters.at(index.row()); - switch (role) - { - case Qt::DisplayRole: - case unity::shell::scopes::FiltersInterface::RoleFilterId: - return QVariant(filter->filterId()); - case unity::shell::scopes::FiltersInterface::RoleFilterType: - return QVariant(static_cast(filter->filterType())); - case unity::shell::scopes::FiltersInterface::RoleFilter: - return QVariant::fromValue(filter); - default: - return QVariant(); - } - } - return QVariant(); -} - -int MockFiltersModel::rowCount(const QModelIndex&) const -{ - return m_filters.count(); -} diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.h b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.h deleted file mode 100644 index fc285b4..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockFiltersModel.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef MOCKFILTERS_H -#define MOCKFILTERS_H - -#include -#include -#include - -#include - -class MockFiltersModel : public unity::shell::scopes::FiltersInterface -{ - Q_OBJECT - -public: - explicit MockFiltersModel(unity::shell::scopes::ScopeInterface *parent = 0); - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - int rowCount(const QModelIndex& parent = QModelIndex()) const override; - -private: - QList m_filters; -}; - -#endif // MOCKDEPARTMENT_H diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.cpp b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.cpp deleted file mode 100644 index 4a669d9..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "MockOptionSelectorFilter.h" - -MockOptionSelectorFilter::MockOptionSelectorFilter(const QString &id, const QString &title, const QString &label, bool multi, QObject *parent) - : unity::shell::scopes::OptionSelectorFilterInterface(parent), - m_id(id), - m_title(title), - m_label(label), - m_multiSelect(multi), - m_options(new MockSelectorOptions(2, this)) -{ -} - -QString MockOptionSelectorFilter::filterId() const -{ - return m_id; -} - -QString MockOptionSelectorFilter::title() const -{ - return m_title; -} - -QString MockOptionSelectorFilter::label() const -{ - return m_label; -} - -bool MockOptionSelectorFilter::multiSelect() const -{ - return m_multiSelect; -} - -unity::shell::scopes::OptionSelectorOptionsInterface* MockOptionSelectorFilter::options() const -{ - return m_options; -} - -QString MockOptionSelectorFilter::filterTag() const -{ - return ""; -} diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.h b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.h deleted file mode 100644 index db0593c..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockOptionSelectorFilter.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef MOCKOPTIONSELECTORFILTER_H -#define MOCKOPTIONSELECTORFILTER_H - -#include -#include -#include "MockSelectorOptions.h" - -class MockOptionSelectorFilter : public unity::shell::scopes::OptionSelectorFilterInterface -{ - Q_OBJECT - -public: - MockOptionSelectorFilter(const QString &id, const QString& title, const QString &label, bool multi, QObject *parent = 0); - QString filterId() const override; - QString title() const override; - QString label() const override; - bool multiSelect() const override; - unity::shell::scopes::OptionSelectorOptionsInterface* options() const override; - QString filterTag() const override; - -private: - QString m_id; - QString m_title; - QString m_label; - bool m_multiSelect; - MockSelectorOptions *m_options; -}; - -#endif diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewModel.cpp b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewModel.cpp deleted file mode 100644 index ea51f32..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewModel.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * Authors: - * Michał Sawicz - * Michal Hruby - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// self -#include "MockPreviewModel.h" - -// local -#include "MockPreviewWidgetModel.h" - -// Qt -#include - -MockPreviewModel::MockPreviewModel(QObject* parent) - : unity::shell::scopes::PreviewModelInterface(parent) -{ - // we have one column by default - MockPreviewWidgetModel* columnModel = new MockPreviewWidgetModel(this); - m_previewWidgetModels.append(columnModel); -} - -void MockPreviewModel::setWidgetColumnCount(int count) -{ - if (count != 1) { - qWarning("MockPreviewModel::setWidgetColumnCount != 1 not implemented"); - } -} - -int MockPreviewModel::widgetColumnCount() const -{ - return 1; -} - -bool MockPreviewModel::loaded() const -{ - return true; -} - -bool MockPreviewModel::processingAction() const -{ - return false; -} - -int MockPreviewModel::rowCount(const QModelIndex&) const -{ - return m_previewWidgetModels.size(); -} - -QVariant MockPreviewModel::data(const QModelIndex& index, int role) const -{ - switch (role) { - case RoleColumnModel: - return QVariant::fromValue(m_previewWidgetModels.at(index.row())); - default: - return QVariant(); - } -} diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewModel.h b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewModel.h deleted file mode 100644 index fffc2da..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewModel.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#ifndef MOCKPREVIEWMODEL_H -#define MOCKPREVIEWMODEL_H - -#include - -class MockPreviewWidgetModel; - -class MockPreviewModel : public unity::shell::scopes::PreviewModelInterface -{ - Q_OBJECT - -public: - explicit MockPreviewModel(QObject* parent = 0); - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - int rowCount(const QModelIndex& parent = QModelIndex()) const override; - - void setWidgetColumnCount(int count) override; - int widgetColumnCount() const override; - bool loaded() const override; - bool processingAction() const override; - -private: - QHash m_roles; - QList m_previewWidgetModels; -}; - -#endif diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewWidgetModel.cpp b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewWidgetModel.cpp deleted file mode 100644 index 1744ee3..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewWidgetModel.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * Authors: - * Michał Sawicz - * Michal Hruby - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// self -#include "MockPreviewWidgetModel.h" - -// Qt -#include - -struct MockPreviewData -{ - QString id; - QString type; - QVariantMap data; - - MockPreviewData(QString const& id_, QString const& type_, QVariantMap const& data_): id(id_), type(type_), data(data_) - { - } -}; - -MockPreviewWidgetModel::MockPreviewWidgetModel(QObject* parent) - : unity::shell::scopes::PreviewWidgetModelInterface(parent) -{ - for (int i = 0; i <= 20; i++) { - QVariantMap attributes; - attributes["text"] = QVariant::fromValue(QString("Widget %1").arg(i)); - attributes["title"] = QVariant::fromValue(QString("Title %1").arg(i)); - MockPreviewData* preview_data = new MockPreviewData(QString("widget-%1").arg(i), QString("text"), attributes); - m_previewWidgets.append(QSharedPointer(preview_data)); - } -} - -int MockPreviewWidgetModel::rowCount(const QModelIndex&) const -{ - return m_previewWidgets.size(); -} - -QVariant MockPreviewWidgetModel::data(const QModelIndex& index, int role) const -{ - auto widget_data = m_previewWidgets.at(index.row()); - switch (role) { - case RoleWidgetId: - return widget_data->id; - case RoleType: - return widget_data->type; - case RoleProperties: - return widget_data->data; - default: - return QVariant(); - } -} diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewWidgetModel.h b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewWidgetModel.h deleted file mode 100644 index adbd32a..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewWidgetModel.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#ifndef MOCKPREVIEWWIDGETMODEL_H -#define MOCKPREVIEWWIDGETMODEL_H - -#include - -#include - -struct MockPreviewData; - -class MockPreviewWidgetModel : public unity::shell::scopes::PreviewWidgetModelInterface -{ - Q_OBJECT - -public: - explicit MockPreviewWidgetModel(QObject* parent = 0); - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - int rowCount(const QModelIndex& parent = QModelIndex()) const override; - -private: - QList> m_previewWidgets; -}; - -#endif // FAKE_PREVIEWWIDGETMODEL_H diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockResultsModel.cpp b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockResultsModel.cpp deleted file mode 100644 index 7f4dfa0..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockResultsModel.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// self -#include "MockResultsModel.h" - -MockResultsModel::MockResultsModel(int result_count, int categoryId, QObject* parent) - : unity::shell::scopes::ResultsModelInterface(parent) - , m_result_count(result_count) - , m_categoryId(categoryId) -{ -} - -QString MockResultsModel::categoryId() const -{ - return QString::number(m_categoryId); -} - -void MockResultsModel::setCategoryId(QString const& /*id*/) -{ - qFatal("Calling un-implemented MockResultsModel::setCategoryId"); -} - -int MockResultsModel::rowCount(const QModelIndex& parent) const -{ - Q_UNUSED(parent); - - return m_result_count; -} - -int MockResultsModel::count() const -{ - return rowCount(); -} - -QVariant -MockResultsModel::data(const QModelIndex& index, int role) const -{ - switch (role) { - case RoleResult: - return QVariantMap(); - case RoleTitle: - return QString("Title.%1.%2").arg(m_categoryId).arg(index.row()); - case RoleArt: - return "dash.png"; - case RoleOverlayColor: - return QString(); - case RoleBackground: - return QVariantMap(); - case RoleSubtitle: - case RoleMascot: - case RoleEmblem: - case RoleSummary: - case RoleUri: - case RoleCategoryId: - case RoleDndUri: - case RoleAttributes: - case RoleSocialActions: - default: - return QString(); - } -} diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockResultsModel.h b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockResultsModel.h deleted file mode 100644 index e546793..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockResultsModel.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#ifndef MOCKRESULTSMODEL_H -#define MOCKRESULTSMODEL_H - -#include - -class MockResultsModel : public unity::shell::scopes::ResultsModelInterface -{ - Q_OBJECT - -public: - explicit MockResultsModel(int result_count, int categoryId, QObject* parent = 0); - - int rowCount(const QModelIndex& parent = QModelIndex()) const override; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - - /* getters */ - QString categoryId() const override; - int count() const override; - - /* setters */ - void setCategoryId(QString const& id) override; - -private: - QHash m_roles; - int m_result_count; - int m_categoryId; -}; - -#endif diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp deleted file mode 100644 index ec87554..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "MockScope.h" -#include "MockCategories.h" -#include "MockPreviewModel.h" -#include "MockDepartment.h" -#include "MockSettingsModel.h" -#include "MockFiltersModel.h" - -MockScope::MockScope(QObject* parent) : MockScope(QString(), QString(), parent) -{ -} - -MockScope::MockScope(QString const& id, QString const& name, QObject* parent) - : unity::shell::scopes::ScopeInterface(parent) - , m_id(id) - , m_name(name) - , m_favorite(false) - , m_searching(false) - , m_isActive(false) - , m_previewRendererName("preview-generic") - , m_categories(new MockCategories(20, this)) - , m_settings(new MockSettingsModel(this)) - , m_filters(new MockFiltersModel(this)) -{ -} - -QString MockScope::id() const { - return m_id; -} - -QString MockScope::name() const { - return m_name; -} - -QString MockScope::searchQuery() const { - return m_searchQuery; -} - -QString MockScope::iconHint() const { - return m_iconHint; -} - -QString MockScope::description() const { - return m_description; -} - -QString MockScope::searchHint() const { - return QString(""); -} - -QString MockScope::shortcut() const { - return QString(""); -} - -QString MockScope::currentNavigationId() const { - return m_currentDepartmentId; -} - -bool MockScope::searchInProgress() const { - return m_searching; -} - -bool MockScope::activationInProgress() const { - return false; -} - -unity::shell::scopes::CategoriesInterface* MockScope::categories() const { - return m_categories; -} - -unity::shell::scopes::SettingsModelInterface* MockScope::settings() const { - return m_settings; -} - -unity::shell::scopes::FiltersInterface* MockScope::filters() const { - return m_filters; -} - -unity::shell::scopes::FilterBaseInterface* MockScope::primaryNavigationFilter() const { - return nullptr; -} - -QString MockScope::noResultsHint() const { - return m_noResultsHint; -} - -QString MockScope::formFactor() const { - return m_formFactor; -} - -bool MockScope::favorite() const { - return m_favorite; -} - -bool MockScope::isActive() const { - return m_isActive; -} - -bool MockScope::hasNavigation() const { - return m_hasNavigation; -} - -QVariantMap MockScope::customizations() const { - return m_customizations; -} - -unity::shell::scopes::ScopeInterface::Status MockScope::status() const { - return ScopeInterface::Status::Okay; -} - -void MockScope::setName(const QString &str) { - if (str != m_name) { - m_name = str; - Q_EMIT nameChanged(); - } -} - -void MockScope::setSearchQuery(const QString &str) { - if (str != m_searchQuery) { - m_searchQuery = str; - Q_EMIT searchQueryChanged(); - } -} - -void MockScope::setFormFactor(const QString &str) { - if (str != m_formFactor) { - m_formFactor = str; - Q_EMIT formFactorChanged(); - } -} - -void MockScope::setActive(const bool active) { - if (active != m_isActive) { - m_isActive = active; - Q_EMIT isActiveChanged(); - } -} - -void MockScope::setFavorite(const bool value) { - if (value != m_favorite) { - m_favorite = value; - Q_EMIT favoriteChanged(); - } -} - -void MockScope::setNoResultsHint(const QString& str) { - if (str != m_noResultsHint) { - m_noResultsHint = str; - Q_EMIT noResultsHintChanged(); - } -} - -void MockScope::activate(QVariant const& result, QString const& categoryId) -{ - Q_UNUSED(result); - Q_UNUSED(categoryId); -} - -void MockScope::activateAction(QVariant const& result, QString const& categoryId, QString const& actionId) -{ - Q_UNUSED(result); - Q_UNUSED(categoryId); - Q_UNUSED(actionId); -} - -unity::shell::scopes::PreviewModelInterface* MockScope::preview(QVariant const& result, QString const& categoryId) -{ - Q_UNUSED(result); - Q_UNUSED(categoryId); - - // This probably leaks, do we don't care - // it's a test after all - return new MockPreviewModel; -} - -unity::shell::scopes::NavigationInterface* MockScope::getNavigation(QString const& navigationId) -{ - Q_UNUSED(navigationId); - - return new MockDepartment(); -} - -void MockScope::setNavigationState(QString const& navId) -{ - Q_UNUSED(navId); -} - -void MockScope::cancelActivation() -{ -} - -void MockScope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/) -{ - qFatal("MockScope::closeScope is not implemented"); -} - -void MockScope::performQuery(QString const& cannedQuery) -{ - Q_UNUSED(cannedQuery); -} - -void MockScope::refresh() -{ -} - -QString MockScope::primaryNavigationTag() const -{ - return ""; -} - -void MockScope::resetPrimaryNavigationTag() -{ -} - -void MockScope::resetFilters() -{ -} - -int MockScope::activeFiltersCount() const -{ - return 0; -} diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h deleted file mode 100644 index d6bb6c1..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef MOCKSCOPE_H -#define MOCKSCOPE_H - -#include - -class UNITY_API MockScope : public unity::shell::scopes::ScopeInterface -{ - Q_OBJECT - -public: - MockScope(QObject* parent = 0); - MockScope(QString const& id, QString const& name, QObject* parent); - - /* getters */ - QString id() const override; - QString name() const override; - QString iconHint() const override; - QString description() const override; - QString searchHint() const override; - bool favorite() const override; - QString shortcut() const override; - bool searchInProgress() const override; - bool activationInProgress() const override; - unity::shell::scopes::CategoriesInterface* categories() const override; - unity::shell::scopes::SettingsModelInterface* settings() const override; - unity::shell::scopes::FiltersInterface* filters() const override; - unity::shell::scopes::FilterBaseInterface* primaryNavigationFilter() const override; - QString searchQuery() const override; - QString noResultsHint() const override; - QString formFactor() const override; - bool isActive() const override; - bool hasNavigation() const override; - QString currentNavigationId() const override; - QVariantMap customizations() const override; - Status status() const override; - QString primaryNavigationTag() const override; - int activeFiltersCount() const override; - - /* setters */ - void setName(const QString& name); - void setSearchQuery(const QString& search_query) override; - void setNoResultsHint(const QString& hint) override; - void setFormFactor(const QString& form_factor) override; - void setActive(const bool) override; - void setFavorite(const bool) override; - - Q_INVOKABLE void activate(QVariant const& result, QString const& categoryId) override; - Q_INVOKABLE void activateAction(QVariant const& result, QString const& categoryId, QString const& actionId) override; - Q_INVOKABLE unity::shell::scopes::PreviewModelInterface* preview(QVariant const& result, QString const& categoryId) override; - Q_INVOKABLE void cancelActivation() override; - Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override; - Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& departmentId) override; - Q_INVOKABLE void setNavigationState(QString const& navId) override; - Q_INVOKABLE void performQuery(QString const& cannedQuery) override; - Q_INVOKABLE void refresh() override; - Q_INVOKABLE void resetPrimaryNavigationTag() override; - Q_INVOKABLE void resetFilters() override; - -protected: - QString m_id; - QString m_iconHint; - QString m_description; - QString m_name; - QString m_searchQuery; - QString m_noResultsHint; - QString m_formFactor; - QString m_currentDepartmentId; - bool m_favorite; - bool m_searching; - bool m_isActive; - bool m_hasNavigation; - QVariantMap m_customizations; - - QString m_previewRendererName; - - unity::shell::scopes::CategoriesInterface* m_categories; - unity::shell::scopes::SettingsModelInterface* m_settings; - unity::shell::scopes::FiltersInterface* m_filters; -}; - -#endif diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.cpp b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.cpp deleted file mode 100644 index 7067b81..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -// Self -#include "MockScopes.h" - -#include "MockScope.h" - -MockScopes::MockScopes(QObject *parent) - : unity::shell::scopes::ScopesInterface(parent) -{ - m_scopes << new MockScope("MockScope1", "People", this); - m_scopes << new MockScope("MockScope2", "Music", this); - m_scopes << new MockScope("MockScope3", "Apps", this); - m_scopes << new MockScope("MockScope4", "Videos", this); -} - -bool MockScopes::loaded() const -{ - return true; -} - -unity::shell::scopes::ScopeInterface* MockScopes::overviewScope() const -{ - return nullptr; -} - -int MockScopes::rowCount(const QModelIndex&) const -{ - return m_scopes.count(); -} - -int MockScopes::count() const -{ - return m_scopes.count(); -} - -QVariant MockScopes::data(const QModelIndex& index, int role) const -{ - if (!index.isValid() || index.row() >= m_scopes.size()) { - return QVariant(); - } - - MockScope* scope = m_scopes.at(index.row()); - - if (role == MockScopes::RoleScope) { - return QVariant::fromValue(scope); - } else if (role == MockScopes::RoleId) { - return QVariant::fromValue(scope->id()); - } else if (role == MockScopes::RoleTitle) { - return QVariant::fromValue(scope->name()); - } else { - return QVariant(); - } -} - -unity::shell::scopes::ScopeInterface* MockScopes::getScope(int row) const -{ - if (row < 0 || row >= m_scopes.size()) { - return nullptr; - } - - return m_scopes[row]; -} - -unity::shell::scopes::ScopeInterface* MockScopes::getScope(QString const&) const -{ - // Unimplemented - return nullptr; -} - -void MockScopes::setFavorite(QString const&, bool) -{ - // Unimplemented -} - -void MockScopes::moveFavoriteTo(QString const&, int) -{ - // Unimplemented -} - -void MockScopes::closeScope(unity::shell::scopes::ScopeInterface*) -{ - // Unimplemented -} diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.h b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.h deleted file mode 100644 index 2f12ba1..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifndef MOCK_SCOPES_H -#define MOCK_SCOPES_H - -#include - -// Qt -#include - -class MockScope; - -class UNITY_API MockScopes : public unity::shell::scopes::ScopesInterface -{ - Q_OBJECT - -public: - MockScopes(QObject *parent = 0); - - Q_INVOKABLE int rowCount(const QModelIndex& parent = QModelIndex()) const override; - - Q_INVOKABLE unity::shell::scopes::ScopeInterface* getScope(int row) const override; - Q_INVOKABLE unity::shell::scopes::ScopeInterface* getScope(const QString& scope_id) const override; - Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override; - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - - bool loaded() const override; - int count() const override; - unity::shell::scopes::ScopeInterface* overviewScope() const override; - - void setFavorite(QString const& scopeId, bool favorite) override; - void moveFavoriteTo(QString const& scopeId, int index) override; - -private: - QList m_scopes; - QHash m_roles; -}; - -#endif // SCOPES_H diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.cpp b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.cpp deleted file mode 100644 index 7fe805a..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "MockSelectorOptions.h" - -MockSelectorOptions::MockSelectorOptions(int num, QObject *parent) - : unity::shell::scopes::OptionSelectorOptionsInterface(parent), - m_numOfOptions(num) -{ -} - -QVariant MockSelectorOptions::data(const QModelIndex& index, int role) const -{ - if (index.row() >= 0 && index.row() < m_numOfOptions) - { - switch (role) - { - case unity::shell::scopes::OptionSelectorOptionsInterface::RoleOptionId: - return QVariant(QString("option") + QString::number(index.row())); - case Qt::DisplayRole: - case unity::shell::scopes::OptionSelectorOptionsInterface::RoleOptionLabel: - return QVariant(QString("Option") + QString::number(index.row())); - case unity::shell::scopes::OptionSelectorOptionsInterface::RoleOptionChecked: - return QVariant(false); - default: - return QVariant(); - } - } - return QVariant(); -} - -int MockSelectorOptions::rowCount(const QModelIndex&) const -{ - return m_numOfOptions; -} - -void MockSelectorOptions::setChecked(int, bool) -{ - qFatal("Using un-implemented setChecked() method"); -} diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.h b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.h deleted file mode 100644 index 1f2c8a7..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSelectorOptions.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2015 Canonical, Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef MOCKOPTIONSELECTOROPTIONS_H -#define MOCKOPTIONSELECTOROPTIONS_H - -#include - -class MockSelectorOptions : public unity::shell::scopes::OptionSelectorOptionsInterface -{ - Q_OBJECT - -public: - MockSelectorOptions(int num = 2, QObject *parent = 0); - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - int rowCount(const QModelIndex& parent = QModelIndex()) const override; - void setChecked(int index, bool checked) override; - -private: - int m_numOfOptions; -}; - -#endif diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSettingsModel.cpp b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSettingsModel.cpp deleted file mode 100644 index 6787197..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSettingsModel.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * Authors: - * Pete Woods - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "MockSettingsModel.h" - -MockSettingsModel::MockSettingsModel(QObject* parent) : - SettingsModelInterface(parent) { - - { - QVariantMap parameters; - m_data << QSharedPointer(new Data("boolean-setting", "Boolean Setting", "boolean", parameters, true)); - } - { - QVariantMap parameters; - parameters["values"] = QVariantList() << "First" << "Second" << "Third"; - m_data << QSharedPointer(new Data("list-setting", "List Setting", "list", parameters, 1)); - } - { - QVariantMap parameters; - m_data << QSharedPointer(new Data("number-setting", "Number Setting", "number", parameters, 1.23)); - } - { - QVariantMap parameters; - m_data << QSharedPointer(new Data("string-setting", "String Setting", "string", parameters, "flibble")); - } -} - -QVariant MockSettingsModel::data(const QModelIndex& index, int role) const { - - int row = index.row(); - QVariant result; - - if (row < m_data.size()) { - auto data = m_data[row]; - - switch (role) { - case Roles::RoleSettingId: - result = data->id; - break; - case Roles::RoleDisplayName: - result = data->displayName; - break; - case Roles::RoleType: - result = data->type; - break; - case Roles::RoleProperties: - result = data->properties; - break; - case Roles::RoleValue: { - result = data->value; - break; - } - default: - break; - } - } - - return result; -} - -bool MockSettingsModel::setData(const QModelIndex &index, const QVariant &value, - int role) { - int row = index.row(); - if (row < m_data.size()) { - switch (role) { - case SettingsModelInterface::RoleValue: { - auto data = m_data[row]; - data->value = value; - return true; - } - default: - break; - } - } - - return false; -} - -int MockSettingsModel::rowCount(const QModelIndex&) const { - return count(); -} - -int MockSettingsModel::count() const { - return m_data.size(); -} diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSettingsModel.h b/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSettingsModel.h deleted file mode 100644 index 403d245..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockSettingsModel.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2014 Canonical, Ltd. - * - * Authors: - * Pete Woods - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef MOCK_SETTTINGSMODEL_H -#define MOCK_SETTTINGSMODEL_H - -#include - -#include -#include - -class UNITY_API MockSettingsModel: public unity::shell::scopes::SettingsModelInterface { -Q_OBJECT - - struct Data { - QString id; - QString displayName; - QString type; - QVariant properties; - QVariant value; - - Data(QString const& id_, QString const& displayName_, - QString const& type_, QVariant const& properties_, - QVariant const& value_) : - id(id_), displayName(displayName_), type(type_), properties( - properties_), value(value_) { - } - }; - -public: - explicit MockSettingsModel(QObject* parent = 0); - - ~MockSettingsModel() = default; - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const - override; - - bool setData(const QModelIndex&index, const QVariant& value, int role = - Qt::EditRole) override; - - int rowCount(const QModelIndex& parent = QModelIndex()) const override; - - int count() const override; - -protected: - QList> m_data; -}; - -#endif // MOCK_SETTTINGSMODEL_H diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp b/test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp deleted file mode 100644 index 9e39cc6..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2014 Canonical Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - */ - -#include - -#include - -#include "CategoriesInterface.h" -#include "NavigationInterface.h" -#include "ResultsModelInterface.h" -#include "PreviewModelInterface.h" -#include "PreviewWidgetModelInterface.h" -#include "SettingsModelInterface.h" -#include "FiltersInterface.h" -#include "FilterBaseInterface.h" -#include "OptionSelectorOptionsInterface.h" -#include "OptionSelectorFilterInterface.h" -#include "RangeInputFilterInterface.h" -#include "Mocks/MockScopes.h" -#include "Mocks/MockScope.h" - -void TestScopesPlugin::registerTypes(const char* uri) -{ - qmlRegisterType(uri, 0, 2, "Scopes"); - qmlRegisterUncreatableType(uri, 0, 2, "Scope", "Can't create Categories object in QML. Get them from Scopes instance."); - qmlRegisterUncreatableType(uri, 0, 2, "Categories", "Can't create Categories object in QML. Get them from Scope instance."); - qmlRegisterUncreatableType(uri, 0, 2, "Navigation", "Can't create Navigation object in QML. Get them from Scope instance."); - qmlRegisterUncreatableType(uri, 0, 2, "ResultsModel", "Can't create new ResultsModel in QML. Get them from Categories instance."); - qmlRegisterUncreatableType(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from Scope instance."); - qmlRegisterUncreatableType(uri, 0, 2, "PreviewWidgetModel", "Can't create new PreviewWidgetModel in QML. Get them from PreviewModel instance."); - qmlRegisterUncreatableType(uri, 0, 2, "Settings", "Can't create new Settings in QML. Get them from Scope instance."); - qmlRegisterUncreatableType(uri, 0, 2, "FilterBase", "Can't create new Filter in QML. Get them from Filters instance."); - qmlRegisterUncreatableType(uri, 0, 2, "Filters", "Can't create new Filters in QML. Get them from Scope instance."); - qmlRegisterUncreatableType(uri, 0, 2, "OptionSelectorOptions", "Can't create new OptionSelectorOptions in QML. Get them from OptionSelectorFilter instance."); - qmlRegisterUncreatableType(uri, 0, 2, "OptionSelectorFilter", "Can't create new OptionSelectorFilter in QML. Get them from Filters instance."); - qmlRegisterUncreatableType(uri, 0, 2, "RangeInputFilter", "Can't create new RangeInputFilter in QML. Get them from Filters instance."); -} diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.h b/test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.h deleted file mode 100644 index 4e84653..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2014 Canonical Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - */ - -#ifndef TESTSCOPES_PLUGIN_H -#define TESTSCOPES_PLUGIN_H - -#include - -class TestScopesPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char* uri) override; -}; - -#endif diff --git a/test/qmltest/mocks/plugins/Unity/Scopes/qmldir b/test/qmltest/mocks/plugins/Unity/Scopes/qmldir deleted file mode 100644 index 45cfdcb..0000000 --- a/test/qmltest/mocks/plugins/Unity/Scopes/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -module Unity.Scopes -plugin TestScopesPlugin diff --git a/test/qmltest/unity/shell/CMakeLists.txt b/test/qmltest/unity/shell/CMakeLists.txt index c3ed474..0ac2bfe 100644 --- a/test/qmltest/unity/shell/CMakeLists.txt +++ b/test/qmltest/unity/shell/CMakeLists.txt @@ -9,4 +9,3 @@ set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal") add_qml_test(notifications Notifications) add_qml_test(launcher Launcher) add_qml_test(application Application) -add_qml_test(scopes Scopes) diff --git a/test/qmltest/unity/shell/scopes/tst_Scopes.qml b/test/qmltest/unity/shell/scopes/tst_Scopes.qml deleted file mode 100644 index 4eabf49..0000000 --- a/test/qmltest/unity/shell/scopes/tst_Scopes.qml +++ /dev/null @@ -1,617 +0,0 @@ -/* - * Copyright 2014 Canonical Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - */ - -import QtQuick 2.0 -import QtTest 1.0 -import TestUtil 0.1 -import Unity.Scopes 0.2 - -Item { - id: root - - Scopes { - id: scopes - } - property var scope: scopes.getScope(0) - property var preview: root.scope.preview("", "") - property var navigation: root.scope.getNavigation("root") - - Verifier { - id: scopesVerifier - - Repeater { - id: repeater - model: scopes - delegate: Item { - property var roles: model - } - } - - function test_scopes_data() { - return [ - { tag: "Scopes[object]", type: "object" }, - { tag: "Scopes[ScopesInterface]", type: "unity::shell::scopes::ScopesInterface" }, - ]; - } - - function test_scopes(data) { - object = repeater.model; - name = "Scopes"; - verifyData(data); - } - - function test_scopes_roles_data() { - return [ - { tag: "Model.roles[scope]", role: "scope", type: "object" }, - { tag: "Model.roles[id]", role: "id", type: "string" }, - { tag: "Model.roles[title]", role: "title", type: "string" }, - ]; - } - - function test_scopes_roles(data) { - object = repeater.itemAt(0).roles; - name = "Scopes"; - verifyData(data); - } - - function test_scopes_properties_data() { - return [ - { tag: "Item.properties[loaded]", constant: "loaded", type: "boolean" }, - { tag: "Item.properties[count]", constant: "count", type: "number" }, - { tag: "Item.properties[overviewScope]", constant: "overviewScope", type: "object" } - ]; - } - - function test_scopes_properties(data) { - object = repeater.model; - name = "Scopes"; - verifyData(data); - } - - function test_scopes_methods_data() { - return [ - { tag: "Model.methods[get]", method: "getScope" } - ]; - } - - function test_scopes_methods(data) { - object = repeater.model; - name = "Scopes" - verifyData(data); - } - } - - Verifier { - id: scopeVerifier - - function test_scope_data() { - return [ - { tag: "Scope[object]", type: "object" }, - { tag: "Scope[ScopeInterface]", type: "unity::shell::scopes::ScopeInterface" }, - ]; - } - - function test_scope(data) { - object = root.scope; - name = "Scope"; - verifyData(data); - } - - function test_scope_properties_data() { - return [ - { tag: "Item.properties[id]", constant: "id", type: "string" }, - { tag: "Item.properties[name]", constant: "name", type: "string" }, - { tag: "Item.properties[iconHint]", constant: "iconHint", type: "string" }, - { tag: "Item.properties[description]", constant: "description", type: "string" }, - { tag: "Item.properties[searchHint]", constant: "searchHint", type: "string" }, - { tag: "Item.properties[searchInProgress]", constant: "searchInProgress", type: "boolean" }, - { tag: "Item.properties[favorite]", constant: "favorite", type: "boolean" }, - { tag: "Item.properties[shortcut]", constant: "shortcut", type: "string" }, - { tag: "Item.properties[categories]", constant: "categories", type: "object" }, - { tag: "Item.properties[filters]", constant: "filters", type: "object" }, - { tag: "Item.properties[searchQuery]", constant: "searchQuery", type: "string" }, - { tag: "Item.properties[noResultsHint]", constant: "noResultsHint", type: "string" }, - { tag: "Item.properties[formFactor]", constant: "formFactor", type: "string" }, - { tag: "Item.properties[isActive]", constant: "isActive", type: "boolean" }, - { tag: "Item.properties[currentNavigationId]", constant: "currentNavigationId", type: "string" }, - { tag: "Item.properties[hasNavigation]", constant: "hasNavigation", type: "boolean" }, - { tag: "Item.properties[customizations]", constant: "customizations", type: "object" }, - { tag: "Item.properties[status]", constant: "status", type: "number" } - ]; - } - - function test_scope_properties(data) { - object = root.scope; - name = "Scope"; - verifyData(data); - } - - function test_scope_methods_data() { - return [ - { tag: "Model.methods[activate]", method: "activate" }, - { tag: "Model.methods[preview]", method: "preview" }, - { tag: "Model.methods[cancelActivation]", method: "cancelActivation" }, - { tag: "Model.methods[closeScope]", method: "closeScope" }, - { tag: "Model.methods[showDash]", method: "showDash" }, - { tag: "Model.methods[hideDash]", method: "hideDash" }, - { tag: "Model.methods[gotoUri]", method: "gotoUri" }, - { tag: "Model.methods[previewRequested]", method: "previewRequested" }, - { tag: "Model.methods[gotoScope]", method: "gotoScope" }, - { tag: "Model.methods[openScope]", method: "openScope" }, - { tag: "Model.methods[performQuery]", method: "performQuery" }, - { tag: "Model.methods[refresh]", method: "refresh" }, - { tag: "Model.methods[getNavigation]", method: "getNavigation" }, - { tag: "Model.methods[setNavigationState]", method: "setNavigationState" }, - ]; - } - - function test_scope_methods(data) { - object = root.scope; - name = "Scope" - verifyData(data); - } - } - - Verifier { - id: filtersVerifier - - Repeater { - id: filtersRepeater - model: root.scope.filters - delegate: Item { - property var roles: model - } - } - - function test_filters(data) { - object = filtersRepeater.model; - name = "Filters"; - verifyData(data); - } - - function test_filters_data() { - return [ - { tag: "Filters[object]", type: "object" }, - { tag: "Filters[FiltersInterface]", type: "unity::shell::scopes::FiltersInterface" }, - ]; - } - - function test_filters_roles(data) { - object = filtersRepeater.itemAt(0).roles; - name = "Filters"; - verifyData(data); - } - - function test_filters_roles_data() { - return [ - { tag: "Model.roles[id]", role: "id", type: "string" }, - { tag: "Model.roles[type]", role: "type", type: "number" }, - { tag: "Model.roles[filter]", role: "filter", type: "unity::shell::scopes::FilterBaseInterface" }, - ]; - } - } - - Verifier { - id: optionSelectorFilterVerifier - - function test_option_selector_filter(data) { - object = filtersRepeater.itemAt(0).roles.filter; - name = "Filter"; - verifyData(data); - } - - function test_option_selector_filter_data() { - return [ - { tag: "Filter[object]", type: "object" }, - { tag: "Filter[OptionSelectorFilterInterface]", type: "unity::shell::scopes::OptionSelectorFilterInterface" }, - ]; - } - - function test_option_selector_filter_properties_data() { - return [ - { tag: "Filter.properties[filterId]", constant: "filterId", type: "string" }, - { tag: "Filter.properties[label]", constant: "label", type: "string" }, - { tag: "Filter.properties[multiSelect]", constant: "multiSelect", type: "boolean" }, - { tag: "Filter.properties[options]", constant: "options", type: "object" }, - ]; - } - - function test_option_selector_filter_properties(data) { - object = filtersRepeater.itemAt(0).roles.filter; - name = "Filter"; - verifyData(data); - } - - function test_options_data() { - return [ - { tag: "Options[object]", type: "object" }, - { tag: "Options[OptionSelectorOptionsInterface]", type: "unity::shell::scopes::OptionSelectorOptionsInterface" }, - ]; - } - - function test_options(data) { - object = filtersRepeater.itemAt(0).roles.filter.options; - name = "Options"; - verifyData(data); - } - } - - Verifier { - id: optionSelectorFilterOptionsVerifier - - Repeater { - id: optionsRepeater - model: filtersRepeater.count > 0 ? filtersRepeater.itemAt(0).roles.filter.options : undefined - delegate: Item { - property var roles: model - } - } - - function test_option_selector_filter_options_roles_data() { - return [ - { tag: "Model.roles[id]", role: "id", type: "string" }, - { tag: "Model.roles[label]", role: "label", type: "string" }, - { tag: "Model.roles[checked]", role: "checked", type: "boolean" }, - ]; - } - - function test_option_selector_filter_options_roles(data) { - object = optionsRepeater.itemAt(0).roles; - name = "Options"; - verifyData(data); - } - } - - Verifier { - id: categoriesVerifier - - Repeater { - id: categoriesRepeater - model: root.scope.categories - delegate: Item { - property var roles: model - property var results: model.results - } - } - - function test_categories_data() { - return [ - { tag: "Categories[object]", type: "object" }, - { tag: "Categories[CategoriesInterface]", type: "unity::shell::scopes::CategoriesInterface" }, - ]; - } - - function test_categories(data) { - object = categoriesRepeater.model; - name = "Categories"; - verifyData(data); - } - - function test_categories_roles_data() { - return [ - { tag: "Model.roles[categoryId]", role: "categoryId", type: "string" }, - { tag: "Model.roles[name]", role: "name", type: "string" }, - { tag: "Model.roles[icon]", role: "icon", type: "string" }, - { tag: "Model.roles[rawRendererTemplate]", role: "rawRendererTemplate", type: "string" }, - { tag: "Model.roles[renderer]", role: "renderer", type: "object" }, - { tag: "Model.roles[components]", role: "components", type: "object" }, - { tag: "Model.roles[headerLink]", role: "headerLink", type: "string" }, - { tag: "Model.roles[results]", role: "results", type: "object" }, - { tag: "Model.roles[count]", role: "count", type: "number" }, - ]; - } - - function test_categories_roles(data) { - object = categoriesRepeater.itemAt(0).roles; - name = "Categories"; - verifyData(data); - } - - function test_categories_methods_data() { - return [ - { tag: "Model.methods[overrideCategoryJson]", method: "overrideCategoryJson" } - ]; - } - - function test_categories_methods(data) { - object = categoriesRepeater.model; - name = "Categories" - verifyData(data); - } - } - - Verifier { - id: settingsVerifier - - Repeater { - id: settingsRepeater - model: root.scope.settings - delegate: Item { - property var roles: model - } - } - - function test_settings_data() { - return [ - { tag: "Settings[object]", type: "object" }, - { tag: "Settings[SettingsModelInterface]", type: "unity::shell::scopes::SettingsModelInterface" }, - ]; - } - - function test_settings(data) { - object = settingsRepeater.model; - name = "Settings"; - verifyData(data); - } - - function test_settings_roles_data() { - return [ - { tag: "Model.roles[settingId]", role: "settingId", type: "string" }, - { tag: "Model.roles[displayName]", role: "displayName", type: "string" }, - { tag: "Model.roles[type]", role: "type", type: "string" }, - { tag: "Model.roles[properties]", role: "properties", type: "object" }, - // the first mocked setting is of type boolean - { tag: "Model.roles[value]", role: "value", type: "boolean" }, - ]; - } - - function test_settings_roles(data) { - object = settingsRepeater.itemAt(0).roles; - name = "Settings"; - verifyData(data); - } - - function test_settings_properties_data() { - return [ - { tag: "Item.properties[count]", constant: "count", type: "number" } - ]; - } - - function test_settings_properties(data) { - object = settingsRepeater.model; - name = "Settings"; - verifyData(data); - } - } - - Verifier { - id: resultsModelVerifier - - Repeater { - id: resultsModelRepeater - model: categoriesRepeater.count > 0 ? categoriesRepeater.itemAt(0).results : undefined - delegate: Item { - property var roles: model - } - } - - function test_resultsModel_data() { - return [ - { tag: "ResultsModel[object]", type: "object" }, - { tag: "ResultsModel[ResultsModelInterface]", type: "unity::shell::scopes::ResultsModelInterface" }, - ]; - } - - function test_resultsModel(data) { - object = categoriesRepeater.itemAt(0).results; - name = "ResultsModel"; - verifyData(data); - } - - function test_resultsModel_roles_data() { - return [ - { tag: "Model.roles[uri]", role: "uri", type: "string" }, - { tag: "Model.roles[categoryId]", role: "categoryId", type: "string" }, - { tag: "Model.roles[dndUri]", role: "dndUri", type: "string" }, - { tag: "Model.roles[result]", role: "result", type: "object" }, - { tag: "Model.roles[title]", role: "title", type: "string" }, - { tag: "Model.roles[art]", role: "art", type: "string" }, - { tag: "Model.roles[subtitle]", role: "subtitle", type: "string" }, - { tag: "Model.roles[mascot]", role: "mascot", type: "string" }, - { tag: "Model.roles[emblem]", role: "emblem", type: "string" }, - { tag: "Model.roles[summary]", role: "summary", type: "string" }, - { tag: "Model.roles[attributes]", role: "attributes", type: "string" }, - { tag: "Model.roles[background]", role: "background", type: "object" }, - { tag: "Model.roles[overlayColor]", role: "overlayColor", type: "string" }, - { tag: "Model.roles[socialActions]", role: "socialActions", type: "string" }, - ]; - } - - function test_resultsModel_roles(data) { - object = resultsModelRepeater.itemAt(0).roles; - name = "ResultsModel"; - verifyData(data); - } - - function test_resultsModel_properties_data() { - return [ - { tag: "Item.properties[categoryId]", constant: "categoryId", type: "string" }, - { tag: "Item.properties[count]", constant: "count", type: "number" } - ]; - } - - function test_resultsModel_properties(data) { - object = resultsModelRepeater.model; - name = "ResultsModel"; - verifyData(data); - } - } - - Verifier { - id: previewModelVerifier - - Repeater { - id: previewModelRepeater - model: preview - delegate: Item { - property var roles: model - property var columnModel: model.columnModel - } - } - - function test_previewModel_data() { - return [ - { tag: "PreviewModel[object]", type: "object" }, - { tag: "PreviewModel[PreviewModelInterface]", type: "unity::shell::scopes::PreviewModelInterface" }, - ]; - } - - function test_previewModel(data) { - object = previewModelRepeater.model; - name = "PreviewModel"; - verifyData(data); - } - - function test_previewModel_roles_data() { - return [ - { tag: "Model.roles[columnModel]", role: "columnModel", type: "object" } - ]; - } - - function test_previewModel_roles(data) { - object = previewModelRepeater.itemAt(0).roles; - name = "PreviewModel"; - verifyData(data); - } - - function test_previewModel_properties_data() { - return [ - { tag: "Item.properties[widgetColumnCount]", constant: "widgetColumnCount", type: "number" }, - { tag: "Item.properties[loaded]", constant: "loaded", type: "boolean" }, - { tag: "Item.properties[processingAction]", constant: "processingAction", type: "boolean" } - ]; - } - - function test_previewModel_properties(data) { - object = previewModelRepeater.model; - name = "PreviewModel"; - verifyData(data); - } - - function test_previewModel_methods_data() { - return [ - { tag: "Model.methods[triggered]", method: "triggered" } - ]; - } - - function test_previewModel_methods(data) { - object = previewModelRepeater.model; - name = "PreviewModel" - verifyData(data); - } - } - - Verifier { - id: previewWidgetModelVerifier - - Repeater { - id: previewWidgetModelRepeater - model: previewModelRepeater.count > 0 ? previewModelRepeater.itemAt(0).columnModel : undefined - delegate: Item { - property var roles: model - } - } - - function test_previewWidgetModel_data() { - return [ - { tag: "PreviewWidgetModel[object]", type: "object" }, - { tag: "PreviewWidgetModel[ScopesInterface]", type: "unity::shell::scopes::PreviewWidgetModelInterface" }, - ]; - } - - function test_previewWidgetModel(data) { - object = previewWidgetModelRepeater.model; - name = "PreviewWidgetModel"; - verifyData(data); - } - - function test_previewWidgetModel_roles_data() { - return [ - { tag: "Model.roles[widgetId]", role: "widgetId", type: "string" }, - { tag: "Model.roles[type]", role: "type", type: "string" }, - { tag: "Model.roles[properties]", role: "properties", type: "object" } - ]; - } - - function test_previewWidgetModel_roles(data) { - object = previewWidgetModelRepeater.itemAt(0).roles; - name = "PreviewWidgetModel"; - verifyData(data); - } - } - - - Verifier { - id: navigationVerifier - - Repeater { - id: navigationRepeater - model: root.navigation - delegate: Item { - property var roles: model - } - } - - function test_navigation_data() { - return [ - { tag: "Navigation[object]", type: "object" }, - { tag: "Navigation[NavigationInterface]", type: "unity::shell::scopes::NavigationInterface" }, - ]; - } - - function test_navigation(data) { - object = navigationRepeater.model; - name = "Navigation"; - verifyData(data); - } - - function test_navigation_roles_data() { - return [ - { tag: "Model.roles[navigationId]", role: "navigationId", type: "string" }, - { tag: "Model.roles[label]", role: "label", type: "string" }, - { tag: "Model.roles[hasChildren]", role: "hasChildren", type: "boolean" }, - { tag: "Model.roles[isActive]", role: "isActive", type: "boolean" } - ]; - } - - function test_navigation_roles(data) { - object = navigationRepeater.itemAt(0).roles; - name = "Navigation"; - verifyData(data); - } - - function test_navigation_properties_data() { - return [ - { tag: "Model.properties[navigationId]", constant: "navigationId", type: "string" }, - { tag: "Model.properties[label]", constant: "label", type: "string" }, - { tag: "Model.properties[allLabel]", constant: "allLabel", type: "string" }, - { tag: "Model.properties[parentNavigationId]", constant: "parentNavigationId", type: "string" }, - { tag: "Model.properties[parentLabel]", constant: "parentLabel", type: "string" }, - { tag: "Model.properties[loaded]", constant: "loaded", type: "boolean" }, - { tag: "Model.properties[isRoot]", constant: "isRoot", type: "boolean" }, - { tag: "Model.properties[hidden]", constant: "hidden", type: "boolean" }, - { tag: "Model.properties[count]", constant: "count", type: "number" } - ]; - } - - function test_navigation_properties(data) { - object = navigationRepeater.model; - name = "Navigation"; - verifyData(data); - } - } -}