summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2002-12-14 18:30:49 (UTC)
committer mickeyl <mickeyl>2002-12-14 18:30:49 (UTC)
commit57918323f3b2e1377d9cf97ed6466e31b260d24a (patch) (side-by-side diff)
treede2cc333e1239464d3af1f23fbe5a6006bcc8e85
parentade8c5fddf3f125ee276c4c19d1646a9ef4cab08 (diff)
downloadopie-57918323f3b2e1377d9cf97ed6466e31b260d24a.zip
opie-57918323f3b2e1377d9cf97ed6466e31b260d24a.tar.gz
opie-57918323f3b2e1377d9cf97ed6466e31b260d24a.tar.bz2
- support compilation for Qt/X11
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/gui-x11.pro11
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp1
-rw-r--r--noncore/net/wellenreiter/gui/resource.cpp35
-rw-r--r--noncore/net/wellenreiter/gui/resource.h26
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.cpp7
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp40
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.h11
7 files changed, 119 insertions, 12 deletions
diff --git a/noncore/net/wellenreiter/gui/gui-x11.pro b/noncore/net/wellenreiter/gui/gui-x11.pro
new file mode 100644
index 0000000..0cddd22
--- a/dev/null
+++ b/noncore/net/wellenreiter/gui/gui-x11.pro
@@ -0,0 +1,11 @@
+DESTDIR = .
+TEMPLATE = app
+CONFIG = qt warn_on debug
+#CONFIG = qt warn_on release
+HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h logwindow.h hexwindow.h configwindow.h resource.h
+SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp configwindow.cpp resource.cpp
+INCLUDEPATH += ../daemon
+DEPENDPATH += ../daemon
+LIBS += -lwellenreiter
+INTERFACES = configbase.ui
+TARGET = wellenreiter
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp
index 4b8d489..3307d49 100644
--- a/noncore/net/wellenreiter/gui/main.cpp
+++ b/noncore/net/wellenreiter/gui/main.cpp
@@ -1,42 +1,43 @@
/**********************************************************************
** 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 "wellenreiter.h"
#ifdef QWS
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
#endif
int main( int argc, char **argv )
{
#ifdef QWS
QPEApplication a( argc, argv );
#else
QApplication a( argc, argv );
#endif
Wellenreiter e;
e.setCaption( Wellenreiter::tr("Wellenreiter") );
#ifdef QWS
a.showMainWidget(&e);
#else
a.setMainWidget(&e);
+ e.show();
#endif
return a.exec();
}
diff --git a/noncore/net/wellenreiter/gui/resource.cpp b/noncore/net/wellenreiter/gui/resource.cpp
new file mode 100644
index 0000000..58c6bed
--- a/dev/null
+++ b/noncore/net/wellenreiter/gui/resource.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 "resource.h"
+
+#define PIXMAPPATH "/home/mickey/work/opie/pics"
+
+namespace Resource
+{
+
+QPixmap loadPixmap( const QString& pix )
+{
+ QString filename;
+ filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix );
+ QPixmap pixmap( filename );
+ if ( pixmap.isNull() )
+ {
+ qDebug( "Wellenreiter::Resource: can't find pixmap " + filename );
+ }
+ return pixmap;
+};
+
+};
diff --git a/noncore/net/wellenreiter/gui/resource.h b/noncore/net/wellenreiter/gui/resource.h
new file mode 100644
index 0000000..6a3cc99
--- a/dev/null
+++ b/noncore/net/wellenreiter/gui/resource.h
@@ -0,0 +1,26 @@
+/**********************************************************************
+** 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 RESOURCE_H
+#define RESOURCE_H
+
+#include <qpixmap.h>
+
+namespace Resource
+{
+ QPixmap loadPixmap( const QString& );
+}
+
+#endif // RESOURCE_H
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.cpp b/noncore/net/wellenreiter/gui/scanlistitem.cpp
index 398b42d..1e2a52e 100644
--- a/noncore/net/wellenreiter/gui/scanlistitem.cpp
+++ b/noncore/net/wellenreiter/gui/scanlistitem.cpp
@@ -1,73 +1,78 @@
/**********************************************************************
** 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 "scanlistitem.h"
-#include <qpe/resource.h>
#include <assert.h>
#include <qpixmap.h>
+#ifdef QWS
+#include <qpe/resource.h>
+#else
+#include "resource.h"
+#endif
+
const int col_type = 0;
const int col_essid = 0;
const int col_sig = 1;
const int col_ap = 2;
const int col_channel = 3;
const int col_wep = 4;
const int col_traffic = 5;
MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr,
bool wep, int channel, int signal )
:QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
{
qDebug( "creating scanlist item" );
decorateItem( type, essid, macaddr, wep, channel, signal );
}
MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr,
bool wep, int channel, int signal )
:QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
{
qDebug( "creating scanlist item" );
decorateItem( type, essid, macaddr, wep, channel, signal );
}
void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
{
qDebug( "decorating scanlist item %s / %s / %s [%d]",
(const char*) type,
(const char*) essid,
(const char*) macaddr,
channel );
// set icon for managed or adhoc mode
QString name;
name.sprintf( "wellenreiter/%s", (const char*) type );
setPixmap( col_type, Resource::loadPixmap( name ) );
// set icon for wep (wireless encryption protocol)
if ( wep )
setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); // rename the pixmap!
// set channel and signal text
if ( signal != -1 )
setText( col_sig, QString::number( signal ) );
if ( channel != -1 )
setText( col_channel, QString::number( channel ) );
listView()->triggerUpdate();
this->type = type;
}
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
index aa94c81..5017b08 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
@@ -1,171 +1,191 @@
/**********************************************************************
** 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 "wellenreiterbase.h"
#include <qheader.h>
#include <qlabel.h>
#include <qlistview.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
-#include <opie/otabwidget.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include "logwindow.h"
#include "hexwindow.h"
#include "configwindow.h"
+#ifdef QWS
#include <qpe/resource.h>
+#include <opie/otabwidget.h>
+#else
+#include "resource.h"
+#include <qtabwidget.h>
+#endif
/*
* Constructs a WellenreiterBase which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "WellenreiterBase" );
resize( 191, 294 );
setCaption( tr( "Wellenreiter" ) );
WellenreiterBaseLayout = new QVBoxLayout( this );
WellenreiterBaseLayout->setSpacing( 2 );
WellenreiterBaseLayout->setMargin( 0 );
-
+#ifdef QWS
TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global );
-
+#else
+ TabWidget = new QTabWidget( this, "TabWidget" );
+#endif
ap = new QWidget( TabWidget, "ap" );
apLayout = new QVBoxLayout( ap );
apLayout->setSpacing( 2 );
apLayout->setMargin( 2 );
//--------- NETVIEW TAB --------------
netview = new QListView( ap, "netview" );
netview->addColumn( tr( "SSID" ) );
netview->setColumnAlignment( 0, AlignLeft || AlignVCenter );
netview->addColumn( tr( "Sig" ) );
netview->setColumnAlignment( 1, AlignCenter );
netview->addColumn( tr( "AP" ) );
netview->setColumnAlignment( 2, AlignCenter );
netview->addColumn( tr( "Chn" ) );
netview->setColumnAlignment( 3, AlignCenter );
netview->addColumn( tr( "W" ) );
netview->setColumnAlignment( 4, AlignCenter );
netview->addColumn( tr( "T" ) );
netview->setColumnAlignment( 5, AlignCenter );
netview->setFrameShape( QListView::StyledPanel );
netview->setFrameShadow( QListView::Sunken );
netview->setRootIsDecorated( TRUE );
apLayout->addWidget( netview );
- TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) );
+
//--------- LOG TAB --------------
logwindow = new MLogWindow( TabWidget, "Log" );
- TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
+
//--------- HEX TAB --------------
hexwindow = new MHexWindow( TabWidget, "Hex" );
- TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
//--------- CONFIG TAB --------------
configwindow = new WellenreiterConfigWindow( TabWidget, "Config" );
- TabWidget->addTab( configwindow, "wellenreiter/config", tr( "Config" ) );
//--------- ABOUT TAB --------------
about = new QWidget( TabWidget, "about" );
aboutLayout = new QGridLayout( about );
aboutLayout->setSpacing( 6 );
aboutLayout->setMargin( 11 );
PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" );
PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) );
PixmapLabel1_3_2->setFrameShape( QLabel::Panel );
PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken );
PixmapLabel1_3_2->setLineWidth( 2 );
PixmapLabel1_3_2->setMargin( 0 );
PixmapLabel1_3_2->setMidLineWidth( 0 );
PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) );
PixmapLabel1_3_2->setScaledContents( TRUE );
PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) );
aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 );
TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" );
QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
TextLabel1_4_2_font.setPointSize( 10 );
TextLabel1_4_2->setFont( TextLabel1_4_2_font );
TextLabel1_4_2->setText( tr( "<p align=center>\n"
"<hr>\n"
"Max Moser<br>\n"
"Martin J. Muench<br>\n"
"Michael Lauer<br><hr>\n"
"<b>www.remote-exploit.org</b>\n"
"</p>" ) );
TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) );
aboutLayout->addWidget( TextLabel1_4_2, 1, 0 );
- TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) );
- WellenreiterBaseLayout->addWidget( TabWidget );
button = new QPushButton( this, "button" );
button->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, button->sizePolicy().hasHeightForWidth() ) );
button->setText( tr( "Start Scanning" ) );
- WellenreiterBaseLayout->addWidget( button );
+#ifdef QWS
+ TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) );
+ TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
+ TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
+ TabWidget->addTab( configwindow, "wellenreiter/config", tr( "Config" ) );
+ TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) );
+#else
+ TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) );
+ TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) );
+ TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) );
+ TabWidget->addTab( configwindow, /* "wellenreiter/config", */ tr( "Config" ) );
+ TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) );
+#endif
+ WellenreiterBaseLayout->addWidget( TabWidget );
+ WellenreiterBaseLayout->addWidget( button );
+
+#ifdef QWS
TabWidget->setCurrentTab( tr( "Networks" ) );
+#endif
}
/*
* Destroys the object and frees any allocated resources
*/
WellenreiterBase::~WellenreiterBase()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Main event handler. Reimplemented to handle application
* font changes
*/
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 TextLabel1_4_2_font( TextLabel1_4_2->font() );
TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
TextLabel1_4_2_font.setPointSize( 10 );
TextLabel1_4_2->setFont( TextLabel1_4_2_font );
}
return ret;
}
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.h b/noncore/net/wellenreiter/gui/wellenreiterbase.h
index 4e5ca94..fce25d1 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.h
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.h
@@ -1,59 +1,68 @@
/**********************************************************************
** 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 WELLENREITERBASE_H
#define WELLENREITERBASE_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QLabel;
class QListView;
class QListViewItem;
class QPushButton;
-class OTabWidget;
class MLogWindow;
class MHexWindow;
class WellenreiterConfigWindow;
+#ifdef QWS
+class OTabWidget;
+#else
+class QTabWidget;
+#endif
+
class WellenreiterBase : public QWidget
{
Q_OBJECT
public:
WellenreiterBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~WellenreiterBase();
+#ifdef QWS
OTabWidget* TabWidget;
+#else
+ QTabWidget* TabWidget;
+#endif
QWidget* ap;
QListView* netview;
MLogWindow* logwindow;
MHexWindow* hexwindow;
WellenreiterConfigWindow* configwindow;
QWidget* about;
QLabel* PixmapLabel1_3_2;
QLabel* TextLabel1_4_2;
QPushButton* button;
protected:
QVBoxLayout* WellenreiterBaseLayout;
QVBoxLayout* apLayout;
QGridLayout* aboutLayout;
bool event( QEvent* );
};
#endif // WELLENREITERBASE_H