From 2afc171bec78e9cb22d180f5cc8b978f12a911ce Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 10 Nov 2023 00:32:52 +0400 Subject: [PATCH 1/6] Version 4.11.6: Fix build with GCC. --- Telegram/SourceFiles/boxes/gift_premium_box.cpp | 2 +- .../SourceFiles/info/boosts/info_boosts_inner_widget.cpp | 2 -- Telegram/SourceFiles/ui/boxes/boost_box.cpp | 7 +------ 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index 96196bc11938a..1244964d2e8c3 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -692,7 +692,7 @@ void GiftCodePendingBox( AddTable(box->verticalLayout(), controller, data, true); - const auto footer = box->addRow( + box->addRow( object_ptr( box, tr::lng_gift_link_pending_footer(), diff --git a/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp b/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp index 84b7cad524978..34e0d926fffa7 100644 --- a/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp +++ b/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp @@ -184,8 +184,6 @@ void FillShareLink( label->clicks( ) | rpl::start_with_next(copyLink, label->lifetime()); - const auto copyShareWrap = content->add( - object_ptr(content)); { const auto wrap = content->add( object_ptr( diff --git a/Telegram/SourceFiles/ui/boxes/boost_box.cpp b/Telegram/SourceFiles/ui/boxes/boost_box.cpp index 633cb3e1fa692..83bd4fa37843e 100644 --- a/Telegram/SourceFiles/ui/boxes/boost_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/boost_box.cpp @@ -24,7 +24,7 @@ For license and copyright information please follow this link: namespace Ui { namespace { -[[nodiscrd]] BoostCounters AdjustByReached(BoostCounters data) { +[[nodiscard]] BoostCounters AdjustByReached(BoostCounters data) { const auto exact = (data.boosts == data.thisLevelBoosts); const auto reached = !data.nextLevelBoosts || (exact && data.mine > 0); if (reached) { @@ -465,11 +465,6 @@ void AskBoostBox( box->setWidth(st::boxWideWidth); box->setStyle(st::boostBox); - struct State { - bool submitted = false; - }; - const auto state = box->lifetime().make_state(); - FillBoostLimit( BoxShowFinishes(box), box->verticalLayout(), From 8d0fe601cf1a16eca642de05ffb78c329963ba1e Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 10 Nov 2023 16:25:55 +0400 Subject: [PATCH 2/6] Fix sending quote data with uploaded media. Fixes #27032. --- Telegram/SourceFiles/history/history_item.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 1bd5d52c28281..c9391f3fa00fb 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -2904,11 +2904,22 @@ FullStoryId HistoryItem::replyToStory() const { } FullReplyTo HistoryItem::replyTo() const { - return { - .messageId = replyToFullId(), - .storyId = replyToStory(), + auto result = FullReplyTo{ .topicRootId = topicRootId(), }; + if (const auto reply = Get()) { + const auto &fields = reply->fields(); + const auto peer = fields.externalPeerId; + const auto replyToPeer = peer ? peer : _history->peer->id; + if (const auto id = fields.messageId) { + result.messageId = { replyToPeer, id }; + result.quote = fields.quote; + } + if (const auto id = fields.storyId) { + result.storyId = { replyToPeer, id }; + } + } + return result; } void HistoryItem::setText(const TextWithEntities &textWithEntities) { From b959877598b21de0d01e641bbf70c7fc4a75b30a Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 10 Nov 2023 13:27:26 +0400 Subject: [PATCH 3/6] Use explicit nativeVirtualKey on Windows only. --- Telegram/lib_ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 0bee95570e7d2..85b25a109dc91 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 0bee95570e7d28afa5cee91b3d1c642051ba1da8 +Subproject commit 85b25a109dc916356d75836bff73710c846a5a40 From f7ea0e1d00764f563e6da847a4955ba2574e65e1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 10 Nov 2023 16:46:17 +0400 Subject: [PATCH 4/6] Fix modifications tracking in Ui::Text::String. Fixes #27031. --- Telegram/lib_ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 85b25a109dc91..024f438ce539d 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 85b25a109dc916356d75836bff73710c846a5a40 +Subproject commit 024f438ce539d627717e4793479c8b727e8df29b From c530d7cc891f6eb86691d067f40dbe9dabc7238b Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 10 Nov 2023 17:43:58 +0400 Subject: [PATCH 5/6] Apply Ui::Text::String modifications in highlighting. --- .../history/view/history_view_element.cpp | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram/SourceFiles/history/view/history_view_element.cpp index 1ba43758618b9..bacc1d8af8c31 100644 --- a/Telegram/SourceFiles/history/view/history_view_element.cpp +++ b/Telegram/SourceFiles/history/view/history_view_element.cpp @@ -1673,21 +1673,27 @@ TextSelection Element::FindSelectionFromQuote( } offset = i + 1; } - //for (const auto &modification : text.modifications()) { - // if (modification.position >= selection.to) { - // break; - // } else if (modification.position <= selection.from) { - // modified.from += modification.skipped; - // if (modification.added - // && modification.position < selection.from) { - // --modified.from; - // } - // } - // modified.to += modification.skipped; - // if (modification.added && modified.to > modified.from) { - // --modified.to; - // } - //} + for (const auto &modification : text.modifications()) { + if (modification.position >= result.to) { + break; + } + if (modification.added) { + ++result.to; + } + const auto shiftTo = std::min( + int(modification.skipped), + result.to - modification.position); + result.to -= shiftTo; + if (modification.position <= result.from) { + if (modification.added) { + ++result.from; + } + const auto shiftFrom = std::min( + int(modification.skipped), + result.from - modification.position); + result.from -= shiftFrom; + } + } return result; } From 468d4c5e4f3383dcbec01b6c09d77470c4073f5c Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 10 Nov 2023 18:01:41 +0400 Subject: [PATCH 6/6] Don't make multiboost badge gradient. --- Telegram/SourceFiles/ui/boxes/boost_box.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/ui/boxes/boost_box.cpp b/Telegram/SourceFiles/ui/boxes/boost_box.cpp index 83bd4fa37843e..0be48632caa0e 100644 --- a/Telegram/SourceFiles/ui/boxes/boost_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/boost_box.cpp @@ -98,11 +98,7 @@ namespace { auto hq = PainterHighQualityEnabler(p); const auto radius = std::min(badge->width(), badge->height()) / 2; p.setPen(Qt::NoPen); - auto brush = QLinearGradient( - QPointF(badge->width(), badge->height()), - QPointF()); - brush.setStops(Ui::Premium::ButtonGradientStops()); - p.setBrush(brush); + p.setBrush(st::premiumButtonBg2); p.drawRoundedRect(badge->rect(), radius, radius); }, badge->lifetime());