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.h60
1 files changed, 15 insertions, 45 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h
index 421a433..b27cda1 100644
--- a/noncore/settings/networksettings2/networksettings2/resources.h
+++ b/noncore/settings/networksettings2/networksettings2/resources.h
@@ -38,21 +38,7 @@ public :
38 QArray<char *> EnvList; 38 QArray<char *> EnvList;
39}; 39};
40 40
41#ifdef MYPLUGIN
42
43typedef struct NetNode_S {
44 ANetNode * NetNode;
45 QLibrary * TheLibrary;
46 long NodeCountInLib;
47} NetNode_t;
48typedef QDict<NetNode_t> Name2NetNode_t;
49
50#else
51
52typedef QDict<ANetNode> Name2NetNode_t; 41typedef QDict<ANetNode> Name2NetNode_t;
53
54#endif
55
56typedef QDict<ANetNodeInstance > Name2Instance_t; 42typedef QDict<ANetNodeInstance > Name2Instance_t;
57typedef QDict<NodeCollection> Name2Connection_t; 43typedef QDict<NodeCollection> Name2Connection_t;
58typedef QDict<SystemFile> Name2SystemFile_t; 44typedef QDict<SystemFile> Name2SystemFile_t;
@@ -77,16 +63,9 @@ public :
77 { return AllNodeTypes; } 63 { return AllNodeTypes; }
78 bool netNodeExists( const QString & X ) 64 bool netNodeExists( const QString & X )
79 { return AllNodeTypes.find(X)!=0; } 65 { return AllNodeTypes.find(X)!=0; }
80#ifdef MYPLUGIN
81 ANetNode * findNetNode( const QString & N )
82 { NetNode_t * NNT = AllNodeTypes.find(N);
83 return (NNT) ? NNT->NetNode : 0;
84 }
85#else
86 ANetNode * findNetNode( const QString & N ) 66 ANetNode * findNetNode( const QString & N )
87 { return AllNodeTypes.find(N); 67 { return AllNodeTypes.find(N);
88 } 68 }
89#endif
90 // define new plugin (=node) 69 // define new plugin (=node)
91 void addNodeType( const QString & ID, 70 void addNodeType( const QString & ID,
92 const QString & LongName, 71 const QString & LongName,
@@ -99,21 +78,15 @@ public :
99 bool KDI ); 78 bool KDI );
100 79
101 ANetNodeInstance * createNodeInstance( const QString & S ) 80 ANetNodeInstance * createNodeInstance( const QString & S )
102 { ANetNodeInstance * NNI = 0; 81 { ANetNode * NN = findNetNode( S );
103 printf( "Find node type %s\n", S.latin1() ); 82
104#ifdef MYPLUGIN 83 Log(( "Find node type %s : %p\n", S.latin1(), NN ));
105 NetNode_t * NNT = AllNodeTypes[S]; 84
106 if( ! NNT ) { 85 if( NN == 0 )
107 return 0; 86 // type of this instance not found
108 }
109 NNI = NNT->NetNode->createInstance();
110#else
111 ANetNode * NNT = AllNodeTypes[S];
112 if( ! NNT ) {
113 return 0; 87 return 0;
114 } 88
115 NNI = NNT->createInstance(); 89 ANetNodeInstance * NNI = NN->createInstance();
116#endif
117 NNI->initialize(); 90 NNI->initialize();
118 return NNI; 91 return NNI;
119 } 92 }
@@ -130,12 +103,14 @@ public :
130 const QString & netNode2Name( const char * Type ); 103 const QString & netNode2Name( const char * Type );
131 const QString & netNode2Description( const char * Type ); 104 const QString & netNode2Description( const char * Type );
132 105
133 void addConnection( NodeCollection * NC ); 106 void addConnection( NodeCollection * NC, bool Dangling );
134 void removeConnection( const QString & N ); 107 void removeConnection( const QString & N );
135 NodeCollection * findConnection( const QString & N ); 108 NodeCollection * findConnection( const QString & N );
136 NodeCollection * getConnection( int nr ); 109 NodeCollection * getConnection( int nr );
137 Name2Connection_t & connections( void ) 110 Name2Connection_t & connections( void )
138 { return ConnectionsMap; } 111 { return ConnectionsMap; }
112 Name2Connection_t & danglingConnections( void )
113 { return ConnectionsMap; }
139 114
140 inline bool userKnown( void ) 115 inline bool userKnown( void )
141 { return CurrentUser.known(); } 116 { return CurrentUser.known(); }
@@ -147,18 +122,15 @@ private :
147 void detectCurrentUser( void ); 122 void detectCurrentUser( void );
148 QString tr( const char * path ); 123 QString tr( const char * path );
149 124
150#ifdef MYPLUGIN
151 void findAvailableNetNodes( const QString &path );
152 bool loadNetNode(
153 const QString &pluginFileName,
154 const QString &resolveString = "create_plugin");
155#else
156 void findAvailableNetNodes( void ); 125 void findAvailableNetNodes( void );
157#endif
158 126
159 QMap< QString, QString> NodeTypeNameMap; 127 QMap< QString, QString> NodeTypeNameMap;
160 QMap< QString, QString> NodeTypeDescriptionMap; 128 QMap< QString, QString> NodeTypeDescriptionMap;
129 // list of connections that are valid
161 Name2Connection_t ConnectionsMap; 130 Name2Connection_t ConnectionsMap;
131 // list of connection configurations that are not valid
132 // e.g. because plugins are missing
133 Name2Connection_t DanglingConnectionsMap;
162 System * TheSystem; 134 System * TheSystem;
163 Name2SystemFile_t SystemFiles; 135 Name2SystemFile_t SystemFiles;
164 136
@@ -170,10 +142,8 @@ private :
170 142
171 CurrentQPEUser CurrentUser; 143 CurrentQPEUser CurrentUser;
172 144
173#ifndef MYPLUGIN
174 Opie::Core::OPluginLoader * Plugins; 145 Opie::Core::OPluginLoader * Plugins;
175 Opie::Core::OPluginManager * PluginManager; 146 Opie::Core::OPluginManager * PluginManager;
176#endif
177 147
178}; 148};
179 149