From 632f1024242c043ac6efdb75a515ade79791e748 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 28 Jul 2020 18:49:06 +0200 Subject: [PATCH] IncrediBuild: Rework IBConsoleBuildStep - partially move towards using ProjectConfigurationAspect infrastructure - fix display of default make arguments - code cosmetics Change-Id: I5ce3eb531c65b53d66411e959bcf79408418d5a1 Reviewed-by: Christian Kandeler --- src/plugins/incredibuild/CMakeLists.txt | 5 - .../incredibuild/ibconsolebuildstep.cpp | 310 ++++++++++++++---- src/plugins/incredibuild/ibconsolebuildstep.h | 53 +-- .../incredibuild/ibconsolebuildstep.ui | 156 --------- .../ibconsolestepconfigwidget.cpp | 163 --------- .../incredibuild/ibconsolestepconfigwidget.h | 61 ---- .../incredibuild/ibconsolestepfactory.cpp | 55 ---- .../incredibuild/ibconsolestepfactory.h | 44 --- src/plugins/incredibuild/incredibuild.pro | 9 +- src/plugins/incredibuild/incredibuild.qbs | 5 - src/plugins/incredibuild/incredibuildplugin.h | 2 +- 11 files changed, 252 insertions(+), 611 deletions(-) delete mode 100644 src/plugins/incredibuild/ibconsolebuildstep.ui delete mode 100644 src/plugins/incredibuild/ibconsolestepconfigwidget.cpp delete mode 100644 src/plugins/incredibuild/ibconsolestepconfigwidget.h delete mode 100644 src/plugins/incredibuild/ibconsolestepfactory.cpp delete mode 100644 src/plugins/incredibuild/ibconsolestepfactory.h diff --git a/src/plugins/incredibuild/CMakeLists.txt b/src/plugins/incredibuild/CMakeLists.txt index 16f7773f87f..b0cd2b1b2ca 100644 --- a/src/plugins/incredibuild/CMakeLists.txt +++ b/src/plugins/incredibuild/CMakeLists.txt @@ -15,11 +15,6 @@ add_qtc_plugin(IncrediBuild commandbuilder.h ibconsolebuildstep.cpp ibconsolebuildstep.h - ibconsolebuildstep.ui - ibconsolestepconfigwidget.cpp - ibconsolestepconfigwidget.h - ibconsolestepfactory.cpp - ibconsolestepfactory.h incredibuild_global.h incredibuildconstants.h incredibuildplugin.cpp diff --git a/src/plugins/incredibuild/ibconsolebuildstep.cpp b/src/plugins/incredibuild/ibconsolebuildstep.cpp index 8241b3896be..8cec7b37ade 100644 --- a/src/plugins/incredibuild/ibconsolebuildstep.cpp +++ b/src/plugins/incredibuild/ibconsolebuildstep.cpp @@ -26,20 +26,30 @@ #include "ibconsolebuildstep.h" #include "cmakecommandbuilder.h" -#include "ibconsolestepconfigwidget.h" -#include "incredibuildconstants.h" #include "incredibuildconstants.h" #include "makecommandbuilder.h" -#include "ui_ibconsolebuildstep.h" +#include + +#include #include #include #include #include +#include +#include #include + #include +#include + +#include +#include +#include +#include using namespace ProjectExplorer; +using namespace Utils; namespace IncrediBuild { namespace Internal { @@ -52,27 +62,218 @@ const QLatin1String IBCONSOLE_FORCEREMOTE("IncrediBuild.IBConsole.ForceRemote"); const QLatin1String IBCONSOLE_ALTERNATE("IncrediBuild.IBConsole.Alternate"); } -IBConsoleBuildStep::IBConsoleBuildStep(ProjectExplorer::BuildStepList *buildStepList, Utils::Id id) - : ProjectExplorer::AbstractProcessStep(buildStepList, id) +class IBConsoleBuildStep; + +class IBConsoleStepConfigWidget : public BuildStepConfigWidget +{ + Q_DECLARE_TR_FUNCTIONS(IncrediBuild::Internal::IBConsoleBuildStep) + +public: + explicit IBConsoleStepConfigWidget(IBConsoleBuildStep *ibConsoleStep); + +private: + void commandBuilderChanged(); + void commandArgsChanged(); + void makePathEdited(); + + IBConsoleBuildStep *m_buildStep; + + QLineEdit *makeArgumentsLineEdit; + QComboBox *commandBuilder; + PathChooser *makePathChooser; +}; + +class IBConsoleBuildStep final : public AbstractProcessStep +{ + Q_DECLARE_TR_FUNCTIONS(IncrediBuild::Internal::IBConsoleBuildStep) + +public: + IBConsoleBuildStep(BuildStepList *buildStepList, Id id); + + bool init() final; + + BuildStepConfigWidget *createConfigWidget() final; + + bool fromMap(const QVariantMap &map) final; + QVariantMap toMap() const final; + + void setCommandBuilder(const QString &commandBuilder); + + void tryToMigrate(); + + void setupOutputFormatter(OutputFormatter *formatter) final; + +public: + BaseIntegerAspect *m_nice{nullptr}; + BaseBoolAspect *m_keepJobNum{nullptr}; + BaseBoolAspect *m_forceRemote{nullptr}; + BaseBoolAspect *m_alternate{nullptr}; + + BuildStepList *m_earlierSteps{}; + bool m_loadedFromMap{false}; + + CommandBuilder m_customCommandBuilder{this}; // "Custom Command"- needs to be first in the list. + MakeCommandBuilder m_makeCommandBuilder{this}; + CMakeCommandBuilder m_cmakeCommandBuilder{this}; + + CommandBuilder *m_commandBuilders[3] { + &m_customCommandBuilder, + &m_makeCommandBuilder, + &m_cmakeCommandBuilder + }; + CommandBuilder *m_activeCommandBuilder{m_commandBuilders[0]}; +}; + +IBConsoleStepConfigWidget::IBConsoleStepConfigWidget(IBConsoleBuildStep *ibConsoleStep) + : BuildStepConfigWidget(ibConsoleStep) + , m_buildStep(ibConsoleStep) +{ + setDisplayName(tr("IncrediBuild for Linux")); + setSummaryText("" + displayName() + ""); + + QFont font; + font.setBold(true); + font.setWeight(75); + + auto section1 = new QLabel("Target and configuration", this); + section1->setFont(font); + + auto commandHelperLabel = new QLabel(tr("Command Helper:"), this); + commandHelperLabel->setToolTip(tr("Select an helper to establish the build command.")); + + makePathChooser = new PathChooser(this); + makeArgumentsLineEdit = new QLineEdit(this); + const QString defaultCommand = m_buildStep->m_activeCommandBuilder->defaultCommand(); + makePathChooser->lineEdit()->setPlaceholderText(defaultCommand); + const QString command = m_buildStep->m_activeCommandBuilder->command(); + if (command != defaultCommand) + makePathChooser->setPath(command); + + makePathChooser->setExpectedKind(PathChooser::Kind::ExistingCommand); + makePathChooser->setBaseDirectory(FilePath::fromString(PathChooser::homePath())); + makePathChooser->setHistoryCompleter(QLatin1String("IncrediBuild.IBConsole.MakeCommand.History")); + connect(makePathChooser, &PathChooser::rawPathChanged, this, &IBConsoleStepConfigWidget::makePathEdited); + + QString defaultArgs; + for (const QString &a : m_buildStep->m_activeCommandBuilder->defaultArguments()) + defaultArgs += "\"" + a + "\" "; + + QString args; + for (const QString &a : m_buildStep->m_activeCommandBuilder->arguments()) + args += "\"" + a + "\" "; + + makeArgumentsLineEdit->setPlaceholderText(defaultArgs); + if (args != defaultArgs) + makeArgumentsLineEdit->setText(args); + connect(makeArgumentsLineEdit, &QLineEdit::textEdited, this, &IBConsoleStepConfigWidget::commandArgsChanged); + + auto section2 = new QLabel(this); + section2->setText(tr("IncrediBuild Distribution control")); + section2->setFont(font); + + commandBuilder = new QComboBox(this); + for (CommandBuilder *p : m_buildStep->m_commandBuilders) + commandBuilder->addItem(p->displayName()); + commandBuilder->setCurrentText(m_buildStep->m_activeCommandBuilder->displayName()); + connect(commandBuilder, &QComboBox::currentTextChanged, this, &IBConsoleStepConfigWidget::commandBuilderChanged); + + const auto emphasize = [](const QString &msg) { return QString("" + msg); }; + auto infoLabel1 = new QLabel(emphasize(tr("Enter the appropriate arguments to your build " + "command.")), this); + auto infoLabel2 = new QLabel(emphasize(tr("Make sure the build command's " + "multi-job parameter value is large enough (such as " + "-j200 for the JOM or Make build tools)")), this); + + LayoutBuilder builder(this); + builder.addRow(section1); + builder.startNewRow().addItems(commandHelperLabel, commandBuilder); + builder.startNewRow().addItems(tr("Make command:"), makePathChooser); + builder.startNewRow().addItems(tr("Make arguments:"), makeArgumentsLineEdit); + builder.addRow(infoLabel1); + builder.addRow(infoLabel2); + builder.addRow(ibConsoleStep->m_keepJobNum); + + builder.addRow(section2); + builder.addRow(ibConsoleStep->m_nice); + builder.addRow(ibConsoleStep->m_forceRemote); + builder.addRow(ibConsoleStep->m_alternate); + + Core::VariableChooser::addSupportForChildWidgets(this, ibConsoleStep->macroExpander()); +} + +void IBConsoleStepConfigWidget::commandBuilderChanged() +{ + m_buildStep->setCommandBuilder(commandBuilder->currentText()); + + QString defaultArgs; + for (const QString &a : m_buildStep->m_activeCommandBuilder->defaultArguments()) + defaultArgs += "\"" + a + "\" "; + + QString args; + for (const QString &a : m_buildStep->m_activeCommandBuilder->arguments()) + args += "\"" + a + "\" "; + if (args == defaultArgs) + args.clear(); + makeArgumentsLineEdit->setPlaceholderText(defaultArgs); + makeArgumentsLineEdit->setText(args); + + const QString defaultCommand = m_buildStep->m_activeCommandBuilder->defaultCommand(); + QString command = m_buildStep->m_activeCommandBuilder->command(); + if (command != defaultCommand) + command.clear(); + makePathChooser->lineEdit()->setPlaceholderText(defaultCommand); + makePathChooser->setPath(command); +} + +void IBConsoleStepConfigWidget::commandArgsChanged() +{ + m_buildStep->m_activeCommandBuilder->arguments(makeArgumentsLineEdit->text()); +} + +void IBConsoleStepConfigWidget::makePathEdited() +{ + m_buildStep->m_activeCommandBuilder->command(makePathChooser->rawPath()); +} + + +// IBConsoleBuildStep + +IBConsoleBuildStep::IBConsoleBuildStep(BuildStepList *buildStepList, Id id) + : AbstractProcessStep(buildStepList, id) , m_earlierSteps(buildStepList) { setDisplayName("IncrediBuild for Linux"); - initCommandBuilders(); -} -IBConsoleBuildStep::~IBConsoleBuildStep() -{ - for (CommandBuilder* p : m_commandBuildersList) { - delete p; - p = nullptr; - } + m_nice = addAspect(); + m_nice->setSettingsKey(Constants::IBCONSOLE_NICE); + m_nice->setToolTip(tr("Specify nice value. Nice Value should be numeric and between -20 and 19")); + m_nice->setLabel(tr("Nice value:")); + m_nice->setRange(-20, 19); + + m_keepJobNum = addAspect(); + m_keepJobNum->setSettingsKey(Constants::IBCONSOLE_KEEPJOBNUM); + m_keepJobNum->setLabel(tr("Keep Original Jobs Num:")); + m_keepJobNum->setToolTip(tr("Setting this option to true, forces IncrediBuild to not override " + "the -j command line switch. The default IncrediBuild behavior is " + "to set a high value to the -j command line switch which controls " + "the number of processes that the build tools executed by Qt will " + "execute in parallel (the default IncrediBuild behavior will set " + "this value to 200).")); + + m_forceRemote = addAspect(); + m_forceRemote->setSettingsKey(Constants::IBCONSOLE_ALTERNATE); + m_forceRemote->setLabel(tr("Force remote:")); + + m_alternate = addAspect(); + m_alternate->setSettingsKey(Constants::IBCONSOLE_FORCEREMOTE); + m_alternate->setLabel(tr("Alternate tasks preference:")); } void IBConsoleBuildStep::tryToMigrate() { // This is called when creating a fresh build step. // Attempt to detect build system from pre-existing steps. - for (CommandBuilder* p : m_commandBuildersList) { + for (CommandBuilder *p : m_commandBuilders) { if (p->canMigrate(m_earlierSteps)) { m_activeCommandBuilder = p; break; @@ -80,7 +281,7 @@ void IBConsoleBuildStep::tryToMigrate() } } -void IBConsoleBuildStep::setupOutputFormatter(Utils::OutputFormatter *formatter) +void IBConsoleBuildStep::setupOutputFormatter(OutputFormatter *formatter) { formatter->addLineParser(new GnuMakeParser()); formatter->addLineParsers(target()->kit()->createOutputParsers()); @@ -91,13 +292,9 @@ void IBConsoleBuildStep::setupOutputFormatter(Utils::OutputFormatter *formatter) bool IBConsoleBuildStep::fromMap(const QVariantMap &map) { m_loadedFromMap = true; - m_nice = map.value(Constants::IBCONSOLE_NICE, QVariant(0)).toInt(); - m_keepJobNum = map.value(Constants::IBCONSOLE_KEEPJOBNUM, QVariant(false)).toBool(); - m_forceRemote = map.value(Constants::IBCONSOLE_FORCEREMOTE, QVariant(false)).toBool(); - m_forceRemote = map.value(Constants::IBCONSOLE_ALTERNATE, QVariant(false)).toBool(); // Command builder. Default to the first in list, which should be the "Custom Command" - commandBuilder(map.value(Constants::IBCONSOLE_COMMANDBUILDER, QVariant(m_commandBuildersList.front()->displayName())).toString()); + setCommandBuilder(map.value(Constants::IBCONSOLE_COMMANDBUILDER, QVariant(m_commandBuilders[0]->displayName())).toString()); bool result = m_activeCommandBuilder->fromMap(map); return result && AbstractProcessStep::fromMap(map); @@ -108,11 +305,7 @@ QVariantMap IBConsoleBuildStep::toMap() const QVariantMap map = AbstractProcessStep::toMap(); map[IncrediBuild::Constants::INCREDIBUILD_BUILDSTEP_TYPE] = QVariant(IncrediBuild::Constants::IBCONSOLE_BUILDSTEP_ID); - map[Constants::IBCONSOLE_NICE] = QVariant(m_nice); - map[Constants::IBCONSOLE_KEEPJOBNUM] = QVariant(m_keepJobNum); - map[Constants::IBCONSOLE_ALTERNATE] = QVariant(m_forceRemote); - map[Constants::IBCONSOLE_FORCEREMOTE] = QVariant(m_forceRemote); - map[Constants::IBCONSOLE_COMMANDBUILDER] = QVariant(commandBuilder()->displayName()); + map[Constants::IBCONSOLE_COMMANDBUILDER] = QVariant(m_activeCommandBuilder->displayName()); m_activeCommandBuilder->toMap(&map); return map; @@ -122,69 +315,47 @@ bool IBConsoleBuildStep::init() { QStringList args; - if (m_nice != 0) - args.append(QString("--nice %0 ").arg(m_nice)); + if (m_nice->value() != 0) + args.append(QString("--nice %0 ").arg(m_nice->value())); - if (m_alternate) + if (m_alternate->value()) args.append("--alternate"); - if (m_forceRemote) + if (m_forceRemote->value()) args.append("--force-remote"); - m_activeCommandBuilder->keepJobNum(m_keepJobNum); + m_activeCommandBuilder->keepJobNum(m_keepJobNum->value()); args.append(m_activeCommandBuilder->fullCommandFlag()); - Utils::CommandLine cmdLine("ib_console", args); + CommandLine cmdLine("ib_console", args); ProcessParameters *procParams = processParameters(); procParams->setCommandLine(cmdLine); - procParams->setEnvironment(Utils::Environment::systemEnvironment()); + procParams->setEnvironment(Environment::systemEnvironment()); BuildConfiguration *buildConfig = buildConfiguration(); if (buildConfig) { procParams->setWorkingDirectory(buildConfig->buildDirectory()); procParams->setEnvironment(buildConfig->environment()); - - Utils::MacroExpander *macroExpander = buildConfig->macroExpander(); - if (macroExpander) - procParams->setMacroExpander(macroExpander); + procParams->setMacroExpander(buildConfig->macroExpander()); } return AbstractProcessStep::init(); } -BuildStepConfigWidget* IBConsoleBuildStep::createConfigWidget() +BuildStepConfigWidget *IBConsoleBuildStep::createConfigWidget() { + // On first creation of the step, attempt to detect and migrate from preceding steps + if (!m_loadedFromMap) + tryToMigrate(); + return new IBConsoleStepConfigWidget(this); } -void IBConsoleBuildStep::initCommandBuilders() + + +void IBConsoleBuildStep::setCommandBuilder(const QString &commandBuilder) { - if (m_commandBuildersList.empty()) { - m_commandBuildersList.push_back(new CommandBuilder(this)); // "Custom Command"- needs to be first in the list. - m_commandBuildersList.push_back(new MakeCommandBuilder(this)); - m_commandBuildersList.push_back(new CMakeCommandBuilder(this)); - } - - // Default to "Custom Command". - if (!m_activeCommandBuilder) - m_activeCommandBuilder = m_commandBuildersList.front(); -} - -const QStringList& IBConsoleBuildStep::supportedCommandBuilders() -{ - static QStringList list; - if (list.empty()) { - initCommandBuilders(); - for (CommandBuilder* p : m_commandBuildersList) - list.push_back(p->displayName()); - } - - return list; -} - -void IBConsoleBuildStep::commandBuilder(const QString &commandBuilder) -{ - for (CommandBuilder* p : m_commandBuildersList) { + for (CommandBuilder *p : m_commandBuilders) { if (p->displayName().compare(commandBuilder) == 0) { m_activeCommandBuilder = p; break; @@ -192,5 +363,16 @@ void IBConsoleBuildStep::commandBuilder(const QString &commandBuilder) } } + +// IBConsoleStepFactory + +IBConsoleStepFactory::IBConsoleStepFactory() +{ + registerStep(IncrediBuild::Constants::IBCONSOLE_BUILDSTEP_ID); + setDisplayName(QObject::tr("IncrediBuild for Linux")); + setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_BUILD, + ProjectExplorer::Constants::BUILDSTEPS_CLEAN}); +} + } // namespace Internal } // namespace IncrediBuild diff --git a/src/plugins/incredibuild/ibconsolebuildstep.h b/src/plugins/incredibuild/ibconsolebuildstep.h index f022cb6a000..d1d38619736 100644 --- a/src/plugins/incredibuild/ibconsolebuildstep.h +++ b/src/plugins/incredibuild/ibconsolebuildstep.h @@ -25,62 +25,15 @@ #pragma once -#include "commandbuilder.h" - -#include -#include - -#include +#include namespace IncrediBuild { namespace Internal { -class IBConsoleBuildStep : public ProjectExplorer::AbstractProcessStep +class IBConsoleStepFactory : public ProjectExplorer::BuildStepFactory { - Q_OBJECT public: - explicit IBConsoleBuildStep(ProjectExplorer::BuildStepList *buildStepList, Utils::Id id); - ~IBConsoleBuildStep() override; - - bool init() override; - - ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override; - - bool fromMap(const QVariantMap &map) override; - QVariantMap toMap() const override; - - int nice() const { return m_nice; } - void nice(int nice) { m_nice = nice; } - - bool keepJobNum() const { return m_keepJobNum; } - void keepJobNum(bool keepJobNum) { m_keepJobNum = keepJobNum; } - - bool forceRemote() const { return m_forceRemote; } - void forceRemote(bool forceRemote) { m_forceRemote = forceRemote; } - - bool alternate() const { return m_alternate; } - void alternate(bool alternate) { m_alternate = alternate; } - - const QStringList& supportedCommandBuilders(); - CommandBuilder* commandBuilder() const { return m_activeCommandBuilder; } - void commandBuilder(const QString &commandBuilder); - - bool loadedFromMap() const { return m_loadedFromMap; } - void tryToMigrate(); - - void setupOutputFormatter(Utils::OutputFormatter *formatter) override; - -private: - void initCommandBuilders(); - - int m_nice{0}; - bool m_keepJobNum{false}; - bool m_forceRemote{false}; - bool m_alternate{false}; - ProjectExplorer::BuildStepList *m_earlierSteps{}; - bool m_loadedFromMap{false}; - CommandBuilder* m_activeCommandBuilder{}; - QList m_commandBuildersList{}; + IBConsoleStepFactory(); }; } // namespace Internal diff --git a/src/plugins/incredibuild/ibconsolebuildstep.ui b/src/plugins/incredibuild/ibconsolebuildstep.ui deleted file mode 100644 index a80af67b1ba..00000000000 --- a/src/plugins/incredibuild/ibconsolebuildstep.ui +++ /dev/null @@ -1,156 +0,0 @@ - - - IncrediBuild::Internal::IBConsoleBuildStep - - - - 0 - 0 - 355 - 273 - - - - - - - Enter the appropriate arguments to your build command - - - - - - - Setting this option to true, forces IncrediBuild to not override the -j command line switch. The default IncrediBuild behavior is to set a high value to the -j command line switch which controls the number of processes that the build tools executed by QT will execute in parallel (the default IncrediBuild behavior will set this value to 200). - - - Keep Original Jobs Num - - - - - - - - 75 - true - - - - Target and configuration - - - - - - - Make command: - - - - - - - -20 - - - 19 - - - 1 - - - 0 - - - - - - - - - - Force remote - - - - - - - - - - - 75 - true - - - - IncrediBuild Distribution control - - - - - - - Specify nice value. Nice Value should be numeric and between -20 and 19 - - - Nice value: - - - - - - - - - - Make arguments: - - - - - - - Select an helper to establish the build command. - - - Command Helper: - - - - - - - Alternate tasks preference - - - - - - - - - - Make sure the build command's multi-job parameter value is large enough (such as -J200 for the JOM or Make build tools). - - - - - - - - Utils::PathChooser - QWidget -
utils/pathchooser.h
- 1 - - editingFinished() - browsingFinished() - -
-
- - -
diff --git a/src/plugins/incredibuild/ibconsolestepconfigwidget.cpp b/src/plugins/incredibuild/ibconsolestepconfigwidget.cpp deleted file mode 100644 index 5e67345e1db..00000000000 --- a/src/plugins/incredibuild/ibconsolestepconfigwidget.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://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 "ibconsolestepconfigwidget.h" - -#include "ui_ibconsolebuildstep.h" - -#include - -namespace IncrediBuild { -namespace Internal { - -IBConsoleStepConfigWidget::IBConsoleStepConfigWidget(IBConsoleBuildStep *ibConsoleStep) - : ProjectExplorer::BuildStepConfigWidget(ibConsoleStep) - , m_buildStepUI(nullptr) - , m_buildStep(ibConsoleStep) -{ - // On first creation of the step, attempt to detect and migrate from preceding steps - if (!ibConsoleStep->loadedFromMap()) - ibConsoleStep->tryToMigrate(); - - m_buildStepUI = new Ui_IBConsoleBuildStep(); - m_buildStepUI->setupUi(this); - Core::VariableChooser::addSupportForChildWidgets(this, ibConsoleStep->macroExpander()); - - m_buildStepUI->commandBuilder->addItems(m_buildStep->supportedCommandBuilders()); - m_buildStepUI->commandBuilder->setCurrentText(m_buildStep->commandBuilder()->displayName()); - connect(m_buildStepUI->commandBuilder, &QComboBox::currentTextChanged, this, &IBConsoleStepConfigWidget::commandBuilderChanged); - - QString command, defaultCommand; - defaultCommand = m_buildStep->commandBuilder()->defaultCommand(); - m_buildStepUI->makePathChooser->lineEdit()->setPlaceholderText(defaultCommand); - command = m_buildStep->commandBuilder()->command(); - if (command != defaultCommand) - m_buildStepUI->makePathChooser->setPath(command); - - m_buildStepUI->makePathChooser->setExpectedKind(Utils::PathChooser::Kind::ExistingCommand); - m_buildStepUI->makePathChooser->setBaseDirectory(Utils::FilePath::fromString(Utils::PathChooser::homePath())); - m_buildStepUI->makePathChooser->setHistoryCompleter(QLatin1String("IncrediBuild.IBConsole.MakeCommand.History")); - connect(m_buildStepUI->makePathChooser, &Utils::PathChooser::rawPathChanged, this, &IBConsoleStepConfigWidget::makePathEdited); - - QString defaultArgs; - for (const QString &a : m_buildStep->commandBuilder()->defaultArguments()) - defaultArgs += "\"" + a + "\" "; - - QString args; - for (const QString &a : m_buildStep->commandBuilder()->arguments()) - args += "\"" + a + "\" "; - - m_buildStepUI->makeArgumentsLineEdit->setPlaceholderText(defaultArgs); - if (args != defaultArgs) - m_buildStepUI->makeArgumentsLineEdit->setText(args); - connect(m_buildStepUI->makeArgumentsLineEdit, &QLineEdit::textEdited, this, &IBConsoleStepConfigWidget::commandArgsChanged); - - m_buildStepUI->niceSpin->setValue(m_buildStep->nice()); - connect(m_buildStepUI->niceSpin, static_cast(&QSpinBox::valueChanged), this, &IBConsoleStepConfigWidget::niceChanged); - - m_buildStepUI->keepJobsNum->setChecked(m_buildStep->keepJobNum()); - connect(m_buildStepUI->keepJobsNum, &QCheckBox::stateChanged, this, &IBConsoleStepConfigWidget::keepJobNumChanged); - - m_buildStepUI->alternate->setChecked(m_buildStep->alternate()); - connect(m_buildStepUI->alternate, &QCheckBox::stateChanged, this, &IBConsoleStepConfigWidget::alternateChanged); - - m_buildStepUI->forceRemote->setChecked(m_buildStep->forceRemote()); - connect(m_buildStepUI->forceRemote, &QCheckBox::stateChanged, this, &IBConsoleStepConfigWidget::forceRemoteChanged); -} - -IBConsoleStepConfigWidget::~IBConsoleStepConfigWidget() -{ - delete m_buildStepUI; - m_buildStepUI = nullptr; -} - -QString IBConsoleStepConfigWidget::displayName() const -{ - return tr("IncrediBuild for Linux"); -} - -QString IBConsoleStepConfigWidget::summaryText() const -{ - return "" + displayName() + ""; -} - -void IBConsoleStepConfigWidget::niceChanged(int) -{ - m_buildStep->nice(m_buildStepUI->niceSpin->value()); -} - -void IBConsoleStepConfigWidget::commandBuilderChanged(const QString&) -{ - m_buildStep->commandBuilder(m_buildStepUI->commandBuilder->currentText()); - - QString defaultArgs; - for (const QString &a : m_buildStep->commandBuilder()->defaultArguments()) - defaultArgs += "\"" + a + "\" "; - - QString args; - for (const QString &a : m_buildStep->commandBuilder()->arguments()) - args += "\"" + a + "\" "; - if (args != defaultArgs) - m_buildStepUI->makeArgumentsLineEdit->setText(args); - else - m_buildStepUI->makeArgumentsLineEdit->setText(""); - - QString command, defaultCommand; - defaultCommand = m_buildStep->commandBuilder()->defaultCommand(); - m_buildStepUI->makePathChooser->lineEdit()->setPlaceholderText(defaultCommand); - command = m_buildStep->commandBuilder()->command(); - if (command != defaultCommand) - m_buildStepUI->makePathChooser->setPath(command); - else - m_buildStepUI->makePathChooser->setPath(""); -} - -void IBConsoleStepConfigWidget::commandArgsChanged(const QString&) -{ - m_buildStep->commandBuilder()->arguments(m_buildStepUI->makeArgumentsLineEdit->text()); -} - -void IBConsoleStepConfigWidget::makePathEdited() -{ - m_buildStep->commandBuilder()->command(m_buildStepUI->makePathChooser->rawPath()); -} - -void IBConsoleStepConfigWidget::keepJobNumChanged() -{ - m_buildStep->keepJobNum(m_buildStepUI->keepJobsNum->checkState() == Qt::CheckState::Checked); -} - -void IBConsoleStepConfigWidget::alternateChanged() -{ - m_buildStep->alternate(m_buildStepUI->alternate->checkState() == Qt::CheckState::Checked); -} - -void IBConsoleStepConfigWidget::forceRemoteChanged() -{ - m_buildStep->forceRemote(m_buildStepUI->forceRemote->checkState() == Qt::CheckState::Checked); -} - -} // namespace Internal -} // namespace IncrediBuild diff --git a/src/plugins/incredibuild/ibconsolestepconfigwidget.h b/src/plugins/incredibuild/ibconsolestepconfigwidget.h deleted file mode 100644 index 7682b875911..00000000000 --- a/src/plugins/incredibuild/ibconsolestepconfigwidget.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://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 "ibconsolebuildstep.h" - -#include - -namespace IncrediBuild { -namespace Internal { - -class Ui_IBConsoleBuildStep; - -class IBConsoleStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget -{ - Q_OBJECT -public: - explicit IBConsoleStepConfigWidget(IBConsoleBuildStep *ibConsoleStep); - virtual ~IBConsoleStepConfigWidget(); - - QString displayName() const; - QString summaryText() const; - -private: - void niceChanged(int); - void keepJobNumChanged(); - void forceRemoteChanged(); - void alternateChanged(); - void commandBuilderChanged(const QString&); - void commandArgsChanged(const QString&); - void makePathEdited(); - - Internal::Ui_IBConsoleBuildStep *m_buildStepUI; - IBConsoleBuildStep *m_buildStep; -}; - -} // namespace Internal -} // namespace IncrediBuild diff --git a/src/plugins/incredibuild/ibconsolestepfactory.cpp b/src/plugins/incredibuild/ibconsolestepfactory.cpp deleted file mode 100644 index 05c3664866a..00000000000 --- a/src/plugins/incredibuild/ibconsolestepfactory.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://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 "ibconsolestepfactory.h" - -#include "ibconsolebuildstep.h" -#include "incredibuildconstants.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace ProjectExplorer; - -namespace IncrediBuild { -namespace Internal { - -IBConsoleStepFactory::IBConsoleStepFactory() -{ - registerStep(Constants::IBCONSOLE_BUILDSTEP_ID); - setDisplayName(QObject::tr("IncrediBuild for Linux")); - setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_BUILD, - ProjectExplorer::Constants::BUILDSTEPS_CLEAN}); -} -} // namespace Internal -} // namespace IncrediBuild diff --git a/src/plugins/incredibuild/ibconsolestepfactory.h b/src/plugins/incredibuild/ibconsolestepfactory.h deleted file mode 100644 index 171c2c4c2de..00000000000 --- a/src/plugins/incredibuild/ibconsolestepfactory.h +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://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 -#include -#include -#include -#include - -namespace IncrediBuild { -namespace Internal { - -class IBConsoleStepFactory : public ProjectExplorer::BuildStepFactory -{ -public: - IBConsoleStepFactory(); -}; - -} // namespace Internal -} // namespace IncrediBuild diff --git a/src/plugins/incredibuild/incredibuild.pro b/src/plugins/incredibuild/incredibuild.pro index 167da0bbb57..732b4d82309 100644 --- a/src/plugins/incredibuild/incredibuild.pro +++ b/src/plugins/incredibuild/incredibuild.pro @@ -14,23 +14,18 @@ SOURCES += incredibuildplugin.cpp \ commandbuilder.cpp \ makecommandbuilder.cpp \ cmakecommandbuilder.cpp \ - ibconsolebuildstep.cpp \ - ibconsolestepconfigwidget.cpp \ - ibconsolestepfactory.cpp + ibconsolebuildstep.cpp HEADERS += incredibuildplugin.h \ buildconsolestepconfigwidget.h \ buildconsolestepfactory.h \ cmakecommandbuilder.h \ commandbuilder.h \ - ibconsolestepconfigwidget.h \ incredibuild_global.h \ incredibuildconstants.h \ buildconsolebuildstep.h \ makecommandbuilder.h \ ibconsolebuildstep.h \ - ibconsolestepfactory.h FORMS += \ - buildconsolebuildstep.ui \ - ibconsolebuildstep.ui + buildconsolebuildstep.ui diff --git a/src/plugins/incredibuild/incredibuild.qbs b/src/plugins/incredibuild/incredibuild.qbs index 5015fbe3932..82bd444fdd9 100644 --- a/src/plugins/incredibuild/incredibuild.qbs +++ b/src/plugins/incredibuild/incredibuild.qbs @@ -22,11 +22,6 @@ QtcPlugin { "commandbuilder.h", "ibconsolebuildstep.cpp", "ibconsolebuildstep.h", - "ibconsolebuildstep.ui", - "ibconsolestepconfigwidget.cpp", - "ibconsolestepconfigwidget.h", - "ibconsolestepfactory.cpp", - "ibconsolestepfactory.h", "incredibuild_global.h", "incredibuildconstants.h", "incredibuildplugin.cpp", diff --git a/src/plugins/incredibuild/incredibuildplugin.h b/src/plugins/incredibuild/incredibuildplugin.h index 5298a10bcdf..59a5c4455cf 100644 --- a/src/plugins/incredibuild/incredibuildplugin.h +++ b/src/plugins/incredibuild/incredibuildplugin.h @@ -27,7 +27,7 @@ #include "incredibuild_global.h" #include "buildconsolestepfactory.h" -#include "ibconsolestepfactory.h" +#include "ibconsolebuildstep.h" #include