-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 { BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) : BluetoothBase( parent, name, fl ) { 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); + setCaption( tr( "Bluetooth Manager" ) ); + readConfig(); initGui(); } /** * Reads all options from the config file */ void BlueBase::readConfig() { 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); @@ -139,27 +141,27 @@ namespace OpieTooth { writeConfig(); 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(); + scan->showMaximized(); } /** * Decontructor */ BlueBase::~BlueBase(){ } } 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 { */ ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "ScanDialog" ); resize( 240, 320 ); 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 ); + privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 280 ) ); + Layout11 = new QVBoxLayout( privateLayoutWidget ); Layout11->setSpacing( 6 ); Layout11->setMargin( 0 ); progress = new QProgressBar(privateLayoutWidget, "progbar"); progress->setTotalSteps(20); - //Layout11->addMultiCellWidget( progress, 1, 1, 0, 1 ); - Layout11->addWidget(progress, 2, 2); - StartButton = new QPushButton( privateLayoutWidget, "StartButton" ); + QFrame *buttonFrame = new QFrame(Frame7, ""); + + StartButton = new QPushButton( buttonFrame, "StartButton" ); StartButton->setText( tr( "Start" ) ); - Layout11->addWidget( StartButton, 2, 0 ); - - StopButton = new QPushButton( privateLayoutWidget, "StopButton" ); + StopButton = new QPushButton( buttonFrame, "StopButton" ); StopButton->setText( tr( "Cancel" ) ); - Layout11->addWidget( StopButton, 2, 1 ); + + QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame); + buttonLayout->addWidget(StartButton); + buttonLayout->addWidget(StopButton); ListView1 = new QListView( privateLayoutWidget, "ListView1" ); ListView1->addColumn( tr( "Add" ) ); ListView1->addColumn( tr( "Device Name" ) ); //ListView1->addColumn( tr( "Type" ) ); - Layout11->addMultiCellWidget( ListView1, 0, 0, 0, 1 ); + Layout11->addWidget( ListView1); + Layout11->addWidget(progress); + Layout11->addWidget( buttonFrame); + + localDevice = new Manager( "hci0" ); connect( (QObject*)StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); connect( (QObject*)StopButton, SIGNAL( clicked() ), this, SLOT( stopSearch() ) ); connect( (QObject*)localDevice, SIGNAL( foundDevices( const QString& , RemoteDevices::ValueList ) ), this, SLOT(fillList(const QString& , RemoteDevices::ValueList ) ) ) ; progressStat = 0; } // hack, make cleaner later void ScanDialog::progressTimer(int maxSeconds) { progressStat++; if (progressStat++ < maxSeconds) { QTimer::singleShot( 1000, this, SLOT(progressTimer ) ); } } void ScanDialog::startSearch() { progress->setProgress(0); progressStat = 0; - // read it from config later - localDevice = new Manager( "hci0" ); + progressTimer(20); // when finished, it emmite foundDevices() // checken ob initialisiert , qcop ans applet. localDevice->searchDevices(); progress->setProgress(20); } void ScanDialog::stopSearch() { } void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) { QListViewItem * deviceItem; 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; class ScanDialog : public QDialog { Q_OBJECT public: ScanDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~ScanDialog(); QFrame* Frame7; QProgressBar* progress; QPushButton* StartButton; QPushButton* StopButton; QListView* ListView1; protected: - QGridLayout* Layout11; + QVBoxLayout* Layout11; private slots: void stopSearch(); void startSearch(); void fillList(const QString& device, RemoteDevices::ValueList list); private: void progressTimer(int maxSeconds); Manager *localDevice; int progressStat; }; } #endif // SCANDIALOG_H |