Qt4ProjectManager: Warn of a existing build for a diffrent project

Task-Nr: QTCREATORBUG-2113

Reviewed-By: hunger
This commit is contained in:
dt
2010-10-07 12:08:46 +02:00
parent fe8f2c2b1a
commit 224ca48e84

View File

@@ -295,6 +295,7 @@ void Qt4ProjectConfigWidget::updateImportLabel()
{
bool visible = false;
bool targetMatches = false;
bool incompatibleBuild = false;
QtVersionManager *vm = QtVersionManager::instance();
// we only show if we actually have a qmake and makestep
@@ -309,8 +310,11 @@ void Qt4ProjectConfigWidget::updateImportLabel()
QtVersion *version = m_buildConfiguration->qtVersion();
// check that there's a makefile
if (!qmakePath.isEmpty()) {
// Is it from the same build?
if (!QtVersionManager::makefileIsFor(makefile, m_buildConfiguration->target()->project()->file()->fileName())) {
incompatibleBuild = true;
} else if (qmakePath != (version ? version->qmakeCommand() : QString())) {
// and that the qmake path is different from the current version
if (qmakePath != (version ? version->qmakeCommand() : QString())) {
// import enable
visible = true;
QtVersion *newVersion = vm->qtVersionForQMakeBinary(qmakePath);
@@ -327,8 +331,6 @@ void Qt4ProjectConfigWidget::updateImportLabel()
visible = !m_buildConfiguration->compareToImportFrom(makefile);
targetMatches = true;
}
} else {
visible = false;
}
}
@@ -338,7 +340,14 @@ void Qt4ProjectConfigWidget::updateImportLabel()
QList<ProjectExplorer::Task> issues = m_buildConfiguration->qtVersion()->reportIssues(m_buildConfiguration->target()->project()->file()->fileName(),
buildDirectory);
if (!issues.isEmpty()) {
if (incompatibleBuild) {
m_ui->problemLabel->setVisible(true);
m_ui->warningLabel->setVisible(true);
m_ui->importLabel->setVisible(false);
m_ui->problemLabel->setText(tr("An build for a different project exists in %1, which will be overwritten.",
"%1 build directory").
arg(m_ui->shadowBuildDirEdit->path()));
} else if (!issues.isEmpty()) {
m_ui->problemLabel->setVisible(true);
m_ui->warningLabel->setVisible(true);
m_ui->importLabel->setVisible(visible);