Changeset View
Changeset View
Standalone View
Standalone View
kcms/input/inputbackend.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2017 Xuetian Weng <wengxt@gmail.com> | ||||
3 | * Copyright 2018 Roman Gilg <subdiff@gmail.com> | ||||
4 | * | ||||
5 | * This program is free software; you can redistribute it and/or modify | ||||
6 | * it under the terms of the GNU General Public License as published by | ||||
7 | * the Free Software Foundation; either version 2 of the License, or | ||||
8 | * (at your option) any later version. | ||||
9 | * | ||||
10 | * This program is distributed in the hope that it will be useful, | ||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
13 | * GNU General Public License for more details. | ||||
14 | * | ||||
15 | * You should have received a copy of the GNU General Public License | ||||
16 | * along with this program; if not, write to the Free Software | ||||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | #ifndef INPUTBACKEND_H | ||||
21 | #define INPUTBACKEND_H | ||||
22 | | ||||
23 | #include <QObject> | ||||
24 | #include <QVector> | ||||
25 | #include <QVariantHash> | ||||
26 | | ||||
27 | class ConfigPlugin; | ||||
28 | | ||||
29 | enum class InputBackendMode { | ||||
30 | KWinWayland = 0, | ||||
31 | XLibinput = 1, // TODO | ||||
32 | XEvdev = 2 | ||||
33 | }; | ||||
34 | | ||||
35 | class InputBackend : public QObject | ||||
36 | { | ||||
37 | Q_OBJECT | ||||
38 | | ||||
39 | protected: | ||||
40 | explicit InputBackend(QObject *parent) : QObject(parent) {} | ||||
41 | InputBackendMode m_mode; | ||||
42 | | ||||
43 | public: | ||||
44 | static InputBackend *implementation(QObject *parent = nullptr); | ||||
45 | | ||||
46 | InputBackendMode mode() { | ||||
47 | return m_mode; | ||||
48 | } | ||||
49 | | ||||
50 | virtual bool isValid() const { return false; } | ||||
51 | | ||||
52 | virtual void load() {} | ||||
53 | | ||||
54 | virtual bool applyConfig(const QVariantHash &) { return false; } | ||||
55 | virtual bool getConfig(QVariantHash &) { return false; } | ||||
56 | | ||||
57 | virtual bool applyConfig() { return false; } | ||||
58 | virtual bool getConfig() { return false; } | ||||
59 | | ||||
60 | virtual bool getDefaultConfig() { return false; } | ||||
61 | virtual bool isChangedConfig() const { return false; } | ||||
62 | | ||||
63 | virtual QString errorString() const { return QString(); } | ||||
64 | | ||||
65 | virtual int deviceCount() const { return 0; } | ||||
66 | virtual QVector<QObject*> getDevices() const { return QVector<QObject*>(); } | ||||
67 | | ||||
68 | Q_SIGNALS: | ||||
69 | void deviceAdded(bool success); | ||||
70 | void deviceRemoved(int index); | ||||
71 | }; | ||||
72 | | ||||
73 | #endif // INPUTBACKEND_H |