forked from qt-creator/qt-creator
AutoTest: Only write values that are not default to user files
Change-Id: I0e36cdbc850c148e5fa7c865f3f1136a4dc8a11f Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -47,18 +47,21 @@ public:
|
||||
void clear() { m_cache.clear(); }
|
||||
bool isEmpty() const { return m_cache.isEmpty(); }
|
||||
|
||||
QVariantMap toSettings() const
|
||||
QVariantMap toSettings(const T &valueToIgnore) const
|
||||
{
|
||||
QVariantMap result;
|
||||
for (auto it = m_cache.cbegin(), end = m_cache.cend(); it != end; ++it)
|
||||
for (auto it = m_cache.cbegin(), end = m_cache.cend(); it != end; ++it) {
|
||||
if (it.value().value == valueToIgnore)
|
||||
continue;
|
||||
result.insert(QString::number(it.value().type) + '@'
|
||||
+ it.key(), QVariant::fromValue(it.value().value));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void fromSettings(const QVariantMap &stored)
|
||||
{
|
||||
const QRegularExpression regex("^((\\d+)@)?(.*)$");
|
||||
static const QRegularExpression regex("^((\\d+)@)?(.*)$");
|
||||
m_cache.clear();
|
||||
for (auto it = stored.cbegin(), end = stored.cend(); it != end; ++it) {
|
||||
const QRegularExpressionMatch match = regex.match(it.key());
|
||||
|
@@ -108,7 +108,7 @@ void TestProjectSettings::save()
|
||||
activeFrameworks.insert(it.key()->id().toString(), it.value());
|
||||
m_project->setNamedSettings(SK_ACTIVE_FRAMEWORKS, activeFrameworks);
|
||||
m_project->setNamedSettings(SK_RUN_AFTER_BUILD, int(m_runAfterBuild));
|
||||
m_project->setNamedSettings(SK_CHECK_STATES, m_checkStateCache.toSettings());
|
||||
m_project->setNamedSettings(SK_CHECK_STATES, m_checkStateCache.toSettings(Qt::Checked));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user