summaryrefslogtreecommitdiff
path: root/noncore/net
Unidiff
Diffstat (limited to 'noncore/net') (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
@@ -28,4 +28,5 @@
28#include <qtooltip.h> 28#include <qtooltip.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30#include <qprogressbar.h>
30 31
31#include <manager.h> 32#include <manager.h>
@@ -37,5 +38,4 @@ namespace OpieTooth {
37 38
38/* 39/*
39
40 */ 40 */
41 ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 41 ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
@@ -44,5 +44,5 @@ namespace OpieTooth {
44 if ( !name ) 44 if ( !name )
45 setName( "ScanDialog" ); 45 setName( "ScanDialog" );
46 resize( 360, 392 ); 46 resize( 240, 320 );
47 setCaption( tr( "Scan for devices" ) ); 47 setCaption( tr( "Scan for devices" ) );
48 48
@@ -52,4 +52,5 @@ namespace OpieTooth {
52 Frame7->setFrameShadow( QFrame::Raised ); 52 Frame7->setFrameShadow( QFrame::Raised );
53 53
54
54 QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" ); 55 QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" );
55 privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 310 ) ); 56 privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 310 ) );
@@ -59,22 +60,23 @@ namespace OpieTooth {
59 60
60 61
61 TextLabel10 = new QLabel( privateLayoutWidget, "TextLabel10" ); 62 progress = new QProgressBar(privateLayoutWidget, "progbar");
62 TextLabel10->setText( tr( "ersetzen durch qprogressbar" ) ); 63 progress->setTotalSteps(20);
63 64
64 Layout11->addMultiCellWidget( TextLabel10, 1, 1, 0, 1 ); 65 //Layout11->addMultiCellWidget( progress, 1, 1, 0, 1 );
66 Layout11->addWidget(progress, 2, 2);
65 67
66 StartButton = new QPushButton( privateLayoutWidget, "PushButton13" ); 68 StartButton = new QPushButton( privateLayoutWidget, "StartButton" );
67 StartButton->setText( tr( "Start" ) ); 69 StartButton->setText( tr( "Start" ) );
68 70
69 Layout11->addWidget( StartButton, 2, 0 ); 71 Layout11->addWidget( StartButton, 2, 0 );
70 72
71 PushButton6 = new QPushButton( privateLayoutWidget, "PushButton6" ); 73 StopButton = new QPushButton( privateLayoutWidget, "StopButton" );
72 PushButton6->setText( tr( "Stop" ) ); 74 StopButton->setText( tr( "Cancel" ) );
73 75
74 Layout11->addWidget( PushButton6, 2, 1 ); 76 Layout11->addWidget( StopButton, 2, 1 );
75 77
76 ListView1 = new QListView( privateLayoutWidget, "ListView1" ); 78 ListView1 = new QListView( privateLayoutWidget, "ListView1" );
77 79
78 // ListView1->addColumn( tr( "In List" ) ); 80 ListView1->addColumn( tr( "Add" ) );
79 ListView1->addColumn( tr( "Device Name" ) ); 81 ListView1->addColumn( tr( "Device Name" ) );
80 //ListView1->addColumn( tr( "Type" ) ); 82 //ListView1->addColumn( tr( "Type" ) );
@@ -83,22 +85,44 @@ namespace OpieTooth {
83 85
84 connect( (QObject*)StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); 86 connect( (QObject*)StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) );
87 connect( (QObject*)StopButton, SIGNAL( clicked() ), this, SLOT( stopSearch() ) );
85 connect( (QObject*)localDevice, SIGNAL( foundDevices( const QString& , RemoteDevices::ValueList ) ), 88 connect( (QObject*)localDevice, SIGNAL( foundDevices( const QString& , RemoteDevices::ValueList ) ),
86 this, SLOT(fillList(const QString& , RemoteDevices::ValueList ) ) ) ; 89 this, SLOT(fillList(const QString& , RemoteDevices::ValueList ) ) ) ;
90 progressStat = 0;
91 }
92
93// hack, make cleaner later
94 void ScanDialog::progressTimer(int maxSeconds) {
95
96 progressStat++;
97 if (progressStat++ < maxSeconds) {
98 QTimer::singleShot( 1000, this, SLOT(progressTimer ) );
99 }
100
87 } 101 }
88 102
89 void ScanDialog::startSearch() { 103 void ScanDialog::startSearch() {
104 progress->setProgress(0);
105 progressStat = 0;
90 // read it from config later 106 // read it from config later
91 localDevice = new Manager( "hci0" ); 107 localDevice = new Manager( "hci0" );
108 progressTimer(20);
109 // when finished, it emmite foundDevices()
110 // checken ob initialisiert , qcop ans applet.
92 localDevice->searchDevices(); 111 localDevice->searchDevices();
112 progress->setProgress(20);
93 } 113 }
94 114
115 void ScanDialog::stopSearch() {
116
117 }
95 118
96 void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) { 119 void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) {
97 120
121 QListViewItem * deviceItem;
98 122
99 RemoteDevices::ValueList::Iterator it; 123 RemoteDevices::ValueList::Iterator it;
100 for( it = deviceList.begin(); it != deviceList.end(); ++it ) { 124 for( it = deviceList.begin(); it != deviceList.end(); ++it ) {
101 125
102 126 deviceItem = new QListViewItem( ListView1, (*it).name() );
103 } 127 }
104 } 128 }
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
@@ -32,7 +32,5 @@ class QListView;
32class QListViewItem; 32class QListViewItem;
33class QPushButton; 33class QPushButton;
34 34class QProgressBar;
35class Manager;
36class Device;
37 35
38 36
@@ -40,4 +38,6 @@ namespace OpieTooth {
40 38
41 39
40class Manager;
41class Device;
42 42
43 class ScanDialog : public QDialog { 43 class ScanDialog : public QDialog {
@@ -49,7 +49,7 @@ namespace OpieTooth {
49 49
50 QFrame* Frame7; 50 QFrame* Frame7;
51 QLabel* TextLabel10; 51 QProgressBar* progress;
52 QPushButton* StartButton; 52 QPushButton* StartButton;
53 QPushButton* PushButton6; 53 QPushButton* StopButton;
54 QListView* ListView1; 54 QListView* ListView1;
55 55
@@ -59,10 +59,12 @@ namespace OpieTooth {
59 59
60 private slots: 60 private slots:
61 void stopSearch();
61 void startSearch(); 62 void startSearch();
62 void fillList(const QString& device, RemoteDevices::ValueList list); 63 void fillList(const QString& device, RemoteDevices::ValueList list);
63 64
64 private: 65 private:
65 66 void progressTimer(int maxSeconds);
66 Manager *localDevice; 67 Manager *localDevice;
68 int progressStat;
67 }; 69 };
68 70