forked from qt-creator/qt-creator
ProjectExplorer: Use expanded run config display names
... in the "Add new run configuration" dialog. Otherwise users will see placeholders in e.g. the RemoteLinux case. Change-Id: Id8b22f4e51b83a2b061fd74bbe9649bee44fc0af Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -51,8 +51,9 @@ class CandidateTreeItem : public TreeItem
|
|||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Internal::AddRunConfigDialog)
|
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Internal::AddRunConfigDialog)
|
||||||
public:
|
public:
|
||||||
CandidateTreeItem(const RunConfigurationCreationInfo &rci, const FilePath &projectRoot)
|
CandidateTreeItem(const RunConfigurationCreationInfo &rci, const Target *target)
|
||||||
: m_creationInfo(rci), m_projectRoot(projectRoot)
|
: m_creationInfo(rci), m_projectRoot(target->project()->projectDirectory()),
|
||||||
|
m_displayName(target->macroExpander()->expand(rci.displayName))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
RunConfigurationCreationInfo creationInfo() const { return m_creationInfo; }
|
RunConfigurationCreationInfo creationInfo() const { return m_creationInfo; }
|
||||||
@@ -64,7 +65,7 @@ private:
|
|||||||
if (role == IsCustomRole)
|
if (role == IsCustomRole)
|
||||||
return m_creationInfo.projectFilePath.isEmpty();
|
return m_creationInfo.projectFilePath.isEmpty();
|
||||||
if (column == 0 && role == Qt::DisplayRole)
|
if (column == 0 && role == Qt::DisplayRole)
|
||||||
return m_creationInfo.displayName;
|
return m_displayName;
|
||||||
if (column == 1 && role == Qt::DisplayRole) {
|
if (column == 1 && role == Qt::DisplayRole) {
|
||||||
FilePath displayPath = m_creationInfo.projectFilePath.relativeChildPath(m_projectRoot);
|
FilePath displayPath = m_creationInfo.projectFilePath.relativeChildPath(m_projectRoot);
|
||||||
if (displayPath.isEmpty()) {
|
if (displayPath.isEmpty()) {
|
||||||
@@ -78,6 +79,7 @@ private:
|
|||||||
|
|
||||||
const RunConfigurationCreationInfo m_creationInfo;
|
const RunConfigurationCreationInfo m_creationInfo;
|
||||||
const FilePath m_projectRoot;
|
const FilePath m_projectRoot;
|
||||||
|
const QString m_displayName;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CandidatesModel : public TreeModel<TreeItem, CandidateTreeItem>
|
class CandidatesModel : public TreeModel<TreeItem, CandidateTreeItem>
|
||||||
@@ -89,8 +91,7 @@ public:
|
|||||||
setHeader({tr("Name"), tr("Source")});
|
setHeader({tr("Name"), tr("Source")});
|
||||||
for (const RunConfigurationCreationInfo &rci
|
for (const RunConfigurationCreationInfo &rci
|
||||||
: RunConfigurationFactory::creatorsForTarget(target)) {
|
: RunConfigurationFactory::creatorsForTarget(target)) {
|
||||||
rootItem()->appendChild(new CandidateTreeItem(rci,
|
rootItem()->appendChild(new CandidateTreeItem(rci, target));
|
||||||
target->project()->projectDirectory()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user