2
* Copyright (C) 2015 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/>.
18
#ifndef UNITY_INTEGRATED_SESSIONSMODEL_H
19
#define UNITY_INTEGRATED_SESSIONSMODEL_H
21
#include <QtCore/QAbstractListModel>
22
#include <QtCore/QString>
24
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
25
* CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
26
* COUNTERPART IN tests/mocks/LightDM/IntegratedLightDM/liblightdm
27
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
29
// This is taken from liblightdm and modified to confirm to our syle conventions
32
class SessionsModelPrivate;
34
class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
38
Q_ENUMS(SessionModelRoles SessionType)
42
enum SessionModelRoles {
43
//name is exposed as Qt::DisplayRole
44
//comment is exposed as Qt::TooltipRole
45
KeyRole = Qt::UserRole,
46
IdRole = KeyRole, /** Deprecated */
55
explicit SessionsModel(QObject* parent=0); /** Deprecated. Loads local sessions*/
56
explicit SessionsModel(SessionsModel::SessionType, QObject* parent=0);
57
virtual ~SessionsModel();
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;
64
SessionsModelPrivate* const d_ptr;
67
QHash<int, QByteArray> m_roleNames;
68
Q_DECLARE_PRIVATE(SessionsModel)
72
#endif // UNITY_INTEGRATED_SESSIONSMODEL_H