dont display cancel X in sending photos and gifs from inline bots, version 0.9.16

This commit is contained in:
John Preston 2016-01-04 19:28:41 +08:00
parent b201a5a975
commit b016b859da
1 changed files with 21 additions and 5 deletions

View File

@ -3354,11 +3354,16 @@ void HistoryPhoto::draw(Painter &p, const HistoryItem *parent, const QRect &r, b
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
style::sprite icon; style::sprite icon;
if (radial || _data->loading()) { 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 { } else {
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
} }
p.drawSpriteCenter(inner, icon); if (!icon.isEmpty()) {
p.drawSpriteCenter(inner, icon);
}
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); 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 (x >= skipx && y >= skipy && x < skipx + width && y < skipy + height) {
if (_data->uploading()) { if (_data->uploading()) {
lnk = _cancell; 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 { } else {
lnk = _data->loaded() ? _openl : (_data->loading() ? _cancell : _savel); lnk = _savel;
} }
if (_caption.isEmpty() && parent->getMedia() == this) { if (_caption.isEmpty() && parent->getMedia() == this) {
int32 fullRight = skipx + width, fullBottom = skipy + height; 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) { if (_data->loaded() && !radial) {
icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else if (radial || _data->loading()) { } else if (radial || _data->loading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); if (parent->id > 0) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
}
} else { } else {
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
} }
p.drawSpriteCenter(inner, icon); if (!icon.isEmpty()) {
p.drawSpriteCenter(inner, icon);
}
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));