summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-04-06 19:27:38 -0500
committerTimothy Pearson <[email protected]>2012-04-06 19:27:38 -0500
commit5f27e3ead5c7d78075ff7fdcfa7a17c1403c826b (patch)
tree083077ee859d91880aafaefddf1ed8b5e26269fd
parent520b27baef7cd2e3a8b7b757564a9b78cd61e506 (diff)
downloadtdebase-5f27e3ead5c7d78075ff7fdcfa7a17c1403c826b.tar.gz
tdebase-5f27e3ead5c7d78075ff7fdcfa7a17c1403c826b.zip
Enhance device manager module
-rw-r--r--kcontrol/hwmanager/CMakeLists.txt2
-rw-r--r--kcontrol/hwmanager/devicepropsdlg.cpp66
-rw-r--r--kcontrol/hwmanager/devicepropsdlg.h5
-rw-r--r--kcontrol/hwmanager/devicepropsdlgbase.ui209
-rw-r--r--kcontrol/hwmanager/hwmanager.cpp35
-rw-r--r--kcontrol/hwmanager/hwmanager.h6
6 files changed, 262 insertions, 61 deletions
diff --git a/kcontrol/hwmanager/CMakeLists.txt b/kcontrol/hwmanager/CMakeLists.txt
index dc1265e49..4973c894f 100644
--- a/kcontrol/hwmanager/CMakeLists.txt
+++ b/kcontrol/hwmanager/CMakeLists.txt
@@ -33,7 +33,7 @@ set_source_files_properties( hwmanager.cpp PROPERTIES COMPILE_FLAGS -DKDE_CONFDI
tde_add_kpart( kcm_hwmanager AUTOMOC
SOURCES
- hwmanager.cpp deviceiconview.cpp devicepropsdlg.cpp hwmanagerbase.ui hwmanager.skel
+ hwmanager.cpp deviceiconview.cpp devicepropsdlg.cpp devicepropsdlgbase.ui hwmanagerbase.ui hwmanager.skel
LINK kio-shared
DESTINATION ${PLUGIN_INSTALL_DIR}
)
diff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp
index 16b01adc9..43892ce8c 100644
--- a/kcontrol/hwmanager/devicepropsdlg.cpp
+++ b/kcontrol/hwmanager/devicepropsdlg.cpp
@@ -42,62 +42,28 @@ DevicePropertiesDialog::DevicePropertiesDialog(TDEGenericDevice* device, TQWidge
enableButtonOK( false );
if (m_device) {
+ base = new DevicePropertiesDialogBase(plainPage());
+
TQGridLayout *mainGrid = new TQGridLayout(plainPage(), 1, 1, 0, spacingHint());
mainGrid->setRowStretch(1, 1);
mainGrid->setRowStretch(1, 1);
-
- TQTabWidget *mainTabs = new TQTabWidget(plainPage());
-
- TQWidget *genericPropertiesTab = new TQWidget(this);
-
- TQGridLayout *generalTabLayout = new TQGridLayout(genericPropertiesTab, 4, 2, 0, spacingHint() );
+ mainGrid->addWidget(base, 0, 0);
- int row = 0;
- TQLabel *label;
- label = new TQLabel(i18n("Device Name:"), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 0);
- label = new TQLabel(m_device->friendlyName(), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 1);
- row++;
- label = new TQLabel(i18n("Device Node:"), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 0);
- label = new TQLabel(m_device->deviceNode(), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 1);
- row++;
- label = new TQLabel(i18n("System Path:"), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 0);
- label = new TQLabel(m_device->systemPath(), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 1);
- row++;
- label = new TQLabel(i18n("Subsystem Type:"), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 0);
- label = new TQLabel(m_device->subsystem(), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 1);
- row++;
- label = new TQLabel(i18n("Device Driver:"), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 0);
- label = new TQLabel((m_device->deviceDriver().isNull())?i18n("<none>"):m_device->deviceDriver(), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 1);
- row++;
- label = new TQLabel(i18n("Device Class:"), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 0);
- label = new TQLabel((m_device->PCIClass().isNull())?i18n("<n/a>"):m_device->PCIClass(), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 1);
- row++;
+ base->labelDeviceType->setText(m_device->friendlyDeviceType());
+ base->iconDeviceType->setPixmap(m_device->icon(KIcon::SizeSmall));
+ base->labelDeviceName->setText(m_device->friendlyName());
+ base->labelDeviceNode->setText((m_device->deviceNode().isNull())?i18n("<none>"):m_device->deviceNode());
+ base->labelSystemPath->setText(m_device->systemPath());
+ 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());
if (m_device->subsystem() == "pci") {
- TQString busid = m_device->systemPath();
- busid = busid.remove(0, busid.findRev("/")+1);
- busid = busid.remove(0, busid.find(":")+1);
- label = new TQLabel(i18n("Bus ID:"), genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 0);
- label = new TQLabel(busid, genericPropertiesTab);
- generalTabLayout->addWidget(label, row, 1);
- row++;
+ base->labelBusID->setText(m_device->busID());
+ }
+ else {
+ base->labelBusID->hide();
+ base->stocklabelBusID->hide();
}
-
- mainTabs->addTab(genericPropertiesTab, i18n("&General"));
-
- mainGrid->addWidget(mainTabs, 0, 0);
}
}
diff --git a/kcontrol/hwmanager/devicepropsdlg.h b/kcontrol/hwmanager/devicepropsdlg.h
index 30c69b1a7..d6ef07b03 100644
--- a/kcontrol/hwmanager/devicepropsdlg.h
+++ b/kcontrol/hwmanager/devicepropsdlg.h
@@ -19,12 +19,12 @@
#ifndef __devicepropsdlg_h__
#define __devicepropsdlg_h__
-// #include <tqt.h>
-
#include <kdialogbase.h>
#include <tdehardwaredevices.h>
+#include "devicepropsdlgbase.h"
+
/**
*
* Dialog to view and edit hardware device properties
@@ -49,6 +49,7 @@ protected:
private:
TDEGenericDevice* m_device;
+ DevicePropertiesDialogBase* base;
class DevicePropertiesDialogPrivate;
DevicePropertiesDialogPrivate* d;
diff --git a/kcontrol/hwmanager/devicepropsdlgbase.ui b/kcontrol/hwmanager/devicepropsdlgbase.ui
new file mode 100644
index 000000000..e55b8dd40
--- /dev/null
+++ b/kcontrol/hwmanager/devicepropsdlgbase.ui
@@ -0,0 +1,209 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>DevicePropertiesDialogBase</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>DevicePropertiesDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>519</width>
+ <height>356</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>TabWidget2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>General</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupProps</cstring>
+ </property>
+ <property name="title">
+ <string>Properties</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0" colspan="1">
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="text">
+ <string>Device Type:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="1" colspan="1">
+ <property name="name">
+ <cstring>iconDeviceType</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="2" colspan="1">
+ <property name="name">
+ <cstring>labelDeviceType</cstring>
+ </property>
+ </widget>
+ <spacer row="0" column="3">
+ <property name="name" stdset="0">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>1</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLabel" row="1" column="0" colspan="1">
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="text">
+ <string>Device Name:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="1" colspan="3">
+ <property name="name">
+ <cstring>labelDeviceName</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0" colspan="1">
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="text">
+ <string>Device Node:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="1" colspan="3">
+ <property name="name">
+ <cstring>labelDeviceNode</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="3" column="0" colspan="1">
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="text">
+ <string>System Path:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="3" column="1" colspan="3">
+ <property name="name">
+ <cstring>labelSystemPath</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="4" column="0" colspan="1">
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="text">
+ <string>Subsystem Type:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="4" column="1" colspan="3">
+ <property name="name">
+ <cstring>labelSubsytemType</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="5" column="0" colspan="1">
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="text">
+ <string>Device Driver:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="5" column="1" colspan="3">
+ <property name="name">
+ <cstring>labelDeviceDriver</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="6" column="0" colspan="1">
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="text">
+ <string>Device Class:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="6" column="1" colspan="3">
+ <property name="name">
+ <cstring>labelDeviceClass</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="7" column="0" colspan="1">
+ <property name="name">
+ <cstring>stocklabelBusID</cstring>
+ </property>
+ <property name="text">
+ <string>Bus ID:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="7" column="1" colspan="3">
+ <property name="name">
+ <cstring>labelBusID</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="8" column="0">
+ <property name="name" stdset="0">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<includes>
+ <include location="local" impldecl="in implementation">DevicePropertiesDialogBase.ui.h</include>
+</includes>
+<Q_SLOTS>
+ <slot>enableSupport_toggled(bool)</slot>
+</Q_SLOTS>
+<includes>
+ <include location="local" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="3" margin="6"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/kcontrol/hwmanager/hwmanager.cpp b/kcontrol/hwmanager/hwmanager.cpp
index 049460d17..cf39b579a 100644
--- a/kcontrol/hwmanager/hwmanager.cpp
+++ b/kcontrol/hwmanager/hwmanager.cpp
@@ -125,6 +125,15 @@ void TDEHWManager::populateTreeView()
{
bool show_by_connection = base->showByConnection->isChecked();
+ // Figure out which device, if any, was selected
+ TQString selected_syspath;
+ DeviceIconItem* selItem = dynamic_cast<DeviceIconItem*>(base->deviceTree->selectedItem());
+ if (selItem) {
+ if (selItem->device()) {
+ selected_syspath = selItem->device()->systemPath();
+ }
+ }
+
base->deviceTree->clear();
if (show_by_connection) {
@@ -135,25 +144,37 @@ void TDEHWManager::populateTreeView()
TDEGenericDevice *hwdevice;
for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
DeviceIconItem* item = new DeviceIconItem(rootitem, hwdevice->friendlyName(), hwdevice->icon(base->deviceTree->iconSize()), hwdevice);
- populateTreeViewLeaf(item, show_by_connection);
+ if ((!selected_syspath.isNull()) && (hwdevice->systemPath() == selected_syspath)) {
+ base->deviceTree->ensureItemVisible(item);
+ base->deviceTree->setSelected(item, true);
+ }
+ populateTreeViewLeaf(item, show_by_connection, selected_syspath);
}
}
else {
TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices();
for (int i=0;i<=TDEGenericDeviceType::Last;i++) {
if (i != TDEGenericDeviceType::Root) {
- DeviceIconItem* item = new DeviceIconItem(base->deviceTree, hwdevices->getFriendlyDeviceTypeStringFromType((TDEGenericDeviceType::TDEGenericDeviceType)i), hwdevices->getDeviceTypeIconFromType((TDEGenericDeviceType::TDEGenericDeviceType)i, base->deviceTree->iconSize()), 0);
+ DeviceIconItem* rootitem = new DeviceIconItem(base->deviceTree, hwdevices->getFriendlyDeviceTypeStringFromType((TDEGenericDeviceType::TDEGenericDeviceType)i), hwdevices->getDeviceTypeIconFromType((TDEGenericDeviceType::TDEGenericDeviceType)i, base->deviceTree->iconSize()), 0);
TDEGenericDevice *hwdevice;
TDEGenericHardwareList hwlist = hwdevices->listByDeviceClass((TDEGenericDeviceType::TDEGenericDeviceType)i);
for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
- new DeviceIconItem(item, hwdevice->friendlyName(), hwdevice->icon(base->deviceTree->iconSize()), hwdevice);
+ DeviceIconItem* item = new DeviceIconItem(rootitem, 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);
+ }
}
}
}
}
+
+ if (!selected_syspath.isNull()) {
+
+ }
}
-void TDEHWManager::populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_connection) {
+void TDEHWManager::populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_connection, TQString selected_syspath) {
if (show_by_connection) {
TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices();
TDEGenericHardwareList hwlist = hwdevices->listAllPhysicalDevices();
@@ -161,7 +182,11 @@ void TDEHWManager::populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_con
for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
if (hwdevice->parentDevice() == parent->device()) {
DeviceIconItem* item = new DeviceIconItem(parent, hwdevice->friendlyName(), hwdevices->getDeviceTypeIconFromType(hwdevice->type(), base->deviceTree->iconSize()), hwdevice);
- populateTreeViewLeaf(item, show_by_connection);
+ if ((!selected_syspath.isNull()) && (hwdevice->systemPath() == selected_syspath)) {
+ base->deviceTree->ensureItemVisible(item);
+ base->deviceTree->setSelected(item, true);
+ }
+ populateTreeViewLeaf(item, show_by_connection, selected_syspath);
}
}
}
diff --git a/kcontrol/hwmanager/hwmanager.h b/kcontrol/hwmanager/hwmanager.h
index c8b7053df..dfa972b50 100644
--- a/kcontrol/hwmanager/hwmanager.h
+++ b/kcontrol/hwmanager/hwmanager.h
@@ -47,8 +47,6 @@ public:
TDEHWManager(TQWidget *parent, const char *name, const TQStringList &);
virtual ~TDEHWManager();
- TDEHWManagerBase *base;
-
void load();
void load( bool useDefaults);
void save();
@@ -61,9 +59,11 @@ k_dcop:
private slots:
void populateTreeView();
- void populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_connection);
+ void populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_connection, TQString selected_syspath);
private:
+ TDEHWManagerBase *base;
+
KConfig *config;
};