Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
UPowerHost.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 <PhosphorServices/phosphorservices_export.h>
7
9
10#include <QDBusObjectPath>
11#include <QList>
12#include <QObject>
13
14namespace PhosphorServices {
15
16class PHOSPHORSERVICES_EXPORT UPowerHost : public QObject
17{
18 Q_OBJECT
19 Q_PROPERTY(bool onBattery READ onBattery NOTIFY onBatteryChanged)
20 Q_PROPERTY(PhosphorServices::UPowerDevice* displayDevice READ displayDevice NOTIFY displayDeviceChanged)
21 Q_PROPERTY(int deviceCount READ deviceCount NOTIFY deviceCountChanged)
22
23public:
24 explicit UPowerHost(QObject* parent = nullptr);
25 ~UPowerHost() override;
26
27 [[nodiscard]] bool onBattery() const;
28 [[nodiscard]] UPowerDevice* displayDevice() const;
29 [[nodiscard]] int deviceCount() const;
30 [[nodiscard]] QList<UPowerDevice*> devices() const;
31 [[nodiscard]] Q_INVOKABLE PhosphorServices::UPowerDevice* deviceAt(int index) const;
32
33Q_SIGNALS:
39
40private Q_SLOTS:
41 void _q_onPropertiesChanged(const QString& iface, const QVariantMap& changed, const QStringList& invalidated);
42 void _q_onDeviceAdded(const QDBusObjectPath& path);
43 void _q_onDeviceRemoved(const QDBusObjectPath& path);
44
45private:
46 class Private;
47 std::unique_ptr<Private> d;
48};
49
50} // namespace PhosphorServices
Definition UPowerDevice.h:16
Definition UPowerHost.h:17
void deviceRemoved(PhosphorServices::UPowerDevice *device)
UPowerHost(QObject *parent=nullptr)
void deviceAdded(PhosphorServices::UPowerDevice *device)
QList< UPowerDevice * > devices() const
UPowerDevice * displayDevice() const
PhosphorServices::UPowerDevice * deviceAt(int index) const
Definition DBusMenuModel.h:15