Diffstat (limited to 'noncore/settings/networksettings2/cable') (more/less context) (ignore whitespace changes)
4 files changed, 16 insertions, 17 deletions
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp index 6f62772..a6be4d5 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.cpp +++ b/noncore/settings/networksettings2/cable/cable_NN.cpp @@ -1,66 +1,54 @@ #include "cable_NN.h" #include "cable_NNI.h" static const char * CableNeeds[] = { 0 }; /** * Constructor, find all of the possible interfaces */ CableNetNode::CableNetNode() : ANetNode() { } /** * Delete any interfaces that we own. */ CableNetNode::~CableNetNode(){ } const QString CableNetNode::nodeDescription(){ return tr("\ <p>Sets up a wired serial or parallel.</p>\ " ); } ANetNodeInstance * CableNetNode::createInstance( void ) { return new ACable( this ); } const char ** CableNetNode::needs( void ) { return CableNeeds; } const char * CableNetNode::provides( void ) { return "line"; } bool CableNetNode::generateProperFilesFor( ANetNodeInstance * ) { return 1; } -bool CableNetNode::hasDataFor( const QString &, bool ) { - return 0; -} - -bool CableNetNode::generateDataForCommonFile( - SystemFile & , - long , - ANetNodeInstance * ) { - return 1; -} - bool CableNetNode::generateDeviceDataForCommonFile( SystemFile & , - long , - ANetNodeInstance * ) { + long ) { return 1; } extern "C" { void create_plugin( QList<ANetNode> & PNN ) { PNN.append( new CableNetNode() ); } } diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h index 3875af6..83b98e0 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.h +++ b/noncore/settings/networksettings2/cable/cable_NN.h @@ -1,46 +1,45 @@ #ifndef CABLE_NETNODE_H #define CABLE_NETNODE_H #include "netnode.h" class ACable; class CableNetNode : public ANetNode { Q_OBJECT public: CableNetNode(); virtual ~CableNetNode(); virtual const QString pixmapName() { return "Devices/cable"; } virtual const QString nodeName() { return tr("Cable Connection"); } virtual const QString nodeDescription() ; virtual ANetNodeInstance * createInstance( void ); virtual const char ** needs( void ); virtual const char * provides( void ); virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); - virtual bool hasDataFor( const QString & S, bool DS ); - virtual bool generateDataForCommonFile( - SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); + virtual bool hasDataFor( const QString & ) + { return 0; } virtual bool generateDeviceDataForCommonFile( - SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); + SystemFile & SF, long DevNr); private: }; extern "C" { void create_plugin( QList<ANetNode> & PNN ); }; #endif diff --git a/noncore/settings/networksettings2/cable/cable_NNI.cpp b/noncore/settings/networksettings2/cable/cable_NNI.cpp index d26afd1..ca21135 100644 --- a/noncore/settings/networksettings2/cable/cable_NNI.cpp +++ b/noncore/settings/networksettings2/cable/cable_NNI.cpp @@ -1,66 +1,73 @@ #include "cableedit.h" #include "cable_NNI.h" #include "cable_NN.h" ACable::ACable( CableNetNode * PNN ) : ANetNodeInstance( PNN ) { // default values Data.Device = "/dev/ttyS0"; Data.LockFile = "/var/Lock"; Data.Speed = 115200; Data.DataBits = 8; Data.Parity = 0; Data.StopBits = 1; Data.HardwareControl = 0; Data.SoftwareControl = 0; GUI = 0; RT = 0; } void ACable::setSpecificAttribute( QString & A, QString & V) { if( A == "device" ) { Data.Device = V; } else if ( A == "lockfile" ) { Data.LockFile = V; } else if ( A == "speed" ) { Data.Speed = V.toLong(); } else if ( A == "parity" ) { Data.Parity = V.toShort(); } else if ( A == "databits" ) { Data.DataBits = V.toShort(); } else if ( A == "stopbits" ) { Data.StopBits = V.toShort(); } else if ( A == "hardwarecontrol" ) { Data.HardwareControl = ( V == "yes" ); } else if ( A == "softwarecontrol" ) { Data.SoftwareControl = ( V == "yes" ); } } void ACable::saveSpecificAttribute( QTextStream & TS ) { TS << "device=" << quote( Data.Device ) << endl; TS << "lockfile=" << quote( Data.LockFile ) << endl; TS << "speed=" << Data.Speed << endl; TS << "parity=" << Data.Parity << endl; TS << "databits=" << Data.DataBits << endl; TS << "stopbits=" << Data.StopBits << endl; TS << "hardwarecontrol=" << ((Data.HardwareControl) ? "yes" : "no") << endl; TS << "softwarecontrol=" << ((Data.SoftwareControl) ? "yes" : "no") << endl; } QWidget * ACable::edit( QWidget * parent ) { GUI = new CableEdit( parent ); GUI->showData( Data ); return GUI; } QString ACable::acceptable( void ) { return ( GUI ) ? GUI->acceptable( ) : QString(); } void ACable::commit( void ) { if( GUI && GUI->commit( Data ) ) { setModified( 1 ); } } + +bool ACable::generateDataForCommonFile( + SystemFile & , + long ) { + return 1; +} + diff --git a/noncore/settings/networksettings2/cable/cable_NNI.h b/noncore/settings/networksettings2/cable/cable_NNI.h index 0654a5d..bf3e292 100644 --- a/noncore/settings/networksettings2/cable/cable_NNI.h +++ b/noncore/settings/networksettings2/cable/cable_NNI.h @@ -1,43 +1,48 @@ #ifndef CABLE_H #define CABLE_H #include <netnode.h> #include "cabledata.h" #include "cablerun.h" class CableNetNode; class CableEdit; class ACable : public ANetNodeInstance { public : ACable( CableNetNode * PNN ); QWidget * edit( QWidget * parent ); QString acceptable( void ); void commit( void ); RuntimeInfo * runtime( void ) { if( RT == 0 ) RT = new CableRun( this, Data ); return RT; } virtual void * data( void ) { return (void *)&Data; } + virtual bool hasDataFor( const QString & ) + { return 0; } + virtual bool generateDataForCommonFile( + SystemFile & SF, long DevNr ); + protected : virtual void setSpecificAttribute( QString & Attr, QString & Value ); virtual void saveSpecificAttribute( QTextStream & TS ); private : CableEdit * GUI; CableData_t Data; CableRun * RT; }; #endif |