2019-10-27 17:08:51 +00:00
|
|
|
/**
|
|
|
|
* SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLUGINMODEL
|
|
|
|
#define PLUGINMODEL
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
|
2020-11-15 23:28:44 +00:00
|
|
|
#include <KPluginMetaData>
|
|
|
|
#include <KSharedConfig>
|
2019-10-27 17:08:51 +00:00
|
|
|
|
|
|
|
#include "interfaces/dbusinterfaces.h"
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
class KDECONNECTINTERFACES_EXPORT PluginModel : public QAbstractListModel
|
2019-10-27 17:08:51 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString deviceId READ deviceId WRITE setDeviceId)
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum ExtraRoles {
|
|
|
|
IconRole = Qt::UserRole + 1,
|
|
|
|
IdRole,
|
2020-11-15 23:39:23 +00:00
|
|
|
ConfigSourceRole,
|
|
|
|
DescriptionRole,
|
2019-10-27 17:08:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Q_ENUM(ExtraRoles)
|
|
|
|
|
|
|
|
explicit PluginModel(QObject *parent = nullptr);
|
|
|
|
~PluginModel() override;
|
|
|
|
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
2022-09-10 22:23:52 +01:00
|
|
|
void setDeviceId(const QString &deviceId);
|
2019-10-27 17:08:51 +00:00
|
|
|
QString deviceId();
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
2022-09-10 22:23:52 +01:00
|
|
|
void deviceIdChanged(const QString &value);
|
2019-10-27 17:08:51 +00:00
|
|
|
void rowsChanged();
|
|
|
|
|
|
|
|
private:
|
2020-11-15 23:28:44 +00:00
|
|
|
QVector<KPluginMetaData> m_plugins;
|
2019-10-27 17:08:51 +00:00
|
|
|
QString m_deviceId;
|
|
|
|
KSharedConfigPtr m_config;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // KPLUGINSELECTOR_P_H
|