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>
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

View File

@@ -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

View File

@@ -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