summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/cable/cable_NNI.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/cable/cable_NNI.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/cable/cable_NNI.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.cpp b/noncore/settings/networksettings2/cable/cable_NNI.cpp
index 4bd9421..12a00a2 100644
--- a/noncore/settings/networksettings2/cable/cable_NNI.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NNI.cpp
@@ -4,86 +4,84 @@
4 4
5ACable::ACable( CableNetNode * PNN ) : ANetNodeInstance( PNN ) { 5ACable::ACable( CableNetNode * PNN ) : ANetNodeInstance( PNN ) {
6 // default values 6 // default values
7 Data.Device = "/dev/ttyS0"; 7 Data.Device = "/dev/ttyS0";
8 Data.LockFile = "/var/Lock"; 8 Data.LockFile = "/var/Lock";
9 Data.Speed = 115200; 9 Data.Speed = 115200;
10 Data.DataBits = 8; 10 Data.DataBits = 8;
11 Data.Parity = 0; 11 Data.Parity = 0;
12 Data.StopBits = 1; 12 Data.StopBits = 1;
13 Data.HardwareControl = 0; 13 Data.HardwareControl = 0;
14 Data.SoftwareControl = 0; 14 Data.SoftwareControl = 0;
15 GUI = 0; 15 GUI = 0;
16 RT = 0; 16 RT = 0;
17} 17}
18 18
19void ACable::setSpecificAttribute( QString & A, QString & V) { 19void ACable::setSpecificAttribute( QString & A, QString & V) {
20 if( A == "device" ) { 20 if( A == "device" ) {
21 Data.Device = V; 21 Data.Device = V;
22 } else if ( A == "lockfile" ) { 22 } else if ( A == "lockfile" ) {
23 Data.LockFile = V; 23 Data.LockFile = V;
24 } else if ( A == "speed" ) { 24 } else if ( A == "speed" ) {
25 Data.Speed = V.toLong(); 25 Data.Speed = V.toLong();
26 } else if ( A == "parity" ) { 26 } else if ( A == "parity" ) {
27 Data.Parity = V.toShort(); 27 Data.Parity = V.toShort();
28 } else if ( A == "databits" ) { 28 } else if ( A == "databits" ) {
29 Data.DataBits = V.toShort(); 29 Data.DataBits = V.toShort();
30 } else if ( A == "stopbits" ) { 30 } else if ( A == "stopbits" ) {
31 Data.StopBits = V.toShort(); 31 Data.StopBits = V.toShort();
32 } else if ( A == "hardwarecontrol" ) { 32 } else if ( A == "hardwarecontrol" ) {
33 Data.HardwareControl = ( V == "yes" ); 33 Data.HardwareControl = ( V == "yes" );
34 } else if ( A == "softwarecontrol" ) { 34 } else if ( A == "softwarecontrol" ) {
35 Data.SoftwareControl = ( V == "yes" ); 35 Data.SoftwareControl = ( V == "yes" );
36 } 36 }
37} 37}
38 38
39void ACable::saveSpecificAttribute( QTextStream & TS ) { 39void ACable::saveSpecificAttribute( QTextStream & TS ) {
40 TS << "device=" << quote( Data.Device ) << endl; 40 TS << "device=" << quote( Data.Device ) << endl;
41 TS << "lockfile=" << quote( Data.LockFile ) << endl; 41 TS << "lockfile=" << quote( Data.LockFile ) << endl;
42 TS << "speed=" << Data.Speed << endl; 42 TS << "speed=" << Data.Speed << endl;
43 TS << "parity=" << Data.Parity << endl; 43 TS << "parity=" << Data.Parity << endl;
44 TS << "databits=" << Data.DataBits << endl; 44 TS << "databits=" << Data.DataBits << endl;
45 TS << "stopbits=" << Data.StopBits << endl; 45 TS << "stopbits=" << Data.StopBits << endl;
46 TS << "hardwarecontrol=" << 46 TS << "hardwarecontrol=" <<
47 ((Data.HardwareControl) ? "yes" : "no") << endl; 47 ((Data.HardwareControl) ? "yes" : "no") << endl;
48 TS << "softwarecontrol=" << 48 TS << "softwarecontrol=" <<
49 ((Data.SoftwareControl) ? "yes" : "no") << endl; 49 ((Data.SoftwareControl) ? "yes" : "no") << endl;
50} 50}
51 51
52short ACable::generateFileEmbedded( const QString & ID, 52short ACable::generateFileEmbedded( SystemFile & SF,
53 const QString & Path,
54 QTextStream & TS,
55 long DevNr ) { 53 long DevNr ) {
56 short rvl, rvd; 54 short rvl, rvd;
57 55
58 rvl = 1; 56 rvl = 1;
59 if( ID == "peers" ) { 57 if( SF.name() == "peers" ) {
60 TS << Data.Device 58 SF << Data.Device
61 << endl; 59 << endl;
62 TS << Data.Speed 60 SF << Data.Speed
63 << endl; 61 << endl;
64 TS << "lock " 62 SF << "lock "
65 << Data.LockFile 63 << Data.LockFile
66 << endl; 64 << endl;
67 rvl = 0; 65 rvl = 0;
68 } 66 }
69 67
70 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr ); 68 rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr );
71 return (rvd == 2 || rvl == 2 ) ? 2 : 69 return (rvd == 2 || rvl == 2 ) ? 2 :
72 (rvd == 0 || rvl == 0 ) ? 0 : 1; 70 (rvd == 0 || rvl == 0 ) ? 0 : 1;
73} 71}
74 72
75QWidget * ACable::edit( QWidget * parent ) { 73QWidget * ACable::edit( QWidget * parent ) {
76 GUI = new CableEdit( parent ); 74 GUI = new CableEdit( parent );
77 GUI->showData( Data ); 75 GUI->showData( Data );
78 return GUI; 76 return GUI;
79} 77}
80 78
81QString ACable::acceptable( void ) { 79QString ACable::acceptable( void ) {
82 return ( GUI ) ? GUI->acceptable( ) : QString(); 80 return ( GUI ) ? GUI->acceptable( ) : QString();
83} 81}
84 82
85void ACable::commit( void ) { 83void ACable::commit( void ) {
86 if( GUI && GUI->commit( Data ) ) { 84 if( GUI && GUI->commit( Data ) ) {
87 setModified( 1 ); 85 setModified( 1 );
88 } 86 }
89} 87}