Changeset View
Changeset View
Standalone View
Standalone View
src/sessionmodel.cpp
Show All 11 Lines | |||||
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the | 15 | * along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | ***************************************************************************/ | 18 | ***************************************************************************/ | ||
19 | 19 | | |||
20 | #include "config.h" | ||||
20 | #include "sessionmodel.h" | 21 | #include "sessionmodel.h" | ||
21 | 22 | | |||
22 | #include <QDir> | 23 | #include <QDir> | ||
23 | #include <QFile> | 24 | #include <QFile> | ||
24 | #include <QList> | 25 | #include <QList> | ||
25 | #include <QTextStream> | 26 | #include <QTextStream> | ||
26 | 27 | | |||
27 | #include <memory> | 28 | #include <memory> | ||
Show All 13 Lines | |||||
41 | 42 | | |||
42 | class SessionModelPrivate { | 43 | class SessionModelPrivate { | ||
43 | public: | 44 | public: | ||
44 | int lastIndex { 0 }; | 45 | int lastIndex { 0 }; | ||
45 | QList<SessionPtr> sessions; | 46 | QList<SessionPtr> sessions; | ||
46 | }; | 47 | }; | ||
47 | 48 | | |||
48 | SessionModel::SessionModel(QObject *parent) : QAbstractListModel(parent), d(new SessionModelPrivate()) { | 49 | SessionModel::SessionModel(QObject *parent) : QAbstractListModel(parent), d(new SessionModelPrivate()) { | ||
49 | loadDir(QStringLiteral("/usr/share/xsessions"), SessionTypeX); | 50 | loadDir(QStringLiteral(XSESSIONS_DIR), SessionTypeX); | ||
50 | loadDir(QStringLiteral("/usr/share/wayland-sessions"), SessionTypeWayland); | 51 | loadDir(QStringLiteral(WAYLAND_SESSIONS_DIR), SessionTypeWayland); | ||
51 | } | 52 | } | ||
52 | 53 | | |||
53 | SessionModel::~SessionModel() { | 54 | SessionModel::~SessionModel() { | ||
54 | delete d; | 55 | delete d; | ||
55 | } | 56 | } | ||
56 | 57 | | |||
57 | void SessionModel::loadDir(const QString &path, SessionType type) | 58 | void SessionModel::loadDir(const QString &path, SessionType type) | ||
58 | { | 59 | { | ||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |