File indexing completed on 2024-05-26 05:37:14

0001 /*
0002     SPDX-FileCopyrightText: 2017 Roman Gilg <subdiff@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "touchpadbackend.h"
0010 
0011 #include <QList>
0012 
0013 class QDBusInterface;
0014 
0015 class KWinWaylandBackend : public TouchpadBackend
0016 {
0017     Q_OBJECT
0018 
0019     Q_PROPERTY(int touchpadCount READ touchpadCount CONSTANT)
0020 
0021 public:
0022     explicit KWinWaylandBackend(QObject *parent = nullptr);
0023     ~KWinWaylandBackend();
0024 
0025     bool applyConfig() override;
0026     bool getConfig() override;
0027     bool getDefaultConfig() override;
0028     bool isChangedConfig() const override;
0029     QString errorString() const override
0030     {
0031         return m_errorString;
0032     }
0033 
0034     virtual int touchpadCount() const override
0035     {
0036         return m_devices.count();
0037     }
0038     virtual QList<QObject *> getDevices() const override
0039     {
0040         return m_devices;
0041     }
0042 
0043 private Q_SLOTS:
0044     void onDeviceAdded(QString);
0045     void onDeviceRemoved(QString);
0046 
0047 private:
0048     void findTouchpads();
0049 
0050     QDBusInterface *m_deviceManager;
0051     QList<QObject *> m_devices;
0052 
0053     QString m_errorString = QString();
0054 };