Fix upload progress and message time display.

Fixes #6909.
This commit is contained in:
John Preston 2019-12-30 13:38:36 +03:00
parent 57b27d217c
commit 4aaecfd531
2 changed files with 19 additions and 13 deletions

View File

@ -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

View File

@ -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<QPixmap*> 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;