From 96dbb38aaa1a8ba1c268ce45bef8f008723b3965 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 6 Apr 2017 14:37:13 +0300 Subject: [PATCH] Improve mute and info display in video messages. Display mute on top of the video and move info to the right side for incoming messages (because of channel authors and views count). --- .../history/history_media_types.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/history_media_types.cpp b/Telegram/SourceFiles/history/history_media_types.cpp index cdf0fa12ca..d957d7572b 100644 --- a/Telegram/SourceFiles/history/history_media_types.cpp +++ b/Telegram/SourceFiles/history/history_media_types.cpp @@ -1918,7 +1918,7 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, TimeM } } if (displayMute) { - auto muteRect = rtlrect(rthumb.x() + (rthumb.width() - st::historyVideoMessageMuteSize) / 2, rthumb.y() + rthumb.height() - st::msgDateImgDelta - st::historyVideoMessageMuteSize, st::historyVideoMessageMuteSize, st::historyVideoMessageMuteSize, _width); + auto muteRect = rtlrect(rthumb.x() + (rthumb.width() - st::historyVideoMessageMuteSize) / 2, rthumb.y() + st::msgDateImgDelta, st::historyVideoMessageMuteSize, st::historyVideoMessageMuteSize, _width); p.setPen(Qt::NoPen); p.setBrush(selected ? st::msgDateImgBgSelected : st::msgDateImgBg); PainterHighQualityEnabler hq(p); @@ -1955,6 +1955,23 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, TimeM } else if (_parent->getMedia() == this && (isRound || _data->uploading() || App::hoveredItem() == _parent)) { auto fullRight = skipx + width; auto fullBottom = skipy + height; + if (isRound && !outbg) { + auto infoWidth = _parent->infoWidth(); + + // This is just some arbitrary point, + // the main idea is to make info left aligned here. + fullRight += infoWidth - st::normalFont->height; + + auto maxRight = _parent->history()->width - st::msgMargin.left(); + if (_parent->history()->canHaveFromPhotos()) { + maxRight -= st::msgMargin.right(); + } else { + maxRight -= st::msgMargin.left(); + } + if (fullRight > maxRight) { + fullRight = maxRight; + } + } _parent->drawInfo(p, fullRight, fullBottom, 2 * skipx + width, selected, isRound ? InfoDisplayOverBackground : InfoDisplayOverImage); } }