author | mickeyl <mickeyl> | 2005-05-04 15:31:32 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-04 15:31:32 (UTC) |
commit | bdc113a8b37e3fa2f65903d043798d33d2f9f907 (patch) (side-by-side diff) | |
tree | 7af09b3bc1ceb52414aab972f1b4c4e16afe3441 | |
parent | 1f412e211a7d5759d2ca51aa4e14c6292984f124 (diff) | |
download | opie-bdc113a8b37e3fa2f65903d043798d33d2f9f907.zip opie-bdc113a8b37e3fa2f65903d043798d33d2f9f907.tar.gz opie-bdc113a8b37e3fa2f65903d043798d33d2f9f907.tar.bz2 |
start with details window
-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.cpp | 22 | ||||
-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.h | 8 |
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 @@ -74,4 +74,6 @@ void DevicesView::selectionChanged( QListViewItem* item ) { odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; + QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget(); + ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details ); } @@ -79,7 +81,7 @@ void DevicesView::selectionChanged( QListViewItem* item ) //================================================================================================= 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 ); @@ -88,4 +90,5 @@ DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) } + DevicesInfo::~DevicesInfo() { @@ -93,4 +96,13 @@ 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 ) @@ -113,4 +125,10 @@ Device::~Device() } +QWidget* Device::detailsWidget() +{ + return new QPushButton( static_cast<QWidget*>( listView()->parent() ), "Press Button to self-destruct" ); +} + + //================================================================================================= CpuCategory::CpuCategory( DevicesView* parent ) 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 @@ -32,4 +32,5 @@ _;:, .> :=|. This program is free software; you can /* OPIE */ #include <opie2/olistview.h> +#include <opie2/olayout.h> /* QT */ @@ -55,7 +56,10 @@ public: ~DevicesInfo(); + void setDetailsWidget( QWidget* w = 0 ); + private: + Opie::Ui::OAutoBoxLayout* layout; Opie::Ui::OListView* view; - + QWidget* details; private slots: }; @@ -77,4 +81,6 @@ public: Device( Category* parent, const QString& name ); ~Device(); + + QWidget* detailsWidget(); }; |