summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/profile/profileedit.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/profile/profileedit.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/profile/profileedit.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/noncore/settings/networksettings2/profile/profileedit.cpp b/noncore/settings/networksettings2/profile/profileedit.cpp
index ad943fe..1713f0c 100644
--- a/noncore/settings/networksettings2/profile/profileedit.cpp
+++ b/noncore/settings/networksettings2/profile/profileedit.cpp
@@ -1,44 +1,50 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qgroupbox.h>
3#include <qpushbutton.h>
2#include <qframe.h> 4#include <qframe.h>
3#include <qcheckbox.h> 5#include <qcheckbox.h>
4#include <qmultilineedit.h> 6#include <qmultilineedit.h>
5#include <qcheckbox.h> 7#include <qcheckbox.h>
6 8
7#include <GUIUtils.h> 9#include <GUIUtils.h>
8#include <netnode.h> 10#include <netnode.h>
9#include <resources.h> 11#include <resources.h>
10 12
11#include "profileedit.h" 13#include "profileedit.h"
12 14
13ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : 15ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) :
14 ProfileGUI( Parent ), RefreshTimer(this) { 16 ProfileGUI( Parent ), RefreshTimer(this) {
15 InterfaceInfo * II; 17 InterfaceInfo * II;
16 18
17 II = TNNI->networkSetup()->assignedInterface(); 19 II = TNNI->networkSetup()->assignedInterface();
18 Log(( "Interface %p %p %p: %d\n", II, 20 Log(( "Interface %p %p %p: %d\n", II,
19 TNNI, TNNI->networkSetup(), (II) ? II->IsUp : 0 )); 21 TNNI, TNNI->networkSetup(), (II) ? II->IsUp : 0 ));
20 22
21 NNI = TNNI; 23 NNI = TNNI;
22 Dev = NNI->runtime()->device(); 24 Dev = NNI->runtime()->device();
23 if( ( II = NNI->networkSetup()->assignedInterface() ) ) { 25 if( ( II = NNI->networkSetup()->assignedInterface() ) ) {
24 26
25 Refresh_CB->setEnabled( TRUE ); 27 Refresh_CB->setEnabled( TRUE );
26 Snd_GB->setEnabled( TRUE ); 28 ResetODO_But->setEnabled( TRUE );
27 Rcv_GB->setEnabled( TRUE ); 29 Sending_GB->setEnabled( TRUE );
28 Collisions_FRM->setEnabled( TRUE ); 30 Receiving_GB->setEnabled( TRUE );
31 Misc_GB->setEnabled( TRUE );
29 32
30 // show current content 33 // show current content
31 SLOT_Refresh(); 34 SLOT_Refresh();
32 35
36 // initialize ODO
37 SLOT_ResetODO();
38
33 // fill in static data 39 // fill in static data
34 InterfaceName_LBL->setText( II->Name ); 40 InterfaceName_LBL->setText( II->Name );
35 IPAddress_LBL->setText( II->Address ); 41 IPAddress_LBL->setText( II->Address );
36 SubnetMask_LBL->setText( II->Netmask ); 42 SubnetMask_LBL->setText( II->Netmask );
37 Broadcast_LBL->setText( II->BCastAddress ); 43 Broadcast_LBL->setText( II->BCastAddress );
38 MACAddress_LBL->setText( II->MACAddress ); 44 MACAddress_LBL->setText( II->MACAddress );
39 if( II->IsPointToPoint ) { 45 if( II->IsPointToPoint ) {
40 PointToPoint_LBL->setText( II->DstAddress ); 46 PointToPoint_LBL->setText( II->DstAddress );
41 } 47 }
42 QString S; 48 QString S;
43 InterfaceName_LBL->setText( II->Name ); 49 InterfaceName_LBL->setText( II->Name );
44 if( II->HasMulticast ) { 50 if( II->HasMulticast ) {
@@ -73,30 +79,47 @@ bool ProfileEdit::commit( ProfileData & Data ) {
73 TXTM( Data.Description, Description_LE, SM ); 79 TXTM( Data.Description, Description_LE, SM );
74 80
75 CBM( Data.Automatic, Automatic_CB, SM ); 81 CBM( Data.Automatic, Automatic_CB, SM );
76 CBM( Data.TriggerVPN, TriggersVPN_CB, SM ); 82 CBM( Data.TriggerVPN, TriggersVPN_CB, SM );
77 CBM( Data.Disabled, Disabled_CB, SM ); 83 CBM( Data.Disabled, Disabled_CB, SM );
78 CBM( Data.Confirm, Confirm_CB, SM ); 84 CBM( Data.Confirm, Confirm_CB, SM );
79 85
80 return SM; 86 return SM;
81} 87}
82 88
83void ProfileEdit::SLOT_Refresh( void ) { 89void ProfileEdit::SLOT_Refresh( void ) {
84 InterfaceInfo * II = NNI->networkSetup()->assignedInterface(); 90 InterfaceInfo * II = NNI->networkSetup()->assignedInterface();
91 QString S;
85 NSResources->system().refreshStatistics( *II ); 92 NSResources->system().refreshStatistics( *II );
93
86 RcvBytes_LBL->setText( II->RcvBytes ); 94 RcvBytes_LBL->setText( II->RcvBytes );
87 SndBytes_LBL->setText( II->SndBytes ); 95 RcvPackets_LBL->setText( II->RcvPackets );
88 RcvErrors_LBL->setText( II->RcvErrors ); 96 RcvErrors_LBL->setText( II->RcvErrors );
89 SndErrors_LBL->setText( II->SndErrors );
90 RcvDropped_LBL->setText( II->RcvDropped ); 97 RcvDropped_LBL->setText( II->RcvDropped );
98 S.setNum( II->RcvBytes.toLong() - RcvODO );
99 RcvODO_LBL->setText( S );
100
101 SndBytes_LBL->setText( II->SndBytes );
102 SndPackets_LBL->setText( II->SndPackets );
103 SndErrors_LBL->setText( II->SndErrors );
91 SndDropped_LBL->setText( II->SndDropped ); 104 SndDropped_LBL->setText( II->SndDropped );
105 S.setNum( II->SndBytes.toLong() - SndODO );
106 SndODO_LBL->setText( S );
107
92 Collisions_LBL->setText( II->Collisions ); 108 Collisions_LBL->setText( II->Collisions );
93} 109}
94 110
95void ProfileEdit::SLOT_AutoRefresh( bool ar ) { 111void ProfileEdit::SLOT_AutoRefresh( bool ar ) {
96 if( ar ) { 112 if( ar ) {
97 RefreshTimer.start( 1000 ); 113 RefreshTimer.start( 1000 );
98 SLOT_Refresh(); 114 SLOT_Refresh();
99 } else { 115 } else {
100 RefreshTimer.stop(); 116 RefreshTimer.stop();
101 } 117 }
102} 118}
119
120void ProfileEdit::SLOT_ResetODO( void ) {
121 InterfaceInfo * II = NNI->networkSetup()->assignedInterface();
122 RcvODO = II->RcvBytes.toLong();
123 SndODO = II->SndBytes.toLong();
124 SLOT_Refresh();
125}