From b016b859daff027d6f4e91273d5fa938ac920ad9 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 4 Jan 2016 19:28:41 +0800 Subject: [PATCH] dont display cancel X in sending photos and gifs from inline bots, version 0.9.16 --- Telegram/SourceFiles/history.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 27b4a18de..2096bd247 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -3354,11 +3354,16 @@ void HistoryPhoto::draw(Painter &p, const HistoryItem *parent, const QRect &r, b p.setOpacity(radialOpacity); style::sprite icon; if (radial || _data->loading()) { - icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); + DelayedStorageImage *delayed = _data->full->toDelayedStorageImage(); + if (!delayed || !delayed->location().isNull()) { + icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); + } } else { icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); } - p.drawSpriteCenter(inner, icon); + if (!icon.isEmpty()) { + p.drawSpriteCenter(inner, icon); + } if (radial) { p.setOpacity(1); QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); @@ -3403,8 +3408,15 @@ void HistoryPhoto::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x if (x >= skipx && y >= skipy && x < skipx + width && y < skipy + height) { if (_data->uploading()) { lnk = _cancell; + } else if (_data->loaded()) { + lnk = _openl; + } else if (_data->loading()) { + DelayedStorageImage *delayed = _data->full->toDelayedStorageImage(); + if (!delayed || !delayed->location().isNull()) { + lnk = _cancell; + } } else { - lnk = _data->loaded() ? _openl : (_data->loading() ? _cancell : _savel); + lnk = _savel; } if (_caption.isEmpty() && parent->getMedia() == this) { int32 fullRight = skipx + width, fullBottom = skipy + height; @@ -4563,11 +4575,15 @@ void HistoryGif::draw(Painter &p, const HistoryItem *parent, const QRect &r, boo if (_data->loaded() && !radial) { icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); } else if (radial || _data->loading()) { - icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); + if (parent->id > 0) { + icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); + } } else { icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); } - p.drawSpriteCenter(inner, icon); + if (!icon.isEmpty()) { + p.drawSpriteCenter(inner, icon); + } if (radial) { p.setOpacity(1); QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));