File indexing completed on 2024-05-12 09:36:15
0001 // SPDX-FileCopyrightText: 2015 by Martin Gräßlin <mgraesslin@kde.org> 0002 // SPDX-FileCopyrightText: 2022 Aleix Pol Gonzalez <aleixpol@kde.org> 0003 // 0004 // SPDX-License-Identifier: LGPL-2.1-or-later 0005 0006 #pragma once 0007 0008 #include "dpms.h" 0009 #include <QObject> 0010 #include <optional> 0011 0012 class QScreen; 0013 0014 namespace KScreen 0015 { 0016 0017 class AbstractDpmsHelper : public QObject 0018 { 0019 Q_OBJECT 0020 public: 0021 virtual ~AbstractDpmsHelper(); 0022 0023 virtual void trigger(Dpms::Mode, const QList<QScreen *> &screens) = 0; 0024 0025 bool isSupported() 0026 { 0027 return m_supported; 0028 } 0029 0030 void setSupported(bool supported) 0031 { 0032 if (m_supported != supported) { 0033 m_supported = supported; 0034 Q_EMIT supportedChanged(supported); 0035 } 0036 } 0037 void setHasPendingChanges(bool hasThem) 0038 { 0039 if (m_hasPendingChanges != hasThem) { 0040 m_hasPendingChanges = hasThem; 0041 Q_EMIT hasPendingChangesChanged(hasThem); 0042 } 0043 } 0044 0045 bool hasPendingChanges() const 0046 { 0047 return m_hasPendingChanges; 0048 } 0049 0050 Q_SIGNALS: 0051 void supportedChanged(bool supported); 0052 void modeChanged(Dpms::Mode mode, QScreen *screen); 0053 void hasPendingChangesChanged(bool pendingChanges); 0054 0055 private: 0056 bool m_supported = false; 0057 bool m_hasPendingChanges = false; 0058 }; 0059 0060 }