author | harlekin <harlekin> | 2002-06-16 19:26:43 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-16 19:26:43 (UTC) |
commit | 8dde6abcd14717bd362248c365fe140efe0f0386 (patch) (unidiff) | |
tree | f9e97c987e5197d4cbb3d0a0d5afe99fe12b1eba | |
parent | 1eca76c99326afc111efeb2bf55a306a4f37eb1e (diff) | |
download | opie-8dde6abcd14717bd362248c365fe140efe0f0386.zip opie-8dde6abcd14717bd362248c365fe140efe0f0386.tar.gz opie-8dde6abcd14717bd362248c365fe140efe0f0386.tar.bz2 |
update
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 14 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 5 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 46 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.h | 10 |
4 files changed, 64 insertions, 11 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index e3b9e53..71da82e 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -40,16 +40,20 @@ | |||
40 | 40 | ||
41 | 41 | ||
42 | namespace OpieTooth { | 42 | namespace OpieTooth { |
43 | 43 | ||
44 | class RemoteDevices; | ||
44 | 45 | ||
45 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 46 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
46 | : BluetoothBase( parent, name, fl ) { | 47 | : BluetoothBase( parent, name, fl ) { |
47 | 48 | ||
48 | 49 | ||
49 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); | 50 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); |
50 | QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); | 51 | QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); |
51 | 52 | ||
53 | |||
54 | |||
55 | |||
52 | QPalette pal = this->palette(); | 56 | QPalette pal = this->palette(); |
53 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); | 57 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); |
54 | pal.setColor(QPalette::Active, QColorGroup::Button, col); | 58 | pal.setColor(QPalette::Active, QColorGroup::Button, col); |
55 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); | 59 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); |
@@ -148,13 +152,23 @@ namespace OpieTooth { | |||
148 | // falls nötig hcid killhupen - die funktionalität adden | 152 | // falls nötig hcid killhupen - die funktionalität adden |
149 | } | 153 | } |
150 | 154 | ||
151 | 155 | ||
156 | void BlueBase::addSearchedDevices( QList<RemoteDevices> &newDevices ) { | ||
157 | |||
158 | |||
159 | |||
160 | } | ||
161 | |||
162 | |||
152 | /** | 163 | /** |
153 | * Open the "scan for devices" dialog | 164 | * Open the "scan for devices" dialog |
154 | */ | 165 | */ |
155 | void BlueBase::startScan() { | 166 | void BlueBase::startScan() { |
156 | ScanDialog *scan = new ScanDialog( this, "", true); | 167 | ScanDialog *scan = new ScanDialog( this, "", true); |
168 | QObject::connect((QObject*)scan, SIGNAL( selectedDevices(QList<RemoteDevices>&) ), | ||
169 | this, SLOT( addSearchedDevices(QList<RemoteDevices>& ) )); | ||
170 | |||
157 | scan->showMaximized(); | 171 | scan->showMaximized(); |
158 | } | 172 | } |
159 | 173 | ||
160 | /** | 174 | /** |
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 023af7a..ae5ce67 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h | |||
@@ -5,8 +5,9 @@ | |||
5 | #include <qvariant.h> | 5 | #include <qvariant.h> |
6 | #include <qwidget.h> | 6 | #include <qwidget.h> |
7 | #include <qscrollview.h> | 7 | #include <qscrollview.h> |
8 | #include <qsplitter.h> | 8 | #include <qsplitter.h> |
9 | #include <qlist.h> | ||
9 | 10 | ||
10 | #include "bluetoothbase.h" | 11 | #include "bluetoothbase.h" |
11 | 12 | ||
12 | class QVBox; | 13 | class QVBox; |
@@ -19,8 +20,10 @@ class QTabWidget; | |||
19 | class QCheckBox; | 20 | class QCheckBox; |
20 | 21 | ||
21 | namespace OpieTooth { | 22 | namespace OpieTooth { |
22 | 23 | ||
24 | |||
25 | |||
23 | class BlueBase : public BluetoothBase { | 26 | class BlueBase : public BluetoothBase { |
24 | Q_OBJECT | 27 | Q_OBJECT |
25 | 28 | ||
26 | public: | 29 | public: |
@@ -47,9 +50,9 @@ namespace OpieTooth { | |||
47 | int enablePagescan; | 50 | int enablePagescan; |
48 | int enableInquiryscan; | 51 | int enableInquiryscan; |
49 | 52 | ||
50 | private slots: | 53 | private slots: |
51 | 54 | void addSearchedDevices( QList<RemoteDevices> &newDevices ); | |
52 | void applyConfigChanges(); | 55 | void applyConfigChanges(); |
53 | 56 | ||
54 | }; | 57 | }; |
55 | 58 | ||
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index 63c5472..70ea77a 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp | |||
@@ -27,16 +27,19 @@ | |||
27 | #include <qvariant.h> | 27 | #include <qvariant.h> |
28 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
29 | #include <qwhatsthis.h> | 29 | #include <qwhatsthis.h> |
30 | #include <qprogressbar.h> | 30 | #include <qprogressbar.h> |
31 | #include <qlist.h> | ||
31 | 32 | ||
32 | #include <manager.h> | 33 | #include <manager.h> |
33 | #include <device.h> | 34 | #include <device.h> |
34 | #include <remotedevice.h> | 35 | |
35 | 36 | ||
36 | 37 | ||
37 | namespace OpieTooth { | 38 | namespace OpieTooth { |
38 | 39 | ||
40 | #include <remotedevice.h> | ||
41 | |||
39 | /* | 42 | /* |
40 | */ | 43 | */ |
41 | ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 44 | ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
42 | : QDialog( parent, name, modal, fl ) { | 45 | : QDialog( parent, name, modal, fl ) { |
@@ -62,21 +65,22 @@ namespace OpieTooth { | |||
62 | 65 | ||
63 | QFrame *buttonFrame = new QFrame(Frame7, ""); | 66 | QFrame *buttonFrame = new QFrame(Frame7, ""); |
64 | 67 | ||
65 | StartButton = new QPushButton( buttonFrame, "StartButton" ); | 68 | StartButton = new QPushButton( buttonFrame, "StartButton" ); |
66 | StartButton->setText( tr( "Start" ) ); | 69 | StartButton->setText( tr( "Start scan" ) ); |
67 | 70 | ||
68 | StopButton = new QPushButton( buttonFrame, "StopButton" ); | 71 | StopButton = new QPushButton( buttonFrame, "StopButton" ); |
69 | StopButton->setText( tr( "Cancel" ) ); | 72 | StopButton->setText( tr( "Cancel scan" ) ); |
70 | 73 | ||
71 | QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame); | 74 | QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame); |
75 | |||
72 | buttonLayout->addWidget(StartButton); | 76 | buttonLayout->addWidget(StartButton); |
73 | buttonLayout->addWidget(StopButton); | 77 | buttonLayout->addWidget(StopButton); |
74 | 78 | ||
75 | ListView1 = new QListView( privateLayoutWidget, "ListView1" ); | 79 | ListView1 = new QListView( privateLayoutWidget, "ListView1" ); |
76 | 80 | ||
77 | ListView1->addColumn( tr( "Add" ) ); | 81 | //ListView1->addColumn( tr( "Add" ) ); |
78 | ListView1->addColumn( tr( "Device Name" ) ); | 82 | ListView1->addColumn( tr( "Add Device" ) ); |
79 | //ListView1->addColumn( tr( "Type" ) ); | 83 | //ListView1->addColumn( tr( "Type" ) ); |
80 | 84 | ||
81 | Layout11->addWidget( ListView1); | 85 | Layout11->addWidget( ListView1); |
82 | Layout11->addWidget(progress); | 86 | Layout11->addWidget(progress); |
@@ -105,8 +109,11 @@ namespace OpieTooth { | |||
105 | void ScanDialog::startSearch() { | 109 | void ScanDialog::startSearch() { |
106 | progress->setProgress(0); | 110 | progress->setProgress(0); |
107 | progressStat = 0; | 111 | progressStat = 0; |
108 | 112 | ||
113 | QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox ); | ||
114 | deviceItem2->setText(1, "BLAH" ); | ||
115 | |||
109 | progressTimer(); | 116 | progressTimer(); |
110 | // when finished, it emmite foundDevices() | 117 | // when finished, it emmite foundDevices() |
111 | // checken ob initialisiert , qcop ans applet. | 118 | // checken ob initialisiert , qcop ans applet. |
112 | localDevice->searchDevices(); | 119 | localDevice->searchDevices(); |
@@ -118,21 +125,46 @@ namespace OpieTooth { | |||
118 | } | 125 | } |
119 | 126 | ||
120 | void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) { | 127 | void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) { |
121 | 128 | ||
122 | QListViewItem * deviceItem; | 129 | QCheckListItem * deviceItem; |
123 | 130 | ||
124 | RemoteDevices::ValueList::Iterator it; | 131 | RemoteDevices::ValueList::Iterator it; |
125 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { | 132 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { |
126 | 133 | ||
127 | deviceItem = new QListViewItem( ListView1, (*it).name() ); | 134 | deviceItem = new QCheckListItem( ListView1, (*it).name() ); |
135 | deviceItem->setText(1, (*it).mac() ); | ||
136 | } | ||
137 | |||
138 | } | ||
139 | |||
140 | /* | ||
141 | * Iterates trough the items, and collects the checked items. | ||
142 | * Then it emits it, so the manager can connect to the signal to fill the listing. | ||
143 | */ | ||
144 | void ScanDialog::emitToManager() { | ||
145 | |||
146 | if (!ListView1) { | ||
147 | return; | ||
148 | } | ||
149 | |||
150 | QList<RemoteDevices> *deviceList = new QList<RemoteDevices>; | ||
151 | |||
152 | QListViewItemIterator it( ListView1 ); | ||
153 | for ( ; it.current(); ++it ) { | ||
154 | if ( it.current()->isSelected() ) { | ||
155 | RemoteDevices* device = new RemoteDevices( it.current()->text(1), it.current()->text(0)); | ||
156 | deviceList->append( device ); | ||
157 | } | ||
128 | } | 158 | } |
159 | emit selectedDevices( *deviceList ); | ||
129 | } | 160 | } |
130 | 161 | ||
131 | /* | 162 | /* |
132 | * Cleanup | 163 | * Cleanup |
133 | */ | 164 | */ |
134 | ScanDialog::~ScanDialog() { | 165 | ScanDialog::~ScanDialog() { |
166 | emitToManager(); | ||
135 | delete localDevice; | 167 | delete localDevice; |
136 | } | 168 | } |
137 | 169 | ||
138 | } | 170 | } |
diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h index fcaee6e..4785a62 100644 --- a/noncore/net/opietooth/manager/scandialog.h +++ b/noncore/net/opietooth/manager/scandialog.h | |||
@@ -18,12 +18,11 @@ | |||
18 | #define SCANDIALOG_H | 18 | #define SCANDIALOG_H |
19 | 19 | ||
20 | #include <qvariant.h> | 20 | #include <qvariant.h> |
21 | #include <qdialog.h> | 21 | #include <qdialog.h> |
22 | #include <qlist.h> | ||
22 | 23 | ||
23 | 24 | ||
24 | #include <remotedevice.h> | ||
25 | |||
26 | class QVBoxLayout; | 25 | class QVBoxLayout; |
27 | class QHBoxLayout; | 26 | class QHBoxLayout; |
28 | class QGridLayout; | 27 | class QGridLayout; |
29 | class QFrame; | 28 | class QFrame; |
@@ -35,9 +34,9 @@ class QProgressBar; | |||
35 | 34 | ||
36 | 35 | ||
37 | namespace OpieTooth { | 36 | namespace OpieTooth { |
38 | 37 | ||
39 | 38 | #include <remotedevices.h> | |
40 | class Manager; | 39 | class Manager; |
41 | class Device; | 40 | class Device; |
42 | 41 | ||
43 | class ScanDialog : public QDialog { | 42 | class ScanDialog : public QDialog { |
@@ -63,11 +62,16 @@ class Device; | |||
63 | void progressTimer(); | 62 | void progressTimer(); |
64 | void fillList(const QString& device, RemoteDevices::ValueList list); | 63 | void fillList(const QString& device, RemoteDevices::ValueList list); |
65 | 64 | ||
66 | private: | 65 | private: |
66 | void emitToManager(); | ||
67 | Manager *localDevice; | 67 | Manager *localDevice; |
68 | int progressStat; | 68 | int progressStat; |
69 | |||
70 | signals: | ||
71 | void selectedDevices(QList<RemoteDevices>&); | ||
69 | }; | 72 | }; |
70 | 73 | ||
74 | |||
71 | } | 75 | } |
72 | 76 | ||
73 | #endif // SCANDIALOG_H | 77 | #endif // SCANDIALOG_H |