summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-02-23 17:13:49 (UTC)
committer mickeyl <mickeyl>2003-02-23 17:13:49 (UTC)
commit9f24ae5ae12aa1eb0f974b072d46868ba048e65d (patch) (unidiff)
tree85d9e671fe060ebec2bf7f04ab69ca96d8029741
parent2f897267b4d3ec5b1c7dafdc0700a8e91cbb3321 (diff)
downloadopie-9f24ae5ae12aa1eb0f974b072d46868ba048e65d.zip
opie-9f24ae5ae12aa1eb0f974b072d46868ba048e65d.tar.gz
opie-9f24ae5ae12aa1eb0f974b072d46868ba048e65d.tar.bz2
insert demo menu - useful, if you don't have wireless stuff yet but want
to show this program to someone...
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp25
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.h1
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h1
3 files changed, 21 insertions, 6 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index b2d3a71..2d5ecd2 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -1,161 +1,174 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "configwindow.h" 16#include "configwindow.h"
17#include "mainwindow.h" 17#include "mainwindow.h"
18#include "wellenreiter.h" 18#include "wellenreiter.h"
19 19
20#include "scanlist.h"
21
20#include <qcombobox.h> 22#include <qcombobox.h>
21#include <qiconset.h> 23#include <qiconset.h>
22#include <qmenubar.h> 24#include <qmenubar.h>
23#include <qpopupmenu.h> 25#include <qpopupmenu.h>
24#include <qstatusbar.h> 26#include <qstatusbar.h>
25#include <qtoolbutton.h> 27#include <qtoolbutton.h>
26 28
27#ifdef QWS 29#ifdef QWS
28#include <qpe/resource.h> 30#include <qpe/resource.h>
29#else 31#else
30#include "resource.h" 32#include "resource.h"
31#endif 33#endif
32 34
33WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) 35WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f )
34 :QMainWindow( parent, name, f ) 36 :QMainWindow( parent, name, f )
35{ 37{
36 cw = new WellenreiterConfigWindow( this ); 38 cw = new WellenreiterConfigWindow( this );
37 mw = new Wellenreiter( this ); 39 mw = new Wellenreiter( this );
38 mw->setConfigWindow( cw ); 40 mw->setConfigWindow( cw );
39 setCentralWidget( mw ); 41 setCentralWidget( mw );
40 42
41 // setup icon sets 43 // setup icon sets
42 44
43 infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); 45 infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) );
44 settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); 46 settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) );
45 #ifdef QWS 47 #ifdef QWS
46 searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); 48 searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) );
47 cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); 49 cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) );
48 #else 50 #else
49 startStopIconSet = new QIconSet(); 51 startStopIconSet = new QIconSet();
50 startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/SearchIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off ); 52 startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/SearchIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off );
51 startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/CancelIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::On ); 53 startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/CancelIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::On );
52 #endif 54 #endif
53 55
54 // setup tool buttons 56 // setup tool buttons
55 57
56 startStopButton = new QToolButton( 0 ); 58 startStopButton = new QToolButton( 0 );
57 startStopButton->setAutoRaise( true ); 59 startStopButton->setAutoRaise( true );
58 #ifdef QWS 60 #ifdef QWS
59 startStopButton->setOnIconSet( *cancelIconSet ); 61 startStopButton->setOnIconSet( *cancelIconSet );
60 startStopButton->setOffIconSet( *searchIconSet ); 62 startStopButton->setOffIconSet( *searchIconSet );
61 #else 63 #else
62 startStopButton->setIconSet( *startStopIconSet ); 64 startStopButton->setIconSet( *startStopIconSet );
63 #endif 65 #endif
64 startStopButton->setToggleButton( true ); 66 startStopButton->setToggleButton( true );
65 connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); 67 connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) );
66 startStopButton->setEnabled( false ); 68 startStopButton->setEnabled( false );
67 69
68 QToolButton* c = new QToolButton( 0 ); 70 QToolButton* c = new QToolButton( 0 );
69 c->setAutoRaise( true ); 71 c->setAutoRaise( true );
70 c->setIconSet( *infoIconSet ); 72 c->setIconSet( *infoIconSet );
71 c->setEnabled( false ); 73 c->setEnabled( false );
72 74
73 QToolButton* d = new QToolButton( 0 ); 75 QToolButton* d = new QToolButton( 0 );
74 d->setAutoRaise( true ); 76 d->setAutoRaise( true );
75 d->setIconSet( *settingsIconSet ); 77 d->setIconSet( *settingsIconSet );
76 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); 78 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) );
77 79
78 // setup menu bar 80 // setup menu bar
79 81
80 QMenuBar* mb = menuBar(); 82 QMenuBar* mb = menuBar();
81 83
82 QPopupMenu* file = new QPopupMenu( mb ); 84 QPopupMenu* file = new QPopupMenu( mb );
83 file->insertItem( "&Load" ); 85 file->insertItem( "&Load..." );
84 file->insertItem( "&Save" ); 86 file->insertItem( "&Save..." );
85 87
86 QPopupMenu* view = new QPopupMenu( mb ); 88 QPopupMenu* view = new QPopupMenu( mb );
87 view->insertItem( "&Configure" ); 89 view->insertItem( "&Configure..." );
88 90
89 QPopupMenu* sniffer = new QPopupMenu( mb ); 91 QPopupMenu* sniffer = new QPopupMenu( mb );
90 sniffer->insertItem( "&Configure" ); 92 sniffer->insertItem( "&Configure..." );
91 sniffer->insertSeparator(); 93 sniffer->insertSeparator();
92 94
93 int id; 95 QPopupMenu* demo = new QPopupMenu( mb );
96 demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) );
94 97
98 int id;
95 id = mb->insertItem( "&File", file ); 99 id = mb->insertItem( "&File", file );
96 mb->setItemEnabled( id, false ); 100 mb->setItemEnabled( id, false );
97 id = mb->insertItem( "&View", view ); 101 id = mb->insertItem( "&View", view );
98 mb->setItemEnabled( id, false ); 102 mb->setItemEnabled( id, false );
99 id = mb->insertItem( "&Sniffer", sniffer ); 103 id = mb->insertItem( "&Sniffer", sniffer );
100 mb->setItemEnabled( id, false ); 104 mb->setItemEnabled( id, false );
105 id = mb->insertItem( "&Demo", demo );
106 mb->setItemEnabled( id, true );
101 107
102 #ifdef QWS 108 #ifdef QWS
103 mb->insertItem( startStopButton ); 109 mb->insertItem( startStopButton );
104 mb->insertItem( c ); 110 mb->insertItem( c );
105 mb->insertItem( d ); 111 mb->insertItem( d );
106 #else // Qt3 changed the insertion order. It's now totally random :( 112 #else // Qt3 changed the insertion order. It's now totally random :(
107 mb->insertItem( d ); 113 mb->insertItem( d );
108 mb->insertItem( c ); 114 mb->insertItem( c );
109 mb->insertItem( startStopButton ); 115 mb->insertItem( startStopButton );
110 #endif 116 #endif
111 117
112 // setup status bar (for now only on X11) 118 // setup status bar (for now only on X11)
113 119
114 #ifndef QWS 120 #ifndef QWS
115 statusBar()->message( "Ready." ); 121 statusBar()->message( "Ready." );
116 #endif 122 #endif
117 123
118}; 124};
119 125
120void WellenreiterMainWindow::showConfigure() 126void WellenreiterMainWindow::showConfigure()
121{ 127{
122 qDebug( "show configure..." ); 128 qDebug( "show configure..." );
123 cw->setCaption( tr( "Configure" ) ); 129 cw->setCaption( tr( "Configure" ) );
124 #ifdef QWS 130 #ifdef QWS
125 cw->showMaximized(); 131 cw->showMaximized();
126 #endif 132 #endif
127 int result = cw->exec(); 133 int result = cw->exec();
128 134
129 if ( result ) 135 if ( result )
130 { 136 {
131 // check configuration from config window 137 // check configuration from config window
132 138
133 const QString& interface = cw->interfaceName->currentText(); 139 const QString& interface = cw->interfaceName->currentText();
134 const int cardtype = cw->daemonDeviceType(); 140 const int cardtype = cw->daemonDeviceType();
135 const int interval = cw->daemonHopInterval(); 141 const int interval = cw->daemonHopInterval();
136 142
137 if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) 143 if ( ( interface != "<select>" ) && ( cardtype != 0 ) )
138 startStopButton->setEnabled( true ); 144 startStopButton->setEnabled( true );
139 //TODO ... 145 //TODO ...
140 else 146 else
141 startStopButton->setEnabled( false ); 147 startStopButton->setEnabled( false );
142 //TODO ... 148 //TODO ...
143 } 149 }
144} 150}
145 151
146WellenreiterMainWindow::~WellenreiterMainWindow() 152WellenreiterMainWindow::~WellenreiterMainWindow()
147{ 153{
148 154
149 delete infoIconSet; 155 delete infoIconSet;
150 delete settingsIconSet; 156 delete settingsIconSet;
151 #ifdef QWS 157 #ifdef QWS
152 delete searchIconSet; 158 delete searchIconSet;
153 delete cancelIconSet; 159 delete cancelIconSet;
154 #else 160 #else
155 delete startStopIconSet; 161 delete startStopIconSet;
156 #endif 162 #endif
157 163
158}; 164};
159 165
160 166void WellenreiterMainWindow::demoAddStations()
167{
168 mw->netView()->addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 );
169 mw->netView()->addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 );
170 mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 );
171 mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 );
172 mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 );
173}
161 174
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h
index c21841a..22c21e8 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.h
+++ b/noncore/net/wellenreiter/gui/mainwindow.h
@@ -1,50 +1,51 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef MAINWINDOW_H 16#ifndef MAINWINDOW_H
17#define MAINWINDOW_H 17#define MAINWINDOW_H
18 18
19#include <qmainwindow.h> 19#include <qmainwindow.h>
20 20
21class Wellenreiter; 21class Wellenreiter;
22class WellenreiterConfigWindow; 22class WellenreiterConfigWindow;
23class QIconSet; 23class QIconSet;
24class QToolButton; 24class QToolButton;
25 25
26class WellenreiterMainWindow: public QMainWindow 26class WellenreiterMainWindow: public QMainWindow
27{ 27{
28 Q_OBJECT 28 Q_OBJECT
29 29
30 public: 30 public:
31 WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 ); 31 WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 );
32 ~WellenreiterMainWindow(); 32 ~WellenreiterMainWindow();
33 33
34 protected: 34 protected:
35 Wellenreiter* mw; 35 Wellenreiter* mw;
36 WellenreiterConfigWindow* cw; 36 WellenreiterConfigWindow* cw;
37 37
38 QIconSet* startStopIconSet; 38 QIconSet* startStopIconSet;
39 const QIconSet* searchIconSet; 39 const QIconSet* searchIconSet;
40 const QIconSet* infoIconSet; 40 const QIconSet* infoIconSet;
41 const QIconSet* settingsIconSet; 41 const QIconSet* settingsIconSet;
42 const QIconSet* cancelIconSet; 42 const QIconSet* cancelIconSet;
43 43
44 QToolButton* startStopButton; 44 QToolButton* startStopButton;
45 45
46 public slots: 46 public slots:
47 void showConfigure(); 47 void showConfigure();
48 void demoAddStations();
48}; 49};
49 50
50#endif 51#endif
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index a55d6a1..61960d2 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -6,74 +6,75 @@
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITER_H 16#ifndef WELLENREITER_H
17#define WELLENREITER_H 17#define WELLENREITER_H
18 18
19#include "wellenreiterbase.h" 19#include "wellenreiterbase.h"
20 20
21#ifdef QWS 21#ifdef QWS
22#include <opie/odevice.h> 22#include <opie/odevice.h>
23using namespace Opie; 23using namespace Opie;
24#endif 24#endif
25 25
26// ugly... not here! 26// ugly... not here!
27 27
28#include <assert.h> 28#include <assert.h>
29#include <errno.h> 29#include <errno.h>
30#include <unistd.h> 30#include <unistd.h>
31#include <string.h> 31#include <string.h>
32#include <sys/types.h> 32#include <sys/types.h>
33#include <sys/socket.h> 33#include <sys/socket.h>
34#include <stdlib.h> 34#include <stdlib.h>
35#include <fcntl.h> 35#include <fcntl.h>
36#include <daemon/source/config.hh> 36#include <daemon/source/config.hh>
37#include <libwellenreiter/source/wl_types.hh> 37#include <libwellenreiter/source/wl_types.hh>
38#include <libwellenreiter/source/wl_sock.hh> 38#include <libwellenreiter/source/wl_sock.hh>
39#include <libwellenreiter/source/wl_proto.hh> 39#include <libwellenreiter/source/wl_proto.hh>
40 40
41class QTimerEvent; 41class QTimerEvent;
42class QPixmap; 42class QPixmap;
43class ManufacturerDB; 43class ManufacturerDB;
44class WellenreiterConfigWindow; 44class WellenreiterConfigWindow;
45 45
46class Wellenreiter : public WellenreiterBase { 46class Wellenreiter : public WellenreiterBase {
47 Q_OBJECT 47 Q_OBJECT
48 48
49 public: 49 public:
50 Wellenreiter( QWidget* parent = 0 ); 50 Wellenreiter( QWidget* parent = 0 );
51 ~Wellenreiter(); 51 ~Wellenreiter();
52 52
53 void setConfigWindow( WellenreiterConfigWindow* cw ); 53 void setConfigWindow( WellenreiterConfigWindow* cw );
54 MScanListView* netView() const { return netview; };
54 55
55 protected: 56 protected:
56 bool daemonRunning; 57 bool daemonRunning;
57 58
58 public slots: 59 public slots:
59 void dataReceived(); 60 void dataReceived();
60 void startStopClicked(); 61 void startStopClicked();
61 62
62 private: 63 private:
63 int daemon_fd; // socket filedescriptor for udp communication socket 64 int daemon_fd; // socket filedescriptor for udp communication socket
64 #ifdef QWS 65 #ifdef QWS
65 OSystem _system; // Opie Operating System identifier 66 OSystem _system; // Opie Operating System identifier
66 #endif 67 #endif
67 void handleMessage(); 68 void handleMessage();
68 69
69 ManufacturerDB* manufacturerdb; 70 ManufacturerDB* manufacturerdb;
70 WellenreiterConfigWindow* configwindow; 71 WellenreiterConfigWindow* configwindow;
71 struct sockaddr_in sockaddr; 72 struct sockaddr_in sockaddr;
72 73
73 //void readConfig(); 74 //void readConfig();
74 //void writeConfig(); 75 //void writeConfig();
75}; 76};
76 77
77 78
78 79
79#endif 80#endif