Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mce-qt] Add battery related items. Fixes JB#44019
Implements new Qt classes / QML items for tracking: MceBatteryLevel: Current charge percentage MceBatteryStatus: Current status as Empty|Low|Ok|Full MceCableState: Whether charger cable is connected MceChargerState: Whether battery is getting charged McePowerSaveMode: Whether PowerSaveMode is active Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
- Loading branch information
Showing
12 changed files
with
1,142 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (C) 2016-2018 Jolla Ltd. | ||
* Contact: Slava Monich <slava.monich@jolla.com> | ||
* | ||
* You may use this file under the terms of BSD license as follows: | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may | ||
* be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* The views and conclusions contained in the software and documentation | ||
* are those of the authors and should not be interpreted as representing | ||
* any official policies, either expressed or implied. | ||
*/ | ||
|
||
#ifndef QMCE_BATTERYLEVEL_H_ | ||
#define QMCE_BATTERYLEVEL_H_ | ||
|
||
#include "qmcetypes.h" | ||
|
||
class QMCE_EXPORT QMceBatteryLevel : public QObject | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(bool valid READ valid NOTIFY validChanged) | ||
Q_PROPERTY(int percent READ percent NOTIFY percentChanged) | ||
public: | ||
QMceBatteryLevel(QObject* aParent = NULL); | ||
bool valid() const; | ||
int percent() const; | ||
Q_SIGNALS: | ||
void validChanged(); | ||
void percentChanged(); | ||
private: | ||
class Private; | ||
Private* iPrivate; | ||
}; | ||
|
||
#endif // QMCE_BATTERYLEVEL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (C) 2016-2018 Jolla Ltd. | ||
* Contact: Slava Monich <slava.monich@jolla.com> | ||
* | ||
* You may use this file under the terms of BSD license as follows: | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may | ||
* be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* The views and conclusions contained in the software and documentation | ||
* are those of the authors and should not be interpreted as representing | ||
* any official policies, either expressed or implied. | ||
*/ | ||
|
||
#ifndef QMCE_BATTERYSTATUS_H_ | ||
#define QMCE_BATTERYSTATUS_H_ | ||
|
||
#include "qmcetypes.h" | ||
|
||
class QMCE_EXPORT QMceBatteryStatus : public QObject | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(bool valid READ valid NOTIFY validChanged) | ||
Q_PROPERTY(Status status READ status NOTIFY statusChanged) | ||
Q_ENUMS(Status) | ||
public: | ||
enum Status { Empty, Low, Ok, Full, }; | ||
QMceBatteryStatus(QObject* aParent = NULL); | ||
bool valid() const; | ||
Status status() const; | ||
Q_SIGNALS: | ||
void validChanged(); | ||
void statusChanged(); | ||
private: | ||
class Private; | ||
Private* iPrivate; | ||
}; | ||
|
||
#endif // QMCE_BATTERYSTATUS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (C) 2016-2018 Jolla Ltd. | ||
* Contact: Slava Monich <slava.monich@jolla.com> | ||
* | ||
* You may use this file under the terms of BSD license as follows: | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may | ||
* be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* The views and conclusions contained in the software and documentation | ||
* are those of the authors and should not be interpreted as representing | ||
* any official policies, either expressed or implied. | ||
*/ | ||
|
||
#ifndef QMCE_CABLESTATE_H_ | ||
#define QMCE_CABLESTATE_H_ | ||
|
||
#include "qmcetypes.h" | ||
|
||
class QMCE_EXPORT QMceCableState : public QObject | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(bool valid READ valid NOTIFY validChanged) | ||
Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged) | ||
public: | ||
QMceCableState(QObject* aParent = NULL); | ||
bool valid() const; | ||
bool connected() const; | ||
Q_SIGNALS: | ||
void validChanged(); | ||
void connectedChanged(); | ||
private: | ||
class Private; | ||
Private* iPrivate; | ||
}; | ||
|
||
#endif // QMCE_CABLESTATE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (C) 2016-2018 Jolla Ltd. | ||
* Contact: Slava Monich <slava.monich@jolla.com> | ||
* | ||
* You may use this file under the terms of BSD license as follows: | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may | ||
* be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* The views and conclusions contained in the software and documentation | ||
* are those of the authors and should not be interpreted as representing | ||
* any official policies, either expressed or implied. | ||
*/ | ||
|
||
#ifndef QMCE_CHARGERSTATE_H_ | ||
#define QMCE_CHARGERSTATE_H_ | ||
|
||
#include "qmcetypes.h" | ||
|
||
class QMCE_EXPORT QMceChargerState : public QObject | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(bool valid READ valid NOTIFY validChanged) | ||
Q_PROPERTY(bool charging READ charging NOTIFY chargingChanged) | ||
public: | ||
QMceChargerState(QObject* aParent = NULL); | ||
bool valid() const; | ||
bool charging() const; | ||
Q_SIGNALS: | ||
void validChanged(); | ||
void chargingChanged(); | ||
private: | ||
class Private; | ||
Private* iPrivate; | ||
}; | ||
|
||
#endif // QMCE_CHARGERSTATE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (C) 2016-2018 Jolla Ltd. | ||
* Contact: Slava Monich <slava.monich@jolla.com> | ||
* | ||
* You may use this file under the terms of BSD license as follows: | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may | ||
* be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* The views and conclusions contained in the software and documentation | ||
* are those of the authors and should not be interpreted as representing | ||
* any official policies, either expressed or implied. | ||
*/ | ||
|
||
#ifndef QMCE_POWERSAVEMODE_H_ | ||
#define QMCE_POWERSAVEMODE_H_ | ||
|
||
#include "qmcetypes.h" | ||
|
||
class QMCE_EXPORT QMcePowerSaveMode : public QObject | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(bool valid READ valid NOTIFY validChanged) | ||
Q_PROPERTY(bool active READ active NOTIFY activeChanged) | ||
public: | ||
QMcePowerSaveMode(QObject* aParent = NULL); | ||
bool valid() const; | ||
bool active() const; | ||
Q_SIGNALS: | ||
void validChanged(); | ||
void activeChanged(); | ||
private: | ||
class Private; | ||
Private* iPrivate; | ||
}; | ||
|
||
#endif // QMCE_POWERSAVEMODE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.