diff options
Diffstat (limited to 'lib/settings.cpp')
-rw-r--r-- | lib/settings.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/settings.cpp b/lib/settings.cpp index 124d7042..f8f1eae5 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -18,7 +18,7 @@ void Settings::setLegacyNames(const QString& organizationName, void Settings::setValue(const QString& key, const QVariant& value) { -// qCDebug() << "Setting" << key << "to" << value; + // qCDebug() << "Setting" << key << "to" << value; QSettings::setValue(key, value); if (legacySettings.contains(key)) legacySettings.remove(key); @@ -56,15 +56,13 @@ bool SettingsGroup::contains(const QString& key) const return Settings::contains(groupPath + '/' + key); } -QVariant SettingsGroup::value(const QString& key, const QVariant& defaultValue) const +QVariant SettingsGroup::value(const QString& key, + const QVariant& defaultValue) const { return Settings::value(groupPath + '/' + key, defaultValue); } -QString SettingsGroup::group() const -{ - return groupPath; -} +QString SettingsGroup::group() const { return groupPath; } QStringList SettingsGroup::childGroups() const { @@ -84,9 +82,12 @@ void SettingsGroup::remove(const QString& key) Settings::remove(fullKey); } -QMC_DEFINE_SETTING(AccountSettings, QString, deviceId, "device_id", {}, setDeviceId) -QMC_DEFINE_SETTING(AccountSettings, QString, deviceName, "device_name", {}, setDeviceName) -QMC_DEFINE_SETTING(AccountSettings, bool, keepLoggedIn, "keep_logged_in", false, setKeepLoggedIn) +QMC_DEFINE_SETTING(AccountSettings, QString, deviceId, "device_id", {}, + setDeviceId) +QMC_DEFINE_SETTING(AccountSettings, QString, deviceName, "device_name", {}, + setDeviceName) +QMC_DEFINE_SETTING(AccountSettings, bool, keepLoggedIn, "keep_logged_in", false, + setKeepLoggedIn) static const auto HomeserverKey = QStringLiteral("homeserver"); static const auto AccessTokenKey = QStringLiteral("access_token"); @@ -101,10 +102,7 @@ void AccountSettings::setHomeserver(const QUrl& url) setValue(HomeserverKey, url.toString()); } -QString AccountSettings::userId() const -{ - return group().section('/', -1); -} +QString AccountSettings::userId() const { return group().section('/', -1); } QString AccountSettings::accessToken() const { @@ -121,6 +119,7 @@ void AccountSettings::setAccessToken(const QString& accessToken) void AccountSettings::clearAccessToken() { legacySettings.remove(AccessTokenKey); - legacySettings.remove(QStringLiteral("device_id")); // Force the server to re-issue it + legacySettings.remove(QStringLiteral("device_id")); // Force the server to + // re-issue it remove(AccessTokenKey); } |