Commit 66efe78b authored by Tobias Hunger's avatar Tobias Hunger

BuildConfiguration: Add static helper to turn buildtype into a string

Use that helper in the projectexplorer instead of hardcoding a mapping
there.

Change-Id: I8720607a869c086569661fc9e9326ed6e0f85bb3
Reviewed-by: default avatarUlf Hermann <ulf.hermann@theqtcompany.com>
parent ea128cd8
......@@ -306,6 +306,21 @@ QString BuildConfiguration::disabledReason() const
return QString();
}
QString BuildConfiguration::buildTypeName(BuildConfiguration::BuildType type)
{
switch (type) {
case ProjectExplorer::BuildConfiguration::Debug:
return QLatin1String("debug");
case ProjectExplorer::BuildConfiguration::Profile:
return QLatin1String("profile");
case ProjectExplorer::BuildConfiguration::Release:
return QLatin1String("release");
case ProjectExplorer::BuildConfiguration::Unknown: // fallthrough
default:
return QLatin1String("unknown");
}
}
///
// IBuildConfigurationFactory
///
......
......@@ -91,6 +91,8 @@ public:
};
virtual BuildType buildType() const = 0;
static QString buildTypeName(BuildType type);
signals:
void environmentChanged();
void buildDirectoryChanged();
......
......@@ -1371,16 +1371,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
expander->registerVariable(Constants::VAR_CURRENTBUILD_TYPE,
tr("The currently active build configuration's type."),
[&]() -> QString {
if (BuildConfiguration *bc = activeBuildConfiguration()) {
BuildConfiguration::BuildType type = bc->buildType();
if (type == BuildConfiguration::Debug)
return QLatin1String("debug");
if (type == BuildConfiguration::Release)
return QLatin1String("release");
if (type == BuildConfiguration::Profile)
return QLatin1String("profile");
}
return tr("unknown");
BuildConfiguration *bc = activeBuildConfiguration();
const BuildConfiguration::BuildType type
= bc ? bc->buildType() : BuildConfiguration::Unknown;
return BuildConfiguration::buildTypeName(type);
});
......
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