aboutsummaryrefslogtreecommitdiff
path: root/settings.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-11-28 12:42:03 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-11-28 12:42:03 +0900
commit357625eb55e2f4569bb487ffe14a9236188e25f3 (patch)
treed39340ab74f25a23a5855f679973628f7457fd87 /settings.h
parent94e6636d8225a0561ed7df3fa8081c5b0183610c (diff)
parent8f762a2458db773f6db24b568b2e944427297c2b (diff)
downloadlibquotient-357625eb55e2f4569bb487ffe14a9236188e25f3.tar.gz
libquotient-357625eb55e2f4569bb487ffe14a9236188e25f3.zip
Merge branch 'master' into kitsune-gtad
Diffstat (limited to 'settings.h')
-rw-r--r--settings.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/settings.h b/settings.h
index a6c0420e..ab3aae8b 100644
--- a/settings.h
+++ b/settings.h
@@ -28,7 +28,17 @@ namespace QMatrixClient
{
class Settings: public QSettings
{
+ Q_OBJECT
public:
+ /**
+ * Use this function before creating any Settings objects in order
+ * to setup a read-only location where configuration has previously
+ * been stored. This will provide an additional fallback in case of
+ * renaming the organisation/application.
+ */
+ static void setLegacyNames(const QString& organizationName,
+ const QString& applicationName = {});
+
#if defined(_MSC_VER) && _MSC_VER < 1900
// VS 2013 (and probably older) aren't friends with 'using' statements
// that involve private constructors
@@ -41,6 +51,16 @@ namespace QMatrixClient
const QVariant &value);
Q_INVOKABLE QVariant value(const QString &key,
const QVariant &defaultValue = {}) const;
+ Q_INVOKABLE bool contains(const QString& key) const;
+ Q_INVOKABLE QStringList childGroups() const;
+
+ private:
+ static QString legacyOrganizationName;
+ static QString legacyApplicationName;
+
+ protected:
+ const QSettings legacySettings { legacyOrganizationName,
+ legacyApplicationName };
};
class SettingsGroup: public Settings
@@ -69,7 +89,7 @@ namespace QMatrixClient
class AccountSettings: public SettingsGroup
{
Q_OBJECT
- Q_PROPERTY(QString userId READ userId)
+ Q_PROPERTY(QString userId READ userId CONSTANT)
Q_PROPERTY(QString deviceId READ deviceId WRITE setDeviceId)
Q_PROPERTY(QString deviceName READ deviceName WRITE setDeviceName)
Q_PROPERTY(QUrl homeserver READ homeserver WRITE setHomeserver)