Commit 55324926 authored by Daniel Teske's avatar Daniel Teske
Browse files

Show a message box on importing the same build twice



Task-number: QTCREATORBUG-6788

Change-Id: I65f40c440fb5dd8927d4a1ec8cf4f352ac2eb4be
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 28560dc3
......@@ -52,6 +52,16 @@ struct QT4PROJECTMANAGER_EXPORT BuildConfigurationInfo {
return version != 0;
}
bool operator ==(const BuildConfigurationInfo &other) const
{
return version == other.version
&& buildConfig == other.buildConfig
&& additionalArguments == other.additionalArguments
&& directory == other.directory
&& importing == other.importing
&& temporaryQtVersion == other.temporaryQtVersion;
}
QtSupport::BaseQtVersion *version;
QtSupport::BaseQtVersion::QmakeBuildConfigs buildConfig;
QString additionalArguments;
......
......@@ -777,6 +777,7 @@ void Qt4DefaultTargetSetupWidget::addImportClicked()
m_importLineLayout->invalidate();
return;
}
QList<BuildConfigurationInfo> infos = BuildConfigurationInfo::checkForBuild(m_importLinePath->path(), m_proFilePath);
if (infos.isEmpty()) {
QMessageBox::critical(this,
......@@ -804,6 +805,28 @@ void Qt4DefaultTargetSetupWidget::addImportClicked()
// show something if we found incompatible builds?
}
// Filter out already imported builds
infos = filterdInfos;
filterdInfos.clear();
foreach (const BuildConfigurationInfo &info, infos) {
bool alreadyImported = false;
foreach (const BuildConfigurationInfo &existingImport, m_importInfos) {
if (info == existingImport) {
alreadyImported = true;
break;
}
}
if (!alreadyImported)
filterdInfos << info;
}
if (filterdInfos.isEmpty() && !infos.isEmpty()) {
QMessageBox::critical(this,
tr("Already imported build"),
tr("The build found in %1 is already imported").arg(m_importLinePath->path()));
return;
}
// We switch from to "NONE" on importing if the user has not changed it
if (m_buildConfigurationTemplateUnchanged)
setBuildConfigurationTemplate(NONE);
......
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