Lomiri
Loading...
Searching...
No Matches
SessionsModel.h
1/*
2 * Copyright (C) 2015 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
18#ifndef LOMIRI_INTEGRATED_SESSIONSMODEL_H
19#define LOMIRI_INTEGRATED_SESSIONSMODEL_H
20
21#include <QtCore/QAbstractListModel>
22#include <QtCore/QString>
23
24/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
25 * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
26 * COUNTERPART IN tests/mocks/LightDM/IntegratedLightDM/liblightdm
27 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
28
29// This is taken from liblightdm and modified to confirm to our syle conventions
30namespace QLightDM
31{
32class SessionsModelPrivate;
33
34class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
35 {
36 Q_OBJECT
37
38 public:
39
40 enum SessionModelRoles {
41 //name is exposed as Qt::DisplayRole
42 //comment is exposed as Qt::TooltipRole
43 KeyRole = Qt::UserRole,
44 IdRole = KeyRole,
45 TypeRole
46 };
47 Q_ENUM(SessionModelRoles)
48
49 enum SessionType {
50 LocalSessions,
51 RemoteSessions
52 };
53 Q_ENUM(SessionType)
54
55 explicit SessionsModel(QObject* parent=0);
56 explicit SessionsModel(SessionsModel::SessionType, QObject* parent=0);
57 virtual ~SessionsModel();
58
59 QHash<int, QByteArray> roleNames() const override;
60 int rowCount(const QModelIndex& parent) const override;
61 QVariant data(const QModelIndex& index, int role) const override;
62
63 protected:
64 SessionsModelPrivate* const d_ptr;
65
66 private:
67 QHash<int, QByteArray> m_roleNames;
68 Q_DECLARE_PRIVATE(SessionsModel)
69 };
70}
71
72#endif // LOMIRI_INTEGRATED_SESSIONSMODEL_H