Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/netnode.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings2/netnode.h | 73 |
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 | |||
@@ -14,17 +14,17 @@ | |||
14 | 14 | ||
15 | // difference feature interfaces | 15 | // difference feature interfaces |
16 | class AsDevice; | 16 | class AsDevice; |
17 | class AsLine; | 17 | class AsLine; |
18 | class AsConnection; | 18 | class AsNetworkSetup; |
19 | class AsFullSetup; | 19 | class AsFullSetup; |
20 | 20 | ||
21 | // needed for plugin creation function | 21 | // needed for plugin creation function |
22 | #include <qlist.h> | 22 | #include <qlist.h> |
23 | 23 | ||
24 | class ANetNode; | 24 | class ANetNode; |
25 | class ANetNodeInstance; | 25 | class ANetNodeInstance; |
26 | class NodeCollection; | 26 | class NetworkSetup; |
27 | class QTextStream; | 27 | class QTextStream; |
28 | class RuntimeInfo; | 28 | class RuntimeInfo; |
29 | class InterfaceInfo; | 29 | class InterfaceInfo; |
30 | class NSResources; | 30 | class NSResources; |
@@ -38,22 +38,22 @@ typedef enum State { | |||
38 | // if we have not yet detected the state of the device | 38 | // if we have not yet detected the state of the device |
39 | Unchecked = 0, | 39 | Unchecked = 0, |
40 | // if we cannot determine the state | 40 | // if we cannot determine the state |
41 | Unknown = 1, | 41 | Unknown = 1, |
42 | // if connection cannot be established e.g. because | 42 | // if networkSetup cannot be established e.g. because |
43 | // the hardware is not available | 43 | // the hardware is not available |
44 | Unavailable = 2, | 44 | Unavailable = 2, |
45 | // if the connection cannot be establishec but NOT | 45 | // if the networkSetup cannot be establishec but NOT |
46 | // because it is physically impossible but because | 46 | // because it is physically impossible but because |
47 | // it has been disabled for FUNCTIONAL reasons | 47 | // it has been disabled for FUNCTIONAL reasons |
48 | Disabled = 3, | 48 | Disabled = 3, |
49 | // if connection is available to is currently down | 49 | // if networkSetup is available to is currently down |
50 | // i.e. the corresponding hardware is not activated | 50 | // i.e. the corresponding hardware is not activated |
51 | Off = 4, | 51 | Off = 4, |
52 | // if connection is available to be used (i.e. the | 52 | // if networkSetup is available to be used (i.e. the |
53 | // devices if fully ready to be used | 53 | // devices if fully ready to be used |
54 | Available = 5, | 54 | Available = 5, |
55 | // if connection is being used | 55 | // if networkSetup is being used |
56 | IsUp = 6 | 56 | IsUp = 6 |
57 | } State_t; | 57 | } State_t; |
58 | 58 | ||
59 | typedef enum Action { | 59 | typedef enum Action { |
@@ -64,11 +64,11 @@ typedef enum Action { | |||
64 | // bring the hardware up -> to Available | 64 | // bring the hardware up -> to Available |
65 | Activate = 2, | 65 | Activate = 2, |
66 | // bring the hardware down -> to off | 66 | // bring the hardware down -> to off |
67 | Deactivate = 3, | 67 | Deactivate = 3, |
68 | // bring the connection up -> to IsUp | 68 | // bring the networkSetup up -> to IsUp |
69 | Up = 4, | 69 | Up = 4, |
70 | // bring the connection down -> to Available | 70 | // bring the networkSetup down -> to Available |
71 | Down = 5 | 71 | Down = 5 |
72 | } Action_t; | 72 | } Action_t; |
73 | 73 | ||
74 | class ANetNode : public QObject { | 74 | class ANetNode : public QObject { |
@@ -90,9 +90,9 @@ public: | |||
90 | { return Done; } | 90 | { return Done; } |
91 | inline void setDone( int D ) | 91 | inline void setDone( int D ) |
92 | { Done = D; } | 92 | { Done = D; } |
93 | 93 | ||
94 | // does this Node provide a Connection | 94 | // does this Node provide a NetworkSetup |
95 | bool isToplevel( void ); | 95 | bool isToplevel( void ); |
96 | 96 | ||
97 | // set the value of an attribute | 97 | // set the value of an attribute |
98 | void setAttribute( QString & Attr, QString & Value ) ; | 98 | void setAttribute( QString & Attr, QString & Value ) ; |
@@ -244,12 +244,12 @@ public: | |||
244 | 244 | ||
245 | inline const char ** needs( void ) | 245 | inline const char ** needs( void ) |
246 | { return NodeType->needs(); } | 246 | { return NodeType->needs(); } |
247 | 247 | ||
248 | inline void setConnection( NodeCollection * NC ) | 248 | inline void setNetworkSetup( NetworkSetup * NC ) |
249 | { Connection = NC; } | 249 | { TheNetworkSetup = NC; } |
250 | inline NodeCollection * connection( void ) | 250 | inline NetworkSetup * networkSetup( void ) |
251 | { return Connection; } | 251 | { return TheNetworkSetup; } |
252 | 252 | ||
253 | // | 253 | // |
254 | // | 254 | // |
255 | // Virtual methods with sensible defaults | 255 | // Virtual methods with sensible defaults |
@@ -314,10 +314,10 @@ protected : | |||
314 | virtual void setSpecificAttribute( QString & , QString & ) = 0; | 314 | virtual void setSpecificAttribute( QString & , QString & ) = 0; |
315 | virtual void saveSpecificAttribute( QTextStream & ) = 0; | 315 | virtual void saveSpecificAttribute( QTextStream & ) = 0; |
316 | 316 | ||
317 | ANetNode * NodeType; | 317 | ANetNode * NodeType; |
318 | // connection to which this node belongs to | 318 | // networkSetup to which this node belongs to |
319 | NodeCollection * Connection; | 319 | NetworkSetup * TheNetworkSetup; |
320 | QString Description; | 320 | QString Description; |
321 | bool IsModified; | 321 | bool IsModified; |
322 | // true if this nodeinstance was just created (and not | 322 | // true if this nodeinstance was just created (and not |
323 | // loaded from file | 323 | // loaded from file |
@@ -377,9 +377,9 @@ public : | |||
377 | { NNI = TheNNI; } | 377 | { NNI = TheNNI; } |
378 | 378 | ||
379 | // | 379 | // |
380 | // | 380 | // |
381 | // methods to be overloaded by connection capable | 381 | // methods to be overloaded by networkSetup capable |
382 | // runtimes | 382 | // runtimes |
383 | // | 383 | // |
384 | // | 384 | // |
385 | 385 | ||
@@ -474,14 +474,14 @@ public : | |||
474 | 474 | ||
475 | inline ANetNodeInstance * netNode() | 475 | inline ANetNodeInstance * netNode() |
476 | { return NNI; } | 476 | { return NNI; } |
477 | 477 | ||
478 | inline NodeCollection * nodeCollection() | 478 | inline NetworkSetup * networkSetup() |
479 | { return NNI->connection(); } | 479 | { return NNI->networkSetup(); } |
480 | 480 | ||
481 | virtual State_t detectState( void ) = 0; | 481 | virtual State_t detectState( void ) = 0; |
482 | // public API to set the state | 482 | // public API to set the state |
483 | virtual QString setState( NodeCollection * NC, | 483 | virtual QString setState( NetworkSetup * NC, |
484 | Action_t A, | 484 | Action_t A, |
485 | bool Force = 0 ); | 485 | bool Force = 0 ); |
486 | 486 | ||
487 | inline RuntimeInfo * nextNode( void ) { | 487 | inline RuntimeInfo * nextNode( void ) { |
@@ -496,23 +496,26 @@ signals : | |||
496 | 496 | ||
497 | protected : | 497 | protected : |
498 | 498 | ||
499 | // set state of this node (private API) | 499 | // set state of this node (private API) |
500 | virtual QString setMyState( NodeCollection * NC, | 500 | virtual QString setMyState( NetworkSetup * NC, |
501 | Action_t A, | 501 | Action_t A, |
502 | bool Force = 0 ) = 0; | 502 | bool Force = 0 ) = 0; |
503 | 503 | ||
504 | // connection this runtime info belongs to | 504 | // networkSetup this runtime info belongs to |
505 | ANetNodeInstance * NNI; | 505 | ANetNodeInstance * NNI; |
506 | }; | 506 | }; |
507 | 507 | ||
508 | class NodeCollection : public QList<ANetNodeInstance> { | 508 | class NetworkSetup : public QList<ANetNodeInstance> { |
509 | 509 | ||
510 | public : | 510 | public : |
511 | 511 | ||
512 | NodeCollection( void ); | 512 | NetworkSetup( void ); |
513 | NodeCollection( QTextStream & TS, bool & Dangling ); | 513 | NetworkSetup( QTextStream & TS, bool & Dangling ); |
514 | ~NodeCollection( void ); | 514 | ~NetworkSetup( void ); |
515 | |||
516 | // copy settings from NC to this | ||
517 | void copyFrom( const NetworkSetup & NC ); | ||
515 | 518 | ||
516 | inline int done( void ) | 519 | inline int done( void ) |
517 | { return Done; } | 520 | { return Done; } |
518 | inline void setDone( int D ) | 521 | inline void setDone( int D ) |
@@ -542,17 +545,17 @@ public : | |||
542 | } | 545 | } |
543 | 546 | ||
544 | // assign the interface to this device | 547 | // assign the interface to this device |
545 | inline void assignInterface( InterfaceInfo * NI ) { | 548 | inline void assignInterface( InterfaceInfo * NI ) { |
546 | if( NI == 0 ) { | 549 | // cleanup previous |
547 | if( AssignedInterface ) { | ||
548 | AssignedInterface->assignConnection( 0 ); | ||
549 | } | ||
550 | } | ||
551 | AssignedInterface = NI; | ||
552 | if( AssignedInterface ) { | 550 | if( AssignedInterface ) { |
553 | AssignedInterface->assignConnection( this ); | 551 | AssignedInterface->assignToNetworkSetup( 0 ); |
554 | } | 552 | } |
553 | if( NI ) { | ||
554 | // assign new | ||
555 | NI->assignToNetworkSetup( this ); | ||
556 | } | ||
557 | AssignedInterface = NI; | ||
555 | } | 558 | } |
556 | 559 | ||
557 | inline RuntimeInfo * device() { | 560 | inline RuntimeInfo * device() { |
558 | return getToplevel()->runtime()->device(); | 561 | return getToplevel()->runtime()->device(); |
@@ -576,9 +579,9 @@ public : | |||
576 | void save( QTextStream & TS ); | 579 | void save( QTextStream & TS ); |
577 | 580 | ||
578 | void append( ANetNodeInstance * NNI ); | 581 | void append( ANetNodeInstance * NNI ); |
579 | 582 | ||
580 | // makes sure that all items in the connection point to | 583 | // makes sure that all items in the networkSetup point to |
581 | // that connectoin | 584 | // that connectoin |
582 | void reassign( void ); | 585 | void reassign( void ); |
583 | 586 | ||
584 | ANetNodeInstance * getToplevel( void ); | 587 | ANetNodeInstance * getToplevel( void ); |
@@ -618,9 +621,9 @@ private : | |||
618 | QCollection::Item item2 ); | 621 | QCollection::Item item2 ); |
619 | 622 | ||
620 | long Number; | 623 | long Number; |
621 | 624 | ||
622 | // state of this connection | 625 | // state of this networkSetup |
623 | State_t CurrentState; | 626 | State_t CurrentState; |
624 | 627 | ||
625 | QString Name; | 628 | QString Name; |
626 | // true if this collection was just created (and not | 629 | // true if this collection was just created (and not |