summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2002-12-08 19:31:23 (UTC)
committer mickeyl <mickeyl>2002-12-08 19:31:23 (UTC)
commit77ab301a0ab41befda91e6a210c64a72f0d7c264 (patch) (unidiff)
tree5c41c48b2f41dc1eb9350a138b8ba03fe3ac7fb1
parentf91aa29028f6807312e059229627ec4a8b1191d4 (diff)
downloadopie-77ab301a0ab41befda91e6a210c64a72f0d7c264.zip
opie-77ab301a0ab41befda91e6a210c64a72f0d7c264.tar.gz
opie-77ab301a0ab41befda91e6a210c64a72f0d7c264.tar.bz2
started work on logwindow and hexwindow
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/gui.pro4
-rw-r--r--noncore/net/wellenreiter/gui/hexwindow.cpp35
-rw-r--r--noncore/net/wellenreiter/gui/hexwindow.h38
-rw-r--r--noncore/net/wellenreiter/gui/logwindow.cpp38
-rw-r--r--noncore/net/wellenreiter/gui/logwindow.h38
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp11
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp93
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.h11
8 files changed, 176 insertions, 92 deletions
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro
index fbe2c11..6b9944d 100644
--- a/noncore/net/wellenreiter/gui/gui.pro
+++ b/noncore/net/wellenreiter/gui/gui.pro
@@ -2,8 +2,8 @@ DESTDIR = $(OPIEDIR)/bin
2TEMPLATE = app 2TEMPLATE = app
3CONFIG = qt warn_on debug 3CONFIG = qt warn_on debug
4#CONFIG = qt warn_on release 4#CONFIG = qt warn_on release
5HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h 5HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h logwindow.h hexwindow.h
6SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp 6SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp
7INCLUDEPATH += $(OPIEDIR)/include ../daemon 7INCLUDEPATH += $(OPIEDIR)/include ../daemon
8DEPENDPATH += $(OPIEDIR)/include ../daemon 8DEPENDPATH += $(OPIEDIR)/include ../daemon
9LIBS += -lqpe -lopie -L../libwellenreiter/source -lwellenreiter 9LIBS += -lqpe -lopie -L../libwellenreiter/source -lwellenreiter
diff --git a/noncore/net/wellenreiter/gui/hexwindow.cpp b/noncore/net/wellenreiter/gui/hexwindow.cpp
new file mode 100644
index 0000000..91aa6f7
--- a/dev/null
+++ b/noncore/net/wellenreiter/gui/hexwindow.cpp
@@ -0,0 +1,35 @@
1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3**
4** This file is part of Opie Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14**********************************************************************/
15
16#include "hexwindow.h"
17#include <qmultilineedit.h>
18
19MHexWindow::MHexWindow( QWidget * parent, const char * name, WFlags f )
20 :QVBox( parent, name, f )
21{
22 ledit = new QMultiLineEdit( this );
23
24 // FIXME: Set properties( font, read-only, etc...)
25
26};
27
28void MHexWindow::log( QString text )
29{
30
31 ledit->append( text );
32
33};
34
35
diff --git a/noncore/net/wellenreiter/gui/hexwindow.h b/noncore/net/wellenreiter/gui/hexwindow.h
new file mode 100644
index 0000000..eec1be0
--- a/dev/null
+++ b/noncore/net/wellenreiter/gui/hexwindow.h
@@ -0,0 +1,38 @@
1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3**
4** This file is part of Opie Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14**********************************************************************/
15
16#ifndef HEXWINDOW_H
17#define HEXWINDOW_H
18
19#include <qvbox.h>
20
21class QString;
22class QMultiLineEdit;
23
24class MHexWindow: public QVBox
25{
26
27 public:
28 MHexWindow( QWidget * parent = 0, const char * name = "MHexWindow", WFlags f = 0 );
29
30 void log( QString text );
31
32 protected:
33 QMultiLineEdit* ledit;
34
35};
36
37#endif
38
diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp
new file mode 100644
index 0000000..dafb429
--- a/dev/null
+++ b/noncore/net/wellenreiter/gui/logwindow.cpp
@@ -0,0 +1,38 @@
1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3**
4** This file is part of Opie Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14**********************************************************************/
15
16#include "logwindow.h"
17#include <qmultilineedit.h>
18#include <qdatetime.h>
19
20MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f )
21 :QVBox( parent, name, f )
22{
23 ledit = new QMultiLineEdit( this );
24
25 // FIXME: Set properties( font, read-only, etc...)
26
27};
28
29void MLogWindow::log( QString text )
30{
31 QTime time = QTime::currentTime();
32 QString line;
33 line.sprintf( "[%s] %s", (const char*) time.toString(), (const char*) text );
34 ledit->append( line );
35
36};
37
38
diff --git a/noncore/net/wellenreiter/gui/logwindow.h b/noncore/net/wellenreiter/gui/logwindow.h
new file mode 100644
index 0000000..325f8d0
--- a/dev/null
+++ b/noncore/net/wellenreiter/gui/logwindow.h
@@ -0,0 +1,38 @@
1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3**
4** This file is part of Opie Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14**********************************************************************/
15
16#ifndef LOGWINDOW_H
17#define LOGWINDOW_H
18
19#include <qvbox.h>
20
21class QString;
22class QMultiLineEdit;
23
24class MLogWindow: public QVBox
25{
26
27 public:
28 MLogWindow( QWidget * parent = 0, const char * name = "MLogWindow", WFlags f = 0 );
29
30 void log( QString text );
31
32 protected:
33 QMultiLineEdit* ledit;
34
35};
36
37#endif
38
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 11cdaef..e983b4d 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -26,6 +26,8 @@
26 26
27#include "wellenreiter.h" 27#include "wellenreiter.h"
28#include "scanlistitem.h" 28#include "scanlistitem.h"
29#include "logwindow.h"
30#include "hexwindow.h"
29 31
30#include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS! 32#include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS!
31#include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS! 33#include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS!
@@ -35,6 +37,8 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl )
35 : WellenreiterBase( parent, name, fl ) 37 : WellenreiterBase( parent, name, fl )
36{ 38{
37 39
40 logwindow->log( "(i) Wellenreiter has been started." );
41
38 connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); 42 connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) );
39 netview->setColumnWidthMode( 1, QListView::Manual ); 43 netview->setColumnWidthMode( 1, QListView::Manual );
40 44
@@ -44,7 +48,10 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl )
44 48
45 daemon_fd = commsock( GUIADDR, GUIPORT ); 49 daemon_fd = commsock( GUIADDR, GUIPORT );
46 if ( daemon_fd == -1 ) 50 if ( daemon_fd == -1 )
51 {
52 logwindow->log( "(E) Couldn't get file descriptor for commsocket." );
47 qDebug( "D'oh! Could not get file descriptor for daemon-->gui communication socket." ); 53 qDebug( "D'oh! Could not get file descriptor for daemon-->gui communication socket." );
54 }
48 else 55 else
49 startTimer( 700 ); 56 startTimer( 700 );
50 57
@@ -77,10 +84,12 @@ typedef struct {
77} wl_network_t; 84} wl_network_t;
78*/ 85*/
79 86
80 qDebug( "Sniffer sent: '%s'", buffer ); 87 qDebug( "Sniffer sent: '%s'", (const char*) &buffer );
88 hexwindow->log( (const char*) &buffer );
81 89
82 if ( result == NETFOUND ) /* new network found */ 90 if ( result == NETFOUND ) /* new network found */
83 { 91 {
92 logwindow->log( "(i) found new network" );
84 qDebug( "Sniffer said: new network found." ); 93 qDebug( "Sniffer said: new network found." );
85 wl_network_t n; 94 wl_network_t n;
86 get_network_found( &n, (char*) &buffer ); 95 get_network_found( &n, (char*) &buffer );
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
index d938561..7849e12 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
@@ -28,6 +28,9 @@
28#include <qimage.h> 28#include <qimage.h>
29#include <qpixmap.h> 29#include <qpixmap.h>
30 30
31#include "logwindow.h"
32#include "hexwindow.h"
33
31static const char* const image0_data[] = { 34static const char* const image0_data[] = {
32"150 105 949 2", 35"150 105 949 2",
33"g0 c #000000", 36"g0 c #000000",
@@ -1122,85 +1125,11 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f
1122 apLayout->addWidget( netview ); 1125 apLayout->addWidget( netview );
1123 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) ); 1126 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) );
1124 1127
1125 Log = new QWidget( TabWidget, "Log" ); 1128 logwindow = new MLogWindow( TabWidget, "Log" );
1126 LogLayout = new QVBoxLayout( Log ); 1129 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
1127 LogLayout->setSpacing( 2 );
1128 LogLayout->setMargin( 2 );
1129
1130 Log_2 = new QMultiLineEdit( Log, "Log_2" );
1131 Log_2->setText( tr( "11/18 18:15 - log started\n"
1132"11/19 20:13 - new net : \"ELAN\"\n"
1133"11/19 20:15 - new station : \"pegasus\"" ) );
1134 LogLayout->addWidget( Log_2 );
1135 TabWidget->addTab( Log, "wellenreiter/log", tr( "Log" ) );
1136
1137 tab = new QWidget( TabWidget, "tab" );
1138 tabLayout = new QGridLayout( tab );
1139 tabLayout->setSpacing( 2 );
1140 tabLayout->setMargin( 2 );
1141
1142 Log_2_2 = new QMultiLineEdit( tab, "Log_2_2" );
1143 QPalette pal;
1144 QColorGroup cg;
1145 cg.setColor( QColorGroup::Foreground, white );
1146 cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );
1147 cg.setColor( QColorGroup::Light, white );
1148 cg.setColor( QColorGroup::Midlight, QColor( 223, 223, 223) );
1149 cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );
1150 cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );
1151 cg.setColor( QColorGroup::Text, white );
1152 cg.setColor( QColorGroup::BrightText, white );
1153 cg.setColor( QColorGroup::ButtonText, white );
1154 cg.setColor( QColorGroup::Base, black );
1155 cg.setColor( QColorGroup::Background, black );
1156 cg.setColor( QColorGroup::Shadow, black );
1157 cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
1158 cg.setColor( QColorGroup::HighlightedText, white );
1159 pal.setActive( cg );
1160 cg.setColor( QColorGroup::Foreground, white );
1161 cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );
1162 cg.setColor( QColorGroup::Light, white );
1163 cg.setColor( QColorGroup::Midlight, QColor( 220, 220, 220) );
1164 cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );
1165 cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );
1166 cg.setColor( QColorGroup::Text, white );
1167 cg.setColor( QColorGroup::BrightText, white );
1168 cg.setColor( QColorGroup::ButtonText, white );
1169 cg.setColor( QColorGroup::Base, black );
1170 cg.setColor( QColorGroup::Background, black );
1171 cg.setColor( QColorGroup::Shadow, black );
1172 cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
1173 cg.setColor( QColorGroup::HighlightedText, white );
1174 pal.setInactive( cg );
1175 cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) );
1176 cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );
1177 cg.setColor( QColorGroup::Light, white );
1178 cg.setColor( QColorGroup::Midlight, QColor( 220, 220, 220) );
1179 cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );
1180 cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );
1181 cg.setColor( QColorGroup::Text, QColor( 128, 128, 128) );
1182 cg.setColor( QColorGroup::BrightText, white );
1183 cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) );
1184 cg.setColor( QColorGroup::Base, black );
1185 cg.setColor( QColorGroup::Background, black );
1186 cg.setColor( QColorGroup::Shadow, black );
1187 cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
1188 cg.setColor( QColorGroup::HighlightedText, white );
1189 pal.setDisabled( cg );
1190 Log_2_2->setPalette( pal );
1191 QFont Log_2_2_font( Log_2_2->font() );
1192 Log_2_2_font.setFamily( "adobe-courier" );
1193 Log_2_2_font.setPointSize( 8 );
1194 Log_2_2->setFont( Log_2_2_font );
1195 Log_2_2->setText( tr( "00 0a 20 00 a8 00 e2 00 ...ESD..\n"
1196"00 0a 20 00 a8 00 e2 00 .*&23...\n"
1197"00 0a 20 00 a8 00 e2 00 ........\n"
1198"00 0a 20 00 a8 00 e2 00 ........\n"
1199"00 0a 20 00 a8 00 e2 00 ........\n"
1200"00 0a 20 00 a8 00 e2 00 ...BRA22" ) );
1201 1130
1202 tabLayout->addWidget( Log_2_2, 0, 0 ); 1131 hexwindow = new MHexWindow( TabWidget, "tab" );
1203 TabWidget->addTab( tab, "wellenreiter/hex", tr( "Hex" ) ); 1132 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
1204 1133
1205 about = new QWidget( TabWidget, "about" ); 1134 about = new QWidget( TabWidget, "about" );
1206 aboutLayout = new QGridLayout( about ); 1135 aboutLayout = new QGridLayout( about );
@@ -1267,10 +1196,10 @@ bool WellenreiterBase::event( QEvent* ev )
1267{ 1196{
1268 bool ret = QWidget::event( ev ); 1197 bool ret = QWidget::event( ev );
1269 if ( ev->type() == QEvent::ApplicationFontChange ) { 1198 if ( ev->type() == QEvent::ApplicationFontChange ) {
1270 QFont Log_2_font( Log_2->font() ); 1199 //QFont Log_2_font( Log_2->font() );
1271 Log_2_font.setFamily( "adobe-courier" ); 1200 //Log_2_font.setFamily( "adobe-courier" );
1272 Log_2_font.setPointSize( 8 ); 1201 //Log_2_font.setPointSize( 8 );
1273 Log_2->setFont( Log_2_font ); 1202 //Log_2->setFont( Log_2_font );
1274 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 1203 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
1275 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 1204 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
1276 TextLabel1_4_2_font.setPointSize( 10 ); 1205 TextLabel1_4_2_font.setPointSize( 10 );
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.h b/noncore/net/wellenreiter/gui/wellenreiterbase.h
index b133d28..b7bd820 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.h
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.h
@@ -24,9 +24,10 @@ class QGridLayout;
24class QLabel; 24class QLabel;
25class QListView; 25class QListView;
26class QListViewItem; 26class QListViewItem;
27class QMultiLineEdit;
28class QPushButton; 27class QPushButton;
29class OTabWidget; 28class OTabWidget;
29class MLogWindow;
30class MHexWindow;
30 31
31class WellenreiterBase : public QWidget 32class WellenreiterBase : public QWidget
32{ 33{
@@ -39,10 +40,8 @@ public:
39 OTabWidget* TabWidget; 40 OTabWidget* TabWidget;
40 QWidget* ap; 41 QWidget* ap;
41 QListView* netview; 42 QListView* netview;
42 QWidget* Log; 43 MLogWindow* logwindow;
43 QMultiLineEdit* Log_2; 44 MHexWindow* hexwindow;
44 QWidget* tab;
45 QMultiLineEdit* Log_2_2;
46 QWidget* about; 45 QWidget* about;
47 QLabel* PixmapLabel1_3_2; 46 QLabel* PixmapLabel1_3_2;
48 QLabel* TextLabel1_4_2; 47 QLabel* TextLabel1_4_2;
@@ -51,8 +50,6 @@ public:
51protected: 50protected:
52 QVBoxLayout* WellenreiterBaseLayout; 51 QVBoxLayout* WellenreiterBaseLayout;
53 QVBoxLayout* apLayout; 52 QVBoxLayout* apLayout;
54 QVBoxLayout* LogLayout;
55 QGridLayout* tabLayout;
56 QGridLayout* aboutLayout; 53 QGridLayout* aboutLayout;
57 bool event( QEvent* ); 54 bool event( QEvent* );
58}; 55};