author | mickeyl <mickeyl> | 2003-02-23 18:48:17 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-02-23 18:48:17 (UTC) |
commit | a195865dfdb03b4c7c972acfc8cfd87743ab3e6f (patch) (unidiff) | |
tree | 9be601d3d82e40ea144d12027869dd9bc39a33cd | |
parent | 9f24ae5ae12aa1eb0f974b072d46868ba048e65d (diff) | |
download | opie-a195865dfdb03b4c7c972acfc8cfd87743ab3e6f.zip opie-a195865dfdb03b4c7c972acfc8cfd87743ab3e6f.tar.gz opie-a195865dfdb03b4c7c972acfc8cfd87743ab3e6f.tar.bz2 |
- write simple log
- record first seen / last seen per item
-rw-r--r-- | noncore/net/wellenreiter/gui/logwindow.cpp | 9 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/logwindow.h | 5 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 32 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlistitem.cpp | 14 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 1 |
7 files changed, 53 insertions, 13 deletions
diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp index c355f09..f132f56 100644 --- a/noncore/net/wellenreiter/gui/logwindow.cpp +++ b/noncore/net/wellenreiter/gui/logwindow.cpp | |||
@@ -3,37 +3,40 @@ | |||
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 "logwindow.h" | 16 | #include "logwindow.h" |
17 | #include <qmultilineedit.h> | 17 | #include <qmultilineedit.h> |
18 | #include <qdatetime.h> | 18 | #include <qdatetime.h> |
19 | 19 | ||
20 | MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) | 20 | MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) |
21 | :QVBox( parent, name, f ) | 21 | :QVBox( parent, name, f ) |
22 | { | 22 | { |
23 | ledit = new QMultiLineEdit( this ); | 23 | ledit = new QMultiLineEdit( this ); |
24 | 24 | ||
25 | // FIXME: Set properties( font, read-only, etc...) | 25 | // FIXME: Set properties( font, read-only, etc...) |
26 | 26 | ||
27 | }; | 27 | } |
28 | 28 | ||
29 | void MLogWindow::log( QString text ) | 29 | void MLogWindow::log( QString text ) |
30 | { | 30 | { |
31 | QTime time = QTime::currentTime(); | 31 | QTime time = QTime::currentTime(); |
32 | QString line; | 32 | QString line; |
33 | line.sprintf( "[%s] %s", (const char*) time.toString(), (const char*) text ); | 33 | line.sprintf( "[%s] %s", (const char*) time.toString(), (const char*) text ); |
34 | ledit->append( line ); | 34 | ledit->append( line ); |
35 | qDebug( line ); | 35 | qDebug( line ); |
36 | 36 | ||
37 | }; | 37 | } |
38 | |||
39 | 38 | ||
39 | const QString MLogWindow::getLog() const | ||
40 | { | ||
41 | return ledit->text(); | ||
42 | } | ||
diff --git a/noncore/net/wellenreiter/gui/logwindow.h b/noncore/net/wellenreiter/gui/logwindow.h index 325f8d0..253defa 100644 --- a/noncore/net/wellenreiter/gui/logwindow.h +++ b/noncore/net/wellenreiter/gui/logwindow.h | |||
@@ -5,34 +5,35 @@ | |||
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 LOGWINDOW_H | 16 | #ifndef LOGWINDOW_H |
17 | #define LOGWINDOW_H | 17 | #define LOGWINDOW_H |
18 | 18 | ||
19 | #include <qvbox.h> | 19 | #include <qvbox.h> |
20 | 20 | ||
21 | class QString; | 21 | class QString; |
22 | class QMultiLineEdit; | 22 | class QMultiLineEdit; |
23 | 23 | ||
24 | class MLogWindow: public QVBox | 24 | class MLogWindow: public QVBox |
25 | { | 25 | { |
26 | 26 | ||
27 | public: | 27 | public: |
28 | MLogWindow( QWidget * parent = 0, const char * name = "MLogWindow", WFlags f = 0 ); | 28 | MLogWindow( QWidget * parent = 0, const char * name = "MLogWindow", WFlags f = 0 ); |
29 | 29 | ||
30 | void log( QString text ); | 30 | void log( QString text ); |
31 | 31 | const QString getLog() const; | |
32 | |||
32 | protected: | 33 | protected: |
33 | QMultiLineEdit* ledit; | 34 | QMultiLineEdit* ledit; |
34 | 35 | ||
35 | }; | 36 | }; |
36 | 37 | ||
37 | #endif | 38 | #endif |
38 | 39 | ||
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 2d5ecd2..cb003dd 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -1,50 +1,53 @@ | |||
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 "logwindow.h" | ||
17 | #include "mainwindow.h" | 18 | #include "mainwindow.h" |
18 | #include "wellenreiter.h" | 19 | #include "wellenreiter.h" |
19 | 20 | ||
20 | #include "scanlist.h" | 21 | #include "scanlist.h" |
21 | 22 | ||
22 | #include <qcombobox.h> | 23 | #include <qcombobox.h> |
24 | #include <qfile.h> | ||
23 | #include <qiconset.h> | 25 | #include <qiconset.h> |
24 | #include <qmenubar.h> | 26 | #include <qmenubar.h> |
25 | #include <qpopupmenu.h> | 27 | #include <qpopupmenu.h> |
26 | #include <qstatusbar.h> | 28 | #include <qstatusbar.h> |
29 | #include <qtextstream.h> | ||
27 | #include <qtoolbutton.h> | 30 | #include <qtoolbutton.h> |
28 | 31 | ||
29 | #ifdef QWS | 32 | #ifdef QWS |
30 | #include <qpe/resource.h> | 33 | #include <qpe/resource.h> |
31 | #else | 34 | #else |
32 | #include "resource.h" | 35 | #include "resource.h" |
33 | #endif | 36 | #endif |
34 | 37 | ||
35 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) | 38 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) |
36 | :QMainWindow( parent, name, f ) | 39 | :QMainWindow( parent, name, f ) |
37 | { | 40 | { |
38 | cw = new WellenreiterConfigWindow( this ); | 41 | cw = new WellenreiterConfigWindow( this ); |
39 | mw = new Wellenreiter( this ); | 42 | mw = new Wellenreiter( this ); |
40 | mw->setConfigWindow( cw ); | 43 | mw->setConfigWindow( cw ); |
41 | setCentralWidget( mw ); | 44 | setCentralWidget( mw ); |
42 | 45 | ||
43 | // setup icon sets | 46 | // setup icon sets |
44 | 47 | ||
45 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); | 48 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); |
46 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); | 49 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); |
47 | #ifdef QWS | 50 | #ifdef QWS |
48 | searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); | 51 | searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); |
49 | cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); | 52 | cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); |
50 | #else | 53 | #else |
@@ -58,67 +61,71 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
58 | startStopButton = new QToolButton( 0 ); | 61 | startStopButton = new QToolButton( 0 ); |
59 | startStopButton->setAutoRaise( true ); | 62 | startStopButton->setAutoRaise( true ); |
60 | #ifdef QWS | 63 | #ifdef QWS |
61 | startStopButton->setOnIconSet( *cancelIconSet ); | 64 | startStopButton->setOnIconSet( *cancelIconSet ); |
62 | startStopButton->setOffIconSet( *searchIconSet ); | 65 | startStopButton->setOffIconSet( *searchIconSet ); |
63 | #else | 66 | #else |
64 | startStopButton->setIconSet( *startStopIconSet ); | 67 | startStopButton->setIconSet( *startStopIconSet ); |
65 | #endif | 68 | #endif |
66 | startStopButton->setToggleButton( true ); | 69 | startStopButton->setToggleButton( true ); |
67 | connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); | 70 | connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); |
68 | startStopButton->setEnabled( false ); | 71 | startStopButton->setEnabled( false ); |
69 | 72 | ||
70 | QToolButton* c = new QToolButton( 0 ); | 73 | QToolButton* c = new QToolButton( 0 ); |
71 | c->setAutoRaise( true ); | 74 | c->setAutoRaise( true ); |
72 | c->setIconSet( *infoIconSet ); | 75 | c->setIconSet( *infoIconSet ); |
73 | c->setEnabled( false ); | 76 | c->setEnabled( false ); |
74 | 77 | ||
75 | QToolButton* d = new QToolButton( 0 ); | 78 | QToolButton* d = new QToolButton( 0 ); |
76 | d->setAutoRaise( true ); | 79 | d->setAutoRaise( true ); |
77 | d->setIconSet( *settingsIconSet ); | 80 | d->setIconSet( *settingsIconSet ); |
78 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | 81 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); |
79 | 82 | ||
80 | // setup menu bar | 83 | // setup menu bar |
81 | 84 | ||
85 | int id; | ||
86 | |||
82 | QMenuBar* mb = menuBar(); | 87 | QMenuBar* mb = menuBar(); |
83 | 88 | ||
89 | QPopupMenu* fileSave = new QPopupMenu( mb ); | ||
90 | fileSave->insertItem( "&Log", this, SLOT( fileSaveLog() ) ); | ||
91 | |||
84 | QPopupMenu* file = new QPopupMenu( mb ); | 92 | QPopupMenu* file = new QPopupMenu( mb ); |
85 | file->insertItem( "&Load..." ); | 93 | id = file->insertItem( "&Load" ); |
86 | file->insertItem( "&Save..." ); | 94 | file->setItemEnabled( id, false ); |
95 | file->insertItem( "&Save", fileSave ); | ||
87 | 96 | ||
88 | QPopupMenu* view = new QPopupMenu( mb ); | 97 | QPopupMenu* view = new QPopupMenu( mb ); |
89 | view->insertItem( "&Configure..." ); | 98 | view->insertItem( "&Configure..." ); |
90 | 99 | ||
91 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 100 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
92 | sniffer->insertItem( "&Configure..." ); | 101 | sniffer->insertItem( "&Configure..." ); |
93 | sniffer->insertSeparator(); | 102 | sniffer->insertSeparator(); |
94 | 103 | ||
95 | QPopupMenu* demo = new QPopupMenu( mb ); | 104 | QPopupMenu* demo = new QPopupMenu( mb ); |
96 | demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); | 105 | demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); |
97 | 106 | ||
98 | int id; | ||
99 | id = mb->insertItem( "&File", file ); | 107 | id = mb->insertItem( "&File", file ); |
100 | mb->setItemEnabled( id, false ); | ||
101 | id = mb->insertItem( "&View", view ); | 108 | id = mb->insertItem( "&View", view ); |
102 | mb->setItemEnabled( id, false ); | 109 | mb->setItemEnabled( id, false ); |
103 | id = mb->insertItem( "&Sniffer", sniffer ); | 110 | id = mb->insertItem( "&Sniffer", sniffer ); |
104 | mb->setItemEnabled( id, false ); | 111 | mb->setItemEnabled( id, false ); |
105 | id = mb->insertItem( "&Demo", demo ); | 112 | id = mb->insertItem( "&Demo", demo ); |
106 | mb->setItemEnabled( id, true ); | 113 | mb->setItemEnabled( id, true ); |
107 | 114 | ||
108 | #ifdef QWS | 115 | #ifdef QWS |
109 | mb->insertItem( startStopButton ); | 116 | mb->insertItem( startStopButton ); |
110 | mb->insertItem( c ); | 117 | mb->insertItem( c ); |
111 | mb->insertItem( d ); | 118 | mb->insertItem( d ); |
112 | #else // Qt3 changed the insertion order. It's now totally random :( | 119 | #else // Qt3 changed the insertion order. It's now totally random :( |
113 | mb->insertItem( d ); | 120 | mb->insertItem( d ); |
114 | mb->insertItem( c ); | 121 | mb->insertItem( c ); |
115 | mb->insertItem( startStopButton ); | 122 | mb->insertItem( startStopButton ); |
116 | #endif | 123 | #endif |
117 | 124 | ||
118 | // setup status bar (for now only on X11) | 125 | // setup status bar (for now only on X11) |
119 | 126 | ||
120 | #ifndef QWS | 127 | #ifndef QWS |
121 | statusBar()->message( "Ready." ); | 128 | statusBar()->message( "Ready." ); |
122 | #endif | 129 | #endif |
123 | 130 | ||
124 | }; | 131 | }; |
@@ -151,24 +158,41 @@ void WellenreiterMainWindow::showConfigure() | |||
151 | 158 | ||
152 | WellenreiterMainWindow::~WellenreiterMainWindow() | 159 | WellenreiterMainWindow::~WellenreiterMainWindow() |
153 | { | 160 | { |
154 | 161 | ||
155 | delete infoIconSet; | 162 | delete infoIconSet; |
156 | delete settingsIconSet; | 163 | delete settingsIconSet; |
157 | #ifdef QWS | 164 | #ifdef QWS |
158 | delete searchIconSet; | 165 | delete searchIconSet; |
159 | delete cancelIconSet; | 166 | delete cancelIconSet; |
160 | #else | 167 | #else |
161 | delete startStopIconSet; | 168 | delete startStopIconSet; |
162 | #endif | 169 | #endif |
163 | 170 | ||
164 | }; | 171 | }; |
165 | 172 | ||
166 | void WellenreiterMainWindow::demoAddStations() | 173 | void WellenreiterMainWindow::demoAddStations() |
167 | { | 174 | { |
168 | mw->netView()->addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); | 175 | 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 ); | 176 | 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 ); | 177 | 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 ); | 178 | 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 ); | 179 | mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); |
173 | } | 180 | } |
174 | 181 | ||
182 | void WellenreiterMainWindow::fileSaveLog() | ||
183 | { | ||
184 | const QString fname( "/tmp/log.txt" ); | ||
185 | QFile f( fname ); | ||
186 | if ( f.open(IO_WriteOnly) ) | ||
187 | { | ||
188 | QTextStream t( &f ); | ||
189 | t << mw->logWindow()->getLog(); | ||
190 | f.close(); | ||
191 | qDebug( "saved log in file '%s'", (const char*) fname ); | ||
192 | } | ||
193 | else | ||
194 | { | ||
195 | qDebug( "Problem saving log in file '%s'", (const char*) fname ); | ||
196 | } | ||
197 | |||
198 | } \ No newline at end of file | ||
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h index 22c21e8..03aa08a 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.h +++ b/noncore/net/wellenreiter/gui/mainwindow.h | |||
@@ -25,27 +25,28 @@ class QToolButton; | |||
25 | 25 | ||
26 | class WellenreiterMainWindow: public QMainWindow | 26 | class 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 | void demoAddStations(); |
49 | void fileSaveLog(); | ||
49 | }; | 50 | }; |
50 | 51 | ||
51 | #endif | 52 | #endif |
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index ab19701..a689cca 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -20,48 +20,52 @@ | |||
20 | 20 | ||
21 | #include "manufacturers.h" | 21 | #include "manufacturers.h" |
22 | 22 | ||
23 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 23 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
24 | :QListView( parent, name ), _manufacturerdb( 0 ) | 24 | :QListView( parent, name ), _manufacturerdb( 0 ) |
25 | { | 25 | { |
26 | 26 | ||
27 | setFrameShape( QListView::StyledPanel ); | 27 | setFrameShape( QListView::StyledPanel ); |
28 | setFrameShadow( QListView::Sunken ); | 28 | setFrameShadow( QListView::Sunken ); |
29 | 29 | ||
30 | addColumn( tr( "Net/Station" ) ); | 30 | addColumn( tr( "Net/Station" ) ); |
31 | setColumnAlignment( 0, AlignLeft || AlignVCenter ); | 31 | setColumnAlignment( 0, AlignLeft || AlignVCenter ); |
32 | addColumn( tr( "B" ) ); | 32 | addColumn( tr( "B" ) ); |
33 | setColumnAlignment( 1, AlignCenter ); | 33 | setColumnAlignment( 1, AlignCenter ); |
34 | addColumn( tr( "AP" ) ); | 34 | addColumn( tr( "AP" ) ); |
35 | setColumnAlignment( 2, AlignCenter ); | 35 | setColumnAlignment( 2, AlignCenter ); |
36 | addColumn( tr( "Chn" ) ); | 36 | addColumn( tr( "Chn" ) ); |
37 | setColumnAlignment( 3, AlignCenter ); | 37 | setColumnAlignment( 3, AlignCenter ); |
38 | addColumn( tr( "W" ) ); | 38 | addColumn( tr( "W" ) ); |
39 | setColumnAlignment( 4, AlignCenter ); | 39 | setColumnAlignment( 4, AlignCenter ); |
40 | addColumn( tr( "T" ) ); | 40 | addColumn( tr( "T" ) ); |
41 | setColumnAlignment( 5, AlignCenter ); | 41 | setColumnAlignment( 5, AlignCenter ); |
42 | addColumn( tr( "Manufacturer" ) ); | 42 | addColumn( tr( "Manufacturer" ) ); |
43 | setColumnAlignment( 6, AlignCenter ); | 43 | setColumnAlignment( 6, AlignCenter ); |
44 | addColumn( tr( "First Seen" ) ); | ||
45 | setColumnAlignment( 7, AlignCenter ); | ||
46 | addColumn( tr( "Last Seen" ) ); | ||
47 | setColumnAlignment( 8, AlignCenter ); | ||
44 | setRootIsDecorated( true ); | 48 | setRootIsDecorated( true ); |
45 | setAllColumnsShowFocus( true ); | 49 | setAllColumnsShowFocus( true ); |
46 | }; | 50 | }; |
47 | 51 | ||
48 | MScanListView::~MScanListView() | 52 | MScanListView::~MScanListView() |
49 | { | 53 | { |
50 | }; | 54 | }; |
51 | 55 | ||
52 | void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb ) | 56 | void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb ) |
53 | { | 57 | { |
54 | _manufacturerdb = manufacturerdb; | 58 | _manufacturerdb = manufacturerdb; |
55 | } | 59 | } |
56 | 60 | ||
57 | void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | 61 | void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) |
58 | { | 62 | { |
59 | // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...) | 63 | // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...) |
60 | 64 | ||
61 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", | 65 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", |
62 | (const char*) type, | 66 | (const char*) type, |
63 | (const char*) essid, | 67 | (const char*) essid, |
64 | (const char*) macaddr, | 68 | (const char*) macaddr, |
65 | channel ); | 69 | channel ); |
66 | 70 | ||
67 | // search, if we already have seen this net | 71 | // search, if we already have seen this net |
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.cpp b/noncore/net/wellenreiter/gui/scanlistitem.cpp index 15aef0c..dd33f5f 100644 --- a/noncore/net/wellenreiter/gui/scanlistitem.cpp +++ b/noncore/net/wellenreiter/gui/scanlistitem.cpp | |||
@@ -1,96 +1,102 @@ | |||
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 "scanlistitem.h" | 16 | #include "scanlistitem.h" |
17 | #include <assert.h> | 17 | #include <assert.h> |
18 | #include <qdatetime.h> | ||
18 | #include <qpixmap.h> | 19 | #include <qpixmap.h> |
19 | 20 | ||
20 | #ifdef QWS | 21 | #ifdef QWS |
21 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
22 | #else | 23 | #else |
23 | #include "resource.h" | 24 | #include "resource.h" |
24 | #endif | 25 | #endif |
25 | 26 | ||
26 | const int col_type = 0; | 27 | const int col_type = 0; |
27 | const int col_essid = 0; | 28 | const int col_essid = 0; |
28 | const int col_sig = 1; | 29 | const int col_sig = 1; |
29 | const int col_ap = 2; | 30 | const int col_ap = 2; |
30 | const int col_channel = 3; | 31 | const int col_channel = 3; |
31 | const int col_wep = 4; | 32 | const int col_wep = 4; |
32 | const int col_traffic = 5; | 33 | const int col_traffic = 5; |
33 | const int col_manuf = 6; | 34 | const int col_manuf = 6; |
35 | const int col_firstseen = 7; | ||
36 | const int col_lastseen = 8; | ||
34 | 37 | ||
35 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 38 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, |
36 | bool wep, int channel, int signal ) | 39 | bool wep, int channel, int signal ) |
37 | :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 40 | :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
38 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 41 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
39 | _channel( channel ), _signal( signal ), _beacons( 0 ) | 42 | _channel( channel ), _signal( signal ), _beacons( 0 ) |
40 | { | 43 | { |
41 | qDebug( "creating scanlist item" ); | 44 | qDebug( "creating scanlist item" ); |
42 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 45 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
43 | } | 46 | } |
44 | 47 | ||
45 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | 48 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, |
46 | bool wep, int channel, int signal ) | 49 | bool wep, int channel, int signal ) |
47 | :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | 50 | :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) |
48 | { | 51 | { |
49 | qDebug( "creating scanlist item" ); | 52 | qDebug( "creating scanlist item" ); |
50 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 53 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
51 | } | 54 | } |
52 | 55 | ||
53 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | 56 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) |
54 | { | 57 | { |
55 | qDebug( "decorating scanlist item %s / %s / %s [%d]", | 58 | qDebug( "decorating scanlist item %s / %s / %s [%d]", |
56 | (const char*) type, | 59 | (const char*) type, |
57 | (const char*) essid, | 60 | (const char*) essid, |
58 | (const char*) macaddr, | 61 | (const char*) macaddr, |
59 | channel ); | 62 | channel ); |
60 | 63 | ||
61 | // set icon for managed or adhoc mode | 64 | // set icon for managed or adhoc mode |
62 | QString name; | 65 | QString name; |
63 | name.sprintf( "wellenreiter/%s", (const char*) type ); | 66 | name.sprintf( "wellenreiter/%s", (const char*) type ); |
64 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 67 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
65 | 68 | ||
66 | // set icon for wep (wireless encryption protocol) | 69 | // set icon for wep (wireless encryption protocol) |
67 | if ( wep ) | 70 | if ( wep ) |
68 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); // rename the pixmap! | 71 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
69 | 72 | ||
70 | // set channel and signal text | 73 | // set channel and signal text |
71 | 74 | ||
72 | if ( signal != -1 ) | 75 | if ( signal != -1 ) |
73 | setText( col_sig, QString::number( signal ) ); | 76 | setText( col_sig, QString::number( signal ) ); |
74 | if ( channel != -1 ) | 77 | if ( channel != -1 ) |
75 | setText( col_channel, QString::number( channel ) ); | 78 | setText( col_channel, QString::number( channel ) ); |
76 | 79 | ||
80 | setText( col_firstseen, QTime::currentTime().toString() ); | ||
81 | //setText( col_lastseen, QTime::currentTime().toString() ); | ||
82 | |||
77 | listView()->triggerUpdate(); | 83 | listView()->triggerUpdate(); |
78 | 84 | ||
79 | this->type = type; | 85 | this->type = type; |
80 | 86 | ||
81 | } | 87 | } |
82 | 88 | ||
83 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 89 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
84 | { | 90 | { |
85 | setText( col_manuf, manufacturer ); | 91 | setText( col_manuf, manufacturer ); |
86 | } | 92 | } |
87 | 93 | ||
88 | void MScanListItem::receivedBeacon() | 94 | void MScanListItem::receivedBeacon() |
89 | { | 95 | { |
90 | _beacons++; | 96 | _beacons++; |
91 | #ifdef DEBUG | 97 | #ifdef DEBUG |
92 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); | 98 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); |
93 | #endif | 99 | #endif |
94 | setText( col_sig, QString::number( _beacons ) ); | 100 | setText( col_sig, QString::number( _beacons ) ); |
101 | setText( col_lastseen, QTime::currentTime().toString() ); | ||
95 | } | 102 | } |
96 | |||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 61960d2..ff523d4 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -31,48 +31,49 @@ using namespace Opie; | |||
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 | ||
41 | class QTimerEvent; | 41 | class QTimerEvent; |
42 | class QPixmap; | 42 | class QPixmap; |
43 | class ManufacturerDB; | 43 | class ManufacturerDB; |
44 | class WellenreiterConfigWindow; | 44 | class WellenreiterConfigWindow; |
45 | 45 | ||
46 | class Wellenreiter : public WellenreiterBase { | 46 | class 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 | MScanListView* netView() const { return netview; }; |
55 | MLogWindow* logWindow() const { return logwindow; }; | ||
55 | 56 | ||
56 | protected: | 57 | protected: |
57 | bool daemonRunning; | 58 | bool daemonRunning; |
58 | 59 | ||
59 | public slots: | 60 | public slots: |
60 | void dataReceived(); | 61 | void dataReceived(); |
61 | void startStopClicked(); | 62 | void startStopClicked(); |
62 | 63 | ||
63 | private: | 64 | private: |
64 | int daemon_fd; // socket filedescriptor for udp communication socket | 65 | int daemon_fd; // socket filedescriptor for udp communication socket |
65 | #ifdef QWS | 66 | #ifdef QWS |
66 | OSystem _system; // Opie Operating System identifier | 67 | OSystem _system; // Opie Operating System identifier |
67 | #endif | 68 | #endif |
68 | void handleMessage(); | 69 | void handleMessage(); |
69 | 70 | ||
70 | ManufacturerDB* manufacturerdb; | 71 | ManufacturerDB* manufacturerdb; |
71 | WellenreiterConfigWindow* configwindow; | 72 | WellenreiterConfigWindow* configwindow; |
72 | struct sockaddr_in sockaddr; | 73 | struct sockaddr_in sockaddr; |
73 | 74 | ||
74 | //void readConfig(); | 75 | //void readConfig(); |
75 | //void writeConfig(); | 76 | //void writeConfig(); |
76 | }; | 77 | }; |
77 | 78 | ||
78 | 79 | ||