Diffstat (limited to 'noncore/settings/sysinfo/devicesinfo.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.cpp | 22 |
1 files changed, 20 insertions, 2 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 | |||
@@ -73,25 +73,37 @@ DevicesView::~DevicesView() | |||
73 | void DevicesView::selectionChanged( QListViewItem* item ) | 73 | void 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 | //================================================================================================= |
80 | DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) | 82 | DevicesInfo::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 | |||
90 | DevicesInfo::~DevicesInfo() | 93 | DevicesInfo::~DevicesInfo() |
91 | { | 94 | { |
92 | } | 95 | } |
93 | 96 | ||
94 | 97 | ||
98 | void DevicesInfo::setDetailsWidget( QWidget* w ) | ||
99 | { | ||
100 | if ( details ) delete( details ); | ||
101 | layout->addWidget( w ); | ||
102 | w->show(); | ||
103 | } | ||
104 | |||
105 | |||
106 | //================================================================================================= | ||
95 | Category::Category( DevicesView* parent, const QString& name ) | 107 | Category::Category( DevicesView* parent, const QString& name ) |
96 | :OListViewItem( parent, name ) | 108 | :OListViewItem( parent, name ) |
97 | { | 109 | { |
@@ -112,6 +124,12 @@ Device::~Device() | |||
112 | { | 124 | { |
113 | } | 125 | } |
114 | 126 | ||
127 | QWidget* Device::detailsWidget() | ||
128 | { | ||
129 | return new QPushButton( static_cast<QWidget*>( listView()->parent() ), "Press Button to self-destruct" ); | ||
130 | } | ||
131 | |||
132 | |||
115 | //================================================================================================= | 133 | //================================================================================================= |
116 | CpuCategory::CpuCategory( DevicesView* parent ) | 134 | CpuCategory::CpuCategory( DevicesView* parent ) |
117 | :Category( parent, "1. Central Processing Unit" ) | 135 | :Category( parent, "1. Central Processing Unit" ) |