Diffstat (limited to 'noncore/settings/networksettings2/nsdata.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/nsdata.cpp | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index b4d9aaa..13979ce 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -33,4 +33,3 @@ NetworkSettingsData::~NetworkSettingsData( void ) { | |||
33 | void NetworkSettingsData::loadSettings( void ) { | 33 | void NetworkSettingsData::loadSettings( void ) { |
34 | QString S; | 34 | QString Line, S; |
35 | ANetNodeInstance* NNI; | ||
36 | QString Attr, Value; | 35 | QString Attr, Value; |
@@ -59,3 +58,3 @@ void NetworkSettingsData::loadSettings( void ) { | |||
59 | while( ! TS.atEnd() ) { | 58 | while( ! TS.atEnd() ) { |
60 | S = TS.readLine(); | 59 | S = Line = TS.readLine(); |
61 | 60 | ||
@@ -75,6 +74,12 @@ void NetworkSettingsData::loadSettings( void ) { | |||
75 | } else { | 74 | } else { |
76 | // load nodes | 75 | ANetNode * NN = 0; |
76 | ANetNodeInstance* NNI = 0; | ||
77 | if( S.startsWith( "nodetype " ) ) { | ||
78 | S = S.mid( 9, S.length()-9-1 ); | ||
79 | fprintf( stderr, "Node %s\n", S.latin1() ); | ||
80 | // try to find netnode | ||
81 | NN = NSResources->findNetNode( S ); | ||
82 | } else { | ||
83 | // try to find instance | ||
77 | NNI = NSResources->createNodeInstance( S ); | 84 | NNI = NSResources->createNodeInstance( S ); |
78 | if( ! NNI ) { | ||
79 | printf( "SKIPPING %s\n", S.latin1() ); | ||
80 | } | 85 | } |
@@ -83,2 +88,4 @@ void NetworkSettingsData::loadSettings( void ) { | |||
83 | S = TS.readLine(); | 88 | S = TS.readLine(); |
89 | |||
90 | if( NN || NNI ) { | ||
84 | if( S.isEmpty() ) { | 91 | if( S.isEmpty() ) { |
@@ -87,4 +94,2 @@ void NetworkSettingsData::loadSettings( void ) { | |||
87 | } | 94 | } |
88 | // node found ? | ||
89 | if( NNI ) { | ||
90 | idx = S.find( '=' ); | 95 | idx = S.find( '=' ); |
@@ -104,2 +109,6 @@ void NetworkSettingsData::loadSettings( void ) { | |||
104 | 109 | ||
110 | if( NN ) { | ||
111 | // set the attribute | ||
112 | NNI->setAttribute( Attr, Value ); | ||
113 | } else { | ||
105 | // set the attribute | 114 | // set the attribute |
@@ -107,3 +116,10 @@ void NetworkSettingsData::loadSettings( void ) { | |||
107 | } | 116 | } |
108 | 117 | } else { | |
118 | LeftOvers.append( Line ); | ||
119 | // add empty line too as delimiter | ||
120 | if( S.isEmpty() ) { | ||
121 | // empty line | ||
122 | break; | ||
123 | } | ||
124 | } | ||
109 | } while( 1 ); | 125 | } while( 1 ); |
@@ -140,2 +156,21 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
140 | QTextStream TS( &F ); | 156 | QTextStream TS( &F ); |
157 | |||
158 | // save leftovers | ||
159 | for ( QStringList::Iterator it = LeftOvers.begin(); | ||
160 | it != LeftOvers.end(); ++it ) { | ||
161 | TS << (*it) << endl; | ||
162 | } | ||
163 | |||
164 | // save global configs | ||
165 | for( QDictIterator<NetNode_t> it( NSResources->netNodes() ); | ||
166 | it.current(); | ||
167 | ++it ) { | ||
168 | TS << "[nodetype " | ||
169 | << it.current()->NetNode->name() | ||
170 | << "]" | ||
171 | << endl; | ||
172 | |||
173 | it.current()->NetNode->saveAttributes( TS ); | ||
174 | } | ||
175 | |||
141 | { Name2Connection_t & M = NSResources->connections(); | 176 | { Name2Connection_t & M = NSResources->connections(); |