summaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@gmail.com>2014-11-29 10:12:41 +1000
committerLorn Potter <lorn.potter@gmail.com>2014-12-04 08:36:07 +0100
commit32e65739c2bc690f04f9bc7ee4edeeacc3f93420 (patch)
tree57d53031a1f8f53a060478ec8b0ccfac1df660b1 /src/imports
parent3a0216301ad1338126abb326e8e4c22c6ea12f40 (diff)
Re-add BatteryInfo qml
The battery declarative class was never reinstated after the battery class for refactored. Also fix the upower backend to work correctly. Task-number: QTBUG-42958 Change-Id: I4f627426f6c716a5317eb28ed85fd9da793f1940 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/systeminfo/plugins.qmltypes204
-rw-r--r--src/imports/systeminfo/qdeclarativebatteryinfo.cpp499
-rw-r--r--src/imports/systeminfo/qdeclarativebatteryinfo_p.h189
-rw-r--r--src/imports/systeminfo/qdeclarativedeviceinfo_p.h2
-rw-r--r--src/imports/systeminfo/qsysteminfo.cpp2
5 files changed, 58 insertions, 838 deletions
diff --git a/src/imports/systeminfo/plugins.qmltypes b/src/imports/systeminfo/plugins.qmltypes
index bd62dd85..858fbad9 100644
--- a/src/imports/systeminfo/plugins.qmltypes
+++ b/src/imports/systeminfo/plugins.qmltypes
@@ -3,11 +3,12 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
-// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtSystemInfo 5.0'.
+// This file was auto-generated by:
+// 'qmlplugindump -notrelocatable QtSystemInfo 5.0'
Module {
Component {
- name: "QDeclarativeBatteryInfo"
+ name: "QBatteryInfo"
prototype: "QObject"
exports: ["QtSystemInfo/BatteryInfo 5.0"]
exportMetaObjectRevisions: [0]
@@ -24,113 +25,99 @@ Module {
name: "ChargingState"
values: {
"UnknownChargingState": 0,
- "NotCharging": 1,
- "Charging": 2,
- "Discharging": 3,
- "Full": 4
+ "Charging": 1,
+ "IdleChargingState": 2,
+ "Discharging": 3
}
}
Enum {
- name: "EnergyUnit"
+ name: "LevelStatus"
values: {
- "UnitUnknown": 0,
- "UnitmAh": 1,
- "UnitmWh": 2
+ "LevelUnknown": 0,
+ "LevelEmpty": 1,
+ "LevelLow": 2,
+ "LevelOk": 3,
+ "LevelFull": 4
}
}
Enum {
- name: "BatteryStatus"
+ name: "Health"
values: {
- "BatteryStatusUnknown": 0,
- "BatteryEmpty": 1,
- "BatteryLow": 2,
- "BatteryOk": 3,
- "BatteryFull": 4
+ "HealthUnknown": 0,
+ "HealthOk": 1,
+ "HealthBad": 2
}
}
- Property { name: "monitorBatteryCount"; type: "bool" }
- Property { name: "monitorChargerType"; type: "bool" }
- Property { name: "monitorCurrentFlow"; type: "bool" }
- Property { name: "monitorRemainingCapacity"; type: "bool" }
- Property { name: "monitorRemainingChargingTime"; type: "bool" }
- Property { name: "monitorVoltage"; type: "bool" }
- Property { name: "monitorChargingState"; type: "bool" }
- Property { name: "monitorBatteryStatus"; type: "bool" }
Property { name: "batteryCount"; type: "int"; isReadonly: true }
+ Property { name: "batteryIndex"; type: "int" }
+ Property { name: "valid"; type: "bool"; isReadonly: true }
+ Property { name: "level"; type: "int"; isReadonly: true }
+ Property { name: "currentFlow"; type: "int"; isReadonly: true }
+ Property { name: "cycleCount"; type: "int"; isReadonly: true }
+ Property { name: "maximumCapacity"; type: "int"; isReadonly: true }
+ Property { name: "remainingCapacity"; type: "int"; isReadonly: true }
+ Property { name: "remainingChargingTime"; type: "int"; isReadonly: true }
+ Property { name: "voltage"; type: "int"; isReadonly: true }
+ Property { name: "chargingState"; type: "ChargingState"; isReadonly: true }
Property { name: "chargerType"; type: "ChargerType"; isReadonly: true }
- Property { name: "energyUnit"; type: "EnergyUnit"; isReadonly: true }
+ Property { name: "levelStatus"; type: "LevelStatus"; isReadonly: true }
+ Property { name: "health"; type: "Health"; isReadonly: true }
+ Property { name: "temperature"; type: "float"; isReadonly: true }
+ Signal {
+ name: "batteryIndexChanged"
+ Parameter { name: "batteryIndex"; type: "int" }
+ }
+ Signal {
+ name: "validChanged"
+ Parameter { name: "isValid"; type: "bool" }
+ }
Signal {
name: "batteryCountChanged"
Parameter { name: "count"; type: "int" }
}
Signal {
name: "chargerTypeChanged"
- Parameter { name: "type"; type: "int" }
+ Parameter { name: "type"; type: "QBatteryInfo::ChargerType" }
}
Signal {
name: "chargingStateChanged"
- Parameter { name: "battery"; type: "int" }
- Parameter { name: "state"; type: "int" }
+ Parameter { name: "state"; type: "QBatteryInfo::ChargingState" }
+ }
+ Signal {
+ name: "levelChanged"
+ Parameter { name: "level"; type: "int" }
}
Signal {
name: "currentFlowChanged"
- Parameter { name: "battery"; type: "int" }
Parameter { name: "flow"; type: "int" }
}
Signal {
+ name: "cycleCountChanged"
+ Parameter { name: "cycleCount"; type: "int" }
+ }
+ Signal {
name: "remainingCapacityChanged"
- Parameter { name: "battery"; type: "int" }
Parameter { name: "capacity"; type: "int" }
}
Signal {
name: "remainingChargingTimeChanged"
- Parameter { name: "battery"; type: "int" }
Parameter { name: "seconds"; type: "int" }
}
Signal {
name: "voltageChanged"
- Parameter { name: "battery"; type: "int" }
Parameter { name: "voltage"; type: "int" }
}
Signal {
- name: "batteryStatusChanged"
- Parameter { name: "battery"; type: "int" }
- Parameter { name: "status"; type: "int" }
- }
- Method {
- name: "currentFlow"
- type: "int"
- Parameter { name: "battery"; type: "int" }
- }
- Method {
- name: "remainingCapacity"
- type: "int"
- Parameter { name: "battery"; type: "int" }
- }
- Method {
- name: "remainingChargingTime"
- type: "int"
- Parameter { name: "battery"; type: "int" }
+ name: "levelStatusChanged"
+ Parameter { name: "levelStatus"; type: "QBatteryInfo::LevelStatus" }
}
- Method {
- name: "voltage"
- type: "int"
- Parameter { name: "battery"; type: "int" }
- }
- Method {
- name: "chargingState"
- type: "int"
- Parameter { name: "battery"; type: "int" }
- }
- Method {
- name: "maximumCapacity"
- type: "int"
- Parameter { name: "battery"; type: "int" }
+ Signal {
+ name: "healthChanged"
+ Parameter { name: "health"; type: "QBatteryInfo::Health" }
}
- Method {
- name: "batteryStatus"
- type: "int"
- Parameter { name: "battery"; type: "int" }
+ Signal {
+ name: "temperatureChanged"
+ Parameter { name: "temperature"; type: "float" }
}
}
Component {
@@ -219,87 +206,6 @@ Module {
}
}
Component {
- name: "QDeclarativeDeviceProfile"
- prototype: "QObject"
- exports: ["QtSystemInfo/DeviceProfile 5.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "ProfileType"
- values: {
- "UnknownProfile": 0,
- "SilentProfile": 1,
- "NormalProfile": 2,
- "VibrationProfile": 3,
- "BeepProfile": 4
- }
- }
- Property { name: "isVibrationActivated"; type: "bool"; isReadonly: true }
- Property { name: "messageRingtoneVolume"; type: "int"; isReadonly: true }
- Property { name: "voiceRingtoneVolume"; type: "int"; isReadonly: true }
- Property { name: "currentProfileType"; type: "ProfileType"; isReadonly: true }
- Signal { name: "vibrationActivatedChanged" }
- }
- Component {
- name: "QDeclarativeDisplayInfo"
- prototype: "QObject"
- exports: ["QtSystemInfo/DisplayInfo 5.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "BacklightState"
- values: {
- "BacklightUnknown": 0,
- "BacklightOff": 1,
- "BacklightDimmed": 2,
- "BacklightOn": 3
- }
- }
- Signal {
- name: "backlightStateChanged"
- Parameter { name: "screen"; type: "int" }
- Parameter { name: "state"; type: "int" }
- }
- Method {
- name: "brightness"
- type: "int"
- Parameter { name: "screen"; type: "int" }
- }
- Method {
- name: "contrast"
- type: "int"
- Parameter { name: "screen"; type: "int" }
- }
- Method {
- name: "backlightState"
- type: "int"
- Parameter { name: "screen"; type: "int" }
- }
- Method {
- name: "colorDepth"
- type: "int"
- Parameter { name: "screen"; type: "int" }
- }
- Method {
- name: "dpiX"
- type: "int"
- Parameter { name: "screen"; type: "int" }
- }
- Method {
- name: "dpiY"
- type: "int"
- Parameter { name: "screen"; type: "int" }
- }
- Method {
- name: "physicalHeight"
- type: "int"
- Parameter { name: "screen"; type: "int" }
- }
- Method {
- name: "physicalWidth"
- type: "int"
- Parameter { name: "screen"; type: "int" }
- }
- }
- Component {
name: "QDeclarativeNetworkInfo"
prototype: "QObject"
exports: ["QtSystemInfo/NetworkInfo 5.0"]
diff --git a/src/imports/systeminfo/qdeclarativebatteryinfo.cpp b/src/imports/systeminfo/qdeclarativebatteryinfo.cpp
deleted file mode 100644
index 06ed4dc0..00000000
--- a/src/imports/systeminfo/qdeclarativebatteryinfo.cpp
+++ /dev/null
@@ -1,499 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtSystems module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativebatteryinfo_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype BatteryInfo
- \instantiates QDeclarativeBatteryInfo
- \inqmlmodule QtSystemInfo
- \ingroup qml-systeminfo
- \brief The BatteryInfo element provides various information about the battery status.
-*/
-
-/*!
- \internal
-*/
-QDeclarativeBatteryInfo::QDeclarativeBatteryInfo(QObject *parent)
- : QObject(parent)
- , batteryInfo(new QBatteryInfo(this))
- , isMonitorBatteryCount(false)
- , isMonitorChargerType(false)
- , isMonitorChargingState(false)
- , isMonitorCurrentFlow(false)
- , isMonitorRemainingCapacity(false)
- , isMonitorRemainingChargingTime(false)
- , isMonitorVoltage(false)
- , isMonitorBatteryStatus(false)
-{
-}
-
-/*!
- \internal
- */
-QDeclarativeBatteryInfo::~QDeclarativeBatteryInfo()
-{
-}
-
-/*!
- \qmlproperty bool BatteryInfo::monitorBatteryCount
-
- This property holds whether or not monitor the change of battery counts.
-
- \sa batteryCount
- */
-bool QDeclarativeBatteryInfo::monitorBatteryCount() const
-{
- return isMonitorBatteryCount;
-}
-
-void QDeclarativeBatteryInfo::setMonitorBatteryCount(bool monitor)
-{
- if (monitor != isMonitorBatteryCount) {
- isMonitorBatteryCount = monitor;
- if (monitor) {
- connect(batteryInfo, SIGNAL(batteryCountChanged(int)),
- this, SIGNAL(batteryCountChanged(int)));
- } else {
- disconnect(batteryInfo, SIGNAL(batteryCountChanged(int)),
- this, SIGNAL(batteryCountChanged(int)));
- }
- emit monitorBatteryCountChanged();
- }
-}
-
-/*!
- \qmlproperty int BatteryInfo::batteryCount
-
- This property holds the number of batteries available, or -1 on error or the information is not
- available.
-*/
-int QDeclarativeBatteryInfo::batteryCount() const
-{
- return batteryInfo->batteryCount();
-}
-
-/*!
- \qmlproperty bool BatteryInfo::monitorChargerType
-
- This property holds whether or not monitor the change of charger type.
-
- \sa chargerType
- */
-bool QDeclarativeBatteryInfo::monitorChargerType() const
-{
- return isMonitorChargerType;
-}
-
-void QDeclarativeBatteryInfo::setMonitorChargerType(bool monitor)
-{
- if (monitor != isMonitorChargerType) {
- isMonitorChargerType = monitor;
- if (monitor) {
- connect(batteryInfo, SIGNAL(chargerTypeChanged(QBatteryInfo::ChargerType)),
- this, SLOT(_q_chargerTypeChanged(QBatteryInfo::ChargerType)));
- } else {
- disconnect(batteryInfo, SIGNAL(chargerTypeChanged(QBatteryInfo::ChargerType)),
- this, SLOT(_q_chargerTypeChanged(QBatteryInfo::ChargerType)));
- }
- emit monitorChargerTypeChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration BatteryInfo::chargerType
-
- This property holds the type of the charger. Possible values are:
- \list
- \li BatteryInfo.UnknownCharger - The charger type is unknown, or no charger.
- \li BatteryInfo.WallCharger - Using wall (mains) charger.
- \li BatteryInfo.USBCharger - Using USB charger when the system cannot differentiate the current.
- \li BatteryInfo.VariableCurrentCharger - Using variable current charger such as bicycle or solar.
- \endlist
-*/
-QDeclarativeBatteryInfo::ChargerType QDeclarativeBatteryInfo::chargerType() const
-{
- return static_cast<ChargerType>(batteryInfo->chargerType());
-}
-
-void QDeclarativeBatteryInfo::_q_chargerTypeChanged(QBatteryInfo::ChargerType type)
-{
- emit chargerTypeChanged(static_cast<ChargerType>(type));
-}
-
-/*!
- \qmlproperty bool BatteryInfo::monitorCurrentFlow
-
- This property holds whether or not monitor the flow of batteries.
-
- \sa onCurrentFlowChanged
- */
-bool QDeclarativeBatteryInfo::monitorCurrentFlow() const
-{
- return isMonitorCurrentFlow;
-}
-
-void QDeclarativeBatteryInfo::setMonitorCurrentFlow(bool monitor)
-{
- if (monitor != isMonitorCurrentFlow) {
- isMonitorCurrentFlow = monitor;
- if (monitor) {
- connect(batteryInfo, SIGNAL(currentFlowChanged(int,int)),
- this, SIGNAL(currentFlowChanged(int,int)));
- } else {
- disconnect(batteryInfo, SIGNAL(currentFlowChanged(int,int)),
- this, SIGNAL(currentFlowChanged(int,int)));
- }
- emit monitorCurrentFlowChanged();
- }
-}
-
-/*!
- \qmlsignal BatteryInfo::onCurrentFlowChanged(int battery, int flow)
-
- This handler is called when current flow of \a battery has changed to \a flow.
- Note that it won't be called unless monitorCurrentFlow is set true.
-
- \sa currentFlow, monitorCurrentFlow
- */
-
-/*!
- \qmlmethod int BatteryInfo::currentFlow(int battery)
-
- Returns the current flow of the \a battery.
-
- \sa onCurrentFlowChanged
-*/
-int QDeclarativeBatteryInfo::currentFlow(int battery) const
-{
- return batteryInfo->currentFlow(battery);
-}
-
-/*!
- \qmlproperty bool BatteryInfo::monitorRemainingCapacity
-
- This property holds whether or not monitor the remaining capacity of batteries.
-
- \sa onRemainingCapacityChanged
- */
-bool QDeclarativeBatteryInfo::monitorRemainingCapacity() const
-{
- return isMonitorRemainingCapacity;
-}
-
-void QDeclarativeBatteryInfo::setMonitorRemainingCapacity(bool monitor)
-{
- if (monitor != isMonitorRemainingCapacity) {
- isMonitorRemainingCapacity = monitor;
- if (monitor) {
- connect(batteryInfo, SIGNAL(remainingCapacityChanged(int,int)),
- this, SIGNAL(remainingCapacityChanged(int,int)));
- } else {
- disconnect(batteryInfo, SIGNAL(remainingCapacityChanged(int,int)),
- this, SIGNAL(remainingCapacityChanged(int,int)));
- }
- emit monitorRemainingCapacityChanged();
- }
-}
-
-/*!
- \qmlsignal BatteryInfo::onRemainingCapacityChanged(int battery, int capacity)
-
- This handler is called when remaining capacity of \a battery has changed to \a capacity.
- Note that it won't be called unless monitorRemainingCapacity is set true.
-
- \sa remainingCapacity, monitorRemainingCapacity
- */
-
-/*!
- \qmlmethod int BatteryInfo::remainingCapacity(int battery)
-
- Returns the remaining capacity of the \a battery.
-
- \sa onRemainingCapacityChanged
-*/
-int QDeclarativeBatteryInfo::remainingCapacity(int battery) const
-{
- return batteryInfo->remainingCapacity(battery);
-}
-
-/*!
- \qmlproperty bool BatteryInfo::monitorRemainingChargingTime
-
- This property holds whether or not monitor the remaining charging time of batteries.
-
- \sa onRemainingChargingTimeChanged
- */
-bool QDeclarativeBatteryInfo::monitorRemainingChargingTime() const
-{
- return isMonitorRemainingChargingTime;
-}
-
-void QDeclarativeBatteryInfo::setMonitorRemainingChargingTime(bool monitor)
-{
- if (monitor != isMonitorRemainingChargingTime) {
- isMonitorRemainingChargingTime = monitor;
- if (monitor) {
- connect(batteryInfo, SIGNAL(remainingChargingTimeChanged(int,int)),
- this, SIGNAL(remainingChargingTimeChanged(int,int)));
- } else {
- disconnect(batteryInfo, SIGNAL(remainingChargingTimeChanged(int,int)),
- this, SIGNAL(remainingChargingTimeChanged(int,int)));
- }
- emit monitorRemainingChargingTimeChanged();
- }
-}
-
-/*!
- \qmlsignal BatteryInfo::onRemainingChargingTimeChanged(int battery, int seconds)
-
- This handler is called when remaining charging time of \a battery has changed to \a seconds.
- Note that it won't be called unless monitorRemainingChargingTime is set true.
-
- \sa remainingChargingTime, monitorRemainingChargingTime
- */
-
-/*!
- \qmlmethod int BatteryInfo::remainingChargingTime(int battery)
-
- Returns the remaining charging time of the \a battery.
-
- \sa onRemainingChargingTimeChanged
-*/
-int QDeclarativeBatteryInfo::remainingChargingTime(int battery) const
-{
- return batteryInfo->remainingChargingTime(battery);
-}
-
-/*!
- \qmlproperty bool BatteryInfo::monitorVoltage
-
- This property holds whether or not monitor the voltage of batteries.
-
- \sa onVoltageChanged
- */
-bool QDeclarativeBatteryInfo::monitorVoltage() const
-{
- return isMonitorVoltage;
-}
-
-void QDeclarativeBatteryInfo::setMonitorVoltage(bool monitor)
-{
- if (monitor != isMonitorVoltage) {
- isMonitorVoltage = monitor;
- if (monitor) {
- connect(batteryInfo, SIGNAL(voltageChanged(int,int)),
- this, SIGNAL(voltageChanged(int,int)));
- } else {
- disconnect(batteryInfo, SIGNAL(voltageChanged(int,int)),
- this, SIGNAL(voltageChanged(int,int)));
- }
- emit monitorVoltageChanged();
- }
-}
-
-/*!
- \qmlsignal BatteryInfo::onVoltageChanged(int battery, int voltage)
-
- This handler is called when voltage of \a battery has changed to \a voltage.
- Note that it won't be called unless monitorVoltage is set true.
-
- \sa voltage, monitorVoltage
- */
-
-/*!
- \qmlmethod int BatteryInfo::voltage(int battery)
-
- Returns the voltage of the \a battery.
-
- \sa onVoltageChanged
-*/
-int QDeclarativeBatteryInfo::voltage(int battery) const
-{
- return batteryInfo->voltage(battery);
-}
-
-/*!
- \qmlproperty bool BatteryInfo::monitorChargingState
-
- This property holds whether or not monitor the change of charging state.
-
- \sa onChargingStateChanged
- */
-bool QDeclarativeBatteryInfo::monitorChargingState() const
-{
- return isMonitorChargingState;
-}
-
-void QDeclarativeBatteryInfo::setMonitorChargingState(bool monitor)
-{
- if (monitor != isMonitorChargingState) {
- isMonitorChargingState = monitor;
- if (monitor) {
- connect(batteryInfo, SIGNAL(chargingStateChanged(int,QBatteryInfo::ChargingState)),
- this, SLOT(_q_chargingStateChanged(int,QBatteryInfo::ChargingState)));
- } else {
- disconnect(batteryInfo, SIGNAL(chargingStateChanged(int,QBatteryInfo::ChargingState)),
- this, SLOT(_q_chargingStateChanged(int,QBatteryInfo::ChargingState)));
- }
- emit monitorChargingStateChanged();
- }
-}
-
-/*!
- \qmlmethod ChargingState BatteryInfo::chargingState(int battery)
-
- Returns the charging state of the given \a battery. Possible values are:
- \list
- \li BatteryInfo.UnknownChargingState - The charging state is unknown or charging error occured.
- \li BatteryInfo.NotCharging - The battery is not charging, i.e. too low charger power.
- \li BatteryInfo.Charging - The battery is charging.
- \li BatteryInfo.Discharging - The battery is discharging.
- \li BatteryInfo.Full - The battery is fully charged.
- \endlist
-
- \sa onChargingStateChanged
-*/
-int QDeclarativeBatteryInfo::chargingState(int battery) const
-{
- return batteryInfo->chargingState(battery);
-}
-
-/*!
- \qmlsignal BatteryInfo::onChargingStateChanged(int battery, ChargingState state)
-
- This handler is called when charging state of \a battery has changed to \a state.
- Note that it won't be called unless monitorChargingState is set true.
-
- \sa chargingState, monitorChargingState
- */
-void QDeclarativeBatteryInfo::_q_chargingStateChanged(int battery, QBatteryInfo::ChargingState state)
-{
- emit chargingStateChanged(battery, static_cast<ChargingState>(state));
-}
-
-/*!
- \qmlproperty enumeration BatteryInfo::energyUnit
-
- This property holds the energy unit used. Possible values are:
- \list
- \li BatteryInfo.UnitUnknown - Energy unit unknown.
- \li BatteryInfo.UnitmAh - Energy described in milliamp-hour (mAh)
- \li BatteryInfo.UnitmWh - Energy described in milliwatt-hour (mWh)
- \endlist
-*/
-QDeclarativeBatteryInfo::EnergyUnit QDeclarativeBatteryInfo::energyUnit() const
-{
- return static_cast<EnergyUnit>(batteryInfo->energyUnit());
-}
-
-/*!
- \qmlmethod int BatteryInfo::maximumCapacity(int battery)
-
- Returns the maximum capacity of the \a battery
-*/
-int QDeclarativeBatteryInfo::maximumCapacity(int battery) const
-{
- return batteryInfo->maximumCapacity(battery);
-}
-
-/*!
- \qmlproperty bool BatteryInfo::monitorBatteryStatus
-
- This property holds whether or not monitor the change of battery's status.
-
- \sa onBatteryStatusChanged
- */
-bool QDeclarativeBatteryInfo::monitorBatteryStatus() const
-{
- return isMonitorBatteryStatus;
-}
-
-void QDeclarativeBatteryInfo::setMonitorBatteryStatus(bool monitor)
-{
- if (monitor != isMonitorBatteryStatus) {
- isMonitorBatteryStatus = monitor;
- if (monitor) {
- connect(batteryInfo, SIGNAL(batteryStatusChanged(int,QBatteryInfo::BatteryStatus)),
- this, SLOT(_q_batteryStatusChanged(int,QBatteryInfo::BatteryStatus)));
- } else {
- disconnect(batteryInfo, SIGNAL(batteryStatusChanged(int,QBatteryInfo::BatteryStatus)),
- this, SLOT(_q_batteryStatusChanged(int,QBatteryInfo::BatteryStatus)));
- }
- emit monitorBatteryStatusChanged();
- }
-}
-
-/*!
- \qmlmethod BatteryStatus BatteryInfo::batteryStatus(int battery)
-
- Returns the status of the given \a battery. Possible values are:
- \list
- \li BatteryInfo.BatteryStatusUnknown - Battery level undetermined.
- \li BatteryInfo.BatteryEmpty - Battery is considered be empty and device needs to shut down.
- \li BatteryInfo.BatteryLow - Battery level is low and warnings need to be issued to the user.
- \li BatteryInfo.BatteryOk - Battery level is Ok. It is above "Low" but not "Full".
- \li BatteryInfo.BatteryFull - Battery is fully charged.
- \endlist
-
- \sa onBatteryStatusChanged
-*/
-int QDeclarativeBatteryInfo::batteryStatus(int battery) const
-{
- return batteryInfo->batteryStatus(battery);
-}
-
-/*!
- \qmlsignal BatteryInfo::onBatteryStatusChanged(int battery, BatteryStatus status)
-
- This handler is called when status of \a battery has changed to \a status.
- Note that it won't be called unless monitorBatteryStatus is set true.
-
- \sa batteryStatus, monitorBatteryStatus
- */
-void QDeclarativeBatteryInfo::_q_batteryStatusChanged(int battery, QBatteryInfo::BatteryStatus status)
-{
- emit batteryStatusChanged(battery, static_cast<BatteryStatus>(status));
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/systeminfo/qdeclarativebatteryinfo_p.h b/src/imports/systeminfo/qdeclarativebatteryinfo_p.h
deleted file mode 100644
index 0fc104e3..00000000
--- a/src/imports/systeminfo/qdeclarativebatteryinfo_p.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtSystems module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QDECLARATIVEBATTERYINFO_P_H
-#define QDECLARATIVEBATTERYINFO_P_H
-
-#include <qbatteryinfo.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeBatteryInfo : public QObject
-{
- Q_OBJECT
-
- Q_ENUMS(ChargerType)
- Q_ENUMS(ChargingState)
- Q_ENUMS(EnergyUnit)
- Q_ENUMS(BatteryStatus)
-
- Q_PROPERTY(bool monitorBatteryCount READ monitorBatteryCount WRITE setMonitorBatteryCount NOTIFY monitorBatteryCountChanged)
- Q_PROPERTY(bool monitorChargerType READ monitorChargerType WRITE setMonitorChargerType NOTIFY monitorChargerTypeChanged)
- Q_PROPERTY(bool monitorCurrentFlow READ monitorCurrentFlow WRITE setMonitorCurrentFlow NOTIFY monitorCurrentFlowChanged)
- Q_PROPERTY(bool monitorRemainingCapacity READ monitorRemainingCapacity WRITE setMonitorRemainingCapacity NOTIFY monitorRemainingCapacityChanged)
- Q_PROPERTY(bool monitorRemainingChargingTime READ monitorRemainingChargingTime WRITE setMonitorRemainingChargingTime NOTIFY monitorRemainingChargingTimeChanged)
- Q_PROPERTY(bool monitorVoltage READ monitorVoltage WRITE setMonitorVoltage NOTIFY monitorVoltageChanged)
- Q_PROPERTY(bool monitorChargingState READ monitorChargingState WRITE setMonitorChargingState NOTIFY monitorChargingStateChanged)
- Q_PROPERTY(bool monitorBatteryStatus READ monitorBatteryStatus WRITE setMonitorBatteryStatus NOTIFY monitorBatteryStatusChanged)
-
- Q_PROPERTY(int batteryCount READ batteryCount NOTIFY batteryCountChanged)
- Q_PROPERTY(ChargerType chargerType READ chargerType NOTIFY chargerTypeChanged)
- Q_PROPERTY(EnergyUnit energyUnit READ energyUnit)
-
-public:
- enum ChargerType {
- UnknownCharger = QBatteryInfo::UnknownCharger,
- WallCharger = QBatteryInfo::WallCharger,
- USBCharger = QBatteryInfo::USBCharger,
- VariableCurrentCharger = QBatteryInfo::VariableCurrentCharger
- };
-
- enum ChargingState {
- UnknownChargingState = QBatteryInfo::UnknownChargingState,
- NotCharging = QBatteryInfo::NotCharging,
- Charging = QBatteryInfo::Charging,
- Discharging = QBatteryInfo::Discharging,
- Full = QBatteryInfo::Full
- };
-
- enum EnergyUnit {
- UnitUnknown = QBatteryInfo::UnitUnknown,
- UnitmAh = QBatteryInfo::UnitmAh,
- UnitmWh = QBatteryInfo::UnitmWh
- };
-
- enum BatteryStatus {
- BatteryStatusUnknown = QBatteryInfo::BatteryStatusUnknown,
- BatteryEmpty = QBatteryInfo::BatteryEmpty,
- BatteryLow = QBatteryInfo::BatteryLow,
- BatteryOk = QBatteryInfo::BatteryOk,
- BatteryFull = QBatteryInfo::BatteryFull
- };
-
- QDeclarativeBatteryInfo(QObject *parent = 0);
- virtual ~QDeclarativeBatteryInfo();
-
- bool monitorBatteryCount() const;
- void setMonitorBatteryCount(bool monitor);
- int batteryCount() const;
-
- bool monitorChargerType() const;
- void setMonitorChargerType(bool monitor);
- ChargerType chargerType() const;
-
- bool monitorCurrentFlow() const;
- void setMonitorCurrentFlow(bool monitor);
- Q_INVOKABLE int currentFlow(int battery) const;
-
- bool monitorRemainingCapacity() const;
- void setMonitorRemainingCapacity(bool monitor);
- Q_INVOKABLE int remainingCapacity(int battery) const;
-
- bool monitorRemainingChargingTime() const;
- void setMonitorRemainingChargingTime(bool monitor);
- Q_INVOKABLE int remainingChargingTime(int battery) const;
-
- bool monitorVoltage() const;
- void setMonitorVoltage(bool monitor);
- Q_INVOKABLE int voltage(int battery) const;
-
- bool monitorChargingState() const;
- void setMonitorChargingState(bool monitor);
- Q_INVOKABLE int chargingState(int battery) const;
-
- EnergyUnit energyUnit() const;
- Q_INVOKABLE int maximumCapacity(int battery) const;
-
- bool monitorBatteryStatus() const;
- void setMonitorBatteryStatus(bool monitor);
- Q_INVOKABLE int batteryStatus(int battery) const;
-
-Q_SIGNALS:
- void monitorBatteryCountChanged();
- void monitorChargerTypeChanged();
- void monitorChargingStateChanged();
- void monitorCurrentFlowChanged();
- void monitorRemainingCapacityChanged();
- void monitorRemainingChargingTimeChanged();
- void monitorVoltageChanged();
- void monitorBatteryStatusChanged();
-
- void batteryCountChanged(int count);
- void chargerTypeChanged(int type);
- void chargingStateChanged(int battery, int state);
- void currentFlowChanged(int battery, int flow);
- void remainingCapacityChanged(int battery, int capacity);
- void remainingChargingTimeChanged(int battery, int seconds);
- void voltageChanged(int battery, int voltage);
- void batteryStatusChanged(int battery, int status);
-
-private Q_SLOTS:
- void _q_chargerTypeChanged(QBatteryInfo::ChargerType type);
- void _q_chargingStateChanged(int battery, QBatteryInfo::ChargingState state);
- void _q_batteryStatusChanged(int battery, QBatteryInfo::BatteryStatus status);
-
-private:
- QBatteryInfo *batteryInfo;
-
- bool isMonitorBatteryCount;
- bool isMonitorChargerType;
- bool isMonitorChargingState;
- bool isMonitorCurrentFlow;
- bool isMonitorRemainingCapacity;
- bool isMonitorRemainingChargingTime;
- bool isMonitorVoltage;
- bool isMonitorBatteryStatus;
-};
-
-QT_END_NAMESPACE
-
-#endif // QDECLARATIVEBATTERYINFO_P_H
diff --git a/src/imports/systeminfo/qdeclarativedeviceinfo_p.h b/src/imports/systeminfo/qdeclarativedeviceinfo_p.h
index c857cf3f..9a593bff 100644
--- a/src/imports/systeminfo/qdeclarativedeviceinfo_p.h
+++ b/src/imports/systeminfo/qdeclarativedeviceinfo_p.h
@@ -53,7 +53,7 @@
#ifndef QDECLARATIVEDEVICEINFO_P_H
#define QDECLARATIVEDEVICEINFO_P_H
-#include <qdeviceinfo.h>
+#include "qdeviceinfo.h"
QT_BEGIN_NAMESPACE
diff --git a/src/imports/systeminfo/qsysteminfo.cpp b/src/imports/systeminfo/qsysteminfo.cpp
index 93f14690..91ed0b6b 100644
--- a/src/imports/systeminfo/qsysteminfo.cpp
+++ b/src/imports/systeminfo/qsysteminfo.cpp
@@ -42,6 +42,7 @@
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqml.h>
+#include "qbatteryinfo.h"
#include "qdeclarativedeviceinfo_p.h"
#include "qdeclarativenetworkinfo_p.h"
#include <qscreensaver.h>
@@ -60,6 +61,7 @@ public:
int major = 5;
int minor = 0;
+ qmlRegisterType<QBatteryInfo>(uri, major, minor, "BatteryInfo");
qmlRegisterType<QDeclarativeDeviceInfo>(uri, major, minor, "DeviceInfo");
qmlRegisterType<QDeclarativeNetworkInfo>(uri, major, minor, "NetworkInfo");
qmlRegisterType<QScreenSaver>(uri, major, minor, "ScreenSaver");