From 5334b639c9f97793bcae4f50f7b47c7a2ada4e2f Mon Sep 17 00:00:00 2001 From: wimpie Date: Fri, 02 Apr 2004 18:29:49 +0000 Subject: First import of NS2 app --- (limited to 'noncore/settings/networksettings2/profile/profileedit.cpp') diff --git a/noncore/settings/networksettings2/profile/profileedit.cpp b/noncore/settings/networksettings2/profile/profileedit.cpp new file mode 100644 index 0000000..3f72c52 --- a/dev/null +++ b/noncore/settings/networksettings2/profile/profileedit.cpp @@ -0,0 +1,93 @@ +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "profileedit.h" + +ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : + ProfileGUI( Parent ), TrafficRefresh(this) { + InterfaceInfo * II; + + NNI = TNNI; + Dev = NNI->runtime()->device(); + if( ( II = Dev->assignedInterface() ) ) { + Refresh_CB->setEnabled( TRUE ); + Snd_GB->setEnabled( TRUE ); + Rcv_GB->setEnabled( TRUE ); + Collisions_FRM->setEnabled( TRUE ); + // show current content + SLOT_Refresh(); + + // fill in static data + InterfaceName_LBL->setText( II->Name ); + IPAddress_LBL->setText( II->Address ); + SubnetMask_LBL->setText( II->Netmask ); + Broadcast_LBL->setText( II->BCastAddress ); + MACAddress_LBL->setText( II->MACAddress ); + if( II->IsPointToPoint ) { + PointToPoint_LBL->setText( II->DstAddress ); + } + QString S; + InterfaceName_LBL->setText( II->Name ); + if( II->HasMulticast ) { + S += "Multicast"; + } + if( ! S.isEmpty() ) { + S.prepend( " : " ); + } + InterfaceOptions_LBL->setText( S ); + } + + connect( &TrafficRefresh, SIGNAL( timeout() ), + this, SLOT( SLOT_Refresh() ) ); +} + +QString ProfileEdit::acceptable( void ) { + return QString(); +} + +void ProfileEdit::showData( ProfileData_t & Data ) { + Description_LE->setText( Data.Description ); + Automatic_CB->setChecked( Data.Automatic ); + Confirm_CB->setChecked( Data.Confirm ); + Disabled_CB->setChecked( Data.Disabled ); +} + + +bool ProfileEdit::commit( ProfileData_t & Data ) { + bool SM = 0; + TXTM( Data.Description, Description_LE, SM ); + + CBM( Data.Automatic, Automatic_CB, SM ); + CBM( Data.Disabled, Disabled_CB, SM ); + CBM( Data.Confirm, Confirm_CB, SM ); + + return SM; +} + +void ProfileEdit::SLOT_Refresh( void ) { + InterfaceInfo * II = Dev->assignedInterface(); + NSResources->system().refreshStatistics( *II ); + RcvBytes_LBL->setText( II->RcvBytes ); + SndBytes_LBL->setText( II->SndBytes ); + RcvErrors_LBL->setText( II->RcvErrors ); + SndErrors_LBL->setText( II->SndErrors ); + RcvDropped_LBL->setText( II->RcvDropped ); + SndDropped_LBL->setText( II->SndDropped ); + Collisions_LBL->setText( II->Collisions ); +} + +void ProfileEdit::SLOT_AutoRefresh( bool ar ) { + if( ar ) { + TrafficRefresh.start( 1000 ); + SLOT_Refresh(); + } else { + TrafficRefresh.stop(); + } +} -- cgit v0.9.0.2