Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 70 |
1 files changed, 41 insertions, 29 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index e801ce7..df8e9c3 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -34,7 +34,4 @@ #include <opie2/opcap.h> #include <qpe/qcopenvelope_qws.h> -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Ui; /* QT */ @@ -61,4 +58,9 @@ using namespace Opie::Ui; #include <signal.h> + +using namespace Opie::Core; +using namespace Opie::Net; +using namespace Opie::Ui; + Wellenreiter* Wellenreiter::instance = 0; @@ -75,6 +77,5 @@ Wellenreiter::Wellenreiter( QWidget* parent ) #ifdef QWS - QString sys; - sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); + QString sys = QString( "(i) Running on '%1'.").arg( ODevice::inst()->systemString() ); _system = ODevice::inst()->system(); logwindow->log( sys ); @@ -111,4 +112,5 @@ void Wellenreiter::initialTimer() void Wellenreiter::signalHandler( int sig ) { + Q_UNUSED( sig ) oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl; if ( Wellenreiter::instance->sniffing ) @@ -177,5 +179,5 @@ void Wellenreiter::handleNotification( OPacket* p ) { QString action = configwindow->parsePackets->protocolAction( name ); - odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << action << "'" << oendl; + odebug << "parsePacket-action for '" << name << "' seems to be '" << action << "'" << oendl; doAction( action, name, p ); } @@ -198,10 +200,10 @@ void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* -void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) +void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* /* request */ ) { OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); - OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); - int channel = ds ? ds->channel() : -1; +// OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); +// int channel = ds ? ds->channel() : -1; OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); @@ -221,10 +223,10 @@ void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManage -void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) +void Wellenreiter::handleManagementFrameProbeResponse( OPacket* /* p */, OWaveLanManagementPacket* /* response */ ) { } -void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) +void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) { QString type; @@ -288,5 +290,5 @@ void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* contro -void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) +void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* /* data */ , OMacAddress& from, OMacAddress& to ) { OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); @@ -318,5 +320,5 @@ void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAdd -void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) +void Wellenreiter::handleEthernetData( OPacket* /* p */, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) { from = data->sourceAddress(); @@ -327,5 +329,5 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd -void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) +void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& /* source */, OMacAddress& /* dest */ ) { OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); @@ -346,5 +348,5 @@ void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, -void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) +void Wellenreiter::handleIPData( OPacket* p, OIPPacket* /* ip */, OMacAddress& source, OMacAddress& /* dest */ ) { //TODO: Implement more IP based protocols @@ -356,5 +358,5 @@ void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, if ( dhcp->type() == "OFFER" ) { - odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; + odebug << "DHCP: '" << source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; netView()->identify( source, dhcp->serverAddress().toString() ); netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); @@ -362,5 +364,5 @@ void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, else if ( dhcp->type() == "ACK" ) { - odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; + odebug << "DHCP: '" << dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); } @@ -396,8 +398,8 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) { QString action = configwindow->capturePackets->protocolAction( name ); - odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << action << "'" << oendl; + odebug << "capturePackets-action for '" << name << "' seems to be '" << action << "'" << oendl; if ( action == "Discard" ) { - logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); + logwindow->log( QString("(i) dump-discarding of '%1' packet requested." ).arg( name ) ); return false; } @@ -521,7 +523,5 @@ void Wellenreiter::stopClicked() #endif - // print out statistics - for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) - statwindow->updateCounter( it.key(), it.data() ); + updateStatistics(); } @@ -533,5 +533,5 @@ void Wellenreiter::startClicked() const QString& interface = configwindow->interfaceName->currentText(); const int cardtype = configwindow->driverType(); - const int interval = configwindow->hoppingInterval(); +// const int interval = configwindow->hoppingInterval(); if ( ( interface == "" ) || ( cardtype == 0 ) ) @@ -705,5 +705,5 @@ void Wellenreiter::timerEvent( QTimerEvent* ) -void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) +void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ ) { #ifdef QWS @@ -719,8 +719,8 @@ void Wellenreiter::doAction( const QString& action, const QString& protocol, OPa ODevice::inst()->setLedState( Led_Mail, Led_Off ); else if ( action == "LogMessage" ) - logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); + logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) ); else if ( action == "MessageBox" ) QMessageBox::information( this, "Notification!", - QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); + QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) ); #else #warning Actions do not work with Qt/X11 yet @@ -743,7 +743,7 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch } - odebug << "joinNetwork() with Interface " << (const char*) iface->name() - << ": " << (const char*) type << ", " << (const char*) essid - << ", " << channel << ", " << (const char*) macaddr << oendl; + odebug << "joinNetwork() with Interface " << iface->name() + << ": " << type << ", " << essid + << ", " << channel << ", " << macaddr << oendl; QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); @@ -765,2 +765,14 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch } +void Wellenreiter::updateStatistics() +{ + // print out statistics + for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) + statwindow->updateCounter( it.key(), it.data() ); +} + +void Wellenreiter::slotTabChanged( QWidget* wid ) +{ + if ( wid == statwindow ) + updateStatistics(); +} |