File indexing completed on 2024-04-28 16:49:43
0001 /* 0002 * SPDX-FileCopyrightText: 2014 Daniel Vratil <dvratil@redhat.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-or-later 0005 * 0006 */ 0007 0008 #ifndef BACKENDDBUSWRAPPER_H 0009 #define BACKENDDBUSWRAPPER_H 0010 0011 #include <QObject> 0012 #include <QTimer> 0013 #include <QVariant> 0014 0015 #include "types.h" 0016 0017 namespace KScreen 0018 { 0019 class AbstractBackend; 0020 } 0021 0022 class BackendDBusWrapper : public QObject 0023 { 0024 Q_OBJECT 0025 Q_CLASSINFO("D-Bus Interface", "org.kde.KScreen.Backend") 0026 0027 public: 0028 explicit BackendDBusWrapper(KScreen::AbstractBackend *backend); 0029 ~BackendDBusWrapper() override; 0030 0031 bool init(); 0032 0033 QVariantMap getConfig() const; 0034 QVariantMap setConfig(const QVariantMap &config); 0035 QByteArray getEdid(int output) const; 0036 0037 inline KScreen::AbstractBackend *backend() const 0038 { 0039 return mBackend; 0040 } 0041 0042 Q_SIGNALS: 0043 void configChanged(const QVariantMap &config); 0044 0045 private Q_SLOTS: 0046 void backendConfigChanged(const KScreen::ConfigPtr &config); 0047 void doEmitConfigChanged(); 0048 0049 private: 0050 KScreen::AbstractBackend *mBackend = nullptr; 0051 QTimer mChangeCollector; 0052 KScreen::ConfigPtr mCurrentConfig; 0053 }; 0054 0055 #endif // BACKENDDBUSWRAPPER_H