Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
BrightnessHost.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <PhosphorServiceBrightness/phosphorservicebrightness_export.h>
7
8#include <QList>
9#include <QObject>
10#include <QString>
11
12#include <memory>
13
14class QDBusConnection;
15
17
19
40class PHOSPHORSERVICEBRIGHTNESS_EXPORT BrightnessHost : public QObject
41{
42 Q_OBJECT
43 Q_PROPERTY(int deviceCount READ deviceCount NOTIFY deviceCountChanged)
44
45public:
48 explicit BrightnessHost(QObject* parent = nullptr);
49
54 BrightnessHost(QString sysfsRoot, QDBusConnection connection, QString service, QString sessionPath,
55 QObject* parent = nullptr);
56
57 ~BrightnessHost() override;
58
59 [[nodiscard]] QList<BrightnessDevice*> devices() const;
60 [[nodiscard]] int deviceCount() const;
61 [[nodiscard]] Q_INVOKABLE PhosphorServiceBrightness::BrightnessDevice* deviceAt(int index) const;
62
63Q_SIGNALS:
74
75private:
76 Q_DISABLE_COPY_MOVE(BrightnessHost)
77 class Private;
78 std::unique_ptr<Private> d;
79};
80
81} // namespace PhosphorServiceBrightness
One brightness-controllable backlight: a display panel (under /sys/class/backlight) or a keyboard bac...
Definition BrightnessDevice.h:33
BrightnessHost(QString sysfsRoot, QDBusConnection connection, QString service, QString sessionPath, QObject *parent=nullptr)
Injectable wiring for tests / advanced consumers.
PhosphorServiceBrightness::BrightnessDevice * deviceAt(int index) const
void deviceRemoved(PhosphorServiceBrightness::BrightnessDevice *device)
The counterpart to deviceAdded, for dynamic sources that can drop a device at runtime.
BrightnessHost(QObject *parent=nullptr)
Production wiring: the real sysfs root (/sys), the system bus, and the logind session resolved from t...
void deviceAdded(PhosphorServiceBrightness::BrightnessDevice *device)
Sysfs devices are added synchronously at construction; external displays (DDC/CI) arrive asynchronous...
QList< BrightnessDevice * > devices() const
Definition BrightnessDevice.h:16