diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-12-26 21:12:03 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-12-26 21:12:03 +0900 |
commit | 205a9a268eb3d1c35b1decaf323619a72a33036e (patch) | |
tree | 6ddb3886b16ae4ab36d064e38937ef3779b6aa0f /settings.cpp | |
parent | 961bca954677cf68a3beae29bb9e16e2a5dddf3d (diff) | |
download | libquotient-205a9a268eb3d1c35b1decaf323619a72a33036e.tar.gz libquotient-205a9a268eb3d1c35b1decaf323619a72a33036e.zip |
Settings: factored out common declarations/definitions to macros
It cannot be made in templates because property and methods names are involved.
Diffstat (limited to 'settings.cpp')
-rw-r--r-- | settings.cpp | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/settings.cpp b/settings.cpp index ac9c091c..bf369c58 100644 --- a/settings.cpp +++ b/settings.cpp @@ -84,15 +84,9 @@ void SettingsGroup::remove(const QString& key) Settings::remove(fullKey);
}
-bool AccountSettings::keepLoggedIn() const
-{
- return value("keep_logged_in", false).toBool();
-}
-
-void AccountSettings::setKeepLoggedIn(bool newSetting)
-{
- setValue("keep_logged_in", newSetting);
-}
+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)
QUrl AccountSettings::homeserver() const
{
@@ -109,26 +103,6 @@ QString AccountSettings::userId() const return group().section('/', -1);
}
-QString AccountSettings::deviceId() const
-{
- return value("device_id").toString();
-}
-
-void AccountSettings::setDeviceId(const QString& deviceId)
-{
- setValue("device_id", deviceId);
-}
-
-QString AccountSettings::deviceName() const
-{
- return value("device_name").toString();
-}
-
-void AccountSettings::setDeviceName(const QString& deviceName)
-{
- setValue("device_name", deviceName);
-}
-
QString AccountSettings::accessToken() const
{
return value("access_token").toString();
|