]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - liblightdm-qt/QLightDM/sessionsmodel.h
dd200990c88c305d8cd936b5535552c4a335350e
[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             TypeRole
32         };
33
34         enum SessionType {
35             LocalSessions,
36             RemoteSessions
37         };
38
39         explicit SessionsModel(QObject *parent = 0); /** Deprecated. Loads local sessions*/
40         explicit SessionsModel(SessionsModel::SessionType, QObject *parent = 0);
41         virtual ~SessionsModel();
42
43         int rowCount(const QModelIndex &parent) const;
44         QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const;
45
46     protected:
47         SessionsModelPrivate *d_ptr;
48         
49     private:
50         Q_DECLARE_PRIVATE(SessionsModel)
51     };
52 }
53
54 #endif // QLIGHTDM_SESSION_H