mirror of https://github.com/procxx/kepka.git
Fix inline result previews.
This commit is contained in:
parent
de230332b9
commit
60b39c8f7e
|
@ -625,7 +625,7 @@ void Photo::prepareThumbnail(QSize size, QSize frame) const {
|
|||
}
|
||||
|
||||
Video::Video(not_null<Context*> context, Result *result) : FileBase(context, result)
|
||||
, _link(getResultContentUrlHandler())
|
||||
, _link(getResultPreviewHandler())
|
||||
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
|
||||
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
|
||||
if (int duration = content_duration()) {
|
||||
|
@ -1057,7 +1057,7 @@ void Contact::prepareThumbnail(int width, int height) const {
|
|||
|
||||
Article::Article(not_null<Context*> context, Result *result, bool withThumb) : ItemBase(context, result)
|
||||
, _url(getResultUrlHandler())
|
||||
, _link(getResultContentUrlHandler())
|
||||
, _link(getResultPreviewHandler())
|
||||
, _withThumb(withThumb)
|
||||
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
|
||||
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
|
||||
|
|
|
@ -187,11 +187,16 @@ ClickHandlerPtr ItemBase::getResultUrlHandler() const {
|
|||
return ClickHandlerPtr();
|
||||
}
|
||||
|
||||
ClickHandlerPtr ItemBase::getResultContentUrlHandler() const {
|
||||
ClickHandlerPtr ItemBase::getResultPreviewHandler() const {
|
||||
if (!_result->_content_url.isEmpty()) {
|
||||
return std::make_shared<UrlClickHandler>(
|
||||
_result->_content_url,
|
||||
false);
|
||||
} else if (_result->_document && _result->_document->canBePlayed()) {
|
||||
return std::make_shared<DocumentOpenClickHandler>(
|
||||
_result->_document);
|
||||
} else if (_result->_photo) {
|
||||
return std::make_shared<PhotoOpenClickHandler>(_result->_photo);
|
||||
}
|
||||
return ClickHandlerPtr();
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ protected:
|
|||
int getResultDuration() const;
|
||||
QString getResultUrl() const;
|
||||
ClickHandlerPtr getResultUrlHandler() const;
|
||||
ClickHandlerPtr getResultContentUrlHandler() const;
|
||||
ClickHandlerPtr getResultPreviewHandler() const;
|
||||
QString getResultThumbLetter() const;
|
||||
|
||||
not_null<Context*> context() const {
|
||||
|
|
|
@ -272,9 +272,9 @@ bool Result::onChoose(Layout::ItemBase *layout) {
|
|||
} else if (_document->loading()) {
|
||||
_document->cancel();
|
||||
} else {
|
||||
_document->save(
|
||||
DocumentSaveClickHandler::Save(
|
||||
Data::FileOriginSavedGifs(),
|
||||
QString());
|
||||
_document);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2358,25 +2358,19 @@ void OverlayWidget::playbackPauseResume() {
|
|||
Expects(_streamed != nullptr);
|
||||
|
||||
_streamed->resumeOnCallEnd = false;
|
||||
if (const auto item = Auth().data().message(_msgid)) {
|
||||
if (_streamed->player.failed()) {
|
||||
clearStreaming();
|
||||
initStreaming();
|
||||
} else if (_streamed->player.finished()) {
|
||||
_streamingStartPaused = false;
|
||||
restartAtSeekPosition(0);
|
||||
} else if (_streamed->player.paused()) {
|
||||
_streamed->player.resume();
|
||||
updatePlaybackState();
|
||||
playbackPauseMusic();
|
||||
} else {
|
||||
_streamed->player.pause();
|
||||
updatePlaybackState();
|
||||
}
|
||||
} else {
|
||||
if (_streamed->player.failed()) {
|
||||
clearStreaming();
|
||||
updateControls();
|
||||
update();
|
||||
initStreaming();
|
||||
} else if (_streamed->player.finished()) {
|
||||
_streamingStartPaused = false;
|
||||
restartAtSeekPosition(0);
|
||||
} else if (_streamed->player.paused()) {
|
||||
_streamed->player.resume();
|
||||
updatePlaybackState();
|
||||
playbackPauseMusic();
|
||||
} else {
|
||||
_streamed->player.pause();
|
||||
updatePlaybackState();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3324,7 +3318,7 @@ void OverlayWidget::mousePressEvent(QMouseEvent *e) {
|
|||
void OverlayWidget::mouseDoubleClickEvent(QMouseEvent *e) {
|
||||
updateOver(e->pos());
|
||||
|
||||
if (_over == OverVideo) {
|
||||
if (_over == OverVideo && _streamed) {
|
||||
playbackToggleFullScreen();
|
||||
playbackPauseResume();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue