File indexing completed on 2024-05-12 05:38:44
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2006 Kevin Ottens <ervin@kde.org> 0003 SPDX-FileCopyrightText: 2008-2010 Dario Freddi <drf@kde.org> 0004 SPDX-FileCopyrightText: 2010 Alejandro Fiestas <alex@eyeos.org> 0005 SPDX-FileCopyrightText: 2015 Kai Uwe Broulik <kde@privat.broulik.de> 0006 0007 SPDX-License-Identifier: LGPL-2.0-only 0008 0009 */ 0010 0011 #pragma once 0012 0013 #include <QObject> 0014 0015 #include "powerdevilcore_export.h" 0016 #include "powerdevilenums.h" 0017 #include "powerdevilkeyboardbrightnesslogic.h" 0018 #include "upower_kbdbacklight_interface.h" 0019 0020 class POWERDEVILCORE_EXPORT KeyboardBrightnessController : public QObject 0021 { 0022 Q_OBJECT 0023 public: 0024 KeyboardBrightnessController(); 0025 0026 int keyboardBrightness() const; 0027 int keyboardBrightnessMax() const; 0028 void setKeyboardBrightness(int value); 0029 void setKeyboardBrightnessOff(); 0030 bool keyboardBrightnessAvailable() const; 0031 int keyboardBrightnessSteps(); 0032 0033 int keyboardBrightnessKeyPressed(PowerDevil::BrightnessLogic::BrightnessKeyType type); 0034 0035 Q_SIGNALS: 0036 void keyboardBrightnessChanged(const PowerDevil::BrightnessLogic::BrightnessInfo &brightnessInfo); 0037 0038 private Q_SLOTS: 0039 void onKeyboardBrightnessChanged(int value, const QString &source); 0040 0041 private: 0042 int calculateNextKeyboardBrightnessStep(int value, int valueMax, PowerDevil::BrightnessLogic::BrightnessKeyType keyType); 0043 0044 int m_kbdMaxBrightness; 0045 int m_cachedKeyboardBrightness; 0046 int m_keyboardBrightnessBeforeTogglingOff; 0047 bool m_keyboardBrightnessAvailable = false; 0048 0049 PowerDevil::KeyboardBrightnessLogic m_keyboardBrightnessLogic; 0050 0051 OrgFreedesktopUPowerKbdBacklightInterface *m_kbdBacklight; 0052 };