|
|
@ -71,6 +71,7 @@ UserSettings::load(std::optional<QString> profile) |
|
|
|
settings.value(QStringLiteral("user/timeline/enlarge_emoji_only_msg"), false).toBool(); |
|
|
|
settings.value(QStringLiteral("user/timeline/enlarge_emoji_only_msg"), false).toBool(); |
|
|
|
markdown_ = settings.value(QStringLiteral("user/markdown_enabled"), true).toBool(); |
|
|
|
markdown_ = settings.value(QStringLiteral("user/markdown_enabled"), true).toBool(); |
|
|
|
bubbles_ = settings.value(QStringLiteral("user/bubbles_enabled"), true).toBool(); |
|
|
|
bubbles_ = settings.value(QStringLiteral("user/bubbles_enabled"), true).toBool(); |
|
|
|
|
|
|
|
smallAvatars_ = settings.value(QStringLiteral("user/small_avatars_enabled"), true).toBool(); |
|
|
|
animateImagesOnHover_ = |
|
|
|
animateImagesOnHover_ = |
|
|
|
settings.value(QStringLiteral("user/animate_images_on_hover"), false).toBool(); |
|
|
|
settings.value(QStringLiteral("user/animate_images_on_hover"), false).toBool(); |
|
|
|
typingNotifications_ = |
|
|
|
typingNotifications_ = |
|
|
@ -253,6 +254,16 @@ UserSettings::setBubbles(bool state) |
|
|
|
save(); |
|
|
|
save(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
|
|
|
UserSettings::setSmallAvatars(bool state) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (state == smallAvatars_) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
smallAvatars_ = state; |
|
|
|
|
|
|
|
emit smallAvatarsChanged(state); |
|
|
|
|
|
|
|
save(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
|
UserSettings::setAnimateImagesOnHover(bool state) |
|
|
|
UserSettings::setAnimateImagesOnHover(bool state) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -708,6 +719,7 @@ UserSettings::save() |
|
|
|
settings.setValue(QStringLiteral("group_view"), groupView_); |
|
|
|
settings.setValue(QStringLiteral("group_view"), groupView_); |
|
|
|
settings.setValue(QStringLiteral("markdown_enabled"), markdown_); |
|
|
|
settings.setValue(QStringLiteral("markdown_enabled"), markdown_); |
|
|
|
settings.setValue(QStringLiteral("bubbles_enabled"), bubbles_); |
|
|
|
settings.setValue(QStringLiteral("bubbles_enabled"), bubbles_); |
|
|
|
|
|
|
|
settings.setValue(QStringLiteral("small_avatars_enabled"), smallAvatars_); |
|
|
|
settings.setValue(QStringLiteral("animate_images_on_hover"), animateImagesOnHover_); |
|
|
|
settings.setValue(QStringLiteral("animate_images_on_hover"), animateImagesOnHover_); |
|
|
|
settings.setValue(QStringLiteral("desktop_notifications"), hasDesktopNotifications_); |
|
|
|
settings.setValue(QStringLiteral("desktop_notifications"), hasDesktopNotifications_); |
|
|
|
settings.setValue(QStringLiteral("alert_on_notification"), hasAlertOnNotification_); |
|
|
|
settings.setValue(QStringLiteral("alert_on_notification"), hasAlertOnNotification_); |
|
|
@ -810,6 +822,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
return tr("Send messages as Markdown"); |
|
|
|
return tr("Send messages as Markdown"); |
|
|
|
case Bubbles: |
|
|
|
case Bubbles: |
|
|
|
return tr("Enable message bubbles"); |
|
|
|
return tr("Enable message bubbles"); |
|
|
|
|
|
|
|
case SmallAvatars: |
|
|
|
|
|
|
|
return tr("Enable small Avatars"); |
|
|
|
case AnimateImagesOnHover: |
|
|
|
case AnimateImagesOnHover: |
|
|
|
return tr("Play animated images only on hover"); |
|
|
|
return tr("Play animated images only on hover"); |
|
|
|
case TypingNotifications: |
|
|
|
case TypingNotifications: |
|
|
@ -932,6 +946,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
return i->markdown(); |
|
|
|
return i->markdown(); |
|
|
|
case Bubbles: |
|
|
|
case Bubbles: |
|
|
|
return i->bubbles(); |
|
|
|
return i->bubbles(); |
|
|
|
|
|
|
|
case SmallAvatars: |
|
|
|
|
|
|
|
return i->smallAvatars(); |
|
|
|
case AnimateImagesOnHover: |
|
|
|
case AnimateImagesOnHover: |
|
|
|
return i->animateImagesOnHover(); |
|
|
|
return i->animateImagesOnHover(); |
|
|
|
case TypingNotifications: |
|
|
|
case TypingNotifications: |
|
|
@ -1061,6 +1077,9 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
case Bubbles: |
|
|
|
case Bubbles: |
|
|
|
return tr( |
|
|
|
return tr( |
|
|
|
"Messages get a bubble background. This also triggers some layout changes (WIP)."); |
|
|
|
"Messages get a bubble background. This also triggers some layout changes (WIP)."); |
|
|
|
|
|
|
|
case SmallAvatars: |
|
|
|
|
|
|
|
return tr( |
|
|
|
|
|
|
|
"Avatars are resized to fit above the message."); |
|
|
|
case AnimateImagesOnHover: |
|
|
|
case AnimateImagesOnHover: |
|
|
|
return tr("Plays media like GIFs or WEBPs only when explicitly hovering over them."); |
|
|
|
return tr("Plays media like GIFs or WEBPs only when explicitly hovering over them."); |
|
|
|
case TypingNotifications: |
|
|
|
case TypingNotifications: |
|
|
@ -1178,6 +1197,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
case GroupView: |
|
|
|
case GroupView: |
|
|
|
case Markdown: |
|
|
|
case Markdown: |
|
|
|
case Bubbles: |
|
|
|
case Bubbles: |
|
|
|
|
|
|
|
case SmallAvatars: |
|
|
|
case AnimateImagesOnHover: |
|
|
|
case AnimateImagesOnHover: |
|
|
|
case TypingNotifications: |
|
|
|
case TypingNotifications: |
|
|
|
case SortByImportance: |
|
|
|
case SortByImportance: |
|
|
@ -1402,6 +1422,13 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int |
|
|
|
} else |
|
|
|
} else |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case SmallAvatars: { |
|
|
|
|
|
|
|
if (value.userType() == QMetaType::Bool) { |
|
|
|
|
|
|
|
i->setSmallAvatars(value.toBool()); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} else |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
case AnimateImagesOnHover: { |
|
|
|
case AnimateImagesOnHover: { |
|
|
|
if (value.userType() == QMetaType::Bool) { |
|
|
|
if (value.userType() == QMetaType::Bool) { |
|
|
|
i->setAnimateImagesOnHover(value.toBool()); |
|
|
|
i->setAnimateImagesOnHover(value.toBool()); |
|
|
@ -1767,7 +1794,9 @@ UserSettingsModel::UserSettingsModel(QObject *p) |
|
|
|
connect(s.get(), &UserSettings::bubblesChanged, this, [this]() { |
|
|
|
connect(s.get(), &UserSettings::bubblesChanged, this, [this]() { |
|
|
|
emit dataChanged(index(Bubbles), index(Bubbles), {Value}); |
|
|
|
emit dataChanged(index(Bubbles), index(Bubbles), {Value}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
connect(s.get(), &UserSettings::smallAvatarsChanged, this, [this]() { |
|
|
|
|
|
|
|
emit dataChanged(index(SmallAvatars), index(SmallAvatars), {Value}); |
|
|
|
|
|
|
|
}); |
|
|
|
connect(s.get(), &UserSettings::groupViewStateChanged, this, [this]() { |
|
|
|
connect(s.get(), &UserSettings::groupViewStateChanged, this, [this]() { |
|
|
|
emit dataChanged(index(GroupView), index(GroupView), {Value}); |
|
|
|
emit dataChanged(index(GroupView), index(GroupView), {Value}); |
|
|
|
}); |
|
|
|
}); |
|
|
|