3 files changed, 8 insertions, 3 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp index 17653bd..f8f2d1e 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.cpp +++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp | |||
@@ -119,139 +119,140 @@ void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ | |||
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { | 122 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { |
123 | TS << "__name=" << name() << endl; | 123 | TS << "__name=" << name() << endl; |
124 | saveSpecificAttribute( TS ); | 124 | saveSpecificAttribute( TS ); |
125 | } | 125 | } |
126 | 126 | ||
127 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { | 127 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { |
128 | return connection()->findNext( this ); | 128 | return connection()->findNext( this ); |
129 | } | 129 | } |
130 | 130 | ||
131 | // | 131 | // |
132 | // | 132 | // |
133 | // NODECOLLECTION | 133 | // NODECOLLECTION |
134 | // | 134 | // |
135 | // | 135 | // |
136 | 136 | ||
137 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { | 137 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { |
138 | IsModified = 0; | 138 | IsModified = 0; |
139 | Index = -1; | 139 | Index = -1; |
140 | Name=""; | 140 | Name=""; |
141 | IsNew = 1; | 141 | IsNew = 1; |
142 | CurrentState = Unchecked; | 142 | CurrentState = Unchecked; |
143 | AssignedInterface = 0; | 143 | AssignedInterface = 0; |
144 | } | 144 | } |
145 | 145 | ||
146 | NodeCollection::NodeCollection( QTextStream & TS ) : | 146 | NodeCollection::NodeCollection( QTextStream & TS ) : |
147 | QList<ANetNodeInstance>() { | 147 | QList<ANetNodeInstance>() { |
148 | long idx; | 148 | long idx; |
149 | bool InError = 0; | 149 | bool InError = 0; |
150 | QString S, A, N; | 150 | QString S, A, N; |
151 | IsModified = 0; | 151 | IsModified = 0; |
152 | Index = -1; | 152 | Index = -1; |
153 | Name=""; | 153 | Name=""; |
154 | IsNew = 0; | 154 | IsNew = 0; |
155 | AssignedInterface = 0; | 155 | AssignedInterface = 0; |
156 | CurrentState = Unchecked; | 156 | CurrentState = Unchecked; |
157 | 157 | ||
158 | do { | 158 | do { |
159 | S = TS.readLine(); | 159 | S = TS.readLine(); |
160 | if( S.isEmpty() ) { | 160 | if( S.isEmpty() ) { |
161 | if( InError ) { | 161 | if( InError ) { |
162 | // remove all nodes | 162 | // remove all nodes |
163 | clear(); | 163 | clear(); |
164 | } | 164 | } |
165 | // empty line | 165 | // empty line |
166 | break; | 166 | break; |
167 | } | 167 | } |
168 | 168 | ||
169 | idx = S.find('='); | 169 | idx = S.find('='); |
170 | S.stripWhiteSpace(); | 170 | S.stripWhiteSpace(); |
171 | A = S.left( idx ); | 171 | A = S.left( idx ); |
172 | A.lower(); | 172 | A.lower(); |
173 | N = S.mid( idx+1, S.length() ); | 173 | N = S.mid( idx+1, S.length() ); |
174 | N.stripWhiteSpace(); | 174 | N.stripWhiteSpace(); |
175 | N = deQuote( N ); | 175 | N = deQuote( N ); |
176 | 176 | ||
177 | if( A == "name" ) { | 177 | if( A == "name" ) { |
178 | Name = N; | 178 | Name = N; |
179 | } else if( A == "number" ) { | 179 | } else if( A == "number" ) { |
180 | setNumber( N.toLong() ); | 180 | setNumber( N.toLong() ); |
181 | } else if( A == "node" ) { | 181 | } else if( A == "node" ) { |
182 | ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); | 182 | ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); |
183 | Log(( "Find node %s : %p\n", N.latin1(), NNI )); | ||
183 | if( NNI && ! InError ) { | 184 | if( NNI && ! InError ) { |
184 | append( NSResources->findNodeInstance( N ) ); | 185 | append( NNI ); |
185 | } else { | 186 | } else { |
186 | // could not find a node type -> collection invalid | 187 | // could not find a node type -> collection invalid |
187 | InError = 1; | 188 | InError = 1; |
188 | } | 189 | } |
189 | } | 190 | } |
190 | } while( 1 ); | 191 | } while( 1 ); |
191 | 192 | ||
192 | Log(( "Profile number %s : %d nodes\n", | 193 | Log(( "Profile number %s : %d nodes\n", |
193 | N.latin1(), count() )); | 194 | Name.latin1(), count() )); |
194 | } | 195 | } |
195 | 196 | ||
196 | 197 | ||
197 | NodeCollection::~NodeCollection( void ) { | 198 | NodeCollection::~NodeCollection( void ) { |
198 | } | 199 | } |
199 | 200 | ||
200 | const QString & NodeCollection::description( void ) { | 201 | const QString & NodeCollection::description( void ) { |
201 | ANetNodeInstance * NNI = getToplevel(); | 202 | ANetNodeInstance * NNI = getToplevel(); |
202 | return (NNI) ? NNI->runtime()->description() : Name; | 203 | return (NNI) ? NNI->runtime()->description() : Name; |
203 | } | 204 | } |
204 | 205 | ||
205 | void NodeCollection::append( ANetNodeInstance * NNI ) { | 206 | void NodeCollection::append( ANetNodeInstance * NNI ) { |
206 | NNI->setConnection( this ); | 207 | NNI->setConnection( this ); |
207 | QList<ANetNodeInstance>::append( NNI ); | 208 | QList<ANetNodeInstance>::append( NNI ); |
208 | } | 209 | } |
209 | 210 | ||
210 | void NodeCollection::save( QTextStream & TS ) { | 211 | void NodeCollection::save( QTextStream & TS ) { |
211 | 212 | ||
212 | TS << "name=" << quote( Name ) << endl; | 213 | TS << "name=" << quote( Name ) << endl; |
213 | TS << "number=" << number() << endl; | 214 | TS << "number=" << number() << endl; |
214 | ANetNodeInstance * NNI; | 215 | ANetNodeInstance * NNI; |
215 | for( QListIterator<ANetNodeInstance> it(*this); | 216 | for( QListIterator<ANetNodeInstance> it(*this); |
216 | it.current(); | 217 | it.current(); |
217 | ++it ) { | 218 | ++it ) { |
218 | NNI = it.current(); | 219 | NNI = it.current(); |
219 | TS << "node=" << NNI->name() << endl; | 220 | TS << "node=" << NNI->name() << endl; |
220 | } | 221 | } |
221 | TS << endl; | 222 | TS << endl; |
222 | IsNew = 0; | 223 | IsNew = 0; |
223 | } | 224 | } |
224 | 225 | ||
225 | ANetNodeInstance * NodeCollection::getToplevel( void ) { | 226 | ANetNodeInstance * NodeCollection::getToplevel( void ) { |
226 | ANetNodeInstance * NNI = 0; | 227 | ANetNodeInstance * NNI = 0; |
227 | for( QListIterator<ANetNodeInstance> it(*this); | 228 | for( QListIterator<ANetNodeInstance> it(*this); |
228 | it.current(); | 229 | it.current(); |
229 | ++it ) { | 230 | ++it ) { |
230 | NNI = it.current(); | 231 | NNI = it.current(); |
231 | if( NNI->nodeClass()->isToplevel() ) | 232 | if( NNI->nodeClass()->isToplevel() ) |
232 | break; | 233 | break; |
233 | } | 234 | } |
234 | return NNI; | 235 | return NNI; |
235 | } | 236 | } |
236 | 237 | ||
237 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { | 238 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { |
238 | ANetNodeInstance * NNI = 0; | 239 | ANetNodeInstance * NNI = 0; |
239 | for( QListIterator<ANetNodeInstance> it(*this); | 240 | for( QListIterator<ANetNodeInstance> it(*this); |
240 | it.current(); | 241 | it.current(); |
241 | ++it ) { | 242 | ++it ) { |
242 | NNI = it.current(); | 243 | NNI = it.current(); |
243 | if( NNI->name() == S ) | 244 | if( NNI->name() == S ) |
244 | break; | 245 | break; |
245 | } | 246 | } |
246 | return NNI; | 247 | return NNI; |
247 | } | 248 | } |
248 | 249 | ||
249 | ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { | 250 | ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { |
250 | ANetNodeInstance * NNNI; | 251 | ANetNodeInstance * NNNI; |
251 | 252 | ||
252 | if( ! NNI ) | 253 | if( ! NNI ) |
253 | getToplevel(); | 254 | getToplevel(); |
254 | 255 | ||
255 | for( QListIterator<ANetNodeInstance> it(*this); | 256 | for( QListIterator<ANetNodeInstance> it(*this); |
256 | it.current(); | 257 | it.current(); |
257 | ++it ) { | 258 | ++it ) { |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp index 8b3b4fe..50fb15a 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.cpp +++ b/noncore/settings/networksettings2/networksettings2/resources.cpp | |||
@@ -80,138 +80,141 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | |||
80 | 80 | ||
81 | // get access to the system | 81 | // get access to the system |
82 | TheSystem = new System(); | 82 | TheSystem = new System(); |
83 | 83 | ||
84 | } | 84 | } |
85 | 85 | ||
86 | TheNSResources::~TheNSResources( void ) { | 86 | TheNSResources::~TheNSResources( void ) { |
87 | delete TheSystem; | 87 | delete TheSystem; |
88 | } | 88 | } |
89 | 89 | ||
90 | void TheNSResources::addNodeType( const QString & ID, | 90 | void TheNSResources::addNodeType( const QString & ID, |
91 | const QString & Name, | 91 | const QString & Name, |
92 | const QString & Descr ) { | 92 | const QString & Descr ) { |
93 | if( NodeTypeNameMap[ID].isEmpty() ) { | 93 | if( NodeTypeNameMap[ID].isEmpty() ) { |
94 | NodeTypeNameMap.insert( ID, Name ); | 94 | NodeTypeNameMap.insert( ID, Name ); |
95 | NodeTypeDescriptionMap.insert( ID, Descr ); | 95 | NodeTypeDescriptionMap.insert( ID, Descr ); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | void TheNSResources::addSystemFile( const QString & ID, | 99 | void TheNSResources::addSystemFile( const QString & ID, |
100 | const QString & P, | 100 | const QString & P, |
101 | bool KDI ) { | 101 | bool KDI ) { |
102 | if( ! SystemFiles.find( ID ) ) { | 102 | if( ! SystemFiles.find( ID ) ) { |
103 | // new system file | 103 | // new system file |
104 | SystemFiles.insert( ID, new SystemFile( ID, P, KDI ) ); | 104 | SystemFiles.insert( ID, new SystemFile( ID, P, KDI ) ); |
105 | } // else existed | 105 | } // else existed |
106 | } | 106 | } |
107 | 107 | ||
108 | void TheNSResources::busy( bool ) { | 108 | void TheNSResources::busy( bool ) { |
109 | /* | 109 | /* |
110 | if( B ) { | 110 | if( B ) { |
111 | ShowWait->show(); | 111 | ShowWait->show(); |
112 | qApp->process | 112 | qApp->process |
113 | } else { | 113 | } else { |
114 | ShowWait->hide(); | 114 | ShowWait->hide(); |
115 | } | 115 | } |
116 | */ | 116 | */ |
117 | } | 117 | } |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * Load all modules that are found in the path | 120 | * Load all modules that are found in the path |
121 | * @param path a directory that is scaned for any plugins that can be loaded | 121 | * @param path a directory that is scaned for any plugins that can be loaded |
122 | * and attempts to load them | 122 | * and attempts to load them |
123 | */ | 123 | */ |
124 | void TheNSResources::findAvailableNetNodes(const QString &path){ | 124 | void TheNSResources::findAvailableNetNodes(const QString &path){ |
125 | 125 | ||
126 | Log(("Locate plugins in %s\n", path.latin1() )); | 126 | Log(("Locate plugins in %s\n", path.latin1() )); |
127 | QDir d(path); | 127 | QDir d(path); |
128 | if(!d.exists()) | 128 | if(!d.exists()) |
129 | return; | 129 | return; |
130 | 130 | ||
131 | QString lang = ::getenv("LANG"); | 131 | QString lang = ::getenv("LANG"); |
132 | 132 | ||
133 | // Don't want sym links | 133 | // Don't want sym links |
134 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 134 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
135 | const QFileInfoList *list = d.entryInfoList(); | 135 | const QFileInfoList *list = d.entryInfoList(); |
136 | QFileInfoListIterator it( *list ); | 136 | QFileInfoListIterator it( *list ); |
137 | QFileInfo *fi; | 137 | QFileInfo *fi; |
138 | 138 | ||
139 | while ( (fi=it.current()) ) { | 139 | while ( (fi=it.current()) ) { |
140 | 140 | ||
141 | if( fi->fileName().contains(".so")){ | 141 | if( fi->fileName().contains(".so")){ |
142 | /* if loaded install translation */ | 142 | /* if loaded install translation */ |
143 | if( loadNetNode(path + "/" + fi->fileName()) ) { | 143 | if( loadNetNode(path + "/" + fi->fileName()) ) { |
144 | Log(( "Loading plugin %s\n", fi->fileName().latin1())); | ||
144 | QTranslator *trans = new QTranslator(qApp); | 145 | QTranslator *trans = new QTranslator(qApp); |
145 | QString fn = QPEApplication::qpeDir()+ | 146 | QString fn = QPEApplication::qpeDir()+ |
146 | "/i18n/"+lang+"/"+ | 147 | "/i18n/"+lang+"/"+ |
147 | fi->fileName().left( fi->fileName().find(".") )+ | 148 | fi->fileName().left( fi->fileName().find(".") )+ |
148 | ".qm"; | 149 | ".qm"; |
149 | 150 | ||
150 | if( trans->load( fn ) ) | 151 | if( trans->load( fn ) ) |
151 | qApp->installTranslator( trans ); | 152 | qApp->installTranslator( trans ); |
152 | else | 153 | else |
153 | delete trans; | 154 | delete trans; |
155 | } else { | ||
156 | Log(( "Error loading plugin %s\n", fi->fileName().latin1())); | ||
154 | } | 157 | } |
155 | } | 158 | } |
156 | ++it; | 159 | ++it; |
157 | } | 160 | } |
158 | } | 161 | } |
159 | 162 | ||
160 | // used to find unique connection number | 163 | // used to find unique connection number |
161 | int TheNSResources::assignConnectionNumber( void ) { | 164 | int TheNSResources::assignConnectionNumber( void ) { |
162 | bool found = 1; | 165 | bool found = 1; |
163 | for( int trial = 0; ; trial ++ ) { | 166 | for( int trial = 0; ; trial ++ ) { |
164 | found = 1; | 167 | found = 1; |
165 | for( QDictIterator<NodeCollection> it(ConnectionsMap); | 168 | for( QDictIterator<NodeCollection> it(ConnectionsMap); |
166 | it.current(); | 169 | it.current(); |
167 | ++it ) { | 170 | ++it ) { |
168 | if( it.current()->number() == trial ) { | 171 | if( it.current()->number() == trial ) { |
169 | found = 0; | 172 | found = 0; |
170 | break; | 173 | break; |
171 | } | 174 | } |
172 | } | 175 | } |
173 | 176 | ||
174 | if( found ) { | 177 | if( found ) { |
175 | Log(("Assign profile number %d\n", trial )); | 178 | Log(("Assign profile number %d\n", trial )); |
176 | return trial; | 179 | return trial; |
177 | } | 180 | } |
178 | } | 181 | } |
179 | } | 182 | } |
180 | 183 | ||
181 | /** | 184 | /** |
182 | * Attempt to load a function and resolve a function. | 185 | * Attempt to load a function and resolve a function. |
183 | * @param pluginFileName - the name of the file in which to attempt to load | 186 | * @param pluginFileName - the name of the file in which to attempt to load |
184 | * @param resolveString - function pointer to resolve | 187 | * @param resolveString - function pointer to resolve |
185 | * @return true of loading is successful | 188 | * @return true of loading is successful |
186 | */ | 189 | */ |
187 | bool TheNSResources::loadNetNode( | 190 | bool TheNSResources::loadNetNode( |
188 | const QString &pluginFileName, const QString &resolveString){ | 191 | const QString &pluginFileName, const QString &resolveString){ |
189 | 192 | ||
190 | QLibrary *lib = new QLibrary(pluginFileName); | 193 | QLibrary *lib = new QLibrary(pluginFileName); |
191 | void * res = lib->resolve(resolveString); | 194 | void * res = lib->resolve(resolveString); |
192 | if( ! res ){ | 195 | if( ! res ){ |
193 | delete lib; | 196 | delete lib; |
194 | return 0; | 197 | return 0; |
195 | } | 198 | } |
196 | 199 | ||
197 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; | 200 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; |
198 | 201 | ||
199 | // Try to get an object. | 202 | // Try to get an object. |
200 | QList<ANetNode> PNN; | 203 | QList<ANetNode> PNN; |
201 | 204 | ||
202 | getNetNodeList( PNN ); | 205 | getNetNodeList( PNN ); |
203 | if( PNN.isEmpty() ) { | 206 | if( PNN.isEmpty() ) { |
204 | delete lib; | 207 | delete lib; |
205 | return 0; | 208 | return 0; |
206 | } | 209 | } |
207 | 210 | ||
208 | ANetNode * NNP; | 211 | ANetNode * NNP; |
209 | for( QListIterator<ANetNode> it(PNN); | 212 | for( QListIterator<ANetNode> it(PNN); |
210 | it.current(); | 213 | it.current(); |
211 | ++it ) { | 214 | ++it ) { |
212 | NetNode_t * NN; | 215 | NetNode_t * NN; |
213 | 216 | ||
214 | NNP = it.current(); | 217 | NNP = it.current(); |
215 | NN = new NetNode_t; | 218 | NN = new NetNode_t; |
216 | NN->NetNode = NNP; | 219 | NN->NetNode = NNP; |
217 | NN->TheLibrary = lib; | 220 | NN->TheLibrary = lib; |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h index 634cd39..5d90286 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.h +++ b/noncore/settings/networksettings2/networksettings2/resources.h | |||
@@ -19,125 +19,126 @@ typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN ); | |||
19 | typedef struct NetNode_S { | 19 | typedef struct NetNode_S { |
20 | ANetNode * NetNode; | 20 | ANetNode * NetNode; |
21 | QLibrary * TheLibrary; | 21 | QLibrary * TheLibrary; |
22 | long NodeCountInLib; | 22 | long NodeCountInLib; |
23 | } NetNode_t; | 23 | } NetNode_t; |
24 | 24 | ||
25 | class CurrentQPEUser { | 25 | class CurrentQPEUser { |
26 | 26 | ||
27 | public : | 27 | public : |
28 | CurrentQPEUser() : UserName(), HomeDir(), EnvList() {} | 28 | CurrentQPEUser() : UserName(), HomeDir(), EnvList() {} |
29 | 29 | ||
30 | inline bool known( void ) | 30 | inline bool known( void ) |
31 | { return ! HomeDir.isEmpty() && ! UserName.isEmpty(); } | 31 | { return ! HomeDir.isEmpty() && ! UserName.isEmpty(); } |
32 | 32 | ||
33 | QString UserName; | 33 | QString UserName; |
34 | QString HomeDir; | 34 | QString HomeDir; |
35 | int Uid; | 35 | int Uid; |
36 | int Gid; | 36 | int Gid; |
37 | QArray<char *> EnvList; | 37 | QArray<char *> EnvList; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | typedef QDict<NetNode_t> Name2NetNode_t; | 40 | typedef QDict<NetNode_t> Name2NetNode_t; |
41 | typedef QDict<ANetNodeInstance > Name2Instance_t; | 41 | typedef QDict<ANetNodeInstance > Name2Instance_t; |
42 | typedef QDict<NodeCollection> Name2Connection_t; | 42 | typedef QDict<NodeCollection> Name2Connection_t; |
43 | typedef QDict<SystemFile> Name2SystemFile_t; | 43 | typedef QDict<SystemFile> Name2SystemFile_t; |
44 | 44 | ||
45 | class TheNSResources { | 45 | class TheNSResources { |
46 | 46 | ||
47 | public : | 47 | public : |
48 | 48 | ||
49 | TheNSResources( void ); | 49 | TheNSResources( void ); |
50 | ~TheNSResources( ); | 50 | ~TheNSResources( ); |
51 | 51 | ||
52 | // give busy feedback | 52 | // give busy feedback |
53 | void busy( bool B ); | 53 | void busy( bool B ); |
54 | 54 | ||
55 | System & system() | 55 | System & system() |
56 | { return *TheSystem; } | 56 | { return *TheSystem; } |
57 | 57 | ||
58 | int assignConnectionNumber(void); | 58 | int assignConnectionNumber(void); |
59 | QPixmap getPixmap( const QString & Name ); | 59 | QPixmap getPixmap( const QString & Name ); |
60 | 60 | ||
61 | Name2NetNode_t & netNodes( void ) | 61 | Name2NetNode_t & netNodes( void ) |
62 | { return AllNodeTypes; } | 62 | { return AllNodeTypes; } |
63 | bool netNodeExists( const QString & X ) | 63 | bool netNodeExists( const QString & X ) |
64 | { return AllNodeTypes.find(X)!=0; } | 64 | { return AllNodeTypes.find(X)!=0; } |
65 | ANetNode * findNetNode( const QString & N ) | 65 | ANetNode * findNetNode( const QString & N ) |
66 | { NetNode_t * NNT = AllNodeTypes.find(N); | 66 | { NetNode_t * NNT = AllNodeTypes.find(N); |
67 | return (NNT) ? NNT->NetNode : 0; | 67 | return (NNT) ? NNT->NetNode : 0; |
68 | } | 68 | } |
69 | 69 | ||
70 | // define new plugin (=node) | 70 | // define new plugin (=node) |
71 | void addNodeType( const QString & ID, | 71 | void addNodeType( const QString & ID, |
72 | const QString & LongName, | 72 | const QString & LongName, |
73 | const QString & Description ); | 73 | const QString & Description ); |
74 | 74 | ||
75 | Name2SystemFile_t & systemFiles( void ) | 75 | Name2SystemFile_t & systemFiles( void ) |
76 | { return SystemFiles; } | 76 | { return SystemFiles; } |
77 | void addSystemFile( const QString & ID, | 77 | void addSystemFile( const QString & ID, |
78 | const QString & P, | 78 | const QString & P, |
79 | bool KDI ); | 79 | bool KDI ); |
80 | 80 | ||
81 | ANetNodeInstance * createNodeInstance( const QString & S ) | 81 | ANetNodeInstance * createNodeInstance( const QString & S ) |
82 | { ANetNodeInstance * NNI = 0; | 82 | { ANetNodeInstance * NNI = 0; |
83 | printf( "Find node type %s\n", S.latin1() ); | ||
83 | NetNode_t * NNT = AllNodeTypes[S]; | 84 | NetNode_t * NNT = AllNodeTypes[S]; |
84 | if( ! NNT ) { | 85 | if( ! NNT ) { |
85 | return 0; | 86 | return 0; |
86 | } | 87 | } |
87 | NNI = NNT->NetNode->createInstance(); | 88 | NNI = NNT->NetNode->createInstance(); |
88 | NNI->initialize(); | 89 | NNI->initialize(); |
89 | return NNI; | 90 | return NNI; |
90 | } | 91 | } |
91 | 92 | ||
92 | Name2Instance_t & netNodeInstances( void ) | 93 | Name2Instance_t & netNodeInstances( void ) |
93 | { return AllNodes; } | 94 | { return AllNodes; } |
94 | void addNodeInstance( ANetNodeInstance * I ) | 95 | void addNodeInstance( ANetNodeInstance * I ) |
95 | { AllNodes.insert( I->name(), I ); } | 96 | { AllNodes.insert( I->name(), I ); } |
96 | void removeNodeInstance( const QString & N ) | 97 | void removeNodeInstance( const QString & N ) |
97 | { AllNodes.remove( N );} | 98 | { AllNodes.remove( N );} |
98 | ANetNodeInstance * findNodeInstance( const QString & S ) | 99 | ANetNodeInstance * findNodeInstance( const QString & S ) |
99 | { return (AllNodes.find(S)!=0) ? AllNodes[S] : 0; } | 100 | { return AllNodes[S]; } |
100 | 101 | ||
101 | const QString & netNode2Name( const char * Type ); | 102 | const QString & netNode2Name( const char * Type ); |
102 | const QString & netNode2Description( const char * Type ); | 103 | const QString & netNode2Description( const char * Type ); |
103 | 104 | ||
104 | void addConnection( NodeCollection * NC ); | 105 | void addConnection( NodeCollection * NC ); |
105 | void removeConnection( const QString & N ); | 106 | void removeConnection( const QString & N ); |
106 | NodeCollection * findConnection( const QString & N ); | 107 | NodeCollection * findConnection( const QString & N ); |
107 | NodeCollection * getConnection( int nr ); | 108 | NodeCollection * getConnection( int nr ); |
108 | Name2Connection_t & connections( void ) | 109 | Name2Connection_t & connections( void ) |
109 | { return ConnectionsMap; } | 110 | { return ConnectionsMap; } |
110 | 111 | ||
111 | inline bool userKnown( void ) | 112 | inline bool userKnown( void ) |
112 | { return CurrentUser.known(); } | 113 | { return CurrentUser.known(); } |
113 | CurrentQPEUser & currentUser( void ) | 114 | CurrentQPEUser & currentUser( void ) |
114 | { return CurrentUser; } | 115 | { return CurrentUser; } |
115 | 116 | ||
116 | private : | 117 | private : |
117 | 118 | ||
118 | void detectCurrentUser( void ); | 119 | void detectCurrentUser( void ); |
119 | QString tr( const char * path ); | 120 | QString tr( const char * path ); |
120 | void findAvailableNetNodes( const QString &path ); | 121 | void findAvailableNetNodes( const QString &path ); |
121 | bool loadNetNode( | 122 | bool loadNetNode( |
122 | const QString &pluginFileName, | 123 | const QString &pluginFileName, |
123 | const QString &resolveString = "create_plugin"); | 124 | const QString &resolveString = "create_plugin"); |
124 | 125 | ||
125 | QMap< QString, QString> NodeTypeNameMap; | 126 | QMap< QString, QString> NodeTypeNameMap; |
126 | QMap< QString, QString> NodeTypeDescriptionMap; | 127 | QMap< QString, QString> NodeTypeDescriptionMap; |
127 | Name2Connection_t ConnectionsMap; | 128 | Name2Connection_t ConnectionsMap; |
128 | System * TheSystem; | 129 | System * TheSystem; |
129 | Name2SystemFile_t SystemFiles; | 130 | Name2SystemFile_t SystemFiles; |
130 | 131 | ||
131 | // all node type classes | 132 | // all node type classes |
132 | Name2NetNode_t AllNodeTypes; | 133 | Name2NetNode_t AllNodeTypes; |
133 | 134 | ||
134 | // all nodes | 135 | // all nodes |
135 | Name2Instance_t AllNodes; | 136 | Name2Instance_t AllNodes; |
136 | 137 | ||
137 | CurrentQPEUser CurrentUser; | 138 | CurrentQPEUser CurrentUser; |
138 | }; | 139 | }; |
139 | 140 | ||
140 | extern TheNSResources * _NSResources; | 141 | extern TheNSResources * _NSResources; |
141 | #define NSResources _NSResources | 142 | #define NSResources _NSResources |
142 | 143 | ||
143 | #endif | 144 | #endif |