From 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Sun, 04 Apr 2004 13:54:40 +0000 Subject: convert to Opie Debugging Framework --- (limited to 'noncore/net/wellenreiter/gui') diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index da39113..bfdb20a 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -23,7 +23,9 @@ #include #include #include -using namespace Opie; +#include +using namespace Opie::Core; +using namespace Opie::Net; #endif /* QT */ @@ -40,15 +42,9 @@ using namespace Opie; #include #include -/* POSIX */ +/* STD */ #include -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Core; -using namespace Opie::Net; WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) @@ -116,7 +112,7 @@ void WellenreiterConfigWindow::performAutodetection() // and sleep a second, so that it looks // like we're actually doing something fancy... ;-) - qDebug( "WellenreiterConfigWindow::performAutodetection()" ); + odebug << "WellenreiterConfigWindow::performAutodetection()" << oendl; // try to guess device type QFile m( "/proc/modules" ); @@ -137,7 +133,7 @@ void WellenreiterConfigWindow::performAutodetection() { deviceType->setCurrentItem( devicetype ); _guess = devicetype; - qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); + odebug << "Wellenreiter: guessed device type to be #" << devicetype << "" << oendl; } } } @@ -241,7 +237,7 @@ void WellenreiterConfigWindow::changedStationAction(int t) void WellenreiterConfigWindow::getCaptureFileNameClicked() { QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); - qDebug( "name = %s", (const char*) name ); + odebug << "name = " << (const char*) name << "" << oendl; if ( !name.isEmpty() ) { captureFileName->setText( name ); @@ -316,11 +312,11 @@ void WellenreiterConfigWindow::performAction( const QString& type, } else { - qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type ); + owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << (const char*) type << "'" << oendl; return; } - qDebug( "for event '%s' I'm going to perform action %d (script='%s')", (const char*) type, action, (const char*) script ); + odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << (const char*) script << "')" << oendl; switch( action ) { @@ -345,9 +341,9 @@ void WellenreiterConfigWindow::performAction( const QString& type, script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); - qDebug( "going to call script '%s'", (const char*) script ); + odebug << "going to call script '" << (const char*) script << "'" << oendl; ::system( script ); - qDebug( "script returned." ); + odebug << "script returned." << oendl; return; } default: assert( false ); @@ -361,7 +357,7 @@ void WellenreiterConfigWindow::load() #warning Persistent Configuration not yet implemented for standalone X11 build performAutodetection(); #else - qDebug( "loading configuration settings..." ); + odebug << "loading configuration settings..." << oendl; /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ @@ -439,7 +435,7 @@ void WellenreiterConfigWindow::save() #ifdef Q_WS_X11 #warning Persistent Configuration not yet implemented for standalone X11 build #else - qDebug( "saving configuration settings..." ); + odebug << "saving configuration settings..." << oendl; /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index a47b4ec..bd91e35 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp @@ -15,6 +15,10 @@ #include "gps.h" +/* OPIE */ +#include +using namespace Opie::Core; + /* QT */ #include @@ -25,14 +29,14 @@ GPS::GPS( QObject* parent, const char * name ) :QObject( parent, name ) { - qDebug( "GPS::GPS()" ); + odebug << "GPS::GPS()" << oendl; _socket = new QSocket( this, "gpsd commsock" ); } GPS::~GPS() { - qDebug( "GPS::~GPS()" ); + odebug << "GPS::~GPS()" << oendl; } @@ -53,7 +57,7 @@ GpsLocation GPS::position() const if ( result ) { int numAvail = _socket->bytesAvailable(); - qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); + odebug << "GPS write succeeded, " << numAvail << " bytes available for reading..." << oendl; if ( numAvail ) { int numRead = _socket->readBlock( &buf[0], sizeof buf ); @@ -61,7 +65,7 @@ GpsLocation GPS::position() const if ( numRead < 7 || numScan != 2 ) { - qDebug( "GPS read %d bytes succeeded, invalid response: '%s'", numRead, &buf[0] ); + odebug << "GPS read " << numRead << " bytes succeeded, invalid response: '" << &buf[0] << "'" << oendl; return GpsLocation( -111, -111 ); } else diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp index 1c72cf4..714a9a9 100644 --- a/noncore/net/wellenreiter/gui/logwindow.cpp +++ b/noncore/net/wellenreiter/gui/logwindow.cpp @@ -14,6 +14,12 @@ **********************************************************************/ #include "logwindow.h" + +/* OPIE */ +#include +using namespace Opie::Core; + +/* QT */ #include #include @@ -38,7 +44,7 @@ void MLogWindow::log( QString text ) int row; ledit->getCursorPosition( &col, &row ); ledit->insertAt( line, col, row ); - qDebug( line ); + odebug << line << oendl; } diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp index 6bbc39b..62db967 100644 --- a/noncore/net/wellenreiter/gui/main.cpp +++ b/noncore/net/wellenreiter/gui/main.cpp @@ -14,24 +14,27 @@ **********************************************************************/ #include "mainwindow.h" + #ifdef QWS +#include #include #include #else #include #endif +/* QT */ #include #include +/* STD */ #include #include #include #include using namespace Opie::Core; -using namespace Opie::Core; -using namespace Opie::Core; + int main( int argc, char **argv ) { #ifdef QWS @@ -55,10 +58,10 @@ int main( int argc, char **argv ) bool check = true; for ( int i = 1; i < argc; ++i ) { - qDebug( "Wellenreiter::main() parsing argument %d = '%s'", i, argv[i] ); + odebug << "Wellenreiter::main() parsing argument " << i << " = '" << argv[i] << "'" << oendl; if ( !strcmp( "-nocheck", argv[i] ) ) { - qDebug( "-nocheck found" ); + odebug << "-nocheck found" << oendl; check = false; break; } @@ -69,7 +72,7 @@ int main( int argc, char **argv ) // root check if ( getuid() ) { - qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); + owarn << QObject::tr( "Wellenreiter: trying to run as non-root!" ) << oendl; result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), QMessageBox::Yes, QMessageBox::No ); @@ -86,7 +89,7 @@ int main( int argc, char **argv ) if ( result == QMessageBox::Yes ) { if ( -1 == ::kill( dhcpid, SIGTERM ) ) - qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); + owarn << "Wellenreiter: can't kill process #" << result << " (" << strerror( errno ) << ")" << oendl; else killed = true; } diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 7add6cd..a4b8839 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -21,6 +21,21 @@ #include "wellenreiter.h" #include "scanlist.h" +/* OPIE */ +#ifdef QWS +#include +#include +#include +#else +#include "resource.h" +#include +#include +#endif +using namespace Opie::Core; +using namespace Opie::Net; +using namespace Opie::Ui; + +/* QT */ #include #include #include @@ -39,23 +54,9 @@ #include #include -#ifdef QWS -#include -#include -using namespace Opie; -#else -#include "resource.h" -#include -#include -#endif - +/* STD */ #include -using namespace Opie::Ui; -using namespace Opie::Net; -using namespace Opie::Ui; -using namespace Opie::Net; -using namespace Opie::Net; WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) :QMainWindow( parent, name, f ) { @@ -188,7 +189,7 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n void WellenreiterMainWindow::showConfigure() { - qDebug( "show configure..." ); + odebug << "show configure..." << oendl; cw->setCaption( tr( "Configure" ) ); int result = QPEApplication::execDialog( cw ); @@ -231,7 +232,7 @@ void WellenreiterMainWindow::changedSniffingState() WellenreiterMainWindow::~WellenreiterMainWindow() { - qDebug( "Wellenreiter: bye." ); + odebug << "Wellenreiter: bye." << oendl; }; @@ -251,7 +252,7 @@ void WellenreiterMainWindow::demoReadFromGps() { WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance(); GPS* gps = new GPS( this ); - qDebug( "Wellenreiter::demoReadFromGps(): url=gps://%s:%d/", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); + odebug << "Wellenreiter::demoReadFromGps(): url=gps://" << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "/" << oendl; gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); GpsLocation loc = gps->position(); QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) ); @@ -305,11 +306,11 @@ void WellenreiterMainWindow::fileSaveLog() QTextStream t( &f ); t << mw->logWindow()->getLog(); f.close(); - qDebug( "Saved log to file '%s'", (const char*) fname ); + odebug << "Saved log to file '" << (const char*) fname << "'" << oendl; } else { - qDebug( "Problem saving log to file '%s'", (const char*) fname ); + odebug << "Problem saving log to file '" << (const char*) fname << "'" << oendl; } } } @@ -326,11 +327,11 @@ void WellenreiterMainWindow::fileSaveSession() QDataStream t( &f ); t << *mw->netView(); f.close(); - qDebug( "Saved session to file '%s'", (const char*) fname ); + odebug << "Saved session to file '" << (const char*) fname << "'" << oendl; } else { - qDebug( "Problem saving session to file '%s'", (const char*) fname ); + odebug << "Problem saving session to file '" << (const char*) fname << "'" << oendl; } } } @@ -348,11 +349,11 @@ void WellenreiterMainWindow::fileSaveHex() QTextStream t( &f ); t << mw->hexWindow()->getLog(); f.close(); - qDebug( "Saved hex log to file '%s'", (const char*) fname ); + odebug << "Saved hex log to file '" << (const char*) fname << "'" << oendl; } else { - qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); + odebug << "Problem saving hex log to file '" << (const char*) fname << "'" << oendl; } } */ @@ -369,11 +370,11 @@ void WellenreiterMainWindow::fileLoadSession() QDataStream t( &f ); t >> *mw->netView(); f.close(); - qDebug( "Loaded session from file '%s'", (const char*) fname ); + odebug << "Loaded session from file '" << (const char*) fname << "'" << oendl; } else { - qDebug( "Problem loading session from file '%s'", (const char*) fname ); + odebug << "Problem loading session from file '" << (const char*) fname << "'" << oendl; } } } @@ -438,11 +439,11 @@ void WellenreiterMainWindow::uploadSession() if ( !result ) { - qDebug( "Session upload cancelled :(" ); + odebug << "Session upload cancelled :(" << oendl; return; } - qDebug( "Starting upload..." ); + odebug << "Starting upload..." << oendl; struct sockaddr_in raddr; struct hostent *rhost_info; diff --git a/noncore/net/wellenreiter/gui/packetview.cpp b/noncore/net/wellenreiter/gui/packetview.cpp index 3d3aa18..4df01da 100644 --- a/noncore/net/wellenreiter/gui/packetview.cpp +++ b/noncore/net/wellenreiter/gui/packetview.cpp @@ -84,7 +84,7 @@ void PacketView::showPacket( int number ) } else { - qDebug( "D'oh! No packet!" ); + odebug << "D'oh! No packet!" << oendl; } } diff --git a/noncore/net/wellenreiter/gui/resource.cpp b/noncore/net/wellenreiter/gui/resource.cpp index d98ef0b..cb17f51 100644 --- a/noncore/net/wellenreiter/gui/resource.cpp +++ b/noncore/net/wellenreiter/gui/resource.cpp @@ -29,7 +29,7 @@ QPixmap loadPixmap( const QString& pix ) QPixmap pixmap( filename ); if ( pixmap.isNull() ) { - qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); + odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; } return pixmap; }; @@ -41,7 +41,7 @@ QIconSet loadIconSet( const QString& pix ) QPixmap pixmap( filename ); if ( pixmap.isNull() ) { - qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); + odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; } return QIconSet( pixmap ); }; diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 3b7120a..a2be782 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -17,21 +17,26 @@ #include "configwindow.h" #include "logwindow.h" -#include -#include -#include -#include -#include - +/* OPIE */ #ifdef QWS +#include #include -#endif - -#ifdef QWS #include #else #include "resource.h" #endif +using namespace Opie::Core; +using namespace Opie::Ui; +using namespace Opie::Net; + +/* QT */ +#include +#include +#include +#include + +/* STD */ +#include const int col_type = 0; const int col_essid = 0; @@ -46,12 +51,6 @@ const int col_firstseen = 8; const int col_lastseen = 9; const int col_location = 10; -using namespace Opie::Net; -using namespace Opie::Ui; -using namespace Opie::Net; -using namespace Opie::Ui; -using namespace Opie::Ui; -using namespace Opie::Net; MScanListView::MScanListView( QWidget* parent, const char* name ) :OListView( parent, name ) { @@ -106,14 +105,14 @@ OListViewItem* MScanListView::childFactory() void MScanListView::serializeTo( QDataStream& s) const { - qDebug( "serializing MScanListView" ); + odebug << "serializing MScanListView" << oendl; OListView::serializeTo( s ); } void MScanListView::serializeFrom( QDataStream& s) { - qDebug( "serializing MScanListView" ); + odebug << "serializing MScanListView" << oendl; OListView::serializeFrom( s ); } @@ -143,7 +142,7 @@ void MScanListView::addNewItem( const QString& type, while ( item && ( item->text( col_essid ) != essid ) ) { #ifdef DEBUG - qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); + odebug << "itemtext: " << (const char*) item->text( col_essid ) << "" << oendl; #endif item = static_cast ( item->nextSibling() ); } @@ -159,7 +158,7 @@ void MScanListView::addNewItem( const QString& type, while ( item && ( item->text( col_ap ) != macaddr ) ) { #ifdef DEBUG - qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); + odebug << "subitemtext: " << (const char*) item->text( col_ap ) << "" << oendl; #endif item = static_cast ( item->nextSibling() ); } @@ -168,7 +167,7 @@ void MScanListView::addNewItem( const QString& type, { // we have already seen this item, it's a dupe #ifdef DEBUG - qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); + odebug << "" << (const char*) macaddr << " is a dupe - ignoring..." << oendl; #endif item->receivedBeacon(); return; @@ -186,7 +185,7 @@ void MScanListView::addNewItem( const QString& type, // no essid to reduce clutter, maybe later we have a nick or stationname to display!? #ifdef DEBUG - qDebug( "inserting new station %s", (const char*) macaddr ); + odebug << "inserting new station " << (const char*) macaddr << "" << oendl; #endif MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); @@ -212,7 +211,7 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) { #ifdef DEBUG - qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); + odebug << "subitemtext: " << (const char*) subitem->text( col_ap ) << "" << oendl; #endif subitem = static_cast ( subitem->nextSibling() ); } @@ -221,7 +220,7 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& { // we have already seen this item, it's a dupe #ifdef DEBUG - qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); + odebug << "" << (const char*) addr.toString(true) << " is a dupe - ignoring..." << oendl; #endif subitem->receivedBeacon(); //FIXME: sent data bit return; @@ -246,7 +245,7 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) { - qDebug( "WDSTraffic: %s and %s seem to form a WDS", (const char*) viaFrom.toString(), (const char*) viaTo.toString() ); + odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << (const char*) viaTo.toString() << " seem to form a WDS" << oendl; QString s; MScanListItem* network; @@ -264,7 +263,7 @@ void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, } else { - qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); + odebug << "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); } } @@ -286,7 +285,7 @@ void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, } else { - qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); + odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); } @@ -309,7 +308,7 @@ void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& t } else { - qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); + odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); } } @@ -317,14 +316,14 @@ void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& t void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) { - qWarning( "D'oh! Not yet implemented..." ); + owarn << "D'oh! Not yet implemented..." << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); } void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) { - qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); + odebug << "identify " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl; QListViewItemIterator it( this ); for ( ; it.current(); ++it ) @@ -335,7 +334,7 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) return; } } - qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); + odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", (const char*) macaddr.toString(), (const char*) ip ) ); } @@ -343,7 +342,7 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) { - qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip ); + odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl; //TODO: Refactor that out, we need it all over the place. // Best to do it in a more comfortable abstraction in OListView @@ -360,7 +359,7 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr, while ( subitem && ( subitem->text( col_essid ) != name ) ) { #ifdef DEBUG - qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) ); + odebug << "subitemtext: " << (const char*) subitem->text( col_essid ) << "" << oendl; #endif subitem = static_cast ( subitem->nextSibling() ); } @@ -369,7 +368,7 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr, { // we have already seen this item, it's a dupe #ifdef DEBUG - qDebug( "%s is a dupe - ignoring...", (const char*) name ); + odebug << "" << (const char*) name << " is a dupe - ignoring..." << oendl; #endif subitem->receivedBeacon(); //FIXME: sent data bit return; @@ -383,7 +382,7 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr, return; } } - qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); + odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", (const char*) macaddr.toString(), (const char*) ip ) ); } @@ -421,7 +420,7 @@ MScanListItem::MScanListItem( QListView* parent, const QString& type, const QStr _channel( channel ), _signal( signal ), _beacons( 1 ) { #ifdef DEBUG - qDebug( "creating scanlist item" ); + odebug << "creating scanlist item" << oendl; #endif if ( WellenreiterConfigWindow::instance() ) @@ -435,7 +434,7 @@ MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) { #ifdef DEBUG - qDebug( "creating scanlist item" ); + odebug << "creating scanlist item" << oendl; #endif if ( WellenreiterConfigWindow::instance() ) WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here @@ -459,7 +458,7 @@ OListViewItem* MScanListItem::childFactory() void MScanListItem::serializeTo( QDataStream& s ) const { #ifdef DEBUG - qDebug( "serializing MScanListItem" ); + odebug << "serializing MScanListItem" << oendl; #endif OListViewItem::serializeTo( s ); @@ -470,7 +469,7 @@ void MScanListItem::serializeTo( QDataStream& s ) const void MScanListItem::serializeFrom( QDataStream& s ) { #ifdef DEBUG - qDebug( "serializing MScanListItem" ); + odebug << "serializing MScanListItem" << oendl; #endif OListViewItem::serializeFrom( s ); @@ -556,7 +555,7 @@ void MScanListItem::receivedBeacon() { _beacons++; #ifdef DEBUG - qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); + odebug << "MScanListItem " << (const char*) _macaddr << ": received beacon #" << _beacons << "" << oendl; #endif setText( col_sig, QString::number( _beacons ) ); setText( col_lastseen, QTime::currentTime().toString() ); diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index fff7c35..fad6efd 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -11,8 +11,6 @@ ** ***********************************************************************/ -// Local - #include "gps.h" #include "wellenreiter.h" #include "scanlist.h" @@ -23,10 +21,10 @@ #include "graphwindow.h" #include "protolistview.h" -// Opie - +/* OPIE */ #ifdef QWS #include +#include #include #else #include @@ -35,10 +33,11 @@ #include #include #include -using namespace Opie; - -// Qt +using namespace Opie::Core; +using namespace Opie::Net; +using namespace Opie::Ui; +/* QT */ #include #include #include @@ -52,8 +51,7 @@ using namespace Opie; #include #include -// Standard - +/* STD */ #include #include #include @@ -61,12 +59,6 @@ using namespace Opie; #include #include -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Net; -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Core; Wellenreiter::Wellenreiter( QWidget* parent ) : WellenreiterBase( parent, 0, 0 ), sniffing( false ), iface( 0 ), configwindow( 0 ) @@ -106,7 +98,7 @@ Wellenreiter::~Wellenreiter() void Wellenreiter::initialTimer() { - qDebug( "Wellenreiter::preloading manufacturer database..." ); + odebug << "Wellenreiter::preloading manufacturer database..." << oendl; OManufacturerDB::instance(); } @@ -149,12 +141,12 @@ void Wellenreiter::handleNotification( OPacket* p ) if ( configwindow->parsePackets->isProtocolChecked( name ) ) { QString action = configwindow->parsePackets->protocolAction( name ); - qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); + odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl; doAction( action, name, p ); } else { - qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); + odebug << "protocol '" << (const char*) name << "' not checked in parsePackets." << oendl; } ++it; } @@ -166,7 +158,7 @@ void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); - else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() ); + else owarn << "Wellenreiter::handleManagementFrame(): '" << (const char*) manage->managementType() << "' - please handle me!" << oendl; } @@ -182,14 +174,14 @@ void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManage if ( configwindow->enableGPS->isChecked() ) { // TODO: add check if GPS is working!? - qDebug( "Wellenreiter::gathering GPS data..." ); + odebug << "Wellenreiter::gathering GPS data..." << oendl; loc = gps->position(); - qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); + odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; } if ( essid.length() ) netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); - qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" ); + odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; } @@ -211,7 +203,7 @@ void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPa } else { - qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); + owarn << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; return; } @@ -226,9 +218,9 @@ void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPa if ( configwindow->enableGPS->isChecked() ) { // TODO: add check if GPS is working!? - qDebug( "Wellenreiter::gathering GPS data..." ); + odebug << "Wellenreiter::gathering GPS data..." << oendl; loc = gps->position(); - qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); + odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; } netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); @@ -255,7 +247,7 @@ void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* contro } else { - qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); + odebug << "Wellenreiter::handleControlFrame - please handle " << (const char*) control->controlType() << " in a future version! :D" << oendl; } } @@ -304,7 +296,7 @@ void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); if ( arp ) { - qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); + odebug << "Received ARP traffic (type '" << (const char*) arp->type() << "'): " << oendl; if ( arp->type() == "REQUEST" ) { netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); @@ -325,16 +317,16 @@ void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); if ( dhcp ) { - qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); + odebug << "Received DHCP '" << (const char*) dhcp->type() << "' packet" << oendl; if ( dhcp->type() == "OFFER" ) { - qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); + odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << (const char*) dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; netView()->identify( source, dhcp->serverAddress().toString() ); netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); } else if ( dhcp->type() == "ACK" ) { - qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); + odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << (const char*) dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); } } @@ -368,7 +360,7 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) if ( configwindow->capturePackets->isProtocolChecked( name ) ) { QString action = configwindow->capturePackets->protocolAction( name ); - qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); + odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl; if ( action == "Discard" ) { logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); @@ -377,7 +369,7 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) } else { - qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name ); + odebug << "protocol '" << (const char*) name << "' not checked in capturePackets." << oendl; } ++it; } @@ -551,7 +543,7 @@ void Wellenreiter::startClicked() case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; - case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; + case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << (const char*) interface << "'" << oendl; break; default: assert( 0 ); // shouldn't reach this } @@ -572,7 +564,7 @@ void Wellenreiter::startClicked() // open GPS device if ( configwindow->enableGPS->isChecked() ) { - qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); + odebug << "Wellenreiter:GPS enabled @ " << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl; gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); } @@ -596,7 +588,7 @@ void Wellenreiter::startClicked() else pcap->open( QFile( interface ) ); - qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname ); + odebug << "Wellenreiter:: dumping to " << (const char*) dumpname << "" << oendl; pcap->openDumpFile( dumpname ); if ( !pcap->isOpen() ) @@ -652,7 +644,7 @@ void Wellenreiter::startClicked() void Wellenreiter::timerEvent( QTimerEvent* ) { - qDebug( "Wellenreiter::timerEvent()" ); + odebug << "Wellenreiter::timerEvent()" << oendl; OPacket* p = pcap->next(); if ( !p ) // no more packets available { @@ -715,15 +707,15 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); int count = 3; - qDebug("sending %d messages",count); + odebug << "sending " << count << " messages" << oendl; msg << QString("count") << QString::number(count); - qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); + odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; msg << QString(iface->name()) << QString("Mode") << type; - qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); + odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; msg << QString(iface->name()) << QString("ESSID") << essid; - qDebug("msg >%s< channel >%d<", iface->name(),channel); + odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; msg << QString(iface->name()) << QString("Channel") << channel; -// qDebug("msg >%s< mac >%s<", iface->name(),macaddr); +// odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; // msg << QString(iface->name()) << QString("MacAddr") << macaddr; #else QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); -- cgit v0.9.0.2