AutoTest: Simplify settings handling

There is no need to check complete settings whether something has
changed before setting them.
Limit the check to what is needed and remove unneeded functionality.

Change-Id: Icdf99d89d795edc20338a774ca7e90b1e4f1e417
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2016-09-16 07:46:05 +02:00
parent f1a85e1441
commit fde344fff3
3 changed files with 10 additions and 33 deletions

View File

@@ -128,23 +128,6 @@ void TestSettings::fromSettings(const QSettings *s)
} }
} }
bool TestSettings::equals(const TestSettings &rhs) const
{
return timeout == rhs.timeout && metrics == rhs.metrics
&& omitInternalMssg == rhs.omitInternalMssg
&& omitRunConfigWarn == rhs.omitRunConfigWarn
&& limitResultOutput == rhs.limitResultOutput
&& autoScroll == rhs.autoScroll
&& alwaysParse == rhs.alwaysParse
&& qtestNoCrashHandler == rhs.qtestNoCrashHandler
&& gtestRunDisabled == rhs.gtestRunDisabled
&& gtestRepeat == rhs.gtestRepeat && gtestIterations == rhs.gtestIterations
&& gtestShuffle == rhs.gtestShuffle && gtestSeed == rhs.gtestSeed
&& gtestBreakOnFailure == rhs.gtestBreakOnFailure
&& gtestThrowOnFailure == rhs.gtestThrowOnFailure
&& frameworks == rhs.frameworks;
}
QString TestSettings::metricsTypeToOption(const MetricsType type) QString TestSettings::metricsTypeToOption(const MetricsType type)
{ {
switch (type) { switch (type) {

View File

@@ -49,7 +49,6 @@ struct TestSettings
TestSettings(); TestSettings();
void toSettings(QSettings *s) const; void toSettings(QSettings *s) const;
void fromSettings(const QSettings *s); void fromSettings(const QSettings *s);
bool equals(const TestSettings &rhs) const;
static QString metricsTypeToOption(const MetricsType type); static QString metricsTypeToOption(const MetricsType type);
int timeout; int timeout;
@@ -70,8 +69,5 @@ struct TestSettings
QHash<Core::Id, bool> frameworks; QHash<Core::Id, bool> frameworks;
}; };
inline bool operator==(const TestSettings &s1, const TestSettings &s2) { return s1.equals(s2); }
inline bool operator!=(const TestSettings &s1, const TestSettings &s2) { return !s1.equals(s2); }
} // namespace Internal } // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -197,7 +197,6 @@ void TestSettingsPage::apply()
if (!m_widget) // page was not shown at all if (!m_widget) // page was not shown at all
return; return;
const TestSettings newSettings = m_widget->settings(); const TestSettings newSettings = m_widget->settings();
if (newSettings != *m_settings) {
bool frameworkSyncNecessary = newSettings.frameworks != m_settings->frameworks; bool frameworkSyncNecessary = newSettings.frameworks != m_settings->frameworks;
*m_settings = newSettings; *m_settings = newSettings;
m_settings->toSettings(Core::ICore::settings()); m_settings->toSettings(Core::ICore::settings());
@@ -209,7 +208,6 @@ void TestSettingsPage::apply()
if (frameworkSyncNecessary) if (frameworkSyncNecessary)
TestTreeModel::instance()->syncTestFrameworks(); TestTreeModel::instance()->syncTestFrameworks();
} }
}
} // namespace Internal } // namespace Internal
} // namespace Autotest } // namespace Autotest