From bdc113a8b37e3fa2f65903d043798d33d2f9f907 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Wed, 04 May 2005 15:31:32 +0000 Subject: start with details window --- (limited to 'noncore/settings') 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() void DevicesView::selectionChanged( QListViewItem* item ) { odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; + QWidget* details = ( static_cast( item ) )->detailsWidget(); + ( static_cast( parent() ) )->setDetailsWidget( details ); } //================================================================================================= DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) - :QWidget( parent, name, fl ) + :QWidget( parent, name, fl ), details( 0 ) { - OAutoBoxLayout *layout = new OAutoBoxLayout( this ); + layout = new OAutoBoxLayout( this ); layout->setSpacing( 4 ); layout->setMargin( 4 ); view = new DevicesView( this ); layout->addWidget( view ); } + DevicesInfo::~DevicesInfo() { } +void DevicesInfo::setDetailsWidget( QWidget* w ) +{ + if ( details ) delete( details ); + layout->addWidget( w ); + w->show(); +} + + +//================================================================================================= Category::Category( DevicesView* parent, const QString& name ) :OListViewItem( parent, name ) { @@ -112,6 +124,12 @@ Device::~Device() { } +QWidget* Device::detailsWidget() +{ + return new QPushButton( static_cast( listView()->parent() ), "Press Button to self-destruct" ); +} + + //================================================================================================= CpuCategory::CpuCategory( DevicesView* parent ) :Category( parent, "1. Central Processing Unit" ) 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 @@ -31,6 +31,7 @@ _;:,     .>    :=|. This program is free software; you can /* OPIE */ #include +#include /* QT */ #include @@ -54,9 +55,12 @@ public: DevicesInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); ~DevicesInfo(); + void setDetailsWidget( QWidget* w = 0 ); + private: + Opie::Ui::OAutoBoxLayout* layout; Opie::Ui::OListView* view; - + QWidget* details; private slots: }; @@ -76,6 +80,8 @@ class Device : public Opie::Ui::OListViewItem public: Device( Category* parent, const QString& name ); ~Device(); + + QWidget* detailsWidget(); }; //================================================================================================= -- cgit v0.9.0.2