My Project
PreviewModelInterface.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_PREVIEWMODELINTERFACE_H
18 #define UNITY_SHELL_SCOPES_PREVIEWMODELINTERFACE_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 
37 class UNITY_API PreviewModelInterface : public QAbstractListModel
38 {
39  Q_OBJECT
40 
41  Q_ENUMS(Roles)
42 
43 
50  Q_PROPERTY(int widgetColumnCount READ widgetColumnCount WRITE setWidgetColumnCount NOTIFY widgetColumnCountChanged)
51 
55  Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
56 
64  Q_PROPERTY(bool processingAction READ processingAction NOTIFY processingActionChanged)
65 
66 protected:
68  explicit PreviewModelInterface(QObject* parent = 0) : QAbstractListModel(parent) { }
70 
71 public:
75  enum Roles {
76  RoleColumnModel
77  };
78 
79  // @cond
80  virtual void setWidgetColumnCount(int count) = 0;
81  virtual int widgetColumnCount() const = 0;
82  virtual bool loaded() const = 0;
83  virtual bool processingAction() const = 0;
84  QHash<int, QByteArray> roleNames() const override
85  {
86  QHash<int, QByteArray> roles;
87  roles[RoleColumnModel] = "columnModel";
88  return roles;
89  }
90  // @endcond
91 
92 Q_SIGNALS:
93  // @cond
94  void widgetColumnCountChanged();
95  void loadedChanged();
96  void processingActionChanged();
97  // @endcond
98 
105  void triggered(QString const&, QString const&, QVariantMap const&);
106 };
107 
108 }
109 }
110 }
111 
113 
114 #endif
A list of PreviewWidgetModelInterface instances.
Definition: PreviewModelInterface.h:37
Roles
The roles supported by this model.
Definition: PreviewModelInterface.h:75
Top-level namespace for all things Unity-related.
Definition: Version.h:37