EditorFrame::EditorFrame(const wxString& title) : wxFrame(nullptr, wxID_ANY, title) , paneCtrl(nullptr) , toolbarCtrl(nullptr) , statusCtrl(nullptr) , notebookCtrl(nullptr) , eventManager(nullptr) , pluginManager(nullptr) , documentManager(nullptr) , engine(nullptr) , archive(nullptr) , input(nullptr) { gs_EditorInstance = this; CoreInitialize(); #ifdef EDITOR_OLD_UI documentManager = AllocateThis(DocumentManager); documentManager->onDocumentAdded.Connect(this, &EditorFrame::onDocumentAdded); documentManager->onDocumentRemoved.Connect(this, &EditorFrame::onDocumentRemoved); documentManager->onDocumentRenamed.Connect(this, &EditorFrame::onDocumentRenamed); #endif createPlugins(); #ifdef EDITOR_OLD_UI createUI(); #endif createEngine(); eventManager = AllocateThis(EventManager); #ifdef ENABLE_PLUGIN_MONO Plugin* monoPlugin = pluginManager->getPluginFromClass( ReflectionGetType(MonoPlugin) ); pluginManager->enablePlugin(monoPlugin); #endif #ifdef EDITOR_OLD_UI enablePlugins(); createToolbar(); createLastUI(); #endif Bind(wxEVT_IDLE, &EditorFrame::OnIdle, this); Bind(wxEVT_CLOSE_WINDOW, &EditorFrame::OnClose, this); auto projectPlugin = GetPlugin<ProjectPlugin>(); projectPlugin->createDocument(); }
int run(int /*argc*/, char** argv) { std::string pluginPath(argv[1]); std::deque<MyPlugin> plugins; std::unique_ptr<load_plugins::PluginServiceInterface> service(new load_plugins::ConcreteService()); MyPluginFactory factory(pluginPath, *service); factory.load(); auto availablePlugins = factory.availablePlugins(); printPluginNames(availablePlugins); createPlugins(factory, availablePlugins, plugins); callPlugins(plugins); service->report(); return 0; }
void Configurator::loadItem( QListWidgetItem* item ) { if( 0 == item ) return; // searching corresponding section QString sectionName = item->listWidget()->objectName(); QDomNode configurator = _domDocument.documentElement(); QDomNode section = configurator.firstChild(); while( false == section.isNull() ) { QDomNamedNodeMap sectionAttributes = section.attributes(); if( sectionName == sectionAttributes.namedItem(c_attributeName).nodeValue() ) break; section = section.nextSibling(); } // having section, searching for the sectionItem QString sectionItemName = item->data( Qt::UserRole ).toString(); QDomNode sectionItem = section.firstChild(); while( false == sectionItem.isNull() ) { QDomNamedNodeMap sectionItemAttributes = sectionItem.attributes(); if( QDomNode::CommentNode != section.nodeType() ) if( sectionItemName == sectionItemAttributes.namedItem(c_attributeName).nodeValue() ) break; sectionItem = sectionItem.nextSibling(); } // destroying all previous controls from the frame QObjectList children = _configOptions->children(); foreach( QObject* child, children ) delete child; // vertical-layout all the frame's objects QVBoxLayout* verticalLayout = new QVBoxLayout( _configOptions ); // at this step we have everything to start load data from DOM QDomNode control = sectionItem.firstChild(); while( false == control.isNull() ) { // note: not all the nodes met will have these attributes, speciffic nodes will have some of these QDomNamedNodeMap controlAttributes = control.attributes(); QString controlName = controlAttributes.namedItem( c_attributeName ).nodeValue(); QString controlText = controlAttributes.namedItem( c_attributeText ).nodeValue(); QString controlType = controlAttributes.namedItem( c_attributeType ).nodeValue(); QString controlValue = controlAttributes.namedItem( c_attributeValue ).nodeValue(); switch( getControlTypeByName(controlType) ) { case eFontChooser : verticalLayout->addWidget( createFontChooser(controlName,controlText,controlValue) ); break; case eColorChooser : verticalLayout->addWidget( createColorChooser(controlName,controlText,controlValue) ); break; case ePathChooser : verticalLayout->addWidget( createPathChooser(controlName,controlText,controlValue) ); break; case eRadioBoxes : verticalLayout->addWidget( createRadioBoxes(controlName,controlText,controlValue,control.firstChild()) ); break; case eCheckBoxes : verticalLayout->addWidget( createCheckBoxes(controlName,controlText,controlValue,control.firstChild()) ); break; case eTextViewer : verticalLayout->addWidget( createTextViewer(controlName,control) ); break; case eLineInput : verticalLayout->addWidget( createLineInput(controlName,controlText,controlValue) ); break; case ePlugins : verticalLayout->addWidget( createPlugins(controlName,controlValue) ); break; default: break; } control = control.nextSibling(); } }
QList<NetworkPlugin *> PluginManager::createNetworkPlugins() const { return createPlugins( d, d->m_networkPluginTemplates ); }
QList<RenderPlugin *> PluginManager::createRenderPlugins() const { return createPlugins( d, d->m_renderPluginTemplates ); }
QList<PositionProviderPlugin *> PluginManager::createPositionProviderPlugins() const { return createPlugins( d, d->m_positionProviderPluginTemplates ); }