Debian Codegraph @

src/systeminfo/qbatteryinfo.h

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 /****************************************************************************
2 **
3 ** Copyright (C) 2018 The Qt Company Ltd and/or its subsidiary(-ies).
4 ** Copyright (C) 2018 BlackBerry Limited. All rights reserved.
5 ** Contact: http://www.qt-project.org/legal
6 **
7 ** This file is part of the QtSystems module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see https://www.qt.io/terms-conditions. For further
16 ** information use the contact form at https://www.qt.io/contact-us.
17 **
18 ** GNU Lesser General Public License Usage
19 ** Alternatively, this file may be used under the terms of the GNU Lesser
20 ** General Public License version 3 as published by the Free Software
21 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
22 ** packaging of this file. Please review the following information to
23 ** ensure the GNU Lesser General Public License version 3 requirements
24 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
25 **
26 ** GNU General Public License Usage
27 ** Alternatively, this file may be used under the terms of the GNU
28 ** General Public License version 2.0 or (at your option) the GNU General
29 ** Public license version 3 or any later version approved by the KDE Free
30 ** Qt Foundation. The licenses are as published by the Free Software
31 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
32 ** included in the packaging of this file. Please review the following
33 ** information to ensure the GNU General Public License requirements will
34 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
35 ** https://www.gnu.org/licenses/gpl-3.0.html.
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40
41 #ifndef QBATTERYINFO_H
42 #define QBATTERYINFO_H
43
44 #include "qsysteminfoglobal.h"
45 #include <QtCore/qobject.h>
46
47 QT_BEGIN_NAMESPACE
48
49 #if !defined(QT_SIMULATOR)
50 class QBatteryInfoPrivate;
51 #else
52 class QBatteryInfoSimulator;
53 #endif // QT_SIMULATOR
54
55 class Q_SYSTEMINFO_EXPORT QBatteryInfo : public QObject
56 {
57 Q_OBJECT
58
59 Q_ENUMS(ChargerType)
60 Q_ENUMS(ChargingState)
61 Q_ENUMS(LevelStatus)
62 Q_ENUMS(Health)
63
64 Q_PROPERTY(int batteryCount READ batteryCount NOTIFY batteryCountChanged)
65 Q_PROPERTY(int batteryIndex READ batteryIndex WRITE setBatteryIndex NOTIFY batteryIndexChanged)
66 Q_PROPERTY(bool valid READ isValid NOTIFY validChanged)
67 Q_PROPERTY(int level READ level NOTIFY levelChanged)
68 Q_PROPERTY(int currentFlow READ currentFlow NOTIFY currentFlowChanged)
69 Q_PROPERTY(int cycleCount READ cycleCount NOTIFY cycleCountChanged)
70 Q_PROPERTY(int maximumCapacity READ maximumCapacity)
71 Q_PROPERTY(int remainingCapacity READ remainingCapacity NOTIFY remainingCapacityChanged)
72 Q_PROPERTY(int remainingChargingTime READ remainingChargingTime NOTIFY remainingChargingTimeChanged)
73 Q_PROPERTY(int voltage READ voltage NOTIFY voltageChanged)
74 Q_PROPERTY(ChargingState chargingState READ chargingState NOTIFY chargingStateChanged)
75 Q_PROPERTY(ChargerType chargerType READ chargerType NOTIFY chargerTypeChanged)
76 Q_PROPERTY(LevelStatus levelStatus READ levelStatus NOTIFY levelStatusChanged)
77 Q_PROPERTY(Health health READ health NOTIFY healthChanged)
78 Q_PROPERTY(float temperature READ temperature NOTIFY temperatureChanged)
79
80 public:
81 enum ChargerType {
82 UnknownCharger = 0,
83 WallCharger,
84 USBCharger,
85 VariableCurrentCharger
86 };
87
88 enum ChargingState {
89 UnknownChargingState = 0,
90 Charging,
91 IdleChargingState,
92 Discharging
93 };
94
95 enum LevelStatus {
96 LevelUnknown = 0,
97 LevelEmpty,
98 LevelLow,
99 LevelOk,
100 LevelFull
101 };
102
103 enum Health {
104 HealthUnknown = 0,
105 HealthOk,
106 HealthBad
107 };
108
109 explicit QBatteryInfo(QObject *parent = Q_NULLPTR);
110 explicit QBatteryInfo(int batteryIndex, QObject *parent = Q_NULLPTR);
111 virtual ~QBatteryInfo();
112
113 int batteryCount() const;
114 int batteryIndex() const;
115 bool isValid() const;
116 int level() const;
117 int currentFlow() const;
118 int cycleCount() const;
119 int maximumCapacity() const;
120 int remainingCapacity() const;
121 int remainingChargingTime() const;
122 int voltage() const;
123 QBatteryInfo::ChargingState chargingState() const;
124 QBatteryInfo::ChargerType chargerType() const;
125 QBatteryInfo::LevelStatus levelStatus() const;
126 QBatteryInfo::Health health() const;
127 float temperature() const;
128
129 void setBatteryIndex(int batteryIndex);
130
131 Q_SIGNALS:
132 void batteryIndexChanged(int batteryIndex);
133 void validChanged(bool isValid);
134 void batteryCountChanged(int count);
135 void chargerTypeChanged(QBatteryInfo::ChargerType type);
136 void chargingStateChanged(QBatteryInfo::ChargingState state);
137 void levelChanged(int level);
138 void currentFlowChanged(int flow);
139 void cycleCountChanged(int cycleCount);
140 void remainingCapacityChanged(int capacity);
141 void remainingChargingTimeChanged(int seconds);
142 void voltageChanged(int voltage);
143 void levelStatusChanged(QBatteryInfo::LevelStatus levelStatus);
144 void healthChanged(QBatteryInfo::Health health);
145 void temperatureChanged(float temperature);
146
147 protected:
148 void connectNotify(const QMetaMethod &signal);
149 void disconnectNotify(const QMetaMethod &signal);
150
151 private:
152 Q_DISABLE_COPY(QBatteryInfo)
153 #if !defined(QT_SIMULATOR)
154 QBatteryInfoPrivate * const d_ptr;
155 Q_DECLARE_PRIVATE(QBatteryInfo)
156 #else
157 QBatteryInfoSimulator * const d_ptr;
158 #endif // QT_SIMULATOR
159 };
160
161 QT_END_NAMESPACE
162
163 #endif // QBATTERYINFO_H