author | zecke <zecke> | 2002-07-09 18:28:19 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-07-09 18:28:19 (UTC) |
commit | 411ac6f9199b1aae2b6a40e7a8cf6bfea260acba (patch) (unidiff) | |
tree | 218836d6509d2dcaba3c6306f9f488b759169b1a | |
parent | 5f549398401acc5591ffcb67459dbf55ea323b91 (diff) | |
download | opie-411ac6f9199b1aae2b6a40e7a8cf6bfea260acba.zip opie-411ac6f9199b1aae2b6a40e7a8cf6bfea260acba.tar.gz opie-411ac6f9199b1aae2b6a40e7a8cf6bfea260acba.tar.bz2 |
Add a generic class for the sensitive QPopupMenu
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 6 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/manager.pro | 4 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/popuphelper.cpp | 25 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/popuphelper.h | 25 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.h | 2 |
6 files changed, 57 insertions, 7 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index c29eb1a..85c6717 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -241,13 +241,13 @@ using namespace OpieTooth; | |||
241 | } | 241 | } |
242 | 242 | ||
243 | /** | 243 | /** |
244 | * Add fresh found devices from scan dialog to the listing | 244 | * Add fresh found devices from scan dialog to the listing |
245 | * | 245 | * |
246 | */ | 246 | */ |
247 | void BlueBase::addSearchedDevices( QValueList<RemoteDevice> &newDevices ) { | 247 | void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { |
248 | BTListItem * deviceItem; | 248 | BTListItem * deviceItem; |
249 | QValueList<RemoteDevice>::ConstIterator it; | 249 | QValueList<RemoteDevice>::ConstIterator it; |
250 | 250 | ||
251 | for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { | 251 | for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { |
252 | deviceItem = new BTListItem( ListView2 , (*it).name(), (*it).mac(), "device" ); | 252 | deviceItem = new BTListItem( ListView2 , (*it).name(), (*it).mac(), "device" ); |
253 | deviceItem->setExpandable ( true ); | 253 | deviceItem->setExpandable ( true ); |
@@ -431,14 +431,14 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin | |||
431 | /** | 431 | /** |
432 | * Open the "scan for devices" dialog | 432 | * Open the "scan for devices" dialog |
433 | */ | 433 | */ |
434 | void BlueBase::startScan() { | 434 | void BlueBase::startScan() { |
435 | ScanDialog *scan = new ScanDialog( this, "ScanDialog", | 435 | ScanDialog *scan = new ScanDialog( this, "ScanDialog", |
436 | true, WDestructiveClose ); | 436 | true, WDestructiveClose ); |
437 | QObject::connect( scan, SIGNAL( selectedDevices( QValueList<RemoteDevice>& ) ), | 437 | QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ), |
438 | this, SLOT( addSearchedDevices( QValueList<RemoteDevice>& ) ) ); | 438 | this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) ); |
439 | 439 | ||
440 | scan->showMaximized(); | 440 | scan->showMaximized(); |
441 | } | 441 | } |
442 | 442 | ||
443 | 443 | ||
444 | /** | 444 | /** |
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 97ce8c3..73fac97 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h | |||
@@ -65,13 +65,13 @@ namespace OpieTooth { | |||
65 | QPixmap m_offPix; | 65 | QPixmap m_offPix; |
66 | QPixmap m_onPix; | 66 | QPixmap m_onPix; |
67 | 67 | ||
68 | BTIconLoader *m_iconLoader; | 68 | BTIconLoader *m_iconLoader; |
69 | 69 | ||
70 | private slots: | 70 | private slots: |
71 | void addSearchedDevices( QValueList<RemoteDevice> &newDevices ); | 71 | void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); |
72 | void addServicesToDevice( BTListItem *item ); | 72 | void addServicesToDevice( BTListItem *item ); |
73 | void addServicesToDevice( const QString& device, Services::ValueList ); | 73 | void addServicesToDevice( const QString& device, Services::ValueList ); |
74 | void addConnectedDevices(); | 74 | void addConnectedDevices(); |
75 | void addConnectedDevices( Connection::ValueList ); | 75 | void addConnectedDevices( Connection::ValueList ); |
76 | void startServiceActionClicked( QListViewItem *item ); | 76 | void startServiceActionClicked( QListViewItem *item ); |
77 | void startServiceActionHold( QListViewItem *, const QPoint &, int ); | 77 | void startServiceActionHold( QListViewItem *, const QPoint &, int ); |
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index 55f2fd2..4f0ea60 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro | |||
@@ -1,11 +1,11 @@ | |||
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 bticonloader.h | 4 | HEADERS = popuphelper.h bluebase.h scandialog.h btlistitem.h hciconfwrapper.h bticonloader.h |
5 | SOURCES = main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp bticonloader.cpp | 5 | SOURCES = popuphelper.cpp 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 |
9 | LIBS += -lqpe -lopietooth -lopie | 9 | LIBS += -lqpe -lopietooth -lopie |
10 | INTERFACES = bluetoothbase.ui devicedialog.ui | 10 | INTERFACES = bluetoothbase.ui devicedialog.ui |
11 | DESTDIR = $(OPIEDIR)/bin | 11 | DESTDIR = $(OPIEDIR)/bin |
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp new file mode 100644 index 0000000..2a6dad0 --- a/dev/null +++ b/noncore/net/opietooth/manager/popuphelper.cpp | |||
@@ -0,0 +1,25 @@ | |||
1 | |||
2 | #include "popuphelper.h" | ||
3 | |||
4 | using namespace OpieTooth; | ||
5 | |||
6 | PopupHelper::PopupHelper() { | ||
7 | init(); | ||
8 | } | ||
9 | PopupHelper::~PopupHelper() { | ||
10 | |||
11 | } | ||
12 | void PopupHelper::insert( int id, popupFactory fact ) { | ||
13 | m_map.insert(id, fact ); | ||
14 | } | ||
15 | QPopupMenu* PopupHelper::find( int id ) { | ||
16 | FactoryMap::Iterator it = m_map.find(id ); | ||
17 | if ( it != m_map.end() ) { | ||
18 | popupFactory fact = it.data(); | ||
19 | return (*fact)(); | ||
20 | } | ||
21 | return 0l; | ||
22 | } | ||
23 | void PopupHelper::init() { | ||
24 | |||
25 | } | ||
diff --git a/noncore/net/opietooth/manager/popuphelper.h b/noncore/net/opietooth/manager/popuphelper.h new file mode 100644 index 0000000..7485f71 --- a/dev/null +++ b/noncore/net/opietooth/manager/popuphelper.h | |||
@@ -0,0 +1,25 @@ | |||
1 | |||
2 | #ifndef OPIE_TOOTH_POPUP_HELPER | ||
3 | #define OPIE_TOOTH_POPUP_HELPER | ||
4 | |||
5 | #include <qpopupmenu.h> | ||
6 | #include <qmap.h> | ||
7 | |||
8 | |||
9 | namespace OpieTooth { | ||
10 | typedef QPopupMenu* (*popupFactory)(void); | ||
11 | typedef QMap<int, popupFactory> FactoryMap; | ||
12 | class PopupHelper { | ||
13 | public: | ||
14 | PopupHelper(); | ||
15 | ~PopupHelper(); | ||
16 | void insert( int id, popupFactory fact ); | ||
17 | QPopupMenu* find( int id ); | ||
18 | private: | ||
19 | void init(); | ||
20 | FactoryMap m_map; | ||
21 | |||
22 | }; | ||
23 | }; | ||
24 | |||
25 | #endif | ||
diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h index cc890f3..f18784d 100644 --- a/noncore/net/opietooth/manager/scandialog.h +++ b/noncore/net/opietooth/manager/scandialog.h | |||
@@ -67,13 +67,13 @@ public slots: | |||
67 | private: | 67 | private: |
68 | void emitToManager(); | 68 | void emitToManager(); |
69 | Manager *localDevice; | 69 | Manager *localDevice; |
70 | int progressStat; | 70 | int progressStat; |
71 | 71 | ||
72 | signals: | 72 | signals: |
73 | void selectedDevices(QValueList<RemoteDevice>&); | 73 | void selectedDevices(const QValueList<RemoteDevice>&); |
74 | }; | 74 | }; |
75 | 75 | ||
76 | 76 | ||
77 | } | 77 | } |
78 | 78 | ||
79 | #endif // SCANDIALOG_H | 79 | #endif // SCANDIALOG_H |