File indexing completed on 2024-05-12 17:07:23
0001 /* 0002 SPDX-FileCopyrightText: 2017 Xuetian Weng <wengxt@gmail.com> 0003 SPDX-FileCopyrightText: 2018 Roman Gilg <subdiff@gmail.com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include <QObject> 0011 #include <QVariantHash> 0012 #include <QVector> 0013 0014 enum class InputBackendMode { 0015 KWinWayland = 0, 0016 XLibinput = 1, 0017 XEvdev = 2, 0018 }; 0019 0020 class InputBackend : public QObject 0021 { 0022 Q_OBJECT 0023 0024 protected: 0025 explicit InputBackend(QObject *parent) 0026 : QObject(parent) 0027 { 0028 } 0029 InputBackendMode m_mode; 0030 0031 public: 0032 static InputBackend *implementation(QObject *parent = nullptr); 0033 0034 InputBackendMode mode() 0035 { 0036 return m_mode; 0037 } 0038 0039 virtual void kcmInit() 0040 { 0041 } 0042 0043 virtual bool isValid() const 0044 { 0045 return false; 0046 } 0047 0048 virtual void load() 0049 { 0050 } 0051 0052 virtual bool applyConfig(const QVariantHash &) 0053 { 0054 return false; 0055 } 0056 virtual bool getConfig(QVariantHash &) 0057 { 0058 return false; 0059 } 0060 0061 virtual bool applyConfig() 0062 { 0063 return false; 0064 } 0065 virtual bool getConfig() 0066 { 0067 return false; 0068 } 0069 0070 virtual bool getDefaultConfig() 0071 { 0072 return false; 0073 } 0074 virtual bool isChangedConfig() const 0075 { 0076 return false; 0077 } 0078 0079 virtual QString errorString() const 0080 { 0081 return QString(); 0082 } 0083 0084 virtual int deviceCount() const 0085 { 0086 return 0; 0087 } 0088 virtual QVector<QObject *> getDevices() const 0089 { 0090 return QVector<QObject *>(); 0091 } 0092 0093 Q_SIGNALS: 0094 void deviceAdded(bool success); 0095 void deviceRemoved(int index); 0096 };