Diffstat (limited to 'noncore/settings/networksettings2/cable/cable_NNI.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/cable/cable_NNI.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.cpp b/noncore/settings/networksettings2/cable/cable_NNI.cpp new file mode 100644 index 0000000..d26afd1 --- a/dev/null +++ b/noncore/settings/networksettings2/cable/cable_NNI.cpp | |||
@@ -0,0 +1,66 @@ | |||
1 | #include "cableedit.h" | ||
2 | #include "cable_NNI.h" | ||
3 | #include "cable_NN.h" | ||
4 | |||
5 | ACable::ACable( CableNetNode * PNN ) : ANetNodeInstance( PNN ) { | ||
6 | // default values | ||
7 | Data.Device = "/dev/ttyS0"; | ||
8 | Data.LockFile = "/var/Lock"; | ||
9 | Data.Speed = 115200; | ||
10 | Data.DataBits = 8; | ||
11 | Data.Parity = 0; | ||
12 | Data.StopBits = 1; | ||
13 | Data.HardwareControl = 0; | ||
14 | Data.SoftwareControl = 0; | ||
15 | GUI = 0; | ||
16 | RT = 0; | ||
17 | } | ||
18 | |||
19 | void ACable::setSpecificAttribute( QString & A, QString & V) { | ||
20 | if( A == "device" ) { | ||
21 | Data.Device = V; | ||
22 | } else if ( A == "lockfile" ) { | ||
23 | Data.LockFile = V; | ||
24 | } else if ( A == "speed" ) { | ||
25 | Data.Speed = V.toLong(); | ||
26 | } else if ( A == "parity" ) { | ||
27 | Data.Parity = V.toShort(); | ||
28 | } else if ( A == "databits" ) { | ||
29 | Data.DataBits = V.toShort(); | ||
30 | } else if ( A == "stopbits" ) { | ||
31 | Data.StopBits = V.toShort(); | ||
32 | } else if ( A == "hardwarecontrol" ) { | ||
33 | Data.HardwareControl = ( V == "yes" ); | ||
34 | } else if ( A == "softwarecontrol" ) { | ||
35 | Data.SoftwareControl = ( V == "yes" ); | ||
36 | } | ||
37 | } | ||
38 | |||
39 | void ACable::saveSpecificAttribute( QTextStream & TS ) { | ||
40 | TS << "device=" << quote( Data.Device ) << endl; | ||
41 | TS << "lockfile=" << quote( Data.LockFile ) << endl; | ||
42 | TS << "speed=" << Data.Speed << endl; | ||
43 | TS << "parity=" << Data.Parity << endl; | ||
44 | TS << "databits=" << Data.DataBits << endl; | ||
45 | TS << "stopbits=" << Data.StopBits << endl; | ||
46 | TS << "hardwarecontrol=" << | ||
47 | ((Data.HardwareControl) ? "yes" : "no") << endl; | ||
48 | TS << "softwarecontrol=" << | ||
49 | ((Data.SoftwareControl) ? "yes" : "no") << endl; | ||
50 | } | ||
51 | |||
52 | QWidget * ACable::edit( QWidget * parent ) { | ||
53 | GUI = new CableEdit( parent ); | ||
54 | GUI->showData( Data ); | ||
55 | return GUI; | ||
56 | } | ||
57 | |||
58 | QString ACable::acceptable( void ) { | ||
59 | return ( GUI ) ? GUI->acceptable( ) : QString(); | ||
60 | } | ||
61 | |||
62 | void ACable::commit( void ) { | ||
63 | if( GUI && GUI->commit( Data ) ) { | ||
64 | setModified( 1 ); | ||
65 | } | ||
66 | } | ||