summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/scandialog.cpp
blob: 3ddba3ecf424fe0755232a9aa96b3db74f0770ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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 <qframe.h>
#include <qheader.h>
#include <qlabel.h>
#include <qlistview.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>

#include <manager.h>
#include <device.h>
#include <remotedevice.h>


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;
    }

}