Commit 0d9e4b74 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

QMakeProfileInformation: Report mkspec in a better way



Report teh effective, default and set mkspec separately to improve
the importing and the UI.

Change-Id: I6087950cd961829d7fcf60b3f6de317a02444631
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 0a6e31d8
......@@ -63,19 +63,8 @@ unsigned int QmakeProfileInformation::priority() const
QVariant QmakeProfileInformation::defaultValue(ProjectExplorer::Profile *p) const
{
QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
if (!version) // No version, so no qmake
Q_UNUSED(p);
return QString();
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.toString();
}
return version ? version->mkspec().toString() : QString();
}
QList<ProjectExplorer::Task> QmakeProfileInformation::validate(ProjectExplorer::Profile *p) const
......@@ -115,9 +104,39 @@ Utils::FileName QmakeProfileInformation::mkspec(const ProjectExplorer::Profile *
return Utils::FileName::fromString(p->value(Core::Id(Internal::MKSPEC_INFORMATION)).toString());
}
Utils::FileName QmakeProfileInformation::effectiveMkspec(const ProjectExplorer::Profile *p)
{
if (!p)
return Utils::FileName();
Utils::FileName spec = mkspec(p);
if (spec.isEmpty())
return defaultMkspec(p);
return spec;
}
void QmakeProfileInformation::setMkspec(ProjectExplorer::Profile *p, const Utils::FileName &fn)
{
if (fn == defaultMkspec(p))
p->setValue(Core::Id(Internal::MKSPEC_INFORMATION), QString());
else
p->setValue(Core::Id(Internal::MKSPEC_INFORMATION), fn.toString());
}
Utils::FileName QmakeProfileInformation::defaultMkspec(const ProjectExplorer::Profile *p)
{
QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
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();
}
} // namespace Qt4ProjectManager
......@@ -58,8 +58,11 @@ public:
ItemList toUserOutput(ProjectExplorer::Profile *p) const;
static Utils::FileName mkspec(const ProjectExplorer::Profile *p);
static void setMkspec(ProjectExplorer::Profile *p, const Utils::FileName &fn);
static Utils::FileName mkspec(const ProjectExplorer::Profile *p);
static Utils::FileName effectiveMkspec(const ProjectExplorer::Profile *p);
static Utils::FileName defaultMkspec(const ProjectExplorer::Profile *p);
};
} // namespace Qt4ProjectManager
......
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