summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp69
-rw-r--r--noncore/net/opietooth/manager/scandialog.h13
2 files changed, 24 insertions, 58 deletions
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp
index 9ce1b6a..de4f742 100644
--- a/noncore/net/opietooth/manager/scandialog.cpp
+++ b/noncore/net/opietooth/manager/scandialog.cpp
@@ -19,7 +19,5 @@
19#include "scandialog.h" 19#include "scandialog.h"
20 20
21#include <qframe.h>
22#include <qheader.h> 21#include <qheader.h>
23#include <qlabel.h>
24#include <qlistview.h> 22#include <qlistview.h>
25#include <qpushbutton.h> 23#include <qpushbutton.h>
@@ -35,45 +33,26 @@
35 33
36 34
37
38namespace OpieTooth { 35namespace OpieTooth {
39 36
40#include <remotedevice.h> 37#include <remotedevice.h>
41 38
42/* 39/**
43 */ 40 */
44 ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 41 ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
45 : QDialog( parent, name, modal, fl ) { 42 : QDialog( parent, name, modal, fl ) {
46 43
47 if ( !name )
48 setName( "ScanDialog" );
49 resize( 240, 320 );
50 setCaption( tr( "Scan for devices" ) ); 44 setCaption( tr( "Scan for devices" ) );
51 45
52 Frame7 = new QFrame( this, "Frame7" ); 46 Layout11 = new QVBoxLayout( this );
53 Frame7->setGeometry( QRect( 0, 0, 240, 331 ) );
54 Frame7->setFrameShape( QFrame::StyledPanel );
55 Frame7->setFrameShadow( QFrame::Raised );
56
57 QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" );
58 privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 280 ) );
59 Layout11 = new QVBoxLayout( privateLayoutWidget );
60 Layout11->setSpacing( 6 ); 47 Layout11->setSpacing( 6 );
61 Layout11->setMargin( 0 ); 48 Layout11->setMargin( 0 );
62 49
63 progress = new QProgressBar(privateLayoutWidget, "progbar"); 50 progress = new QProgressBar( this, "progbar");
64 progress->setTotalSteps(20); 51 progress->setTotalSteps(20);
65 52
66 QFrame *buttonFrame = new QFrame(Frame7, ""); 53 StartStopButton = new QPushButton( this, "StartButton" );
67
68 StartStopButton = new QPushButton( buttonFrame, "StartButton" );
69 StartStopButton->setText( tr( "Start scan" ) ); 54 StartStopButton->setText( tr( "Start scan" ) );
70 55
71 56 ListView1 = new QListView( this, "ListView1" );
72 QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame);
73
74 buttonLayout->addWidget(StartStopButton);
75 //buttonLayout->addWidget(StopButton);
76
77 ListView1 = new QListView( privateLayoutWidget, "ListView1" );
78 57
79 //ListView1->addColumn( tr( "Add" ) ); 58 //ListView1->addColumn( tr( "Add" ) );
@@ -81,7 +60,7 @@ namespace OpieTooth {
81 //ListView1->addColumn( tr( "Type" ) ); 60 //ListView1->addColumn( tr( "Type" ) );
82 61
83 Layout11->addWidget( ListView1); 62 Layout11->addWidget( ListView1 );
84 Layout11->addWidget(progress); 63 Layout11->addWidget( progress );
85 Layout11->addWidget( buttonFrame); 64 Layout11->addWidget( StartStopButton );
86 65
87 localDevice = new Manager( "hci0" ); 66 localDevice = new Manager( "hci0" );
@@ -89,6 +68,6 @@ namespace OpieTooth {
89 connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); 68 connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) );
90 connect( localDevice, SIGNAL( foundDevices( const QString& , RemoteDevice::ValueList ) ), 69 connect( localDevice, SIGNAL( foundDevices( const QString& , RemoteDevice::ValueList ) ),
91 this, SLOT(fillList(const QString& , RemoteDevice::ValueList ) ) ) ; 70 this, SLOT( fillList( const QString& , RemoteDevice::ValueList ) ) ) ;
92 // connect( this, SIGNAL( accept() ), this, SLOT( emitToManager() )); 71
93 progressStat = 0; 72 progressStat = 0;
94 m_search = false; 73 m_search = false;
@@ -99,9 +78,8 @@ namespace OpieTooth {
99 78
100 progressStat++; 79 progressStat++;
101 if (progressStat++ < 20 && m_search ) { 80 if ( progressStat++ < 20 && m_search ) {
102 QTimer::singleShot( 2000, this, SLOT(progressTimer() ) ); 81 QTimer::singleShot( 2000, this, SLOT( progressTimer() ) );
103 progress->setProgress(progressStat++); 82 progress->setProgress( progressStat++ );
104 } 83 }
105
106 } 84 }
107 85
@@ -124,11 +102,8 @@ namespace OpieTooth {
124 ListView1->clear(); 102 ListView1->clear();
125 103
126 QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox );
127 deviceItem2->setText(1, "BLAH" );
128
129 progressTimer(); 104 progressTimer();
130 // when finished, it emmite foundDevices() 105 // when finished, it emmite foundDevices()
131 // checken ob initialisiert , qcop ans applet. 106 // checken ob initialisiert , qcop ans applet.
132 StartStopButton->setText( tr("Stop scan")); 107 StartStopButton->setText( tr( "Stop scan" ) );
133 108
134 localDevice->searchDevices(); 109 localDevice->searchDevices();
@@ -143,5 +118,4 @@ namespace OpieTooth {
143 progress->setProgress(0); 118 progress->setProgress(0);
144 progressStat = 0; 119 progressStat = 0;
145 qDebug("fill List");
146 QCheckListItem * deviceItem; 120 QCheckListItem * deviceItem;
147 121
@@ -150,16 +124,15 @@ namespace OpieTooth {
150 124
151 deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox ); 125 deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox );
152 deviceItem->setText(1, (*it).mac() ); 126 deviceItem->setText( 1, (*it).mac() );
153 } 127 }
154 m_search = false; 128 m_search = false;
155 StartStopButton->setText(tr ("Start scan") ); 129 StartStopButton->setText( tr( "Start scan" ) );
156 } 130 }
157 131
158/* 132/**
159 * Iterates trough the items, and collects the checked items. 133 * Iterates trough the items, and collects the checked items.
160 * Then it emits it, so the manager can connect to the signal to fill the listing. 134 * Then it emits it, so the manager can connect to the signal to fill the listing.
161 */ 135 */
162 void ScanDialog::emitToManager() { 136 void ScanDialog::emitToManager() {
163 qDebug("vor liste durchsuchen");
164 137
165 if (!ListView1) { 138 if (!ListView1) {
@@ -171,14 +144,13 @@ namespace OpieTooth {
171 QListViewItemIterator it( ListView1 ); 144 QListViewItemIterator it( ListView1 );
172 for ( ; it.current(); ++it ) { 145 for ( ; it.current(); ++it ) {
173 if ( ((QCheckListItem*)it.current())->isOn() ) { 146 if ( ( (QCheckListItem*)it.current() )->isOn() ) {
174 RemoteDevice device( it.current()->text(1), it.current()->text(0)); 147 RemoteDevice device( it.current()->text(1), it.current()->text(0) );
175 deviceList.append( device ); 148 deviceList.append( device );
176 } 149 }
177 } 150 }
178 qDebug("vor emit");
179 emit selectedDevices( deviceList ); 151 emit selectedDevices( deviceList );
180 } 152 }
181 153
182/* 154/**
183 * Cleanup 155 * Cleanup
184 */ 156 */
@@ -187,4 +159,3 @@ namespace OpieTooth {
187 delete localDevice; 159 delete localDevice;
188 } 160 }
189
190} 161}
diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h
index 8f8d39a..a644e96 100644
--- a/noncore/net/opietooth/manager/scandialog.h
+++ b/noncore/net/opietooth/manager/scandialog.h
@@ -24,7 +24,5 @@
24#include <remotedevice.h> 24#include <remotedevice.h>
25class QVBoxLayout; 25class QVBoxLayout;
26class QHBoxLayout;
27class QGridLayout; 26class QGridLayout;
28class QFrame;
29class QLabel; 27class QLabel;
30class QListView; 28class QListView;
@@ -36,5 +34,4 @@ class QProgressBar;
36namespace OpieTooth { 34namespace OpieTooth {
37 35
38
39class Manager; 36class Manager;
40class Device; 37class Device;
@@ -47,9 +44,7 @@ class Device;
47 ~ScanDialog(); 44 ~ScanDialog();
48 45
49 private: // make them private -zecke 46 private:
50 QFrame* Frame7; 47 QProgressBar* progress;
51 QProgressBar* progress;
52 QPushButton* StartStopButton; 48 QPushButton* StartStopButton;
53// QPushButton* StopButton;
54 QListView* ListView1; 49 QListView* ListView1;
55 50
@@ -64,5 +59,5 @@ class Device;
64 void startSearch(); 59 void startSearch();
65 void progressTimer(); 60 void progressTimer();
66 void fillList(const QString& device, RemoteDevice::ValueList list); 61 void fillList( const QString& device, RemoteDevice::ValueList list );
67 62
68 private: 63 private:
@@ -73,5 +68,5 @@ class Device;
73 68
74 signals: 69 signals:
75 void selectedDevices(const QValueList<RemoteDevice>&); 70 void selectedDevices( const QValueList<RemoteDevice>& );
76 }; 71 };
77 72