diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-06-08 20:26:37 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-06-08 20:26:37 +0200 |
commit | f2bfa61e086266a1c1e39e39dd8228c9451b2707 (patch) | |
tree | 6af614a25933d34cdf5dda535247ff8b1ecdc19f /src/UserSettingsPage.cpp | |
parent | Show presence and set custom status messages (diff) | |
download | nheko-f2bfa61e086266a1c1e39e39dd8228c9451b2707.tar.xz |
Add menu actions to set presence
Diffstat (limited to 'src/UserSettingsPage.cpp')
-rw-r--r-- | src/UserSettingsPage.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index dfd99069..659e8ceb 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -34,6 +34,7 @@ #include <QStandardPaths> #include <QString> #include <QTextStream> +#include <QtQml> #include "Cache.h" #include "Config.h" @@ -46,7 +47,11 @@ #include "config/nheko.h" -UserSettings::UserSettings() { load(); } +UserSettings::UserSettings() +{ + qRegisterMetaType<UserSettings::Presence>(); + load(); +} void UserSettings::load() @@ -72,6 +77,9 @@ UserSettings::load() decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool(); emojiFont_ = settings.value("user/emoji_font_family", "default").toString(); baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble(); + presence_ = + settings.value("user/presence", QVariant::fromValue(Presence::AutomaticPresence)) + .value<Presence>(); applyTheme(); } @@ -244,6 +252,16 @@ UserSettings::setEmojiFontFamily(QString family) } void +UserSettings::setPresence(Presence state) +{ + if (state == presence_) + return; + presence_ = state; + emit presenceChanged(state); + save(); +} + +void UserSettings::setTheme(QString theme) { if (theme == theme) @@ -337,6 +355,7 @@ UserSettings::save() settings.setValue("theme", theme()); settings.setValue("font_family", font_); settings.setValue("emoji_font_family", emojiFont_); + settings.setValue("presence", QVariant::fromValue(presence_)); settings.endGroup(); |