2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 09:05:14 +00:00

Active round video moving to active window.

This commit is contained in:
John Preston
2023-01-19 11:40:39 +04:00
parent b80b770631
commit ec3957fcf3
14 changed files with 140 additions and 78 deletions

View File

@@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/buttons.h"
#include "ui/cached_round_corners.h"
#include "window/section_widget.h"
#include "window/window_controller.h"
#include "window/window_session_controller.h"
#include "window/main_window.h"
#include "main/main_session.h"
@@ -31,7 +32,7 @@ LayerWidget::LayerWidget(
: _controller(controller)
, _content(this, controller, Wrap::Layer, memento) {
setupHeightConsumers();
Core::App().replaceFloatPlayerDelegate(floatPlayerDelegate());
controller->window().replaceFloatPlayerDelegate(floatPlayerDelegate());
}
LayerWidget::LayerWidget(
@@ -40,7 +41,7 @@ LayerWidget::LayerWidget(
: _controller(controller)
, _content(memento->takeContent(this, Wrap::Layer)) {
setupHeightConsumers();
Core::App().replaceFloatPlayerDelegate(floatPlayerDelegate());
controller->window().replaceFloatPlayerDelegate(floatPlayerDelegate());
}
auto LayerWidget::floatPlayerDelegate()
@@ -52,6 +53,15 @@ not_null<Ui::RpWidget*> LayerWidget::floatPlayerWidget() {
return this;
}
void LayerWidget::floatPlayerToggleGifsPaused(bool paused) {
constexpr auto kReason = Window::GifPauseReason::RoundPlaying;
if (paused) {
_controller->enableGifPauseReason(kReason);
} else {
_controller->disableGifPauseReason(kReason);
}
}
auto LayerWidget::floatPlayerGetSection(Window::Column column)
-> not_null<::Media::Player::FloatSectionDelegate*> {
Expects(_content != nullptr);
@@ -357,7 +367,8 @@ void LayerWidget::paintEvent(QPaintEvent *e) {
void LayerWidget::restoreFloatPlayerDelegate() {
if (!_floatPlayerDelegateRestored) {
_floatPlayerDelegateRestored = true;
Core::App().restoreFloatPlayerDelegate(floatPlayerDelegate());
_controller->window().restoreFloatPlayerDelegate(
floatPlayerDelegate());
}
}