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