From 05c95a0307d4cd57077e6711393b6af019205073 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 13 Feb 2020 16:34:19 +0400 Subject: [PATCH] Fix fullscreen rotate, fix rotate phrase. --- Telegram/Resources/langs/lang.strings | 1 + .../media/view/media_view_overlay_widget.cpp | 15 ++++++++++++--- .../media/view/media_view_playback_controls.cpp | 3 ++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index ddeb6c9cb..5578b330e 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1581,6 +1581,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_mediaview_video_loading" = "Loading - {percent}"; "lng_mediaview_playback_speed" = "Playback speed"; "lng_mediaview_playback_speed_normal" = "Normal"; +"lng_mediaview_rotate_video" = "Rotate video"; "lng_theme_preview_title" = "Theme Preview"; "lng_theme_preview_generating" = "Generating color theme preview..."; diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index 44b4f9368..c82d7cae7 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -920,8 +920,8 @@ void OverlayWidget::resizeContentByScreenSize() { _w = _width; _h = _height; } - _x = skipWidth + (usew - _w) / 2; - _y = skipHeight + (useh - _h) / 2; + _x = (width() - _w) / 2; + _y = (height() - _h) / 2; } float64 OverlayWidget::radialProgress() const { @@ -2571,17 +2571,26 @@ void OverlayWidget::playbackControlsVolumeChangeFinished() { } void OverlayWidget::playbackControlsSpeedChanged(float64 speed) { + DEBUG_LOG(("Media playback speed: change to %1.").arg(speed)); if (_doc) { + DEBUG_LOG(("Media playback speed: %1 to settings.").arg(speed)); _doc->session().settings().setVideoPlaybackSpeed(speed); _doc->session().saveSettingsDelayed(); } if (_streamed && !videoIsGifv()) { + DEBUG_LOG(("Media playback speed: %1 to _streamed.").arg(speed)); _streamed->instance.setSpeed(speed); } } float64 OverlayWidget::playbackControlsCurrentSpeed() { - return _doc ? _doc->session().settings().videoPlaybackSpeed() : 1.; + const auto result = _doc + ? _doc->session().settings().videoPlaybackSpeed() + : 1.; + DEBUG_LOG(("Media playback speed: now %1 (doc %2)." + ).arg(result + ).arg(Logs::b(_doc != nullptr))); + return result; } void OverlayWidget::switchToPip() { diff --git a/Telegram/SourceFiles/media/view/media_view_playback_controls.cpp b/Telegram/SourceFiles/media/view/media_view_playback_controls.cpp index 8228db670..3b57c63a6 100644 --- a/Telegram/SourceFiles/media/view/media_view_playback_controls.cpp +++ b/Telegram/SourceFiles/media/view/media_view_playback_controls.cpp @@ -223,7 +223,7 @@ void PlaybackControls::showMenu() { addSpeed(1.75); addSpeed(2.); _menu.emplace(this, st::mediaviewControlsPopupMenu); - _menu->addAction("Rotate video", [=] { + _menu->addAction(tr::lng_mediaview_rotate_video(tr::now), [=] { _delegate->playbackControlsRotate(); }); _menu->addSeparator(); @@ -235,6 +235,7 @@ void PlaybackControls::showMenu() { } void PlaybackControls::updatePlaybackSpeed(float64 speed) { + DEBUG_LOG(("Media playback speed: update to %1.").arg(speed)); _delegate->playbackControlsSpeedChanged(speed); resizeEvent(nullptr); }