Haskell: Move plugin class definition to .cpp

... and simplify setup a bit.

Change-Id: Ic5a36c35c083232cb8df3c7a06aaac46bcef55e0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-11-20 11:48:11 +01:00
parent 18bbffddb4
commit fabef397f9
4 changed files with 28 additions and 55 deletions

View File

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

View File

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

View File

@@ -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 <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <extensionsystem/iplugin.h>
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
#include <projectexplorer/projectmanager.h>
#include <projectexplorer/runcontrol.h>
@@ -24,8 +24,7 @@
#include <QAction>
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,11 +46,17 @@ 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")
public:
~HaskellPlugin() final { delete d; }
private:
void initialize() final
{
d = new HaskellPluginPrivate;
ProjectExplorer::ProjectManager::registerProjectType<HaskellProject>(
@@ -67,8 +67,11 @@ bool HaskellPlugin::initialize(const QStringList &arguments, QString *errorStrin
registerGhciAction(this);
ProjectExplorer::JsonWizardFactory::addWizardPath(":/haskell/share/wizards/");
return true;
}
}
} // namespace Internal
} // namespace Haskell
HaskellPluginPrivate *d = nullptr;
};
} // Haskell::Internal
#include "haskellplugin.moc"

View File

@@ -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 <extensionsystem/iplugin.h>
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