From ba620ee07989aff134fec6b5d6f058cab3377ecc Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 19 Oct 2017 19:36:10 +0900 Subject: Introduce device_id and initial_device_name support; switch to generated LoginJob This is _almost_ a backwards-compatible change, except that connect*() and other relevant methods in Connection are no more virtual (that wasn't much useful anyway). Otherwise it's a matter of passing initial_device_name to connectToServer(), saving device_id (along with access_token) from the result of LoginJob and then passing device_id (along with access_token, again) to connectWithToken() upon the next run. --- settings.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'settings.cpp') diff --git a/settings.cpp b/settings.cpp index fbcd845f..3a5f4d26 100644 --- a/settings.cpp +++ b/settings.cpp @@ -5,9 +5,6 @@ using namespace QMatrixClient; -Settings::~Settings() -{ } - void Settings::setValue(const QString& key, const QVariant& value) { // qCDebug() << "Setting" << key << "to" << value; @@ -19,9 +16,6 @@ QVariant Settings::value(const QString& key, const QVariant& defaultValue) const return QSettings::value(key, defaultValue); } -SettingsGroup::~SettingsGroup() -{ } - void SettingsGroup::setValue(const QString& key, const QVariant& value) { Settings::setValue(groupPath + "/" + key, value); @@ -58,9 +52,6 @@ void SettingsGroup::remove(const QString& key) Settings::remove(fullKey); } -AccountSettings::~AccountSettings() -{ } - bool AccountSettings::keepLoggedIn() const { return value("keep_logged_in", false).toBool(); @@ -86,6 +77,26 @@ 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(); -- cgit v1.2.3