diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index f1616b6cd5..680059eec5 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -253,7 +253,7 @@ void Gif::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms if (width() < st::msgPadding.left() + st::msgPadding.right() + 1) return; const auto item = _parent->data(); - const auto displayLoading = (item->id < 0) || _data->displayLoading(); + const auto displayLoading = item->isSending() || _data->displayLoading(); const auto selected = (selection == FullSelection); const auto autoPaused = App::wnd()->sessionController()->isGifPausedAtLeastFor(Window::GifPauseReason::Any); const auto cornerDownload = downloadInCorner(); @@ -294,6 +294,7 @@ void Gif::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms if (displayLoading && (!streamedForWaiting || item->isSending() + || _data->uploading() || (cornerDownload && _data->loading()))) { ensureAnimation(); if (!_animation->radial.animating()) { @@ -595,8 +596,8 @@ void Gif::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms fullRight = maxRight; } } - if (isRound) { - _parent->drawInfo(p, fullRight, fullBottom, 2 * paintx + paintw, selected, InfoDisplayType::Background); + if (isRound || needInfoDisplay()) { + _parent->drawInfo(p, fullRight, fullBottom, 2 * paintx + paintw, selected, isRound ? InfoDisplayType::Background : InfoDisplayType::Image); } if (!bubble && _parent->displayRightAction()) { auto fastShareLeft = (fullRight + st::historyFastShareLeft); @@ -611,7 +612,7 @@ void Gif::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms } void Gif::drawCornerStatus(Painter &p, bool selected, QPoint position) const { - if (!needInfoDisplay()) { + if (!needCornerStatusDisplay()) { return; } const auto own = activeOwnStreamed(); @@ -662,7 +663,7 @@ TextState Gif::cornerStatusTextState( StateRequest request, QPoint position) const { auto result = TextState(_parent); - if (!needInfoDisplay() || !downloadInCorner() || _data->loaded()) { + if (!needCornerStatusDisplay() || !downloadInCorner() || _data->loaded()) { return result; } const auto padding = st::msgDateImgPadding; @@ -1430,10 +1431,14 @@ bool Gif::dataLoaded() const { } bool Gif::needInfoDisplay() const { - return _data->isVideoFile() - || _parent->data()->isSending() + return _parent->data()->isSending() || _data->uploading() || _parent->isUnderCursor(); } +bool Gif::needCornerStatusDisplay() const { + return _data->isVideoFile() + || needInfoDisplay(); +} + } // namespace HistoryView diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.h b/Telegram/SourceFiles/history/view/media/history_view_gif.h index efa35b4e1d..141fb6bddb 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.h +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.h @@ -135,14 +135,15 @@ private: void streamingReady(::Media::Streaming::Information &&info); void repaintStreamedContent(); - bool needInfoDisplay() const; - int additionalWidth( + [[nodiscard]] bool needInfoDisplay() const; + [[nodiscard]] bool needCornerStatusDisplay() const; + [[nodiscard]] int additionalWidth( const HistoryMessageVia *via, const HistoryMessageReply *reply, const HistoryMessageForwarded *forwarded) const; - int additionalWidth() const; - QString mediaTypeString() const; - bool isSeparateRoundVideo() const; + [[nodiscard]] int additionalWidth() const; + [[nodiscard]] QString mediaTypeString() const; + [[nodiscard]] bool isSeparateRoundVideo() const; void validateGroupedCache( const QRect &geometry, @@ -151,7 +152,7 @@ private: not_null cache) const; void setStatusSize(int newSize) const; void updateStatusText() const; - QSize sizeForAspectRatio() const; + [[nodiscard]] QSize sizeForAspectRatio() const; [[nodiscard]] bool downloadInCorner() const; void drawCornerStatus(Painter &p, bool selected, QPoint position) const;