File indexing completed on 2024-04-14 05:19:09

0001 /*
0002     SPDX-FileCopyrightText: 2022 Aditya Mehra <aix.m@outlook.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef RemoteControllers_H
0008 #define RemoteControllers_H
0009 
0010 #include "devicesmodel.h"
0011 #include "kcmdbusinterface.h"
0012 #include "keymapmodel.h"
0013 #include <KConfigGroup>
0014 #include <KQuickConfigModule>
0015 #include <QDBusVariant>
0016 
0017 class KeyMapModel;
0018 class KcmDbusInterface;
0019 class RemoteController : public KQuickConfigModule
0020 {
0021     Q_OBJECT
0022     Q_CLASSINFO("D-Bus Interface", "org.kde.plasma.remotecontrollers.KCM")
0023     Q_PROPERTY(KeyMapModel *keyMapModel READ keyMapModel CONSTANT)
0024     Q_PROPERTY(DevicesModel *devicesModel READ devicesModel CONSTANT)
0025 
0026 public:
0027     explicit RemoteController(QObject *parent, const KPluginMetaData &metaData);
0028     ~RemoteController() override;
0029     KcmDbusInterface kcmDbusInterface;
0030     DevicesModel *devicesModel();
0031     KeyMapModel *keyMapModel();
0032 
0033 public Q_SLOTS:
0034     QString cecKeyConfig(const QString &key);
0035     QString gamepadKeyConfig(const QString &key);
0036     void setCecKeyConfig(const QString &button, const QString &key);
0037     void setGamepadKeyConfig(const QString &button, const QString &key);
0038     void acquireNoOp();
0039     void releaseNoOp();
0040     int cecKeyFromRemotePress();
0041 
0042 Q_SIGNALS:
0043     void cecConfigChanged(const QString &button);
0044     void gamepadConfigChanged(const QString &button);
0045     void gamepadKeyPressed(int keyCode);
0046 
0047 private:
0048     DevicesModel *m_devicesModel;
0049     KeyMapModel *m_keyMapModel;
0050 };
0051 
0052 #endif