File indexing completed on 2024-05-19 05:39:20
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2017 Dorian Vogel <dorianvogel@gmail.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-only 0005 * 0006 */ 0007 0008 #pragma once 0009 0010 #include <QObject> 0011 #include <QStringList> 0012 0013 #ifdef WITH_DDCUTIL 0014 #include <ddcutil_c_api.h> 0015 #endif 0016 0017 #include "ddcutildisplay.h" 0018 0019 #include <unordered_map> 0020 0021 class DDCutilBrightness : public QObject 0022 { 0023 Q_OBJECT 0024 public: 0025 explicit DDCutilBrightness(QObject *parent = nullptr); 0026 ~DDCutilBrightness(); 0027 0028 void detect(); 0029 QStringList displayIds() const; 0030 bool isSupported() const; 0031 int brightness(const QString &displayId); 0032 int maxBrightness(const QString &displayId); 0033 void setBrightness(const QString &displayId, int value); 0034 0035 private: 0036 #ifdef WITH_DDCUTIL 0037 QString generateDisplayId(const DDCA_Display_Info &displayInfo) const; 0038 #endif 0039 0040 private: 0041 QStringList m_displayIds; 0042 std::unordered_map<QString, std::unique_ptr<DDCutilDisplay>> m_displays; 0043 };