From fef13c17861a7510ef4564550fc041ba62f3f0a2 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 14 Apr 2012 16:50:36 -0500 Subject: Show system properties --- kcontrol/hwmanager/devicepropsdlg.cpp | 102 +++++++++++++++++++ kcontrol/hwmanager/devicepropsdlg.h | 4 + kcontrol/hwmanager/devicepropsdlgbase.ui | 163 +++++++++++++++++++++++++++++++ kcontrol/hwmanager/hwmanager.cpp | 6 +- 4 files changed, 271 insertions(+), 4 deletions(-) diff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp index f5747c1c5..14810318a 100644 --- a/kcontrol/hwmanager/devicepropsdlg.cpp +++ b/kcontrol/hwmanager/devicepropsdlg.cpp @@ -276,6 +276,9 @@ DevicePropertiesDialog::DevicePropertiesDialog(TDEGenericDevice* device, TQWidge if (m_device->type() != TDEGenericDeviceType::Monitor) { base->tabBarWidget->removePage(base->tabMonitor); } + if (m_device->type() != TDEGenericDeviceType::RootSystem) { + base->tabBarWidget->removePage(base->tabRootSystem); + } if (m_device->type() == TDEGenericDeviceType::CPU) { connect(base->comboCPUGovernor, TQT_SIGNAL(activated(const TQString &)), this, TQT_SLOT(setCPUGovernor(const TQString &))); @@ -291,6 +294,9 @@ DevicePropertiesDialog::DevicePropertiesDialog(TDEGenericDevice* device, TQWidge if (m_device->type() == TDEGenericDeviceType::Backlight) { connect(base->sliderBacklightBrightness, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(setBacklightBrightness(int))); } + if (m_device->type() == TDEGenericDeviceType::RootSystem) { + connect(base->comboSystemHibernationMethod, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setHibernationMethod(int))); + } TQGridLayout *mainGrid = new TQGridLayout(plainPage(), 1, 1, 0, spacingHint()); mainGrid->setRowStretch(1, 1); @@ -579,6 +585,95 @@ void DevicePropertiesDialog::populateDeviceInformation() { // RandR warning base->labelRandrWarning->setText("NOTE: Any further integration of displays into TDE REQUIRES multi GPU support and other features slated for RandR 2.0.

Development on such features has been sorely lacking for well over a year as of 2012; if you want to see Linux come up to Windows and Macintosh standards in this area please tell the Xorg developers at http://www.x.org/wiki/XorgMailingLists

The TDE project badly needs these features before it can proceed with graphical monitor configuration tools:
* GPU object support
* The ability to query the active driver name for any Xorg output

To recap, this is not a TDE shortcoming, but rather is the result of a lack of fundamental Linux support for graphics configuration!"); } + + if (m_device->type() == TDEGenericDeviceType::RootSystem) { + TDERootSystemDevice* rdevice = static_cast(m_device); + + TQString formFactorString; + TDESystemFormFactor::TDESystemFormFactor formFactor = rdevice->formFactor(); + if (formFactor == TDESystemFormFactor::Unclassified) { + formFactorString = i18n("Unknown"); + } + else if (formFactor == TDESystemFormFactor::Desktop) { + formFactorString = i18n("Desktop"); + } + else if (formFactor == TDESystemFormFactor::Laptop) { + formFactorString = i18n("Laptop"); + } + else if (formFactor == TDESystemFormFactor::Server) { + formFactorString = i18n("Server"); + } + base->labelSystemFormFactor->setText(formFactorString); + + TQString powerStatesString; + TDESystemPowerStateList powerStates = rdevice->powerStates(); + if (powerStates.count() > 0) { + powerStatesString = ""; + TDESystemPowerStateList::iterator it; + for (it = powerStates.begin(); it != powerStates.end(); ++it) { + if ((*it) == TDESystemPowerState::Active) { + powerStatesString += i18n("Active
"); + } + if ((*it) == TDESystemPowerState::Standby) { + powerStatesString += i18n("Standby
"); + } + if ((*it) == TDESystemPowerState::Suspend) { + powerStatesString += i18n("Suspend
"); + } + if ((*it) == TDESystemPowerState::Hibernate) { + powerStatesString += i18n("Hibernate
"); + } + if ((*it) == TDESystemPowerState::PowerOff) { + powerStatesString += i18n("Power Off
"); + } + } + powerStatesString += "
"; + } + else { + powerStatesString += i18n(""); + } + base->labelSystemPowerStates->setText(powerStatesString); + + base->comboSystemHibernationMethod->setEnabled(rdevice->canSetHibernationMethod()); + TDESystemHibernationMethodList hibernationMethods = rdevice->hibernationMethods(); + if ((uint)hibernationMethods.count() != (uint)base->comboSystemHibernationMethod->count()) { + base->comboSystemHibernationMethod->clear(); + m_hibernationComboMap.clear(); + int i=0; + TQString label; + for (TDESystemHibernationMethodList::Iterator it = hibernationMethods.begin(); it != hibernationMethods.end(); ++it) { + if ((*it) == TDESystemHibernationMethod::None) { + label = i18n(""); + } + if ((*it) == TDESystemHibernationMethod::Platform) { + label = i18n("Platform"); + } + if ((*it) == TDESystemHibernationMethod::Shutdown) { + label = i18n("Shutdown"); + } + if ((*it) == TDESystemHibernationMethod::Reboot) { + label = i18n("Reboot"); + } + if ((*it) == TDESystemHibernationMethod::TestProc) { + label = i18n("Test Procedure"); + } + if ((*it) == TDESystemHibernationMethod::Test) { + label = i18n("Test"); + } + base->comboSystemHibernationMethod->insertItem(label, i); + m_hibernationComboMap[*it] = i; + i++; + } + } + base->comboSystemHibernationMethod->setCurrentItem(m_hibernationComboMap[rdevice->hibernationMethod()]); + + base->labelSystemUserCanStandby->setText((rdevice->canStandby())?i18n("Yes"):i18n("No")); + base->labelSystemUserCanSuspend->setText((rdevice->canSuspend())?i18n("Yes"):i18n("No")); + base->labelSystemUserCanHibernate->setText((rdevice->canHibernate())?i18n("Yes"):i18n("No")); + base->labelSystemUserCanPowerOff->setText((rdevice->canPowerOff())?i18n("Yes"):i18n("No")); + + base->labelSystemHibernationSpace->setText((rdevice->diskSpaceNeededForHibernation()<0)?i18n(""):TDEHardwareDevices::bytesToFriendlySizeString(rdevice->diskSpaceNeededForHibernation())); + } } } @@ -595,6 +690,13 @@ void DevicePropertiesDialog::setBacklightBrightness(int value) { bdevice->setRawBrightness(value); } +void DevicePropertiesDialog::setHibernationMethod(int value) { + TDERootSystemDevice* rdevice = static_cast(m_device); + + rdevice->setHibernationMethod(m_hibernationComboMap.keys()[value]); + populateDeviceInformation(); +} + void DevicePropertiesDialog::virtual_hook( int id, void* data ) { KDialogBase::virtual_hook( id, data ); } diff --git a/kcontrol/hwmanager/devicepropsdlg.h b/kcontrol/hwmanager/devicepropsdlg.h index 4a70da5c2..192ebffd4 100644 --- a/kcontrol/hwmanager/devicepropsdlg.h +++ b/kcontrol/hwmanager/devicepropsdlg.h @@ -155,6 +155,7 @@ private: }; typedef TQPtrList SensorDisplayWidgetList; +typedef TQMap HibernationComboMap; /** * @@ -185,6 +186,7 @@ private slots: void setCPUGovernor(const TQString &); void setBacklightBrightness(int); + void setHibernationMethod(int); private: TDEGenericDevice* m_device; @@ -195,6 +197,8 @@ private: TQGridLayout* m_sensorDataGrid; SensorDisplayWidgetList m_sensorDataGridWidgets; + + HibernationComboMap m_hibernationComboMap; }; #endif diff --git a/kcontrol/hwmanager/devicepropsdlgbase.ui b/kcontrol/hwmanager/devicepropsdlgbase.ui index cd4aaf03d..d1cda0007 100644 --- a/kcontrol/hwmanager/devicepropsdlgbase.ui +++ b/kcontrol/hwmanager/devicepropsdlgbase.ui @@ -1217,6 +1217,169 @@ + + + tabRootSystem + + + System + + + + unnamed + + + + groupSysinfo + + + System Information + + + + unnamed + + + + unnamed + + + Form Factor + + + + + labelSystemFormFactor + + + + + + + groupSystemPower + + + Power Management + + + + + unnamed + + + Available Power States + + + AlignTop|AlignLeft + + + + + labelSystemPowerStates + + + + + unnamed + + + Hibernation Method + + + AlignTop|AlignLeft + + + + + comboSystemHibernationMethod + + + + + unnamed + + + Disk Space Needed to Hibernate + + + + + labelSystemHibernationSpace + + + + + unnamed + + + User Can Request Standby + + + + + labelSystemUserCanStandby + + + + + unnamed + + + User Can Request Suspend + + + + + labelSystemUserCanSuspend + + + + + unnamed + + + User Can Request Hibernation + + + + + labelSystemUserCanHibernate + + + + + unnamed + + + User Can Request Shutdown + + + + + labelSystemUserCanPowerOff + + + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + diff --git a/kcontrol/hwmanager/hwmanager.cpp b/kcontrol/hwmanager/hwmanager.cpp index 71b47aac0..055425154 100644 --- a/kcontrol/hwmanager/hwmanager.cpp +++ b/kcontrol/hwmanager/hwmanager.cpp @@ -139,13 +139,11 @@ void TDEHWManager::populateTreeView() base->deviceTree->clear(); if (show_by_connection) { - DeviceIconItem* rootitem = new DeviceIconItem(base->deviceTree, "Linux System", DesktopIcon("misc", base->deviceTree->iconSize()), 0); - TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); - TDEGenericHardwareList hwlist = hwdevices->listByDeviceClass(TDEGenericDeviceType::Root); + TDEGenericHardwareList hwlist = hwdevices->listByDeviceClass(TDEGenericDeviceType::RootSystem); TDEGenericDevice *hwdevice; for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) { - DeviceIconItem* item = new DeviceIconItem(rootitem, hwdevice->friendlyName(), hwdevice->icon(base->deviceTree->iconSize()), hwdevice); + DeviceIconItem* item = new DeviceIconItem(base->deviceTree, hwdevice->friendlyName(), hwdevice->icon(base->deviceTree->iconSize()), hwdevice); if ((!selected_syspath.isNull()) && (hwdevice->systemPath() == selected_syspath)) { base->deviceTree->ensureItemVisible(item); base->deviceTree->setSelected(item, true); -- cgit v1.2.1