diff options
author | Daniel Teske <daniel.teske@nokia.com> | 2012-01-23 14:55:58 +0100 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-01-31 18:04:27 +0100 |
commit | 5d0407ef4651143881a7e538aa68728e5b9f4b4f (patch) | |
tree | eee562a3720bac70358ebfd751967b0294747fc1 /src/plugins | |
parent | 5b847a66dfc762e3a8049860ca036be195faba89 (diff) | |
download | qt-creator-5d0407ef4651143881a7e538aa68728e5b9f4b4f.tar.gz |
Optionaly disable buildsteps
Task-number: QTCREATORBUG-6713
Change-Id: Ief7f8509572cfa2008209083e5ae9c7763eba42a
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins')
22 files changed, 357 insertions, 141 deletions
diff --git a/src/plugins/autotoolsprojectmanager/autogenstep.cpp b/src/plugins/autotoolsprojectmanager/autogenstep.cpp index 0762531f3b..f85ab38904 100644 --- a/src/plugins/autotoolsprojectmanager/autogenstep.cpp +++ b/src/plugins/autotoolsprojectmanager/autogenstep.cpp @@ -163,8 +163,6 @@ bool AutogenStep::init() { AutotoolsBuildConfiguration *bc = autotoolsBuildConfiguration(); - setEnabled(true); - ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); pp->setEnvironment(bc->environment()); diff --git a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp index 9b3bfce26a..f7e7526bf8 100644 --- a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp +++ b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp @@ -162,8 +162,6 @@ bool AutoreconfStep::init() { AutotoolsBuildConfiguration *bc = autotoolsBuildConfiguration(); - setEnabled(true); - ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); pp->setEnvironment(bc->environment()); diff --git a/src/plugins/autotoolsprojectmanager/configurestep.cpp b/src/plugins/autotoolsprojectmanager/configurestep.cpp index 844c421b5a..6506755e8a 100644 --- a/src/plugins/autotoolsprojectmanager/configurestep.cpp +++ b/src/plugins/autotoolsprojectmanager/configurestep.cpp @@ -163,8 +163,6 @@ bool ConfigureStep::init() { AutotoolsBuildConfiguration *bc = autotoolsBuildConfiguration(); - setEnabled(true); - ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); pp->setEnvironment(bc->environment()); diff --git a/src/plugins/autotoolsprojectmanager/makestep.cpp b/src/plugins/autotoolsprojectmanager/makestep.cpp index 8a615f2b2f..64255f430e 100644 --- a/src/plugins/autotoolsprojectmanager/makestep.cpp +++ b/src/plugins/autotoolsprojectmanager/makestep.cpp @@ -177,7 +177,6 @@ bool MakeStep::init() QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets); Utils::QtcProcess::addArgs(&arguments, additionalArguments()); - setEnabled(true); setIgnoreReturnValue(m_clean); ProcessParameters *pp = processParameters(); diff --git a/src/plugins/cmakeprojectmanager/makestep.cpp b/src/plugins/cmakeprojectmanager/makestep.cpp index 063155faeb..323cf5de0d 100644 --- a/src/plugins/cmakeprojectmanager/makestep.cpp +++ b/src/plugins/cmakeprojectmanager/makestep.cpp @@ -136,7 +136,6 @@ bool MakeStep::init() QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets); Utils::QtcProcess::addArgs(&arguments, additionalArguments()); - setEnabled(true); setIgnoreReturnValue(m_clean); ProcessParameters *pp = processParameters(); diff --git a/src/plugins/genericprojectmanager/genericmakestep.cpp b/src/plugins/genericprojectmanager/genericmakestep.cpp index df11285781..9ca85172c3 100644 --- a/src/plugins/genericprojectmanager/genericmakestep.cpp +++ b/src/plugins/genericprojectmanager/genericmakestep.cpp @@ -111,7 +111,6 @@ bool GenericMakeStep::init() { GenericBuildConfiguration *bc = genericBuildConfiguration(); - setEnabled(true); ProjectExplorer::ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); pp->setWorkingDirectory(bc->buildDirectory()); diff --git a/src/plugins/projectexplorer/abstractprocessstep.cpp b/src/plugins/projectexplorer/abstractprocessstep.cpp index 7b05a5dfd7..a0839e4ad4 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.cpp +++ b/src/plugins/projectexplorer/abstractprocessstep.cpp @@ -92,15 +92,15 @@ using namespace ProjectExplorer; AbstractProcessStep::AbstractProcessStep(BuildStepList *bsl, const QString &id) : BuildStep(bsl, id), m_timer(0), m_futureInterface(0), - m_enabled(true), m_ignoreReturnValue(false), - m_process(0), m_eventLoop(0), m_outputParserChain(0) + m_ignoreReturnValue(false), m_process(0), + m_eventLoop(0), m_outputParserChain(0) { } AbstractProcessStep::AbstractProcessStep(BuildStepList *bsl, AbstractProcessStep *bs) : BuildStep(bsl, bs), m_timer(0), m_futureInterface(0), - m_enabled(bs->m_enabled), m_ignoreReturnValue(bs->m_ignoreReturnValue), + m_ignoreReturnValue(bs->m_ignoreReturnValue), m_process(0), m_eventLoop(0), m_outputParserChain(0) { } @@ -186,10 +186,6 @@ bool AbstractProcessStep::init() void AbstractProcessStep::run(QFutureInterface<bool> &fi) { m_futureInterface = &fi; - if (!m_enabled) { - fi.reportResult(true); - return; - } QDir wd(m_param.effectiveWorkingDirectory()); if (!wd.exists()) wd.mkpath(wd.absolutePath()); diff --git a/src/plugins/projectexplorer/abstractprocessstep.h b/src/plugins/projectexplorer/abstractprocessstep.h index b72de26021..218eb6f3cc 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.h +++ b/src/plugins/projectexplorer/abstractprocessstep.h @@ -64,8 +64,6 @@ public: virtual BuildStepConfigWidget *createConfigWidget() = 0; virtual bool immutable() const = 0; - void setEnabled(bool b) { m_enabled = b; } - ProcessParameters *processParameters() { return &m_param; } bool ignoreReturnValue(); @@ -99,7 +97,6 @@ private: QTimer *m_timer; QFutureInterface<bool> *m_futureInterface; ProcessParameters m_param; - bool m_enabled; bool m_ignoreReturnValue; Utils::QtcProcess *m_process; QEventLoop *m_eventLoop; diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index 3a1d747ed9..a614271f10 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -80,6 +80,7 @@ struct BuildManagerPrivate { Internal::TaskWindow *m_taskWindow; QList<BuildStep *> m_buildQueue; + QList<bool> m_enabledState; QStringList m_stepNames; ProjectExplorerPlugin *m_projectExplorerPlugin; bool m_running; @@ -93,6 +94,7 @@ struct BuildManagerPrivate { QHash<ProjectConfiguration *, int> m_activeBuildStepsPerProjectConfiguration; Project *m_previousBuildStepProject; // is set to true while canceling, so that nextBuildStep knows that the BuildStep finished because of canceling + bool m_skipDisabled; bool m_canceling; bool m_doNotEnterEventLoop; QEventLoop *m_eventLoop; @@ -108,6 +110,7 @@ struct BuildManagerPrivate { BuildManagerPrivate::BuildManagerPrivate() : m_running(false) , m_previousBuildStepProject(0) + , m_skipDisabled(false) , m_canceling(false) , m_doNotEnterEventLoop(false) , m_eventLoop(0) @@ -271,6 +274,7 @@ void BuildManager::clearBuildQueue() d->m_stepNames.clear(); d->m_buildQueue.clear(); + d->m_enabledState.clear(); d->m_running = false; d->m_previousBuildStepProject = 0; d->m_currentBuildStep = 0; @@ -400,7 +404,7 @@ void BuildManager::nextBuildQueue() d->m_progressFutureInterface->setProgressValueAndText(d->m_progress*100, msgProgress(d->m_progress, d->m_maxProgress)); decrementActiveBuildSteps(d->m_currentBuildStep); - bool result = d->m_watcher.result(); + bool result = d->m_skipDisabled || d->m_watcher.result(); if (!result) { // Build Failure const QString projectName = d->m_currentBuildStep->project()->displayName(); @@ -445,6 +449,7 @@ void BuildManager::nextStep() d->m_currentBuildStep = d->m_buildQueue.front(); d->m_buildQueue.pop_front(); QString name = d->m_stepNames.takeFirst(); + d->m_skipDisabled = !d->m_enabledState.takeFirst(); if (d->m_futureProgress) d->m_futureProgress.data()->setTitle(name); @@ -454,6 +459,14 @@ void BuildManager::nextStep() .arg(projectName), BuildStep::MessageOutput); d->m_previousBuildStepProject = d->m_currentBuildStep->project(); } + + if (d->m_skipDisabled) { + addToOutputWindow(tr("Skipping disabled step %1.") + .arg(d->m_currentBuildStep->displayName()), BuildStep::MessageOutput); + nextBuildQueue(); + return; + } + if (d->m_currentBuildStep->runInGuiThread()) { connect (d->m_currentBuildStep, SIGNAL(finished()), this, SLOT(buildStepFinishedAsync())); @@ -475,7 +488,7 @@ void BuildManager::nextStep() } } -bool BuildManager::buildQueueAppend(QList<BuildStep *> steps, const QStringList &names) +bool BuildManager::buildQueueAppend(QList<BuildStep *> steps, QStringList names) { int count = steps.size(); bool init = true; @@ -486,9 +499,11 @@ bool BuildManager::buildQueueAppend(QList<BuildStep *> steps, const QStringList this, SLOT(addToTaskWindow(ProjectExplorer::Task))); connect(bs, SIGNAL(addOutput(QString, ProjectExplorer::BuildStep::OutputFormat, ProjectExplorer::BuildStep::OutputNewlineSetting)), this, SLOT(addToOutputWindow(QString, ProjectExplorer::BuildStep::OutputFormat, ProjectExplorer::BuildStep::OutputNewlineSetting))); - init = bs->init(); - if (!init) - break; + if (bs->enabled()) { + init = bs->init(); + if (!init) + break; + } } if (!init) { BuildStep *bs = steps.at(i); @@ -511,6 +526,7 @@ bool BuildManager::buildQueueAppend(QList<BuildStep *> steps, const QStringList ++d->m_maxProgress; d->m_buildQueue.append(steps.at(i)); d->m_stepNames.append(names.at(i)); + d->m_enabledState.append(steps.at(i)->enabled()); incrementActiveBuildSteps(steps.at(i)); } return true; diff --git a/src/plugins/projectexplorer/buildmanager.h b/src/plugins/projectexplorer/buildmanager.h index 0c0f255e67..f4c98450d5 100644 --- a/src/plugins/projectexplorer/buildmanager.h +++ b/src/plugins/projectexplorer/buildmanager.h @@ -106,7 +106,7 @@ private: void startBuildQueue(); void nextStep(); void clearBuildQueue(); - bool buildQueueAppend(QList<BuildStep *> steps, const QStringList &names); + bool buildQueueAppend(QList<BuildStep *> steps, QStringList names); void incrementActiveBuildSteps(BuildStep *bs); void decrementActiveBuildSteps(BuildStep *bs); void disconnectOutput(BuildStep *bs); diff --git a/src/plugins/projectexplorer/buildstep.cpp b/src/plugins/projectexplorer/buildstep.cpp index 2b999d4b39..7d86700728 100644 --- a/src/plugins/projectexplorer/buildstep.cpp +++ b/src/plugins/projectexplorer/buildstep.cpp @@ -122,16 +122,18 @@ \brief This signal needs to be emitted if the BuildStep runs in the gui thread. */ +static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled"; + using namespace ProjectExplorer; BuildStep::BuildStep(BuildStepList *bsl, const QString &id) : - ProjectConfiguration(bsl, id) + ProjectConfiguration(bsl, id), m_enabled(true) { Q_ASSERT(bsl); } BuildStep::BuildStep(BuildStepList *bsl, BuildStep *bs) : - ProjectConfiguration(bsl, bs) + ProjectConfiguration(bsl, bs), m_enabled(bs->m_enabled) { Q_ASSERT(bsl); } @@ -140,6 +142,19 @@ BuildStep::~BuildStep() { } +bool BuildStep::fromMap(const QVariantMap &map) +{ + m_enabled = map.value(QLatin1String(buildStepEnabledKey), true).toBool(); + return ProjectConfiguration::fromMap(map); +} + +QVariantMap BuildStep::toMap() const +{ + QVariantMap map = ProjectConfiguration::toMap(); + map.insert(QLatin1String(buildStepEnabledKey), m_enabled); + return map; +} + BuildConfiguration *BuildStep::buildConfiguration() const { return qobject_cast<BuildConfiguration *>(parent()->parent()); @@ -180,6 +195,19 @@ void BuildStep::cancel() // Do nothing } +void BuildStep::setEnabled(bool b) +{ + if (m_enabled == b) + return; + m_enabled = b; + emit enabledChanged(); +} + +bool BuildStep::enabled() const +{ + return m_enabled; +} + IBuildStepFactory::IBuildStepFactory(QObject *parent) : QObject(parent) { } diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h index 85f1cc6890..1eccd30f8d 100644 --- a/src/plugins/projectexplorer/buildstep.h +++ b/src/plugins/projectexplorer/buildstep.h @@ -70,6 +70,12 @@ public: virtual bool runInGuiThread() const; virtual void cancel(); + virtual bool fromMap(const QVariantMap &map); + virtual QVariantMap toMap() const; + + bool enabled() const; + void setEnabled(bool b); + BuildConfiguration *buildConfiguration() const; DeployConfiguration *deployConfiguration() const; ProjectConfiguration *projectConfiguration() const; @@ -86,6 +92,10 @@ signals: ProjectExplorer::BuildStep::OutputNewlineSetting newlineSetting = DoAppendNewline) const; void finished(); + + void enabledChanged(); +private: + bool m_enabled; }; class PROJECTEXPLORER_EXPORT IBuildStepFactory : diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp index 341066c9d1..b00f200bdc 100644 --- a/src/plugins/projectexplorer/buildstepspage.cpp +++ b/src/plugins/projectexplorer/buildstepspage.cpp @@ -34,7 +34,6 @@ #include "buildconfiguration.h" #include "buildsteplist.h" -#include "detailsbutton.h" #include "projectexplorerconstants.h" #include <coreplugin/coreconstants.h> @@ -45,6 +44,7 @@ #include <QtCore/QSignalMapper> +#include <QtCore/QPropertyAnimation> #include <QtGui/QLabel> #include <QtGui/QPushButton> #include <QtGui/QMenu> @@ -53,12 +53,170 @@ #include <QtGui/QToolButton> #include <QtGui/QMessageBox> #include <QtGui/QMainWindow> +#include <QtGui/QGraphicsOpacityEffect> using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; +ToolWidget::ToolWidget(QWidget *parent) + : Utils::FadingPanel(parent), m_buildStepEnabled(true) +{ + QHBoxLayout *layout = new QHBoxLayout; + layout->setMargin(4); + layout->setSpacing(4); + setLayout(layout); + m_firstWidget = new FadingWidget(this); + m_firstWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + QHBoxLayout *hbox = new QHBoxLayout(); + hbox->setContentsMargins(0, 0, 0, 0); + hbox->setSpacing(0); + m_firstWidget->setLayout(hbox); +#ifdef Q_OS_MAC + QSize buttonSize(20, 20); +#else + QSize buttonSize(20, 26); +#endif + + m_disableButton = new QToolButton(m_firstWidget); + m_disableButton->setAutoRaise(true); + m_disableButton->setToolTip(BuildStepListWidget::tr("Disable")); + m_disableButton->setFixedSize(buttonSize); + m_disableButton->setIcon(QIcon(QLatin1String(":/projectexplorer/images/disabledbuildstep.png"))); + m_disableButton->setCheckable(true); + hbox->addWidget(m_disableButton); + layout->addWidget(m_firstWidget); + + m_secondWidget = new FadingWidget(this); + m_secondWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); + hbox = new QHBoxLayout(); + hbox->setMargin(0); + hbox->setSpacing(4); + m_secondWidget->setLayout(hbox); + + m_upButton = new QToolButton(m_secondWidget); + m_upButton->setAutoRaise(true); + m_upButton->setToolTip(BuildStepListWidget::tr("Move Up")); + m_upButton->setFixedSize(buttonSize); + m_upButton->setIcon(QIcon(QLatin1String(":/core/images/darkarrowup.png"))); + hbox->addWidget(m_upButton); + + m_downButton = new QToolButton(m_secondWidget); + m_downButton->setAutoRaise(true); + m_downButton->setToolTip(BuildStepListWidget::tr("Move Down")); + m_downButton->setFixedSize(buttonSize); + m_downButton->setIcon(QIcon(QLatin1String(":/core/images/darkarrowdown.png"))); + hbox->addWidget(m_downButton); + + m_removeButton = new QToolButton(m_secondWidget); + m_removeButton->setAutoRaise(true); + m_removeButton->setToolTip(BuildStepListWidget::tr("Remove Item")); + m_removeButton->setFixedSize(buttonSize); + m_removeButton->setIcon(QIcon(QLatin1String(":/core/images/darkclose.png"))); + hbox->addWidget(m_removeButton); + + layout->addWidget(m_secondWidget); + + connect(m_disableButton, SIGNAL(clicked()), this, SIGNAL(disabledClicked())); + connect(m_upButton, SIGNAL(clicked()), this, SIGNAL(upClicked())); + connect(m_downButton, SIGNAL(clicked()), this, SIGNAL(downClicked())); + connect(m_removeButton, SIGNAL(clicked()), this, SIGNAL(removeClicked())); +} + +void ToolWidget::setOpacity(qreal value) +{ + m_targetOpacity = value; + if (m_buildStepEnabled) + m_firstWidget->setOpacity(value); + m_secondWidget->setOpacity(value); +} + +void ToolWidget::fadeTo(qreal value) +{ + m_targetOpacity = value; + if (m_buildStepEnabled) + m_firstWidget->fadeTo(value); + m_secondWidget->fadeTo(value); +} + +void ToolWidget::setBuildStepEnabled(bool b) +{ + m_buildStepEnabled = b; + if (m_buildStepEnabled) { +#ifdef Q_OS_MAC + m_firstWidget->setOpacity(m_targetOpacity); +#else + m_firstWidget->fadeTo(m_targetOpacity); +#endif + } else { +#ifdef Q_OS_MAC + m_firstWidget->setOpacity(1.0); +#else + m_firstWidget->fadeTo(1.0); +#endif + } + m_disableButton->setChecked(!b); +} + +void ToolWidget::setUpEnabled(bool b) +{ + m_upButton->setEnabled(b); +} + +void ToolWidget::setDownEnabled(bool b) +{ + m_downButton->setEnabled(b); +} + +void ToolWidget::setRemoveEnabled(bool b) +{ + m_removeButton->setEnabled(b); +} + +void ToolWidget::setUpVisible(bool b) +{ + m_upButton->setVisible(b); +} + +void ToolWidget::setDownVisible(bool b) +{ + m_downButton->setVisible(b); +} + +FadingWidget::FadingWidget(QWidget *parent) : + QWidget(parent), + m_opacityEffect(new QGraphicsOpacityEffect) +{ + m_opacityEffect->setOpacity(0); + setGraphicsEffect(m_opacityEffect); + + // Workaround for issue with QGraphicsEffect. GraphicsEffect + // currently clears with Window color. Remove if flickering + // no longer occurs on fade-in + QPalette pal; + pal.setBrush(QPalette::All, QPalette::Window, Qt::transparent); + setPalette(pal); +} + +void FadingWidget::setOpacity(qreal value) +{ + m_opacityEffect->setOpacity(value); +} + +void FadingWidget::fadeTo(qreal value) +{ + QPropertyAnimation *animation = new QPropertyAnimation(m_opacityEffect, "opacity"); + animation->setDuration(200); + animation->setEndValue(value); + animation->start(QAbstractAnimation::DeleteWhenStopped); +} + +qreal FadingWidget::opacity() +{ + return m_opacityEffect->opacity(); +} + BuildStepsWidgetData::BuildStepsWidgetData(BuildStep *s) : - step(s), widget(0), detailsWidget(0), upButton(0), downButton(0), removeButton(0) + step(s), widget(0), detailsWidget(0) { widget = s->createConfigWidget(); Q_ASSERT(widget); @@ -66,44 +224,11 @@ BuildStepsWidgetData::BuildStepsWidgetData(BuildStep *s) : detailsWidget = new Utils::DetailsWidget; detailsWidget->setWidget(widget); - Utils::FadingPanel *toolWidget = new Utils::FadingPanel(detailsWidget); -#ifdef Q_OS_MAC - QSize buttonSize(20, 20); -#else - QSize buttonSize(20, 26); -#endif - - upButton = new QToolButton(toolWidget); - upButton->setAutoRaise(true); - upButton->setToolTip(BuildStepListWidget::tr("Move Up")); - upButton->setFixedSize(buttonSize); - upButton->setIcon(QIcon(QLatin1String(":/core/images/darkarrowup.png"))); - - downButton = new QToolButton(toolWidget); - downButton->setAutoRaise(true); - downButton->setToolTip(BuildStepListWidget::tr("Move Down")); - downButton->setFixedSize(buttonSize); - downButton->setIcon(QIcon(QLatin1String(":/core/images/darkarrowdown.png"))); - - removeButton = new QToolButton(toolWidget); - removeButton->setAutoRaise(true); - removeButton->setToolTip(BuildStepListWidget::tr("Remove Item")); - removeButton->setFixedSize(buttonSize); - removeButton->setIcon(QIcon(QLatin1String(":/core/images/darkclose.png"))); - - toolWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); - QHBoxLayout *hbox = new QHBoxLayout(); - toolWidget->setLayout(hbox); - hbox->setMargin(4); - hbox->setSpacing(0); - hbox->addWidget(upButton); - hbox->addWidget(downButton); - hbox->addWidget(removeButton); + toolWidget = new ToolWidget(detailsWidget); + toolWidget->setBuildStepEnabled(step->enabled()); detailsWidget->setToolWidget(toolWidget); - detailsWidget->setContentsMargins(0, 0, 0, 1); - detailsWidget->setSummaryText(widget->summaryText()); detailsWidget->setAdditionalSummaryText(widget->additionalSummaryText()); } @@ -153,6 +278,19 @@ void BuildStepListWidget::updateAdditionalSummary() } } +void BuildStepListWidget::updateEnabledState() +{ + BuildStep *step = qobject_cast<BuildStep *>(sender()); + if (step) { + foreach (const BuildStepsWidgetData *s, m_buildStepsData) { + if (s->step == step) { + s->toolWidget->setBuildStepEnabled(step->enabled()); + break; + } + } + } +} + void BuildStepListWidget::init(BuildStepList *bsl) { Q_ASSERT(bsl); @@ -240,11 +378,16 @@ void BuildStepListWidget::addBuildStepWidget(int pos, BuildStep *step) connect(s->widget, SIGNAL(updateAdditionalSummary()), this, SLOT(updateAdditionalSummary())); - connect(s->upButton, SIGNAL(clicked()), + connect(s->step, SIGNAL(enabledChanged()), + this, SLOT(updateEnabledState())); + + connect(s->toolWidget, SIGNAL(disabledClicked()), + m_disableMapper, SLOT(map())); + connect(s->toolWidget, SIGNAL(upClicked()), m_upMapper, SLOT(map())); - connect(s->downButton, SIGNAL(clicked()), + connect(s->toolWidget, SIGNAL(downClicked()), m_downMapper, SLOT(map())); - connect(s->removeButton, SIGNAL(clicked()), + connect(s->toolWidget, SIGNAL(removeClicked()), m_removeMapper, SLOT(map())); } @@ -314,11 +457,21 @@ void BuildStepListWidget::removeBuildStep(int pos) m_noStepsLabel->setVisible(hasSteps); } +void BuildStepListWidget::triggerDisable(int pos) +{ + BuildStep *bs = m_buildStepsData.at(pos)->step; + bs->setEnabled(!bs->enabled()); + m_buildStepsData.at(pos)->toolWidget->setBuildStepEnabled(bs->enabled()); +} + void BuildStepListWidget::setupUi() { if (0 != m_addButton) return; + m_disableMapper = new QSignalMapper(this); + connect(m_disableMapper, SIGNAL(mapped(int)), + this, SLOT(triggerDisable(int))); m_upMapper = new QSignalMapper(this); connect(m_upMapper, SIGNAL(mapped(int)), this, SLOT(triggerStepMoveUp(int))); @@ -361,21 +514,22 @@ void BuildStepListWidget::updateBuildStepButtonsState() return; for (int i = 0; i < m_buildStepsData.count(); ++i) { BuildStepsWidgetData *s = m_buildStepsData.at(i); - s->removeButton->setEnabled(!m_buildStepList->at(i)->immutable()); - m_removeMapper->setMapping(s->removeButton, i); - - s->upButton->setEnabled((i > 0) - && !(m_buildStepList->at(i)->immutable() - && m_buildStepList->at(i - 1))); - m_upMapper->setMapping(s->upButton, i); - s->downButton->setEnabled((i + 1 < m_buildStepList->count()) - && !(m_buildStepList->at(i)->immutable() - && m_buildStepList->at(i + 1)->immutable())); - m_downMapper->setMapping(s->downButton, i); + m_disableMapper->setMapping(s->toolWidget, i); + s->toolWidget->setRemoveEnabled(!m_buildStepList->at(i)->immutable()); + m_removeMapper->setMapping(s->toolWidget, i); + + s->toolWidget->setUpEnabled((i > 0) + && !(m_buildStepList->at(i)->immutable() + && m_buildStepList->at(i - 1))); + m_upMapper->setMapping(s->toolWidget, i); + s->toolWidget->setDownEnabled((i + 1 < m_buildStepList->count()) + && !(m_buildStepList->at(i)->immutable() + && m_buildStepList->at(i + 1)->immutable())); + m_downMapper->setMapping(s->toolWidget, i); // Only show buttons when needed - s->downButton->setVisible(m_buildStepList->count() != 1); - s->upButton->setVisible(m_buildStepList->count() != 1); + s->toolWidget->setDownVisible(m_buildStepList->count() != 1); + s->toolWidget->setUpVisible(m_buildStepList->count() != 1); } } diff --git a/src/plugins/projectexplorer/buildstepspage.h b/src/plugins/projectexplorer/buildstepspage.h index 33d2beef3b..7860d135ae 100644 --- a/src/plugins/projectexplorer/buildstepspage.h +++ b/src/plugins/projectexplorer/buildstepspage.h @@ -36,6 +36,7 @@ #include "buildstep.h" #include "deployconfiguration.h" #include "namedwidget.h" +#include <utils/detailsbutton.h> QT_BEGIN_NAMESPACE class QPushButton; @@ -43,6 +44,7 @@ class QToolButton; class QLabel; class QVBoxLayout; class QSignalMapper; +class QGraphicsOpacityEffect; QT_END_NAMESPACE namespace Utils { @@ -55,6 +57,50 @@ class Target; class BuildConfiguration; namespace Internal { +class FadingWidget : public QWidget +{ + Q_OBJECT +public: + FadingWidget(QWidget *parent = 0); + void fadeTo(qreal value); + qreal opacity(); + void setOpacity(qreal value); +protected: + QGraphicsOpacityEffect *m_opacityEffect; +}; + +class ToolWidget : public Utils::FadingPanel +{ + Q_OBJECT +public: + ToolWidget(QWidget *parent = 0); + + void fadeTo(qreal value); + void setOpacity(qreal value); + + void setBuildStepEnabled(bool b); + void setUpEnabled(bool b); + void setDownEnabled(bool b); + void setRemoveEnabled(bool b); + void setUpVisible(bool b); + void setDownVisible(bool b); +signals: + void disabledClicked(); + void upClicked(); + void downClicked(); + void removeClicked(); + +private: + QToolButton *m_disableButton; + QToolButton *m_upButton; + QToolButton *m_downButton; + QToolButton *m_removeButton; + + bool m_buildStepEnabled; + FadingWidget *m_firstWidget; + FadingWidget *m_secondWidget; + qreal m_targetOpacity; +}; class BuildStepsWidgetData { @@ -65,9 +111,7 @@ public: BuildStep *step; BuildStepConfigWidget *widget; Utils::DetailsWidget *detailsWidget; - QToolButton *upButton; - QToolButton *downButton; - QToolButton *removeButton; + ToolWidget *toolWidget; }; class BuildStepListWidget : public NamedWidget @@ -86,11 +130,13 @@ private slots: void addBuildStep(int pos); void updateSummary(); void updateAdditionalSummary(); + void updateEnabledState(); void triggerStepMoveUp(int pos); void stepMoved(int from, int to); void triggerStepMoveDown(int pos); void triggerRemoveBuildStep(int pos); void removeBuildStep(int pos); + void triggerDisable(int pos); private: void setupUi(); @@ -107,6 +153,7 @@ private: QLabel *m_noStepsLabel; QPushButton *m_addButton; + QSignalMapper *m_disableMapper; QSignalMapper *m_upMapper; QSignalMapper *m_downMapper; QSignalMapper *m_removeMapper; diff --git a/src/plugins/projectexplorer/images/disabledbuildstep.png b/src/plugins/projectexplorer/images/disabledbuildstep.png Binary files differnew file mode 100644 index 0000000000..81b50edbe7 --- /dev/null +++ b/src/plugins/projectexplorer/images/disabledbuildstep.png diff --git a/src/plugins/projectexplorer/processstep.cpp b/src/plugins/projectexplorer/processstep.cpp index ea687609fb..ac350c13eb 100644 --- a/src/plugins/projectexplorer/processstep.cpp +++ b/src/plugins/projectexplorer/processstep.cpp @@ -52,7 +52,6 @@ const char PROCESS_STEP_ID[] = "ProjectExplorer.ProcessStep"; const char PROCESS_COMMAND_KEY[] = "ProjectExplorer.ProcessStep.Command"; const char PROCESS_WORKINGDIRECTORY_KEY[] = "ProjectExplorer.ProcessStep.WorkingDirectory"; const char PROCESS_ARGUMENTS_KEY[] = "ProjectExplorer.ProcessStep.Arguments"; -const char PROCESS_ENABLED_KEY[] = "ProjectExplorer.ProcessStep.Enabled"; } ProcessStep::ProcessStep(BuildStepList *bsl) : @@ -71,8 +70,7 @@ ProcessStep::ProcessStep(BuildStepList *bsl, ProcessStep *bs) : AbstractProcessStep(bsl, bs), m_command(bs->m_command), m_arguments(bs->m_arguments), - m_workingDirectory(bs->m_workingDirectory), - m_enabled(bs->m_enabled) + m_workingDirectory(bs->m_workingDirectory) { ctor(); } @@ -100,7 +98,6 @@ bool ProcessStep::init() pp->setWorkingDirectory(workingDirectory()); pp->setCommand(m_command); pp->setArguments(m_arguments); - AbstractProcessStep::setEnabled(m_enabled); setOutputParser(bc->createOutputParser()); return AbstractProcessStep::init(); } @@ -130,11 +127,6 @@ QString ProcessStep::arguments() const return m_arguments; } -bool ProcessStep::enabled() const -{ - return m_enabled; -} - QString ProcessStep::workingDirectory() const { return m_workingDirectory; @@ -150,11 +142,6 @@ void ProcessStep::setArguments(const QString &arguments) m_arguments = arguments; } -void ProcessStep::setEnabled(bool enabled) -{ - m_enabled = enabled; -} - void ProcessStep::setWorkingDirectory(const QString &workingDirectory) { if (workingDirectory.isEmpty()) @@ -169,8 +156,6 @@ QVariantMap ProcessStep::toMap() const map.insert(QLatin1String(PROCESS_COMMAND_KEY), command()); map.insert(QLatin1String(PROCESS_ARGUMENTS_KEY), arguments()); map.insert(QLatin1String(PROCESS_WORKINGDIRECTORY_KEY), workingDirectory()); - map.insert(QLatin1String(PROCESS_ENABLED_KEY), enabled()); - return map; } @@ -179,7 +164,6 @@ bool ProcessStep::fromMap(const QVariantMap &map) setCommand(map.value(QLatin1String(PROCESS_COMMAND_KEY)).toString()); setArguments(map.value(QLatin1String(PROCESS_ARGUMENTS_KEY)).toString()); setWorkingDirectory(map.value(QLatin1String(PROCESS_WORKINGDIRECTORY_KEY)).toString()); - setEnabled(map.value(QLatin1String(PROCESS_ENABLED_KEY), false).toBool()); return AbstractProcessStep::fromMap(map); } @@ -271,7 +255,6 @@ ProcessStepConfigWidget::ProcessStepConfigWidget(ProcessStep *step) m_ui.workingDirectory->setPath(m_step->workingDirectory()); m_ui.commandArgumentsLineEdit->setText(m_step->arguments()); - m_ui.enabledCheckBox->setChecked(m_step->enabled()); updateDetails(); @@ -282,8 +265,6 @@ ProcessStepConfigWidget::ProcessStepConfigWidget(ProcessStep *step) connect(m_ui.commandArgumentsLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(commandArgumentsLineEditTextEdited())); - connect(m_ui.enabledCheckBox, SIGNAL(clicked(bool)), - this, SLOT(enabledCheckBoxClicked(bool))); } void ProcessStepConfigWidget::updateDetails() @@ -302,10 +283,6 @@ void ProcessStepConfigWidget::updateDetails() param.setCommand(m_step->command()); param.setArguments(m_step->arguments()); m_summaryText = param.summary(displayName); - if (!m_step->enabled()) { - //: %1 is the custom process step summary - m_summaryText = tr("%1 (disabled)").arg(m_summaryText); - } emit updateSummary(); } @@ -335,9 +312,3 @@ void ProcessStepConfigWidget::commandArgumentsLineEditTextEdited() m_step->setArguments(m_ui.commandArgumentsLineEdit->text()); updateDetails(); } - -void ProcessStepConfigWidget::enabledCheckBoxClicked(bool) -{ - m_step->setEnabled(m_ui.enabledCheckBox->isChecked()); - updateDetails(); -} diff --git a/src/plugins/projectexplorer/processstep.h b/src/plugins/projectexplorer/processstep.h index c2f71eb7e2..77c2e19f51 100644 --- a/src/plugins/projectexplorer/processstep.h +++ b/src/plugins/projectexplorer/processstep.h @@ -77,12 +77,10 @@ public: QString command() const; QString arguments() const; - bool enabled() const; QString workingDirectory() const; void setCommand(const QString &command); void setArguments(const QString &arguments); - void setEnabled(bool enabled); void setWorkingDirectory(const QString &workingDirectory); QVariantMap toMap() const; @@ -99,7 +97,6 @@ private: QString m_command; QString m_arguments; QString m_workingDirectory; - bool m_enabled; }; class ProcessStepConfigWidget : public BuildStepConfigWidget @@ -113,7 +110,6 @@ private slots: void commandLineEditTextEdited(); void workingDirectoryLineEditTextEdited(); void commandArgumentsLineEditTextEdited(); - void enabledCheckBoxClicked(bool); private: void updateDetails(); ProcessStep *m_step; diff --git a/src/plugins/projectexplorer/processstep.ui b/src/plugins/projectexplorer/processstep.ui index 5ab7b64484..864735b499 100644 --- a/src/plugins/projectexplorer/processstep.ui +++ b/src/plugins/projectexplorer/processstep.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>290</width> - <height>95</height> + <width>262</width> + <height>66</height> </rect> </property> <layout class="QFormLayout" name="formLayout"> @@ -15,47 +15,33 @@ <enum>QFormLayout::AllNonFixedFieldsGrow</enum> </property> <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Enable custom process step</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="enabledCheckBox"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="0"> <widget class="QLabel" name="commandLabel"> <property name="text"> <string>Command:</string> </property> </widget> </item> - <item row="1" column="1"> + <item row="0" column="1"> <widget class="Utils::PathChooser" name="command" native="true"/> </item> - <item row="2" column="0"> + <item row="1" column="0"> <widget class="QLabel" name="workingDirecoryLabel"> <property name="text"> <string>Working directory:</string> </property> </widget> </item> - <item row="2" column="1"> + <item row="1" column="1"> <widget class="Utils::PathChooser" name="workingDirectory" native="true"/> </item> - <item row="3" column="0"> + <item row="2" column="0"> <widget class="QLabel" name="commandArgumentsLabel"> <property name="text"> <string>Command arguments:</string> </property> </widget> </item> - <item row="3" column="1"> + <item row="2" column="1"> <widget class="QLineEdit" name="commandArgumentsLineEdit"/> </item> </layout> diff --git a/src/plugins/projectexplorer/projectexplorer.qrc b/src/plugins/projectexplorer/projectexplorer.qrc index dd78296d35..a4b8daf4f7 100644 --- a/src/plugins/projectexplorer/projectexplorer.qrc +++ b/src/plugins/projectexplorer/projectexplorer.qrc @@ -40,5 +40,6 @@ <file>images/targetremovebutton_disabled.png</file> <file>images/window.png</file> <file>images/stop_small.png</file> + <file>images/disabledbuildstep.png</file> </qresource> </RCC> diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp index 92a5c023e6..d65e82b40e 100644 --- a/src/plugins/projectexplorer/settingsaccessor.cpp +++ b/src/plugins/projectexplorer/settingsaccessor.cpp @@ -323,6 +323,22 @@ public: QVariantMap update(Project *project, const QVariantMap &map); }; +// Version 10 introduces disabling buildsteps, and handles upgrading custom process steps +class Version10Handler : public UserFileVersionHandler +{ +public: + int userFileVersion() const + { + return 10; + } + + QString displayUserFileVersion() const + { + return QLatin1String("2.5pre1"); + } + + QVariantMap update(Project *project, const QVariantMap &map); +}; } // namespace @@ -411,6 +427,7 @@ SettingsAccessor::SettingsAccessor() : addVersionHandler(new Version7Handler); addVersionHandler(new Version8Handler); addVersionHandler(new Version9Handler); + addVersionHandler(new Version10Handler); } SettingsAccessor::~SettingsAccessor() @@ -2250,3 +2267,12 @@ QVariantMap Version9Handler::update(Project *project, const QVariantMap &map) } return result; } + +QVariantMap Version10Handler::update(Project *project, const QVariantMap &map) +{ + Q_UNUSED(project); + QList<Change> changes; + changes.append(qMakePair(QLatin1String("ProjectExplorer.ProcessStep.Enabled"), + QLatin1String("ProjectExplorer.BuildStep.Enabled"))); + return renameKeys(changes, QVariantMap(map)); +} diff --git a/src/plugins/qt4projectmanager/makestep.cpp b/src/plugins/qt4projectmanager/makestep.cpp index c47799f4df..4c10ab9ec8 100644 --- a/src/plugins/qt4projectmanager/makestep.cpp +++ b/src/plugins/qt4projectmanager/makestep.cpp @@ -221,8 +221,6 @@ bool MakeStep::init() } pp->setEnvironment(env); - - setEnabled(true); pp->setArguments(args); ProjectExplorer::IOutputParser *parser = 0; diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp index 4c87368ccd..7752c91a53 100644 --- a/src/plugins/qt4projectmanager/qmakestep.cpp +++ b/src/plugins/qt4projectmanager/qmakestep.cpp @@ -284,7 +284,6 @@ bool QMakeStep::init() m_needToRunQMake = true; m_forced = false; - setEnabled(m_needToRunQMake); ProcessParameters *pp = processParameters(); pp->setMacroExpander(qt4bc->macroExpander()); pp->setWorkingDirectory(workingDirectory); |