Music Hub  ..
A session-wide music playback service
battery_observer.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 Canonical Ltd.
3  * Copyright © 2022 UBports Foundation.
4  *
5  * Contact: Alberto Mardegan <mardy@users.sourceforge.net>
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License version 3,
9  * as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Authored by: Thomas Voß <thomas.voss@canonical.com>
20  */
21 #ifndef LOMIRI_MEDIAHUBSERVICE_POWER_STATE_OBSERVER_H
22 #define LOMIRI_MEDIAHUBSERVICE_POWER_STATE_OBSERVER_H
23 
24 #include <QObject>
25 #include <QScopedPointer>
26 
27 namespace lomiri
28 {
29 namespace MediaHubService
30 {
31 namespace power
32 {
33 // Enumerates known power levels.
34 enum class Level
35 {
36  unknown,
37  ok,
38  low,
39  very_low,
40  critical
41 };
42 
43 class BatteryObserverPrivate;
44 
45 // Interface that enables observation of the system power state.
46 class BatteryObserver: public QObject
47 {
48  Q_OBJECT
49 
50 public:
51  BatteryObserver(QObject *parent = nullptr);
52  virtual ~BatteryObserver();
53 
54  Level level() const;
55  bool isWarningActive() const;
56 
57 Q_SIGNALS:
58  void levelChanged();
60 
61 private:
62  Q_DECLARE_PRIVATE(BatteryObserver);
63  QScopedPointer<BatteryObserverPrivate> d_ptr;
64 };
65 
66 }
67 }
68 }
69 
70 #endif // LOMIRI_MEDIAHUBSERVICE_POWER_STATE_OBSERVER_H
QObject
lomiri::MediaHubService::power::Level::critical
@ critical
lomiri::MediaHubService::power::Level::unknown
@ unknown
lomiri::MediaHubService::power::Level
Level
Definition: battery_observer.h:34
lomiri::MediaHubService::power::Level::very_low
@ very_low
lomiri::MediaHubService::power::BatteryObserver::isWarningActive
bool isWarningActive() const
Definition: battery_observer.cpp:141
lomiri::MediaHubService::power::BatteryObserver::levelChanged
void levelChanged()
lomiri::MediaHubService::power::BatteryObserver::~BatteryObserver
virtual ~BatteryObserver()
lomiri::MediaHubService::power::Level::low
@ low
lomiri::MediaHubService::power::BatteryObserver::isWarningActiveChanged
void isWarningActiveChanged()
lomiri::MediaHubService::power::BatteryObserver::BatteryObserver
BatteryObserver(QObject *parent=nullptr)
Definition: battery_observer.cpp:127
lomiri::MediaHubService::power::BatteryObserver::level
Level level() const
Definition: battery_observer.cpp:135
lomiri::MediaHubService::power::Level::ok
@ ok
lomiri
Definition: dbus_utils.h:24
lomiri::MediaHubService::power::BatteryObserver
Definition: battery_observer.h:46