forked from qt-creator/qt-creator
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: Ulf Hermann <ulf.hermann@theqtcompany.com>
This commit is contained in:
@@ -306,6 +306,21 @@ QString BuildConfiguration::disabledReason() const
|
|||||||
return QString();
|
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
|
// IBuildConfigurationFactory
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ public:
|
|||||||
};
|
};
|
||||||
virtual BuildType buildType() const = 0;
|
virtual BuildType buildType() const = 0;
|
||||||
|
|
||||||
|
static QString buildTypeName(BuildType type);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void environmentChanged();
|
void environmentChanged();
|
||||||
void buildDirectoryChanged();
|
void buildDirectoryChanged();
|
||||||
|
|||||||
@@ -1371,16 +1371,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
expander->registerVariable(Constants::VAR_CURRENTBUILD_TYPE,
|
expander->registerVariable(Constants::VAR_CURRENTBUILD_TYPE,
|
||||||
tr("The currently active build configuration's type."),
|
tr("The currently active build configuration's type."),
|
||||||
[&]() -> QString {
|
[&]() -> QString {
|
||||||
if (BuildConfiguration *bc = activeBuildConfiguration()) {
|
BuildConfiguration *bc = activeBuildConfiguration();
|
||||||
BuildConfiguration::BuildType type = bc->buildType();
|
const BuildConfiguration::BuildType type
|
||||||
if (type == BuildConfiguration::Debug)
|
= bc ? bc->buildType() : BuildConfiguration::Unknown;
|
||||||
return QLatin1String("debug");
|
return BuildConfiguration::buildTypeName(type);
|
||||||
if (type == BuildConfiguration::Release)
|
|
||||||
return QLatin1String("release");
|
|
||||||
if (type == BuildConfiguration::Profile)
|
|
||||||
return QLatin1String("profile");
|
|
||||||
}
|
|
||||||
return tr("unknown");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user