From f33a8c1d7df263f8a1374b5bd3ead8c6615ef145 Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Sun, 11 Sep 2022 02:53:31 +0300 Subject: [PATCH] [Improvement] Video controls for GIFs --- Telegram/Resources/langs/rewrites/en.json | 1 + .../media/view/media_view_overlay_widget.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json index ee06ff882..e1ff3f236 100644 --- a/Telegram/Resources/langs/rewrites/en.json +++ b/Telegram/Resources/langs/rewrites/en.json @@ -175,6 +175,7 @@ "ktg_disable_chat_themes": "Disable chat themes", "ktg_settings_remember_compress_images": "Remember compress images", "ktg_settings_compress_images_default": "Compress images by default", + "ktg_pip_not_supported": "Sorry, Picture-in-Picture mode is not supported here.", "ktg_forward_quiz_unquoted": "Sorry, quizzes that are currently open and unvoted on cannot be forwarded unquoted.", "ktg_in_app_update_disabled": "In-app updater is disabled.", "ktg_settings_view_profile_on_top": "Show \"View Profile\" first", diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index cfa414afe..0a9c1acb2 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "media/view/media_view_overlay_widget.h" +#include "kotato/kotato_lang.h" #include "apiwrap.h" #include "api/api_attached_stickers.h" #include "api/api_peer_photo.h" @@ -1069,8 +1070,8 @@ QSize OverlayWidget::videoSize() const { bool OverlayWidget::streamingRequiresControls() const { return !_stories - && _document - && (!_document->isAnimation() || _document->isVideoMessage()); + && _document; + //&& (!_document->isAnimation() || _document->isVideoMessage()); } QImage OverlayWidget::videoFrame() const { @@ -4225,8 +4226,11 @@ float64 OverlayWidget::playbackControlsCurrentSpeed(bool lastNonDefault) { } void OverlayWidget::switchToPip() { + if (_document == nullptr) { + Ui::Toast::Show(_widget, ktr("ktg_pip_not_supported")); + return; + } Expects(_streamed != nullptr); - Expects(_document != nullptr); const auto document = _document; const auto messageId = _message ? _message->fullId() : FullMsgId();