summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-06-15 21:29:57 (UTC)
committer harlekin <harlekin>2002-06-15 21:29:57 (UTC)
commit8ab6f33e6bd35266bed38952f149a328bea3c544 (patch) (unidiff)
treeaee29787d61e58c6a8b345de40acaf36d0fdc424
parente7712c9535a461c6f5f98e78b856af0bb9eca0c6 (diff)
downloadopie-8ab6f33e6bd35266bed38952f149a328bea3c544.zip
opie-8ab6f33e6bd35266bed38952f149a328bea3c544.tar.gz
opie-8ab6f33e6bd35266bed38952f149a328bea3c544.tar.bz2
update
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp7
-rw-r--r--noncore/net/opietooth/manager/scandialog.h2
2 files changed, 3 insertions, 6 deletions
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp
index b0ffbb3..63c5472 100644
--- a/noncore/net/opietooth/manager/scandialog.cpp
+++ b/noncore/net/opietooth/manager/scandialog.cpp
@@ -22,115 +22,112 @@
22#include <qheader.h> 22#include <qheader.h>
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qlistview.h> 24#include <qlistview.h>
25#include <qpushbutton.h> 25#include <qpushbutton.h>
26#include <qlayout.h> 26#include <qlayout.h>
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 31
32#include <manager.h> 32#include <manager.h>
33#include <device.h> 33#include <device.h>
34#include <remotedevice.h> 34#include <remotedevice.h>
35 35
36 36
37namespace OpieTooth { 37namespace OpieTooth {
38 38
39/* 39/*
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
55 QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" ); 54 QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" );
56 privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 280 ) ); 55 privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 280 ) );
57 Layout11 = new QVBoxLayout( privateLayoutWidget ); 56 Layout11 = new QVBoxLayout( privateLayoutWidget );
58 Layout11->setSpacing( 6 ); 57 Layout11->setSpacing( 6 );
59 Layout11->setMargin( 0 ); 58 Layout11->setMargin( 0 );
60 59
61
62 progress = new QProgressBar(privateLayoutWidget, "progbar"); 60 progress = new QProgressBar(privateLayoutWidget, "progbar");
63 progress->setTotalSteps(20); 61 progress->setTotalSteps(20);
64 62
65 63 QFrame *buttonFrame = new QFrame(Frame7, "");
66 QFrame *buttonFrame = new QFrame(Frame7, "");
67 64
68 StartButton = new QPushButton( buttonFrame, "StartButton" ); 65 StartButton = new QPushButton( buttonFrame, "StartButton" );
69 StartButton->setText( tr( "Start" ) ); 66 StartButton->setText( tr( "Start" ) );
70 67
71 StopButton = new QPushButton( buttonFrame, "StopButton" ); 68 StopButton = new QPushButton( buttonFrame, "StopButton" );
72 StopButton->setText( tr( "Cancel" ) ); 69 StopButton->setText( tr( "Cancel" ) );
73 70
74
75 QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame); 71 QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame);
76 buttonLayout->addWidget(StartButton); 72 buttonLayout->addWidget(StartButton);
77 buttonLayout->addWidget(StopButton); 73 buttonLayout->addWidget(StopButton);
78 74
79 ListView1 = new QListView( privateLayoutWidget, "ListView1" ); 75 ListView1 = new QListView( privateLayoutWidget, "ListView1" );
80 76
81 ListView1->addColumn( tr( "Add" ) ); 77 ListView1->addColumn( tr( "Add" ) );
82 ListView1->addColumn( tr( "Device Name" ) ); 78 ListView1->addColumn( tr( "Device Name" ) );
83 //ListView1->addColumn( tr( "Type" ) ); 79 //ListView1->addColumn( tr( "Type" ) );
84 80
85 Layout11->addWidget( ListView1); 81 Layout11->addWidget( ListView1);
86 Layout11->addWidget(progress); 82 Layout11->addWidget(progress);
87 Layout11->addWidget( buttonFrame); 83 Layout11->addWidget( buttonFrame);
88 84
89 localDevice = new Manager( "hci0" ); 85 localDevice = new Manager( "hci0" );
90 86
91 connect( (QObject*)StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); 87 connect( (QObject*)StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) );
92 connect( (QObject*)StopButton, SIGNAL( clicked() ), this, SLOT( stopSearch() ) ); 88 connect( (QObject*)StopButton, SIGNAL( clicked() ), this, SLOT( stopSearch() ) );
93 connect( (QObject*)localDevice, SIGNAL( foundDevices( const QString& , RemoteDevices::ValueList ) ), 89 connect( (QObject*)localDevice, SIGNAL( foundDevices( const QString& , RemoteDevices::ValueList ) ),
94 this, SLOT(fillList(const QString& , RemoteDevices::ValueList ) ) ) ; 90 this, SLOT(fillList(const QString& , RemoteDevices::ValueList ) ) ) ;
95 progressStat = 0; 91 progressStat = 0;
96 } 92 }
97 93
98// hack, make cleaner later 94// hack, make cleaner later
99 void ScanDialog::progressTimer() { 95 void ScanDialog::progressTimer() {
100 96
101 progressStat++; 97 progressStat++;
102 if (progressStat++ < 20) { 98 if (progressStat++ < 20) {
103 QTimer::singleShot( 1000, this, SLOT(progressTimer() ) ); 99 QTimer::singleShot( 1000, this, SLOT(progressTimer() ) );
104 } 100 }
101 progress->setProgress(progressStat++);
105 102
106 } 103 }
107 104
108 void ScanDialog::startSearch() { 105 void ScanDialog::startSearch() {
109 progress->setProgress(0); 106 progress->setProgress(0);
110 progressStat = 0; 107 progressStat = 0;
111 108
112 progressTimer(); 109 progressTimer();
113 // when finished, it emmite foundDevices() 110 // when finished, it emmite foundDevices()
114 // checken ob initialisiert , qcop ans applet. 111 // checken ob initialisiert , qcop ans applet.
115 localDevice->searchDevices(); 112 localDevice->searchDevices();
116 113
117 } 114 }
118 115
119 void ScanDialog::stopSearch() { 116 void ScanDialog::stopSearch() {
120 117
121 } 118 }
122 119
123 void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) { 120 void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) {
124 121
125 QListViewItem * deviceItem; 122 QListViewItem * deviceItem;
126 123
127 RemoteDevices::ValueList::Iterator it; 124 RemoteDevices::ValueList::Iterator it;
128 for( it = deviceList.begin(); it != deviceList.end(); ++it ) { 125 for( it = deviceList.begin(); it != deviceList.end(); ++it ) {
129 126
130 deviceItem = new QListViewItem( ListView1, (*it).name() ); 127 deviceItem = new QListViewItem( ListView1, (*it).name() );
131 } 128 }
132 } 129 }
133 130
134/* 131/*
135 * Cleanup 132 * Cleanup
136 */ 133 */
diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h
index 22ee01d..fcaee6e 100644
--- a/noncore/net/opietooth/manager/scandialog.h
+++ b/noncore/net/opietooth/manager/scandialog.h
@@ -31,43 +31,43 @@ class QLabel;
31class QListView; 31class QListView;
32class QListViewItem; 32class QListViewItem;
33class QPushButton; 33class QPushButton;
34class QProgressBar; 34class QProgressBar;
35 35
36 36
37namespace OpieTooth { 37namespace OpieTooth {
38 38
39 39
40class Manager; 40class Manager;
41class Device; 41class 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 QVBoxLayout* 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 progressTimer();
63 void fillList(const QString& device, RemoteDevices::ValueList list); 64 void fillList(const QString& device, RemoteDevices::ValueList list);
64 65
65 private: 66 private:
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