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) (unidiff)
tree136957b6dcef1e3b66e2a4a52a0bdb77bb0b09c7 /noncore
parente782feb7418fbf956547b9abb59afdde00745442 (diff)
downloadopie-e23774336087439cfed07899c8446eab674a3de8.zip
opie-e23774336087439cfed07899c8446eab674a3de8.tar.gz
opie-e23774336087439cfed07899c8446eab674a3de8.tar.bz2
more
Diffstat (limited to 'noncore') (more/less context) (show 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 @@
27#include <qvariant.h> 27#include <qvariant.h>
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>
32#include <device.h> 33#include <device.h>
@@ -36,14 +37,13 @@
36namespace OpieTooth { 37namespace 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 )
42 : QDialog( parent, name, modal, fl ) { 42 : QDialog( parent, name, modal, fl ) {
43 43
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
49 Frame7 = new QFrame( this, "Frame7" ); 49 Frame7 = new QFrame( this, "Frame7" );
@@ -51,6 +51,7 @@ namespace OpieTooth {
51 Frame7->setFrameShape( QFrame::StyledPanel ); 51 Frame7->setFrameShape( QFrame::StyledPanel );
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 ) );
56 Layout11 = new QGridLayout( privateLayoutWidget ); 57 Layout11 = new QGridLayout( privateLayoutWidget );
@@ -58,48 +59,71 @@ namespace OpieTooth {
58 Layout11->setMargin( 0 ); 59 Layout11->setMargin( 0 );
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" ) );
81 83
82 Layout11->addMultiCellWidget( ListView1, 0, 0, 0, 1 ); 84 Layout11->addMultiCellWidget( ListView1, 0, 0, 0, 1 );
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 }
105 129
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;
31class QListView; 31class QListView;
32class QListViewItem; 32class QListViewItem;
33class QPushButton; 33class QPushButton;
34 34class QProgressBar;
35class Manager;
36class Device;
37 35
38 36
39namespace OpieTooth { 37namespace OpieTooth {
40 38
41 39
40class Manager;
41class Device;
42 42
43 class ScanDialog : public QDialog { 43 class ScanDialog : public QDialog {
44 Q_OBJECT 44 Q_OBJECT
@@ -48,9 +48,9 @@ namespace OpieTooth {
48 ~ScanDialog(); 48 ~ScanDialog();
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
56 56
@@ -58,12 +58,14 @@ namespace OpieTooth {
58 QGridLayout* Layout11; 58 QGridLayout* Layout11;
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
69} 71}