settings: Fix defaults caching, cache key exists
authorShane Synan <digitalcircuit36939@gmail.com>
Wed, 22 Aug 2018 21:46:01 +0000 (16:46 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 28 Aug 2018 20:03:19 +0000 (22:03 +0200)
Add separate cache of whether or not a settings key is persisted to
disk, separate from the cache of settings key values.  Modify
localKeyExists() to make use of this cache, offering a potential
slight performance boost.

Fix caching of default values as actual settings values by always
checking if the key is persisted to disk, returning the default value
if not.

This fixes ChatMonitorSettings's "OperationMode" getting set to
"InvalidMode" by ChatMonitorFilter::_operationMode's reading of a
default "InvalidMode", then when loading settings,
ChatMonitorSettingsPage::settings["OperationMode"] would incorrectly
default to "InvalidMode" instead of "OptOut".

Test case:
1.  Start with a fresh configuration.
2.  Open Chat Monitor settings, skipping first-run wizard/etc
3.  Check that "Opt Out" is the default mode
4.  Via qDebug() prints, check that ChatMonitorFilter still sees the
    default value as InvalidMode


No differences found