2
* Copyright (C) 2014 Canonical, Ltd.
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.
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.
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/>.
17
#ifndef UNITY_SHELL_SCOPES_DEPARTMENTINTERFACE_H
18
#define UNITY_SHELL_SCOPES_DEPARTMENTINTERFACE_H
20
#include <unity/SymbolExport.h>
22
#include <QAbstractListModel>
32
* @brief Object representing department instance, which exposes model(s) with results.
34
class UNITY_API DepartmentInterface : public QAbstractListModel
41
* @brief Id of the department.
43
Q_PROPERTY(QString departmentId READ departmentId NOTIFY departmentIdChanged)
46
* @brief Label of the department.
48
Q_PROPERTY(QString label READ label NOTIFY labelChanged)
51
* @brief Label for "All Button" of the department.
53
Q_PROPERTY(QString allLabel READ allLabel NOTIFY allLabelChanged)
56
* @brief Parent Id of the department.
58
Q_PROPERTY(QString parentDepartmentId READ parentDepartmentId NOTIFY parentDepartmentIdChanged)
61
* @brief Parent label of the department.
63
Q_PROPERTY(QString parentLabel READ parentLabel NOTIFY parentLabelChanged)
66
* @brief Is the model of the deparment completely loaded?
68
Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
71
* @brief Is this deparment the root deparment?
73
Q_PROPERTY(bool isRoot READ isRoot NOTIFY isRootChanged)
76
* @brief Number of items of the deparment.
78
Q_PROPERTY(int count READ count NOTIFY countChanged)
82
explicit DepartmentInterface(QObject* parent = 0) : QAbstractListModel(parent) { }
87
* @brief The roles supported by this model.
97
virtual QString departmentId() const = 0;
98
virtual QString label() const = 0;
99
virtual QString allLabel() const = 0;
100
virtual QString parentDepartmentId() const = 0;
101
virtual QString parentLabel() const = 0;
102
virtual bool loaded() const = 0;
103
virtual bool isRoot() const = 0;
104
virtual int count() const = 0;
105
QHash<int, QByteArray> roleNames() const override
107
QHash<int, QByteArray> roles;
108
roles[RoleDepartmentId] = "departmentId";
109
roles[RoleLabel] = "label";
110
roles[RoleHasChildren] = "hasChildren";
111
roles[RoleIsActive] = "isActive";
118
void departmentIdChanged();
120
void allLabelChanged();
121
void parentDepartmentIdChanged();
122
void parentLabelChanged();
123
void loadedChanged();
124
void isRootChanged();
133
Q_DECLARE_METATYPE(unity::shell::scopes::DepartmentInterface*)