Diffstat (limited to 'noncore/net/opietooth/manager/scandialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 47 |
1 files changed, 9 insertions, 38 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 | |||
@@ -18,9 +18,7 @@ | |||
18 | 18 | ||
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> |
26 | #include <qlayout.h> | 24 | #include <qlayout.h> |
@@ -34,47 +32,28 @@ | |||
34 | #include <device.h> | 32 | #include <device.h> |
35 | 33 | ||
36 | 34 | ||
37 | |||
38 | namespace OpieTooth { | 35 | namespace 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" ) ); |
80 | ListView1->addColumn( tr( "Add Device" ) ); | 59 | ListView1->addColumn( tr( "Add Device" ) ); |
@@ -82,14 +61,14 @@ namespace OpieTooth { | |||
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" ); |
88 | 67 | ||
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; |
95 | } | 74 | } |
@@ -102,7 +81,6 @@ namespace OpieTooth { | |||
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 | ||
108 | void ScanDialog::accept() { | 86 | void ScanDialog::accept() { |
@@ -123,9 +101,6 @@ namespace OpieTooth { | |||
123 | // empty list before a new scan | 101 | // empty list before a new scan |
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. |
@@ -142,7 +117,6 @@ namespace OpieTooth { | |||
142 | void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) { | 117 | void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) { |
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 | ||
148 | RemoteDevice::ValueList::Iterator it; | 122 | RemoteDevice::ValueList::Iterator it; |
@@ -155,12 +129,11 @@ namespace OpieTooth { | |||
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) { |
166 | return; | 139 | return; |
@@ -175,16 +148,14 @@ namespace OpieTooth { | |||
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 | */ |
185 | ScanDialog::~ScanDialog() { | 157 | ScanDialog::~ScanDialog() { |
186 | qWarning("delete scan dialog"); | 158 | qWarning("delete scan dialog"); |
187 | delete localDevice; | 159 | delete localDevice; |
188 | } | 160 | } |
189 | |||
190 | } | 161 | } |