Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

profileedit.cpp

Go to the documentation of this file.
00001 #include <qlabel.h>
00002 #include <qgroupbox.h>
00003 #include <qpushbutton.h>
00004 #include <qframe.h>
00005 #include <qcheckbox.h>
00006 #include <qmultilineedit.h>
00007 #include <qcheckbox.h>
00008 
00009 #include <GUIUtils.h>
00010 #include <netnode.h>
00011 #include <resources.h>
00012 
00013 #include "profileedit.h"
00014 
00015 ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : 
00016       ProfileGUI( Parent ), RefreshTimer(this) {
00017       InterfaceInfo * II;
00018 
00019       II = TNNI->networkSetup()->assignedInterface();
00020       Log(( "Interface %p %p %p: %d\n", II, 
00021             TNNI, TNNI->networkSetup(), (II) ? II->IsUp : 0 ));
00022 
00023       NNI = TNNI;
00024       Dev = NNI->runtime()->device();
00025       if( ( II = NNI->networkSetup()->assignedInterface() ) ) {
00026 
00027         Refresh_CB->setEnabled( TRUE );
00028         ResetODO_But->setEnabled( TRUE );
00029         Sending_GB->setEnabled( TRUE );
00030         Receiving_GB->setEnabled( TRUE );
00031         Misc_GB->setEnabled( TRUE );
00032 
00033         // show current content
00034         SLOT_Refresh();
00035 
00036         // initialize ODO
00037         SLOT_ResetODO();
00038 
00039         // fill in static data
00040         InterfaceName_LBL->setText( II->Name );
00041         IPAddress_LBL->setText( II->Address );
00042         SubnetMask_LBL->setText( II->Netmask );
00043         Broadcast_LBL->setText( II->BCastAddress );
00044         MACAddress_LBL->setText( II->MACAddress );
00045         if( II->IsPointToPoint ) {
00046           PointToPoint_LBL->setText( II->DstAddress );
00047         }
00048         QString S;
00049         InterfaceName_LBL->setText( II->Name );
00050         if( II->HasMulticast ) {
00051           S += "Multicast";
00052         }
00053         if( ! S.isEmpty() ) {
00054           S.prepend( " : " );
00055         }
00056         InterfaceOptions_LBL->setText( S  );
00057 
00058         connect( &RefreshTimer, SIGNAL( timeout() ),
00059                  this, SLOT( SLOT_Refresh() ) );
00060       }
00061 
00062 }
00063 
00064 QString ProfileEdit::acceptable( void ) {
00065     return QString();
00066 }
00067 
00068 void ProfileEdit::showData( ProfileData & Data ) {
00069     Description_LE->setText( Data.Description );
00070     Automatic_CB->setChecked( Data.Automatic );
00071     TriggersVPN_CB->setChecked( Data.TriggerVPN );
00072     Confirm_CB->setChecked( Data.Confirm );
00073     Enabled_CB->setChecked( Data.Enabled );
00074 }
00075 
00076 
00077 bool ProfileEdit::commit( ProfileData & Data ) {
00078     bool SM = 0;
00079     TXTM( Data.Description, Description_LE, SM );
00080 
00081     CBM( Data.Automatic, Automatic_CB, SM );
00082     CBM( Data.TriggerVPN, TriggersVPN_CB, SM );
00083     CBM( Data.Enabled, Enabled_CB, SM );
00084     CBM( Data.Confirm, Confirm_CB, SM );
00085 
00086     return SM;
00087 }
00088 
00089 void ProfileEdit::SLOT_Refresh( void ) {
00090     InterfaceInfo * II = NNI->networkSetup()->assignedInterface();
00091     QString S;
00092     NSResources->system().refreshStatistics( *II );
00093 
00094     RcvBytes_LBL->setText( II->RcvBytes );
00095     RcvPackets_LBL->setText( II->RcvPackets );
00096     RcvErrors_LBL->setText( II->RcvErrors );
00097     RcvDropped_LBL->setText( II->RcvDropped );
00098     S.setNum( II->RcvBytes.toLong() - RcvODO );
00099     RcvODO_LBL->setText( S );
00100 
00101     SndBytes_LBL->setText( II->SndBytes );
00102     SndPackets_LBL->setText( II->SndPackets );
00103     SndErrors_LBL->setText( II->SndErrors );
00104     SndDropped_LBL->setText( II->SndDropped );
00105     S.setNum( II->SndBytes.toLong() - SndODO );
00106     SndODO_LBL->setText( S );
00107 
00108     Collisions_LBL->setText( II->Collisions );
00109 }
00110 
00111 void ProfileEdit::SLOT_AutoRefresh( bool ar ) {
00112     if( ar ) {
00113       RefreshTimer.start( 1000 );
00114       SLOT_Refresh();
00115     } else {
00116       RefreshTimer.stop();
00117     }
00118 }
00119 
00120 void ProfileEdit::SLOT_ResetODO( void ) {
00121     InterfaceInfo * II = NNI->networkSetup()->assignedInterface();
00122     RcvODO = II->RcvBytes.toLong();
00123     SndODO = II->SndBytes.toLong();
00124     SLOT_Refresh();
00125 }

Generated on Sat Nov 5 16:17:56 2005 for OPIE by  doxygen 1.4.2