Nim: Simplify NimCleanStep

Change-Id: I76213999b394fb18e228cf3c4d24a47c26afb398
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-06-25 12:29:12 +02:00
parent 1f0a4c0152
commit 7dc1b39a61
9 changed files with 10 additions and 167 deletions

View File

@@ -12,7 +12,6 @@ add_qtc_plugin(Nim
project/nimcompilerbuildstep.cpp project/nimcompilerbuildstep.h project/nimcompilerbuildstep.cpp project/nimcompilerbuildstep.h
project/nimcompilerbuildstepconfigwidget.cpp project/nimcompilerbuildstepconfigwidget.h project/nimcompilerbuildstepconfigwidget.ui project/nimcompilerbuildstepconfigwidget.cpp project/nimcompilerbuildstepconfigwidget.h project/nimcompilerbuildstepconfigwidget.ui
project/nimcompilercleanstep.cpp project/nimcompilercleanstep.h project/nimcompilercleanstep.cpp project/nimcompilercleanstep.h
project/nimcompilercleanstepconfigwidget.cpp project/nimcompilercleanstepconfigwidget.h project/nimcompilercleanstepconfigwidget.ui
project/nimproject.cpp project/nimproject.h project/nimproject.cpp project/nimproject.h
project/nimprojectnode.cpp project/nimprojectnode.h project/nimprojectnode.cpp project/nimprojectnode.h
project/nimrunconfiguration.cpp project/nimrunconfiguration.h project/nimrunconfiguration.cpp project/nimrunconfiguration.h

View File

@@ -22,7 +22,6 @@ HEADERS += \
project/nimcompilerbuildstep.h \ project/nimcompilerbuildstep.h \
project/nimcompilerbuildstepconfigwidget.h \ project/nimcompilerbuildstepconfigwidget.h \
project/nimcompilercleanstep.h \ project/nimcompilercleanstep.h \
project/nimcompilercleanstepconfigwidget.h \
project/nimrunconfiguration.h \ project/nimrunconfiguration.h \
editor/nimeditorfactory.h \ editor/nimeditorfactory.h \
settings/nimcodestylesettingspage.h \ settings/nimcodestylesettingspage.h \
@@ -52,7 +51,6 @@ SOURCES += \
project/nimcompilerbuildstep.cpp \ project/nimcompilerbuildstep.cpp \
project/nimcompilerbuildstepconfigwidget.cpp \ project/nimcompilerbuildstepconfigwidget.cpp \
project/nimcompilercleanstep.cpp \ project/nimcompilercleanstep.cpp \
project/nimcompilercleanstepconfigwidget.cpp \
project/nimrunconfiguration.cpp \ project/nimrunconfiguration.cpp \
editor/nimeditorfactory.cpp \ editor/nimeditorfactory.cpp \
settings/nimcodestylesettingspage.cpp \ settings/nimcodestylesettingspage.cpp \
@@ -70,6 +68,5 @@ SOURCES += \
FORMS += \ FORMS += \
project/nimcompilerbuildstepconfigwidget.ui \ project/nimcompilerbuildstepconfigwidget.ui \
project/nimcompilercleanstepconfigwidget.ui \
settings/nimcodestylepreferenceswidget.ui \ settings/nimcodestylepreferenceswidget.ui \
settings/nimtoolssettingswidget.ui settings/nimtoolssettingswidget.ui

View File

@@ -40,7 +40,6 @@ QtcPlugin {
"nimcompilerbuildstep.h", "nimcompilerbuildstep.cpp", "nimcompilerbuildstep.h", "nimcompilerbuildstep.cpp",
"nimcompilerbuildstepconfigwidget.h", "nimcompilerbuildstepconfigwidget.cpp", "nimcompilerbuildstepconfigwidget.ui", "nimcompilerbuildstepconfigwidget.h", "nimcompilerbuildstepconfigwidget.cpp", "nimcompilerbuildstepconfigwidget.ui",
"nimcompilercleanstep.h", "nimcompilercleanstep.cpp", "nimcompilercleanstep.h", "nimcompilercleanstep.cpp",
"nimcompilercleanstepconfigwidget.h", "nimcompilercleanstepconfigwidget.cpp", "nimcompilercleanstepconfigwidget.ui",
"nimproject.h", "nimproject.cpp", "nimproject.h", "nimproject.cpp",
"nimprojectnode.h", "nimprojectnode.cpp", "nimprojectnode.h", "nimprojectnode.cpp",
"nimrunconfiguration.h", "nimrunconfiguration.cpp", "nimrunconfiguration.h", "nimrunconfiguration.cpp",

View File

@@ -58,11 +58,6 @@ const char C_NIMCOMPILERBUILDSTEPWIDGET_SUMMARY[] = QT_TRANSLATE_NOOP("NimCompil
// NimCompilerCleanStep // NimCompilerCleanStep
const char C_NIMCOMPILERCLEANSTEP_ID[] = "Nim.NimCompilerCleanStep"; const char C_NIMCOMPILERCLEANSTEP_ID[] = "Nim.NimCompilerCleanStep";
const char C_NIMCOMPILERCLEANSTEP_DISPLAY[] = QT_TRANSLATE_NOOP("NimCompilerCleanStepFactory", "Nim Compiler Clean Step");
// NimCompilerCleanStepWidget
const char C_NIMCOMPILERCLEANSTEPWIDGET_DISPLAY[] = QT_TRANSLATE_NOOP("NimCompilerCleanStepWidget", "Nim clean step");
const char C_NIMCOMPILERCLEANSTEPWIDGET_SUMMARY[] = QT_TRANSLATE_NOOP("NimCompilerCleanStepWidget", "Nim clean step");
const char C_NIMLANGUAGE_ID[] = "Nim"; const char C_NIMLANGUAGE_ID[] = "Nim";
const char C_NIMCODESTYLESETTINGSPAGE_ID[] = "Nim.NimCodeStyleSettings"; const char C_NIMCODESTYLESETTINGSPAGE_ID[] = "Nim.NimCodeStyleSettings";

View File

@@ -25,10 +25,10 @@
#include "nimcompilercleanstep.h" #include "nimcompilercleanstep.h"
#include "nimbuildconfiguration.h" #include "nimbuildconfiguration.h"
#include "nimcompilercleanstepconfigwidget.h"
#include "../nimconstants.h" #include "../nimconstants.h"
#include <projectexplorer/projectconfigurationaspects.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -45,11 +45,15 @@ NimCompilerCleanStep::NimCompilerCleanStep(BuildStepList *parentList)
{ {
setDefaultDisplayName(tr("Nim Clean Step")); setDefaultDisplayName(tr("Nim Clean Step"));
setDisplayName(tr("Nim Clean Step")); setDisplayName(tr("Nim Clean Step"));
}
BuildStepConfigWidget *NimCompilerCleanStep::createConfigWidget() auto workingDirectory = addAspect<BaseStringAspect>();
{ workingDirectory->setLabelText(tr("Working directory:"));
return new NimCompilerCleanStepConfigWidget(this); workingDirectory->setDisplayStyle(BaseStringAspect::LineEditDisplay);
setSummaryUpdater([this, workingDirectory] {
workingDirectory->setFileName(buildConfiguration()->buildDirectory());
return displayName();
});
} }
bool NimCompilerCleanStep::init() bool NimCompilerCleanStep::init()
@@ -122,7 +126,7 @@ NimCompilerCleanStepFactory::NimCompilerCleanStepFactory()
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
setSupportedConfiguration(Constants::C_NIMBUILDCONFIGURATION_ID); setSupportedConfiguration(Constants::C_NIMBUILDCONFIGURATION_ID);
setRepeatable(false); setRepeatable(false);
setDisplayName(NimCompilerCleanStep::tr(Nim::Constants::C_NIMCOMPILERCLEANSTEP_DISPLAY)); setDisplayName(NimCompilerCleanStep::tr("Nim Compiler Clean Step"));
} }
} // Nim } // Nim

View File

@@ -38,8 +38,6 @@ class NimCompilerCleanStep : public ProjectExplorer::BuildStep
public: public:
NimCompilerCleanStep(ProjectExplorer::BuildStepList *parentList); NimCompilerCleanStep(ProjectExplorer::BuildStepList *parentList);
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
private: private:
bool init() override; bool init() override;
void doRun() override; void doRun() override;

View File

@@ -1,59 +0,0 @@
/****************************************************************************
**
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "nimcompilercleanstepconfigwidget.h"
#include "ui_nimcompilercleanstepconfigwidget.h"
#include "nimcompilercleanstep.h"
#include "../nimconstants.h"
#include "projectexplorer/buildconfiguration.h"
using namespace ProjectExplorer;
namespace Nim {
NimCompilerCleanStepConfigWidget::NimCompilerCleanStepConfigWidget(NimCompilerCleanStep *cleanStep)
: BuildStepConfigWidget(cleanStep)
, m_ui(new Ui::NimCompilerCleanStepConfigWidget())
{
m_ui->setupUi(this);
setDisplayName(tr(Constants::C_NIMCOMPILERCLEANSTEPWIDGET_DISPLAY));
setSummaryText(tr(Constants::C_NIMCOMPILERCLEANSTEPWIDGET_SUMMARY));
connect(cleanStep->buildConfiguration(), &BuildConfiguration::buildDirectoryChanged,
this, &NimCompilerCleanStepConfigWidget::updateUi);
updateUi();
}
NimCompilerCleanStepConfigWidget::~NimCompilerCleanStepConfigWidget() = default;
void NimCompilerCleanStepConfigWidget::updateUi()
{
auto buildDiretory = step()->buildConfiguration()->buildDirectory();
m_ui->workingDirectoryLineEdit->setText(buildDiretory.toString());
}
}

View File

@@ -1,51 +0,0 @@
/****************************************************************************
**
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <projectexplorer/buildstep.h>
namespace Nim {
class NimCompilerCleanStep;
namespace Ui { class NimCompilerCleanStepConfigWidget; }
class NimCompilerCleanStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
public:
NimCompilerCleanStepConfigWidget(NimCompilerCleanStep *cleanStep);
~NimCompilerCleanStepConfigWidget();
private:
void updateUi();
QScopedPointer<Ui::NimCompilerCleanStepConfigWidget> m_ui;
};
}

View File

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Nim::NimCompilerCleanStepConfigWidget</class>
<widget class="QWidget" name="Nim::NimCompilerCleanStepConfigWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="workingDirectoryLabel">
<property name="text">
<string>Working directory:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="workingDirectoryLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>