From 2cfaa5af2af105570708bb8949ae51d1a89dd0da Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Fri, 26 Aug 2022 16:10:02 +0300 Subject: [PATCH] [Option][GUI] Adaptive chat bubbles --- Telegram/Resources/langs/rewrites/en.json | 2 + .../history/history_inner_widget.cpp | 3 +- .../SourceFiles/history/history_widget.cpp | 30 ++++++++++++++ .../history/view/history_view_element.cpp | 7 +++- .../history/view/history_view_element.h | 1 + .../history/view/history_view_list_widget.cpp | 3 +- .../history/view/history_view_message.cpp | 21 +++++++--- .../history/view/history_view_message.h | 3 +- .../view/history_view_service_message.cpp | 7 ++-- .../view/media/history_view_document.cpp | 7 +++- .../history/view/media/history_view_gif.cpp | 14 ++++++- .../view/media/history_view_location.cpp | 11 +++++- .../view/media/history_view_media_grouped.cpp | 14 ++++++- .../history/view/media/history_view_photo.cpp | 14 +++++-- .../view/media/history_view_web_page.cpp | 9 +++++ .../SourceFiles/kotato/kotato_settings.cpp | 7 ++++ .../kotato/kotato_settings_menu.cpp | 39 +++++++++++++++++++ .../window/themes/window_theme_preview.cpp | 13 +++++-- 18 files changed, 182 insertions(+), 23 deletions(-) diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json index d4eb5242b..39b83f704 100644 --- a/Telegram/Resources/langs/rewrites/en.json +++ b/Telegram/Resources/langs/rewrites/en.json @@ -42,8 +42,10 @@ "ktg_settings_network": "Network", "ktg_settings_system": "System", "ktg_settings_other": "Other", + "ktg_settings_adaptive_bubbles": "Adaptive bubbles", "ktg_settings_filters": "Folders", "ktg_settings_messages": "Messages", + "ktg_settings_monospace_large_bubbles": "Expand bubbles with monospace", "ktg_settings_forward": "Forward", "ktg_in_app_update_disabled": "In-app updater is disabled.", "dummy_last_string": "" diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 9809f9c89..235614f8b 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/history_inner_widget.h" +#include "kotato/kotato_settings.h" #include "chat_helpers/stickers_emoji_pack.h" #include "core/file_utilities.h" #include "core/click_handler_types.h" @@ -3765,7 +3766,7 @@ void HistoryInner::mouseActionUpdate() { dateWidth += st::msgServicePadding.left() + st::msgServicePadding.right(); auto dateLeft = st::msgServiceMargin.left(); auto maxwidth = _contentWidth; - if (_isChatWide) { + if (_isChatWide && !::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left())); } auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left(); diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 5ce869414..ade96676c 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -659,6 +659,36 @@ HistoryWidget::HistoryWidget( }); }, lifetime()); + ::Kotato::JsonSettings::Events( + "adaptive_bubbles" + ) | rpl::start_with_next([=] { + crl::on_main(this, [=] { + if (_history) { + _history->forceFullResize(); + if (_migrated) { + _migrated->forceFullResize(); + } + updateHistoryGeometry(); + update(); + } + }); + }, lifetime()); + + ::Kotato::JsonSettings::Events( + "monospace_large_bubbles" + ) | rpl::start_with_next([=] { + crl::on_main(this, [=] { + if (_history) { + _history->forceFullResize(); + if (_migrated) { + _migrated->forceFullResize(); + } + updateHistoryGeometry(); + update(); + } + }); + }, lifetime()); + session().data().channelDifferenceTooLong( ) | rpl::filter([=](not_null channel) { return _peer == channel.get(); diff --git a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram/SourceFiles/history/view/history_view_element.cpp index e687ec921..dc8a9fa7b 100644 --- a/Telegram/SourceFiles/history/view/history_view_element.cpp +++ b/Telegram/SourceFiles/history/view/history_view_element.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/history_view_element.h" +#include "kotato/kotato_settings.h" #include "history/view/history_view_service_message.h" #include "history/view/history_view_message.h" #include "history/view/media/history_view_media_grouped.h" @@ -323,7 +324,7 @@ void UnreadBar::paint( p.setPen(st->historyUnreadBarFg()); int maxwidth = w; - if (chatWide) { + if (chatWide && !::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { maxwidth = qMin( maxwidth, st::msgMaxWidth @@ -680,6 +681,10 @@ int Element::infoWidth() const { return 0; } +int Element::plainMaxWidth() const { + return 0; +} + int Element::bottomInfoFirstLineWidth() const { return 0; } diff --git a/Telegram/SourceFiles/history/view/history_view_element.h b/Telegram/SourceFiles/history/view/history_view_element.h index a11d0831d..f38675aa6 100644 --- a/Telegram/SourceFiles/history/view/history_view_element.h +++ b/Telegram/SourceFiles/history/view/history_view_element.h @@ -352,6 +352,7 @@ public: [[nodiscard]] int skipBlockWidth() const; [[nodiscard]] int skipBlockHeight() const; [[nodiscard]] virtual int infoWidth() const; + [[nodiscard]] virtual int plainMaxWidth() const; [[nodiscard]] virtual int bottomInfoFirstLineWidth() const; [[nodiscard]] virtual bool bottomInfoIsWide() const; diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index a320a67f7..0d1e31d3c 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/history_view_list_widget.h" +#include "kotato/kotato_settings.h" #include "base/unixtime.h" #include "base/qt/qt_key_modifiers.h" #include "base/qt/qt_common_adapters.h" @@ -3575,7 +3576,7 @@ void ListWidget::mouseActionUpdate() { dateWidth += st::msgServicePadding.left() + st::msgServicePadding.right(); auto dateLeft = st::msgServiceMargin.left(); auto maxwidth = view->width(); - if (_isChatWide) { + if (_isChatWide && !::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left())); } auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left(); diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 96cbc4648..372d5e527 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/history_view_message.h" +#include "kotato/kotato_settings.h" #include "core/click_handler_types.h" // ClickHandlerContext #include "core/ui_integration.h" #include "history/view/history_view_cursor_state.h" @@ -3925,7 +3926,9 @@ QRect Message::countGeometry() const { // contentLeft += st::msgPhotoSkip - (hmaxwidth - hwidth); } accumulate_min(contentWidth, maxWidth()); - accumulate_min(contentWidth, int(_bubbleWidthLimit)); + if (!::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { + accumulate_min(contentWidth, int(_bubbleWidthLimit)); + } if (mediaWidth < contentWidth) { const auto textualWidth = plainMaxWidth(); if (mediaWidth < textualWidth @@ -3935,7 +3938,11 @@ QRect Message::countGeometry() const { contentWidth = mediaWidth; } } - if (contentWidth < availableWidth && !delegate()->elementIsChatWide()) { + if (contentWidth < availableWidth + && (!delegate()->elementIsChatWide() + || (context() == Context::Replies + && item->isDiscussionPost() + && ::Kotato::JsonSettings::GetBool("adaptive_bubbles")))) { if (outbg) { contentLeft += availableWidth - contentWidth; } else if (centeredView) { @@ -4033,8 +4040,12 @@ int Message::resizeContentGetHeight(int newWidth) { } } accumulate_min(contentWidth, maxWidth()); - _bubbleWidthLimit = std::max(st::msgMaxWidth, monospaceMaxWidth()); - accumulate_min(contentWidth, int(_bubbleWidthLimit)); + _bubbleWidthLimit = (::Kotato::JsonSettings::GetBool("monospace_large_bubbles") + ? std::max(st::msgMaxWidth, monospaceMaxWidth()) + : st::msgMaxWidth); + if (!::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { + accumulate_min(contentWidth, int(_bubbleWidthLimit)); + } if (mediaDisplayed) { media->resizeGetHeight(contentWidth); if (media->width() < contentWidth) { @@ -4067,7 +4078,7 @@ int Message::resizeContentGetHeight(int newWidth) { _reactions->resizeGetHeight(textWidth); } - if (contentWidth == maxWidth()) { + if (!::Kotato::JsonSettings::GetBool("adaptive_bubbles") && contentWidth == maxWidth()) { if (mediaDisplayed) { if (entry) { newHeight += entry->resizeGetHeight(contentWidth); diff --git a/Telegram/SourceFiles/history/view/history_view_message.h b/Telegram/SourceFiles/history/view/history_view_message.h index 62ab6c02b..8838ccd38 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.h +++ b/Telegram/SourceFiles/history/view/history_view_message.h @@ -141,6 +141,7 @@ public: [[nodiscard]] bool allowTextSelectionByHandler( const ClickHandlerPtr &handler) const override; [[nodiscard]] int infoWidth() const override; + [[nodiscard]] int plainMaxWidth() const override; [[nodiscard]] int bottomInfoFirstLineWidth() const override; [[nodiscard]] bool bottomInfoIsWide() const override; [[nodiscard]] bool isSignedAuthorElided() const override; @@ -276,7 +277,7 @@ private: void ensureRightAction() const; void refreshTopicButton(); void refreshInfoSkipBlock(); - [[nodiscard]] int plainMaxWidth() const; + //[[nodiscard]] int plainMaxWidth() const; [[nodiscard]] int monospaceMaxWidth() const; void validateInlineKeyboard(HistoryMessageReplyMarkup *markup); diff --git a/Telegram/SourceFiles/history/view/history_view_service_message.cpp b/Telegram/SourceFiles/history/view/history_view_service_message.cpp index 107bb9416..063716543 100644 --- a/Telegram/SourceFiles/history/view/history_view_service_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_service_message.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/history_view_service_message.h" +#include "kotato/kotato_settings.h" #include "history/view/media/history_view_media.h" #include "history/view/history_view_cursor_state.h" #include "history/history.h" @@ -154,7 +155,7 @@ void PaintPreparedDate( int w, bool chatWide) { int left = st::msgServiceMargin.left(); - const auto maxwidth = chatWide + const auto maxwidth = (chatWide && !::Kotato::JsonSettings::GetBool("adaptive_bubbles")) ? std::min(w, WideChatWidth()) : w; w = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left(); @@ -420,7 +421,7 @@ bool Service::consumeHorizontalScroll(QPoint position, int delta) { QRect Service::countGeometry() const { auto result = QRect(0, 0, width(), height()); - if (delegate()->elementIsChatWide()) { + if (delegate()->elementIsChatWide() && !::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { result.setWidth(qMin(result.width(), st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left())); } return result.marginsRemoved(st::msgServiceMargin); @@ -445,7 +446,7 @@ QSize Service::performCountCurrentSize(int newWidth) { + st::msgServiceMargin.bottom(); } else if (!text().isEmpty()) { auto contentWidth = newWidth; - if (delegate()->elementIsChatWide()) { + if (delegate()->elementIsChatWide() && !::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { accumulate_min(contentWidth, st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()); } contentWidth -= st::msgServiceMargin.left() + st::msgServiceMargin.left(); // two small margins diff --git a/Telegram/SourceFiles/history/view/media/history_view_document.cpp b/Telegram/SourceFiles/history/view/media/history_view_document.cpp index bb64302c7..9653fdcd8 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_document.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_document.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/media/history_view_document.h" +#include "kotato/kotato_settings.h" #include "base/random.h" #include "lang/lang_keys.h" #include "lottie/lottie_icon.h" @@ -520,7 +521,11 @@ QSize Document::countOptimalSize() { if (auto named = Get()) { accumulate_max(maxWidth, tleft + named->namew + tright); - accumulate_min(maxWidth, st::msgMaxWidth); + if (::Kotato::JsonSettings::GetBool("adaptive_bubbles") && captioned) { + accumulate_max(maxWidth, captioned->caption.maxWidth() + st::msgPadding.left() + st::msgPadding.right()); + } else { + accumulate_min(maxWidth, st::msgMaxWidth); + } } if (voice && voice->transcribe) { maxWidth += st::historyTranscribeSkip diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index 7dbee0416..cb08d82a8 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/media/history_view_gif.h" +#include "kotato/kotato_settings.h" #include "apiwrap.h" #include "api/api_transcribes.h" #include "lang/lang_keys.h" @@ -229,13 +230,19 @@ QSize Gif::sizeForAspectRatio() const { } QSize Gif::countThumbSize(int &inOutWidthMax) const { + const auto captionWithPaddings = ::Kotato::JsonSettings::GetBool("adaptive_bubbles") + ? _caption.maxWidth() + + st::msgPadding.left() + + st::msgPadding.right() + : 0; const auto maxSize = _data->isVideoFile() ? st::maxMediaSize : _data->isVideoMessage() ? st::maxVideoMessageSize : st::maxGifSize; + const auto maxSizeWithCaption = std::max(captionWithPaddings, maxSize); const auto size = style::ConvertScale(videoSize()); - accumulate_min(inOutWidthMax, maxSize); + accumulate_min(inOutWidthMax, maxSizeWithCaption); return DownscaledSize(size, { inOutWidthMax, maxSize }); } @@ -272,6 +279,11 @@ QSize Gif::countOptimalSize() { } if (_parent->hasBubble()) { if (!_caption.isEmpty()) { + if (::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { + accumulate_max(maxWidth, _caption.maxWidth() + + st::msgPadding.left() + + st::msgPadding.right()); + } maxWidth = qMax(maxWidth, st::msgPadding.left() + _caption.maxWidth() + st::msgPadding.right()); diff --git a/Telegram/SourceFiles/history/view/media/history_view_location.cpp b/Telegram/SourceFiles/history/view/media/history_view_location.cpp index 5b8b18e61..405d53f0d 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_location.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_location.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/media/history_view_location.h" +#include "kotato/kotato_settings.h" #include "base/unixtime.h" #include "history/history.h" #include "history/history_item_components.h" @@ -274,9 +275,15 @@ QSize Location::countOptimalSize() { if (_parent->hasBubble()) { if (!_title.isEmpty()) { + if (::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { + maxWidth = qMax(maxWidth, _title.maxWidth() + st::msgPadding.left() + st::msgPadding.right()); + } minHeight += qMin(_title.countHeight(maxWidth - st::msgPadding.left() - st::msgPadding.right()), 2 * st::webPageTitleFont->height); } if (!_description.isEmpty()) { + if (::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { + maxWidth = qMax(maxWidth, _description.maxWidth() + st::msgPadding.left() + st::msgPadding.right()); + } minHeight += qMin(_description.countHeight(maxWidth - st::msgPadding.left() - st::msgPadding.right()), 3 * st::webPageDescriptionFont->height); } if (!_title.isEmpty() || !_description.isEmpty()) { @@ -307,8 +314,10 @@ QSize Location::countCurrentSize(int newWidth) { auto newHeight = th; if (tw > newWidth) { newHeight = (newWidth * newHeight / tw); - } else { + } else if (!::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { newWidth = tw; + } else { + newHeight = (newWidth * newHeight / tw); } auto minWidth = std::clamp( _parent->minWidthForMedia(), diff --git a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp index 038192cf1..e56ecae38 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/media/history_view_media_grouped.h" +#include "kotato/kotato_settings.h" #include "history/history_item_components.h" #include "history/history_item.h" #include "history/history.h" @@ -127,10 +128,18 @@ QSize GroupedMedia::countOptimalSize() { sizes.push_back(part.content->sizeForGroupingOptimal(maxWidth)); } + const auto captionWithPaddings = _caption.maxWidth() + + st::msgPadding.left() + + st::msgPadding.right(); + auto groupMaxWidth = st::historyGroupWidthMax; + if (::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { + accumulate_max(groupMaxWidth, captionWithPaddings); + } + const auto layout = (_mode == Mode::Grid) ? Ui::LayoutMediaGroup( sizes, - st::historyGroupWidthMax, + groupMaxWidth, st::historyGroupWidthMin, st::historyGroupSkip) : LayoutPlaylist(sizes); @@ -146,6 +155,9 @@ QSize GroupedMedia::countOptimalSize() { } if (!_caption.isEmpty()) { + if (::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { + maxWidth = qMax(maxWidth, captionWithPaddings); + } auto captionw = maxWidth - st::msgPadding.left() - st::msgPadding.right(); minHeight += st::mediaCaptionSkip + _caption.countHeight(captionw); if (isBubbleBottom()) { diff --git a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp index 2532509a7..066c9bd8e 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/media/history_view_photo.h" +#include "kotato/kotato_settings.h" #include "history/history_item_components.h" #include "history/history_item.h" #include "history/history.h" @@ -201,15 +202,20 @@ QSize Photo::countOptimalSize() { ? st::historyPhotoBubbleMinWidth : st::minPhotoSize), st::maxMediaSize); - const auto maxActualWidth = qMax(scaled.width(), minWidth); + auto maxActualWidth = qMax(scaled.width(), minWidth); auto maxWidth = qMax(maxActualWidth, scaled.height()); auto minHeight = qMax(scaled.height(), st::minPhotoSize); if (_parent->hasBubble() && !_caption.isEmpty()) { + const auto captionWithPaddings = (st::msgPadding.left() + + _caption.maxWidth() + + st::msgPadding.right()); + if (::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { + maxActualWidth = qMax(maxActualWidth, captionWithPaddings); + maxWidth = qMax(maxWidth, captionWithPaddings); + } maxWidth = qMax( maxWidth, - (st::msgPadding.left() - + _caption.maxWidth() - + st::msgPadding.right())); + captionWithPaddings); minHeight = adjustHeightForLessCrop( dimensions, { maxWidth, minHeight }); diff --git a/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp b/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp index 0181d7da3..9ee21e00c 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/media/history_view_web_page.h" +#include "kotato/kotato_settings.h" #include "core/application.h" #include "base/qt/qt_key_modifiers.h" #include "window/window_session_controller.h" @@ -511,6 +512,10 @@ QSize WebPage::countOptimalSize() { maxWidth += rect::m::sum::h(st::historyPageButtonPadding) + _openButton.maxWidth(); } + if (::Kotato::JsonSettings::GetBool("adaptive_bubbles")) { + accumulate_min(maxWidth, st::msgMaxWidth); + accumulate_max(maxWidth, _parent->plainMaxWidth()); + } maxWidth += rect::m::sum::h(padding); minHeight += rect::m::sum::v(padding); @@ -535,6 +540,10 @@ QSize WebPage::countCurrentSize(int newWidth) { return { newWidth, minHeight() }; } + if (::Kotato::JsonSettings::GetBool("adaptive_bubbles") && !asArticle()) { + accumulate_min(newWidth, maxWidth()); + } + const auto padding = inBubblePadding() + innerMargin(); const auto innerWidth = newWidth - rect::m::sum::h(padding); auto newHeight = 0; diff --git a/Telegram/SourceFiles/kotato/kotato_settings.cpp b/Telegram/SourceFiles/kotato/kotato_settings.cpp index 1e40a7cd8..d009111e1 100644 --- a/Telegram/SourceFiles/kotato/kotato_settings.cpp +++ b/Telegram/SourceFiles/kotato/kotato_settings.cpp @@ -236,12 +236,19 @@ const std::map> DefinitionMap { { "sticker_scale_both", { .type = SettingType::BoolSetting, .defaultValue = true, }}, + { "adaptive_bubbles", { + .type = SettingType::BoolSetting, + .defaultValue = false, }}, + { "monospace_large_bubbles", { + .type = SettingType::BoolSetting, + .defaultValue = false, }}, }; using OldOptionKey = QString; using NewOptionKey = QString; const std::map> ReplacedOptionsMap { + { "adaptive_baloons", "adaptive_bubbles" }, }; QString DefaultFilePath() { diff --git a/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp b/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp index ac6f9be98..dec8c97cf 100644 --- a/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp +++ b/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp @@ -135,6 +135,45 @@ void SetupKotatoMessages(not_null container) { Ui::AddDividerText(container, rktr("ktg_settings_sticker_scale_both_about")); Ui::AddSkip(container); + auto adaptiveBubblesButton = container->add(object_ptr