summaryrefslogtreecommitdiff
path: root/noncore
authorharlekin <harlekin>2002-06-15 20:41:08 (UTC)
committer harlekin <harlekin>2002-06-15 20:41:08 (UTC)
commite23774336087439cfed07899c8446eab674a3de8 (patch) (side-by-side diff)
tree136957b6dcef1e3b66e2a4a52a0bdb77bb0b09c7 /noncore
parente782feb7418fbf956547b9abb59afdde00745442 (diff)
downloadopie-e23774336087439cfed07899c8446eab674a3de8.zip
opie-e23774336087439cfed07899c8446eab674a3de8.tar.gz
opie-e23774336087439cfed07899c8446eab674a3de8.tar.bz2
more
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp46
-rw-r--r--noncore/net/opietooth/manager/scandialog.h14
2 files changed, 43 insertions, 17 deletions
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp
index 3ddba3e..842466a 100644
--- a/noncore/net/opietooth/manager/scandialog.cpp
+++ b/noncore/net/opietooth/manager/scandialog.cpp
@@ -27,6 +27,7 @@
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
+#include <qprogressbar.h>
#include <manager.h>
#include <device.h>
@@ -36,14 +37,13 @@
namespace OpieTooth {
/*
-
*/
ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl ) {
if ( !name )
setName( "ScanDialog" );
- resize( 360, 392 );
+ resize( 240, 320 );
setCaption( tr( "Scan for devices" ) );
Frame7 = new QFrame( this, "Frame7" );
@@ -51,6 +51,7 @@ namespace OpieTooth {
Frame7->setFrameShape( QFrame::StyledPanel );
Frame7->setFrameShadow( QFrame::Raised );
+
QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" );
privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 310 ) );
Layout11 = new QGridLayout( privateLayoutWidget );
@@ -58,48 +59,71 @@ namespace OpieTooth {
Layout11->setMargin( 0 );
- TextLabel10 = new QLabel( privateLayoutWidget, "TextLabel10" );
- TextLabel10->setText( tr( "ersetzen durch qprogressbar" ) );
+ progress = new QProgressBar(privateLayoutWidget, "progbar");
+ progress->setTotalSteps(20);
- Layout11->addMultiCellWidget( TextLabel10, 1, 1, 0, 1 );
+ //Layout11->addMultiCellWidget( progress, 1, 1, 0, 1 );
+ Layout11->addWidget(progress, 2, 2);
- StartButton = new QPushButton( privateLayoutWidget, "PushButton13" );
+ StartButton = new QPushButton( privateLayoutWidget, "StartButton" );
StartButton->setText( tr( "Start" ) );
Layout11->addWidget( StartButton, 2, 0 );
- PushButton6 = new QPushButton( privateLayoutWidget, "PushButton6" );
- PushButton6->setText( tr( "Stop" ) );
+ StopButton = new QPushButton( privateLayoutWidget, "StopButton" );
+ StopButton->setText( tr( "Cancel" ) );
- Layout11->addWidget( PushButton6, 2, 1 );
+ Layout11->addWidget( StopButton, 2, 1 );
ListView1 = new QListView( privateLayoutWidget, "ListView1" );
- // ListView1->addColumn( tr( "In List" ) );
+ ListView1->addColumn( tr( "Add" ) );
ListView1->addColumn( tr( "Device Name" ) );
//ListView1->addColumn( tr( "Type" ) );
Layout11->addMultiCellWidget( ListView1, 0, 0, 0, 1 );
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) {
+
+ progressStat++;
+ if (progressStat++ < maxSeconds) {
+ QTimer::singleShot( 1000, this, SLOT(progressTimer ) );
+ }
+
}
void ScanDialog::startSearch() {
+ progress->setProgress(0);
+ progressStat = 0;
// read it from config later
localDevice = new Manager( "hci0" );
+ progressTimer(20);
+ // 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() );
}
}
diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h
index 5cebb11..6d9b877 100644
--- a/noncore/net/opietooth/manager/scandialog.h
+++ b/noncore/net/opietooth/manager/scandialog.h
@@ -31,14 +31,14 @@ class QLabel;
class QListView;
class QListViewItem;
class QPushButton;
-
-class Manager;
-class Device;
+class QProgressBar;
namespace OpieTooth {
+class Manager;
+class Device;
class ScanDialog : public QDialog {
Q_OBJECT
@@ -48,9 +48,9 @@ namespace OpieTooth {
~ScanDialog();
QFrame* Frame7;
- QLabel* TextLabel10;
+ QProgressBar* progress;
QPushButton* StartButton;
- QPushButton* PushButton6;
+ QPushButton* StopButton;
QListView* ListView1;
@@ -58,12 +58,14 @@ namespace OpieTooth {
QGridLayout* Layout11;
private slots:
+ void stopSearch();
void startSearch();
void fillList(const QString& device, RemoteDevices::ValueList list);
private:
-
+ void progressTimer(int maxSeconds);
Manager *localDevice;
+ int progressStat;
};
}