File indexing completed on 2024-12-15 05:06:51
0001 /* 0002 * SPDX-FileCopyrightText: 2010 Dario Freddi <drf@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <powerdevilaction.h> 0010 0011 namespace PowerDevil::BundledActions 0012 { 0013 class DimDisplay : public PowerDevil::Action 0014 { 0015 Q_OBJECT 0016 public: 0017 explicit DimDisplay(QObject *parent); 0018 0019 protected: 0020 void onWakeupFromIdle() override; 0021 void onIdleTimeout(std::chrono::milliseconds timeout) override; 0022 void triggerImpl(const QVariantMap &args) override; 0023 bool isSupported() override; 0024 0025 public: 0026 bool loadAction(const PowerDevil::ProfileSettings &) override; 0027 0028 private: 0029 void setBrightnessHelper(int screen, int keyboard, bool force = false); 0030 0031 std::chrono::milliseconds m_dimOnIdleTime{0}; 0032 0033 int m_oldScreenBrightness = 0; 0034 int m_oldKeyboardBrightness = 0; 0035 0036 bool m_dimmed = false; 0037 }; 0038 0039 }