From 30ac76e94269a9db9cdc6ef2d6599e5265d1772e Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 19 Mar 2024 01:55:07 +0100 Subject: [PATCH] Fix presence not being per profile fixes #1699 --- src/UserSettingsPage.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index c8ea6eb8..49fb6a59 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -93,15 +93,10 @@ UserSettings::load(std::optional profile) updateSpaceVias_ = settings.value("user/space_background_maintenance", true).toBool(); expireEvents_ = settings.value("user/expired_events_background_maintenance", false).toBool(); - mobileMode_ = settings.value("user/mobile_mode", false).toBool(); - disableSwipe_ = settings.value("user/disable_swipe", false).toBool(); - emojiFont_ = settings.value("user/emoji_font_family", "emoji").toString(); - baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble(); - auto tempPresence = settings.value("user/presence", "").toString().toStdString(); - auto presenceValue = QMetaEnum::fromType().keyToValue(tempPresence.c_str()); - if (presenceValue < 0) - presenceValue = 0; - presence_ = static_cast(presenceValue); + mobileMode_ = settings.value("user/mobile_mode", false).toBool(); + disableSwipe_ = settings.value("user/disable_swipe", false).toBool(); + emojiFont_ = settings.value("user/emoji_font_family", "emoji").toString(); + baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble(); ringtone_ = settings.value("user/ringtone", "Default").toString(); microphone_ = settings.value("user/microphone", QString()).toString(); camera_ = settings.value("user/camera", QString()).toString(); @@ -132,6 +127,11 @@ UserSettings::load(std::optional profile) hiddenWidgets_ = settings.value(prefix + "user/hidden_widgets", QStringList{}).toStringList(); recentReactions_ = settings.value(prefix + "user/recent_reactions", QStringList{}).toStringList(); + auto tempPresence = settings.value(prefix + "user/presence", "").toString().toStdString(); + auto presenceValue = QMetaEnum::fromType().keyToValue(tempPresence.c_str()); + if (presenceValue < 0) + presenceValue = 0; + presence_ = static_cast(presenceValue); collapsedSpaces_.clear(); auto tempSpaces = settings.value(prefix + "user/collapsed_spaces", QList{}).toList(); @@ -914,9 +914,6 @@ UserSettings::save() settings.setValue("theme", theme()); settings.setValue("font_family", font_); settings.setValue("emoji_font_family", emojiFont_); - settings.setValue( - "presence", - QString::fromUtf8(QMetaEnum::fromType().valueToKey(static_cast(presence_)))); settings.setValue("ringtone", ringtone_); settings.setValue("microphone", microphone_); settings.setValue("camera", camera_); @@ -955,6 +952,9 @@ UserSettings::save() settings.setValue(prefix + "user/hidden_pins", hiddenPins_); settings.setValue(prefix + "user/hidden_widgets", hiddenWidgets_); settings.setValue(prefix + "user/recent_reactions", recentReactions_); + settings.setValue( + prefix + "user/presence", + QString::fromUtf8(QMetaEnum::fromType().valueToKey(static_cast(presence_)))); QVariantList v; v.reserve(collapsedSpaces_.size());