diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index ac7735ed23..168b3c3055 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -1776,8 +1776,6 @@ PRIVATE ui/image/image_location_factory.h ui/text/format_song_document_name.cpp ui/text/format_song_document_name.h - ui/toast/toast_lottie_icon.cpp - ui/toast/toast_lottie_icon.h ui/widgets/expandable_peer_list.cpp ui/widgets/expandable_peer_list.h ui/widgets/chat_filters_tabs_strip.cpp diff --git a/Telegram/Resources/icons/settings/toast_auction.png b/Telegram/Resources/icons/toast/auction.png similarity index 100% rename from Telegram/Resources/icons/settings/toast_auction.png rename to Telegram/Resources/icons/toast/auction.png diff --git a/Telegram/Resources/icons/settings/toast_auction@2x.png b/Telegram/Resources/icons/toast/auction@2x.png similarity index 100% rename from Telegram/Resources/icons/settings/toast_auction@2x.png rename to Telegram/Resources/icons/toast/auction@2x.png diff --git a/Telegram/Resources/icons/settings/toast_auction@3x.png b/Telegram/Resources/icons/toast/auction@3x.png similarity index 100% rename from Telegram/Resources/icons/settings/toast_auction@3x.png rename to Telegram/Resources/icons/toast/auction@3x.png diff --git a/Telegram/Resources/icons/toast/check.svg b/Telegram/Resources/icons/toast/check.svg new file mode 100644 index 0000000000..fbb3381f90 --- /dev/null +++ b/Telegram/Resources/icons/toast/check.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/Telegram/Resources/icons/toast_info.png b/Telegram/Resources/icons/toast/info.png similarity index 100% rename from Telegram/Resources/icons/toast_info.png rename to Telegram/Resources/icons/toast/info.png diff --git a/Telegram/Resources/icons/toast_info@2x.png b/Telegram/Resources/icons/toast/info@2x.png similarity index 100% rename from Telegram/Resources/icons/toast_info@2x.png rename to Telegram/Resources/icons/toast/info@2x.png diff --git a/Telegram/Resources/icons/toast_info@3x.png b/Telegram/Resources/icons/toast/info@3x.png similarity index 100% rename from Telegram/Resources/icons/toast_info@3x.png rename to Telegram/Resources/icons/toast/info@3x.png diff --git a/Telegram/Resources/icons/toast/star.svg b/Telegram/Resources/icons/toast/star.svg new file mode 100644 index 0000000000..2e8ad94b7e --- /dev/null +++ b/Telegram/Resources/icons/toast/star.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/Telegram/SourceFiles/api/api_bot.cpp b/Telegram/SourceFiles/api/api_bot.cpp index 46319947ac..8265435ec4 100644 --- a/Telegram/SourceFiles/api/api_bot.cpp +++ b/Telegram/SourceFiles/api/api_bot.cpp @@ -40,6 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/toast/toast.h" #include "ui/layers/generic_box.h" #include "ui/text/text_utilities.h" +#include "styles/style_chat.h" #include #include @@ -595,6 +596,7 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) { tr::now, lt_parent_name, bot->name()) }, + .icon = &st::toastCheckIcon, }); }, }); diff --git a/Telegram/SourceFiles/boxes/star_gift_auction_box.cpp b/Telegram/SourceFiles/boxes/star_gift_auction_box.cpp index 805cc67a3b..81475cff97 100644 --- a/Telegram/SourceFiles/boxes/star_gift_auction_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_auction_box.cpp @@ -70,6 +70,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_menu_icons.h" #include "styles/style_premium.h" #include "styles/style_settings.h" +#include "styles/style_widgets.h" #include #include @@ -892,6 +893,8 @@ void AuctionBidBox(not_null box, AuctionBidBoxArgs &&args) { lt_count, perRound, tr::rich), + .icon = &st::auctionBidToastIcon, + .iconPadding = st::auctionBidToast.padding, .st = &st::auctionBidToast, .attach = RectPart::Top, .duration = kBidPlacedToastDuration, diff --git a/Telegram/SourceFiles/chat_helpers/chat_helpers.style b/Telegram/SourceFiles/chat_helpers/chat_helpers.style index 64f6597098..7c9fb85fad 100644 --- a/Telegram/SourceFiles/chat_helpers/chat_helpers.style +++ b/Telegram/SourceFiles/chat_helpers/chat_helpers.style @@ -848,32 +848,31 @@ reactPanelScrollRounded: ScrollArea(emojiScroll) { deltab: 14px; } selfForwardsTaggerStripSkip: 26px; -selfForwardsTaggerIcon: size(32px, 32px); + +selfForwardsTaggerIconPadding: margins(14px, 2px, 8px, 2px); selfForwardsTaggerToast: Toast(defaultToast) { minWidth: 160px; maxWidth: 380px; radius: 9px; - padding: margins(54px, 12px, 19px, 12px); - iconPosition: point(15px, 6px); + padding: margins(19px, 12px, 19px, 12px); } joinChatAddToFilterToast: Toast(defaultToast) { minWidth: 160px; maxWidth: 380px; radius: 9px; - padding: margins(54px, 12px, 44px, 12px); - iconPosition: point(15px, 6px); + padding: margins(7px, 12px, 44px, 12px); } joinChatAddToFilterToastButton: IconButton(defaultIconButton) { width: 40px; height: 40px; icon: icon{ - { "chat/reactions_round_small", windowBgRipple }, - { "chat/reactions_expand_panel", windowSubTextFg }, + { "chat/reactions_round_small", toastFg }, + { "chat/reactions_expand_panel", toastBg }, }; iconOver: icon{ - { "chat/reactions_round_small", windowBgRipple }, - { "chat/reactions_expand_panel", windowSubTextFg }, + { "chat/reactions_round_small", toastFg }, + { "chat/reactions_expand_panel", toastBg }, }; rippleAreaPosition: point(10px, 10px); rippleAreaSize: 20px; diff --git a/Telegram/SourceFiles/core/click_handler_types.cpp b/Telegram/SourceFiles/core/click_handler_types.cpp index d7db236cef..1d1f20c7f4 100644 --- a/Telegram/SourceFiles/core/click_handler_types.cpp +++ b/Telegram/SourceFiles/core/click_handler_types.cpp @@ -17,7 +17,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_session.h" #include "ui/boxes/confirm_box.h" #include "ui/toast/toast.h" -#include "ui/toast/toast_lottie_icon.h" #include "ui/widgets/popup_menu.h" #include "base/qthelp_regex.h" #include "base/qt/qt_key_modifiers.h" @@ -185,20 +184,15 @@ void DoneSetReminder(std::shared_ptr show) { } return false; }; - const auto toast = show->showToast({ + show->showToast({ .text = text, .filter = filter, + .iconLottie = u"toast/saved_messages"_q, + .iconPadding = st::selfForwardsTaggerIconPadding, .st = &st::selfForwardsTaggerToast, .attach = RectPart::Top, .duration = kReminderSetToastDuration, }); - if (const auto strong = toast.get()) { - Ui::AddLottieToToast( - strong->widget(), - st::selfForwardsTaggerToast, - st::selfForwardsTaggerIcon, - u"toast/saved_messages"_q); - } }; } // namespace diff --git a/Telegram/SourceFiles/core/deep_links/deep_links_new.cpp b/Telegram/SourceFiles/core/deep_links/deep_links_new.cpp index fd3407102b..99fa0f0901 100644 --- a/Telegram/SourceFiles/core/deep_links/deep_links_new.cpp +++ b/Telegram/SourceFiles/core/deep_links/deep_links_new.cpp @@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_session.h" #include "ui/toast/toast.h" #include "window/window_session_controller.h" +#include "styles/style_chat.h" namespace Core::DeepLinks { namespace { @@ -92,6 +93,7 @@ Result ShowNewBot(const Context &ctx) { tr::now, lt_parent_name, managerBot->name()) }, + .icon = &st::toastCheckIcon, }); } }, diff --git a/Telegram/SourceFiles/history/history_view_top_toast.cpp b/Telegram/SourceFiles/history/history_view_top_toast.cpp index a68061b9f7..0b825bba49 100644 --- a/Telegram/SourceFiles/history/history_view_top_toast.cpp +++ b/Telegram/SourceFiles/history/history_view_top_toast.cpp @@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/toast/toast.h" #include "core/ui_integration.h" #include "styles/style_chat.h" +#include "styles/style_widgets.h" namespace HistoryView { @@ -35,6 +36,7 @@ void InfoTooltip::show( _topToast = Ui::Toast::Show(parent, Ui::Toast::Config{ .text = text, .textContext = Core::TextContext({ .session = session }), + .icon = &st::historyInfoToastIcon, .st = &st::historyInfoToast, .attach = RectPart::Top, .duration = CountToastDuration(text), diff --git a/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.cpp b/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.cpp index 9c1908f71e..0fd53e51c8 100644 --- a/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.cpp +++ b/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.cpp @@ -27,7 +27,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/text/text_utilities.h" #include "ui/toast/toast_widget.h" #include "ui/toast/toast.h" -#include "ui/toast/toast_lottie_icon.h" #include "ui/widgets/buttons.h" #include "ui/widgets/popup_menu.h" #include "ui/widgets/tooltip.h" @@ -227,30 +226,21 @@ void SelfForwardsTagger::showToast( .textContext = Core::TextContext({ .session = &_controller->session(), }), + .iconLottie = u"toast/saved_messages"_q, + .iconPadding = st::selfForwardsTaggerIconPadding, .st = &st::selfForwardsTaggerToast, .attach = RectPart::Top, .infinite = true, }); if (const auto strong = _toast.get()) { - const auto widget = strong->widget(); - createLottieIcon(widget, u"toast/saved_messages"_q); if (callback) { - QObject::connect(widget, &QObject::destroyed, callback); + QObject::connect(strong->widget(), &QObject::destroyed, callback); } } else if (callback) { callback(); } } -void SelfForwardsTagger::createLottieIcon( - not_null widget, - const QString &name) { - Ui::AddLottieToToast( - widget, - st::selfForwardsTaggerToast, - st::selfForwardsTaggerIcon, - name); -} void SelfForwardsTagger::showTaggedToast(DocumentId reaction) { auto text = tr::lng_message_tagged_with( @@ -271,6 +261,8 @@ void SelfForwardsTagger::showTaggedToast(DocumentId reaction) { .textContext = Core::TextContext({ .session = &_controller->session(), }), + .iconLottie = u"toast/tagged"_q, + .iconPadding = st::selfForwardsTaggerIconPadding, .padding = rpl::single(QMargins(0, 0, rightSkip, 0)), .st = &st, .attach = RectPart::Top, @@ -279,7 +271,6 @@ void SelfForwardsTagger::showTaggedToast(DocumentId reaction) { }); if (const auto strong = _toast.get()) { const auto widget = strong->widget(); - createLottieIcon(widget, u"toast/tagged"_q); const auto button = Ui::CreateChild(widget.get()); button->setClickedCallback([=] { @@ -321,6 +312,8 @@ void SelfForwardsTagger::showChannelFilterToast(not_null peer) { : tr::lng_add_group_to_filter_selector(tr::now); _toast = Ui::Toast::Show(_scroll, Ui::Toast::Config{ .text = { .text = toastText }, + .iconLottie = u"toast/chats_filter_in"_q, + .iconPadding = st::selfForwardsTaggerIconPadding, .st = &st::joinChatAddToFilterToast, .attach = RectPart::Top, .acceptinput = true, @@ -328,7 +321,6 @@ void SelfForwardsTagger::showChannelFilterToast(not_null peer) { }); if (const auto strong = _toast.get()) { const auto widget = strong->widget(); - createLottieIcon(widget, u"toast/chats_filter_in"_q); const auto rightButton = createRightButton(widget); const auto history = peer->owner().history(peer); diff --git a/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.h b/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.h index 4244de69fa..d011029831 100644 --- a/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.h +++ b/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.h @@ -60,7 +60,6 @@ private: void showToast(const TextWithEntities &text, Fn callback); void showTaggedToast(DocumentId); void showChannelFilterToast(not_null peer); - void createLottieIcon(not_null widget, const QString &name); not_null createRightButton( not_null widget); void setupToastTimer( diff --git a/Telegram/SourceFiles/settings/sections/settings_premium.cpp b/Telegram/SourceFiles/settings/sections/settings_premium.cpp index 2cb26d306e..d04f684bb4 100644 --- a/Telegram/SourceFiles/settings/sections/settings_premium.cpp +++ b/Telegram/SourceFiles/settings/sections/settings_premium.cpp @@ -67,6 +67,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_info.h" #include "styles/style_layers.h" #include "styles/style_settings.h" +#include "styles/style_widgets.h" namespace Settings { namespace { @@ -1918,6 +1919,7 @@ void ShowPremiumPromoToast( } return false; }), + .icon = &st::settingsToastStarIcon, .adaptive = true, .duration = Ui::Toast::kDefaultDuration * 2, }); diff --git a/Telegram/SourceFiles/settings/settings.style b/Telegram/SourceFiles/settings/settings.style index 7dc9a30dfc..99a8ac8e7d 100644 --- a/Telegram/SourceFiles/settings/settings.style +++ b/Telegram/SourceFiles/settings/settings.style @@ -789,3 +789,6 @@ detailedSettingsButtonStyle: DetailedSettingsButtonStyle { descriptionBottomSkip: 8px; descriptionRightSkip: 4px; } + +settingsToastStarIcon: icon {{ "toast/star", toastFg }}; + diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index b20ad42a66..ad311944dd 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -425,10 +425,9 @@ historyDiceToast: Toast(defaultToast) { historyInfoToast: Toast(defaultToast) { minWidth: msgMinWidth; maxWidth: 380px; - padding: margins(54px, 13px, 19px, 12px); - icon: icon {{ "toast_info", toastFg }}; - iconPosition: point(13px, 13px); + padding: margins(13px, 13px, 19px, 12px); } +historyInfoToastIcon: icon {{ "toast/info", toastFg }}; bubbleRadiusSmall: roundRadiusLarge; bubbleRadiusLarge: 16px; @@ -1538,3 +1537,6 @@ stateChangeBadgeMargin: margins(0px, 1px, 0px, 0px); historySummaryHeaderIconSize: 30px; historySummaryHeaderIconSizeInner: 5px; + +toastCheckIcon: icon {{ "toast/check-36x36", toastFg }}; +toastCheckIconPadding: margins(12px, 8px, 12px, 8px); diff --git a/Telegram/SourceFiles/ui/effects/credits.style b/Telegram/SourceFiles/ui/effects/credits.style index e7abc56f09..bac065bf84 100644 --- a/Telegram/SourceFiles/ui/effects/credits.style +++ b/Telegram/SourceFiles/ui/effects/credits.style @@ -560,10 +560,9 @@ auctionBidEmoji: IconEmoji { padding: margins(-4px, -2px, -4px, 0px); } auctionBidToast: Toast(defaultToast) { - padding: margins(54px, 13px, 19px, 12px); - icon: icon {{ "settings/toast_auction", toastFg }}; - iconPosition: point(18px, 18px); + padding: margins(19px, 13px, 19px, 12px); } +auctionBidToastIcon: icon {{ "toast/auction", toastFg }}; auctionAboutLogo: icon {{ "settings/large_auctions", windowFgActive }}; auctionAboutLogoPadding: margins(8px, 8px, 8px, 8px); auctionAboutTextPadding: margins(0px, 6px, 0px, 8px); diff --git a/Telegram/SourceFiles/ui/toast/toast_lottie_icon.cpp b/Telegram/SourceFiles/ui/toast/toast_lottie_icon.cpp deleted file mode 100644 index 58299b8bb9..0000000000 --- a/Telegram/SourceFiles/ui/toast/toast_lottie_icon.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop application for the Telegram messaging service. - -For license and copyright information please follow this link: -https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL -*/ -#include "ui/toast/toast_lottie_icon.h" - -#include "lottie/lottie_icon.h" -#include "ui/rp_widget.h" -#include "styles/style_widgets.h" - -namespace Ui { - -void AddLottieToToast( - not_null widget, - const style::Toast &st, - QSize iconSize, - const QString &name) { - const auto lottieWidget = CreateChild(widget); - struct State { - std::unique_ptr lottieIcon; - }; - const auto state = lottieWidget->lifetime().make_state(); - state->lottieIcon = Lottie::MakeIcon({ - .name = name, - .sizeOverride = iconSize, - }); - const auto icon = state->lottieIcon.get(); - lottieWidget->resize(iconSize); - lottieWidget->move(st.iconPosition); - lottieWidget->show(); - lottieWidget->raise(); - icon->animate( - [=] { lottieWidget->update(); }, - 0, - icon->framesCount() - 1); - lottieWidget->paintRequest() | rpl::on_next([=] { - auto p = QPainter(lottieWidget); - icon->paint(p, 0, 0); - }, lottieWidget->lifetime()); -} - -} // namespace Ui diff --git a/Telegram/SourceFiles/ui/toast/toast_lottie_icon.h b/Telegram/SourceFiles/ui/toast/toast_lottie_icon.h deleted file mode 100644 index adb6cc89fe..0000000000 --- a/Telegram/SourceFiles/ui/toast/toast_lottie_icon.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop application for the Telegram messaging service. - -For license and copyright information please follow this link: -https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL -*/ -#pragma once - -class QWidget; - -namespace style { -struct Toast; -} // namespace style - -namespace Ui { - -void AddLottieToToast( - not_null widget, - const style::Toast &st, - QSize iconSize, - const QString &name); - -} // namespace Ui diff --git a/Telegram/lib_lottie b/Telegram/lib_lottie index cba5d113eb..49d67cf66d 160000 --- a/Telegram/lib_lottie +++ b/Telegram/lib_lottie @@ -1 +1 @@ -Subproject commit cba5d113eb941c3eec20c4d171ff4ff9d1a92382 +Subproject commit 49d67cf66d3573cd71a3228af47a4ac59b64fc90 diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 673106851d..64145fe6ff 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 673106851d1af91728bf53c4399c009abb86490d +Subproject commit 64145fe6ffe9a46429153471cc815b5a9315d0e7