My Project
Loading...
Searching...
No Matches
CategoriesInterface.h
1/*
2 * Copyright (C) 2014 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_CATEGORESINTERFACE_H
18#define UNITY_SHELL_SCOPES_CATEGORESINTERFACE_H
19
20#include <unity/SymbolExport.h>
21
22#include <QAbstractListModel>
23
24namespace unity
25{
26namespace shell
27{
28namespace scopes
29{
30
37class UNITY_API CategoriesInterface : public QAbstractListModel
38{
39 Q_OBJECT
40
41protected:
43 explicit CategoriesInterface(QObject* parent = 0) : QAbstractListModel(parent) { }
45
46public:
50 enum Roles {
51 RoleCategoryId,
52 RoleName,
53 RoleIcon,
54 RoleRawRendererTemplate,
55 RoleRenderer,
56 RoleComponents,
57 RoleHeaderLink,
58 RoleResults,
59 RoleCount
60 };
61 Q_ENUM(Roles)
62
63
69 Q_INVOKABLE virtual bool overrideCategoryJson(QString const& categoryId, QString const& json) = 0;
70
71 // @cond
72 QHash<int, QByteArray> roleNames() const override
73 {
74 QHash<int, QByteArray> roles;
75 roles[RoleCategoryId] = "categoryId";
76 roles[RoleName] = "name";
77 roles[RoleIcon] = "icon";
78 roles[RoleRawRendererTemplate] = "rawRendererTemplate";
79 roles[RoleRenderer] = "renderer";
80 roles[RoleComponents] = "components";
81 roles[RoleHeaderLink] = "headerLink";
82 roles[RoleResults] = "results";
83 roles[RoleCount] = "count";
84 return roles;
85 }
86 // @endcond
87};
88
89}
90}
91}
92
94
95#endif
A list of categories for a particular search.
Definition CategoriesInterface.h:38
Roles
The roles supported by this model.
Definition CategoriesInterface.h:50
Top-level namespace for all things Unity-related.
Definition Version.h:38