Warn the user against building in a subdirectory of the source directory

Reviewed-By: hunger
Task-Nr: QTCREATORBUG-670
This commit is contained in:
dt
2010-03-23 16:02:59 +01:00
parent 2d5f60d6de
commit f8db7aca18
2 changed files with 24 additions and 12 deletions

View File

@@ -319,16 +319,28 @@ void Qt4ProjectConfigWidget::updateImportLabel()
} }
} }
if (targetMatches) { QString sourceDirectory =
m_ui->importProblemLabel->setVisible(false); QFileInfo(m_buildConfiguration->qt4Target()->qt4Project()->file()->fileName()).absolutePath();
m_ui->importWarningLabel->setVisible(false); if (!sourceDirectory.endsWith('/'))
sourceDirectory.append('/');
bool invalidBuildDirectory = m_buildConfiguration->shadowBuild()
&& m_buildConfiguration->buildDirectory().startsWith(sourceDirectory);
if (invalidBuildDirectory) {
m_ui->problemLabel->setVisible(true);
m_ui->warningLabel->setVisible(true);
m_ui->importLabel->setVisible(visible);
m_ui->problemLabel->setText(tr("Building in subdirectories of the source directory is not supported by qmake."));
} else if (targetMatches) {
m_ui->problemLabel->setVisible(false);
m_ui->warningLabel->setVisible(false);
m_ui->importLabel->setVisible(visible); m_ui->importLabel->setVisible(visible);
} else { } else {
m_ui->importWarningLabel->setVisible(visible); m_ui->warningLabel->setVisible(visible);
m_ui->importProblemLabel->setVisible(visible); m_ui->problemLabel->setVisible(visible);
m_ui->importProblemLabel->setText(tr("An incompatible build exists in %1, which will be overwritten.", m_ui->problemLabel->setText(tr("An incompatible build exists in %1, which will be overwritten.",
"%1 build directory"). "%1 build directory").
arg(m_ui->shadowBuildDirEdit->path())); arg(m_ui->shadowBuildDirEdit->path()));
m_ui->importLabel->setVisible(false); m_ui->importLabel->setVisible(false);
} }
} }

View File

@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>487</width> <width>712</width>
<height>194</height> <height>194</height>
</rect> </rect>
</property> </property>
@@ -138,16 +138,16 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="importWarningLabel"> <widget class="QLabel" name="warningLabel">
<property name="pixmap"> <property name="pixmap">
<pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap> <pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="importProblemLabel"> <widget class="QLabel" name="problemLabel">
<property name="text"> <property name="text">
<string>The Qt Version about to be imported does not support this target.</string> <string>problemLabel</string>
</property> </property>
</widget> </widget>
</item> </item>