forked from qt-creator/qt-creator
Prevent removing buildsteps if the buildsteps are queued for building.
Task-Nr: QTCREATORBUG-1044
This commit is contained in:
@@ -32,6 +32,8 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
#include <projectexplorer/buildmanager.h>
|
||||||
|
|
||||||
#include <QtCore/QProcess>
|
#include <QtCore/QProcess>
|
||||||
|
|
||||||
@@ -187,11 +189,18 @@ void BuildConfiguration::insertStep(StepType type, int position, BuildStep *step
|
|||||||
m_steps[type].insert(position, step);
|
m_steps[type].insert(position, step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildConfiguration::removeStep(StepType type, int position)
|
bool BuildConfiguration::removeStep(StepType type, int position)
|
||||||
{
|
{
|
||||||
Q_ASSERT(type >= 0 && type < LastStepType);
|
Q_ASSERT(type >= 0 && type < LastStepType);
|
||||||
|
|
||||||
|
ProjectExplorer::BuildManager *bm =
|
||||||
|
ProjectExplorer::ProjectExplorerPlugin::instance()->buildManager();
|
||||||
|
if (bm->isBuilding(m_steps[type].at(position)))
|
||||||
|
return false;
|
||||||
|
|
||||||
delete m_steps[type].at(position);
|
delete m_steps[type].at(position);
|
||||||
m_steps[type].removeAt(position);
|
m_steps[type].removeAt(position);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildConfiguration::moveStepUp(StepType type, int position)
|
void BuildConfiguration::moveStepUp(StepType type, int position)
|
||||||
|
@@ -55,7 +55,7 @@ public:
|
|||||||
|
|
||||||
QList<BuildStep *> steps(StepType type) const;
|
QList<BuildStep *> steps(StepType type) const;
|
||||||
void insertStep(StepType type, int position, BuildStep *step);
|
void insertStep(StepType type, int position, BuildStep *step);
|
||||||
void removeStep(StepType type, int position);
|
bool removeStep(StepType type, int position);
|
||||||
void moveStepUp(StepType type, int position);
|
void moveStepUp(StepType type, int position);
|
||||||
|
|
||||||
virtual QString buildDirectory() const = 0;
|
virtual QString buildDirectory() const = 0;
|
||||||
|
@@ -465,6 +465,11 @@ bool BuildManager::isBuilding(Project *pro)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BuildManager::isBuilding(BuildStep *step)
|
||||||
|
{
|
||||||
|
return (m_currentBuildStep == step) || m_buildQueue.contains(step);
|
||||||
|
}
|
||||||
|
|
||||||
void BuildManager::incrementActiveBuildSteps(Project *pro)
|
void BuildManager::incrementActiveBuildSteps(Project *pro)
|
||||||
{
|
{
|
||||||
QHash<Project *, int>::iterator it = m_activeBuildSteps.find(pro);
|
QHash<Project *, int>::iterator it = m_activeBuildSteps.find(pro);
|
||||||
|
@@ -75,6 +75,7 @@ public:
|
|||||||
void cleanProject(BuildConfiguration *configuration);
|
void cleanProject(BuildConfiguration *configuration);
|
||||||
void cleanProjects(const QList<BuildConfiguration *> &configurations);
|
void cleanProjects(const QList<BuildConfiguration *> &configurations);
|
||||||
bool isBuilding(Project *p);
|
bool isBuilding(Project *p);
|
||||||
|
bool isBuilding(BuildStep *step);
|
||||||
|
|
||||||
// Append any build step to the list of build steps (currently only used to add the QMakeStep)
|
// Append any build step to the list of build steps (currently only used to add the QMakeStep)
|
||||||
void appendStep(BuildStep *step);
|
void appendStep(BuildStep *step);
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "buildconfiguration.h"
|
#include "buildconfiguration.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -42,6 +43,8 @@
|
|||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
#include <QtGui/QHBoxLayout>
|
#include <QtGui/QHBoxLayout>
|
||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
|
#include <QtGui/QMessageBox>
|
||||||
|
#include <QtGui/QMainWindow>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
@@ -241,16 +244,22 @@ void BuildStepsPage::stepMoveDown(int pos)
|
|||||||
|
|
||||||
void BuildStepsPage::stepRemove(int pos)
|
void BuildStepsPage::stepRemove(int pos)
|
||||||
{
|
{
|
||||||
|
if (m_configuration->removeStep(m_type, pos)) {
|
||||||
BuildStepsWidgetStruct s = m_buildSteps.at(pos);
|
BuildStepsWidgetStruct s = m_buildSteps.at(pos);
|
||||||
delete s.widget;
|
delete s.widget;
|
||||||
delete s.detailsWidget;
|
delete s.detailsWidget;
|
||||||
m_buildSteps.removeAt(pos);
|
m_buildSteps.removeAt(pos);
|
||||||
m_configuration->removeStep(m_type, pos);
|
|
||||||
|
|
||||||
updateBuildStepButtonsState();
|
updateBuildStepButtonsState();
|
||||||
|
|
||||||
bool hasSteps = m_configuration->steps(m_type).isEmpty();
|
bool hasSteps = m_configuration->steps(m_type).isEmpty();
|
||||||
m_noStepsLabel->setVisible(hasSteps);
|
m_noStepsLabel->setVisible(hasSteps);
|
||||||
|
} else {
|
||||||
|
QMessageBox::warning(Core::ICore::instance()->mainWindow(),
|
||||||
|
tr("Removing Step failed"),
|
||||||
|
tr("Can't remove build step while building"),
|
||||||
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildStepsPage::setupUi()
|
void BuildStepsPage::setupUi()
|
||||||
|
Reference in New Issue
Block a user