From ef75752efaef84e4b7350f9768f3cb3c4fd744af Mon Sep 17 00:00:00 2001 From: harlekin Date: Sat, 15 Jun 2002 19:30:18 +0000 Subject: wip --- (limited to 'noncore/net') diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 3d446f0..c905ea3 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -38,78 +38,79 @@ #include #include -BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) - : BluetoothBase( parent, name, fl ) { +namespace OpieTooth { - QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); - QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); - QPalette pal = this->palette(); - QColor col = pal.color(QPalette::Active, QColorGroup::Background); - pal.setColor(QPalette::Active, QColorGroup::Button, col); - pal.setColor(QPalette::Inactive, QColorGroup::Button, col); - pal.setColor(QPalette::Normal, QColorGroup::Button, col); - pal.setColor(QPalette::Disabled, QColorGroup::Button, col); - this->setPalette(pal); + BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) + : BluetoothBase( parent, name, fl ) { - readConfig(); - initGui(); -} -/** + QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); + QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); + + QPalette pal = this->palette(); + QColor col = pal.color(QPalette::Active, QColorGroup::Background); + pal.setColor(QPalette::Active, QColorGroup::Button, col); + pal.setColor(QPalette::Inactive, QColorGroup::Button, col); + pal.setColor(QPalette::Normal, QColorGroup::Button, col); + pal.setColor(QPalette::Disabled, QColorGroup::Button, col); + this->setPalette(pal); + + readConfig(); + initGui(); + } + +/** * Reads all options from the config file */ -void BlueBase::readConfig() { + void BlueBase::readConfig() { - Config cfg("bluetoothmanager"); - cfg.setGroup("bluezsettings"); - + Config cfg("bluetoothmanager"); + cfg.setGroup("bluezsettings"); - deviceName = cfg.readEntry("name", "No name"); // name the device should identify with - defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak - useEncryption = cfg.readNumEntry("useEncryption", 1); - enableAuthentification = cfg.readNumEntry("enableAuthentification", 1); - enablePagescan = cfg.readNumEntry("enablePagescan",1); - enableInquiryscan = cfg.readNumEntry("enableInquiryscan", 1); -} + deviceName = cfg.readEntry("name", "No name"); // name the device should identify with + defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak + useEncryption = cfg.readNumEntry("useEncryption", 1); + enableAuthentification = cfg.readNumEntry("enableAuthentification", 1); + enablePagescan = cfg.readNumEntry("enablePagescan",1); + enableInquiryscan = cfg.readNumEntry("enableInquiryscan", 1); + + } /** * Writes all options to the config file */ -void BlueBase::writeConfig() { - + void BlueBase::writeConfig() { - Config cfg("bluetoothmanager"); - cfg.setGroup("bluezsettings"); - - cfg.writeEntry("name", deviceName); - cfg.writeEntryCrypt("passkey", defaultPasskey); - cfg.writeEntry("useEncryption", useEncryption); - cfg.writeEntry("enableAuthentification", enableAuthentification); - cfg.writeEntry("enablePagescan",enablePagescan); - cfg.writeEntry("enableInquiryscan", enableInquiryscan); + Config cfg("bluetoothmanager"); + cfg.setGroup("bluezsettings"); + cfg.writeEntry("name", deviceName); + cfg.writeEntryCrypt("passkey", defaultPasskey); + cfg.writeEntry("useEncryption", useEncryption); + cfg.writeEntry("enableAuthentification", enableAuthentification); + cfg.writeEntry("enablePagescan",enablePagescan); + cfg.writeEntry("enableInquiryscan", enableInquiryscan); } /** - * Set up the gui + * Set up the gui */ -void BlueBase::initGui() { + void BlueBase::initGui() { - StatusLabel->setText(getStatus()); // maybe move it to getStatus() - - cryptCheckBox->setChecked(useEncryption); - authCheckBox->setChecked(enableAuthentification); - pagescanCheckBox->setChecked(enablePagescan); - inquiryscanCheckBox->setChecked(enableInquiryscan); - deviceNameLine->setText(deviceName); - passkeyLine->setText(defaultPasskey); + StatusLabel->setText(getStatus()); // maybe move it to getStatus() + cryptCheckBox->setChecked(useEncryption); + authCheckBox->setChecked(enableAuthentification); + pagescanCheckBox->setChecked(enablePagescan); + inquiryscanCheckBox->setChecked(enableInquiryscan); + deviceNameLine->setText(deviceName); + passkeyLine->setText(defaultPasskey); } @@ -117,49 +118,48 @@ void BlueBase::initGui() { * Get the status informations and returns it * @return QString the status informations gathered */ -QString BlueBase::getStatus(){ + QString BlueBase::getStatus(){ - return ("manger.h need also a status method"); + return ("manger.h need also a status method"); -} + } /** * Read the current values from the gui and invoke writeConfig() */ -void BlueBase::applyConfigChanges() { + void BlueBase::applyConfigChanges() { - deviceName = deviceNameLine->text(); - defaultPasskey = passkeyLine->text(); - useEncryption = cryptCheckBox->isChecked(); - enableAuthentification = authCheckBox->isChecked(); - enablePagescan = pagescanCheckBox->isChecked(); - enableInquiryscan = inquiryscanCheckBox->isChecked(); + deviceName = deviceNameLine->text(); + defaultPasskey = passkeyLine->text(); + useEncryption = cryptCheckBox->isChecked(); + enableAuthentification = authCheckBox->isChecked(); + enablePagescan = pagescanCheckBox->isChecked(); + enableInquiryscan = inquiryscanCheckBox->isChecked(); - writeConfig(); + writeConfig(); - QMessageBox* box = new QMessageBox(this, "Test"); - box->setText(tr("Changes applied")); - box->show(); + QMessageBox* box = new QMessageBox(this, "Test"); + box->setText(tr("Changes applied")); + box->show(); // falls nötig hcid killhupen - die funktionalität adden - - } /** * Open the "scan for devices" dialog */ -void BlueBase::startScan() { - ScanDialog *scan = new ScanDialog( this, "", true); - scan->exec(); -} + void BlueBase::startScan() { + ScanDialog *scan = new ScanDialog( this, "", true); + scan->exec(); + } /** * Decontructor */ -BlueBase::~BlueBase(){ -} + BlueBase::~BlueBase(){ + } +} diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index fb1844c..023af7a 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h @@ -18,39 +18,41 @@ class QPushButton; class QTabWidget; class QCheckBox; -class BlueBase : public BluetoothBase { - Q_OBJECT +namespace OpieTooth { -public: - BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - ~BlueBase(); + class BlueBase : public BluetoothBase { + Q_OBJECT -protected: + public: + BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~BlueBase(); + protected: - private slots: - void startScan(); - private: + private slots: + void startScan(); + + private: void readConfig(); void writeConfig(); QString getStatus(); void initGui(); - + QString deviceName; QString defaultPasskey; int useEncryption; int enableAuthentification; int enablePagescan; - int enableInquiryscan; - + int enableInquiryscan; + private slots: - - void applyConfigChanges(); -}; + void applyConfigChanges(); + }; +} #endif diff --git a/noncore/net/opietooth/manager/main.cpp b/noncore/net/opietooth/manager/main.cpp index d566419..a86e36d 100644 --- a/noncore/net/opietooth/manager/main.cpp +++ b/noncore/net/opietooth/manager/main.cpp @@ -20,17 +20,19 @@ #include "bluebase.h" #include + QPEApplication *BluetoothApp; int main( int argc, char ** argv ) { QPEApplication a(argc, argv); BluetoothApp=&a; - BlueBase t; + OpieTooth::BlueBase t; - t.setCaption( BlueBase::tr("Bluetooth Manager") ); + // t.setCaption( OpieTooth::BlueBase::tr("Bluetooth Manager") ); a.showMainWidget(&t); return a.exec(); } + diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index c369eba..5f0a62c 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro @@ -1,12 +1,12 @@ TEMPLATE = app #CONFIG = qt warn_on debug CONFIG = qt warn_on release -HEADERS = bluebase.h -SOURCES = main.cpp bluebase.cpp +HEADERS = bluebase.h scandialog.h +SOURCES = main.cpp bluebase.cpp scandialog.cpp INCLUDEPATH += $(OPIEDIR)/include INCLUDEPATH += $(OPIEDIR)/noncore/opietooth/lib DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopietooth -INTERFACES = bluetoothbase.ui devicedialog.ui scandialog.ui +INTERFACES = bluetoothbase.ui devicedialog.ui TARGET = $(OPIEDIR)/bin/bluetooth-manager diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp new file mode 100644 index 0000000..3ddba3e --- a/dev/null +++ b/noncore/net/opietooth/manager/scandialog.cpp @@ -0,0 +1,113 @@ +/* main.cpp + * + * --------------------- + * + * copyright : (c) 2002 by Maximilian Reiß + * email : max.reiss@gmx.de + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "scandialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +namespace OpieTooth { + +/* + + */ + ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) { + + if ( !name ) + setName( "ScanDialog" ); + resize( 360, 392 ); + setCaption( tr( "Scan for devices" ) ); + + Frame7 = new QFrame( this, "Frame7" ); + Frame7->setGeometry( QRect( 0, 0, 240, 331 ) ); + Frame7->setFrameShape( QFrame::StyledPanel ); + Frame7->setFrameShadow( QFrame::Raised ); + + QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" ); + privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 310 ) ); + Layout11 = new QGridLayout( privateLayoutWidget ); + Layout11->setSpacing( 6 ); + Layout11->setMargin( 0 ); + + + TextLabel10 = new QLabel( privateLayoutWidget, "TextLabel10" ); + TextLabel10->setText( tr( "ersetzen durch qprogressbar" ) ); + + Layout11->addMultiCellWidget( TextLabel10, 1, 1, 0, 1 ); + + StartButton = new QPushButton( privateLayoutWidget, "PushButton13" ); + StartButton->setText( tr( "Start" ) ); + + Layout11->addWidget( StartButton, 2, 0 ); + + PushButton6 = new QPushButton( privateLayoutWidget, "PushButton6" ); + PushButton6->setText( tr( "Stop" ) ); + + Layout11->addWidget( PushButton6, 2, 1 ); + + ListView1 = new QListView( privateLayoutWidget, "ListView1" ); + + // ListView1->addColumn( tr( "In List" ) ); + ListView1->addColumn( tr( "Device Name" ) ); + //ListView1->addColumn( tr( "Type" ) ); + + Layout11->addMultiCellWidget( ListView1, 0, 0, 0, 1 ); + + connect( (QObject*)StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); + connect( (QObject*)localDevice, SIGNAL( foundDevices( const QString& , RemoteDevices::ValueList ) ), + this, SLOT(fillList(const QString& , RemoteDevices::ValueList ) ) ) ; + } + + void ScanDialog::startSearch() { + // read it from config later + localDevice = new Manager( "hci0" ); + localDevice->searchDevices(); + } + + + void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) { + + + RemoteDevices::ValueList::Iterator it; + for( it = deviceList.begin(); it != deviceList.end(); ++it ) { + + + } + } + +/* + * Cleanup + */ + ScanDialog::~ScanDialog() { + delete localDevice; + } + +} diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h new file mode 100644 index 0000000..5cebb11 --- a/dev/null +++ b/noncore/net/opietooth/manager/scandialog.h @@ -0,0 +1,71 @@ +/* main.cpp + * + * copyright : (c) 2002 by Maximilian Reiß + * email : max.reiss@gmx.de + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef SCANDIALOG_H +#define SCANDIALOG_H + +#include +#include + + +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QFrame; +class QLabel; +class QListView; +class QListViewItem; +class QPushButton; + +class Manager; +class Device; + + +namespace OpieTooth { + + + + class ScanDialog : public QDialog { + Q_OBJECT + + public: + ScanDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~ScanDialog(); + + QFrame* Frame7; + QLabel* TextLabel10; + QPushButton* StartButton; + QPushButton* PushButton6; + QListView* ListView1; + + + protected: + QGridLayout* Layout11; + + private slots: + void startSearch(); + void fillList(const QString& device, RemoteDevices::ValueList list); + + private: + + Manager *localDevice; + }; + +} + +#endif // SCANDIALOG_H diff --git a/noncore/net/opietooth/manager/scandialog.ui b/noncore/net/opietooth/manager/scandialog.ui deleted file mode 100644 index 37847ba..0000000 --- a/noncore/net/opietooth/manager/scandialog.ui +++ b/dev/null @@ -1,155 +0,0 @@ - -ScanDialog - - QDialog - - name - ScanDialog - - - geometry - - 0 - 0 - 360 - 392 - - - - caption - Form3 - - - QFrame - - name - Frame7 - - - geometry - - 0 - 0 - 240 - 331 - - - - frameShape - StyledPanel - - - frameShadow - Raised - - - QLayoutWidget - - name - Layout11 - - - geometry - - 10 - 9 - 221 - 310 - - - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - TextLabel10 - - - text - ersetzen durch qprogressbar - - - - QPushButton - - name - PushButton13 - - - text - Start - - - - QPushButton - - name - PushButton6 - - - text - Stop - - - - QListView - - - text - In List - - - clickable - true - - - resizeable - true - - - - - text - Device Name - - - clickable - true - - - resizeable - true - - - - - text - Type - - - clickable - true - - - resizeable - true - - - - name - ListView1 - - - - - - - -- cgit v0.9.0.2