diff options
author | hjk <hjk@qt.io> | 2024-01-29 16:44:21 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2024-01-30 08:33:49 +0000 |
commit | 0e531fa4537cda01423e3dc93baf64ab031191dc (patch) | |
tree | 31a90f69c65be8008b519fd7f2ae060733d7da69 /src/plugins/mesonprojectmanager | |
parent | 8b78eb2d22c08bc32870b841cd53213cb15b8dd7 (diff) |
Meson: Use setup function for MesonActionsManager
Remove the now-empty MesonProjectPluginPrivate.
Change-Id: I58d9d9338a2ad96d574daa407e35cf8f26843719
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/plugins/mesonprojectmanager')
3 files changed, 29 insertions, 46 deletions
diff --git a/src/plugins/mesonprojectmanager/mesonactionsmanager.cpp b/src/plugins/mesonprojectmanager/mesonactionsmanager.cpp index 221199470ee..5d04cddfcb2 100644 --- a/src/plugins/mesonprojectmanager/mesonactionsmanager.cpp +++ b/src/plugins/mesonprojectmanager/mesonactionsmanager.cpp @@ -17,8 +17,24 @@ #include <utils/action.h> -namespace MesonProjectManager { -namespace Internal { +namespace MesonProjectManager::Internal { + +class MesonActionsManager : public QObject +{ +public: + MesonActionsManager(); + + Utils::Action buildTargetContextAction{ + Tr::tr("Build"), + Tr::tr("Build \"%1\""), + Utils::Action::AlwaysEnabled /*handled manually*/ + }; + QAction configureActionMenu; + QAction configureActionContextMenu; + + void configureCurrentProject(); + void updateContextActions(); +}; MesonActionsManager::MesonActionsManager() : configureActionMenu(Tr::tr("Configure")) @@ -93,5 +109,9 @@ void MesonActionsManager::updateContextActions() buildTargetContextAction.setVisible(targetNode); } -} // namespace Internal -} // namespace MesonProjectManager +void setupMesonActions() +{ + static MesonActionsManager theMesonActionsManager; +} + +} // MesonProjectManager::Internal diff --git a/src/plugins/mesonprojectmanager/mesonactionsmanager.h b/src/plugins/mesonprojectmanager/mesonactionsmanager.h index 81c3df9fbb5..25842ee19e8 100644 --- a/src/plugins/mesonprojectmanager/mesonactionsmanager.h +++ b/src/plugins/mesonprojectmanager/mesonactionsmanager.h @@ -3,29 +3,8 @@ #pragma once -#include <utils/action.h> +namespace MesonProjectManager::Internal { -#include <QCoreApplication> +void setupMesonActions(); -namespace MesonProjectManager { -namespace Internal { - -class MesonActionsManager : public QObject -{ - Q_OBJECT - Utils::Action buildTargetContextAction{ - QCoreApplication::translate("QtC::MesonProjectManager", "Build"), - QCoreApplication::translate("QtC::MesonProjectManager", "Build \"%1\""), - Utils::Action::AlwaysEnabled /*handled manually*/ - }; - QAction configureActionMenu; - QAction configureActionContextMenu; - void configureCurrentProject(); - void updateContextActions(); - -public: - MesonActionsManager(); -}; - -} // namespace Internal -} // namespace MesonProjectManager +} // Internal::MesonProjectManager diff --git a/src/plugins/mesonprojectmanager/mesonprojectplugin.cpp b/src/plugins/mesonprojectmanager/mesonprojectplugin.cpp index 423a38eddb3..7c33685b609 100644 --- a/src/plugins/mesonprojectmanager/mesonprojectplugin.cpp +++ b/src/plugins/mesonprojectmanager/mesonprojectplugin.cpp @@ -12,7 +12,6 @@ #include <extensionsystem/iplugin.h> -#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectmanager.h> #include <utils/fsengine/fileiconprovider.h> @@ -22,28 +21,13 @@ using namespace Utils; namespace MesonProjectManager::Internal { -class MesonProjectPluginPrivate -{ -public: - MesonActionsManager m_actions; -}; - class MesonProjectPlugin final : public ExtensionSystem::IPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "MesonProjectManager.json") -public: - ~MesonProjectPlugin() final - { - delete d; - } - -private: void initialize() final { - d = new MesonProjectPluginPrivate; - setupToolsSettingsPage(); setupToolsSettingsAccessor(); @@ -54,13 +38,13 @@ private: setupMesonRunConfiguration(); setupMesonRunAndDebugWorkers(); + setupMesonActions(); + ProjectManager::registerProjectType<MesonProject>(Constants::Project::MIMETYPE); FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson.build"); FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson_options.txt"); } - - class MesonProjectPluginPrivate *d = nullptr; }; } // MesonProjectManager::Internal |