author | mickeyl <mickeyl> | 2003-04-13 01:03:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-13 01:03:40 (UTC) |
commit | 64d6b3e723b9b2fc3b1f3eea6da6344c5f26ce1e (patch) (unidiff) | |
tree | 86ab7afb2d22626c4f8a68e6353bd318770480f7 | |
parent | 0a2d3731e93a4738a4a3e4b2fce8d011a43b0966 (diff) | |
download | opie-64d6b3e723b9b2fc3b1f3eea6da6344c5f26ce1e.zip opie-64d6b3e723b9b2fc3b1f3eea6da6344c5f26ce1e.tar.gz opie-64d6b3e723b9b2fc3b1f3eea6da6344c5f26ce1e.tar.bz2 |
adjust for new icon size
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 1ef24d2..a8cadd8 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -105,213 +105,213 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
105 | 105 | ||
106 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", | 106 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", |
107 | (const char*) type, | 107 | (const char*) type, |
108 | (const char*) essid, | 108 | (const char*) essid, |
109 | (const char*) macaddr, | 109 | (const char*) macaddr, |
110 | channel ); | 110 | channel ); |
111 | 111 | ||
112 | // search, if we already have seen this net | 112 | // search, if we already have seen this net |
113 | 113 | ||
114 | QString s; | 114 | QString s; |
115 | MScanListItem* network; | 115 | MScanListItem* network; |
116 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); | 116 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); |
117 | 117 | ||
118 | while ( item && ( item->text( 0 ) != essid ) ) | 118 | while ( item && ( item->text( 0 ) != essid ) ) |
119 | { | 119 | { |
120 | qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); | 120 | qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); |
121 | item = static_cast<MScanListItem*> ( item->itemBelow() ); | 121 | item = static_cast<MScanListItem*> ( item->itemBelow() ); |
122 | } | 122 | } |
123 | if ( item ) | 123 | if ( item ) |
124 | { | 124 | { |
125 | // animate the item | 125 | // animate the item |
126 | 126 | ||
127 | /* | 127 | /* |
128 | 128 | ||
129 | const QPixmap* pixmap = item->pixmap( 0 ); | 129 | const QPixmap* pixmap = item->pixmap( 0 ); |
130 | const QPixmap* nextpixmap = ani2; | 130 | const QPixmap* nextpixmap = ani2; |
131 | if ( pixmap == ani1 ) | 131 | if ( pixmap == ani1 ) |
132 | nextpixmap = ani2; | 132 | nextpixmap = ani2; |
133 | else if ( pixmap == ani2 ) | 133 | else if ( pixmap == ani2 ) |
134 | nextpixmap = ani3; | 134 | nextpixmap = ani3; |
135 | else if ( pixmap == ani3 ) | 135 | else if ( pixmap == ani3 ) |
136 | nextpixmap = ani4; | 136 | nextpixmap = ani4; |
137 | else if ( pixmap == ani4 ) | 137 | else if ( pixmap == ani4 ) |
138 | nextpixmap = ani1; | 138 | nextpixmap = ani1; |
139 | item->setPixmap( 0, *nextpixmap ); */ | 139 | item->setPixmap( 0, *nextpixmap ); */ |
140 | 140 | ||
141 | //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap ); | 141 | //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap ); |
142 | 142 | ||
143 | // we have already seen this net, check all childs if MAC exists | 143 | // we have already seen this net, check all childs if MAC exists |
144 | 144 | ||
145 | network = item; | 145 | network = item; |
146 | 146 | ||
147 | item = static_cast<MScanListItem*> ( item->firstChild() ); | 147 | item = static_cast<MScanListItem*> ( item->firstChild() ); |
148 | assert( item ); // this shouldn't fail | 148 | assert( item ); // this shouldn't fail |
149 | 149 | ||
150 | while ( item && ( item->text( 2 ) != macaddr ) ) | 150 | while ( item && ( item->text( 2 ) != macaddr ) ) |
151 | { | 151 | { |
152 | qDebug( "subitemtext: %s", (const char*) item->text( 2 ) ); | 152 | qDebug( "subitemtext: %s", (const char*) item->text( 2 ) ); |
153 | item = static_cast<MScanListItem*> ( item->itemBelow() ); | 153 | item = static_cast<MScanListItem*> ( item->itemBelow() ); |
154 | } | 154 | } |
155 | 155 | ||
156 | if ( item ) | 156 | if ( item ) |
157 | { | 157 | { |
158 | // we have already seen this item, it's a dupe | 158 | // we have already seen this item, it's a dupe |
159 | #ifdef DEBUG | 159 | #ifdef DEBUG |
160 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); | 160 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); |
161 | #endif | 161 | #endif |
162 | item->receivedBeacon(); | 162 | item->receivedBeacon(); |
163 | return; | 163 | return; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | else | 166 | else |
167 | { | 167 | { |
168 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); | 168 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); |
169 | network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 ); | 169 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); |
170 | } | 170 | } |
171 | 171 | ||
172 | 172 | ||
173 | // insert new station as child from network | 173 | // insert new station as child from network |
174 | 174 | ||
175 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 175 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
176 | 176 | ||
177 | qDebug( "inserting new station %s", (const char*) macaddr ); | 177 | qDebug( "inserting new station %s", (const char*) macaddr ); |
178 | 178 | ||
179 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 179 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
180 | if ( _manufacturerdb ) | 180 | if ( _manufacturerdb ) |
181 | station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); | 181 | station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); |
182 | 182 | ||
183 | if ( type == "managed" ) | 183 | if ( type == "managed" ) |
184 | { | 184 | { |
185 | s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); | 185 | s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); |
186 | } | 186 | } |
187 | else | 187 | else |
188 | { | 188 | { |
189 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); | 189 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); |
190 | } | 190 | } |
191 | 191 | ||
192 | } | 192 | } |
193 | 193 | ||
194 | void MScanListView::traffic( QString type, QString from, QString to, QString via, QString additional ) | 194 | void MScanListView::traffic( QString type, QString from, QString to, QString via, QString additional ) |
195 | { | 195 | { |
196 | if ( type != "toDS" ) return; | 196 | if ( type != "toDS" ) return; |
197 | 197 | ||
198 | qDebug( "MScanList::traffic( [%s] | %s -> %s (via %s)", | 198 | qDebug( "MScanList::traffic( [%s] | %s -> %s (via %s)", |
199 | (const char*) type, (const char*) from, | 199 | (const char*) type, (const char*) from, |
200 | (const char*) to, (const char*) via ); | 200 | (const char*) to, (const char*) via ); |
201 | 201 | ||
202 | QString s; | 202 | QString s; |
203 | MScanListItem* network; | 203 | MScanListItem* network; |
204 | 204 | ||
205 | QListViewItemIterator it( this ); | 205 | QListViewItemIterator it( this ); |
206 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; | 206 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; |
207 | 207 | ||
208 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 208 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
209 | 209 | ||
210 | if ( item ) // AP has been shown up, so just add our new "from" - station | 210 | if ( item ) // AP has been shown up, so just add our new "from" - station |
211 | { | 211 | { |
212 | network = static_cast<MScanListItem*>( item->parent() ); | 212 | network = static_cast<MScanListItem*>( item->parent() ); |
213 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 213 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
214 | 214 | ||
215 | while ( subitem && ( subitem->text( col_ap ) != from ) ) | 215 | while ( subitem && ( subitem->text( col_ap ) != from ) ) |
216 | { | 216 | { |
217 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | 217 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); |
218 | subitem = static_cast<MScanListItem*> ( subitem->itemBelow() ); | 218 | subitem = static_cast<MScanListItem*> ( subitem->itemBelow() ); |
219 | } | 219 | } |
220 | 220 | ||
221 | if ( subitem ) | 221 | if ( subitem ) |
222 | { | 222 | { |
223 | // we have already seen this item, it's a dupe | 223 | // we have already seen this item, it's a dupe |
224 | #ifdef DEBUG | 224 | #ifdef DEBUG |
225 | qDebug( "%s is a dupe - ignoring...", (const char*) from ); | 225 | qDebug( "%s is a dupe - ignoring...", (const char*) from ); |
226 | #endif | 226 | #endif |
227 | subitem->receivedBeacon(); //FIXME: sent data bit | 227 | subitem->receivedBeacon(); //FIXME: sent data bit |
228 | return; | 228 | return; |
229 | } | 229 | } |
230 | 230 | ||
231 | // Hey, it seems to be a new item :-D | 231 | // Hey, it seems to be a new item :-D |
232 | MScanListItem* station = new MScanListItem( item->parent(), "adhoc", /* network->text( col_essid ) */ "", from, false, -1, -1 ); | 232 | MScanListItem* station = new MScanListItem( item->parent(), "adhoc", /* network->text( col_essid ) */ "", from, false, -1, -1 ); |
233 | if ( _manufacturerdb ) | 233 | if ( _manufacturerdb ) |
234 | station->setManufacturer( _manufacturerdb->lookup( from ) ); | 234 | station->setManufacturer( _manufacturerdb->lookup( from ) ); |
235 | } | 235 | } |
236 | else | 236 | else |
237 | { | 237 | { |
238 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in alpha-4 version :-D" ); | 238 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in alpha-4 version :-D" ); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | //============================================================ | 242 | //============================================================ |
243 | // MScanListItem | 243 | // MScanListItem |
244 | //============================================================ | 244 | //============================================================ |
245 | 245 | ||
246 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 246 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, |
247 | bool wep, int channel, int signal ) | 247 | bool wep, int channel, int signal ) |
248 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 248 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
249 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 249 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
250 | _channel( channel ), _signal( signal ), _beacons( 1 ) | 250 | _channel( channel ), _signal( signal ), _beacons( 1 ) |
251 | { | 251 | { |
252 | qDebug( "creating scanlist item" ); | 252 | qDebug( "creating scanlist item" ); |
253 | if ( WellenreiterConfigWindow::instance() && type == "networks" ) | 253 | if ( WellenreiterConfigWindow::instance() && type == "network" ) |
254 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); | 254 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); |
255 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 255 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
256 | } | 256 | } |
257 | 257 | ||
258 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | 258 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, |
259 | bool wep, int channel, int signal ) | 259 | bool wep, int channel, int signal ) |
260 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | 260 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) |
261 | { | 261 | { |
262 | qDebug( "creating scanlist item" ); | 262 | qDebug( "creating scanlist item" ); |
263 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 263 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
264 | } | 264 | } |
265 | 265 | ||
266 | OListViewItem* MScanListItem::childFactory() | 266 | OListViewItem* MScanListItem::childFactory() |
267 | { | 267 | { |
268 | return new MScanListItem( this ); | 268 | return new MScanListItem( this ); |
269 | } | 269 | } |
270 | 270 | ||
271 | void MScanListItem::serializeTo( QDataStream& s ) const | 271 | void MScanListItem::serializeTo( QDataStream& s ) const |
272 | { | 272 | { |
273 | qDebug( "serializing MScanListItem" ); | 273 | qDebug( "serializing MScanListItem" ); |
274 | OListViewItem::serializeTo( s ); | 274 | OListViewItem::serializeTo( s ); |
275 | 275 | ||
276 | s << _type; | 276 | s << _type; |
277 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); | 277 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); |
278 | } | 278 | } |
279 | 279 | ||
280 | void MScanListItem::serializeFrom( QDataStream& s ) | 280 | void MScanListItem::serializeFrom( QDataStream& s ) |
281 | { | 281 | { |
282 | qDebug( "serializing MScanListItem" ); | 282 | qDebug( "serializing MScanListItem" ); |
283 | OListViewItem::serializeFrom( s ); | 283 | OListViewItem::serializeFrom( s ); |
284 | 284 | ||
285 | char wep; | 285 | char wep; |
286 | s >> _type; | 286 | s >> _type; |
287 | s >> (Q_UINT8) wep; | 287 | s >> (Q_UINT8) wep; |
288 | _wep = (wep == 'y'); | 288 | _wep = (wep == 'y'); |
289 | 289 | ||
290 | QString name; | 290 | QString name; |
291 | name.sprintf( "wellenreiter/%s", (const char*) _type ); | 291 | name.sprintf( "wellenreiter/%s", (const char*) _type ); |
292 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 292 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
293 | if ( _wep ) | 293 | if ( _wep ) |
294 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 294 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
295 | listView()->triggerUpdate(); | 295 | listView()->triggerUpdate(); |
296 | } | 296 | } |
297 | 297 | ||
298 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | 298 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) |
299 | { | 299 | { |
300 | qDebug( "decorating scanlist item %s / %s / %s [%d]", | 300 | qDebug( "decorating scanlist item %s / %s / %s [%d]", |
301 | (const char*) type, | 301 | (const char*) type, |
302 | (const char*) essid, | 302 | (const char*) essid, |
303 | (const char*) macaddr, | 303 | (const char*) macaddr, |
304 | channel ); | 304 | channel ); |
305 | 305 | ||
306 | // set icon for managed or adhoc mode | 306 | // set icon for managed or adhoc mode |
307 | QString name; | 307 | QString name; |
308 | name.sprintf( "wellenreiter/%s", (const char*) type ); | 308 | name.sprintf( "wellenreiter/%s", (const char*) type ); |
309 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 309 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
310 | 310 | ||
311 | // set icon for wep (wireless encryption protocol) | 311 | // set icon for wep (wireless encryption protocol) |
312 | if ( wep ) | 312 | if ( wep ) |
313 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 313 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
314 | 314 | ||
315 | // set channel and signal text | 315 | // set channel and signal text |
316 | 316 | ||
317 | if ( signal != -1 ) | 317 | if ( signal != -1 ) |