Commit f8db7aca authored by dt's avatar dt
Browse files

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

Reviewed-By: hunger
Task-Nr: QTCREATORBUG-670
parent 2d5f60d6
......@@ -319,16 +319,28 @@ void Qt4ProjectConfigWidget::updateImportLabel()
}
}
if (targetMatches) {
m_ui->importProblemLabel->setVisible(false);
m_ui->importWarningLabel->setVisible(false);
QString sourceDirectory =
QFileInfo(m_buildConfiguration->qt4Target()->qt4Project()->file()->fileName()).absolutePath();
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);
} else {
m_ui->importWarningLabel->setVisible(visible);
m_ui->importProblemLabel->setVisible(visible);
m_ui->importProblemLabel->setText(tr("An incompatible build exists in %1, which will be overwritten.",
"%1 build directory").
arg(m_ui->shadowBuildDirEdit->path()));
m_ui->warningLabel->setVisible(visible);
m_ui->problemLabel->setVisible(visible);
m_ui->problemLabel->setText(tr("An incompatible build exists in %1, which will be overwritten.",
"%1 build directory").
arg(m_ui->shadowBuildDirEdit->path()));
m_ui->importLabel->setVisible(false);
}
}
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>487</width>
<width>712</width>
<height>194</height>
</rect>
</property>
......@@ -138,16 +138,16 @@
</widget>
</item>
<item>
<widget class="QLabel" name="importWarningLabel">
<widget class="QLabel" name="warningLabel">
<property name="pixmap">
<pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="importProblemLabel">
<widget class="QLabel" name="problemLabel">
<property name="text">
<string>The Qt Version about to be imported does not support this target.</string>
<string>problemLabel</string>
</property>
</widget>
</item>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment