Nim: De-Q_OBJECT-ify NimCompilerCleanStep

Change-Id: I3fce6484b90ac540009d0e5501a4435d15f241b6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-02-20 17:53:17 +01:00
parent 62aed34077
commit 8b563a63d4
2 changed files with 23 additions and 30 deletions

View File

@@ -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<NimBuildConfiguration*>(buildConfiguration());

View File

@@ -26,30 +26,10 @@
#pragma once
#include <projectexplorer/buildstep.h>
#include <projectexplorer/buildsteplist.h>
#include <utils/fileutils.h>
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();