[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_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",
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -1177,7 +1178,7 @@ void OverlayWidget::refreshCaptionGeometry() {
|
|||
_groupThumbs = nullptr;
|
||||
_groupThumbsRect = QRect();
|
||||
}
|
||||
const auto captionBottom = (_streamed && !videoIsGifOrUserpic())
|
||||
const auto captionBottom = (_streamed/* && !videoIsGifOrUserpic()*/)
|
||||
? (_streamed->controls.y() - st::mediaviewCaptionMargin.height())
|
||||
: _groupThumbs
|
||||
? _groupThumbsTop
|
||||
|
|
@ -1519,7 +1520,7 @@ void OverlayWidget::contentSizeChanged() {
|
|||
}
|
||||
|
||||
void OverlayWidget::recountSkipTop() {
|
||||
const auto bottom = (!_streamed || videoIsGifOrUserpic())
|
||||
const auto bottom = (!_streamed/* || videoIsGifOrUserpic()*/)
|
||||
? height()
|
||||
: (_streamed->controls.y() - st::mediaviewCaptionPadding.bottom());
|
||||
const auto skipHeightBottom = (height() - bottom);
|
||||
|
|
@ -3105,7 +3106,7 @@ void OverlayWidget::displayDocument(
|
|||
}
|
||||
refreshFromLabel();
|
||||
_blurred = false;
|
||||
if (_showAsPip && _streamed && !videoIsGifOrUserpic()) {
|
||||
if (_showAsPip && _streamed/* && !videoIsGifOrUserpic()*/) {
|
||||
switchToPip();
|
||||
} else {
|
||||
displayFinished();
|
||||
|
|
@ -3348,12 +3349,12 @@ bool OverlayWidget::createStreamingObjects() {
|
|||
|| _document->isVoiceMessage()
|
||||
|| _document->isVideoMessage());
|
||||
|
||||
if (videoIsGifOrUserpic()) {
|
||||
_streamed->controls.hide();
|
||||
} else {
|
||||
// if (videoIsGifOrUserpic()) {
|
||||
// _streamed->controls.hide();
|
||||
// } else {
|
||||
refreshClipControllerGeometry();
|
||||
_streamed->controls.show();
|
||||
}
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3541,7 +3542,7 @@ void OverlayWidget::initThemePreview() {
|
|||
}
|
||||
|
||||
void OverlayWidget::refreshClipControllerGeometry() {
|
||||
if (!_streamed || videoIsGifOrUserpic()) {
|
||||
if (!_streamed/* || videoIsGifOrUserpic()*/) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3586,9 +3587,9 @@ void OverlayWidget::playbackControlsFromFullScreen() {
|
|||
}
|
||||
|
||||
void OverlayWidget::playbackControlsToPictureInPicture() {
|
||||
if (!videoIsGifOrUserpic()) {
|
||||
//if (!videoIsGifOrUserpic()) {
|
||||
switchToPip();
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
void OverlayWidget::playbackControlsRotate() {
|
||||
|
|
@ -3747,7 +3748,7 @@ void OverlayWidget::playbackControlsSpeedChanged(float64 speed) {
|
|||
Core::App().settings().setVideoPlaybackSpeed(speed);
|
||||
Core::App().saveSettingsDelayed();
|
||||
}
|
||||
if (_streamed && !videoIsGifOrUserpic()) {
|
||||
if (_streamed/* && !videoIsGifOrUserpic()*/) {
|
||||
DEBUG_LOG(("Media playback speed: %1 to _streamed.").arg(speed));
|
||||
_streamed->instance.setSpeed(speed);
|
||||
}
|
||||
|
|
@ -3758,8 +3759,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();
|
||||
|
|
@ -3811,7 +3815,7 @@ void OverlayWidget::switchToPip() {
|
|||
void OverlayWidget::playbackToggleFullScreen() {
|
||||
Expects(_streamed != nullptr);
|
||||
|
||||
if (!videoShown() || (videoIsGifOrUserpic() && !_fullScreenVideo)) {
|
||||
if (!videoShown()/* || (videoIsGifOrUserpic() && !_fullScreenVideo)*/) {
|
||||
return;
|
||||
}
|
||||
_fullScreenVideo = !_fullScreenVideo;
|
||||
|
|
@ -3868,9 +3872,11 @@ void OverlayWidget::playbackPauseMusic() {
|
|||
void OverlayWidget::updatePlaybackState() {
|
||||
Expects(_streamed != nullptr);
|
||||
|
||||
/*
|
||||
if (videoIsGifOrUserpic()) {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
const auto state = _streamed->instance.player().prepareLegacyState();
|
||||
if (state.position != kTimeUnknown && state.length != kTimeUnknown) {
|
||||
_streamed->controls.updatePlayback(state);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue