ProjectExplorer: Don't store ProjectConfiguration's default display name

The default display name, if there is one, is always set by the
constructor and/or the factory, and thus does not need to get stored. In
fact, storing it can lead to unwanted effects such as the value not
updating after a language change.

Task-number: QTCREATORBUG-16281
Change-Id: I200cf84a7304e41994ba3ebe69cd759b051cbac7
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-08-01 13:03:35 +02:00
parent eaea7eb213
commit 1d7f6fe298

View File

@@ -33,7 +33,6 @@ using namespace ProjectExplorer;
const char CONFIGURATION_ID_KEY[] = "ProjectExplorer.ProjectConfiguration.Id"; const char CONFIGURATION_ID_KEY[] = "ProjectExplorer.ProjectConfiguration.Id";
const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DisplayName"; const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DisplayName";
const char DEFAULT_DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DefaultDisplayName";
// ProjectConfigurationAspect // ProjectConfigurationAspect
@@ -164,10 +163,7 @@ QVariantMap ProjectConfiguration::toMap() const
QVariantMap map; QVariantMap map;
map.insert(QLatin1String(CONFIGURATION_ID_KEY), m_id.toSetting()); map.insert(QLatin1String(CONFIGURATION_ID_KEY), m_id.toSetting());
map.insert(QLatin1String(DISPLAY_NAME_KEY), m_displayName); map.insert(QLatin1String(DISPLAY_NAME_KEY), m_displayName);
map.insert(QLatin1String(DEFAULT_DISPLAY_NAME_KEY), m_defaultDisplayName);
m_aspects.toMap(map); m_aspects.toMap(map);
return map; return map;
} }
@@ -185,12 +181,7 @@ bool ProjectConfiguration::fromMap(const QVariantMap &map)
QTC_ASSERT(id.toString().startsWith(m_id.toString()), return false); QTC_ASSERT(id.toString().startsWith(m_id.toString()), return false);
m_displayName = map.value(QLatin1String(DISPLAY_NAME_KEY), QString()).toString(); m_displayName = map.value(QLatin1String(DISPLAY_NAME_KEY), QString()).toString();
m_defaultDisplayName = map.value(QLatin1String(DEFAULT_DISPLAY_NAME_KEY),
m_defaultDisplayName.isEmpty() ?
m_displayName : m_defaultDisplayName).toString();
m_aspects.fromMap(map); m_aspects.fromMap(map);
return true; return true;
} }