diff options
author | Malte E <malte.e@mailbox.org> | 2022-02-04 23:12:30 +0100 |
---|---|---|
committer | Malte E <malte.e@mailbox.org> | 2022-02-04 23:12:30 +0100 |
commit | 3f7c15c7afeb029223a7507387a95752428bb689 (patch) | |
tree | c07ef417ae79701041730fd842450b6e8f895a3a /src/UserSettingsPage.cpp | |
parent | Revert removal of width and height in TextMessage and implicitWidth in Messag... (diff) | |
download | nheko-3f7c15c7afeb029223a7507387a95752428bb689.tar.xz |
Add message bubbles
Diffstat (limited to 'src/UserSettingsPage.cpp')
-rw-r--r-- | src/UserSettingsPage.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index a0aa8f84..993b9a01 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -70,6 +70,7 @@ UserSettings::load(std::optional<QString> profile) enlargeEmojiOnlyMessages_ = settings.value(QStringLiteral("user/timeline/enlarge_emoji_only_msg"), false).toBool(); markdown_ = settings.value(QStringLiteral("user/markdown_enabled"), true).toBool(); + bubbles_ = settings.value(QStringLiteral("user/bubbles_enabled"), true).toBool(); animateImagesOnHover_ = settings.value(QStringLiteral("user/animate_images_on_hover"), false).toBool(); typingNotifications_ = @@ -243,6 +244,16 @@ UserSettings::setMarkdown(bool state) } void +UserSettings::setBubbles(bool state) +{ + if (state == bubbles_) + return; + bubbles_ = state; + emit bubblesChanged(state); + save(); +} + +void UserSettings::setAnimateImagesOnHover(bool state) { if (state == animateImagesOnHover_) @@ -696,6 +707,7 @@ UserSettings::save() settings.setValue(QStringLiteral("read_receipts"), readReceipts_); settings.setValue(QStringLiteral("group_view"), groupView_); settings.setValue(QStringLiteral("markdown_enabled"), markdown_); + settings.setValue(QStringLiteral("bubbles_enabled"), bubbles_); settings.setValue(QStringLiteral("animate_images_on_hover"), animateImagesOnHover_); settings.setValue(QStringLiteral("desktop_notifications"), hasDesktopNotifications_); settings.setValue(QStringLiteral("alert_on_notification"), hasAlertOnNotification_); @@ -796,6 +808,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const return tr("Group's sidebar"); case Markdown: return tr("Send messages as Markdown"); + case Bubbles: + return tr("Enable Message bubbles"); case AnimateImagesOnHover: return tr("Play animated images only on hover"); case TypingNotifications: @@ -916,6 +930,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const return i->groupView(); case Markdown: return i->markdown(); + case Bubbles: + return i->bubbles(); case AnimateImagesOnHover: return i->animateImagesOnHover(); case TypingNotifications: @@ -1042,6 +1058,9 @@ UserSettingsModel::data(const QModelIndex &index, int role) const return tr( "Allow using markdown in messages.\nWhen disabled, all messages are sent as a plain " "text."); + case Bubbles: + return tr( + "Messages received a bubble background."); case AnimateImagesOnHover: return tr("Plays media like GIFs or WEBPs only when explicitly hovering over them."); case TypingNotifications: @@ -1158,6 +1177,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const case StartInTray: case GroupView: case Markdown: + case Bubbles: case AnimateImagesOnHover: case TypingNotifications: case SortByImportance: @@ -1375,6 +1395,13 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int } else return false; } + case Bubbles: { + if (value.userType() == QMetaType::Bool) { + i->setBubbles(value.toBool()); + return true; + } else + return false; + } case AnimateImagesOnHover: { if (value.userType() == QMetaType::Bool) { i->setAnimateImagesOnHover(value.toBool()); @@ -1737,6 +1764,9 @@ UserSettingsModel::UserSettingsModel(QObject *p) connect(s.get(), &UserSettings::markdownChanged, this, [this]() { emit dataChanged(index(Markdown), index(Markdown), {Value}); }); + connect(s.get(), &UserSettings::bubblesChanged, this, [this]() { + emit dataChanged(index(Bubbles), index(Bubbles), {Value}); + }); connect(s.get(), &UserSettings::groupViewStateChanged, this, [this]() { emit dataChanged(index(GroupView), index(GroupView), {Value}); |