diff --git a/src/plugins/haskell/haskellplugin.cpp b/src/plugins/haskell/haskellplugin.cpp index f1285340ac9..6da003c1a50 100644 --- a/src/plugins/haskell/haskellplugin.cpp +++ b/src/plugins/haskell/haskellplugin.cpp @@ -26,13 +26,6 @@ namespace Haskell::Internal { -class HaskellPluginPrivate -{ -public: - HaskellRunConfigurationFactory runConfigFactory; - ProjectExplorer::SimpleTargetRunnerFactory runWorkerFactory{{Constants::C_HASKELL_RUNCONFIG_ID}}; -}; - static void registerGhciAction(QObject *guard) { QAction *action = new QAction(Tr::tr("Run GHCi"), guard); @@ -49,15 +42,13 @@ class HaskellPlugin final : public ExtensionSystem::IPlugin Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Haskell.json") public: - ~HaskellPlugin() final { delete d; } - -private: void initialize() final { - d = new HaskellPluginPrivate; - setupHaskellStackBuildStep(); setupHaskellBuildConfiguration(); + + setupHaskellRunSupport(); + setupHaskellEditor(); ProjectExplorer::ProjectManager::registerProjectType( @@ -69,8 +60,6 @@ private: ProjectExplorer::JsonWizardFactory::addWizardPath(":/haskell/share/wizards/"); } - - HaskellPluginPrivate *d = nullptr; }; } // Haskell::Internal diff --git a/src/plugins/haskell/haskellrunconfiguration.cpp b/src/plugins/haskell/haskellrunconfiguration.cpp index 0381f86784a..5c2162757b2 100644 --- a/src/plugins/haskell/haskellrunconfiguration.cpp +++ b/src/plugins/haskell/haskellrunconfiguration.cpp @@ -11,7 +11,9 @@ #include #include #include +#include #include +#include #include #include @@ -21,7 +23,7 @@ using namespace Utils; namespace Haskell::Internal { -class HaskellRunConfiguration : public RunConfiguration +class HaskellRunConfiguration final : public RunConfiguration { public: HaskellRunConfiguration(Target *target, Id id) @@ -46,7 +48,7 @@ public: } private: - Utils::ProcessRunData runnable() const final + ProcessRunData runnable() const final { const FilePath projectDirectory = project()->projectDirectory(); ProcessRunData r; @@ -75,11 +77,21 @@ private: // Factory -HaskellRunConfigurationFactory::HaskellRunConfigurationFactory() +class HaskellRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory { - registerRunConfiguration(Constants::C_HASKELL_RUNCONFIG_ID); - addSupportedProjectType(Constants::C_HASKELL_PROJECT_ID); - addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); +public: + HaskellRunConfigurationFactory() + { + registerRunConfiguration(Constants::C_HASKELL_RUNCONFIG_ID); + addSupportedProjectType(Constants::C_HASKELL_PROJECT_ID); + addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); + } +}; + +void setupHaskellRunSupport() +{ + static HaskellRunConfigurationFactory runConfigFactory; + static SimpleTargetRunnerFactory runWorkerFactory{{Constants::C_HASKELL_RUNCONFIG_ID}}; } } // Haskell::Internal diff --git a/src/plugins/haskell/haskellrunconfiguration.h b/src/plugins/haskell/haskellrunconfiguration.h index 579f8110a75..a979b1813e0 100644 --- a/src/plugins/haskell/haskellrunconfiguration.h +++ b/src/plugins/haskell/haskellrunconfiguration.h @@ -3,14 +3,8 @@ #pragma once -#include - namespace Haskell::Internal { -class HaskellRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory -{ -public: - HaskellRunConfigurationFactory(); -}; +void setupHaskellRunSupport(); } // Haskell::Internal