-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 68 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 3 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bticonloader.cpp | 77 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bticonloader.h | 37 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/hciconfwrapper.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/manager.pro | 4 |
6 files changed, 135 insertions, 56 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index d023302..2001db1 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -42,11 +42,10 @@ | |||
42 | #include <qpe/config.h> | 42 | #include <qpe/config.h> |
43 | 43 | ||
44 | #include <remotedevice.h> | 44 | #include <remotedevice.h> |
45 | 45 | #include <services.h> | |
46 | 46 | ||
47 | namespace OpieTooth { | 47 | namespace OpieTooth { |
48 | 48 | ||
49 | |||
50 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 49 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
51 | : BluetoothBase( parent, name, fl ) { | 50 | : BluetoothBase( parent, name, fl ) { |
52 | 51 | ||
@@ -59,7 +58,6 @@ namespace OpieTooth { | |||
59 | // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); | 58 | // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); |
60 | connect( ListView2, SIGNAL( clicked( QListViewItem* )), | 59 | connect( ListView2, SIGNAL( clicked( QListViewItem* )), |
61 | this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); | 60 | this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); |
62 | // hehe, cast right later | ||
63 | connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), | 61 | connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), |
64 | this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); | 62 | this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); |
65 | connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), | 63 | connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), |
@@ -70,7 +68,6 @@ namespace OpieTooth { | |||
70 | this, SLOT( addConnectedDevices( Connection::ValueList ) ) ); | 68 | this, SLOT( addConnectedDevices( Connection::ValueList ) ) ); |
71 | 69 | ||
72 | //Load all icons needed | 70 | //Load all icons needed |
73 | |||
74 | offPix = Resource::loadPixmap( "editdelete" ); | 71 | offPix = Resource::loadPixmap( "editdelete" ); |
75 | onPix = Resource::loadPixmap( "installed" ); | 72 | onPix = Resource::loadPixmap( "installed" ); |
76 | 73 | ||
@@ -94,11 +91,12 @@ namespace OpieTooth { | |||
94 | topLV2->setPixmap( 1, onPix ); | 91 | topLV2->setPixmap( 1, onPix ); |
95 | (void) new BTListItem( topLV2, "Serial" ,"", "service" ); | 92 | (void) new BTListItem( topLV2, "Serial" ,"", "service" ); |
96 | (void) new BTListItem( topLV2, "BlueNiC" , "", "service" ); | 93 | (void) new BTListItem( topLV2, "BlueNiC" , "", "service" ); |
94 | |||
97 | writeToHciConfig(); | 95 | writeToHciConfig(); |
98 | // search conncetions | 96 | // search conncetions |
99 | addConnectedDevices(); | 97 | addConnectedDevices(); |
100 | } | 98 | iconLoader = new BTIconLoader(); |
101 | 99 | } | |
102 | 100 | ||
103 | /** | 101 | /** |
104 | * Reads all options from the config file | 102 | * Reads all options from the config file |
@@ -108,14 +106,12 @@ namespace OpieTooth { | |||
108 | Config cfg( "bluetoothmanager" ); | 106 | Config cfg( "bluetoothmanager" ); |
109 | cfg.setGroup( "bluezsettings" ); | 107 | cfg.setGroup( "bluezsettings" ); |
110 | 108 | ||
111 | |||
112 | deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with | 109 | deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with |
113 | defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak | 110 | defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak |
114 | useEncryption = cfg.readNumEntry( "useEncryption" , 1 ); | 111 | useEncryption = cfg.readNumEntry( "useEncryption" , 1 ); |
115 | enableAuthentification = cfg.readNumEntry( "enableAuthentification" , 1 ); | 112 | enableAuthentification = cfg.readNumEntry( "enableAuthentification" , 1 ); |
116 | enablePagescan = cfg.readNumEntry( "enablePagescan" , 1 ); | 113 | enablePagescan = cfg.readNumEntry( "enablePagescan" , 1 ); |
117 | enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 ); | 114 | enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 ); |
118 | |||
119 | } | 115 | } |
120 | 116 | ||
121 | /** | 117 | /** |
@@ -123,7 +119,6 @@ namespace OpieTooth { | |||
123 | */ | 119 | */ |
124 | void BlueBase::writeConfig() { | 120 | void BlueBase::writeConfig() { |
125 | 121 | ||
126 | |||
127 | Config cfg( "bluetoothmanager" ); | 122 | Config cfg( "bluetoothmanager" ); |
128 | cfg.setGroup( "bluezsettings" ); | 123 | cfg.setGroup( "bluezsettings" ); |
129 | 124 | ||
@@ -210,16 +205,12 @@ namespace OpieTooth { | |||
210 | * | 205 | * |
211 | */ | 206 | */ |
212 | void BlueBase::writeSavedDevices() { | 207 | void BlueBase::writeSavedDevices() { |
213 | |||
214 | QListViewItemIterator it( ListView2 ); | 208 | QListViewItemIterator it( ListView2 ); |
215 | 209 | ||
216 | for ( ; it.current(); ++it ) { | 210 | for ( ; it.current(); ++it ) { |
217 | |||
218 | // seperate config file for each device, to store more information in future. | 211 | // seperate config file for each device, to store more information in future. |
219 | // TO FIX: BTLISTITEM!!! | ||
220 | qDebug( "/Settings/bluetooth/" + (((BTListItem*)it.current())->mac()) + ".conf"); | 212 | qDebug( "/Settings/bluetooth/" + (((BTListItem*)it.current())->mac()) + ".conf"); |
221 | Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (((BTListItem*)it.current())->mac()) + ".conf", Config::File ); | 213 | Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (((BTListItem*)it.current())->mac()) + ".conf", Config::File ); |
222 | |||
223 | conf.setGroup( "Info" ); | 214 | conf.setGroup( "Info" ); |
224 | conf.writeEntry( "name", ((BTListItem*)it.current())->name() ); | 215 | conf.writeEntry( "name", ((BTListItem*)it.current())->name() ); |
225 | } | 216 | } |
@@ -230,9 +221,7 @@ namespace OpieTooth { | |||
230 | * Set up the gui | 221 | * Set up the gui |
231 | */ | 222 | */ |
232 | void BlueBase::initGui() { | 223 | void BlueBase::initGui() { |
233 | |||
234 | StatusLabel->setText( getStatus() ); // maybe move it to getStatus() | 224 | StatusLabel->setText( getStatus() ); // maybe move it to getStatus() |
235 | |||
236 | cryptCheckBox->setChecked( useEncryption ); | 225 | cryptCheckBox->setChecked( useEncryption ); |
237 | authCheckBox->setChecked( enableAuthentification ); | 226 | authCheckBox->setChecked( enableAuthentification ); |
238 | pagescanCheckBox->setChecked( enablePagescan ); | 227 | pagescanCheckBox->setChecked( enablePagescan ); |
@@ -249,7 +238,6 @@ namespace OpieTooth { | |||
249 | * @return QString the status informations gathered | 238 | * @return QString the status informations gathered |
250 | */ | 239 | */ |
251 | QString BlueBase::getStatus(){ | 240 | QString BlueBase::getStatus(){ |
252 | |||
253 | QString infoString = tr( "<b>Device name : </b> Ipaq" ); | 241 | QString infoString = tr( "<b>Device name : </b> Ipaq" ); |
254 | infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); | 242 | infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); |
255 | infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); | 243 | infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); |
@@ -262,7 +250,6 @@ namespace OpieTooth { | |||
262 | * Read the current values from the gui and invoke writeConfig() | 250 | * Read the current values from the gui and invoke writeConfig() |
263 | */ | 251 | */ |
264 | void BlueBase::applyConfigChanges() { | 252 | void BlueBase::applyConfigChanges() { |
265 | |||
266 | deviceName = deviceNameLine->text(); | 253 | deviceName = deviceNameLine->text(); |
267 | defaultPasskey = passkeyLine->text(); | 254 | defaultPasskey = passkeyLine->text(); |
268 | useEncryption = cryptCheckBox->isChecked(); | 255 | useEncryption = cryptCheckBox->isChecked(); |
@@ -272,27 +259,21 @@ namespace OpieTooth { | |||
272 | 259 | ||
273 | writeConfig(); | 260 | writeConfig(); |
274 | 261 | ||
275 | |||
276 | QMessageBox* box = new QMessageBox( this, "Test" ); | 262 | QMessageBox* box = new QMessageBox( this, "Test" ); |
277 | box->setText( tr( "Changes applied" ) ); | 263 | box->setText( tr( "Changes applied" ) ); |
278 | box->show(); | 264 | box->show(); |
279 | // falls nötig hcid killhupen - die funktionalität adden | 265 | } |
280 | } | ||
281 | |||
282 | 266 | ||
283 | /** | 267 | /** |
284 | * Add fresh found devices from scan dialog to the listing | 268 | * Add fresh found devices from scan dialog to the listing |
285 | * | 269 | * |
286 | */ | 270 | */ |
287 | void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) { | 271 | void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) { |
288 | |||
289 | BTListItem * deviceItem; | 272 | BTListItem * deviceItem; |
290 | |||
291 | QListIterator<RemoteDevice> it( newDevices ); | 273 | QListIterator<RemoteDevice> it( newDevices ); |
292 | 274 | ||
293 | for( ; it.current() ; ++it ) { | 275 | for( ; it.current() ; ++it ) { |
294 | 276 | ||
295 | |||
296 | RemoteDevice *dev = it.current(); | 277 | RemoteDevice *dev = it.current(); |
297 | deviceItem = new BTListItem( ListView2 , dev->name(), dev->mac(), "device" ); | 278 | deviceItem = new BTListItem( ListView2 , dev->name(), dev->mac(), "device" ); |
298 | deviceItem->setExpandable ( true ); | 279 | deviceItem->setExpandable ( true ); |
@@ -310,8 +291,6 @@ namespace OpieTooth { | |||
310 | * Action that is toggled on entrys on click | 291 | * Action that is toggled on entrys on click |
311 | */ | 292 | */ |
312 | void BlueBase::startServiceActionClicked( QListViewItem *item ) { | 293 | void BlueBase::startServiceActionClicked( QListViewItem *item ) { |
313 | |||
314 | |||
315 | } | 294 | } |
316 | 295 | ||
317 | /** | 296 | /** |
@@ -320,20 +299,16 @@ namespace OpieTooth { | |||
320 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) { | 299 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) { |
321 | 300 | ||
322 | QPopupMenu *menu = new QPopupMenu(); | 301 | QPopupMenu *menu = new QPopupMenu(); |
323 | |||
324 | int ret=0; | 302 | int ret=0; |
325 | 303 | ||
326 | |||
327 | //QSize s = menu->sizeHint ( ); | ||
328 | |||
329 | if ( ((BTListItem*)item)->type() == "device") { | 304 | if ( ((BTListItem*)item)->type() == "device") { |
330 | 305 | ||
331 | QPopupMenu *groups = new QPopupMenu(); | 306 | QPopupMenu *groups = new QPopupMenu(); |
332 | 307 | ||
333 | menu->insertItem( tr("rescan sevices:"), 0); | 308 | menu->insertItem( tr("rescan sevices:"), 0); |
334 | menu->insertItem( tr("to group"), groups , 1); | 309 | menu->insertItem( tr("to group"), groups , 1); |
335 | menu->insertItem( tr("delete"), 2); | 310 | menu->insertItem( tr("bound device"), 2); |
336 | 311 | menu->insertItem( tr("delete"), 3); | |
337 | 312 | ||
338 | ret = menu->exec( point , 0); | 313 | ret = menu->exec( point , 0); |
339 | 314 | ||
@@ -343,6 +318,9 @@ namespace OpieTooth { | |||
343 | case 1: | 318 | case 1: |
344 | break; | 319 | break; |
345 | case 2: | 320 | case 2: |
321 | // make connection | ||
322 | break; | ||
323 | case 3: | ||
346 | // delete childs too | 324 | // delete childs too |
347 | delete item; | 325 | delete item; |
348 | break; | 326 | break; |
@@ -367,7 +345,6 @@ namespace OpieTooth { | |||
367 | break; | 345 | break; |
368 | } | 346 | } |
369 | } | 347 | } |
370 | |||
371 | delete menu; | 348 | delete menu; |
372 | } | 349 | } |
373 | 350 | ||
@@ -376,17 +353,13 @@ namespace OpieTooth { | |||
376 | * | 353 | * |
377 | */ | 354 | */ |
378 | void BlueBase::addServicesToDevice( BTListItem * item ) { | 355 | void BlueBase::addServicesToDevice( BTListItem * item ) { |
379 | |||
380 | qDebug("addServicesToDevice"); | 356 | qDebug("addServicesToDevice"); |
381 | // row of mac adress text(3) | 357 | // row of mac adress text(3) |
382 | RemoteDevice *device = new RemoteDevice( item->mac(), item->name() ); | 358 | RemoteDevice *device = new RemoteDevice( item->mac(), item->name() ); |
383 | |||
384 | deviceList.insert( item->mac() , item ); | 359 | deviceList.insert( item->mac() , item ); |
385 | |||
386 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back | 360 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back |
387 | localDevice->searchServices( *device ); | 361 | localDevice->searchServices( *device ); |
388 | 362 | delete device; | |
389 | // delete | ||
390 | } | 363 | } |
391 | 364 | ||
392 | 365 | ||
@@ -396,12 +369,10 @@ namespace OpieTooth { | |||
396 | * @param servicesList the list with the service the device has. | 369 | * @param servicesList the list with the service the device has. |
397 | */ | 370 | */ |
398 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { | 371 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { |
399 | |||
400 | qDebug("fill services list"); | 372 | qDebug("fill services list"); |
401 | 373 | ||
402 | QMap<QString,BTListItem*>::Iterator it; | 374 | QMap<QString,BTListItem*>::Iterator it; |
403 | 375 | BTListItem* deviceItem = 0; | |
404 | BTListItem* deviceItem; | ||
405 | 376 | ||
406 | // get the right devices which requested the search | 377 | // get the right devices which requested the search |
407 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { | 378 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { |
@@ -411,18 +382,16 @@ namespace OpieTooth { | |||
411 | } | 382 | } |
412 | 383 | ||
413 | QValueList<OpieTooth::Services>::Iterator it2; | 384 | QValueList<OpieTooth::Services>::Iterator it2; |
414 | |||
415 | BTListItem * serviceItem; | 385 | BTListItem * serviceItem; |
416 | 386 | ||
417 | if (!servicesList.isEmpty() ) { | 387 | if (!servicesList.isEmpty() ) { |
418 | // add services | 388 | // add services |
419 | for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { | 389 | for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { |
420 | serviceItem = new BTListItem( deviceItem , (*it2).serviceName() , "" , "service" ); | 390 | serviceItem = new BTListItem( deviceItem , (*it2).serviceName() , "" , "service" ); |
421 | //serviceItem->setText(4, "service"); | 391 | serviceItem->setPixmap( 0, iconLoader->serviceIcon( (*it2).classIdList() ) ); |
422 | } | 392 | } |
423 | } else { | 393 | } else { |
424 | serviceItem = new BTListItem( deviceItem , tr("no services found"), "" , "service" ); | 394 | serviceItem = new BTListItem( deviceItem , tr("no services found"), "" , "service" ); |
425 | //serviceItem->setText(4, "service"); | ||
426 | } | 395 | } |
427 | } | 396 | } |
428 | 397 | ||
@@ -437,7 +406,6 @@ namespace OpieTooth { | |||
437 | 406 | ||
438 | 407 | ||
439 | void BlueBase::addConnectedDevices( Connection::ValueList connectionList ) { | 408 | void BlueBase::addConnectedDevices( Connection::ValueList connectionList ) { |
440 | |||
441 | QValueList<OpieTooth::Connection>::Iterator it; | 409 | QValueList<OpieTooth::Connection>::Iterator it; |
442 | BTListItem * connectionItem; | 410 | BTListItem * connectionItem; |
443 | 411 | ||
@@ -458,7 +426,6 @@ namespace OpieTooth { | |||
458 | * Find out if a device can currently be reached | 426 | * Find out if a device can currently be reached |
459 | */ | 427 | */ |
460 | void BlueBase::deviceActive( RemoteDevice *device ) { | 428 | void BlueBase::deviceActive( RemoteDevice *device ) { |
461 | |||
462 | // search by mac, async, gets a signal back | 429 | // search by mac, async, gets a signal back |
463 | localDevice->isAvailable( device->mac() ); | 430 | localDevice->isAvailable( device->mac() ); |
464 | } | 431 | } |
@@ -469,12 +436,10 @@ namespace OpieTooth { | |||
469 | * @param connected - if it is avail. or not | 436 | * @param connected - if it is avail. or not |
470 | */ | 437 | */ |
471 | void BlueBase::deviceActive( const QString& device, bool connected ) { | 438 | void BlueBase::deviceActive( const QString& device, bool connected ) { |
472 | |||
473 | qDebug("deviceActive slot"); | 439 | qDebug("deviceActive slot"); |
474 | 440 | ||
475 | QMap<QString,BTListItem*>::Iterator it; | 441 | QMap<QString,BTListItem*>::Iterator it; |
476 | 442 | BTListItem* deviceItem = 0; | |
477 | BTListItem* deviceItem; | ||
478 | 443 | ||
479 | // get the right devices which requested the search | 444 | // get the right devices which requested the search |
480 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { | 445 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { |
@@ -488,16 +453,12 @@ namespace OpieTooth { | |||
488 | } else { | 453 | } else { |
489 | deviceItem->setPixmap( 1, offPix ); | 454 | deviceItem->setPixmap( 1, offPix ); |
490 | } | 455 | } |
491 | |||
492 | } | 456 | } |
493 | 457 | ||
494 | |||
495 | |||
496 | /** | 458 | /** |
497 | * Open the "scan for devices" dialog | 459 | * Open the "scan for devices" dialog |
498 | */ | 460 | */ |
499 | void BlueBase::startScan() { | 461 | void BlueBase::startScan() { |
500 | |||
501 | ScanDialog *scan = new ScanDialog( this, "", true); | 462 | ScanDialog *scan = new ScanDialog( this, "", true); |
502 | QObject::connect( scan, SIGNAL( selectedDevices( QList<RemoteDevice>& ) ), | 463 | QObject::connect( scan, SIGNAL( selectedDevices( QList<RemoteDevice>& ) ), |
503 | this, SLOT( addSearchedDevices( QList<RemoteDevice>& ) ) ); | 464 | this, SLOT( addSearchedDevices( QList<RemoteDevice>& ) ) ); |
@@ -518,6 +479,7 @@ namespace OpieTooth { | |||
518 | */ | 479 | */ |
519 | BlueBase::~BlueBase() { | 480 | BlueBase::~BlueBase() { |
520 | writeSavedDevices(); | 481 | writeSavedDevices(); |
482 | delete iconLoader; | ||
521 | } | 483 | } |
522 | } | 484 | } |
523 | 485 | ||
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 0516c16..ce0483f 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include "bluetoothbase.h" | 12 | #include "bluetoothbase.h" |
13 | #include "btlistitem.h" | 13 | #include "btlistitem.h" |
14 | #include "bticonloader.h" | ||
14 | 15 | ||
15 | #include <remotedevice.h> | 16 | #include <remotedevice.h> |
16 | #include <manager.h> | 17 | #include <manager.h> |
@@ -64,6 +65,8 @@ namespace OpieTooth { | |||
64 | QPixmap offPix; | 65 | QPixmap offPix; |
65 | QPixmap onPix; | 66 | QPixmap onPix; |
66 | 67 | ||
68 | BTIconLoader *iconLoader; | ||
69 | |||
67 | private slots: | 70 | private slots: |
68 | void addSearchedDevices( QList<RemoteDevice> &newDevices ); | 71 | void addSearchedDevices( QList<RemoteDevice> &newDevices ); |
69 | void addServicesToDevice( BTListItem *item ); | 72 | void addServicesToDevice( BTListItem *item ); |
diff --git a/noncore/net/opietooth/manager/bticonloader.cpp b/noncore/net/opietooth/manager/bticonloader.cpp new file mode 100644 index 0000000..3fb0edd --- a/dev/null +++ b/noncore/net/opietooth/manager/bticonloader.cpp | |||
@@ -0,0 +1,77 @@ | |||
1 | |||
2 | #include "bticonloader.h" | ||
3 | |||
4 | #include <qpixmap.h> | ||
5 | #include <qpe/resource.h> | ||
6 | |||
7 | namespace OpieTooth { | ||
8 | |||
9 | |||
10 | BTIconLoader::BTIconLoader() { | ||
11 | |||
12 | // still need to find out real ids | ||
13 | deviceIcons.insert( "100" , "computer_16" ); | ||
14 | deviceIcons.insert( "101" , "phone_16" ); | ||
15 | deviceIcons.insert( "102" , "brain_16" ); | ||
16 | deviceIcons.insert( "103" , "conduit_16" ); | ||
17 | |||
18 | |||
19 | serviceIcons.insert( "0x1105" , "obex_16" ); //OBEXObjectPush | ||
20 | serviceIcons.insert( "0x1106" , "obex_16" ); //OBEXFileTransfer | ||
21 | serviceIcons.insert( "0x1111" , "print_16" ); //Fax | ||
22 | serviceIcons.insert( "0x1101" , "serial_16" ); //SerialPort | ||
23 | serviceIcons.insert( "0x1104" , "sync_16" ); //IrMCSync | ||
24 | serviceIcons.insert( "0x1107" , "sync_16" ); //IrMCSyncCommand | ||
25 | serviceIcons.insert( "0x1102" , "network_16" ); //LANAccessUsingPPP | ||
26 | serviceIcons.insert( "0x1103" , "network_16"); //DialupNetworking | ||
27 | serviceIcons.insert( "0x1108" , "phone_16"); // Headset | ||
28 | serviceIcons.insert( "0x1112" , "audio_16"); //HeadsetAudioGateway | ||
29 | serviceIcons.insert( "0x1109" , "phone_16"); // CordlessTelephony | ||
30 | serviceIcons.insert( "0x110A" , "audio_16"); // AudioSource | ||
31 | serviceIcons.insert( "0x110B" , "audio_16"); // AudioSink | ||
32 | serviceIcons.insert( "0x1126" , "print_16" ); //HCR_Print | ||
33 | serviceIcons.insert( "0x1128" , "phone_16" ); //Common_ISDN_Access | ||
34 | |||
35 | serviceIcons.insert( "0x1201" , "network_16" ); //GenericNetworking | ||
36 | serviceIcons.insert( "0x1202" , "folder_16" ); //GenericFileTransfer | ||
37 | serviceIcons.insert( "0x1128" , "audio_16" ); //GenericAudio | ||
38 | serviceIcons.insert( "0x1128" , "phone_16" ); //GenericTelephony | ||
39 | |||
40 | //serviceIcons.insert( "106" , "link_16" ); | ||
41 | //serviceIcons.insert( "107" , "misc_16" ); | ||
42 | } | ||
43 | |||
44 | BTIconLoader::~BTIconLoader() { | ||
45 | } | ||
46 | |||
47 | QPixmap BTIconLoader::deviceIcon( const QString &deviceClass ) { | ||
48 | |||
49 | QString iconName; | ||
50 | |||
51 | QMap<QString, QString>::Iterator it; | ||
52 | |||
53 | it = deviceIcons.find( deviceClass ); | ||
54 | iconName = it.data(); | ||
55 | |||
56 | if ( iconName.isEmpty() ) { | ||
57 | iconName = "unknown_16"; | ||
58 | } | ||
59 | return( Resource::loadPixmap( "opietooth/icons/" + iconName ) ); | ||
60 | } | ||
61 | |||
62 | QPixmap BTIconLoader::serviceIcon( const QString &serviceClass ) { | ||
63 | |||
64 | QString iconName; | ||
65 | |||
66 | QMap<QString, QString>::Iterator it; | ||
67 | |||
68 | it = deviceIcons.find( serviceClass ); | ||
69 | iconName = it.data(); | ||
70 | |||
71 | if ( iconName.isEmpty() ) { | ||
72 | iconName = "unknown_16"; | ||
73 | } | ||
74 | return( Resource::loadPixmap( "opietooth/icons/" + iconName ) ); | ||
75 | } | ||
76 | |||
77 | } | ||
diff --git a/noncore/net/opietooth/manager/bticonloader.h b/noncore/net/opietooth/manager/bticonloader.h new file mode 100644 index 0000000..1b48009 --- a/dev/null +++ b/noncore/net/opietooth/manager/bticonloader.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef BTICONLOADER_H | ||
2 | #define BTICONLOADER_H | ||
3 | |||
4 | #include <qpixmap.h> | ||
5 | #include <qmap.h> | ||
6 | |||
7 | namespace OpieTooth { | ||
8 | |||
9 | class BTIconLoader { | ||
10 | |||
11 | public: | ||
12 | |||
13 | BTIconLoader(); | ||
14 | ~BTIconLoader(); | ||
15 | |||
16 | /** | ||
17 | * Returns an icon depending on device class | ||
18 | * @param deviceClass the device class id | ||
19 | * @return the pixmap | ||
20 | */ | ||
21 | QPixmap deviceIcon( const QString &deviceClass ); | ||
22 | |||
23 | /** | ||
24 | * Returns an icon depending on service id | ||
25 | * @param serviceClass the service id | ||
26 | * @return the pixmap | ||
27 | */ | ||
28 | QPixmap serviceIcon( const QString &serviceClass ); | ||
29 | |||
30 | private: | ||
31 | // first ist id, second is icon name | ||
32 | QMap<QString,QString> deviceIcons; | ||
33 | QMap<QString,QString> serviceIcons; | ||
34 | }; | ||
35 | } | ||
36 | |||
37 | #endif | ||
diff --git a/noncore/net/opietooth/manager/hciconfwrapper.cpp b/noncore/net/opietooth/manager/hciconfwrapper.cpp index 2d6d7da..0b90e87 100644 --- a/noncore/net/opietooth/manager/hciconfwrapper.cpp +++ b/noncore/net/opietooth/manager/hciconfwrapper.cpp | |||
@@ -1,4 +1,4 @@ | |||
1 | #include "hciconfwrapper.h" | 1 | #include "hciconfwrapper.h" |
2 | 2 | ||
3 | #include <qfile.h> | 3 | #include <qfile.h> |
4 | #include <qtextstream.h> | 4 | #include <qtextstream.h> |
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index 4fcf010..55f2fd2 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro | |||
@@ -1,8 +1,8 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on debug |
3 | #CONFIG = qt warn_on release | 3 | #CONFIG = qt warn_on release |
4 | HEADERS = bluebase.h scandialog.h btlistitem.h hciconfwrapper.h | 4 | HEADERS = bluebase.h scandialog.h btlistitem.h hciconfwrapper.h bticonloader.h |
5 | SOURCES = main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp | 5 | SOURCES = main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp bticonloader.cpp |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib | 7 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |