forked from qt-creator/qt-creator
ProjectExplorer: Add more variables for active project
Fixes: QTCREATORBUG-25206 Change-Id: I3826824de73ef15138e037a7134592e4aa13130f Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -328,10 +328,15 @@ static BuildConfiguration *currentBuildConfiguration()
|
|||||||
return target ? target->activeBuildConfiguration() : nullptr;
|
return target ? target->activeBuildConfiguration() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BuildConfiguration *activeBuildConfiguration()
|
static Target *activeTarget()
|
||||||
{
|
{
|
||||||
const Project * const project = SessionManager::startupProject();
|
const Project * const project = SessionManager::startupProject();
|
||||||
const Target * const target = project ? project->activeTarget() : nullptr;
|
return project ? project->activeTarget() : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BuildConfiguration *activeBuildConfiguration()
|
||||||
|
{
|
||||||
|
const Target * const target = activeTarget();
|
||||||
return target ? target->activeBuildConfiguration() : nullptr;
|
return target ? target->activeBuildConfiguration() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1823,6 +1828,20 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
return project->projectFilePath().toString();
|
return project->projectFilePath().toString();
|
||||||
return {};
|
return {};
|
||||||
});
|
});
|
||||||
|
expander->registerVariable("ActiveProject:Kit:Name",
|
||||||
|
"The name of the active project's active kit.", // TODO: tr()
|
||||||
|
[]() -> QString {
|
||||||
|
if (const Target * const target = activeTarget())
|
||||||
|
return target->kit()->displayName();
|
||||||
|
return {};
|
||||||
|
});
|
||||||
|
expander->registerVariable("ActiveProject:BuildConfig:Name",
|
||||||
|
"The name of the active project's active build configuration.", // TODO: tr()
|
||||||
|
[]() -> QString {
|
||||||
|
if (const BuildConfiguration * const bc = activeBuildConfiguration())
|
||||||
|
return bc->displayName();
|
||||||
|
return {};
|
||||||
|
});
|
||||||
expander->registerVariable("ActiveProject:BuildConfig:Type",
|
expander->registerVariable("ActiveProject:BuildConfig:Type",
|
||||||
tr("The type of the active project's active build configuration."),
|
tr("The type of the active project's active build configuration."),
|
||||||
[]() -> QString {
|
[]() -> QString {
|
||||||
|
Reference in New Issue
Block a user