diff --git a/src/plugins/nim/project/nimcompilercleanstep.cpp b/src/plugins/nim/project/nimcompilercleanstep.cpp index d0e264da161..3fce967a34a 100644 --- a/src/plugins/nim/project/nimcompilercleanstep.cpp +++ b/src/plugins/nim/project/nimcompilercleanstep.cpp @@ -40,6 +40,24 @@ using namespace Utils; namespace Nim { +class NimCompilerCleanStep final : public BuildStep +{ + Q_DECLARE_TR_FUNCTIONS(Nim::NimCompilerCleanStep) + +public: + NimCompilerCleanStep(BuildStepList *parentList, Core::Id id); + +private: + bool init() final; + void doRun() final; + void doCancel() final {} // Can be left empty. The run() function hardly does anything. + + bool removeCacheDirectory(); + bool removeOutFilePath(); + + Utils::FilePath m_buildDir; +}; + NimCompilerCleanStep::NimCompilerCleanStep(BuildStepList *parentList, Core::Id id) : BuildStep(parentList, id) { @@ -68,32 +86,27 @@ bool NimCompilerCleanStep::init() void NimCompilerCleanStep::doRun() { if (!m_buildDir.exists()) { - emit addOutput(tr("Build directory \"%1\" does not exist.").arg(m_buildDir.toUserOutput()), BuildStep::OutputFormat::ErrorMessage); + emit addOutput(tr("Build directory \"%1\" does not exist.").arg(m_buildDir.toUserOutput()), OutputFormat::ErrorMessage); emit finished(false); return; } if (!removeCacheDirectory()) { - emit addOutput(tr("Failed to delete the cache directory."), BuildStep::OutputFormat::ErrorMessage); + emit addOutput(tr("Failed to delete the cache directory."), OutputFormat::ErrorMessage); emit finished(false); return; } if (!removeOutFilePath()) { - emit addOutput(tr("Failed to delete the out file."), BuildStep::OutputFormat::ErrorMessage); + emit addOutput(tr("Failed to delete the out file."), OutputFormat::ErrorMessage); emit finished(false); return; } - emit addOutput(tr("Clean step completed successfully."), BuildStep::OutputFormat::NormalMessage); + emit addOutput(tr("Clean step completed successfully."), OutputFormat::NormalMessage); emit finished(true); } -void NimCompilerCleanStep::doCancel() -{ - // Can be left empty. The run() function hardly does anything. -} - bool NimCompilerCleanStep::removeCacheDirectory() { auto bc = qobject_cast(buildConfiguration()); diff --git a/src/plugins/nim/project/nimcompilercleanstep.h b/src/plugins/nim/project/nimcompilercleanstep.h index 483d627b9eb..4086cf72751 100644 --- a/src/plugins/nim/project/nimcompilercleanstep.h +++ b/src/plugins/nim/project/nimcompilercleanstep.h @@ -26,30 +26,10 @@ #pragma once #include -#include -#include namespace Nim { -class NimCompilerCleanStep : public ProjectExplorer::BuildStep -{ - Q_OBJECT - -public: - NimCompilerCleanStep(ProjectExplorer::BuildStepList *parentList, Core::Id id); - -private: - bool init() override; - void doRun() override; - void doCancel() override; - - bool removeCacheDirectory(); - bool removeOutFilePath(); - - Utils::FilePath m_buildDir; -}; - -class NimCompilerCleanStepFactory : public ProjectExplorer::BuildStepFactory +class NimCompilerCleanStepFactory final : public ProjectExplorer::BuildStepFactory { public: NimCompilerCleanStepFactory();