From 0f026179d0e57a469f88b1b242312d6e75e4961d Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 8 Apr 2012 16:16:48 -0500 Subject: Add filtering support to device manager Add detailed CPU tab to device manager --- kcontrol/hwmanager/devicepropsdlg.cpp | 35 +++++ kcontrol/hwmanager/devicepropsdlg.h | 5 + kcontrol/hwmanager/devicepropsdlgbase.ui | 212 +++++++++++++++++++++++++++++++ kcontrol/hwmanager/hwmanager.cpp | 4 +- kcontrol/hwmanager/hwmanager.h | 1 + kcontrol/hwmanager/hwmanagerbase.ui | 17 ++- 6 files changed, 271 insertions(+), 3 deletions(-) (limited to 'kcontrol') diff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp index bc2e0f843..96a7cafed 100644 --- a/kcontrol/hwmanager/devicepropsdlg.cpp +++ b/kcontrol/hwmanager/devicepropsdlg.cpp @@ -49,11 +49,46 @@ DevicePropertiesDialog::DevicePropertiesDialog(TDEGenericDevice* device, TQWidge base->tabBarWidget->removePage(base->tabDisk); } + // Remove all non-applicable tabs + if (m_device->type() != TDEGenericDeviceType::Disk) { + base->tabBarWidget->removePage(base->tabDisk); + } + if (m_device->type() != TDEGenericDeviceType::CPU) { + base->tabBarWidget->removePage(base->tabCPU); + } + TQGridLayout *mainGrid = new TQGridLayout(plainPage(), 1, 1, 0, spacingHint()); mainGrid->setRowStretch(1, 1); mainGrid->setRowStretch(1, 1); mainGrid->addWidget(base, 0, 0); + } + + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + + connect(hwdevices, TQT_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQT_SLOT(processHardwareRemoved(TDEGenericDevice*))); + connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(processHardwareUpdated(TDEGenericDevice*))); + + populateDeviceInformation(); +} +DevicePropertiesDialog::~DevicePropertiesDialog() +{ +} + +void DevicePropertiesDialog::processHardwareRemoved(TDEGenericDevice* dev) { + if (dev == m_device) { + close(); + } +} + +void DevicePropertiesDialog::processHardwareUpdated(TDEGenericDevice* dev) { + if (dev == m_device) { + populateDeviceInformation(); + } +} + +void DevicePropertiesDialog::populateDeviceInformation() { + if (m_device) { base->labelDeviceType->setText(m_device->friendlyDeviceType()); base->iconDeviceType->setPixmap(m_device->icon(KIcon::SizeSmall)); base->labelDeviceName->setText(m_device->friendlyName()); diff --git a/kcontrol/hwmanager/devicepropsdlg.h b/kcontrol/hwmanager/devicepropsdlg.h index d6ef07b03..870e57240 100644 --- a/kcontrol/hwmanager/devicepropsdlg.h +++ b/kcontrol/hwmanager/devicepropsdlg.h @@ -47,6 +47,11 @@ public: protected: virtual void virtual_hook( int id, void* data ); +private slots: + void processHardwareRemoved(TDEGenericDevice*); + void processHardwareUpdated(TDEGenericDevice*); + void populateDeviceInformation(); + private: TDEGenericDevice* m_device; DevicePropertiesDialogBase* base; diff --git a/kcontrol/hwmanager/devicepropsdlgbase.ui b/kcontrol/hwmanager/devicepropsdlgbase.ui index 07daa19da..265ba0f0f 100644 --- a/kcontrol/hwmanager/devicepropsdlgbase.ui +++ b/kcontrol/hwmanager/devicepropsdlgbase.ui @@ -264,6 +264,218 @@ + + + tabDisk + + + Disk + + + + unnamed + + + + groupProps + + + Volume Information + + + + unnamed + + + + unnamed + + + Mountpoint: + + + + + labelDiskMountpoint + + + + + unnamed + + + Status: + + + AlignTop|AlignLeft + + + + + labelDiskStatus + + + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + tabCPU + + + Processor + + + + unnamed + + + + groupProps + + + Processor Information + + + + unnamed + + + + unnamed + + + Vendor ID: + + + + + labelCPUVendor + + + + + unnamed + + + Minimum Frequency: + + + + + labelMinCPUFrequency + + + + + unnamed + + + Current Frequency: + + + + + labelCPUFrequency + + + + + unnamed + + + Maximum Frequency: + + + + + labelMaxCPUFrequency + + + + + unnamed + + + Scaling Driver: + + + + + labelScalingDriver + + + + + unnamed + + + Available Frequencies: + + + AlignTop|AlignLeft + + + + + labelScalingFrequencies + + + + + unnamed + + + Frequency Locked Processor(s): + + + AlignTop|AlignLeft + + + + + labelDependentCPUs + + + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + diff --git a/kcontrol/hwmanager/hwmanager.cpp b/kcontrol/hwmanager/hwmanager.cpp index cf39b579a..71b47aac0 100644 --- a/kcontrol/hwmanager/hwmanager.cpp +++ b/kcontrol/hwmanager/hwmanager.cpp @@ -78,6 +78,8 @@ TDEHWManager::TDEHWManager(TQWidget *parent, const char *name, const TQStringLis base = new TDEHWManagerBase(this); layout->add(base); + base->deviceFilter->setListView(base->deviceTree); + setRootOnlyMsg(i18n("Hardware settings are system wide, and requires administrator access
To alter the system's hardware settings, click on the \"Administrator Mode\" button below.")); setUseRootOnlyMsg(true); @@ -88,7 +90,7 @@ TDEHWManager::TDEHWManager(TQWidget *parent, const char *name, const TQStringLis connect(hwdevices, TQT_SIGNAL(hardwareAdded(TDEGenericDevice*)), this, TQT_SLOT(populateTreeView())); connect(hwdevices, TQT_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQT_SLOT(populateTreeView())); - connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(populateTreeView())); +// connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(populateTreeView())); load(); diff --git a/kcontrol/hwmanager/hwmanager.h b/kcontrol/hwmanager/hwmanager.h index dfa972b50..89652cd32 100644 --- a/kcontrol/hwmanager/hwmanager.h +++ b/kcontrol/hwmanager/hwmanager.h @@ -26,6 +26,7 @@ #endif #include +#include #include diff --git a/kcontrol/hwmanager/hwmanagerbase.ui b/kcontrol/hwmanager/hwmanagerbase.ui index 355799e56..689cb4e55 100644 --- a/kcontrol/hwmanager/hwmanagerbase.ui +++ b/kcontrol/hwmanager/hwmanagerbase.ui @@ -45,7 +45,7 @@ unnamed - + showByConnection @@ -53,11 +53,24 @@ &List devices by connection - + deviceTree + + + unnamed + + + Filter by Name: + + + + + deviceFilter + + -- cgit v1.2.3