diff --git a/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp b/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp index ccc8e583d..10dae240e 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp @@ -327,7 +327,7 @@ QImage EmojiImageLoader::prepare(EmojiPtr emoji) { auto tinted = QImage( QSize(st::largeEmojiSize, st::largeEmojiSize) * factor, QImage::Format_ARGB32_Premultiplied); - tinted.fill(cBigEmojiOutline() ? Qt::white : QColor(0, 0, 0, 0)); + tinted.fill(BigEmojiOutline() ? Qt::white : QColor(0, 0, 0, 0)); if (loaded) { QPainter p(&tinted); p.setCompositionMode(QPainter::CompositionMode_DestinationIn); @@ -413,6 +413,17 @@ EmojiPack::EmojiPack(not_null session) refreshAll(); }, _lifetime); + BigEmojiOutlineChanges( + ) | rpl::start_with_next([=] { + _images.clear(); + _imageLoader.with([ + source = prepareSourceImages() + ](details::EmojiImageLoader &loader) mutable { + loader.switchTo(std::move(source)); + }); + refreshAll(); + }, _lifetime); + Ui::Emoji::Updated( ) | rpl::start_with_next([=] { _images.clear(); diff --git a/Telegram/SourceFiles/core/kotato_settings.cpp b/Telegram/SourceFiles/core/kotato_settings.cpp index 847f35552..84bafd46e 100644 --- a/Telegram/SourceFiles/core/kotato_settings.cpp +++ b/Telegram/SourceFiles/core/kotato_settings.cpp @@ -166,7 +166,7 @@ bool Manager::readCustomFile() { const auto settingsBigEmojiOutlineIt = settings.constFind(qsl("big_emoji_outline")); if (settingsBigEmojiOutlineIt != settings.constEnd() && (*settingsBigEmojiOutlineIt).isBool()) { - cSetBigEmojiOutline((*settingsBigEmojiOutlineIt).toBool()); + SetBigEmojiOutline((*settingsBigEmojiOutlineIt).toBool()); } const auto settingsAlwaysShowScheduledIt = settings.constFind(qsl("always_show_scheduled")); @@ -247,7 +247,7 @@ void Manager::writeDefaultFile() { settings.insert(qsl("fonts"), settingsFonts); settings.insert(qsl("sticker_height"), cStickerHeight()); - settings.insert(qsl("big_emoji_outline"), cBigEmojiOutline()); + settings.insert(qsl("big_emoji_outline"), BigEmojiOutline()); settings.insert(qsl("always_show_scheduled"), cAlwaysShowScheduled()); settings.insert(qsl("show_chat_id"), cShowChatId()); settings.insert(qsl("net_speed_boost"), QJsonValue(QJsonValue::Null)); diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 51d6d29d1..bc0a7bad0 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -504,6 +504,13 @@ HistoryWidget::HistoryWidget( }); }, lifetime()); + BigEmojiOutlineChanges( + ) | rpl::start_with_next([=] { + crl::on_main(this, [=] { + updateHistoryGeometry(); + }); + }, lifetime()); + session().data().animationPlayInlineRequest( ) | rpl::start_with_next([=](not_null item) { if (const auto view = item->mainView()) { diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp index ea391c19c..354723556 100644 --- a/Telegram/SourceFiles/settings.cpp +++ b/Telegram/SourceFiles/settings.cpp @@ -211,7 +211,18 @@ QString gMainFont, gSemiboldFont, gMonospaceFont; bool gSemiboldFontIsBold = false; int gStickerHeight = 128; -bool gBigEmojiOutline = false; + +rpl::variable gBigEmojiOutline = false; +void SetBigEmojiOutline(bool enabled) { + gBigEmojiOutline = enabled; +} +bool BigEmojiOutline() { + return gBigEmojiOutline.current(); +} +rpl::producer BigEmojiOutlineChanges() { + return gBigEmojiOutline.changes(); +} + bool gAlwaysShowScheduled = true; bool gShowChatId = true; diff --git a/Telegram/SourceFiles/settings.h b/Telegram/SourceFiles/settings.h index 3728ea1e2..1608299c5 100644 --- a/Telegram/SourceFiles/settings.h +++ b/Telegram/SourceFiles/settings.h @@ -184,8 +184,11 @@ DeclareSetting(QString, SemiboldFont); DeclareSetting(bool, SemiboldFontIsBold); DeclareSetting(QString, MonospaceFont); +void SetBigEmojiOutline(bool enabled); +[[nodiscard]] bool BigEmojiOutline(); +[[nodiscard]] rpl::producer BigEmojiOutlineChanges(); + DeclareSetting(int, StickerHeight); -DeclareSetting(bool, BigEmojiOutline); DeclareSetting(bool, AlwaysShowScheduled); DeclareSetting(bool, ShowChatId); diff --git a/Telegram/SourceFiles/settings/settings_kotato.cpp b/Telegram/SourceFiles/settings/settings_kotato.cpp index d61e12230..bcc98e1c7 100644 --- a/Telegram/SourceFiles/settings/settings_kotato.cpp +++ b/Telegram/SourceFiles/settings/settings_kotato.cpp @@ -71,12 +71,12 @@ void SetupKotatoChats(not_null container) { tr::ktg_settings_emoji_outline(), st::settingsButton )->toggleOn( - rpl::single(cBigEmojiOutline()) + rpl::single(BigEmojiOutline()) )->toggledValue( ) | rpl::filter([](bool enabled) { - return (enabled != cBigEmojiOutline()); + return (enabled != BigEmojiOutline()); }) | rpl::start_with_next([](bool enabled) { - cSetBigEmojiOutline(enabled); + SetBigEmojiOutline(enabled); }, container->lifetime()); AddButton(