1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
/*
SPDX-FileCopyrightText: 2024 Friedrich W. H. Kossebau <kossebau@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#ifndef SESSIONLISTMODEL_H
#define SESSIONLISTMODEL_H
// KDevPlatform
#include <shell/session.h>
// Qt
#include <QAbstractListModel>
class SessionListModel : public QAbstractListModel
{
Q_OBJECT
public:
enum {
SessionIdRole = Qt::UserRole,
};
explicit SessionListModel(QObject* parent = nullptr);
public: // QAbstractListModel API
QVariant data(const QModelIndex& index, int role) const override;
int rowCount(const QModelIndex& index) const override;
QHash<int, QByteArray> roleNames() const override;
public:
int size() const;
Q_SIGNALS:
void sizeChanged(int size);
private Q_SLOTS:
void onSessionDeleted(const QString& id);
private:
KDevelop::SessionInfos m_sessions;
};
#endif
|