-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 36 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 5 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluetoothbase.ui | 14 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/btconnectionitem.cpp | 18 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/btconnectionitem.h | 8 |
5 files changed, 78 insertions, 3 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 8b15c4f..9663b52 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -69,12 +69,14 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | |||
69 | connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), | 69 | connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), |
70 | this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); | 70 | this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); |
71 | connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), | 71 | connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), |
72 | this, SLOT( deviceActive( const QString& , bool ) ) ); | 72 | this, SLOT( deviceActive( const QString& , bool ) ) ); |
73 | connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), | 73 | connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), |
74 | this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); | 74 | this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); |
75 | connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ), | ||
76 | this, SLOT( addSignalStrength( const QString&, const QString& ) ) ); | ||
75 | 77 | ||
76 | 78 | ||
77 | // let hold be rightButtonClicked() | 79 | // let hold be rightButtonClicked() |
78 | QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); | 80 | QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); |
79 | QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); | 81 | QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); |
80 | 82 | ||
@@ -95,15 +97,17 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | |||
95 | 97 | ||
96 | readConfig(); | 98 | readConfig(); |
97 | initGui(); | 99 | initGui(); |
98 | 100 | ||
99 | ListView2->setRootIsDecorated(true); | 101 | ListView2->setRootIsDecorated(true); |
100 | 102 | ||
103 | |||
101 | writeToHciConfig(); | 104 | writeToHciConfig(); |
102 | // search conncetions | 105 | // search conncetions |
103 | addConnectedDevices(); | 106 | addConnectedDevices(); |
107 | addSignalStrength(); | ||
104 | m_iconLoader = new BTIconLoader(); | 108 | m_iconLoader = new BTIconLoader(); |
105 | readSavedDevices(); | 109 | readSavedDevices(); |
106 | } | 110 | } |
107 | 111 | ||
108 | /** | 112 | /** |
109 | * Reads all options from the config file | 113 | * Reads all options from the config file |
@@ -367,13 +371,14 @@ void BlueBase::addServicesToDevice( BTDeviceItem * item ) { | |||
367 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back | 371 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back |
368 | m_localDevice->searchServices( device ); | 372 | m_localDevice->searchServices( device ); |
369 | } | 373 | } |
370 | 374 | ||
371 | 375 | ||
372 | /** | 376 | /** |
373 | * Overloaded. This one it the one that is connected to the foundServices signal | 377 | * Overloaded. This one it the one that is |
378 | ted to the foundServices signal | ||
374 | * @param device the mac address of the remote device | 379 | * @param device the mac address of the remote device |
375 | * @param servicesList the list with the service the device has. | 380 | * @param servicesList the list with the service the device has. |
376 | */ | 381 | */ |
377 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { | 382 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { |
378 | qDebug("fill services list"); | 383 | qDebug("fill services list"); |
379 | 384 | ||
@@ -422,21 +427,43 @@ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList s | |||
422 | } | 427 | } |
423 | // now remove them from the list | 428 | // now remove them from the list |
424 | m_deviceList.remove( it ); | 429 | m_deviceList.remove( it ); |
425 | } | 430 | } |
426 | 431 | ||
427 | 432 | ||
433 | |||
434 | |||
435 | |||
436 | void BlueBase::addSignalStrength() { | ||
437 | |||
438 | QListViewItemIterator it( ListView4 ); | ||
439 | for ( ; it.current(); ++it ) { | ||
440 | m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() ); | ||
441 | } | ||
442 | |||
443 | QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) ); | ||
444 | } | ||
445 | |||
446 | void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) { | ||
447 | |||
448 | QListViewItemIterator it( ListView4 ); | ||
449 | for ( ; it.current(); ++it ) { | ||
450 | if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) { | ||
451 | ((BTConnectionItem*)it.current() )->setSignalStrength( strength ); | ||
452 | } | ||
453 | } | ||
454 | } | ||
455 | |||
428 | /** | 456 | /** |
429 | * Add the existing connections (pairs) to the connections tab. | 457 | * Add the existing connections (pairs) to the connections tab. |
430 | * This one triggers the search | 458 | * This one triggers the search |
431 | */ | 459 | */ |
432 | void BlueBase::addConnectedDevices() { | 460 | void BlueBase::addConnectedDevices() { |
433 | m_localDevice->searchConnections(); | 461 | m_localDevice->searchConnections(); |
434 | } | 462 | } |
435 | 463 | ||
436 | |||
437 | /** | 464 | /** |
438 | * This adds the found connections to the connection tab. | 465 | * This adds the found connections to the connection tab. |
439 | * @param connectionList the ValueList with all current connections | 466 | * @param connectionList the ValueList with all current connections |
440 | */ | 467 | */ |
441 | void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { | 468 | void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { |
442 | 469 | ||
@@ -447,12 +474,17 @@ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) | |||
447 | BTConnectionItem * connectionItem; | 474 | BTConnectionItem * connectionItem; |
448 | 475 | ||
449 | if ( !connectionList.isEmpty() ) { | 476 | if ( !connectionList.isEmpty() ) { |
450 | 477 | ||
451 | for (it = connectionList.begin(); it != connectionList.end(); ++it) { | 478 | for (it = connectionList.begin(); it != connectionList.end(); ++it) { |
452 | connectionItem = new BTConnectionItem( ListView4 , (*it) ); | 479 | connectionItem = new BTConnectionItem( ListView4 , (*it) ); |
480 | |||
481 | if( m_deviceList.find((*it).mac()).data() ) { | ||
482 | |||
483 | connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); | ||
484 | } | ||
453 | } | 485 | } |
454 | } else { | 486 | } else { |
455 | ConnectionState con; | 487 | ConnectionState con; |
456 | con.setMac( tr("No connections found") ); | 488 | con.setMac( tr("No connections found") ); |
457 | connectionItem = new BTConnectionItem( ListView4 , con ); | 489 | connectionItem = new BTConnectionItem( ListView4 , con ); |
458 | } | 490 | } |
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 0326daf..743062c 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h | |||
@@ -10,12 +10,13 @@ | |||
10 | #include <qpixmap.h> | 10 | #include <qpixmap.h> |
11 | 11 | ||
12 | #include "bluetoothbase.h" | 12 | #include "bluetoothbase.h" |
13 | 13 | ||
14 | #include "btserviceitem.h" | 14 | #include "btserviceitem.h" |
15 | #include "btdeviceitem.h" | 15 | #include "btdeviceitem.h" |
16 | |||
16 | #include "popuphelper.h" | 17 | #include "popuphelper.h" |
17 | 18 | ||
18 | #include "bticonloader.h" | 19 | #include "bticonloader.h" |
19 | 20 | ||
20 | #include <remotedevice.h> | 21 | #include <remotedevice.h> |
21 | #include <manager.h> | 22 | #include <manager.h> |
@@ -25,12 +26,13 @@ class QHBoxLayout; | |||
25 | class QGridLayout; | 26 | class QGridLayout; |
26 | class QFrame; | 27 | class QFrame; |
27 | class QLabel; | 28 | class QLabel; |
28 | class QPushButton; | 29 | class QPushButton; |
29 | class QTabWidget; | 30 | class QTabWidget; |
30 | class QCheckBox; | 31 | class QCheckBox; |
32 | class BTConnectionItem; | ||
31 | 33 | ||
32 | 34 | ||
33 | namespace OpieTooth { | 35 | namespace OpieTooth { |
34 | 36 | ||
35 | class BlueBase : public BluetoothBase { | 37 | class BlueBase : public BluetoothBase { |
36 | Q_OBJECT | 38 | Q_OBJECT |
@@ -52,12 +54,13 @@ namespace OpieTooth { | |||
52 | void readSavedDevices(); | 54 | void readSavedDevices(); |
53 | void writeSavedDevices(); | 55 | void writeSavedDevices(); |
54 | void writeToHciConfig(); | 56 | void writeToHciConfig(); |
55 | QString status()const; | 57 | QString status()const; |
56 | void initGui(); | 58 | void initGui(); |
57 | void setInfo(); | 59 | void setInfo(); |
60 | |||
58 | PopupHelper m_popHelper; | 61 | PopupHelper m_popHelper; |
59 | Manager *m_localDevice; | 62 | Manager *m_localDevice; |
60 | QMap<QString,BTDeviceItem*> m_deviceList; | 63 | QMap<QString,BTDeviceItem*> m_deviceList; |
61 | 64 | ||
62 | void deviceActive( const RemoteDevice &device ); | 65 | void deviceActive( const RemoteDevice &device ); |
63 | 66 | ||
@@ -81,12 +84,14 @@ namespace OpieTooth { | |||
81 | void addConnectedDevices(); | 84 | void addConnectedDevices(); |
82 | void addConnectedDevices( ConnectionState::ValueList ); | 85 | void addConnectedDevices( ConnectionState::ValueList ); |
83 | void startServiceActionClicked( QListViewItem *item ); | 86 | void startServiceActionClicked( QListViewItem *item ); |
84 | void startServiceActionHold( QListViewItem *, const QPoint &, int ); | 87 | void startServiceActionHold( QListViewItem *, const QPoint &, int ); |
85 | void deviceActive( const QString& mac, bool connected ); | 88 | void deviceActive( const QString& mac, bool connected ); |
86 | void applyConfigChanges(); | 89 | void applyConfigChanges(); |
90 | void addSignalStrength(); | ||
91 | void addSignalStrength( const QString& mac, const QString& strengh ); | ||
87 | 92 | ||
88 | }; | 93 | }; |
89 | 94 | ||
90 | } | 95 | } |
91 | 96 | ||
92 | #endif | 97 | #endif |
diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui index 869a9cb..b51c8c6 100644 --- a/noncore/net/opietooth/manager/bluetoothbase.ui +++ b/noncore/net/opietooth/manager/bluetoothbase.ui | |||
@@ -195,12 +195,26 @@ | |||
195 | </property> | 195 | </property> |
196 | <property> | 196 | <property> |
197 | <name>resizeable</name> | 197 | <name>resizeable</name> |
198 | <bool>true</bool> | 198 | <bool>true</bool> |
199 | </property> | 199 | </property> |
200 | </column> | 200 | </column> |
201 | <column> | ||
202 | <property> | ||
203 | <name>text</name> | ||
204 | <string>Signal</string> | ||
205 | </property> | ||
206 | <property> | ||
207 | <name>clickable</name> | ||
208 | <bool>true</bool> | ||
209 | </property> | ||
210 | <property> | ||
211 | <name>resizeable</name> | ||
212 | <bool>true</bool> | ||
213 | </property> | ||
214 | </column> | ||
201 | <property stdset="1"> | 215 | <property stdset="1"> |
202 | <name>name</name> | 216 | <name>name</name> |
203 | <cstring>ListView4</cstring> | 217 | <cstring>ListView4</cstring> |
204 | </property> | 218 | </property> |
205 | <property stdset="1"> | 219 | <property stdset="1"> |
206 | <name>geometry</name> | 220 | <name>geometry</name> |
diff --git a/noncore/net/opietooth/manager/btconnectionitem.cpp b/noncore/net/opietooth/manager/btconnectionitem.cpp index b57d1b3..c565c47 100644 --- a/noncore/net/opietooth/manager/btconnectionitem.cpp +++ b/noncore/net/opietooth/manager/btconnectionitem.cpp | |||
@@ -19,6 +19,24 @@ int BTConnectionItem::typeId() const { | |||
19 | return Connection; | 19 | return Connection; |
20 | } | 20 | } |
21 | ConnectionState BTConnectionItem::connection() const { | 21 | ConnectionState BTConnectionItem::connection() const { |
22 | return m_con; | 22 | return m_con; |
23 | } | 23 | } |
24 | 24 | ||
25 | void BTConnectionItem::setName( QString name ) { | ||
26 | m_name = name; | ||
27 | setText( 0, m_name ); | ||
28 | } | ||
29 | |||
30 | QString BTConnectionItem::name() { | ||
31 | return m_name; | ||
32 | } | ||
33 | |||
34 | |||
35 | void BTConnectionItem::setSignalStrength( QString strength ) { | ||
36 | m_signalStrength = strength; | ||
37 | setText( 2, m_signalStrength ); | ||
38 | } | ||
39 | |||
40 | QString BTConnectionItem::signalStrength() { | ||
41 | return m_signalStrength; | ||
42 | } | ||
diff --git a/noncore/net/opietooth/manager/btconnectionitem.h b/noncore/net/opietooth/manager/btconnectionitem.h index 3c0cd79..9ab745e 100644 --- a/noncore/net/opietooth/manager/btconnectionitem.h +++ b/noncore/net/opietooth/manager/btconnectionitem.h | |||
@@ -10,17 +10,23 @@ namespace OpieTooth { | |||
10 | class ConnectionState; | 10 | class ConnectionState; |
11 | class BTConnectionItem : public BTListItem { | 11 | class BTConnectionItem : public BTListItem { |
12 | public: | 12 | public: |
13 | BTConnectionItem( QListView* parent, const ConnectionState& state ); | 13 | BTConnectionItem( QListView* parent, const ConnectionState& state ); |
14 | ~BTConnectionItem(); | 14 | ~BTConnectionItem(); |
15 | QString type()const; | 15 | QString type()const; |
16 | QString name(); | ||
17 | QString signalStrength(); | ||
16 | int typeId() const; | 18 | int typeId() const; |
17 | ConnectionState connection()const; | 19 | ConnectionState connection()const; |
20 | void setSignalStrength( QString ); | ||
21 | void setName( QString ); | ||
22 | |||
18 | private: | 23 | private: |
19 | ConnectionState m_con; | 24 | ConnectionState m_con; |
20 | 25 | QString m_name; | |
26 | QString m_signalStrength; | ||
21 | }; | 27 | }; |
22 | 28 | ||
23 | }; | 29 | }; |
24 | 30 | ||
25 | 31 | ||
26 | #endif | 32 | #endif |