diff options
author | Timothy Pearson <[email protected]> | 2012-04-08 21:30:22 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-04-08 21:30:22 -0500 |
commit | 20fc5cd8695425d504c071449f6d38ae3da29511 (patch) | |
tree | b00038ed1eecd23322b8519b5009bd40946a6605 /kcontrol/hwmanager/devicepropsdlg.cpp | |
parent | ffc390445f8276f2c8a845e9e4fc911073a8f4a7 (diff) | |
download | tdebase-20fc5cd8695425d504c071449f6d38ae3da29511.tar.gz tdebase-20fc5cd8695425d504c071449f6d38ae3da29511.zip |
Add sensors tab
Diffstat (limited to 'kcontrol/hwmanager/devicepropsdlg.cpp')
-rw-r--r-- | kcontrol/hwmanager/devicepropsdlg.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp index 1283d2e44..af16249ba 100644 --- a/kcontrol/hwmanager/devicepropsdlg.cpp +++ b/kcontrol/hwmanager/devicepropsdlg.cpp @@ -51,6 +51,9 @@ DevicePropertiesDialog::DevicePropertiesDialog(TDEGenericDevice* device, TQWidge if (m_device->type() != TDEGenericDeviceType::CPU) { base->tabBarWidget->removePage(base->tabCPU); } + if ((m_device->type() != TDEGenericDeviceType::OtherSensor) && (m_device->type() != TDEGenericDeviceType::ThermalSensor)) { + base->tabBarWidget->removePage(base->tabSensor); + } TQGridLayout *mainGrid = new TQGridLayout(plainPage(), 1, 1, 0, spacingHint()); mainGrid->setRowStretch(1, 1); @@ -92,6 +95,7 @@ void DevicePropertiesDialog::populateDeviceInformation() { base->labelSubsytemType->setText(m_device->subsystem()); base->labelDeviceDriver->setText((m_device->deviceDriver().isNull())?i18n("<none>"):m_device->deviceDriver()); base->labelDeviceClass->setText((m_device->PCIClass().isNull())?i18n("<n/a>"):m_device->PCIClass()); + base->labelModalias->setText((m_device->moduleAlias().isNull())?i18n("<none>"):m_device->moduleAlias()); if (m_device->subsystem() == "pci") { base->labelBusID->setText(m_device->busID()); base->labelBusID->show(); @@ -174,7 +178,56 @@ void DevicePropertiesDialog::populateDeviceInformation() { else { base->labelDependentCPUs->setText(i18n("<none>")); } + } + + if ((m_device->type() == TDEGenericDeviceType::OtherSensor) || (m_device->type() == TDEGenericDeviceType::ThermalSensor)) { + TDESensorDevice* sdevice = static_cast<TDESensorDevice*>(m_device); + + // FIXME + // This is rather ugly + // It should be handled via dynamic addition/update of new TQLabel objects, but that is somewhat complex + TQString sensorLabels = "<qt>"; + TQString sensorDataPoints = "<qt>"; + TDESensorClusterMap map = sdevice->values(); + TDESensorClusterMap::Iterator it; + for ( it = map.begin(); it != map.end(); ++it ) { + TQString sensorlabel = it.key(); + TQString sensordatastring; + TDESensorCluster values = it.data(); + + if (!values.label.isNull()) { + sensorlabel = values.label; + } + if (sensorlabel.isNull()) { + sensorlabel = i18n("<unnamed>"); + } + + if (values.minimum > 0) { + sensordatastring += TQString("Minimum Value: %1, ").arg(values.minimum); + } + sensordatastring += TQString("Current Value: %1, ").arg(values.current); + if (values.maximum > 0) { + sensordatastring += TQString("Maximum Value: %1, ").arg(values.maximum); + } + if (values.warning > 0) { + sensordatastring += TQString("Warning Value: %1, ").arg(values.warning); + } + if (values.critical > 0) { + sensordatastring += TQString("Critical Value: %1, ").arg(values.critical); + } + + if (sensordatastring.endsWith(", ")) { + sensordatastring.truncate(sensordatastring.length()-2); + } + + sensorLabels += sensorlabel + "<br>"; + sensorDataPoints += sensordatastring + "<br>"; + } + sensorLabels += "</qt>"; + sensorDataPoints += "</qt>"; + base->labelSensorNames->setText(sensorLabels); + base->labelSensorValues->setText(sensorDataPoints); } } } |