My Project
FiltersInterface.h
1 /*
2  * Copyright (C) 2015 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef UNITY_SHELL_SCOPES_FILTERSINTERFACE_H
18 #define UNITY_SHELL_SCOPES_FILTERSINTERFACE_H
19 
20 #include <unity/SymbolExport.h>
21 
22 #include <QAbstractListModel>
23 
24 namespace unity
25 {
26 namespace shell
27 {
28 namespace scopes
29 {
30 
31 class UNITY_API FiltersInterface : public QAbstractListModel
32 {
33  Q_OBJECT
34 
35  Q_ENUMS(Roles)
36  Q_ENUMS(FilterType)
37 
38 public:
39  enum Roles {
40  RoleFilterId = Qt::UserRole + 1,
41  RoleFilterType,
42  RoleFilter
43  };
44 
45  enum FilterType {
46  Invalid,
47  OptionSelectorFilter,
48  RangeInputFilter,
49  ValueSliderFilter,
50  ExpandableFilterWidget
51  // TODO add remaining filters
52  };
53 
54  QHash<int, QByteArray> roleNames() const override
55  {
56  QHash<int, QByteArray> roles;
57  roles[RoleFilterId] = "id";
58  roles[RoleFilterType] = "type";
59  roles[RoleFilter] = "filter";
60  return roles;
61  }
62 
63 protected:
65  explicit FiltersInterface(QObject* parent = 0) : QAbstractListModel(parent) {}
67 };
68 
69 }
70 
71 }
72 }
73 
74 Q_DECLARE_METATYPE(unity::shell::scopes::FiltersInterface*)
75 
76 #endif
Definition: FiltersInterface.h:31
Top-level namespace for all things Unity-related.
Definition: Version.h:37