My Project
QuickListModelInterface.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  * Michael Zanetti <michael.zanetti@canonical.com>
18  */
19 
20 #ifndef LOMIRI_SHELL_LAUNCHER_QUICKLISTMODELINTERFACE_H
21 #define LOMIRI_SHELL_LAUNCHER_QUICKLISTMODELINTERFACE_H
22 
23 #include <lomiri/SymbolExport.h>
24 
25 #include <QtCore/QAbstractListModel>
26 
27 namespace lomiri
28 {
29 namespace shell
30 {
31 namespace launcher
32 {
33 
44 class LOMIRI_API QuickListModelInterface: public QAbstractListModel
45 {
46  Q_OBJECT
47 
48 protected:
50  explicit QuickListModelInterface(QObject *parent = 0) : QAbstractListModel(parent) {
51  m_roleNames.insert(RoleLabel, "label");
52  m_roleNames.insert(RoleIcon, "icon");
53  m_roleNames.insert(RoleClickable, "clickable");
54  m_roleNames.insert(RoleHasSeparator, "hasSeparator");
55  m_roleNames.insert(RoleIsPrivate, "isPrivate");
56  }
58 public:
64  enum Roles {
65  RoleLabel,
66  RoleIcon,
67  RoleClickable,
68  RoleHasSeparator,
69  RoleIsPrivate
70  };
71  Q_ENUM(Roles)
72 
73 
74  virtual ~QuickListModelInterface() {}
76 
78  QHash<int, QByteArray> roleNames() const override {
79  return m_roleNames;
80  }
82 
83 protected:
85  QHash<int, QByteArray> m_roleNames;
87 
88 };
89 
90 } // launcher
91 } // shell
92 } // lomiri
93 
94 #endif // LOMIRI_SHELL_LAUNCHER_QUICKLISTMODELINTERFACE_H
lomiri::shell::launcher::QuickListModelInterface
A model containing QuickList actions for an application in the launcher.
Definition: QuickListModelInterface.h:44
lomiri
Top-level namespace for all things Lomiri-related.
Definition: Version.h:37
lomiri::shell::launcher::QuickListModelInterface::Roles
Roles
The Roles supported by the model.
Definition: QuickListModelInterface.h:64