File indexing completed on 2024-05-05 16:47:04
0001 /* 0002 SPDX-FileCopyrightText: 2010 Aleix Pol Gonzalez <aleixpol@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 */ 0006 0007 #ifndef SESSIONSMODEL_H 0008 #define SESSIONSMODEL_H 0009 0010 #include <QModelIndex> 0011 #include <shell/session.h> 0012 0013 class SessionsModel : public QAbstractListModel 0014 { 0015 Q_OBJECT 0016 public: 0017 enum Roles { Uuid = Qt::UserRole+1, Projects, ProjectNames, VisibleIdentifier }; 0018 explicit SessionsModel(QObject* parent = nullptr); 0019 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; 0020 int rowCount(const QModelIndex& parent = QModelIndex()) const override; 0021 QHash< int, QByteArray > roleNames() const override; 0022 0023 Q_SCRIPTABLE void loadSession(const QString& nameOrId) const; 0024 private: 0025 KDevelop::SessionInfos m_sessions; 0026 0027 private Q_SLOTS: 0028 void sessionDeleted(const QString& id); 0029 }; 0030 0031 #endif // SESSIONSMODEL_H