diff options
author | hjk <hjk@qt.io> | 2024-01-29 13:59:10 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2024-04-25 06:50:05 +0000 |
commit | 06cfa02c2d332d76789107f81638405356872b9e (patch) | |
tree | 60f25e4972879c1c554541daa273099abfbbb885 /src | |
parent | 3fc55514653d4ade32d3cce3afb2848109f840a3 (diff) |
CompilerExplorer: Use new MenuBuilder
Change-Id: Iafd26b625493aecd5fa750ac8fcb3da950bda1d8
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/compilerexplorer/compilerexplorerplugin.cpp | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/plugins/compilerexplorer/compilerexplorerplugin.cpp b/src/plugins/compilerexplorer/compilerexplorerplugin.cpp index c54c26a600..1cfcec89d8 100644 --- a/src/plugins/compilerexplorer/compilerexplorerplugin.cpp +++ b/src/plugins/compilerexplorer/compilerexplorerplugin.cpp @@ -6,7 +6,6 @@ #include "compilerexplorersettings.h" #include "compilerexplorertr.h" -#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/coreconstants.h> #include <coreplugin/editormanager/editormanager.h> @@ -20,20 +19,18 @@ #include <utils/fsengine/fileiconprovider.h> -#include <QMenu> - using namespace Core; using namespace Utils; namespace CompilerExplorer::Internal { -class CompilerExplorerPlugin : public ExtensionSystem::IPlugin +class CompilerExplorerPlugin final : public ExtensionSystem::IPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CompilerExplorer.json") public: - void initialize() override + void initialize() final { static CompilerExplorer::EditorFactory ceEditorFactory; @@ -43,21 +40,19 @@ public: ProjectExplorer::JsonWizardFactory::addWizardPath(":/compilerexplorer/wizard/"); const Id menuId = "Tools.CompilerExplorer"; - ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS); - ActionContainer *mCompilerExplorer = ActionManager::createMenu(menuId); - QMenu *menu = mCompilerExplorer->menu(); - menu->setTitle(Tr::tr("Compiler Explorer")); - mtools->addMenu(mCompilerExplorer); - - ActionBuilder openAction(this, "CompilerExplorer.CompilerExplorerAction"); - openAction.setText(Tr::tr("Open Compiler Explorer")); - openAction.addToContainer(menuId); - openAction.addOnTriggered(this, [] { - QString name = "Compiler Explorer $"; - Core::EditorManager::openEditorWithContents(Constants::CE_EDITOR_ID, - &name, - settings().defaultDocument().toUtf8()); - }); + MenuBuilder(menuId) + .setTitle(Tr::tr("Compiler Explorer")) + .addToContainer(Core::Constants::M_TOOLS); + + ActionBuilder(this, "CompilerExplorer.CompilerExplorerAction") + .setText(Tr::tr("Open Compiler Explorer")) + .addToContainer(menuId) + .addOnTriggered(this, [] { + QString name = "Compiler Explorer $"; + EditorManager::openEditorWithContents(Constants::CE_EDITOR_ID, + &name, + settings().defaultDocument().toUtf8()); + }); } }; |