summaryrefslogtreecommitdiffstats
path: root/examples/sysinfo/dialog.cpp
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2010-11-18 15:42:17 +1000
committerLorn Potter <lorn.potter@nokia.com>2010-11-18 15:46:50 +1000
commite16e715efcd461be7fb26e82abfcd97212c54668 (patch)
treedd4c9fe92635ecc58e592b32e46668ec080dea42 /examples/sysinfo/dialog.cpp
parent9e38837b5361229293baac9a8806c16e90aebf7a (diff)
hook up signals and update example application for new batteryinfo
Diffstat (limited to 'examples/sysinfo/dialog.cpp')
-rw-r--r--examples/sysinfo/dialog.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/examples/sysinfo/dialog.cpp b/examples/sysinfo/dialog.cpp
index 4446786169..9c9d8a9076 100644
--- a/examples/sysinfo/dialog.cpp
+++ b/examples/sysinfo/dialog.cpp
@@ -478,13 +478,13 @@ void Dialog::setSaverEnabled(bool b)
}
-void Dialog::updateBatteryStatus(qint32 level)
+void Dialog::updateBatteryStatus(int level)
{
batteryLevelBar->setValue(level);
lcdNumber->display(level);
}
-void Dialog::updatePowerState(QSystemDeviceInfo::PowerState newState)
+void Dialog::updatePowerState(QSystemDeviceInfo::PowerState /*newState*/)
{
// currentPowerState = newState;
// switch (newState) {
@@ -547,6 +547,12 @@ void Dialog::displayBatteryStatus(QSystemBatteryInfo::BatteryStatus status)
QMessageBox::information(this,"QSystemInfo",msg);
}
break;
+ case QSystemBatteryInfo::BatteryFull:
+ {
+ msg = "Battery is Full (100%)";
+ QMessageBox::information(this,"QSystemInfo",msg);
+ }
+ break;
case QSystemBatteryInfo::BatteryUnknown:
{
@@ -729,7 +735,6 @@ void Dialog::updateProfile()
if(di) {
QString profilestring;
- qDebug() << di->currentProfile();
switch(di->currentProfile()) {
case QSystemDeviceInfo::SilentProfile:
{
@@ -833,15 +838,12 @@ void Dialog::setupBattery()
delete bi;
bi = new QSystemBatteryInfo(this);
- connect(bi,SIGNAL(remainingCapacityPercentChanged(qint32)),
- this,SLOT(updateBatteryStatus(qint32)));
+ connect(bi,SIGNAL(remainingCapacityPercentChanged(int)),
+ this,SLOT(updateBatteryStatus(int)));
connect(bi,SIGNAL(batteryStatusChanged(QSystemBatteryInfo::BatteryStatus)),
this,SLOT(displayBatteryStatus(QSystemBatteryInfo::BatteryStatus)));
-// connect(bi,SIGNAL(powerStateChanged(QSystemDeviceInfo::PowerState)),
-// this,SLOT(updatePowerState(QSystemDeviceInfo::PowerState)));
-
connect(bi,SIGNAL(chargingStateChanged(QSystemBatteryInfo::ChargingState)),
this,SLOT(chargingStateChanged(QSystemBatteryInfo::ChargingState)));
@@ -851,6 +853,18 @@ void Dialog::setupBattery()
connect(startMeasurementPushButton,SIGNAL(clicked()),
this,SLOT(startCurrentPushed()));
+ connect(bi,SIGNAL(nominalCapacityChanged(int)),
+ NominalCaplcdNumber,SLOT(display(int)));
+ connect(bi,SIGNAL(remainingCapacityChanged(int)),
+ remainCaplcdNumber,SLOT(display(int)));
+ connect(bi,SIGNAL(voltageChanged(int)),
+ voltagelcdNumber,SLOT(display(int)));
+ connect(bi,SIGNAL(currentFlowChanged(int)),
+ currentFLowlcdNumber,SLOT(display(int)));
+ connect(bi,SIGNAL(remainingCapacityBarsChanged(int)),
+ remainingCapBarslcdNumber,SLOT(display(int)));
+ connect(bi,SIGNAL(remainingChargingTimeChanged(int)),
+ chargeTimelcdNumber,SLOT(display(int)));
chargerTypeChanged(bi->chargerType());
@@ -885,8 +899,8 @@ void Dialog::setupBattery()
void Dialog::chargingStateChanged(QSystemBatteryInfo::ChargingState chargingState)
{
- if(chargingState == QSystemBatteryInfo::NotCharging) {
- chargingCheckBox->setChecked(false);
+ if(chargingState == QSystemBatteryInfo::Charging) {
+ chargingCheckBox->setChecked(true);
} else {
chargingCheckBox->setChecked(false);
}
@@ -896,7 +910,7 @@ void Dialog::chargingStateChanged(QSystemBatteryInfo::ChargingState chargingStat
void Dialog::chargerTypeChanged(QSystemBatteryInfo::ChargerType chargerType)
{
- if(chargerType == QSystemBatteryInfo::BatteryEmpty) {
+ if(chargerType == QSystemBatteryInfo::NoCharger) {
radioButton_2->setChecked(true);
} else if(chargerType == QSystemBatteryInfo::WallCharger) {
radioButton_3->setChecked(true);