summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/bluebase.cpp
authormickeyl <mickeyl>2005-07-09 13:33:21 (UTC)
committer mickeyl <mickeyl>2005-07-09 13:33:21 (UTC)
commit7bccb3143fbfb4dd70cc22d5233e6275245d0285 (patch) (unidiff)
tree34972468579899cbe3eff62f669217b6fbec112d /noncore/net/opietooth/manager/bluebase.cpp
parentdf81736967930c523b3c1be163f830e9120b7b27 (diff)
downloadopie-7bccb3143fbfb4dd70cc22d5233e6275245d0285.zip
opie-7bccb3143fbfb4dd70cc22d5233e6275245d0285.tar.gz
opie-7bccb3143fbfb4dd70cc22d5233e6275245d0285.tar.bz2
change the default generated names of Qt Designer to something meaningful
~lart Harlekin for being unbelievable lazy :/ ~lart all other Opie developers for not correcting this when they spotted it...
Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 90e44cb..7954cc3 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -58,63 +58,63 @@ using namespace OpieTooth;
58 58
59BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 59BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
60 : BluetoothBase( parent, name, fl ) 60 : BluetoothBase( parent, name, fl )
61{ 61{
62 62
63 m_localDevice = new Manager( "hci0" ); 63 m_localDevice = new Manager( "hci0" );
64 64
65 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 65 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
66 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 66 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
67 67
68 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); 68 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) );
69 // not good since lib is async 69 // not good since lib is async
70 // connect( ListView2, SIGNAL( expanded(QListViewItem*) ), 70 // connect( devicesView, SIGNAL( expanded(QListViewItem*) ),
71 // this, SLOT( addServicesToDevice(QListViewItem*) ) ); 71 // this, SLOT( addServicesToDevice(QListViewItem*) ) );
72 connect( ListView2, SIGNAL( clicked(QListViewItem*)), 72 connect( devicesView, SIGNAL( clicked(QListViewItem*)),
73 this, SLOT( startServiceActionClicked(QListViewItem*) ) ); 73 this, SLOT( startServiceActionClicked(QListViewItem*) ) );
74 connect( ListView2, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), 74 connect( devicesView, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
75 this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) ); 75 this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) );
76 connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ), 76 connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ),
77 this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) ); 77 this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) );
78 connect( m_localDevice, SIGNAL( available(const QString&,bool) ), 78 connect( m_localDevice, SIGNAL( available(const QString&,bool) ),
79 this, SLOT( deviceActive(const QString&,bool) ) ); 79 this, SLOT( deviceActive(const QString&,bool) ) );
80 connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), 80 connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ),
81 this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); 81 this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) );
82 connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), 82 connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ),
83 this, SLOT( addSignalStrength(const QString&,const QString&) ) ); 83 this, SLOT( addSignalStrength(const QString&,const QString&) ) );
84 84
85 85
86 // let hold be rightButtonClicked() 86 // let hold be rightButtonClicked()
87 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); 87 QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold);
88 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); 88 QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold);
89 89
90 //Load all icons needed 90 //Load all icons needed
91 m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); 91 m_offPix = Resource::loadPixmap( "opietooth/notconnected" );
92 m_onPix = Resource::loadPixmap( "opietooth/connected" ); 92 m_onPix = Resource::loadPixmap( "opietooth/connected" );
93 m_findPix = Resource::loadPixmap( "opietooth/find" ); 93 m_findPix = Resource::loadPixmap( "opietooth/find" );
94 94
95 QPalette pal = this->palette(); 95 QPalette pal = this->palette();
96 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 96 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
97 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 97 pal.setColor( QPalette::Active, QColorGroup::Button, col );
98 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 98 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
99 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 99 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
100 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 100 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
101 this->setPalette( pal ); 101 this->setPalette( pal );
102 102
103 setCaption( tr( "Bluetooth Manager" ) ); 103 setCaption( tr( "Bluetooth Manager" ) );
104 104
105 readConfig(); 105 readConfig();
106 initGui(); 106 initGui();
107 107
108 ListView2->setRootIsDecorated(true); 108 devicesView->setRootIsDecorated(true);
109 109
110 110
111 writeToHciConfig(); 111 writeToHciConfig();
112 // search conncetions 112 // search conncetions
113 addConnectedDevices(); 113 addConnectedDevices();
114 addSignalStrength(); 114 addSignalStrength();
115 m_iconLoader = new BTIconLoader(); 115 m_iconLoader = new BTIconLoader();
116 readSavedDevices(); 116 readSavedDevices();
117} 117}
118 118
119/** 119/**
120 * Reads all options from the config file 120 * Reads all options from the config file
@@ -180,25 +180,25 @@ void BlueBase::readSavedDevices()
180 DeviceHandler handler; 180 DeviceHandler handler;
181 loadedDevices = handler.load(); 181 loadedDevices = handler.load();
182 182
183 addSearchedDevices( loadedDevices ); 183 addSearchedDevices( loadedDevices );
184} 184}
185 185
186 186
187/** 187/**
188 * Write the list of allready known devices 188 * Write the list of allready known devices
189 */ 189 */
190void BlueBase::writeSavedDevices() 190void BlueBase::writeSavedDevices()
191{ 191{
192 QListViewItemIterator it( ListView2 ); 192 QListViewItemIterator it( devicesView );
193 BTListItem* item; 193 BTListItem* item;
194 BTDeviceItem* device; 194 BTDeviceItem* device;
195 RemoteDevice::ValueList list; 195 RemoteDevice::ValueList list;
196 for ( ; it.current(); ++it ) 196 for ( ; it.current(); ++it )
197 { 197 {
198 item = (BTListItem*)it.current(); 198 item = (BTListItem*)it.current();
199 if(item->typeId() != BTListItem::Device ) 199 if(item->typeId() != BTListItem::Device )
200 continue; 200 continue;
201 device = (BTDeviceItem*)item; 201 device = (BTDeviceItem*)item;
202 202
203 list.append( device->remoteDevice() ); 203 list.append( device->remoteDevice() );
204 } 204 }
@@ -280,25 +280,25 @@ void BlueBase::rfcommDialog()
280 */ 280 */
281void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) 281void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices )
282{ 282{
283 BTDeviceItem * deviceItem; 283 BTDeviceItem * deviceItem;
284 QValueList<RemoteDevice>::ConstIterator it; 284 QValueList<RemoteDevice>::ConstIterator it;
285 285
286 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) 286 for( it = newDevices.begin(); it != newDevices.end() ; ++it )
287 { 287 {
288 288
289 if (find( (*it) )) // is already inserted 289 if (find( (*it) )) // is already inserted
290 continue; 290 continue;
291 291
292 deviceItem = new BTDeviceItem( ListView2 , (*it) ); 292 deviceItem = new BTDeviceItem( devicesView , (*it) );
293 deviceItem->setPixmap( 1, m_findPix ); 293 deviceItem->setPixmap( 1, m_findPix );
294 deviceItem->setExpandable ( true ); 294 deviceItem->setExpandable ( true );
295 295
296 // look if device is avail. atm, async 296 // look if device is avail. atm, async
297 deviceActive( (*it) ); 297 deviceActive( (*it) );
298 298
299 // ggf auch hier? 299 // ggf auch hier?
300 addServicesToDevice( deviceItem ); 300 addServicesToDevice( deviceItem );
301 } 301 }
302} 302}
303 303
304 304
@@ -478,37 +478,37 @@ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList s
478 } 478 }
479 // now remove them from the list 479 // now remove them from the list
480 m_deviceList.remove( it ); 480 m_deviceList.remove( it );
481} 481}
482 482
483 483
484 484
485 485
486 486
487void BlueBase::addSignalStrength() 487void BlueBase::addSignalStrength()
488{ 488{
489 489
490 QListViewItemIterator it( ListView4 ); 490 QListViewItemIterator it( connectionsView );
491 for ( ; it.current(); ++it ) 491 for ( ; it.current(); ++it )
492 { 492 {
493 m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() ); 493 m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() );
494 } 494 }
495 495
496 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) ); 496 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) );
497} 497}
498 498
499void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) 499void BlueBase::addSignalStrength( const QString& mac, const QString& strength )
500{ 500{
501 501
502 QListViewItemIterator it( ListView4 ); 502 QListViewItemIterator it( connectionsView );
503 for ( ; it.current(); ++it ) 503 for ( ; it.current(); ++it )
504 { 504 {
505 if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) 505 if( ((BTConnectionItem*)it.current())->connection().mac() == mac )
506 { 506 {
507 ((BTConnectionItem*)it.current() )->setSignalStrength( strength ); 507 ((BTConnectionItem*)it.current() )->setSignalStrength( strength );
508 } 508 }
509 } 509 }
510} 510}
511 511
512/** 512/**
513 * Add the existing connections (pairs) to the connections tab. 513 * Add the existing connections (pairs) to the connections tab.
514 * This one triggers the search 514 * This one triggers the search
@@ -525,73 +525,73 @@ void BlueBase::addConnectedDevices()
525void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) 525void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList )
526{ 526{
527 527
528 QValueList<OpieTooth::ConnectionState>::Iterator it; 528 QValueList<OpieTooth::ConnectionState>::Iterator it;
529 BTConnectionItem * connectionItem; 529 BTConnectionItem * connectionItem;
530 530
531 if ( !connectionList.isEmpty() ) 531 if ( !connectionList.isEmpty() )
532 { 532 {
533 533
534 for (it = connectionList.begin(); it != connectionList.end(); ++it) 534 for (it = connectionList.begin(); it != connectionList.end(); ++it)
535 { 535 {
536 536
537 QListViewItemIterator it2( ListView4 ); 537 QListViewItemIterator it2( connectionsView );
538 bool found = false; 538 bool found = false;
539 for ( ; it2.current(); ++it2 ) 539 for ( ; it2.current(); ++it2 )
540 { 540 {
541 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) 541 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() )
542 { 542 {
543 found = true; 543 found = true;
544 } 544 }
545 } 545 }
546 546
547 if ( found == false ) 547 if ( found == false )
548 { 548 {
549 connectionItem = new BTConnectionItem( ListView4, (*it) ); 549 connectionItem = new BTConnectionItem( connectionsView, (*it) );
550 550
551 if( m_deviceList.find((*it).mac()).data() ) 551 if( m_deviceList.find((*it).mac()).data() )
552 { 552 {
553 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); 553 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() );
554 } 554 }
555 } 555 }
556 556
557 } 557 }
558 558
559 QListViewItemIterator it2( ListView4 ); 559 QListViewItemIterator it2( connectionsView );
560 for ( ; it2.current(); ++it2 ) 560 for ( ; it2.current(); ++it2 )
561 { 561 {
562 bool found = false; 562 bool found = false;
563 for (it = connectionList.begin(); it != connectionList.end(); ++it) 563 for (it = connectionList.begin(); it != connectionList.end(); ++it)
564 { 564 {
565 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) 565 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() )
566 { 566 {
567 found = true; 567 found = true;
568 } 568 }
569 } 569 }
570 570
571 if ( !found ) 571 if ( !found )
572 { 572 {
573 delete it2.current(); 573 delete it2.current();
574 } 574 }
575 575
576 } 576 }
577 577
578 578
579 } 579 }
580 else 580 else
581 { 581 {
582 ListView4->clear(); 582 connectionsView->clear();
583 ConnectionState con; 583 ConnectionState con;
584 con.setMac( tr("No connections found") ); 584 con.setMac( tr("No connections found") );
585 connectionItem = new BTConnectionItem( ListView4 , con ); 585 connectionItem = new BTConnectionItem( connectionsView , con );
586 } 586 }
587 587
588 // recall connection search after some time 588 // recall connection search after some time
589 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); 589 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) );
590} 590}
591 591
592 592
593/** 593/**
594 * Find out if a device can currently be reached 594 * Find out if a device can currently be reached
595 * @param device 595 * @param device
596 */ 596 */
597void BlueBase::deviceActive( const RemoteDevice &device ) 597void BlueBase::deviceActive( const RemoteDevice &device )
@@ -664,25 +664,25 @@ BlueBase::~BlueBase()
664 delete m_iconLoader; 664 delete m_iconLoader;
665} 665}
666 666
667 667
668/** 668/**
669 * find searches the ListView for a BTDeviceItem containig 669 * find searches the ListView for a BTDeviceItem containig
670 * the same Device if found return true else false 670 * the same Device if found return true else false
671 * @param dev RemoteDevice to find 671 * @param dev RemoteDevice to find
672 * @return returns true if found 672 * @return returns true if found
673 */ 673 */
674bool BlueBase::find( const RemoteDevice& rem ) 674bool BlueBase::find( const RemoteDevice& rem )
675{ 675{
676 QListViewItemIterator it( ListView2 ); 676 QListViewItemIterator it( devicesView );
677 BTListItem* item; 677 BTListItem* item;
678 BTDeviceItem* device; 678 BTDeviceItem* device;
679 for (; it.current(); ++it ) 679 for (; it.current(); ++it )
680 { 680 {
681 item = (BTListItem*) it.current(); 681 item = (BTListItem*) it.current();
682 if ( item->typeId() != BTListItem::Device ) 682 if ( item->typeId() != BTListItem::Device )
683 continue; 683 continue;
684 684
685 device = (BTDeviceItem*)item; 685 device = (BTDeviceItem*)item;
686 if ( rem.equals( device->remoteDevice() ) ) 686 if ( rem.equals( device->remoteDevice() ) )
687 return true; 687 return true;
688 } 688 }