summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (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
@@ -29,2 +29,3 @@
#include <qwhatsthis.h>
+#include <qprogressbar.h>
@@ -38,3 +39,2 @@ namespace OpieTooth {
/*
-
*/
@@ -45,3 +45,3 @@ namespace OpieTooth {
setName( "ScanDialog" );
- resize( 360, 392 );
+ resize( 240, 320 );
setCaption( tr( "Scan for devices" ) );
@@ -53,2 +53,3 @@ namespace OpieTooth {
+
QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" );
@@ -60,8 +61,9 @@ namespace OpieTooth {
- 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" ) );
@@ -70,6 +72,6 @@ namespace OpieTooth {
- 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 );
@@ -77,3 +79,3 @@ namespace OpieTooth {
- // ListView1->addColumn( tr( "In List" ) );
+ ListView1->addColumn( tr( "Add" ) );
ListView1->addColumn( tr( "Device Name" ) );
@@ -84,4 +86,16 @@ namespace OpieTooth {
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 ) );
+ }
+
}
@@ -89,7 +103,16 @@ namespace OpieTooth {
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() {
+
+ }
@@ -97,2 +120,3 @@ namespace OpieTooth {
+ QListViewItem * deviceItem;
@@ -101,3 +125,3 @@ namespace OpieTooth {
-
+ 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
@@ -33,5 +33,3 @@ class QListViewItem;
class QPushButton;
-
-class Manager;
-class Device;
+class QProgressBar;
@@ -41,2 +39,4 @@ namespace OpieTooth {
+class Manager;
+class Device;
@@ -50,5 +50,5 @@ namespace OpieTooth {
QFrame* Frame7;
- QLabel* TextLabel10;
+ QProgressBar* progress;
QPushButton* StartButton;
- QPushButton* PushButton6;
+ QPushButton* StopButton;
QListView* ListView1;
@@ -60,2 +60,3 @@ namespace OpieTooth {
private slots:
+ void stopSearch();
void startSearch();
@@ -64,4 +65,5 @@ namespace OpieTooth {
private:
-
+ void progressTimer(int maxSeconds);
Manager *localDevice;
+ int progressStat;
};