Commit 146cc5f9 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Fix profiles getting added again on import



Task-number: QTCREATORBUG-7564
Change-Id: Ida6ee81cc4bde9766f07755f908af5be726f8645
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 4ff64681
......@@ -128,15 +128,7 @@ Utils::FileName QmakeProfileInformation::defaultMkspec(const ProjectExplorer::Pr
if (!version) // No version, so no qmake
return Utils::FileName();
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
const QList<Utils::FileName> tcSpecList = tc ? tc->suggestedMkspecList() : QList<Utils::FileName>();
foreach (const Utils::FileName &tcSpec, tcSpecList) {
if (version->hasMkspec(tcSpec))
return tcSpec;
}
return version ? version->mkspec() : Utils::FileName();
return version->mkspecFor(ProjectExplorer::ToolChainProfileInformation::toolChain(p));
}
} // namespace Qt4ProjectManager
......@@ -164,8 +164,10 @@ void TargetSetupPage::setImportSearch(bool b)
void TargetSetupPage::setupWidgets()
{
// Known profiles:
foreach (ProjectExplorer::Profile *p, ProjectExplorer::ProfileManager::instance()->profiles(m_requiredMatcher))
foreach (ProjectExplorer::Profile *p, ProjectExplorer::ProfileManager::instance()->profiles(m_requiredMatcher)) {
cleanProfile(p); // clean up broken profiles added by some development versions of QtC
addWidget(p);
}
// Setup import widget:
m_baseLayout->addWidget(m_importWidget);
......@@ -231,6 +233,9 @@ void TargetSetupPage::makeQtPersistent(ProjectExplorer::Profile *p)
void TargetSetupPage::addProject(ProjectExplorer::Profile *p, const QString &path)
{
if (!p->hasValue(PROFILE_IS_TEMPORARY))
return;
QStringList profiles = p->value(TEMPORARY_OF_PROJECTS, QStringList()).toStringList();
Q_ASSERT(!profiles.contains(path));
profiles.append(path);
......@@ -339,15 +344,17 @@ void TargetSetupPage::import(const Utils::FileName &path, const bool silent)
foreach (ProjectExplorer::Profile *p, pm->profiles()) {
QtSupport::BaseQtVersion *profileVersion = QtSupport::QtProfileInformation::qtVersion(p);
Utils::FileName profileSpec = QmakeProfileInformation::mkspec(p);
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
if (profileSpec.isEmpty() && profileVersion)
profileSpec = profileVersion->mkspecFor(tc);
if (profileVersion == version
&& profileSpec == parsedSpec) {
Q_ASSERT(!temporaryVersion);
&& profileSpec == parsedSpec)
profile = p;
}
}
if (!profile)
profile = createTemporaryProfile(version, temporaryVersion, parsedSpec);
else if (profile->hasValue(PROFILE_IS_TEMPORARY))
else
addProject(profile, m_proFilePath);
// Create widget:
......
......@@ -760,6 +760,20 @@ Utils::FileName BaseQtVersion::mkspec() const
return m_mkspec;
}
Utils::FileName BaseQtVersion::mkspecFor(ProjectExplorer::ToolChain *tc) const
{
if (!tc)
return mkspec();
const QList<Utils::FileName> tcSpecList = tc->suggestedMkspecList();
foreach (const Utils::FileName &tcSpec, tcSpecList) {
if (hasMkspec(tcSpec))
return tcSpec;
}
return mkspec();
}
Utils::FileName BaseQtVersion::mkspecPath() const
{
updateMkspec();
......
......@@ -162,6 +162,7 @@ public:
/// @returns the name of the mkspec
Utils::FileName mkspec() const;
Utils::FileName mkspecFor(ProjectExplorer::ToolChain *tc) const;
/// @returns the full path to the default directory
/// specifally not the directory the symlink/ORIGINAL_QMAKESPEC points to
Utils::FileName mkspecPath() const;
......
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