summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-06-19 00:18:46 (UTC)
committer harlekin <harlekin>2002-06-19 00:18:46 (UTC)
commit35ecb27ed64368d30d6360cbd5e30acf3a216a46 (patch) (unidiff)
tree814fd75d019af357c5c78f5166b0a0a0b218689c
parent14881bb4baf3ac470a135bdde6ffb115c91ea124 (diff)
downloadopie-35ecb27ed64368d30d6360cbd5e30acf3a216a46.zip
opie-35ecb27ed64368d30d6360cbd5e30acf3a216a46.tar.gz
opie-35ecb27ed64368d30d6360cbd5e30acf3a216a46.tar.bz2
update
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp21
-rw-r--r--noncore/net/opietooth/manager/scandialog.h4
2 files changed, 18 insertions, 7 deletions
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp
index f8f7b15..ec8df82 100644
--- a/noncore/net/opietooth/manager/scandialog.cpp
+++ b/noncore/net/opietooth/manager/scandialog.cpp
@@ -85,16 +85,17 @@ namespace OpieTooth {
85 Layout11->addWidget( ListView1); 85 Layout11->addWidget( ListView1);
86 Layout11->addWidget(progress); 86 Layout11->addWidget(progress);
87 Layout11->addWidget( buttonFrame); 87 Layout11->addWidget( buttonFrame);
88 88
89 localDevice = new Manager( "hci0" ); 89 localDevice = new Manager( "hci0" );
90 90
91 connect( (QObject*)StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); 91 connect( StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) );
92 connect( (QObject*)StopButton, SIGNAL( clicked() ), this, SLOT( stopSearch() ) ); 92 connect( StopButton, SIGNAL( clicked() ), this, SLOT( stopSearch() ) );
93 connect( (QObject*)localDevice, SIGNAL( foundDevices( const QString& , RemoteDevices::ValueList ) ), 93 connect( localDevice, SIGNAL( foundDevices( const QString& , RemoteDevice::ValueList ) ),
94 this, SLOT(fillList(const QString& , RemoteDevices::ValueList ) ) ) ; 94 this, SLOT(fillList(const QString& , RemoteDevice::ValueList ) ) ) ;
95 // connect( this, SIGNAL( accept() ), this, SLOT( emitToManager() ));
95 progressStat = 0; 96 progressStat = 0;
96 } 97 }
97 98
98// hack, make cleaner later 99// hack, make cleaner later
99 void ScanDialog::progressTimer() { 100 void ScanDialog::progressTimer() {
100 101
@@ -103,12 +104,18 @@ namespace OpieTooth {
103 QTimer::singleShot( 1000, this, SLOT(progressTimer() ) ); 104 QTimer::singleShot( 1000, this, SLOT(progressTimer() ) );
104 } 105 }
105 progress->setProgress(progressStat++); 106 progress->setProgress(progressStat++);
106 107
107 } 108 }
108 109
110 void ScanDialog::accept() {
111 emitToManager();
112 QDialog::accept();
113 }
114
115
109 void ScanDialog::startSearch() { 116 void ScanDialog::startSearch() {
110 progress->setProgress(0); 117 progress->setProgress(0);
111 progressStat = 0; 118 progressStat = 0;
112 119
113 QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox ); 120 QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox );
114 deviceItem2->setText(1, "BLAH" ); 121 deviceItem2->setText(1, "BLAH" );
@@ -123,27 +130,29 @@ namespace OpieTooth {
123 void ScanDialog::stopSearch() { 130 void ScanDialog::stopSearch() {
124 131
125 } 132 }
126 133
127 void ScanDialog::fillList(const QString& device, RemoteDevice::ValueList deviceList) { 134 void ScanDialog::fillList(const QString& device, RemoteDevice::ValueList deviceList) {
128 135
136 qDebug("fill List");
129 QCheckListItem * deviceItem; 137 QCheckListItem * deviceItem;
130 138
131 RemoteDevice::ValueList::Iterator it; 139 RemoteDevice::ValueList::Iterator it;
132 for( it = deviceList.begin(); it != deviceList.end(); ++it ) { 140 for( it = deviceList.begin(); it != deviceList.end(); ++it ) {
133 141
134 deviceItem = new QCheckListItem( ListView1, (*it).name() ); 142 deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox );
135 deviceItem->setText(1, (*it).mac() ); 143 deviceItem->setText(1, (*it).mac() );
136 } 144 }
137 } 145 }
138 146
139/* 147/*
140 * Iterates trough the items, and collects the checked items. 148 * Iterates trough the items, and collects the checked items.
141 * Then it emits it, so the manager can connect to the signal to fill the listing. 149 * Then it emits it, so the manager can connect to the signal to fill the listing.
142 */ 150 */
143 void ScanDialog::emitToManager() { 151 void ScanDialog::emitToManager() {
152 qDebug("vor liste durchsuchen");
144 153
145 if (!ListView1) { 154 if (!ListView1) {
146 return; 155 return;
147 } 156 }
148 157
149 QList<RemoteDevice> *deviceList = new QList<RemoteDevice>; 158 QList<RemoteDevice> *deviceList = new QList<RemoteDevice>;
@@ -153,19 +162,19 @@ namespace OpieTooth {
153 for ( ; it.current(); ++it ) { 162 for ( ; it.current(); ++it ) {
154 if ( ((QCheckListItem*)it.current())->isOn() ) { 163 if ( ((QCheckListItem*)it.current())->isOn() ) {
155 RemoteDevice * device = new RemoteDevice( it.current()->text(1), it.current()->text(0)); 164 RemoteDevice * device = new RemoteDevice( it.current()->text(1), it.current()->text(0));
156 deviceList->append( device ); 165 deviceList->append( device );
157 } 166 }
158 } 167 }
168 qDebug("vor emit");
159 emit selectedDevices( *deviceList ); 169 emit selectedDevices( *deviceList );
160 delete deviceList; 170 delete deviceList;
161 } 171 }
162 172
163/* 173/*
164 * Cleanup 174 * Cleanup
165 */ 175 */
166 ScanDialog::~ScanDialog() { 176 ScanDialog::~ScanDialog() {
167 emitToManager();
168 delete localDevice; 177 delete localDevice;
169 } 178 }
170 179
171} 180}
diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h
index adc960c..7c84ce2 100644
--- a/noncore/net/opietooth/manager/scandialog.h
+++ b/noncore/net/opietooth/manager/scandialog.h
@@ -49,20 +49,22 @@ class Device;
49 QFrame* Frame7; 49 QFrame* Frame7;
50 QProgressBar* progress; 50 QProgressBar* progress;
51 QPushButton* StartButton; 51 QPushButton* StartButton;
52 QPushButton* StopButton; 52 QPushButton* StopButton;
53 QListView* ListView1; 53 QListView* ListView1;
54 54
55public slots:
56 void accept();
55 57
56 protected: 58 protected:
57 QVBoxLayout* Layout11; 59 QVBoxLayout* Layout11;
58 60
59 private slots: 61 private slots:
60 void stopSearch(); 62 void stopSearch();
61 void startSearch(); 63 void startSearch();
62 void progressTimer(); 64 void progressTimer();
63 void fillList(const QString& device, RemoteDevice::ValueList list); 65 void fillList(const QString& device, RemoteDevice::ValueList list);
64 66
65 private: 67 private:
66 void emitToManager(); 68 void emitToManager();
67 Manager *localDevice; 69 Manager *localDevice;
68 int progressStat; 70 int progressStat;