-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 17 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 12 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 12 |
3 files changed, 23 insertions, 18 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 3e18531..ccb3ec0 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -1,157 +1,162 @@ /********************************************************************** ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Wellenreiter II. ** ** 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 "configwindow.h" #include "gps.h" #include "logwindow.h" #include "packetview.h" #include "mainwindow.h" #include "wellenreiter.h" #include "scanlist.h" /* OPIE */ #ifdef QWS -#include <qpe/resource.h> +#include <opie2/oresource.h> #include <opie2/odebug.h> #include <opie2/ofiledialog.h> #else #include "resource.h" #include <qapplication.h> #include <qfiledialog.h> #endif /* QT */ #include <qcombobox.h> #include <qdatastream.h> #include <qfile.h> #include <qfileinfo.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qiconset.h> #include <qmenubar.h> #include <qmessagebox.h> #include <qpopupmenu.h> #include <qpushbutton.h> #include <qstatusbar.h> #include <qspinbox.h> #include <qtextstream.h> #include <qtoolbutton.h> #include <qwhatsthis.h> /* STD */ #include <unistd.h> using namespace Opie::Core; using namespace Opie::Net; using namespace Opie::Ui; WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) :QMainWindow( parent, name, f ) { cw = new WellenreiterConfigWindow( this ); mw = new Wellenreiter( this ); mw->setConfigWindow( cw ); setCentralWidget( mw ); // setup application icon - setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); + setIcon( Opie::Core::OResource::loadPixmap( "wellenreiter/appicon-trans", Opie::Core::OResource::SmallIcon ) ); #ifndef QWS setIconText( "Wellenreiter/X11" ); #endif // setup tool buttons + bool useBigIcon = qApp->desktop()->size().width() > 330; startButton = new QToolButton( 0 ); + startButton->setUsesBigPixmap( useBigIcon ); QWhatsThis::add( startButton, tr( "Click here to start scanning." ) ); #ifdef QWS startButton->setAutoRaise( true ); #endif - startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) ); + startButton->setIconSet( Opie::Core::OResource::loadPixmap( "wellenreiter/SearchIcon", Opie::Core::OResource::SmallIcon ) ); startButton->setEnabled( false ); connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); stopButton = new QToolButton( 0 ); + stopButton->setUsesBigPixmap( useBigIcon ); QWhatsThis::add( stopButton, tr( "Click here to stop scanning." ) ); #ifdef QWS stopButton->setAutoRaise( true ); #endif - stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) ); + stopButton->setIconSet( Opie::Core::OResource::loadPixmap( "wellenreiter/CancelIcon", Opie::Core::OResource::SmallIcon ) ); stopButton->setEnabled( false ); connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); QToolButton* d = new QToolButton( 0 ); + d->setUsesBigPixmap( useBigIcon ); QWhatsThis::add( d, tr( "Click here to open the configure dialog." ) ), #ifdef QWS d->setAutoRaise( true ); #endif - d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) ); + d->setIconSet( Opie::Core::OResource::loadPixmap( "wellenreiter/SettingsIcon", Opie::Core::OResource::SmallIcon ) ); connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); uploadButton = new QToolButton( 0 ); + uploadButton->setUsesBigPixmap( useBigIcon ); QWhatsThis::add( uploadButton, tr( "Click here to upload a capture session." ) ); #ifdef QWS uploadButton->setAutoRaise( true ); #endif - uploadButton->setIconSet( Resource::loadIconSet( "up" ) ); + uploadButton->setIconSet( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) ); uploadButton->setEnabled( false ); //uploadButton->setEnabled( true ); // DEBUGGING connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) ); // setup menu bar int id; QMenuBar* mb = menuBar(); QPopupMenu* fileSave = new QPopupMenu( mb ); fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); QPopupMenu* fileLoad = new QPopupMenu( mb ); fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); QPopupMenu* file = new QPopupMenu( mb ); file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); id = file->insertItem( tr( "&Load" ), fileLoad ); file->insertItem( tr( "&Save" ), fileSave ); file->insertSeparator(); uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) ); file->insertSeparator(); file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); QPopupMenu* sniffer = new QPopupMenu( mb ); sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); sniffer->insertSeparator(); startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); sniffer->setItemEnabled( startID, false ); stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); sniffer->setItemEnabled( stopID, false ); QPopupMenu* view = new QPopupMenu( mb ); view->insertItem( tr( "&Expand All" ), this, SLOT( viewExpandAll() ) ); view->insertItem( tr( "&Collapse All" ), this, SLOT( viewCollapseAll() ) ); QPopupMenu* demo = new QPopupMenu( mb ); demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); //demo->insertItem( tr( "&Read from GPSd" ), this, SLOT( demoReadFromGps() ) ); id = mb->insertItem( tr( "&File" ), file ); id = mb->insertItem( tr( "&View" ), view ); //mb->setItemEnabled( id, false ); diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 587faad..a61e808 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -1,72 +1,72 @@ /********************************************************************** ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Wellenreiter II. ** ** 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 "scanlist.h" #include "configwindow.h" #include "logwindow.h" /* OPIE */ #ifdef QWS #include <opie2/odebug.h> +#include <opie2/oresource.h> #include <qpe/qpeapplication.h> -#include <qpe/resource.h> #else #include "resource.h" #endif /* QT */ #include <qcursor.h> #include <qdatetime.h> #include <qpopupmenu.h> #include <qcheckbox.h> /* STD */ #include <assert.h> using namespace Opie::Core; using namespace Opie::Ui; using namespace Opie::Net; 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; const int col_ip = 6; const int col_manuf = 7; const int col_firstseen = 8; const int col_lastseen = 9; const int col_location = 10; #define DEBUG MScanListView::MScanListView( QWidget* parent, const char* name ) :OListView( parent, name ) { setFrameShape( QListView::StyledPanel ); setFrameShadow( QListView::Sunken ); addColumn( tr( "Net/Station" ) ); setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); addColumn( tr( "#" ) ); setColumnAlignment( col_sig, AlignCenter ); addColumn( tr( "MAC" ) ); setColumnAlignment( col_ap, AlignCenter ); addColumn( tr( "Chn" ) ); setColumnAlignment( col_channel, AlignCenter ); addColumn( tr( "W" ) ); @@ -432,124 +432,124 @@ MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) { #ifdef DEBUG odebug << "creating scanlist item" << oendl; #endif if ( WellenreiterConfigWindow::instance() ) WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here decorateItem( type, essid, macaddr, wep, channel, signal, false ); } const QString& MScanListItem::essid() const { if ( type == "network" ) return _essid; else return ( (MScanListItem*) parent() )->essid(); } OListViewItem* MScanListItem::childFactory() { return new MScanListItem( this ); } void MScanListItem::serializeTo( QDataStream& s ) const { #ifdef DEBUG odebug << "serializing MScanListItem" << oendl; #endif OListViewItem::serializeTo( s ); s << _type; s << (Q_UINT8) ( _wep ? 'y' : 'n' ); } void MScanListItem::serializeFrom( QDataStream& s ) { #ifdef DEBUG odebug << "serializing MScanListItem" << oendl; #endif OListViewItem::serializeFrom( s ); Q_UINT8 wep; s >> _type; s >> wep; _wep = (wep == 'y'); QString name = QString( "wellenreiter/"+ _type ); - setPixmap( col_type, Resource::loadPixmap( name ) ); + setPixmap( col_type, Opie::Core::OResource::loadPixmap( name, Opie::Core::OResource::SmallIcon ) ); if ( _wep ) - setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! + setPixmap( col_wep, Opie::Core::OResource::loadPixmap( "wellenreiter/cracked", Opie::Core::OResource::SmallIcon ) ); //FIXME: rename the pixmap! listView()->triggerUpdate(); } void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) { #ifdef DEBUG odebug << "decorating scanlist item " << type << " / " << essid << " / " << macaddr << "[" << channel << "]" << oendl; #endif // set icon for managed or adhoc mode QString name; name.sprintf( "wellenreiter/"+ type ); - setPixmap( col_type, Resource::loadPixmap( name ) ); + setPixmap( col_type, Opie::Core::OResource::loadPixmap( name, Opie::Core::OResource::SmallIcon ) ); // special case for probed networks FIXME: This is ugly at present if ( type == "network" && probed ) { - setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) ); + setPixmap( col_type, Opie::Core::OResource::loadPixmap( "wellenreiter/network-probed", Opie::Core::OResource::SmallIcon ) ); } // set icon for wep (wireless encryption protocol) if ( wep ) - setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! + setPixmap( col_wep, Opie::Core::OResource::loadPixmap( "wellenreiter/cracked", Opie::Core::OResource::SmallIcon ) ); //FIXME: 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 ) ); setText( col_firstseen, QTime::currentTime().toString() ); //setText( col_lastseen, QTime::currentTime().toString() ); listView()->triggerUpdate(); this->type = type; _type = type; _essid = essid; _macaddr = macaddr; _channel = channel; _beacons = 1; _signal = 0; if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) { listView()->ensureItemVisible( this ); } } void MScanListItem::setManufacturer( const QString& manufacturer ) { setText( col_manuf, manufacturer ); } void MScanListItem::setLocation( const QString& location ) { setText( col_location, location ); } void MScanListItem::receivedBeacon() { _beacons++; #ifdef DEBUG odebug << "MScanListItem " << _macaddr << ": received beacon #" << _beacons << "" << oendl; #endif setText( col_sig, QString::number( _beacons ) ); diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp index 1d5bd1b..11eb145 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp @@ -1,156 +1,156 @@ /********************************************************************** ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Wellenreiter II. ** ** 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 <qlabel.h> #include <qlayout.h> #include "logwindow.h" #include "packetview.h" #include "scanlist.h" #include "statwindow.h" #include "graphwindow.h" #ifdef QWS -#include <qpe/resource.h> +#include <opie2/oresource.h> #include <opie2/otabwidget.h> using namespace Opie; #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' */ using namespace Opie::Ui; using namespace Opie::Ui; using namespace Opie::Ui; WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { - //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); - //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) ); - //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) ); - //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) ); + //ani1 = new QPixmap( Opie::Core::OResource::loadPixmap( "wellenreiter/networks_rot0", Opie::Core::OResource::SmallIcon ) ); + //ani2 = new QPixmap( Opie::Core::OResource::loadPixmap( "wellenreiter/networks_rot90", Opie::Core::OResource::SmallIcon ) ); + //ani3 = new QPixmap( Opie::Core::OResource::loadPixmap( "wellenreiter/networks_rot180", Opie::Core::OResource::SmallIcon ) ); + //ani4 = new QPixmap( Opie::Core::OResource::loadPixmap( "wellenreiter/networks_rot270", Opie::Core::OResource::SmallIcon ) ); if ( !name ) setName( "WellenreiterBase" ); resize( 191, 294 ); #ifdef QWS setCaption( tr( "Wellenreiter/Opie" ) ); #else setCaption( tr( "Wellenreiter/X11" ) ); #endif 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 MScanListView( ap ); apLayout->addWidget( netview ); //--------- GRAPH TAB -------------- graphwindow = new MGraphWindow( TabWidget, "Graph" ); //--------- LOG TAB -------------- logwindow = new MLogWindow( TabWidget, "Log" ); //--------- HEX TAB -------------- hexwindow = new PacketView( TabWidget, "Hex" ); //--------- STAT TAB -------------- statwindow = new MStatWindow( TabWidget, "Stat" ); //--------- 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 ); - QPixmap logo = Resource::loadPixmap( "wellenreiter/logo" ); + QPixmap logo = Opie::Core::OResource::loadPixmap( "wellenreiter/logo" ); QPainter draw( &logo ); draw.setPen( Qt::black ); draw.setFont( QFont( "Fixed", 8 ) ); draw.drawText( 5, 10, WELLENREITER_VERSION ); PixmapLabel1_3_2->setPixmap( 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( "<p align=center>" "<hr>" "<b>(C) Michael 'Mickey' Lauer</b><br>" "<hr>" "mickey@Vanille.de<br>" "www.Vanille.de/projects/wellenreiter.html<br>" "www.wellenreiter.net" "</p>" ); TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); #ifdef QWS TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) ); TabWidget->addTab( graphwindow, "wellenreiter/graph", tr( "Graph" ) ); TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) ); TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); #else TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) ); TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) ); TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); #endif WellenreiterBaseLayout->addWidget( TabWidget ); #ifdef QWS TabWidget->setCurrentTab( tr( "Nets" ) ); |