Brooklyn/plasma/kcms/tablet/devicesmodel.h
Scare Crowe d2ebfd0519 QortalOS Titan 5.60.12
Screw the description like that inbred T3Q
2022-03-05 21:17:59 +05:00

45 lines
1.0 KiB
C++

/*
SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QAbstractListModel>
class QDBusInterface;
class InputDevice;
class DevicesModel : public QAbstractListModel
{
Q_OBJECT
public:
DevicesModel(QObject *parent = nullptr);
QHash<int, QByteArray> roleNames() const override;
QVariant data(const QModelIndex &index, int role) const override;
int rowCount(const QModelIndex &parent) const override;
Q_SCRIPTABLE InputDevice *deviceAt(int row) const;
void load();
void save();
void defaults();
bool isSaveNeeded() const;
bool isDefaults() const;
static DevicesModel *self();
private Q_SLOTS:
void onDeviceAdded(const QString &sysName);
void onDeviceRemoved(const QString &sysName);
Q_SIGNALS:
void needsSaveChanged();
private:
void addDevice(const QString &sysname, bool tellModel);
void resetModel();
QVector<InputDevice *> m_devices;
QDBusInterface *m_deviceManager;
};