summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/networksettings2/netnode.h
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/netnode.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.h73
1 files changed, 38 insertions, 35 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h
index 151d546..8aebdc0 100644
--- a/noncore/settings/networksettings2/networksettings2/netnode.h
+++ b/noncore/settings/networksettings2/networksettings2/netnode.h
@@ -6,101 +6,101 @@
#include <qdict.h>
#include <qpixmap.h>
#include <qstringlist.h>
#include <qobject.h>
#include <time.h>
#include <Utils.h>
#include <system.h>
// difference feature interfaces
class AsDevice;
class AsLine;
-class AsConnection;
+class AsNetworkSetup;
class AsFullSetup;
// needed for plugin creation function
#include <qlist.h>
class ANetNode;
class ANetNodeInstance;
-class NodeCollection;
+class NetworkSetup;
class QTextStream;
class RuntimeInfo;
class InterfaceInfo;
class NSResources;
extern QString & deQuote( QString & X );
extern QString quote( QString X );
#include "systemfile.h"
typedef enum State {
// if we have not yet detected the state of the device
Unchecked = 0,
// if we cannot determine the state
Unknown = 1,
- // if connection cannot be established e.g. because
+ // if networkSetup cannot be established e.g. because
// the hardware is not available
Unavailable = 2,
- // if the connection cannot be establishec but NOT
+ // if the networkSetup cannot be establishec but NOT
// because it is physically impossible but because
// it has been disabled for FUNCTIONAL reasons
Disabled = 3,
- // if connection is available to is currently down
+ // if networkSetup is available to is currently down
// i.e. the corresponding hardware is not activated
Off = 4,
- // if connection is available to be used (i.e. the
+ // if networkSetup is available to be used (i.e. the
// devices if fully ready to be used
Available = 5,
- // if connection is being used
+ // if networkSetup is being used
IsUp = 6
} State_t;
typedef enum Action {
// to make the device unavailable functionally -> to disabled
Disable = 0,
// to make the device available functionally -> to off
Enable = 1,
// bring the hardware up -> to Available
Activate = 2,
// bring the hardware down -> to off
Deactivate = 3,
- // bring the connection up -> to IsUp
+ // bring the networkSetup up -> to IsUp
Up = 4,
- // bring the connection down -> to Available
+ // bring the networkSetup down -> to Available
Down = 5
} Action_t;
class ANetNode : public QObject {
public:
typedef QArray<ANetNode *> NetNodeList;
ANetNode( const char * Name ) : QObject( 0, Name ) {}
virtual ~ANetNode(){};
//
//
// standard methods with sensible default
//
//
inline int done( void )
{ return Done; }
inline void setDone( int D )
{ Done = D; }
- // does this Node provide a Connection
+ // does this Node provide a NetworkSetup
bool isToplevel( void );
// set the value of an attribute
void setAttribute( QString & Attr, QString & Value ) ;
void saveAttributes( QTextStream & TS ) ;
// compiled references to 'needed' NetNodes -> needs list
inline void setAlternatives( NetNodeList * Alt )
{ Alternatives = Alt; }
inline NetNodeList & alternatives( void )
{ return *Alternatives; }
@@ -236,28 +236,28 @@ public:
{ Description = S; }
// pixmap for this instance -> from NetNode
inline const QString pixmapName( void )
{ return NodeType->pixmapName(); }
inline const char ** provides( void )
{ return NodeType->provides(); }
inline const char ** needs( void )
{ return NodeType->needs(); }
- inline void setConnection( NodeCollection * NC )
- { Connection = NC; }
- inline NodeCollection * connection( void )
- { return Connection; }
+ inline void setNetworkSetup( NetworkSetup * NC )
+ { TheNetworkSetup = NC; }
+ inline NetworkSetup * networkSetup( void )
+ { return TheNetworkSetup; }
//
//
// Virtual methods with sensible defaults
//
//
// open proper file identified by S
virtual bool openFile( SystemFile & )
{ return 0; }
@@ -306,26 +306,26 @@ public:
// get data from GUI and store in node
virtual void commit( void ) = 0;
// returns node specific data -> only useful for 'buddy'
virtual void * data( void ) = 0;
protected :
virtual void setSpecificAttribute( QString & , QString & ) = 0;
virtual void saveSpecificAttribute( QTextStream & ) = 0;
ANetNode * NodeType;
- // connection to which this node belongs to
- NodeCollection * Connection;
+ // networkSetup to which this node belongs to
+ NetworkSetup * TheNetworkSetup;
QString Description;
bool IsModified;
// true if this nodeinstance was just created (and not
// loaded from file
bool IsNew;
int Done;
static long InstanceCounter;
};
class ErrorNNI: public ANetNodeInstance {
@@ -369,25 +369,25 @@ protected :
class RuntimeInfo : public QObject {
Q_OBJECT
public :
RuntimeInfo( ANetNodeInstance * TheNNI )
{ NNI = TheNNI; }
//
//
- // methods to be overloaded by connection capable
+ // methods to be overloaded by networkSetup capable
// runtimes
//
//
//
//
// methods to be overloaded by device capable
// runtimes
//
//
@@ -466,61 +466,64 @@ public :
return (RI) ? RI->line() : 0;
}
// return the node that offers full setup capability
virtual RuntimeInfo * fullSetup( void )
{ RuntimeInfo * RI = nextNode();
return (RI) ? RI->fullSetup() : 0;
}
inline ANetNodeInstance * netNode()
{ return NNI; }
- inline NodeCollection * nodeCollection()
- { return NNI->connection(); }
+ inline NetworkSetup * networkSetup()
+ { return NNI->networkSetup(); }
virtual State_t detectState( void ) = 0;
// public API to set the state
- virtual QString setState( NodeCollection * NC,
+ virtual QString setState( NetworkSetup * NC,
Action_t A,
bool Force = 0 );
inline RuntimeInfo * nextNode( void ) {
ANetNodeInstance * NNI = netNode()->nextNode();
return (NNI) ? NNI->runtime() : 0;
}
signals :
// sent by device if state changes
void stateChanged( State_t S, ANetNodeInstance * NNI );
protected :
// set state of this node (private API)
- virtual QString setMyState( NodeCollection * NC,
+ virtual QString setMyState( NetworkSetup * NC,
Action_t A,
bool Force = 0 ) = 0;
- // connection this runtime info belongs to
+ // networkSetup this runtime info belongs to
ANetNodeInstance * NNI;
};
-class NodeCollection : public QList<ANetNodeInstance> {
+class NetworkSetup : public QList<ANetNodeInstance> {
public :
- NodeCollection( void );
- NodeCollection( QTextStream & TS, bool & Dangling );
- ~NodeCollection( void );
+ NetworkSetup( void );
+ NetworkSetup( QTextStream & TS, bool & Dangling );
+ ~NetworkSetup( void );
+
+ // copy settings from NC to this
+ void copyFrom( const NetworkSetup & NC );
inline int done( void )
{ return Done; }
inline void setDone( int D )
{ Done = D; }
inline int number( void )
{ return Number; }
inline void setNumber( int i )
{ Number = i; }
inline bool isNew( void )
{ return IsNew; }
@@ -534,33 +537,33 @@ public :
inline bool handlesInterface( const QString & S ) {
return getToplevel()->runtime()->handlesInterface( S );
}
// return the interface in the OS that is assigned to
// this device
inline InterfaceInfo * assignedInterface( void ) {
return AssignedInterface;
}
// assign the interface to this device
inline void assignInterface( InterfaceInfo * NI ) {
- if( NI == 0 ) {
- if( AssignedInterface ) {
- AssignedInterface->assignConnection( 0 );
- }
- }
- AssignedInterface = NI;
+ // cleanup previous
if( AssignedInterface ) {
- AssignedInterface->assignConnection( this );
+ AssignedInterface->assignToNetworkSetup( 0 );
}
+ if( NI ) {
+ // assign new
+ NI->assignToNetworkSetup( this );
+ }
+ AssignedInterface = NI;
}
inline RuntimeInfo * device() {
return getToplevel()->runtime()->device();
}
const QStringList & triggers();
State_t state( bool Update = 0 );
// get the ixmap for this device
QPixmap devicePixmap( void );
@@ -568,25 +571,25 @@ public :
inline QPixmap statePixmap( bool Update = 0 )
{ return statePixmap( state(Update) ); }
QString stateName( State_t );
inline QString stateName( bool Update = 0 )
{ return stateName( state(Update) ); }
QString setState( Action_t A, bool Force = 0 );
void save( QTextStream & TS );
void append( ANetNodeInstance * NNI );
- // makes sure that all items in the connection point to
+ // makes sure that all items in the networkSetup point to
// that connectoin
void reassign( void );
ANetNodeInstance * getToplevel( void );
ANetNodeInstance * findNext( ANetNodeInstance * NNI );
ANetNodeInstance * findByName( const QString & S );
inline const QString & name()
{ return Name; }
const QString & description( void );
@@ -610,25 +613,25 @@ public :
{ return getToplevel()->generateFile( SF, DN ); }
bool triggeredBy( const QString & Trigger )
{ return getToplevel()->triggeredBy( Trigger ); }
private :
int compareItems ( QCollection::Item item1,
QCollection::Item item2 );
long Number;
- // state of this connection
+ // state of this networkSetup
State_t CurrentState;
QString Name;
// true if this collection was just created (and not
// loaded from file
bool IsNew;
// index in listbox
int Index;
bool IsModified;
int Done;
InterfaceInfo * AssignedInterface;