File indexing completed on 2024-05-26 05:37:09
0001 /* 0002 SPDX-FileCopyrightText: 2018 Roman Gilg <subdiff@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "inputbackend.h" 0010 0011 #include <QList> 0012 0013 class QDBusInterface; 0014 0015 class KWinWaylandBackend : public InputBackend 0016 { 0017 Q_OBJECT 0018 0019 Q_PROPERTY(int deviceCount READ deviceCount CONSTANT) 0020 Q_PROPERTY(QVariantMap buttonMapping READ buttonMapping WRITE setButtonMapping NOTIFY buttonMappingChanged) 0021 0022 public: 0023 explicit KWinWaylandBackend(QObject *parent = nullptr); 0024 ~KWinWaylandBackend(); 0025 0026 bool applyConfig() override; 0027 bool getConfig() override; 0028 bool getDefaultConfig() override; 0029 bool isChangedConfig() const override; 0030 QString errorString() const override 0031 { 0032 return m_errorString; 0033 } 0034 0035 virtual int deviceCount() const override 0036 { 0037 return m_devices.count(); 0038 } 0039 virtual QList<QObject *> getDevices() const override 0040 { 0041 return m_devices; 0042 } 0043 0044 QVariantMap buttonMapping(); 0045 void setButtonMapping(const QVariantMap &mapping); 0046 0047 Q_SIGNALS: 0048 void buttonMappingChanged(); 0049 0050 private Q_SLOTS: 0051 void onDeviceAdded(QString); 0052 void onDeviceRemoved(QString); 0053 0054 private: 0055 void findDevices(); 0056 0057 QDBusInterface *m_deviceManager; 0058 QList<QObject *> m_devices; 0059 QVariantMap m_buttonMapping; 0060 QVariantMap m_loadedButtonMapping; 0061 0062 QString m_errorString = QString(); 0063 };