Diffstat (limited to 'noncore/settings/networksettings2/cable') (more/less context) (ignore whitespace changes)
6 files changed, 51 insertions, 50 deletions
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp index b8c690b..38568df 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.cpp +++ b/noncore/settings/networksettings2/cable/cable_NN.cpp | |||
@@ -35,19 +35,8 @@ const char ** CableNetNode::needs( void ) { | |||
35 | const char * CableNetNode::provides( void ) { | 35 | const char * CableNetNode::provides( void ) { |
36 | return "line"; | 36 | return "line"; |
37 | } | 37 | } |
38 | 38 | ||
39 | bool CableNetNode::generateProperFilesFor( | ||
40 | ANetNodeInstance * ) { | ||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | bool CableNetNode::generateDeviceDataForCommonFile( | ||
45 | SystemFile & , | ||
46 | long ) { | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | void CableNetNode::setSpecificAttribute( QString & , QString & ) { | 39 | void CableNetNode::setSpecificAttribute( QString & , QString & ) { |
51 | } | 40 | } |
52 | 41 | ||
53 | void CableNetNode::saveSpecificAttribute( QTextStream & ) { | 42 | void CableNetNode::saveSpecificAttribute( QTextStream & ) { |
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h index c48037a..5cc2b2d 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.h +++ b/noncore/settings/networksettings2/cable/cable_NN.h | |||
@@ -6,30 +6,22 @@ | |||
6 | class ACable; | 6 | class ACable; |
7 | 7 | ||
8 | class CableNetNode : public ANetNode { | 8 | class CableNetNode : public ANetNode { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | CableNetNode(); | 14 | CableNetNode(); |
15 | virtual ~CableNetNode(); | 15 | virtual ~CableNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/cable"; } | 18 | { return "Devices/cable"; } |
19 | 19 | ||
20 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
21 | 21 | virtual ANetNodeInstance * createInstance( void ); | |
22 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual const char ** needs( void ); |
23 | 23 | virtual const char * provides( void ); | |
24 | virtual const char ** needs( void ); | ||
25 | virtual const char * provides( void ); | ||
26 | |||
27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | ||
28 | virtual bool hasDataFor( const QString & ) | ||
29 | { return 0; } | ||
30 | virtual bool generateDeviceDataForCommonFile( | ||
31 | SystemFile & SF, long DevNr); | ||
32 | 24 | ||
33 | private: | 25 | private: |
34 | 26 | ||
35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.cpp b/noncore/settings/networksettings2/cable/cable_NNI.cpp index ca21135..4bd9421 100644 --- a/noncore/settings/networksettings2/cable/cable_NNI.cpp +++ b/noncore/settings/networksettings2/cable/cable_NNI.cpp | |||
@@ -48,8 +48,31 @@ void ACable::saveSpecificAttribute( QTextStream & TS ) { | |||
48 | TS << "softwarecontrol=" << | 48 | TS << "softwarecontrol=" << |
49 | ((Data.SoftwareControl) ? "yes" : "no") << endl; | 49 | ((Data.SoftwareControl) ? "yes" : "no") << endl; |
50 | } | 50 | } |
51 | 51 | ||
52 | short ACable::generateFileEmbedded( const QString & ID, | ||
53 | const QString & Path, | ||
54 | QTextStream & TS, | ||
55 | long DevNr ) { | ||
56 | short rvl, rvd; | ||
57 | |||
58 | rvl = 1; | ||
59 | if( ID == "peers" ) { | ||
60 | TS << Data.Device | ||
61 | << endl; | ||
62 | TS << Data.Speed | ||
63 | << endl; | ||
64 | TS << "lock " | ||
65 | << Data.LockFile | ||
66 | << endl; | ||
67 | rvl = 0; | ||
68 | } | ||
69 | |||
70 | rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr ); | ||
71 | return (rvd == 2 || rvl == 2 ) ? 2 : | ||
72 | (rvd == 0 || rvl == 0 ) ? 0 : 1; | ||
73 | } | ||
74 | |||
52 | QWidget * ACable::edit( QWidget * parent ) { | 75 | QWidget * ACable::edit( QWidget * parent ) { |
53 | GUI = new CableEdit( parent ); | 76 | GUI = new CableEdit( parent ); |
54 | GUI->showData( Data ); | 77 | GUI->showData( Data ); |
55 | return GUI; | 78 | return GUI; |
@@ -63,11 +86,4 @@ void ACable::commit( void ) { | |||
63 | if( GUI && GUI->commit( Data ) ) { | 86 | if( GUI && GUI->commit( Data ) ) { |
64 | setModified( 1 ); | 87 | setModified( 1 ); |
65 | } | 88 | } |
66 | } | 89 | } |
67 | |||
68 | bool ACable::generateDataForCommonFile( | ||
69 | SystemFile & , | ||
70 | long ) { | ||
71 | return 1; | ||
72 | } | ||
73 | |||
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.h b/noncore/settings/networksettings2/cable/cable_NNI.h index bf3e292..d06cbbe 100644 --- a/noncore/settings/networksettings2/cable/cable_NNI.h +++ b/noncore/settings/networksettings2/cable/cable_NNI.h | |||
@@ -13,26 +13,24 @@ class ACable : public ANetNodeInstance { | |||
13 | public : | 13 | public : |
14 | 14 | ||
15 | ACable( CableNetNode * PNN ); | 15 | ACable( CableNetNode * PNN ); |
16 | 16 | ||
17 | RuntimeInfo * runtime( void ) | ||
18 | { return | ||
19 | ( RT ) ? RT : ( RT = new CableRun( this, Data ) ); | ||
20 | } | ||
21 | |||
17 | QWidget * edit( QWidget * parent ); | 22 | QWidget * edit( QWidget * parent ); |
18 | QString acceptable( void ); | 23 | QString acceptable( void ); |
19 | void commit( void ); | 24 | void commit( void ); |
20 | 25 | ||
21 | RuntimeInfo * runtime( void ) | ||
22 | { if( RT == 0 ) | ||
23 | RT = new CableRun( this, Data ); | ||
24 | return RT; | ||
25 | } | ||
26 | |||
27 | virtual void * data( void ) | 26 | virtual void * data( void ) |
28 | { return (void *)&Data; } | 27 | { return (void *)&Data; } |
29 | 28 | ||
30 | virtual bool hasDataFor( const QString & ) | 29 | short generateFileEmbedded( const QString & ID, |
31 | { return 0; } | 30 | const QString & Path, |
32 | virtual bool generateDataForCommonFile( | 31 | QTextStream & TS, |
33 | SystemFile & SF, long DevNr ); | 32 | long DevNr ); |
34 | |||
35 | protected : | 33 | protected : |
36 | 34 | ||
37 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
38 | virtual void saveSpecificAttribute( QTextStream & TS ); | 36 | virtual void saveSpecificAttribute( QTextStream & TS ); |
diff --git a/noncore/settings/networksettings2/cable/cablerun.cpp b/noncore/settings/networksettings2/cable/cablerun.cpp index 5e99237..85660f6 100644 --- a/noncore/settings/networksettings2/cable/cablerun.cpp +++ b/noncore/settings/networksettings2/cable/cablerun.cpp | |||
@@ -3,9 +3,9 @@ | |||
3 | #include "cablerun.h" | 3 | #include "cablerun.h" |
4 | 4 | ||
5 | void CableRun::detectState( NodeCollection * NC ) { | 5 | void CableRun::detectState( NodeCollection * NC ) { |
6 | 6 | ||
7 | int fd = open( D->Device.latin1(), O_RDWR ); | 7 | int fd = open( Data->Device.latin1(), O_RDWR ); |
8 | 8 | ||
9 | if( fd < 0 ) { | 9 | if( fd < 0 ) { |
10 | NC->setCurrentState( Unavailable ); | 10 | NC->setCurrentState( Unavailable ); |
11 | } | 11 | } |
@@ -23,4 +23,8 @@ bool CableRun::setState( NodeCollection * NC, Action_t A, bool ) { | |||
23 | 23 | ||
24 | bool CableRun::canSetState( State_t , Action_t ) { | 24 | bool CableRun::canSetState( State_t , Action_t ) { |
25 | return 1; | 25 | return 1; |
26 | } | 26 | } |
27 | |||
28 | QString CableRun::deviceFile( void ) { | ||
29 | return Data->Device; | ||
30 | } | ||
diff --git a/noncore/settings/networksettings2/cable/cablerun.h b/noncore/settings/networksettings2/cable/cablerun.h index c5b59d5..20608f6 100644 --- a/noncore/settings/networksettings2/cable/cablerun.h +++ b/noncore/settings/networksettings2/cable/cablerun.h | |||
@@ -5,20 +5,22 @@ class CableRun : public AsLine { | |||
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | CableRun( ANetNodeInstance * NNI, | 8 | CableRun( ANetNodeInstance * NNI, |
9 | CableData & Data ) : AsLine( NNI ) | 9 | CableData_t & D ) : AsLine( NNI ) |
10 | { D = &Data; } | 10 | { Data = &D; } |
11 | 11 | ||
12 | virtual AsLine * asLine( void ) | 12 | virtual AsLine * asLine( void ) |
13 | { return (AsLine *)this; } | 13 | { return (AsLine *)this; } |
14 | 14 | ||
15 | virtual QString deviceFile( void ); | ||
16 | |||
15 | protected : | 17 | protected : |
16 | 18 | ||
17 | void detectState( NodeCollection * NC ); | 19 | void detectState( NodeCollection * NC ); |
18 | bool setState( NodeCollection * NC, Action_t A, bool Force ); | 20 | bool setState( NodeCollection * NC, Action_t A, bool Force ); |
19 | bool canSetState( State_t Curr, Action_t A ); | 21 | bool canSetState( State_t Curr, Action_t A ); |
20 | 22 | ||
21 | private : | 23 | private : |
22 | 24 | ||
23 | CableData_t * D; | 25 | CableData_t * Data; |
24 | }; | 26 | }; |