author | harlekin <harlekin> | 2002-06-15 21:29:57 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-15 21:29:57 (UTC) |
commit | e7712c9535a461c6f5f98e78b856af0bb9eca0c6 (patch) (side-by-side diff) | |
tree | 2cd21c2ad707dbf9461ccb2c5d1d13c63b6f7440 | |
parent | e31f557a84055ce00f814fd44427f9b3584243f9 (diff) | |
download | opie-e7712c9535a461c6f5f98e78b856af0bb9eca0c6.zip opie-e7712c9535a461c6f5f98e78b856af0bb9eca0c6.tar.gz opie-e7712c9535a461c6f5f98e78b856af0bb9eca0c6.tar.bz2 |
update
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index e81b2ee..b0ffbb3 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp @@ -1,141 +1,141 @@ /* main.cpp * * --------------------- * * copyright : (c) 2002 by Maximilian Reiß * email : max.reiss@gmx.de * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "scandialog.h" #include <qframe.h> #include <qheader.h> #include <qlabel.h> #include <qlistview.h> #include <qpushbutton.h> #include <qlayout.h> #include <qvariant.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qprogressbar.h> #include <manager.h> #include <device.h> #include <remotedevice.h> namespace OpieTooth { /* */ 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->setSpacing( 6 ); Layout11->setMargin( 0 ); progress = new QProgressBar(privateLayoutWidget, "progbar"); progress->setTotalSteps(20); - QFrame *buttonFrame = new QFrame(Frame7, ""); - + QFrame *buttonFrame = new QFrame(Frame7, ""); + StartButton = new QPushButton( buttonFrame, "StartButton" ); StartButton->setText( tr( "Start" ) ); StopButton = new QPushButton( buttonFrame, "StopButton" ); StopButton->setText( tr( "Cancel" ) ); - + QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame); buttonLayout->addWidget(StartButton); - buttonLayout->addWidget(StopButton); + buttonLayout->addWidget(StopButton); ListView1 = new QListView( privateLayoutWidget, "ListView1" ); ListView1->addColumn( tr( "Add" ) ); ListView1->addColumn( tr( "Device Name" ) ); //ListView1->addColumn( tr( "Type" ) ); Layout11->addWidget( ListView1); Layout11->addWidget(progress); Layout11->addWidget( buttonFrame); localDevice = new Manager( "hci0" ); connect( (QObject*)StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); connect( (QObject*)StopButton, SIGNAL( clicked() ), this, SLOT( stopSearch() ) ); connect( (QObject*)localDevice, SIGNAL( foundDevices( const QString& , RemoteDevices::ValueList ) ), this, SLOT(fillList(const QString& , RemoteDevices::ValueList ) ) ) ; progressStat = 0; } // hack, make cleaner later - void ScanDialog::progressTimer(int maxSeconds) { + void ScanDialog::progressTimer() { progressStat++; - if (progressStat++ < maxSeconds) { - QTimer::singleShot( 1000, this, SLOT(progressTimer ) ); + if (progressStat++ < 20) { + QTimer::singleShot( 1000, this, SLOT(progressTimer() ) ); } } void ScanDialog::startSearch() { progress->setProgress(0); progressStat = 0; - progressTimer(20); + progressTimer(); // when finished, it emmite foundDevices() // checken ob initialisiert , qcop ans applet. localDevice->searchDevices(); - progress->setProgress(20); + } void ScanDialog::stopSearch() { } void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) { QListViewItem * deviceItem; RemoteDevices::ValueList::Iterator it; for( it = deviceList.begin(); it != deviceList.end(); ++it ) { deviceItem = new QListViewItem( ListView1, (*it).name() ); } } /* * Cleanup */ ScanDialog::~ScanDialog() { delete localDevice; } } |