File indexing completed on 2025-01-26 05:09:05

0001 /*  This file is part of the KDE project
0002  *    SPDX-FileCopyrightText: 2023 Quang NgĂ´ <ngoquang2708@gmail.com>
0003  *
0004  *    SPDX-License-Identifier: LGPL-2.0-only
0005  *
0006  */
0007 
0008 #pragma once
0009 
0010 #include <QObject>
0011 #include <QReadWriteLock>
0012 
0013 #ifdef WITH_DDCUTIL
0014 #include <ddcutil_c_api.h>
0015 #include <ddcutil_status_codes.h>
0016 #endif
0017 
0018 class DDCutilDisplay : public QObject
0019 {
0020     Q_OBJECT
0021 public:
0022 #ifdef WITH_DDCUTIL
0023     DDCutilDisplay(DDCA_Display_Info, DDCA_Display_Handle);
0024 #endif
0025     ~DDCutilDisplay();
0026 
0027     QString label() const;
0028     int brightness();
0029     int maxBrightness();
0030     void setBrightness(int value);
0031     bool supportsBrightness() const;
0032 
0033 private:
0034 #ifdef WITH_DDCUTIL
0035     DDCA_Display_Info m_displayInfo;
0036     DDCA_Display_Handle m_displayHandle;
0037 #endif
0038     QReadWriteLock m_lock;
0039     int m_brightness;
0040     int m_maxBrightness;
0041     bool m_supportsBrightness;
0042 };