author | wimpie <wimpie> | 2004-04-02 18:29:49 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-02 18:29:49 (UTC) |
commit | 5334b639c9f97793bcae4f50f7b47c7a2ada4e2f (patch) (unidiff) | |
tree | f55aebd4314ab878bc39b6b08b8323a8ef78d803 /noncore/settings/networksettings2/profile/profileedit.cpp | |
parent | 7c8922b37b5bb7696c0ff2cbc999e2936b9b509f (diff) | |
download | opie-5334b639c9f97793bcae4f50f7b47c7a2ada4e2f.zip opie-5334b639c9f97793bcae4f50f7b47c7a2ada4e2f.tar.gz opie-5334b639c9f97793bcae4f50f7b47c7a2ada4e2f.tar.bz2 |
First import of NS2 app
Diffstat (limited to 'noncore/settings/networksettings2/profile/profileedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/profile/profileedit.cpp | 93 |
1 files changed, 93 insertions, 0 deletions
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 @@ | |||
1 | #include <qlabel.h> | ||
2 | #include <qframe.h> | ||
3 | #include <qcheckbox.h> | ||
4 | #include <qmultilineedit.h> | ||
5 | #include <qcheckbox.h> | ||
6 | |||
7 | #include <GUIUtils.h> | ||
8 | #include <asdevice.h> | ||
9 | #include <resources.h> | ||
10 | |||
11 | #include "profileedit.h" | ||
12 | |||
13 | ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : | ||
14 | ProfileGUI( Parent ), TrafficRefresh(this) { | ||
15 | InterfaceInfo * II; | ||
16 | |||
17 | NNI = TNNI; | ||
18 | Dev = NNI->runtime()->device(); | ||
19 | if( ( II = Dev->assignedInterface() ) ) { | ||
20 | Refresh_CB->setEnabled( TRUE ); | ||
21 | Snd_GB->setEnabled( TRUE ); | ||
22 | Rcv_GB->setEnabled( TRUE ); | ||
23 | Collisions_FRM->setEnabled( TRUE ); | ||
24 | // show current content | ||
25 | SLOT_Refresh(); | ||
26 | |||
27 | // fill in static data | ||
28 | InterfaceName_LBL->setText( II->Name ); | ||
29 | IPAddress_LBL->setText( II->Address ); | ||
30 | SubnetMask_LBL->setText( II->Netmask ); | ||
31 | Broadcast_LBL->setText( II->BCastAddress ); | ||
32 | MACAddress_LBL->setText( II->MACAddress ); | ||
33 | if( II->IsPointToPoint ) { | ||
34 | PointToPoint_LBL->setText( II->DstAddress ); | ||
35 | } | ||
36 | QString S; | ||
37 | InterfaceName_LBL->setText( II->Name ); | ||
38 | if( II->HasMulticast ) { | ||
39 | S += "Multicast"; | ||
40 | } | ||
41 | if( ! S.isEmpty() ) { | ||
42 | S.prepend( " : " ); | ||
43 | } | ||
44 | InterfaceOptions_LBL->setText( S ); | ||
45 | } | ||
46 | |||
47 | connect( &TrafficRefresh, SIGNAL( timeout() ), | ||
48 | this, SLOT( SLOT_Refresh() ) ); | ||
49 | } | ||
50 | |||
51 | QString ProfileEdit::acceptable( void ) { | ||
52 | return QString(); | ||
53 | } | ||
54 | |||
55 | void ProfileEdit::showData( ProfileData_t & Data ) { | ||
56 | Description_LE->setText( Data.Description ); | ||
57 | Automatic_CB->setChecked( Data.Automatic ); | ||
58 | Confirm_CB->setChecked( Data.Confirm ); | ||
59 | Disabled_CB->setChecked( Data.Disabled ); | ||
60 | } | ||
61 | |||
62 | |||
63 | bool ProfileEdit::commit( ProfileData_t & Data ) { | ||
64 | bool SM = 0; | ||
65 | TXTM( Data.Description, Description_LE, SM ); | ||
66 | |||
67 | CBM( Data.Automatic, Automatic_CB, SM ); | ||
68 | CBM( Data.Disabled, Disabled_CB, SM ); | ||
69 | CBM( Data.Confirm, Confirm_CB, SM ); | ||
70 | |||
71 | return SM; | ||
72 | } | ||
73 | |||
74 | void ProfileEdit::SLOT_Refresh( void ) { | ||
75 | InterfaceInfo * II = Dev->assignedInterface(); | ||
76 | NSResources->system().refreshStatistics( *II ); | ||
77 | RcvBytes_LBL->setText( II->RcvBytes ); | ||
78 | SndBytes_LBL->setText( II->SndBytes ); | ||
79 | RcvErrors_LBL->setText( II->RcvErrors ); | ||
80 | SndErrors_LBL->setText( II->SndErrors ); | ||
81 | RcvDropped_LBL->setText( II->RcvDropped ); | ||
82 | SndDropped_LBL->setText( II->SndDropped ); | ||
83 | Collisions_LBL->setText( II->Collisions ); | ||
84 | } | ||
85 | |||
86 | void ProfileEdit::SLOT_AutoRefresh( bool ar ) { | ||
87 | if( ar ) { | ||
88 | TrafficRefresh.start( 1000 ); | ||
89 | SLOT_Refresh(); | ||
90 | } else { | ||
91 | TrafficRefresh.stop(); | ||
92 | } | ||
93 | } | ||