| 30 | } |
| 31 | |
| 32 | void PluginManagerModule::initialize(Controller *_uiController) |
| 33 | { |
| 34 | AbstractModule::initialize(_uiController); |
| 35 | auto mHelp = ActionManager::instance()->actionContainer(M_HELP); |
| 36 | mHelp->appendGroup("Help.Group.Plugin"); |
| 37 | mHelp->addSeparator("Help.Group.Plugin"); |
| 38 | |
| 39 | QAction *aboutPluginAction = new QAction(MWM_ABOUT_PLUGINS, this); |
| 40 | auto cmd = ActionManager::instance()->registerAction(aboutPluginAction, "Help.AboutPlugins"); |
| 41 | mHelp->addAction(cmd, "Help.Group.Plugin"); |
| 42 | |
| 43 | QAction *navigationItemAction = new QAction(MWMTA_PLUGINS, this); |
| 44 | navigationItemAction->setIcon(QIcon::fromTheme("plugins-navigation")); |
| 45 | auto actionOptionsImpl = new AbstractAction(navigationItemAction, this); |
| 46 | actionOptionsImpl->setShortCutInfo("Tools.Plugins", |
| 47 | MWMTA_PLUGINS); |
| 48 | uiController->addNavigationItem(actionOptionsImpl, Priority::lowest); |
| 49 | |
| 50 | std::function<AbstractWidget *()> detailWidgetCreator = [this]() -> AbstractWidget * { |
| 51 | if (!pluginsUi) { |
| 52 | pluginsUi = new PluginsUi(); |
| 53 | } |
| 54 | return new AbstractWidget(pluginsUi->getPluginDetailView()); |
| 55 | }; |
| 56 | |
| 57 | std::function<AbstractWidget *()> storeWidgetCreator = [this]() -> AbstractWidget * { |
| 58 | if (!pluginsUi) { |
| 59 | pluginsUi = new PluginsUi(); |
| 60 | } |
| 61 | return new AbstractWidget(pluginsUi->getStoreWidget()); |
| 62 | }; |
| 63 | |
| 64 | uiController->registerWidgetCreator("pluginDetail", detailWidgetCreator); |
| 65 | uiController->registerWidgetCreator(MWMTA_PLUGINS, storeWidgetCreator); |
| 66 | |
| 67 | uiController->bindWidgetToNavigation(MWMTA_PLUGINS, actionOptionsImpl); |
| 68 | |
| 69 | QObject::connect(navigationItemAction, &QAction::triggered, this, [this]() { |
| 70 | uiController->showWidgetAtPosition("pluginDetail", Position::Central); |
| 71 | uiController->showWidgetAtPosition(MWMTA_PLUGINS, Position::Left); |
| 72 | auto windowService = dpfGetService(dpfservice::WindowService); |
| 73 | if (windowService) |
| 74 | windowService->setDockHeaderName(MWMTA_PLUGINS, tr("Extensions")); |
| 75 | }); |
| 76 | QObject::connect(aboutPluginAction, &QAction::triggered, this, [this]() { uiController->switchWidgetNavigation(MWMTA_PLUGINS); }); |
| 77 | } |
nothing calls this directly
no test coverage detected