File: pluginmodel.h

package info (click to toggle)
kdeconnect 25.04.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,584 kB
  • sloc: cpp: 22,922; xml: 520; python: 92; sh: 25; makefile: 5
file content (52 lines) | stat: -rw-r--r-- 1,352 bytes parent folder | download | duplicates (2)
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
45
46
47
48
49
50
51
52
/**
 * 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>

#include <KPluginMetaData>
#include <KSharedConfig>

#include "interfaces/dbusinterfaces.h"

class KDECONNECTINTERFACES_EXPORT PluginModel : public QAbstractListModel
{
    Q_OBJECT
    Q_PROPERTY(QString deviceId READ deviceId WRITE setDeviceId)

public:
    enum ExtraRoles {
        IconRole = Qt::UserRole + 1,
        IdRole,
        ConfigSourceRole,
        DescriptionRole,
    };

    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;
    void setDeviceId(const QString &deviceId);
    QString deviceId();

Q_SIGNALS:
    void deviceIdChanged(const QString &value);
    void rowsChanged();

private:
    QVector<KPluginMetaData> m_plugins;
    QString m_deviceId;
    KSharedConfigPtr m_config;
};

#endif // KPLUGINSELECTOR_P_H