From cf0d4a0559bf303976631f8c7ec24e68c5b9f61e Mon Sep 17 00:00:00 2001 From: John Preston <johnprestonmail@gmail.com> Date: Fri, 26 Apr 2019 18:43:25 +0400 Subject: [PATCH] Improve design of video download state. --- Telegram/SourceFiles/history/history.style | 4 ++-- .../SourceFiles/history/media/history_media_video.cpp | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/history/history.style b/Telegram/SourceFiles/history/history.style index ed4f0491a..5b5746925 100644 --- a/Telegram/SourceFiles/history/history.style +++ b/Telegram/SourceFiles/history/history.style @@ -562,12 +562,12 @@ historyGroupAboutHeaderSkip: 10px; historyGroupAboutTextSkip: 10px; historyGroupAboutSkip: 8px; -historyVideoDownloadSize: 36px; +historyVideoDownloadSize: msgFileSize; historyVideoCancel: icon {{ "playlist_cancel", historyFileThumbIconFg }}; historyVideoCancelSelected: icon {{ "playlist_cancel", historyFileThumbIconFgSelected }}; historyVideoDownload: icon {{ "playlist_download", historyFileThumbIconFg }}; historyVideoDownloadSelected: icon {{ "playlist_download", historyFileThumbIconFgSelected }}; -historyVideoRadialLine: 2px; +historyVideoRadialLine: msgFileRadialLine; historyAudioDownloadSize: 20px; historyAudioRadialLine: 2px; diff --git a/Telegram/SourceFiles/history/media/history_media_video.cpp b/Telegram/SourceFiles/history/media/history_media_video.cpp index 6e95a9723..1e28c0b96 100644 --- a/Telegram/SourceFiles/history/media/history_media_video.cpp +++ b/Telegram/SourceFiles/history/media/history_media_video.cpp @@ -275,18 +275,21 @@ void HistoryVideo::drawCornerStatus(Painter &p, bool selected) const { const auto padding = st::msgDateImgPadding; const auto radial = _animation && _animation->radial.animating(); const auto cornerDownload = downloadInCorner() && !_data->loaded(); - const auto addWidth = cornerDownload ? (st::historyVideoDownloadSize + 2 * padding.y() - padding.x()) : 0; + const auto addWidth = cornerDownload ? (st::historyVideoDownloadSize + 2 * padding.y()) : 0; const auto downloadWidth = cornerDownload ? st::normalFont->width(_downloadSize) : 0; - const auto statusX = st::msgDateImgDelta + padding.x(), statusY = st::msgDateImgDelta + padding.y(); const auto statusW = std::max(downloadWidth, st::normalFont->width(_statusText)) + 2 * padding.x() + addWidth; const auto statusH = cornerDownload ? (st::historyVideoDownloadSize + 2 * padding.y()) : (st::normalFont->height + 2 * padding.y()); + const auto statusX = st::msgDateImgDelta + padding.x(); + const auto statusY = st::msgDateImgDelta + padding.y(); const auto around = rtlrect(statusX - padding.x(), statusY - padding.y(), statusW, statusH, width()); + const auto statusTextTop = statusY + (cornerDownload ? (((statusH - 2 * st::normalFont->height) / 3) - padding.y()) : 0); App::roundRect(p, around, selected ? st::msgDateImgBgSelected : st::msgDateImgBg, selected ? DateSelectedCorners : DateCorners); p.setFont(st::normalFont); p.setPen(st::msgDateImgFg); - p.drawTextLeft(statusX + addWidth, statusY, width(), _statusText, statusW - 2 * padding.x()); + p.drawTextLeft(statusX + addWidth, statusTextTop, width(), _statusText, statusW - 2 * padding.x()); if (cornerDownload) { - p.drawTextLeft(statusX + addWidth, statusY + statusH - 2 * padding.y() - st::normalFont->height, width(), _downloadSize, statusW - 2 * padding.x()); + const auto downloadTextTop = statusY + st::normalFont->height + (2 * (statusH - 2 * st::normalFont->height) / 3) - padding.y(); + p.drawTextLeft(statusX + addWidth, downloadTextTop, width(), _downloadSize, statusW - 2 * padding.x()); const auto inner = QRect(statusX + padding.y() - padding.x(), statusY, st::historyVideoDownloadSize, st::historyVideoDownloadSize); const auto icon = [&]() -> const style::icon * { if (_data->loading()) {