summaryrefslogtreecommitdiff
path: root/noncore
authorharlekin <harlekin>2002-07-01 20:10:07 (UTC)
committer harlekin <harlekin>2002-07-01 20:10:07 (UTC)
commit3c6fd2159f4ff609408a2b5c645ee5a454d01325 (patch) (unidiff)
tree644ac4b759d2adaa3f233acf3e4913801a350625 /noncore
parentfcdf02d10c738c95748f082eaf40cb47db6d2975 (diff)
downloadopie-3c6fd2159f4ff609408a2b5c645ee5a454d01325.zip
opie-3c6fd2159f4ff609408a2b5c645ee5a454d01325.tar.gz
opie-3c6fd2159f4ff609408a2b5c645ee5a454d01325.tar.bz2
added ability to schon icons next to services
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp68
-rw-r--r--noncore/net/opietooth/manager/bluebase.h3
-rw-r--r--noncore/net/opietooth/manager/bticonloader.cpp77
-rw-r--r--noncore/net/opietooth/manager/bticonloader.h37
-rw-r--r--noncore/net/opietooth/manager/hciconfwrapper.cpp2
-rw-r--r--noncore/net/opietooth/manager/manager.pro4
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
@@ -44,3 +44,3 @@
44#include <remotedevice.h> 44#include <remotedevice.h>
45 45#include <services.h>
46 46
@@ -48,3 +48,2 @@ 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 )
@@ -61,3 +60,2 @@ namespace OpieTooth {
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 ) ),
@@ -72,3 +70,2 @@ namespace OpieTooth {
72 //Load all icons needed 70 //Load all icons needed
73
74 offPix = Resource::loadPixmap( "editdelete" ); 71 offPix = Resource::loadPixmap( "editdelete" );
@@ -96,2 +93,3 @@ namespace OpieTooth {
96 (void) new BTListItem( topLV2, "BlueNiC" , "", "service" ); 93 (void) new BTListItem( topLV2, "BlueNiC" , "", "service" );
94
97 writeToHciConfig(); 95 writeToHciConfig();
@@ -99,4 +97,4 @@ namespace OpieTooth {
99 addConnectedDevices(); 97 addConnectedDevices();
100 } 98 iconLoader = new BTIconLoader();
101 99 }
102 100
@@ -110,3 +108,2 @@ namespace OpieTooth {
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
@@ -117,3 +114,2 @@ namespace OpieTooth {
117 enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 ); 114 enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 );
118
119 } 115 }
@@ -125,3 +121,2 @@ namespace OpieTooth {
125 121
126
127 Config cfg( "bluetoothmanager" ); 122 Config cfg( "bluetoothmanager" );
@@ -212,3 +207,2 @@ namespace OpieTooth {
212 void BlueBase::writeSavedDevices() { 207 void BlueBase::writeSavedDevices() {
213
214 QListViewItemIterator it( ListView2 ); 208 QListViewItemIterator it( ListView2 );
@@ -216,8 +210,5 @@ namespace OpieTooth {
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" );
@@ -232,5 +223,3 @@ namespace OpieTooth {
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 );
@@ -251,3 +240,2 @@ namespace OpieTooth {
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" );
@@ -264,3 +252,2 @@ namespace OpieTooth {
264 void BlueBase::applyConfigChanges() { 252 void BlueBase::applyConfigChanges() {
265
266 deviceName = deviceNameLine->text(); 253 deviceName = deviceNameLine->text();
@@ -274,3 +261,2 @@ namespace OpieTooth {
274 261
275
276 QMessageBox* box = new QMessageBox( this, "Test" ); 262 QMessageBox* box = new QMessageBox( this, "Test" );
@@ -278,5 +264,3 @@ namespace OpieTooth {
278 box->show(); 264 box->show();
279 // falls nötig hcid killhupen - die funktionalität adden 265 }
280 }
281
282 266
@@ -287,5 +271,3 @@ namespace OpieTooth {
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 );
@@ -294,3 +276,2 @@ namespace OpieTooth {
294 276
295
296 RemoteDevice *dev = it.current(); 277 RemoteDevice *dev = it.current();
@@ -312,4 +293,2 @@ namespace OpieTooth {
312 void BlueBase::startServiceActionClicked( QListViewItem *item ) { 293 void BlueBase::startServiceActionClicked( QListViewItem *item ) {
313
314
315 } 294 }
@@ -322,8 +301,4 @@ namespace OpieTooth {
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") {
@@ -334,4 +309,4 @@ namespace OpieTooth {
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
@@ -345,2 +320,5 @@ namespace OpieTooth {
345 case 2: 320 case 2:
321 // make connection
322 break;
323 case 3:
346 // delete childs too 324 // delete childs too
@@ -369,3 +347,2 @@ namespace OpieTooth {
369 } 347 }
370
371 delete menu; 348 delete menu;
@@ -378,3 +355,2 @@ namespace OpieTooth {
378 void BlueBase::addServicesToDevice( BTListItem * item ) { 355 void BlueBase::addServicesToDevice( BTListItem * item ) {
379
380 qDebug("addServicesToDevice"); 356 qDebug("addServicesToDevice");
@@ -382,9 +358,6 @@ namespace OpieTooth {
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 }
@@ -398,3 +371,2 @@ namespace OpieTooth {
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");
@@ -402,4 +374,3 @@ namespace OpieTooth {
402 QMap<QString,BTListItem*>::Iterator it; 374 QMap<QString,BTListItem*>::Iterator it;
403 375 BTListItem* deviceItem = 0;
404 BTListItem* deviceItem;
405 376
@@ -413,3 +384,2 @@ namespace OpieTooth {
413 QValueList<OpieTooth::Services>::Iterator it2; 384 QValueList<OpieTooth::Services>::Iterator it2;
414
415 BTListItem * serviceItem; 385 BTListItem * serviceItem;
@@ -420,3 +390,3 @@ namespace OpieTooth {
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 }
@@ -424,3 +394,2 @@ namespace OpieTooth {
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 }
@@ -439,3 +408,2 @@ namespace OpieTooth {
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;
@@ -460,3 +428,2 @@ namespace OpieTooth {
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
@@ -471,3 +438,2 @@ namespace OpieTooth {
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");
@@ -475,4 +441,3 @@ namespace OpieTooth {
475 QMap<QString,BTListItem*>::Iterator it; 441 QMap<QString,BTListItem*>::Iterator it;
476 442 BTListItem* deviceItem = 0;
477 BTListItem* deviceItem;
478 443
@@ -490,7 +455,4 @@ namespace OpieTooth {
490 } 455 }
491
492 } 456 }
493 457
494
495
496 /** 458 /**
@@ -499,3 +461,2 @@ namespace OpieTooth {
499 void BlueBase::startScan() { 461 void BlueBase::startScan() {
500
501 ScanDialog *scan = new ScanDialog( this, "", true); 462 ScanDialog *scan = new ScanDialog( this, "", true);
@@ -520,2 +481,3 @@ namespace OpieTooth {
520 writeSavedDevices(); 481 writeSavedDevices();
482 delete iconLoader;
521 } 483 }
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
@@ -13,2 +13,3 @@
13#include "btlistitem.h" 13#include "btlistitem.h"
14#include "bticonloader.h"
14 15
@@ -66,2 +67,4 @@ namespace OpieTooth {
66 67
68 BTIconLoader *iconLoader;
69
67 private slots: 70 private slots:
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
7namespace 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
7namespace 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,2 +1,2 @@
1 #include "hciconfwrapper.h" 1#include "hciconfwrapper.h"
2 2
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
@@ -3,4 +3,4 @@ CONFIG = qt warn_on debug
3#CONFIG = qt warn_on release 3#CONFIG = qt warn_on release
4HEADERS = bluebase.h scandialog.h btlistitem.h hciconfwrapper.h 4HEADERS = bluebase.h scandialog.h btlistitem.h hciconfwrapper.h bticonloader.h
5SOURCES = main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp 5SOURCES = main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp bticonloader.cpp
6INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include