Allow streaming video from overview.

This commit is contained in:
John Preston 2019-03-06 10:49:41 +04:00
parent 22356eb01c
commit aade3d4f27
2 changed files with 9 additions and 9 deletions

View File

@ -213,7 +213,7 @@ void HistoryVideo::draw(Painter &p, const QRect &r, TextSelection selection, crl
auto over = _animation->a_thumbOver.current(); auto over = _animation->a_thumbOver.current();
p.setBrush(anim::brush(st::msgDateImgBg, st::msgDateImgBgOver, over)); p.setBrush(anim::brush(st::msgDateImgBg, st::msgDateImgBgOver, over));
} else { } else {
bool over = ClickHandler::showAsActive(_data->loading() ? _cancell : _savel); bool over = ClickHandler::showAsActive((_data->loading() || _data->uploading()) ? _cancell : _savel);
p.setBrush(over ? st::msgDateImgBgOver : st::msgDateImgBg); p.setBrush(over ? st::msgDateImgBgOver : st::msgDateImgBg);
} }

View File

@ -492,7 +492,7 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const
if (selected) { if (selected) {
p.setBrush(st::msgDateImgBgSelected); p.setBrush(st::msgDateImgBgSelected);
} else { } else {
auto over = ClickHandler::showAsActive(loaded ? _openl : (_data->loading() ? _cancell : _savel)); auto over = ClickHandler::showAsActive((_data->loading() || _data->uploading()) ? _cancell : _data->canBePlayed() ? _openl : _savel);
p.setBrush(anim::brush(st::msgDateImgBg, st::msgDateImgBgOver, _a_iconOver.current(context->ms, over ? 1. : 0.))); p.setBrush(anim::brush(st::msgDateImgBg, st::msgDateImgBgOver, _a_iconOver.current(context->ms, over ? 1. : 0.)));
} }
@ -502,14 +502,14 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const
} }
p.setOpacity((radial && loaded) ? _radial->opacity() : 1); p.setOpacity((radial && loaded) ? _radial->opacity() : 1);
auto icon = ([radial, loaded, selected] { const auto icon = [&] {
if (radial) { if (_data->loading() || _data->uploading()) {
return &(selected ? st::historyFileThumbCancelSelected : st::historyFileThumbCancel); return &(selected ? st::historyFileThumbCancelSelected : st::historyFileThumbCancel);
} else if (loaded) { } else if (_data->canBePlayed()) {
return &(selected ? st::historyFileThumbPlaySelected : st::historyFileThumbPlay); return &(selected ? st::historyFileThumbPlaySelected : st::historyFileThumbPlay);
} }
return &(selected ? st::historyFileThumbDownloadSelected : st::historyFileThumbDownload); return &(selected ? st::historyFileThumbDownloadSelected : st::historyFileThumbDownload);
})(); }();
icon->paintInCenter(p, inner); icon->paintInCenter(p, inner);
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);
@ -546,10 +546,10 @@ TextState Video::getState(
bool loaded = _data->loaded(); bool loaded = _data->loaded();
if (hasPoint(point)) { if (hasPoint(point)) {
const auto link = loaded const auto link = (_data->loading() || _data->uploading())
? _openl
: _data->loading()
? _cancell ? _cancell
: _data->canBePlayed()
? _openl
: _savel; : _savel;
return { parent(), link }; return { parent(), link };
} }