]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - liblightdm-qt/QLightDM/sessionsmodel.h
77c81fb215995f3cc9396f72395205867bc858f6
[sojka/lightdm.git] / liblightdm-qt / QLightDM / sessionsmodel.h
1 /*
2  * Copyright (C) 2010-2011 David Edmundson.
3  * Author: David Edmundson <kde@davidedmundson.co.uk>
4  *
5  * This library is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License as published by the Free
7  * Software Foundation; either version 2 or version 3 of the License.
8  * See http://www.gnu.org/copyleft/lgpl.html the full text of the license.
9  */
10
11 #ifndef QLIGHTDM_SESSIONS_MODEL_H
12 #define QLIGHTDM_SESSIONS_MODEL_H
13
14 #include <QtCore/QAbstractListModel>
15
16 class SessionsModelPrivate;
17
18 namespace QLightDM {
19     class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
20     {
21         Q_OBJECT
22
23         Q_ENUMS(SessionModelRoles SessionType)
24
25     public:
26         enum SessionModelRoles {
27             //name is exposed as Qt::DisplayRole
28             //comment is exposed as Qt::TooltipRole
29             KeyRole = Qt::UserRole,
30             IdRole = KeyRole /** Deprecated */
31         };
32
33         enum SessionType {
34             LocalSessions,
35             RemoteSessions
36         };
37
38         explicit SessionsModel(QObject *parent = 0); /** Deprecated. Loads local sessions*/
39         explicit SessionsModel(SessionsModel::SessionType, QObject *parent = 0);
40         virtual ~SessionsModel();
41
42         int rowCount(const QModelIndex &parent) const;
43         QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const;
44
45     protected:
46         SessionsModelPrivate *d_ptr;
47         
48     private:
49         Q_DECLARE_PRIVATE(SessionsModel)
50     };
51 }
52
53 #endif // QLIGHTDM_SESSION_H