Meson: Use setup function for MesonActionsManager

Remove the now-empty MesonProjectPluginPrivate.

Change-Id: I58d9d9338a2ad96d574daa407e35cf8f26843719
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-01-29 16:44:21 +01:00
parent 8b78eb2d22
commit 0e531fa453
3 changed files with 29 additions and 46 deletions

View File

@@ -17,8 +17,24 @@
#include <utils/action.h> #include <utils/action.h>
namespace MesonProjectManager { namespace MesonProjectManager::Internal {
namespace 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() MesonActionsManager::MesonActionsManager()
: configureActionMenu(Tr::tr("Configure")) : configureActionMenu(Tr::tr("Configure"))
@@ -93,5 +109,9 @@ void MesonActionsManager::updateContextActions()
buildTargetContextAction.setVisible(targetNode); buildTargetContextAction.setVisible(targetNode);
} }
} // namespace Internal void setupMesonActions()
} // namespace MesonProjectManager {
static MesonActionsManager theMesonActionsManager;
}
} // MesonProjectManager::Internal

View File

@@ -3,29 +3,8 @@
#pragma once #pragma once
#include <utils/action.h> namespace MesonProjectManager::Internal {
#include <QCoreApplication> void setupMesonActions();
namespace MesonProjectManager { } // Internal::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

View File

@@ -12,7 +12,6 @@
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectmanager.h> #include <projectexplorer/projectmanager.h>
#include <utils/fsengine/fileiconprovider.h> #include <utils/fsengine/fileiconprovider.h>
@@ -22,28 +21,13 @@ using namespace Utils;
namespace MesonProjectManager::Internal { namespace MesonProjectManager::Internal {
class MesonProjectPluginPrivate
{
public:
MesonActionsManager m_actions;
};
class MesonProjectPlugin final : public ExtensionSystem::IPlugin class MesonProjectPlugin final : public ExtensionSystem::IPlugin
{ {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "MesonProjectManager.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "MesonProjectManager.json")
public:
~MesonProjectPlugin() final
{
delete d;
}
private:
void initialize() final void initialize() final
{ {
d = new MesonProjectPluginPrivate;
setupToolsSettingsPage(); setupToolsSettingsPage();
setupToolsSettingsAccessor(); setupToolsSettingsAccessor();
@@ -54,13 +38,13 @@ private:
setupMesonRunConfiguration(); setupMesonRunConfiguration();
setupMesonRunAndDebugWorkers(); setupMesonRunAndDebugWorkers();
setupMesonActions();
ProjectManager::registerProjectType<MesonProject>(Constants::Project::MIMETYPE); ProjectManager::registerProjectType<MesonProject>(Constants::Project::MIMETYPE);
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson.build"); FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson.build");
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson_options.txt"); FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson_options.txt");
} }
class MesonProjectPluginPrivate *d = nullptr;
}; };
} // MesonProjectManager::Internal } // MesonProjectManager::Internal