-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 69 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.h | 13 |
2 files changed, 24 insertions, 58 deletions
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index 9ce1b6a..de4f742 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp @@ -19,7 +19,5 @@ #include "scandialog.h" -#include <qframe.h> #include <qheader.h> -#include <qlabel.h> #include <qlistview.h> #include <qpushbutton.h> @@ -35,45 +33,26 @@ - namespace OpieTooth { #include <remotedevice.h> -/* +/** */ ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { - if ( !name ) - setName( "ScanDialog" ); - resize( 240, 320 ); setCaption( tr( "Scan for devices" ) ); - Frame7 = new QFrame( this, "Frame7" ); - Frame7->setGeometry( QRect( 0, 0, 240, 331 ) ); - Frame7->setFrameShape( QFrame::StyledPanel ); - Frame7->setFrameShadow( QFrame::Raised ); - - QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" ); - privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 280 ) ); - Layout11 = new QVBoxLayout( privateLayoutWidget ); + Layout11 = new QVBoxLayout( this ); Layout11->setSpacing( 6 ); Layout11->setMargin( 0 ); - progress = new QProgressBar(privateLayoutWidget, "progbar"); + progress = new QProgressBar( this, "progbar"); progress->setTotalSteps(20); - QFrame *buttonFrame = new QFrame(Frame7, ""); - - StartStopButton = new QPushButton( buttonFrame, "StartButton" ); + StartStopButton = new QPushButton( this, "StartButton" ); StartStopButton->setText( tr( "Start scan" ) ); - - QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame); - - buttonLayout->addWidget(StartStopButton); -// buttonLayout->addWidget(StopButton); - - ListView1 = new QListView( privateLayoutWidget, "ListView1" ); + ListView1 = new QListView( this, "ListView1" ); //ListView1->addColumn( tr( "Add" ) ); @@ -81,7 +60,7 @@ namespace OpieTooth { //ListView1->addColumn( tr( "Type" ) ); - Layout11->addWidget( ListView1); - Layout11->addWidget(progress); - Layout11->addWidget( buttonFrame); + Layout11->addWidget( ListView1 ); + Layout11->addWidget( progress ); + Layout11->addWidget( StartStopButton ); localDevice = new Manager( "hci0" ); @@ -89,6 +68,6 @@ namespace OpieTooth { connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); connect( localDevice, SIGNAL( foundDevices( const QString& , RemoteDevice::ValueList ) ), - this, SLOT(fillList(const QString& , RemoteDevice::ValueList ) ) ) ; - // connect( this, SIGNAL( accept() ), this, SLOT( emitToManager() )); + this, SLOT( fillList( const QString& , RemoteDevice::ValueList ) ) ) ; + progressStat = 0; m_search = false; @@ -99,9 +78,8 @@ namespace OpieTooth { progressStat++; - if (progressStat++ < 20 && m_search ) { - QTimer::singleShot( 2000, this, SLOT(progressTimer() ) ); - progress->setProgress(progressStat++); + if ( progressStat++ < 20 && m_search ) { + QTimer::singleShot( 2000, this, SLOT( progressTimer() ) ); + progress->setProgress( progressStat++ ); } - } @@ -124,11 +102,8 @@ namespace OpieTooth { ListView1->clear(); - QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox ); - deviceItem2->setText(1, "BLAH" ); - progressTimer(); // when finished, it emmite foundDevices() // checken ob initialisiert , qcop ans applet. - StartStopButton->setText( tr("Stop scan")); + StartStopButton->setText( tr( "Stop scan" ) ); localDevice->searchDevices(); @@ -143,5 +118,4 @@ namespace OpieTooth { progress->setProgress(0); progressStat = 0; - qDebug("fill List"); QCheckListItem * deviceItem; @@ -150,16 +124,15 @@ namespace OpieTooth { deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox ); - deviceItem->setText(1, (*it).mac() ); + deviceItem->setText( 1, (*it).mac() ); } m_search = false; - StartStopButton->setText(tr ("Start scan") ); + StartStopButton->setText( tr( "Start scan" ) ); } -/* +/** * Iterates trough the items, and collects the checked items. * Then it emits it, so the manager can connect to the signal to fill the listing. */ void ScanDialog::emitToManager() { - qDebug("vor liste durchsuchen"); if (!ListView1) { @@ -171,14 +144,13 @@ namespace OpieTooth { QListViewItemIterator it( ListView1 ); for ( ; it.current(); ++it ) { - if ( ((QCheckListItem*)it.current())->isOn() ) { - RemoteDevice device( it.current()->text(1), it.current()->text(0)); + if ( ( (QCheckListItem*)it.current() )->isOn() ) { + RemoteDevice device( it.current()->text(1), it.current()->text(0) ); deviceList.append( device ); } } - qDebug("vor emit"); emit selectedDevices( deviceList ); } -/* +/** * Cleanup */ @@ -187,4 +159,3 @@ namespace OpieTooth { delete localDevice; } - } diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h index 8f8d39a..a644e96 100644 --- a/noncore/net/opietooth/manager/scandialog.h +++ b/noncore/net/opietooth/manager/scandialog.h @@ -24,7 +24,5 @@ #include <remotedevice.h> class QVBoxLayout; -class QHBoxLayout; class QGridLayout; -class QFrame; class QLabel; class QListView; @@ -36,5 +34,4 @@ class QProgressBar; namespace OpieTooth { - class Manager; class Device; @@ -47,9 +44,7 @@ class Device; ~ScanDialog(); - private: // make them private -zecke - QFrame* Frame7; - QProgressBar* progress; + private: + QProgressBar* progress; QPushButton* StartStopButton; -// QPushButton* StopButton; QListView* ListView1; @@ -64,5 +59,5 @@ class Device; void startSearch(); void progressTimer(); - void fillList(const QString& device, RemoteDevice::ValueList list); + void fillList( const QString& device, RemoteDevice::ValueList list ); private: @@ -73,5 +68,5 @@ class Device; signals: - void selectedDevices(const QValueList<RemoteDevice>&); + void selectedDevices( const QValueList<RemoteDevice>& ); }; |