|
Mantid
|
A QSettings facade that applies only effective changes. More...
#include <QSettingsChangeAware.h>
Public Member Functions | |
| bool | changed () const noexcept |
| QSettingsChangeAware & | operator= (QSettingsChangeAware const &)=delete |
| QSettingsChangeAware () | |
| QSettingsChangeAware (QSettings &settings) | |
| QSettingsChangeAware (QSettingsChangeAware const &)=delete | |
| bool | remove (QString const &key) |
| Remove a key or group only when it contains a value. | |
| bool | setValue (QString const &key, QVariant const &value) |
| Set a value only when the effective stored value differs. | |
Private Member Functions | |
| bool | containsKeyOrChildren (QString const &key) |
Static Private Member Functions | |
| static bool | valuesEqual (QVariant current, QVariant const &requested) |
Private Attributes | |
| bool | m_changed {false} |
| std::unique_ptr< QSettings > | m_ownedSettings |
| QSettings & | m_settings |
A QSettings facade that applies only effective changes.
The default constructor owns a standard QSettings instance. A caller may instead inject a QSettings instance, which remains owned by the caller.
Values are compared after converting the stored value to the requested value's type. This avoids unnecessary writes caused by type information lost by INI storage. An absent key is still written, even when the requested value resembles a caller-side default.
Definition at line 26 of file QSettingsChangeAware.h.
|
inline |
Definition at line 28 of file QSettingsChangeAware.h.
|
inlineexplicit |
Definition at line 29 of file QSettingsChangeAware.h.
|
delete |
|
inlinenoexcept |
Definition at line 58 of file QSettingsChangeAware.h.
References m_changed.
|
inlineprivate |
Definition at line 72 of file QSettingsChangeAware.h.
References m_settings.
Referenced by remove().
|
delete |
|
inline |
Remove a key or group only when it contains a value.
Definition at line 49 of file QSettingsChangeAware.h.
References containsKeyOrChildren(), m_changed, and m_settings.
Referenced by MantidQt::MantidWidgets::FitPropertyBrowser::executeCustomSetupRemove(), and MantidQt::API::AbstractAlgorithmInputHistory::saveSettings().
|
inline |
Set a value only when the effective stored value differs.
Definition at line 37 of file QSettingsChangeAware.h.
References m_changed, m_settings, value, and valuesEqual().
Referenced by MantidQt::MantidWidgets::FitPropertyBrowser::boolChanged(), MantidQt::API::ManageUserDirectories::browseToDirectory(), MantidQt::MantidWidgets::FitPropertyBrowser::enumChanged(), MantidQt::MantidWidgets::FitPropertyBrowser::intChanged(), MantidQt::MantidWidgets::FitPropertyBrowser::saveFunction(), MantidQt::API::FileFinderWidget::saveSettings(), MantidQt::MantidWidgets::FitOptionsBrowserSettings::saveSettings(), MantidQt::MantidWidgets::ProcessingAlgoWidgetSettings::saveSettings(), MantidQt::API::AbstractAlgorithmInputHistory::saveSettings(), MantidQt::MantidWidgets::MessageDisplay::saveSettings(), MantidQt::API::ManageUserDirectories::selectSaveDir(), MantidQt::MantidWidgets::FitPropertyBrowser::setDecimals(), MantidQt::MantidWidgets::QSettingsHelper::setSetting(), and MantidQt::MantidWidgets::QSettingsHelper::setSetting().
|
inlinestaticprivate |
Definition at line 61 of file QSettingsChangeAware.h.
Referenced by setValue().
|
private |
Definition at line 86 of file QSettingsChangeAware.h.
Referenced by changed(), remove(), and setValue().
|
private |
Definition at line 84 of file QSettingsChangeAware.h.
|
private |
Definition at line 85 of file QSettingsChangeAware.h.
Referenced by containsKeyOrChildren(), remove(), and setValue().