Fix presence not being per profile

fixes #1699
This commit is contained in:
Nicolas Werner 2024-03-19 01:55:07 +01:00
parent 6d44c8e30d
commit 30ac76e942
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -97,11 +97,6 @@ UserSettings::load(std::optional<QString> profile)
disableSwipe_ = settings.value("user/disable_swipe", false).toBool(); disableSwipe_ = settings.value("user/disable_swipe", false).toBool();
emojiFont_ = settings.value("user/emoji_font_family", "emoji").toString(); emojiFont_ = settings.value("user/emoji_font_family", "emoji").toString();
baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble(); baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
auto tempPresence = settings.value("user/presence", "").toString().toStdString();
auto presenceValue = QMetaEnum::fromType<Presence>().keyToValue(tempPresence.c_str());
if (presenceValue < 0)
presenceValue = 0;
presence_ = static_cast<Presence>(presenceValue);
ringtone_ = settings.value("user/ringtone", "Default").toString(); ringtone_ = settings.value("user/ringtone", "Default").toString();
microphone_ = settings.value("user/microphone", QString()).toString(); microphone_ = settings.value("user/microphone", QString()).toString();
camera_ = settings.value("user/camera", QString()).toString(); camera_ = settings.value("user/camera", QString()).toString();
@ -132,6 +127,11 @@ UserSettings::load(std::optional<QString> profile)
hiddenWidgets_ = settings.value(prefix + "user/hidden_widgets", QStringList{}).toStringList(); hiddenWidgets_ = settings.value(prefix + "user/hidden_widgets", QStringList{}).toStringList();
recentReactions_ = recentReactions_ =
settings.value(prefix + "user/recent_reactions", QStringList{}).toStringList(); settings.value(prefix + "user/recent_reactions", QStringList{}).toStringList();
auto tempPresence = settings.value(prefix + "user/presence", "").toString().toStdString();
auto presenceValue = QMetaEnum::fromType<Presence>().keyToValue(tempPresence.c_str());
if (presenceValue < 0)
presenceValue = 0;
presence_ = static_cast<Presence>(presenceValue);
collapsedSpaces_.clear(); collapsedSpaces_.clear();
auto tempSpaces = settings.value(prefix + "user/collapsed_spaces", QList<QVariant>{}).toList(); auto tempSpaces = settings.value(prefix + "user/collapsed_spaces", QList<QVariant>{}).toList();
@ -914,9 +914,6 @@ UserSettings::save()
settings.setValue("theme", theme()); settings.setValue("theme", theme());
settings.setValue("font_family", font_); settings.setValue("font_family", font_);
settings.setValue("emoji_font_family", emojiFont_); settings.setValue("emoji_font_family", emojiFont_);
settings.setValue(
"presence",
QString::fromUtf8(QMetaEnum::fromType<Presence>().valueToKey(static_cast<int>(presence_))));
settings.setValue("ringtone", ringtone_); settings.setValue("ringtone", ringtone_);
settings.setValue("microphone", microphone_); settings.setValue("microphone", microphone_);
settings.setValue("camera", camera_); settings.setValue("camera", camera_);
@ -955,6 +952,9 @@ UserSettings::save()
settings.setValue(prefix + "user/hidden_pins", hiddenPins_); settings.setValue(prefix + "user/hidden_pins", hiddenPins_);
settings.setValue(prefix + "user/hidden_widgets", hiddenWidgets_); settings.setValue(prefix + "user/hidden_widgets", hiddenWidgets_);
settings.setValue(prefix + "user/recent_reactions", recentReactions_); settings.setValue(prefix + "user/recent_reactions", recentReactions_);
settings.setValue(
prefix + "user/presence",
QString::fromUtf8(QMetaEnum::fromType<Presence>().valueToKey(static_cast<int>(presence_))));
QVariantList v; QVariantList v;
v.reserve(collapsedSpaces_.size()); v.reserve(collapsedSpaces_.size());