My Project
Loading...
Searching...
No Matches
ResultsModelInterface.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_RESULTSMODELINTERFACE_H
18#define UNITY_SHELL_SCOPES_RESULTSMODELINTERFACE_H
19
20#include <unity/SymbolExport.h>
21
22#include <QAbstractListModel>
23
24namespace unity
25{
26namespace shell
27{
28namespace scopes
29{
30
34class UNITY_API ResultsModelInterface : public QAbstractListModel
35{
36 Q_OBJECT
37
41 Q_PROPERTY(QString categoryId READ categoryId WRITE setCategoryId NOTIFY categoryIdChanged)
42
43
46 Q_PROPERTY(int count READ count NOTIFY countChanged)
47
48protected:
50 explicit ResultsModelInterface(QObject* parent = 0) : QAbstractListModel(parent) { }
52
53public:
57 enum Roles {
58 RoleUri,
59 RoleCategoryId,
60 RoleDndUri,
61 RoleResult,
62 // card components
63 RoleTitle,
64 RoleArt,
65 RoleSubtitle,
66 RoleMascot,
67 RoleEmblem,
68 RoleSummary,
69 RoleAttributes,
70 RoleBackground,
71 RoleOverlayColor,
73 RoleSocialActions
74 };
75 Q_ENUM(Roles)
76
77 // @cond
78 virtual QString categoryId() const = 0;
79 virtual int count() const = 0;
80
81 virtual void setCategoryId(QString const& id) = 0;
82 QHash<int, QByteArray> roleNames() const override
83 {
84 QHash<int, QByteArray> roles;
85 roles[RoleUri] = "uri";
86 roles[RoleCategoryId] = "categoryId";
87 roles[RoleDndUri] = "dndUri";
88 roles[RoleQuickPreviewData] = "quickPreviewData";
89 roles[RoleResult] = "result";
90 roles[RoleTitle] = "title";
91 roles[RoleArt] = "art";
92 roles[RoleSubtitle] = "subtitle";
93 roles[RoleMascot] = "mascot";
94 roles[RoleEmblem] = "emblem";
95 roles[RoleSummary] = "summary";
96 roles[RoleAttributes] = "attributes";
97 roles[RoleBackground] = "background";
98 roles[RoleOverlayColor] = "overlayColor";
99 roles[RoleSocialActions] = "socialActions";
100 return roles;
101 }
102
103 // @endcond
104
105Q_SIGNALS:
106 // @cond
107 void categoryIdChanged();
108 void countChanged();
109 // @endcond
110};
111
112}
113}
114}
115
117
118#endif
A model of scope results for a particular category.
Definition ResultsModelInterface.h:35
Roles
The Roles supported by this model.
Definition ResultsModelInterface.h:57
@ RoleQuickPreviewData
Data for UI quick previewing. In case of audio should contain uri and duration.
Definition ResultsModelInterface.h:72
Top-level namespace for all things Unity-related.
Definition Version.h:38