diff --git a/src/plugins/haskell/CMakeLists.txt b/src/plugins/haskell/CMakeLists.txt index d45326695cb..6cd82f1109b 100644 --- a/src/plugins/haskell/CMakeLists.txt +++ b/src/plugins/haskell/CMakeLists.txt @@ -9,7 +9,7 @@ add_qtc_plugin(Haskell haskelleditorfactory.cpp haskelleditorfactory.h haskellhighlighter.cpp haskellhighlighter.h haskellmanager.cpp haskellmanager.h - haskellplugin.cpp haskellplugin.h + haskellplugin.cpp haskellproject.cpp haskellproject.h haskellrunconfiguration.cpp haskellrunconfiguration.h haskellsettings.cpp haskellsettings.h diff --git a/src/plugins/haskell/haskell.qbs b/src/plugins/haskell/haskell.qbs index 5c1be115387..d1362f32b11 100644 --- a/src/plugins/haskell/haskell.qbs +++ b/src/plugins/haskell/haskell.qbs @@ -18,7 +18,7 @@ QtcPlugin { "haskell_global.h", "haskellhighlighter.cpp", "haskellhighlighter.h", "haskellmanager.cpp", "haskellmanager.h", - "haskellplugin.cpp", "haskellplugin.h", + "haskellplugin.cpp", "haskellproject.cpp", "haskellproject.h", "haskellrunconfiguration.cpp", "haskellrunconfiguration.h", "haskellsettings.cpp", "haskellsettings.h", diff --git a/src/plugins/haskell/haskellplugin.cpp b/src/plugins/haskell/haskellplugin.cpp index 9c082c67a9e..80039b96b21 100644 --- a/src/plugins/haskell/haskellplugin.cpp +++ b/src/plugins/haskell/haskellplugin.cpp @@ -1,8 +1,6 @@ // Copyright (c) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#include "haskellplugin.h" - #include "haskellbuildconfiguration.h" #include "haskellconstants.h" #include "haskelleditorfactory.h" @@ -16,6 +14,8 @@ #include #include +#include + #include #include #include @@ -24,8 +24,7 @@ #include -namespace Haskell { -namespace Internal { +namespace Haskell::Internal { class HaskellPluginPrivate { @@ -37,11 +36,6 @@ public: ProjectExplorer::SimpleTargetRunnerFactory runWorkerFactory{{Constants::C_HASKELL_RUNCONFIG_ID}}; }; -HaskellPlugin::~HaskellPlugin() -{ - delete d; -} - static void registerGhciAction(QObject *guard) { QAction *action = new QAction(Tr::tr("Run GHCi"), guard); @@ -52,23 +46,32 @@ static void registerGhciAction(QObject *guard) }); } -bool HaskellPlugin::initialize(const QStringList &arguments, QString *errorString) +class HaskellPlugin final : public ExtensionSystem::IPlugin { - Q_UNUSED(arguments) - Q_UNUSED(errorString) + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Haskell.json") - d = new HaskellPluginPrivate; +public: + ~HaskellPlugin() final { delete d; } - ProjectExplorer::ProjectManager::registerProjectType( - Constants::C_HASKELL_PROJECT_MIMETYPE); - TextEditor::SnippetProvider::registerGroup(Constants::C_HASKELLSNIPPETSGROUP_ID, - Tr::tr("Haskell", "SnippetProvider")); +private: + void initialize() final + { + d = new HaskellPluginPrivate; - registerGhciAction(this); + ProjectExplorer::ProjectManager::registerProjectType( + Constants::C_HASKELL_PROJECT_MIMETYPE); + TextEditor::SnippetProvider::registerGroup(Constants::C_HASKELLSNIPPETSGROUP_ID, + Tr::tr("Haskell", "SnippetProvider")); - ProjectExplorer::JsonWizardFactory::addWizardPath(":/haskell/share/wizards/"); - return true; -} + registerGhciAction(this); -} // namespace Internal -} // namespace Haskell + ProjectExplorer::JsonWizardFactory::addWizardPath(":/haskell/share/wizards/"); + } + + HaskellPluginPrivate *d = nullptr; +}; + +} // Haskell::Internal + +#include "haskellplugin.moc" diff --git a/src/plugins/haskell/haskellplugin.h b/src/plugins/haskell/haskellplugin.h deleted file mode 100644 index acae0d2001a..00000000000 --- a/src/plugins/haskell/haskellplugin.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2017 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include "haskell_global.h" - -#include - -namespace Haskell { -namespace Internal { - -class HaskellPlugin : public ExtensionSystem::IPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Haskell.json") - -public: - HaskellPlugin() = default; - ~HaskellPlugin() final; - -private: - bool initialize(const QStringList &arguments, QString *errorString) final; - void extensionsInitialized() final {} - - class HaskellPluginPrivate *d = nullptr; -}; - -} // namespace Internal -} // namespace Haskell