summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/networksettings2/resources.h
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/resources.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.h105
1 files changed, 105 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h
new file mode 100644
index 0000000..cfa0b7a
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/resources.h
@@ -0,0 +1,105 @@
1#ifndef __RESOURCES__H
2#define __RESOURCES__H
3
4#include <qstring.h>
5#include <qdict.h>
6#include <qmap.h>
7#include <qlist.h>
8#include "netnode.h"
9#include "systemfile.h"
10#include "system.h"
11
12class QLibrary;
13class QPixmap;
14class ANetNode;
15class ANetNodeInstance;
16
17typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN );
18
19typedef struct NetNode_S {
20 ANetNode * NetNode;
21 QLibrary * TheLibrary;
22 long NodeCountInLib;
23} NetNode_t;
24
25typedef QDict<NetNode_t> Name2NetNode_t;
26typedef QDict<ANetNodeInstance > Name2Instance_t;
27typedef QDict<NodeCollection> Name2Connection_t;
28typedef QDict<SystemFile> Name2SystemFile_t;
29
30class TheNSResources {
31
32public :
33
34 TheNSResources( void );
35 ~TheNSResources( );
36
37 System & system()
38 { return *TheSystem; }
39
40 QPixmap getPixmap( const QString & Name );
41
42 Name2NetNode_t & netNodes( void )
43 { return AllNodeTypes; }
44 bool netNodeExists( const QString & X )
45 { return AllNodeTypes.find(X)!=0; }
46
47 Name2SystemFile_t & systemFiles( void )
48 { return SystemFiles; }
49 void addSystemFile( SystemFile * SF )
50 { SystemFiles.insert( SF->name(), SF ); }
51
52 ANetNodeInstance * createNodeInstance( const QString & S )
53 { ANetNodeInstance * NNI = 0;
54 NetNode_t * NNT = AllNodeTypes[S];
55 if( NNT ) {
56 NNI = NNT->NetNode->createInstance();
57 NNI->initialize();
58 }
59 return NNI;
60 }
61
62 Name2Instance_t & netNodeInstances( void )
63 { return AllNodes; }
64 void addNodeInstance( ANetNodeInstance * I )
65 { AllNodes.insert( I->nodeName(), I ); }
66 void removeNodeInstance( const QString & N )
67 { AllNodes.remove( N );}
68 ANetNodeInstance * findNodeInstance( const QString & S )
69 { return (AllNodes.find(S)!=0) ? AllNodes[S] : 0; }
70
71 const QString & netNode2Name( const char * Type );
72 const QString & netNode2Description( const char * Type );
73
74 void renumberConnections( void );
75 void addConnection( NodeCollection * NC );
76 void removeConnection( const QString & N );
77 NodeCollection * findConnection( const QString & N );
78 Name2Connection_t & connections( void )
79 { return ConnectionsMap; }
80
81private :
82
83 QString tr( const char * path );
84 void findAvailableNetNodes( const QString &path );
85 bool loadNetNode(
86 const QString &pluginFileName,
87 const QString &resolveString = "create_plugin");
88
89 QMap< QString, QString> NodeTypeNameMap;
90 QMap< QString, QString> NodeTypeDescriptionMap;
91 Name2Connection_t ConnectionsMap;
92 System * TheSystem;
93 Name2SystemFile_t SystemFiles;
94
95 // all node type classes
96 Name2NetNode_t AllNodeTypes;
97
98 // all nodes
99 Name2Instance_t AllNodes;
100};
101
102extern TheNSResources * _NSResources;
103#define NSResources _NSResources
104
105#endif