summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/devicesinfo.cpp22
-rw-r--r--noncore/settings/sysinfo/devicesinfo.h8
2 files changed, 27 insertions, 3 deletions
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp
index 4bce65f..f1efb33 100644
--- a/noncore/settings/sysinfo/devicesinfo.cpp
+++ b/noncore/settings/sysinfo/devicesinfo.cpp
@@ -72,27 +72,39 @@ DevicesView::~DevicesView()
72 72
73void DevicesView::selectionChanged( QListViewItem* item ) 73void DevicesView::selectionChanged( QListViewItem* item )
74{ 74{
75 odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; 75 odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl;
76 QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget();
77 ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details );
76} 78}
77 79
78 80
79//================================================================================================= 81//=================================================================================================
80DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) 82DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl )
81 :QWidget( parent, name, fl ) 83 :QWidget( parent, name, fl ), details( 0 )
82{ 84{
83 OAutoBoxLayout *layout = new OAutoBoxLayout( this ); 85 layout = new OAutoBoxLayout( this );
84 layout->setSpacing( 4 ); 86 layout->setSpacing( 4 );
85 layout->setMargin( 4 ); 87 layout->setMargin( 4 );
86 view = new DevicesView( this ); 88 view = new DevicesView( this );
87 layout->addWidget( view ); 89 layout->addWidget( view );
88} 90}
89 91
92
90DevicesInfo::~DevicesInfo() 93DevicesInfo::~DevicesInfo()
91{ 94{
92} 95}
93 96
94 97
98void DevicesInfo::setDetailsWidget( QWidget* w )
99{
100 if ( details ) delete( details );
101 layout->addWidget( w );
102 w->show();
103}
104
105
106//=================================================================================================
95Category::Category( DevicesView* parent, const QString& name ) 107Category::Category( DevicesView* parent, const QString& name )
96 :OListViewItem( parent, name ) 108 :OListViewItem( parent, name )
97{ 109{
98 odebug << "Category '" << name << "' inserted. Scanning for devices..." << oendl; 110 odebug << "Category '" << name << "' inserted. Scanning for devices..." << oendl;
@@ -111,8 +123,14 @@ Device::Device( Category* parent, const QString& name )
111Device::~Device() 123Device::~Device()
112{ 124{
113} 125}
114 126
127QWidget* Device::detailsWidget()
128{
129 return new QPushButton( static_cast<QWidget*>( listView()->parent() ), "Press Button to self-destruct" );
130}
131
132
115//================================================================================================= 133//=================================================================================================
116CpuCategory::CpuCategory( DevicesView* parent ) 134CpuCategory::CpuCategory( DevicesView* parent )
117 :Category( parent, "1. Central Processing Unit" ) 135 :Category( parent, "1. Central Processing Unit" )
118{ 136{
diff --git a/noncore/settings/sysinfo/devicesinfo.h b/noncore/settings/sysinfo/devicesinfo.h
index 262af31..b065f40 100644
--- a/noncore/settings/sysinfo/devicesinfo.h
+++ b/noncore/settings/sysinfo/devicesinfo.h
@@ -30,8 +30,9 @@ _;:,     .>    :=|. This program is free software; you can
30#define DEVICESINFO_H 30#define DEVICESINFO_H
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/olistview.h> 33#include <opie2/olistview.h>
34#include <opie2/olayout.h>
34 35
35/* QT */ 36/* QT */
36#include <qwidget.h> 37#include <qwidget.h>
37 38
@@ -53,11 +54,14 @@ class DevicesInfo : public QWidget
53public: 54public:
54 DevicesInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 55 DevicesInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
55 ~DevicesInfo(); 56 ~DevicesInfo();
56 57
58 void setDetailsWidget( QWidget* w = 0 );
59
57private: 60private:
61 Opie::Ui::OAutoBoxLayout* layout;
58 Opie::Ui::OListView* view; 62 Opie::Ui::OListView* view;
59 63 QWidget* details;
60private slots: 64private slots:
61}; 65};
62 66
63//================================================================================================= 67//=================================================================================================
@@ -75,8 +79,10 @@ class Device : public Opie::Ui::OListViewItem
75{ 79{
76public: 80public:
77 Device( Category* parent, const QString& name ); 81 Device( Category* parent, const QString& name );
78 ~Device(); 82 ~Device();
83
84 QWidget* detailsWidget();
79}; 85};
80 86
81//================================================================================================= 87//=================================================================================================
82class CpuCategory : public Category 88class CpuCategory : public Category