From fdf4129e5e2045541b0d13510be1918d71876e81 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 2 Nov 2022 08:51:03 +0400 Subject: [PATCH] Fix build with GCC. --- Telegram/SourceFiles/apiwrap.cpp | 1 - .../boxes/peers/edit_forum_topic_box.cpp | 4 +--- .../boxes/peers/edit_peer_invite_link.cpp | 1 - Telegram/SourceFiles/boxes/share_box.cpp | 20 +++++++--------- .../calls/group/calls_group_settings.cpp | 1 - .../SourceFiles/chat_helpers/bot_keyboard.cpp | 4 ++-- .../SourceFiles/data/data_forum_topic.cpp | 4 +--- Telegram/SourceFiles/data/data_groups.cpp | 1 - Telegram/SourceFiles/data/data_histories.cpp | 1 - .../SourceFiles/dialogs/dialogs_widget.cpp | 3 --- .../controls/history_view_forward_panel.cpp | 1 - .../history/view/history_view_list_widget.cpp | 2 -- .../history/view/history_view_message.cpp | 2 +- .../view/history_view_replies_section.cpp | 1 - .../view/media/history_view_document.cpp | 2 +- .../media/history_view_extended_preview.cpp | 2 -- .../history/view/media/history_view_gif.cpp | 2 -- .../view/media/history_view_location.cpp | 1 - .../history/view/media/history_view_photo.cpp | 1 - .../media/history_view_theme_document.cpp | 2 -- Telegram/SourceFiles/info/info_controller.cpp | 1 - Telegram/SourceFiles/mainwidget.cpp | 1 - .../linux/notifications_manager_linux.cpp | 3 +++ .../linux/notifications_manager_linux.h | 1 + .../SourceFiles/settings/settings_intro.cpp | 1 - .../SourceFiles/ui/chat/message_bubble.cpp | 4 ---- .../SourceFiles/window/window_peer_menu.cpp | 23 ++++++++----------- Telegram/codegen | 2 +- 28 files changed, 28 insertions(+), 64 deletions(-) diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 100bbaa9e0..7d13a750ab 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -3487,7 +3487,6 @@ void ApiWrap::sendMessage(MessageToSend &&message) { HistoryItem *lastMessage = nullptr; auto &histories = history->owner().histories(); - const auto requestType = Data::Histories::RequestType::Send; while (TextUtilities::CutPart(sending, left, MaxMessageSize)) { auto newId = FullMsgId( diff --git a/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp index 87fa6ba593..0aacd73d32 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp @@ -261,9 +261,7 @@ struct IconSelector { selector->provideRecent(recent()); }, selector->lifetime()); - auto ownedFooter = selector->createFooter(); - const auto footer = ownedFooter.data(); - placeFooter(std::move(ownedFooter)); + placeFooter(selector->createFooter()); const auto shadow = Ui::CreateChild(box.get()); shadow->show(); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp index 569d57c6b0..17df8b9655 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp @@ -1186,7 +1186,6 @@ object_ptr ShareInviteLinkBox( } else { comment.text = link; } - const auto owner = &peer->owner(); auto &api = peer->session().api(); for (const auto thread : result) { auto message = Api::MessageToSend( diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index d929f9bdf4..080590e458 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -1125,25 +1125,21 @@ void ShareBox::Inner::chooseForumTopic(not_null forum) { updateChatName(chat); changePeerCheckState(chat, true); }; - auto initBox = [](not_null box) { - box->addButton(tr::lng_cancel(), [box] { + auto initBox = [=](not_null box) { + box->addButton(tr::lng_cancel(), [=] { box->closeBox(); }); + + forum->destroyed( + ) | rpl::start_with_next([=] { + box->closeBox(); + }, box->lifetime()); }; auto box = Box( std::make_unique( forum, std::move(chosen)), - [=](not_null box) { - box->addButton(tr::lng_cancel(), [=] { - box->closeBox(); - }); - - forum->destroyed( - ) | rpl::start_with_next([=] { - box->closeBox(); - }, box->lifetime()); - }); + std::move(initBox)); *weak = box.data(); _show->showBox(std::move(box)); } diff --git a/Telegram/SourceFiles/calls/group/calls_group_settings.cpp b/Telegram/SourceFiles/calls/group/calls_group_settings.cpp index f2f48c4ddd..e1edaf75f0 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_settings.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_settings.cpp @@ -180,7 +180,6 @@ object_ptr ShareInviteLinkBox( } else { comment.text = link; } - const auto owner = &peer->owner(); auto &api = peer->session().api(); for (const auto thread : result) { auto message = Api::MessageToSend( diff --git a/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp b/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp index 1a5efec605..f07740ccc8 100644 --- a/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp +++ b/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp @@ -141,7 +141,7 @@ void BotKeyboard::paintEvent(QPaintEvent *e) { _impl->paint( p, nullptr, - {}, + Ui::BubbleRounding(), width(), clip.translated(-x, -st::botKbScroll.deltat)); } @@ -249,7 +249,7 @@ void BotKeyboard::clickHandlerActiveChanged(const ClickHandlerPtr &p, bool activ void BotKeyboard::clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed) { if (!_impl) return; - _impl->clickHandlerPressedChanged(p, pressed, {}); + _impl->clickHandlerPressedChanged(p, pressed, Ui::BubbleRounding()); } bool BotKeyboard::updateMarkup(HistoryItem *to, bool force) { diff --git a/Telegram/SourceFiles/data/data_forum_topic.cpp b/Telegram/SourceFiles/data/data_forum_topic.cpp index 816cfeab73..bf1abed3d7 100644 --- a/Telegram/SourceFiles/data/data_forum_topic.cpp +++ b/Telegram/SourceFiles/data/data_forum_topic.cpp @@ -450,9 +450,7 @@ void ForumTopic::setLastMessage(HistoryItem *item) { void ForumTopic::setChatListMessage(HistoryItem *item) { if (_chatListMessage && *_chatListMessage == item) { return; - } - const auto was = _chatListMessage.value_or(nullptr); - if (item) { + } else if (item) { if (item->isSponsored()) { return; } diff --git a/Telegram/SourceFiles/data/data_groups.cpp b/Telegram/SourceFiles/data/data_groups.cpp index e36b6598fa..cf75482dbf 100644 --- a/Telegram/SourceFiles/data/data_groups.cpp +++ b/Telegram/SourceFiles/data/data_groups.cpp @@ -151,7 +151,6 @@ void Groups::refreshViews(const HistoryItemsList &items) { if (items.empty()) { return; } - const auto history = items.front()->history(); for (const auto &item : items) { _data->requestItemViewRefresh(item); item->invalidateChatListEntry(); diff --git a/Telegram/SourceFiles/data/data_histories.cpp b/Telegram/SourceFiles/data/data_histories.cpp index 0571723a34..7325c4ada8 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -962,7 +962,6 @@ void Histories::checkTopicCreated(FullMsgId rootId, MsgId realRoot) { std::move(entry.done), std::move(entry.fail)); } - const auto topic = history->peer->forumTopicFor(realRoot); for (const auto &item : history->clientSideMessages()) { const auto replace = [&](MsgId nowId) { return (nowId == rootId.msg) ? realRoot : nowId; diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index 31111d6582..d89866861b 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -953,7 +953,6 @@ void Widget::jumpToTop(bool belowPinned) { controller()->activeChatsFilterCurrent()) : session().data().chatsList(_openedFolder); const auto count = int(list->pinned()->order().size()); - const auto now = _scroll->scrollTop(); const auto row = _inner->st()->height; const auto min = (row * (count * 2 + 1) - _scroll->height()) / 2; if (_scroll->scrollTop() <= min) { @@ -1573,8 +1572,6 @@ void Widget::searchReceived( _lastSearchPeer = nullptr; _lastSearchId = _lastSearchMigratedId = 0; } - const auto isGlobalSearch = (type == SearchRequestType::FromStart) - || (type == SearchRequestType::FromOffset); const auto isMigratedSearch = (type == SearchRequestType::MigratedFromStart) || (type == SearchRequestType::MigratedFromOffset); const auto process = [&](const MTPVector &messages) { diff --git a/Telegram/SourceFiles/history/view/controls/history_view_forward_panel.cpp b/Telegram/SourceFiles/history/view/controls/history_view_forward_panel.cpp index 9d2029bee0..072e124e1a 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_forward_panel.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_forward_panel.cpp @@ -112,7 +112,6 @@ void ForwardPanel::updateTexts() { _text.clear(); return; } - int32 version = 0; QString from; TextWithEntities text; const auto keepNames = (_data.options diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index f220a262a8..a727f48b29 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -651,8 +651,6 @@ void ListWidget::showAtPosition( anim::type animated, Fn done) { const auto showAtUnread = (position == Data::UnreadMessagePosition); - const auto showAtStart = (position == Data::MinMessagePosition); - const auto showAtEnd = (position == Data::MaxMessagePosition); if (showAtUnread && jumpToBottomInsteadOfUnread()) { showAtPosition(Data::MaxMessagePosition, animated, std::move(done)); diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 265e8ed417..d37c05b5c1 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -3133,7 +3133,7 @@ Ui::BubbleRounding Message::countMessageRounding() const { || (context() == Context::Replies && data()->isDiscussionPost()); const auto right = !delegate()->elementIsChatWide() && hasOutLayout(); using Corner = Ui::BubbleCornerRounding; - return { + return Ui::BubbleRounding{ .topLeft = (smallTop && !right) ? Corner::Small : Corner::Large, .topRight = (smallTop && right) ? Corner::Small : Corner::Large, .bottomLeft = ((smallBottom && !right) diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp index bddb56baa5..2df571eca5 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp @@ -1934,7 +1934,6 @@ bool RepliesWidget::showMessage( if (!message) { return false; } - auto originFound = false; const auto originMessage = [&]() -> HistoryItem* { using OriginMessage = Window::SectionShow::OriginMessage; if (const auto origin = std::get_if(¶ms.origin)) { diff --git a/Telegram/SourceFiles/history/view/media/history_view_document.cpp b/Telegram/SourceFiles/history/view/media/history_view_document.cpp index 3bbb8a6e96..c2c7f622de 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_document.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_document.cpp @@ -760,7 +760,7 @@ Ui::BubbleRounding Document::thumbRounding( Ui::BubbleRounding outsideRounding) const { using Corner = Ui::BubbleCornerRounding; if (mode != LayoutMode::Grouped && _parent->media() != this) { - return {}; // In a WebPage preview. + return Ui::BubbleRounding(); // In a WebPage preview. } const auto hasCaption = Has(); const auto adjust = [&](Corner already, bool skip = false) { diff --git a/Telegram/SourceFiles/history/view/media/history_view_extended_preview.cpp b/Telegram/SourceFiles/history/view/media/history_view_extended_preview.cpp index 5710ecafc1..136e1fc0a8 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_extended_preview.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_extended_preview.cpp @@ -195,8 +195,6 @@ int ExtendedPreview::minWidthForButton() const { void ExtendedPreview::draw(Painter &p, const PaintContext &context) const { if (width() < st::msgPadding.left() + st::msgPadding.right() + 1) return; - const auto st = context.st; - const auto sti = context.imageStyle(); const auto stm = context.messageStyle(); auto paintx = 0, painty = 0, paintw = width(), painth = height(); auto bubble = _parent->hasBubble(); diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index e94f4df4b4..438e1e26a8 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -1110,8 +1110,6 @@ void Gif::drawGrouped( const auto radial = isRadialAnimation() || (streamedForWaiting && streamedForWaiting->waitingShown()); - const auto roundRadius = ImageRoundRadius::Large; - if (streamed) { const auto original = sizeForAspectRatio(); const auto originalWidth = style::ConvertScale(original.width()); diff --git a/Telegram/SourceFiles/history/view/media/history_view_location.cpp b/Telegram/SourceFiles/history/view/media/history_view_location.cpp index e710b09a4e..62ac280811 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_location.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_location.cpp @@ -160,7 +160,6 @@ void Location::draw(Painter &p, const PaintContext &context) const { auto paintx = 0, painty = 0, paintw = width(), painth = height(); bool bubble = _parent->hasBubble(); const auto st = context.st; - const auto sti = context.imageStyle(); const auto stm = context.messageStyle(); const auto hasText = !_title.isEmpty() || !_description.isEmpty(); diff --git a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp index fe0aaf432d..7d70024284 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp @@ -582,7 +582,6 @@ void Photo::drawGrouped( : highlightOpacity; if (overlayOpacity > 0.) { p.setOpacity(overlayOpacity); - const auto roundRadius = ImageRoundRadius::Large; fillImageOverlay(p, geometry, rounding, context); if (!context.selected()) { fillImageOverlay(p, geometry, rounding, context); diff --git a/Telegram/SourceFiles/history/view/media/history_view_theme_document.cpp b/Telegram/SourceFiles/history/view/media/history_view_theme_document.cpp index 6eaeac1e24..bc000ea1e5 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_theme_document.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_theme_document.cpp @@ -176,8 +176,6 @@ void ThemeDocument::draw(Painter &p, const PaintContext &context) const { const auto radial = isRadialAnimation(); auto rthumb = style::rtlrect(paintx, painty, paintw, painth, width()); - auto roundRadius = ImageRoundRadius::Small; - auto roundCorners = RectPart::AllCorners; validateThumbnail(); p.drawPixmap(rthumb.topLeft(), _thumbnail); if (context.selected()) { diff --git a/Telegram/SourceFiles/info/info_controller.cpp b/Telegram/SourceFiles/info/info_controller.cpp index e6cf0add84..58dda92fe5 100644 --- a/Telegram/SourceFiles/info/info_controller.cpp +++ b/Telegram/SourceFiles/info/info_controller.cpp @@ -210,7 +210,6 @@ void Controller::setupMigrationViewer() { void Controller::replaceWith(std::shared_ptr memento) { const auto window = parentController(); - const auto section = _section; auto params = Window::SectionShow( Window::SectionShow::Way::Backward, anim::type::instant, diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index da8e343cba..4ce65d6c16 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -516,7 +516,6 @@ bool MainWidget::setForwardDraft( not_null thread, Data::ForwardDraft &&draft) { const auto history = thread->owningHistory(); - const auto peer = history->peer; const auto items = session().data().idsToItems(draft.ids); const auto topicRootId = thread->topicRootId(); const auto error = GetErrorTextForSending( diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 91a63daa14..228b216acd 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -787,6 +787,7 @@ public: void showNotification( not_null peer, + MsgId topicRootId, std::shared_ptr &userpicView, MsgId msgId, const QString &title, @@ -1061,6 +1062,7 @@ Manager::~Manager() = default; void Manager::doShowNativeNotification( not_null peer, + MsgId topicRootId, std::shared_ptr &userpicView, MsgId msgId, const QString &title, @@ -1069,6 +1071,7 @@ void Manager::doShowNativeNotification( DisplayOptions options) { _private->showNotification( peer, + topicRootId, userpicView, msgId, title, diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h index 2212fa93b5..98ab2b81c9 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h @@ -21,6 +21,7 @@ public: protected: void doShowNativeNotification( not_null peer, + MsgId topicRootId, std::shared_ptr &userpicView, MsgId msgId, const QString &title, diff --git a/Telegram/SourceFiles/settings/settings_intro.cpp b/Telegram/SourceFiles/settings/settings_intro.cpp index 378559045a..e067f47fc6 100644 --- a/Telegram/SourceFiles/settings/settings_intro.cpp +++ b/Telegram/SourceFiles/settings/settings_intro.cpp @@ -514,7 +514,6 @@ void LayerWidget::paintEvent(QPaintEvent *e) { auto clip = e->rect(); auto r = st::boxRadius; - auto parts = RectPart::None | 0; const auto &pixmaps = Ui::CachedCornerPixmaps(Ui::BoxCorners); if (!_tillTop && clip.intersects({ 0, 0, width(), r })) { Ui::FillRoundRect(p, 0, 0, width(), r, st::boxBg, { diff --git a/Telegram/SourceFiles/ui/chat/message_bubble.cpp b/Telegram/SourceFiles/ui/chat/message_bubble.cpp index dee9257bd4..8459d6dd4d 100644 --- a/Telegram/SourceFiles/ui/chat/message_bubble.cpp +++ b/Telegram/SourceFiles/ui/chat/message_bubble.cpp @@ -238,7 +238,6 @@ void PaintSolidBubble(QPainter &p, const SimpleBubble &args) { auto &corners = (size == Corner::Large) ? st.msgBgCornersLarge : st.msgBgCornersSmall; - const auto &corner = corners.p[index]; p.drawPixmap(x, y, corners.p[index]); }, [&](const QPoint &bottomPosition) { tail.paint(p, bottomPosition - tailShift, args.outerWidth); @@ -341,15 +340,12 @@ void PaintBubble(QPainter &p, const ComplexBubble &args) { auto from = top; for (const auto &selected : args.selection) { if (selected.top > from) { - const auto fromTop = (from <= top); paintOne( QRect(left, from, width, selected.top - from), false, (from <= top), false); } - const auto fromTop = (selected.top <= top); - const auto tillBottom = (selected.top + selected.height >= bottom); paintOne( QRect(left, selected.top, width, selected.height), true, diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 1c99c93c2a..7762b7dd9c 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -485,7 +485,6 @@ void Filler::addTogglePin() { } const auto controller = _controller; const auto filterId = _request.filterId; - const auto peer = _peer; const auto thread = _request.key.thread(); if (!thread || thread->fixedOnTopIndex()) { return; @@ -501,7 +500,7 @@ void Filler::addTogglePin() { TogglePinnedThread(controller, strong, filterId); } }; - const auto pinAction = _addAction( + _addAction( pinText(), pinToggle, (thread->isPinnedDialog(filterId) @@ -1684,25 +1683,21 @@ QPointer ShowDropMediaBox( callback(); } }; - auto initBox = [](not_null box) { - box->addButton(tr::lng_cancel(), [box] { + auto initBox = [=](not_null box) { + box->addButton(tr::lng_cancel(), [=] { box->closeBox(); }); + + forum->destroyed( + ) | rpl::start_with_next([=] { + box->closeBox(); + }, box->lifetime()); }; *weak = navigation->parentController()->show(Box( std::make_unique( forum, std::move(chosen)), - [=](not_null box) { - box->addButton(tr::lng_cancel(), [=] { - box->closeBox(); - }); - - forum->destroyed( - ) | rpl::start_with_next([=] { - box->closeBox(); - }, box->lifetime()); - })); + std::move(initBox))); return weak->data(); } diff --git a/Telegram/codegen b/Telegram/codegen index 6e923872a4..7faff81653 160000 --- a/Telegram/codegen +++ b/Telegram/codegen @@ -1 +1 @@ -Subproject commit 6e923872a4b66767da93f7e388f9fcedf266e1aa +Subproject commit 7faff81653264b1cb9cfafeae04cdab82e21117d