[Improvement] Video controls for GIFs
This commit is contained in:
parent
f833b84b94
commit
d0b9f29074
2 changed files with 20 additions and 13 deletions
|
|
@ -189,6 +189,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",
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
@ -1177,7 +1178,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
|
||||||
|
|
@ -1519,7 +1520,7 @@ void OverlayWidget::contentSizeChanged() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::recountSkipTop() {
|
void OverlayWidget::recountSkipTop() {
|
||||||
const auto bottom = (!_streamed || videoIsGifOrUserpic())
|
const auto bottom = (!_streamed/* || videoIsGifOrUserpic()*/)
|
||||||
? height()
|
? height()
|
||||||
: (_streamed->controls.y() - st::mediaviewCaptionPadding.bottom());
|
: (_streamed->controls.y() - st::mediaviewCaptionPadding.bottom());
|
||||||
const auto skipHeightBottom = (height() - bottom);
|
const auto skipHeightBottom = (height() - bottom);
|
||||||
|
|
@ -3105,7 +3106,7 @@ void OverlayWidget::displayDocument(
|
||||||
}
|
}
|
||||||
refreshFromLabel();
|
refreshFromLabel();
|
||||||
_blurred = false;
|
_blurred = false;
|
||||||
if (_showAsPip && _streamed && !videoIsGifOrUserpic()) {
|
if (_showAsPip && _streamed/* && !videoIsGifOrUserpic()*/) {
|
||||||
switchToPip();
|
switchToPip();
|
||||||
} else {
|
} else {
|
||||||
displayFinished();
|
displayFinished();
|
||||||
|
|
@ -3348,12 +3349,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3541,7 +3542,7 @@ void OverlayWidget::initThemePreview() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::refreshClipControllerGeometry() {
|
void OverlayWidget::refreshClipControllerGeometry() {
|
||||||
if (!_streamed || videoIsGifOrUserpic()) {
|
if (!_streamed/* || videoIsGifOrUserpic()*/) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3586,9 +3587,9 @@ void OverlayWidget::playbackControlsFromFullScreen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::playbackControlsToPictureInPicture() {
|
void OverlayWidget::playbackControlsToPictureInPicture() {
|
||||||
if (!videoIsGifOrUserpic()) {
|
//if (!videoIsGifOrUserpic()) {
|
||||||
switchToPip();
|
switchToPip();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::playbackControlsRotate() {
|
void OverlayWidget::playbackControlsRotate() {
|
||||||
|
|
@ -3747,7 +3748,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);
|
||||||
}
|
}
|
||||||
|
|
@ -3758,8 +3759,11 @@ float64 OverlayWidget::playbackControlsCurrentSpeed(bool lastNonDefault) {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 messageId = _message ? _message->fullId() : FullMsgId();
|
const auto messageId = _message ? _message->fullId() : FullMsgId();
|
||||||
|
|
@ -3811,7 +3815,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;
|
||||||
|
|
@ -3868,9 +3872,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