Diffstat (limited to 'noncore/net/wellenreiter/gui') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/hexwindow.cpp | 35 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/hexwindow.h | 38 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/logwindow.cpp | 38 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/logwindow.h | 38 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 11 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 93 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.h | 11 |
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 TEMPLATE = app CONFIG = qt warn_on debug #CONFIG = qt warn_on release -HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h -SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp +HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h logwindow.h hexwindow.h +SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp INCLUDEPATH += $(OPIEDIR)/include ../daemon DEPENDPATH += $(OPIEDIR)/include ../daemon LIBS += -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 @@ +/********************************************************************** +** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#include "hexwindow.h" +#include <qmultilineedit.h> + +MHexWindow::MHexWindow( QWidget * parent, const char * name, WFlags f ) + :QVBox( parent, name, f ) +{ + ledit = new QMultiLineEdit( this ); + + // FIXME: Set properties( font, read-only, etc...) + +}; + +void MHexWindow::log( QString text ) +{ + + ledit->append( text ); + +}; + + 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 @@ +/********************************************************************** +** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#ifndef HEXWINDOW_H +#define HEXWINDOW_H + +#include <qvbox.h> + +class QString; +class QMultiLineEdit; + +class MHexWindow: public QVBox +{ + + public: + MHexWindow( QWidget * parent = 0, const char * name = "MHexWindow", WFlags f = 0 ); + + void log( QString text ); + + protected: + QMultiLineEdit* ledit; + +}; + +#endif + 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 @@ +/********************************************************************** +** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#include "logwindow.h" +#include <qmultilineedit.h> +#include <qdatetime.h> + +MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) + :QVBox( parent, name, f ) +{ + ledit = new QMultiLineEdit( this ); + + // FIXME: Set properties( font, read-only, etc...) + +}; + +void MLogWindow::log( QString text ) +{ + QTime time = QTime::currentTime(); + QString line; + line.sprintf( "[%s] %s", (const char*) time.toString(), (const char*) text ); + ledit->append( line ); + +}; + + 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 @@ +/********************************************************************** +** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#ifndef LOGWINDOW_H +#define LOGWINDOW_H + +#include <qvbox.h> + +class QString; +class QMultiLineEdit; + +class MLogWindow: public QVBox +{ + + public: + MLogWindow( QWidget * parent = 0, const char * name = "MLogWindow", WFlags f = 0 ); + + void log( QString text ); + + protected: + QMultiLineEdit* ledit; + +}; + +#endif + 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 @@ #include "wellenreiter.h" #include "scanlistitem.h" +#include "logwindow.h" +#include "hexwindow.h" #include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS! #include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS! @@ -35,6 +37,8 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) : WellenreiterBase( parent, name, fl ) { + logwindow->log( "(i) Wellenreiter has been started." ); + connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); netview->setColumnWidthMode( 1, QListView::Manual ); @@ -44,7 +48,10 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) daemon_fd = commsock( GUIADDR, GUIPORT ); if ( daemon_fd == -1 ) + { + logwindow->log( "(E) Couldn't get file descriptor for commsocket." ); qDebug( "D'oh! Could not get file descriptor for daemon-->gui communication socket." ); + } else startTimer( 700 ); @@ -77,10 +84,12 @@ typedef struct { } wl_network_t; */ - qDebug( "Sniffer sent: '%s'", buffer ); + qDebug( "Sniffer sent: '%s'", (const char*) &buffer ); + hexwindow->log( (const char*) &buffer ); if ( result == NETFOUND ) /* new network found */ { + logwindow->log( "(i) found new network" ); qDebug( "Sniffer said: new network found." ); wl_network_t n; 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 @@ #include <qimage.h> #include <qpixmap.h> +#include "logwindow.h" +#include "hexwindow.h" + static const char* const image0_data[] = { "150 105 949 2", "g0 c #000000", @@ -1122,85 +1125,11 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f apLayout->addWidget( netview ); TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) ); - Log = new QWidget( TabWidget, "Log" ); - LogLayout = new QVBoxLayout( Log ); - LogLayout->setSpacing( 2 ); - LogLayout->setMargin( 2 ); - - Log_2 = new QMultiLineEdit( Log, "Log_2" ); - Log_2->setText( tr( "11/18 18:15 - log started\n" -"11/19 20:13 - new net : \"ELAN\"\n" -"11/19 20:15 - new station : \"pegasus\"" ) ); - LogLayout->addWidget( Log_2 ); - TabWidget->addTab( Log, "wellenreiter/log", tr( "Log" ) ); - - tab = new QWidget( TabWidget, "tab" ); - tabLayout = new QGridLayout( tab ); - tabLayout->setSpacing( 2 ); - tabLayout->setMargin( 2 ); - - Log_2_2 = new QMultiLineEdit( tab, "Log_2_2" ); - QPalette pal; - QColorGroup cg; - cg.setColor( QColorGroup::Foreground, white ); - cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) ); - cg.setColor( QColorGroup::Light, white ); - cg.setColor( QColorGroup::Midlight, QColor( 223, 223, 223) ); - cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) ); - cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) ); - cg.setColor( QColorGroup::Text, white ); - cg.setColor( QColorGroup::BrightText, white ); - cg.setColor( QColorGroup::ButtonText, white ); - cg.setColor( QColorGroup::Base, black ); - cg.setColor( QColorGroup::Background, black ); - cg.setColor( QColorGroup::Shadow, black ); - cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); - cg.setColor( QColorGroup::HighlightedText, white ); - pal.setActive( cg ); - cg.setColor( QColorGroup::Foreground, white ); - cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) ); - cg.setColor( QColorGroup::Light, white ); - cg.setColor( QColorGroup::Midlight, QColor( 220, 220, 220) ); - cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) ); - cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) ); - cg.setColor( QColorGroup::Text, white ); - cg.setColor( QColorGroup::BrightText, white ); - cg.setColor( QColorGroup::ButtonText, white ); - cg.setColor( QColorGroup::Base, black ); - cg.setColor( QColorGroup::Background, black ); - cg.setColor( QColorGroup::Shadow, black ); - cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); - cg.setColor( QColorGroup::HighlightedText, white ); - pal.setInactive( cg ); - cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); - cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) ); - cg.setColor( QColorGroup::Light, white ); - cg.setColor( QColorGroup::Midlight, QColor( 220, 220, 220) ); - cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) ); - cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) ); - cg.setColor( QColorGroup::Text, QColor( 128, 128, 128) ); - cg.setColor( QColorGroup::BrightText, white ); - cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); - cg.setColor( QColorGroup::Base, black ); - cg.setColor( QColorGroup::Background, black ); - cg.setColor( QColorGroup::Shadow, black ); - cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); - cg.setColor( QColorGroup::HighlightedText, white ); - pal.setDisabled( cg ); - Log_2_2->setPalette( pal ); - QFont Log_2_2_font( Log_2_2->font() ); - Log_2_2_font.setFamily( "adobe-courier" ); - Log_2_2_font.setPointSize( 8 ); - Log_2_2->setFont( Log_2_2_font ); - Log_2_2->setText( tr( "00 0a 20 00 a8 00 e2 00 ...ESD..\n" -"00 0a 20 00 a8 00 e2 00 .*&23...\n" -"00 0a 20 00 a8 00 e2 00 ........\n" -"00 0a 20 00 a8 00 e2 00 ........\n" -"00 0a 20 00 a8 00 e2 00 ........\n" -"00 0a 20 00 a8 00 e2 00 ...BRA22" ) ); + logwindow = new MLogWindow( TabWidget, "Log" ); + TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); - tabLayout->addWidget( Log_2_2, 0, 0 ); - TabWidget->addTab( tab, "wellenreiter/hex", tr( "Hex" ) ); + hexwindow = new MHexWindow( TabWidget, "tab" ); + TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); about = new QWidget( TabWidget, "about" ); aboutLayout = new QGridLayout( about ); @@ -1267,10 +1196,10 @@ bool WellenreiterBase::event( QEvent* ev ) { bool ret = QWidget::event( ev ); if ( ev->type() == QEvent::ApplicationFontChange ) { - QFont Log_2_font( Log_2->font() ); - Log_2_font.setFamily( "adobe-courier" ); - Log_2_font.setPointSize( 8 ); - Log_2->setFont( Log_2_font ); + //QFont Log_2_font( Log_2->font() ); + //Log_2_font.setFamily( "adobe-courier" ); + //Log_2_font.setPointSize( 8 ); + //Log_2->setFont( Log_2_font ); QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 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; class QLabel; class QListView; class QListViewItem; -class QMultiLineEdit; class QPushButton; class OTabWidget; +class MLogWindow; +class MHexWindow; class WellenreiterBase : public QWidget { @@ -39,10 +40,8 @@ public: OTabWidget* TabWidget; QWidget* ap; QListView* netview; - QWidget* Log; - QMultiLineEdit* Log_2; - QWidget* tab; - QMultiLineEdit* Log_2_2; + MLogWindow* logwindow; + MHexWindow* hexwindow; QWidget* about; QLabel* PixmapLabel1_3_2; QLabel* TextLabel1_4_2; @@ -51,8 +50,6 @@ public: protected: QVBoxLayout* WellenreiterBaseLayout; QVBoxLayout* apLayout; - QVBoxLayout* LogLayout; - QGridLayout* tabLayout; QGridLayout* aboutLayout; bool event( QEvent* ); }; |