1 | /* |
2 | * BluezQt - Asynchronous BlueZ wrapper library |
3 | * |
4 | * SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <kde@broulik.de> |
5 | * |
6 | * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
7 | */ |
8 | |
9 | #ifndef DECLARATIVEBATTERY_H |
10 | #define DECLARATIVEBATTERY_H |
11 | |
12 | #include "battery.h" |
13 | #include "qqmlregistration.h" |
14 | |
15 | class DeclarativeBattery : public QObject |
16 | { |
17 | Q_OBJECT |
18 | QML_NAMED_ELEMENT(Battery) |
19 | QML_UNCREATABLE("Battery cannot be created" ) |
20 | Q_PROPERTY(int percentage READ percentage NOTIFY percentageChanged) |
21 | |
22 | public: |
23 | explicit DeclarativeBattery(const BluezQt::BatteryPtr &battery, QObject *parent = nullptr); |
24 | |
25 | int percentage() const; |
26 | |
27 | Q_SIGNALS: |
28 | void percentageChanged(int percentage); |
29 | |
30 | private: |
31 | BluezQt::BatteryPtr m_battery; |
32 | }; |
33 | |
34 | #endif // DECLARATIVEBATTERY_H |
35 | |