File indexing completed on 2024-05-19 16:34:00

0001 /*
0002     SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <kwinglobals.h>
0010 
0011 #include <QObject>
0012 #include <memory>
0013 
0014 namespace KWin
0015 {
0016 
0017 class Output;
0018 class ColorDevicePrivate;
0019 
0020 /**
0021  * The ColorDevice class represents a color managed device.
0022  */
0023 class KWIN_EXPORT ColorDevice : public QObject
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     explicit ColorDevice(Output *output, QObject *parent = nullptr);
0029     ~ColorDevice() override;
0030 
0031     /**
0032      * Returns the underlying output for this color device.
0033      */
0034     Output *output() const;
0035 
0036     /**
0037      * Returns the current color brightness on this device, in percent.
0038      */
0039     uint brightness() const;
0040 
0041     /**
0042      * Sets the color brightness on this device to @a brightness, in percent.
0043      */
0044     void setBrightness(uint brightness);
0045 
0046     /**
0047      * Returns the current color temperature on this device, in Kelvins.
0048      */
0049     uint temperature() const;
0050 
0051     /**
0052      * Sets the color temperature on this device to @a temperature, in Kelvins.
0053      */
0054     void setTemperature(uint temperature);
0055 
0056     /**
0057      * Returns the color profile for this device.
0058      */
0059     QString profile() const;
0060 
0061     /**
0062      * Sets the color profile for this device to @a profile.
0063      */
0064     void setProfile(const QString &profile);
0065 
0066 public Q_SLOTS:
0067     void update();
0068     void scheduleUpdate();
0069 
0070 Q_SIGNALS:
0071     /**
0072      * This signal is emitted when the brightness of this device has changed.
0073      */
0074     void brightnessChanged();
0075     /**
0076      * This signal is emitted when the color temperature of this device has changed.
0077      */
0078     void temperatureChanged();
0079     /**
0080      * This signal is emitted when the color profile of this device has changed.
0081      */
0082     void profileChanged();
0083 
0084 private:
0085     std::unique_ptr<ColorDevicePrivate> d;
0086 };
0087 
0088 } // namespace KWin