| 91 | } |
| 92 | |
| 93 | void Module::registerDynamicComponents() |
| 94 | { |
| 95 | qDebug() << "Module::registerDynamicComponents()"; |
| 96 | |
| 97 | |
| 98 | // vaComponents is populated in QucsApp::slotLoadModule |
| 99 | |
| 100 | // register modules symbol and properties out of in vaComponents |
| 101 | QMapIterator<QString, QString> i(vaComponents); |
| 102 | while (i.hasNext()) { |
| 103 | i.next(); |
| 104 | |
| 105 | // qDebug() << i.key() << ": " << i.value() << endl; |
| 106 | |
| 107 | Module * m = new Module (); |
| 108 | |
| 109 | // what now? pointer to info? |
| 110 | |
| 111 | // the typedef needs to be different |
| 112 | //passes the pointer, but it has no idea how to call the JSON |
| 113 | m->infoVA = &vacomponent::info; |
| 114 | |
| 115 | // TODO maybe allow user load into custom category? |
| 116 | m->category = QObject::tr("verilog-a user devices"); |
| 117 | |
| 118 | // instantiation of the component once in order |
| 119 | // to obtain "Model" property of the component |
| 120 | //QString Name, Model; |
| 121 | //char * File; |
| 122 | QString Name, Model, vaBitmap; |
| 123 | // char * File; |
| 124 | Component * c = (Component *) |
| 125 | vacomponent::info (Name, vaBitmap, true, vaComponents[i.key()]); |
| 126 | Model = c->obsolete_model_hack(); |
| 127 | delete c; |
| 128 | |
| 129 | // put into category and the component hash |
| 130 | intoCategory (m); |
| 131 | |
| 132 | if (!Modules.contains (Model)) |
| 133 | Modules.insert (Model, m); |
| 134 | |
| 135 | } // while |
| 136 | } |
| 137 | |
| 138 | // The function appends the given module to the appropriate category. |
| 139 | // If there is no such category yet, then the category gets created. |