My Project
ModelInterface.h
1 /*
2  * Copyright 2013 Canonical Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authors:
17  * MichaƂ Sawicz <michal.sawicz@canonical.com>
18  */
19 
20 
21 #ifndef UNITY_SHELL_NOTIFICATIONS_MODELINTERFACE_H
22 #define UNITY_SHELL_NOTIFICATIONS_MODELINTERFACE_H
23 
24 #include <unity/SymbolExport.h>
25 
26 #include <QtCore/QAbstractListModel>
27 
28 namespace unity
29 {
30 
31 namespace shell
32 {
33 
34 namespace notifications
35 {
36 
37 
47 class UNITY_API ModelInterface : public QAbstractListModel
48 {
49  Q_OBJECT
50  Q_ENUMS(Roles)
51 
52 
61  Q_PROPERTY(bool confirmationPlaceholder READ confirmationPlaceholder WRITE setConfirmationPlaceholder NOTIFY confirmationPlaceholderChanged)
62 
63 protected:
65  explicit ModelInterface(QObject* parent = 0) : QAbstractListModel(parent) { }
67 
68 public:
69  virtual ~ModelInterface() { }
70 
72  virtual bool confirmationPlaceholder() const = 0;
73  virtual void setConfirmationPlaceholder(bool confirmationPlaceholder) = 0;
75 
81  enum Roles {
82  RoleType = Qt::UserRole + 1,
83  RoleUrgency = Qt::UserRole + 2,
84  RoleId = Qt::UserRole + 3,
85  RoleSummary = Qt::UserRole + 4,
86  RoleBody = Qt::UserRole + 5,
87  RoleValue = Qt::UserRole + 6,
88  RoleIcon = Qt::UserRole + 7,
89  RoleSecondaryIcon = Qt::UserRole + 8,
90  RoleActions = Qt::UserRole + 9,
91  RoleHints = Qt::UserRole + 10,
92  RoleNotification = Qt::UserRole + 11
93  };
94 
95 Q_SIGNALS:
101  void confirmationPlaceholderChanged(bool confirmationPlaceholder);
102 };
103 
104 } // namespace notifications
105 
106 } // namespace shell
107 
108 } // namespace unity
109 
110 #endif // UNITY_SHELL_NOTIFICATIONS_MODELINTERFACE_H
A list of notifications to be displayed.
Definition: ModelInterface.h:47
Roles
NotificationModel's data-role enumeration.
Definition: ModelInterface.h:81
Top-level namespace for all things Unity-related.
Definition: Version.h:37