From 7ac2a6533d3df1f083f48115bc67edd23080bb95 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 14 Apr 2012 19:16:17 -0500 Subject: Add switch reporting --- kcontrol/hwmanager/devicepropsdlg.cpp | 35 ++++++++++++++- kcontrol/hwmanager/devicepropsdlgbase.ui | 75 ++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 1 deletion(-) diff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp index 14810318a..8622dc978 100644 --- a/kcontrol/hwmanager/devicepropsdlg.cpp +++ b/kcontrol/hwmanager/devicepropsdlg.cpp @@ -279,6 +279,9 @@ DevicePropertiesDialog::DevicePropertiesDialog(TDEGenericDevice* device, TQWidge if (m_device->type() != TDEGenericDeviceType::RootSystem) { base->tabBarWidget->removePage(base->tabRootSystem); } + if (m_device->type() != TDEGenericDeviceType::Event) { + base->tabBarWidget->removePage(base->tabEvent); + } if (m_device->type() == TDEGenericDeviceType::CPU) { connect(base->comboCPUGovernor, TQT_SIGNAL(activated(const TQString &)), this, TQT_SLOT(setCPUGovernor(const TQString &))); @@ -327,6 +330,10 @@ void DevicePropertiesDialog::processHardwareUpdated(TDEGenericDevice* dev) { } } +TQString assembleSwitchList(TDESwitchType::TDESwitchType switches) { + return (TDEEventDevice::friendlySwitchList(switches).join("
")); +} + void DevicePropertiesDialog::populateDeviceInformation() { if (m_device) { base->labelDeviceType->setText(m_device->friendlyDeviceType()); @@ -642,7 +649,7 @@ void DevicePropertiesDialog::populateDeviceInformation() { int i=0; TQString label; for (TDESystemHibernationMethodList::Iterator it = hibernationMethods.begin(); it != hibernationMethods.end(); ++it) { - if ((*it) == TDESystemHibernationMethod::None) { + if ((*it) == TDESystemHibernationMethod::Unsupported) { label = i18n(""); } if ((*it) == TDESystemHibernationMethod::Platform) { @@ -674,6 +681,32 @@ void DevicePropertiesDialog::populateDeviceInformation() { base->labelSystemHibernationSpace->setText((rdevice->diskSpaceNeededForHibernation()<0)?i18n(""):TDEHardwareDevices::bytesToFriendlySizeString(rdevice->diskSpaceNeededForHibernation())); } + + if (m_device->type() == TDEGenericDeviceType::Event) { + TDEEventDevice* edevice = static_cast(m_device); + + TQString availableSwitches; + if (edevice->providedSwitches() == TDESwitchType::Null) { + availableSwitches = i18n(""); + } + else { + availableSwitches = ""; + availableSwitches += assembleSwitchList(edevice->providedSwitches()); + availableSwitches += ""; + } + base->labelEventSwitchTypes->setText(availableSwitches); + + TQString activeSwitches; + if (edevice->activeSwitches() == TDESwitchType::Null) { + activeSwitches = i18n(""); + } + else { + activeSwitches = ""; + activeSwitches += assembleSwitchList(edevice->activeSwitches()); + activeSwitches += ""; + } + base->labelEventSwitchActive->setText(activeSwitches); + } } } diff --git a/kcontrol/hwmanager/devicepropsdlgbase.ui b/kcontrol/hwmanager/devicepropsdlgbase.ui index d1cda0007..bd80b3900 100644 --- a/kcontrol/hwmanager/devicepropsdlgbase.ui +++ b/kcontrol/hwmanager/devicepropsdlgbase.ui @@ -1380,6 +1380,81 @@ + + + tabEvent + + + Event Input + + + + unnamed + + + + groupInput + + + Input Status + + + + unnamed + + + + unnamed + + + Physical Switch Type(s) + + + AlignTop|AlignLeft + + + + + labelEventSwitchTypes + + + + + unnamed + + + Active Switch Type(s) + + + AlignTop|AlignLeft + + + + + labelEventSwitchActive + + + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + -- cgit v1.2.1 From c8c3b71ed2853200ea94bd14e1035b703025f03d Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 15 Apr 2012 14:12:28 -0500 Subject: Expose battery time remaining --- kcontrol/hwmanager/devicepropsdlg.cpp | 14 +++++++++++++- kcontrol/hwmanager/devicepropsdlgbase.ui | 13 +++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp index 8622dc978..459d72662 100644 --- a/kcontrol/hwmanager/devicepropsdlg.cpp +++ b/kcontrol/hwmanager/devicepropsdlg.cpp @@ -503,10 +503,22 @@ void DevicePropertiesDialog::populateDeviceInformation() { base->labelMinimumBatteryVoltage->setText((bdevice->minimumVoltage()<0)?i18n(""):TQString("%1 V").arg(bdevice->minimumVoltage())); base->labelCurrentBatteryVoltage->setText((bdevice->voltage()<0)?i18n(""):TQString("%1 V").arg(bdevice->voltage())); base->labelCurrentBatteryDischargeRate->setText((bdevice->dischargeRate()<0)?i18n(""):TQString("%1 Vh").arg(bdevice->dischargeRate())); - base->labelCurrentBatteryStatus->setText((bdevice->status().isNull())?i18n(""):bdevice->status()); + TQString batteryStatusString = i18n("Unknown"); + TDEBatteryStatus::TDEBatteryStatus batteryStatus = bdevice->status(); + if (batteryStatus == TDEBatteryStatus::Charging) { + batteryStatusString = i18n("Charging"); + } + if (batteryStatus == TDEBatteryStatus::Discharging) { + batteryStatusString = i18n("Discharging"); + } + if (batteryStatus == TDEBatteryStatus::Full) { + batteryStatusString = i18n("Full"); + } + base->labelCurrentBatteryStatus->setText(batteryStatusString); base->labelBatteryTechnology->setText((bdevice->technology().isNull())?i18n(""):bdevice->technology()); base->labelBatteryInstalled->setText((bdevice->installed()==0)?i18n("No"):i18n("Yes")); base->labelBatteryCharge->setText((bdevice->chargePercent()<0)?i18n(""):TQString("%1 %").arg(bdevice->chargePercent())); + base->labelBatteryTimeRemaining->setText((bdevice->timeRemaining()<0)?i18n(""):TQString("%1 seconds").arg(bdevice->timeRemaining())); } if (m_device->type() == TDEGenericDeviceType::PowerSupply) { diff --git a/kcontrol/hwmanager/devicepropsdlgbase.ui b/kcontrol/hwmanager/devicepropsdlgbase.ui index bd80b3900..ff5af2031 100644 --- a/kcontrol/hwmanager/devicepropsdlgbase.ui +++ b/kcontrol/hwmanager/devicepropsdlgbase.ui @@ -662,6 +662,19 @@ labelBatteryCharge + + + unnamed + + + Time To Charge / Discharge + + + + + labelBatteryTimeRemaining + + -- cgit v1.2.1 From ebf2c049b7b97c07807c1c324d55ff467c4a3eac Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 15 Apr 2012 16:28:39 -0500 Subject: Fix minor glitch in battery status dialog --- kcontrol/hwmanager/devicepropsdlg.cpp | 2 +- kcontrol/hwmanager/devicepropsdlgbase.ui | 2 +- kcontrol/hwmanager/hwmanagerbase.ui | 17 ----------------- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp index 459d72662..784c49b69 100644 --- a/kcontrol/hwmanager/devicepropsdlg.cpp +++ b/kcontrol/hwmanager/devicepropsdlg.cpp @@ -502,7 +502,7 @@ void DevicePropertiesDialog::populateDeviceInformation() { base->labelMaximumBatteryDesignEnergy->setText((bdevice->maximumDesignEnergy()<0)?i18n(""):TQString("%1 Wh").arg(bdevice->maximumDesignEnergy())); base->labelMinimumBatteryVoltage->setText((bdevice->minimumVoltage()<0)?i18n(""):TQString("%1 V").arg(bdevice->minimumVoltage())); base->labelCurrentBatteryVoltage->setText((bdevice->voltage()<0)?i18n(""):TQString("%1 V").arg(bdevice->voltage())); - base->labelCurrentBatteryDischargeRate->setText((bdevice->dischargeRate()<0)?i18n(""):TQString("%1 Vh").arg(bdevice->dischargeRate())); + base->labelCurrentBatteryDischargeRate->setText((bdevice->dischargeRate()<0)?i18n(""):TQString("%1 Wh").arg(bdevice->dischargeRate())); TQString batteryStatusString = i18n("Unknown"); TDEBatteryStatus::TDEBatteryStatus batteryStatus = bdevice->status(); if (batteryStatus == TDEBatteryStatus::Charging) { diff --git a/kcontrol/hwmanager/devicepropsdlgbase.ui b/kcontrol/hwmanager/devicepropsdlgbase.ui index ff5af2031..dc328d643 100644 --- a/kcontrol/hwmanager/devicepropsdlgbase.ui +++ b/kcontrol/hwmanager/devicepropsdlgbase.ui @@ -602,7 +602,7 @@ unnamed - Current Discharge Rate + Current Charge / Discharge Rate diff --git a/kcontrol/hwmanager/hwmanagerbase.ui b/kcontrol/hwmanager/hwmanagerbase.ui index 689cb4e55..4b14ff428 100644 --- a/kcontrol/hwmanager/hwmanagerbase.ui +++ b/kcontrol/hwmanager/hwmanagerbase.ui @@ -73,23 +73,6 @@ - - - Spacer4 - - - Vertical - - - Expanding - - - - 20 - 20 - - - -- cgit v1.2.1