author | harlekin <harlekin> | 2002-06-15 21:19:03 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-15 21:19:03 (UTC) |
commit | e31f557a84055ce00f814fd44427f9b3584243f9 (patch) (unidiff) | |
tree | 013a928eb50be77200e361b20df46d846bdf6250 | |
parent | be10ba352f2a89bc5ec816eefc307a4ae2f7ff6b (diff) | |
download | opie-e31f557a84055ce00f814fd44427f9b3584243f9.zip opie-e31f557a84055ce00f814fd44427f9b3584243f9.tar.gz opie-e31f557a84055ce00f814fd44427f9b3584243f9.tar.bz2 |
update
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 28 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.h | 2 |
3 files changed, 20 insertions, 14 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index c905ea3..e3b9e53 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -44,32 +44,34 @@ namespace OpieTooth { | |||
44 | 44 | ||
45 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 45 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
46 | : BluetoothBase( parent, name, fl ) { | 46 | : BluetoothBase( parent, name, fl ) { |
47 | 47 | ||
48 | 48 | ||
49 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); | 49 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); |
50 | QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); | 50 | QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); |
51 | 51 | ||
52 | QPalette pal = this->palette(); | 52 | QPalette pal = this->palette(); |
53 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); | 53 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); |
54 | pal.setColor(QPalette::Active, QColorGroup::Button, col); | 54 | pal.setColor(QPalette::Active, QColorGroup::Button, col); |
55 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); | 55 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); |
56 | pal.setColor(QPalette::Normal, QColorGroup::Button, col); | 56 | pal.setColor(QPalette::Normal, QColorGroup::Button, col); |
57 | pal.setColor(QPalette::Disabled, QColorGroup::Button, col); | 57 | pal.setColor(QPalette::Disabled, QColorGroup::Button, col); |
58 | this->setPalette(pal); | 58 | this->setPalette(pal); |
59 | 59 | ||
60 | setCaption( tr( "Bluetooth Manager" ) ); | ||
61 | |||
60 | readConfig(); | 62 | readConfig(); |
61 | initGui(); | 63 | initGui(); |
62 | } | 64 | } |
63 | 65 | ||
64 | /** | 66 | /** |
65 | * Reads all options from the config file | 67 | * Reads all options from the config file |
66 | */ | 68 | */ |
67 | void BlueBase::readConfig() { | 69 | void BlueBase::readConfig() { |
68 | 70 | ||
69 | Config cfg("bluetoothmanager"); | 71 | Config cfg("bluetoothmanager"); |
70 | cfg.setGroup("bluezsettings"); | 72 | cfg.setGroup("bluezsettings"); |
71 | 73 | ||
72 | 74 | ||
73 | deviceName = cfg.readEntry("name", "No name"); // name the device should identify with | 75 | deviceName = cfg.readEntry("name", "No name"); // name the device should identify with |
74 | defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak | 76 | defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak |
75 | useEncryption = cfg.readNumEntry("useEncryption", 1); | 77 | useEncryption = cfg.readNumEntry("useEncryption", 1); |
@@ -139,27 +141,27 @@ namespace OpieTooth { | |||
139 | 141 | ||
140 | writeConfig(); | 142 | writeConfig(); |
141 | 143 | ||
142 | QMessageBox* box = new QMessageBox(this, "Test"); | 144 | QMessageBox* box = new QMessageBox(this, "Test"); |
143 | box->setText(tr("Changes applied")); | 145 | box->setText(tr("Changes applied")); |
144 | box->show(); | 146 | box->show(); |
145 | 147 | ||
146 | // falls nötig hcid killhupen - die funktionalität adden | 148 | // falls nötig hcid killhupen - die funktionalität adden |
147 | } | 149 | } |
148 | 150 | ||
149 | 151 | ||
150 | /** | 152 | /** |
151 | * Open the "scan for devices" dialog | 153 | * Open the "scan for devices" dialog |
152 | */ | 154 | */ |
153 | void BlueBase::startScan() { | 155 | void BlueBase::startScan() { |
154 | ScanDialog *scan = new ScanDialog( this, "", true); | 156 | ScanDialog *scan = new ScanDialog( this, "", true); |
155 | scan->exec(); | 157 | scan->showMaximized(); |
156 | } | 158 | } |
157 | 159 | ||
158 | /** | 160 | /** |
159 | * Decontructor | 161 | * Decontructor |
160 | */ | 162 | */ |
161 | BlueBase::~BlueBase(){ | 163 | BlueBase::~BlueBase(){ |
162 | } | 164 | } |
163 | 165 | ||
164 | } | 166 | } |
165 | 167 | ||
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index 842466a..e81b2ee 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp | |||
@@ -40,84 +40,88 @@ namespace OpieTooth { | |||
40 | */ | 40 | */ |
41 | ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 41 | ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
42 | : QDialog( parent, name, modal, fl ) { | 42 | : QDialog( parent, name, modal, fl ) { |
43 | 43 | ||
44 | if ( !name ) | 44 | if ( !name ) |
45 | setName( "ScanDialog" ); | 45 | setName( "ScanDialog" ); |
46 | resize( 240, 320 ); | 46 | resize( 240, 320 ); |
47 | setCaption( tr( "Scan for devices" ) ); | 47 | setCaption( tr( "Scan for devices" ) ); |
48 | 48 | ||
49 | Frame7 = new QFrame( this, "Frame7" ); | 49 | Frame7 = new QFrame( this, "Frame7" ); |
50 | Frame7->setGeometry( QRect( 0, 0, 240, 331 ) ); | 50 | Frame7->setGeometry( QRect( 0, 0, 240, 331 ) ); |
51 | Frame7->setFrameShape( QFrame::StyledPanel ); | 51 | Frame7->setFrameShape( QFrame::StyledPanel ); |
52 | Frame7->setFrameShadow( QFrame::Raised ); | 52 | Frame7->setFrameShadow( QFrame::Raised ); |
53 | 53 | ||
54 | 54 | ||
55 | QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" ); | 55 | QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" ); |
56 | privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 310 ) ); | 56 | privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 280 ) ); |
57 | Layout11 = new QGridLayout( privateLayoutWidget ); | 57 | Layout11 = new QVBoxLayout( privateLayoutWidget ); |
58 | Layout11->setSpacing( 6 ); | 58 | Layout11->setSpacing( 6 ); |
59 | Layout11->setMargin( 0 ); | 59 | Layout11->setMargin( 0 ); |
60 | 60 | ||
61 | 61 | ||
62 | progress = new QProgressBar(privateLayoutWidget, "progbar"); | 62 | progress = new QProgressBar(privateLayoutWidget, "progbar"); |
63 | progress->setTotalSteps(20); | 63 | progress->setTotalSteps(20); |
64 | 64 | ||
65 | //Layout11->addMultiCellWidget( progress, 1, 1, 0, 1 ); | ||
66 | Layout11->addWidget(progress, 2, 2); | ||
67 | 65 | ||
68 | StartButton = new QPushButton( privateLayoutWidget, "StartButton" ); | 66 | QFrame *buttonFrame = new QFrame(Frame7, ""); |
67 | |||
68 | StartButton = new QPushButton( buttonFrame, "StartButton" ); | ||
69 | StartButton->setText( tr( "Start" ) ); | 69 | StartButton->setText( tr( "Start" ) ); |
70 | 70 | ||
71 | Layout11->addWidget( StartButton, 2, 0 ); | 71 | StopButton = new QPushButton( buttonFrame, "StopButton" ); |
72 | |||
73 | StopButton = new QPushButton( privateLayoutWidget, "StopButton" ); | ||
74 | StopButton->setText( tr( "Cancel" ) ); | 72 | StopButton->setText( tr( "Cancel" ) ); |
75 | 73 | ||
76 | Layout11->addWidget( StopButton, 2, 1 ); | 74 | |
75 | QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame); | ||
76 | buttonLayout->addWidget(StartButton); | ||
77 | buttonLayout->addWidget(StopButton); | ||
77 | 78 | ||
78 | ListView1 = new QListView( privateLayoutWidget, "ListView1" ); | 79 | ListView1 = new QListView( privateLayoutWidget, "ListView1" ); |
79 | 80 | ||
80 | ListView1->addColumn( tr( "Add" ) ); | 81 | ListView1->addColumn( tr( "Add" ) ); |
81 | ListView1->addColumn( tr( "Device Name" ) ); | 82 | ListView1->addColumn( tr( "Device Name" ) ); |
82 | //ListView1->addColumn( tr( "Type" ) ); | 83 | //ListView1->addColumn( tr( "Type" ) ); |
83 | 84 | ||
84 | Layout11->addMultiCellWidget( ListView1, 0, 0, 0, 1 ); | 85 | Layout11->addWidget( ListView1); |
86 | Layout11->addWidget(progress); | ||
87 | Layout11->addWidget( buttonFrame); | ||
88 | |||
89 | localDevice = new Manager( "hci0" ); | ||
85 | 90 | ||
86 | connect( (QObject*)StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); | 91 | connect( (QObject*)StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); |
87 | connect( (QObject*)StopButton, SIGNAL( clicked() ), this, SLOT( stopSearch() ) ); | 92 | connect( (QObject*)StopButton, SIGNAL( clicked() ), this, SLOT( stopSearch() ) ); |
88 | connect( (QObject*)localDevice, SIGNAL( foundDevices( const QString& , RemoteDevices::ValueList ) ), | 93 | connect( (QObject*)localDevice, SIGNAL( foundDevices( const QString& , RemoteDevices::ValueList ) ), |
89 | this, SLOT(fillList(const QString& , RemoteDevices::ValueList ) ) ) ; | 94 | this, SLOT(fillList(const QString& , RemoteDevices::ValueList ) ) ) ; |
90 | progressStat = 0; | 95 | progressStat = 0; |
91 | } | 96 | } |
92 | 97 | ||
93 | // hack, make cleaner later | 98 | // hack, make cleaner later |
94 | void ScanDialog::progressTimer(int maxSeconds) { | 99 | void ScanDialog::progressTimer(int maxSeconds) { |
95 | 100 | ||
96 | progressStat++; | 101 | progressStat++; |
97 | if (progressStat++ < maxSeconds) { | 102 | if (progressStat++ < maxSeconds) { |
98 | QTimer::singleShot( 1000, this, SLOT(progressTimer ) ); | 103 | QTimer::singleShot( 1000, this, SLOT(progressTimer ) ); |
99 | } | 104 | } |
100 | 105 | ||
101 | } | 106 | } |
102 | 107 | ||
103 | void ScanDialog::startSearch() { | 108 | void ScanDialog::startSearch() { |
104 | progress->setProgress(0); | 109 | progress->setProgress(0); |
105 | progressStat = 0; | 110 | progressStat = 0; |
106 | // read it from config later | 111 | |
107 | localDevice = new Manager( "hci0" ); | ||
108 | progressTimer(20); | 112 | progressTimer(20); |
109 | // when finished, it emmite foundDevices() | 113 | // when finished, it emmite foundDevices() |
110 | // checken ob initialisiert , qcop ans applet. | 114 | // checken ob initialisiert , qcop ans applet. |
111 | localDevice->searchDevices(); | 115 | localDevice->searchDevices(); |
112 | progress->setProgress(20); | 116 | progress->setProgress(20); |
113 | } | 117 | } |
114 | 118 | ||
115 | void ScanDialog::stopSearch() { | 119 | void ScanDialog::stopSearch() { |
116 | 120 | ||
117 | } | 121 | } |
118 | 122 | ||
119 | void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) { | 123 | void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) { |
120 | 124 | ||
121 | QListViewItem * deviceItem; | 125 | QListViewItem * deviceItem; |
122 | 126 | ||
123 | RemoteDevices::ValueList::Iterator it; | 127 | RemoteDevices::ValueList::Iterator it; |
diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h index 6d9b877..22ee01d 100644 --- a/noncore/net/opietooth/manager/scandialog.h +++ b/noncore/net/opietooth/manager/scandialog.h | |||
@@ -42,32 +42,32 @@ class Device; | |||
42 | 42 | ||
43 | class ScanDialog : public QDialog { | 43 | class ScanDialog : public QDialog { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | 45 | ||
46 | public: | 46 | public: |
47 | ScanDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 47 | ScanDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
48 | ~ScanDialog(); | 48 | ~ScanDialog(); |
49 | 49 | ||
50 | QFrame* Frame7; | 50 | QFrame* Frame7; |
51 | QProgressBar* progress; | 51 | QProgressBar* progress; |
52 | QPushButton* StartButton; | 52 | QPushButton* StartButton; |
53 | QPushButton* StopButton; | 53 | QPushButton* StopButton; |
54 | QListView* ListView1; | 54 | QListView* ListView1; |
55 | 55 | ||
56 | 56 | ||
57 | protected: | 57 | protected: |
58 | QGridLayout* Layout11; | 58 | QVBoxLayout* Layout11; |
59 | 59 | ||
60 | private slots: | 60 | private slots: |
61 | void stopSearch(); | 61 | void stopSearch(); |
62 | void startSearch(); | 62 | void startSearch(); |
63 | void fillList(const QString& device, RemoteDevices::ValueList list); | 63 | void fillList(const QString& device, RemoteDevices::ValueList list); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | void progressTimer(int maxSeconds); | 66 | void progressTimer(int maxSeconds); |
67 | Manager *localDevice; | 67 | Manager *localDevice; |
68 | int progressStat; | 68 | int progressStat; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | #endif // SCANDIALOG_H | 73 | #endif // SCANDIALOG_H |