[Improvement] Video controls for GIFs
This commit is contained in:
parent
100b89161a
commit
1746993873
3 changed files with 23 additions and 14 deletions
|
|
@ -209,6 +209,7 @@
|
||||||
"ktg_disable_chat_themes": "Disable chat themes",
|
"ktg_disable_chat_themes": "Disable chat themes",
|
||||||
"ktg_settings_remember_compress_images": "Remember compress images",
|
"ktg_settings_remember_compress_images": "Remember compress images",
|
||||||
"ktg_settings_compress_images_default": "Compress images by default",
|
"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_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_in_app_update_disabled": "In-app updater is disabled.",
|
||||||
"ktg_settings_view_profile_on_top": "Show \"View Profile\" first",
|
"ktg_settings_view_profile_on_top": "Show \"View Profile\" first",
|
||||||
|
|
|
||||||
|
|
@ -286,10 +286,12 @@ void ResolveDocument(
|
||||||
|| document->isVoiceMessage()
|
|| document->isVoiceMessage()
|
||||||
|| document->isVideoMessage()) {
|
|| document->isVideoMessage()) {
|
||||||
::Media::Player::instance()->playPause({ document, msgId });
|
::Media::Player::instance()->playPause({ document, msgId });
|
||||||
|
/*
|
||||||
} else if (item
|
} else if (item
|
||||||
&& document->isAnimation()
|
&& document->isAnimation()
|
||||||
&& HistoryView::Gif::CanPlayInline(document)) {
|
&& HistoryView::Gif::CanPlayInline(document)) {
|
||||||
document->owner().requestAnimationPlayInline(item);
|
document->owner().requestAnimationPlayInline(item);
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
showDocument();
|
showDocument();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "media/view/media_view_overlay_widget.h"
|
#include "media/view/media_view_overlay_widget.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_lang.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "api/api_attached_stickers.h"
|
#include "api/api_attached_stickers.h"
|
||||||
#include "api/api_peer_photo.h"
|
#include "api/api_peer_photo.h"
|
||||||
|
|
@ -887,7 +888,7 @@ void OverlayWidget::refreshCaptionGeometry() {
|
||||||
_groupThumbs = nullptr;
|
_groupThumbs = nullptr;
|
||||||
_groupThumbsRect = QRect();
|
_groupThumbsRect = QRect();
|
||||||
}
|
}
|
||||||
const auto captionBottom = (_streamed && !videoIsGifOrUserpic())
|
const auto captionBottom = (_streamed/* && !videoIsGifOrUserpic()*/)
|
||||||
? (_streamed->controls.y() - st::mediaviewCaptionMargin.height())
|
? (_streamed->controls.y() - st::mediaviewCaptionMargin.height())
|
||||||
: _groupThumbs
|
: _groupThumbs
|
||||||
? _groupThumbsTop
|
? _groupThumbsTop
|
||||||
|
|
@ -1203,7 +1204,7 @@ void OverlayWidget::contentSizeChanged() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::resizeContentByScreenSize() {
|
void OverlayWidget::resizeContentByScreenSize() {
|
||||||
const auto bottom = (!_streamed || videoIsGifOrUserpic())
|
const auto bottom = (!_streamed/* || videoIsGifOrUserpic()*/)
|
||||||
? height()
|
? height()
|
||||||
: (_streamed->controls.y()
|
: (_streamed->controls.y()
|
||||||
- st::mediaviewCaptionPadding.bottom()
|
- st::mediaviewCaptionPadding.bottom()
|
||||||
|
|
@ -1509,7 +1510,7 @@ void OverlayWidget::hideControls(bool force) {
|
||||||
|| _menu
|
|| _menu
|
||||||
|| _mousePressed
|
|| _mousePressed
|
||||||
|| (_fullScreenVideo
|
|| (_fullScreenVideo
|
||||||
&& !videoIsGifOrUserpic()
|
/*&& !videoIsGifOrUserpic()*/
|
||||||
&& _streamed->controls.geometry().contains(_lastMouseMovePos))) {
|
&& _streamed->controls.geometry().contains(_lastMouseMovePos))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2666,7 +2667,7 @@ void OverlayWidget::displayDocument(
|
||||||
}
|
}
|
||||||
refreshFromLabel();
|
refreshFromLabel();
|
||||||
_blurred = false;
|
_blurred = false;
|
||||||
if (_showAsPip && _streamed && !videoIsGifOrUserpic()) {
|
if (_showAsPip && _streamed/* && !videoIsGifOrUserpic()*/) {
|
||||||
switchToPip();
|
switchToPip();
|
||||||
} else {
|
} else {
|
||||||
displayFinished();
|
displayFinished();
|
||||||
|
|
@ -2888,12 +2889,12 @@ bool OverlayWidget::createStreamingObjects() {
|
||||||
|| _document->isVoiceMessage()
|
|| _document->isVoiceMessage()
|
||||||
|| _document->isVideoMessage());
|
|| _document->isVideoMessage());
|
||||||
|
|
||||||
if (videoIsGifOrUserpic()) {
|
// if (videoIsGifOrUserpic()) {
|
||||||
_streamed->controls.hide();
|
// _streamed->controls.hide();
|
||||||
} else {
|
// } else {
|
||||||
refreshClipControllerGeometry();
|
refreshClipControllerGeometry();
|
||||||
_streamed->controls.show();
|
_streamed->controls.show();
|
||||||
}
|
// }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3081,7 +3082,7 @@ void OverlayWidget::initThemePreview() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::refreshClipControllerGeometry() {
|
void OverlayWidget::refreshClipControllerGeometry() {
|
||||||
if (!_streamed || videoIsGifOrUserpic()) {
|
if (!_streamed/* || videoIsGifOrUserpic()*/) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3116,9 +3117,9 @@ void OverlayWidget::playbackControlsFromFullScreen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::playbackControlsToPictureInPicture() {
|
void OverlayWidget::playbackControlsToPictureInPicture() {
|
||||||
if (!videoIsGifOrUserpic()) {
|
//if (!videoIsGifOrUserpic()) {
|
||||||
switchToPip();
|
switchToPip();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::playbackControlsRotate() {
|
void OverlayWidget::playbackControlsRotate() {
|
||||||
|
|
@ -3274,7 +3275,7 @@ void OverlayWidget::playbackControlsSpeedChanged(float64 speed) {
|
||||||
Core::App().settings().setVideoPlaybackSpeed(speed);
|
Core::App().settings().setVideoPlaybackSpeed(speed);
|
||||||
Core::App().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
}
|
}
|
||||||
if (_streamed && !videoIsGifOrUserpic()) {
|
if (_streamed/* && !videoIsGifOrUserpic()*/) {
|
||||||
DEBUG_LOG(("Media playback speed: %1 to _streamed.").arg(speed));
|
DEBUG_LOG(("Media playback speed: %1 to _streamed.").arg(speed));
|
||||||
_streamed->instance.setSpeed(speed);
|
_streamed->instance.setSpeed(speed);
|
||||||
}
|
}
|
||||||
|
|
@ -3287,8 +3288,11 @@ float64 OverlayWidget::playbackControlsCurrentSpeed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::switchToPip() {
|
void OverlayWidget::switchToPip() {
|
||||||
|
if (_document == nullptr) {
|
||||||
|
Ui::Toast::Show(_widget, ktr("ktg_pip_not_supported"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
Expects(_streamed != nullptr);
|
Expects(_streamed != nullptr);
|
||||||
Expects(_document != nullptr);
|
|
||||||
|
|
||||||
const auto document = _document;
|
const auto document = _document;
|
||||||
const auto message = _message;
|
const auto message = _message;
|
||||||
|
|
@ -3322,7 +3326,7 @@ void OverlayWidget::switchToPip() {
|
||||||
void OverlayWidget::playbackToggleFullScreen() {
|
void OverlayWidget::playbackToggleFullScreen() {
|
||||||
Expects(_streamed != nullptr);
|
Expects(_streamed != nullptr);
|
||||||
|
|
||||||
if (!videoShown() || (videoIsGifOrUserpic() && !_fullScreenVideo)) {
|
if (!videoShown()/* || (videoIsGifOrUserpic() && !_fullScreenVideo)*/) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_fullScreenVideo = !_fullScreenVideo;
|
_fullScreenVideo = !_fullScreenVideo;
|
||||||
|
|
@ -3376,9 +3380,11 @@ void OverlayWidget::playbackPauseMusic() {
|
||||||
void OverlayWidget::updatePlaybackState() {
|
void OverlayWidget::updatePlaybackState() {
|
||||||
Expects(_streamed != nullptr);
|
Expects(_streamed != nullptr);
|
||||||
|
|
||||||
|
/*
|
||||||
if (videoIsGifOrUserpic()) {
|
if (videoIsGifOrUserpic()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
const auto state = _streamed->instance.player().prepareLegacyState();
|
const auto state = _streamed->instance.player().prepareLegacyState();
|
||||||
if (state.position != kTimeUnknown && state.length != kTimeUnknown) {
|
if (state.position != kTimeUnknown && state.length != kTimeUnknown) {
|
||||||
_streamed->controls.updatePlayback(state);
|
_streamed->controls.updatePlayback(state);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue