File indexing completed on 2024-05-19 05:31:33

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 "effect/globals.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 public Q_SLOTS:
0057     void update();
0058     void scheduleUpdate();
0059 
0060 Q_SIGNALS:
0061     /**
0062      * This signal is emitted when the brightness of this device has changed.
0063      */
0064     void brightnessChanged();
0065     /**
0066      * This signal is emitted when the color temperature of this device has changed.
0067      */
0068     void temperatureChanged();
0069 
0070 private:
0071     std::unique_ptr<ColorDevicePrivate> d;
0072 };
0073 
0074 } // namespace KWin