Active round video moving to active window.
This commit is contained in:
parent
b80b770631
commit
ec3957fcf3
14 changed files with 140 additions and 78 deletions
|
@ -184,6 +184,8 @@ Application::~Application() {
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setLastActiveWindow(nullptr);
|
||||||
|
_lastActivePrimaryWindow = nullptr;
|
||||||
_closingAsyncWindows.clear();
|
_closingAsyncWindows.clear();
|
||||||
_secondaryWindows.clear();
|
_secondaryWindows.clear();
|
||||||
_primaryWindows.clear();
|
_primaryWindows.clear();
|
||||||
|
@ -287,9 +289,8 @@ void Application::run() {
|
||||||
QMimeDatabase().mimeTypeForName(u"text/plain"_q);
|
QMimeDatabase().mimeTypeForName(u"text/plain"_q);
|
||||||
|
|
||||||
_primaryWindows.emplace(nullptr, std::make_unique<Window::Controller>());
|
_primaryWindows.emplace(nullptr, std::make_unique<Window::Controller>());
|
||||||
_lastActiveWindow
|
setLastActiveWindow(_primaryWindows.front().second.get());
|
||||||
= _lastActivePrimaryWindow
|
_lastActivePrimaryWindow = _lastActiveWindow;
|
||||||
= _primaryWindows.front().second.get();
|
|
||||||
|
|
||||||
_domain->activeChanges(
|
_domain->activeChanges(
|
||||||
) | rpl::start_with_next([=](not_null<Main::Account*> account) {
|
) | rpl::start_with_next([=](not_null<Main::Account*> account) {
|
||||||
|
@ -737,35 +738,12 @@ bool Application::screenIsLocked() const {
|
||||||
return _screenIsLocked;
|
return _screenIsLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setDefaultFloatPlayerDelegate(
|
void Application::floatPlayerToggleGifsPaused(bool paused) {
|
||||||
not_null<Media::Player::FloatDelegate*> delegate) {
|
_floatPlayerGifsPaused = paused;
|
||||||
Expects(!_defaultFloatPlayerDelegate == !_floatPlayers);
|
if (_lastActiveWindow) {
|
||||||
|
if (const auto delegate = _lastActiveWindow->floatPlayerDelegate()) {
|
||||||
_defaultFloatPlayerDelegate = delegate;
|
delegate->floatPlayerToggleGifsPaused(paused);
|
||||||
_replacementFloatPlayerDelegate = nullptr;
|
}
|
||||||
if (_floatPlayers) {
|
|
||||||
_floatPlayers->replaceDelegate(delegate);
|
|
||||||
} else {
|
|
||||||
_floatPlayers = std::make_unique<Media::Player::FloatController>(
|
|
||||||
delegate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Application::replaceFloatPlayerDelegate(
|
|
||||||
not_null<Media::Player::FloatDelegate*> replacement) {
|
|
||||||
Expects(_floatPlayers != nullptr);
|
|
||||||
|
|
||||||
_replacementFloatPlayerDelegate = replacement;
|
|
||||||
_floatPlayers->replaceDelegate(replacement);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Application::restoreFloatPlayerDelegate(
|
|
||||||
not_null<Media::Player::FloatDelegate*> replacement) {
|
|
||||||
Expects(_floatPlayers != nullptr);
|
|
||||||
|
|
||||||
if (_replacementFloatPlayerDelegate == replacement) {
|
|
||||||
_replacementFloatPlayerDelegate = nullptr;
|
|
||||||
_floatPlayers->replaceDelegate(_defaultFloatPlayerDelegate);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1304,6 +1282,35 @@ bool Application::closeNonLastAsync(not_null<Window::Controller*> window) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::setLastActiveWindow(Window::Controller *window) {
|
||||||
|
_floatPlayerDelegateLifetime.destroy();
|
||||||
|
|
||||||
|
if (_floatPlayerGifsPaused && _lastActiveWindow) {
|
||||||
|
if (const auto delegate = _lastActiveWindow->floatPlayerDelegate()) {
|
||||||
|
delegate->floatPlayerToggleGifsPaused(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_lastActiveWindow = window;
|
||||||
|
if (!window) {
|
||||||
|
_floatPlayers = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window->floatPlayerDelegateValue(
|
||||||
|
) | rpl::start_with_next([=](Media::Player::FloatDelegate *value) {
|
||||||
|
if (!value) {
|
||||||
|
_floatPlayers = nullptr;
|
||||||
|
} else if (_floatPlayers) {
|
||||||
|
_floatPlayers->replaceDelegate(value);
|
||||||
|
} else if (value) {
|
||||||
|
_floatPlayers = std::make_unique<Media::Player::FloatController>(
|
||||||
|
value);
|
||||||
|
}
|
||||||
|
if (value && _floatPlayerGifsPaused) {
|
||||||
|
value->floatPlayerToggleGifsPaused(true);
|
||||||
|
}
|
||||||
|
}, _floatPlayerDelegateLifetime);
|
||||||
|
}
|
||||||
|
|
||||||
void Application::closeWindow(not_null<Window::Controller*> window) {
|
void Application::closeWindow(not_null<Window::Controller*> window) {
|
||||||
const auto next = (_primaryWindows.front().second.get() != window)
|
const auto next = (_primaryWindows.front().second.get() != window)
|
||||||
? _primaryWindows.front().second.get()
|
? _primaryWindows.front().second.get()
|
||||||
|
@ -1314,7 +1321,7 @@ void Application::closeWindow(not_null<Window::Controller*> window) {
|
||||||
_lastActivePrimaryWindow = next;
|
_lastActivePrimaryWindow = next;
|
||||||
}
|
}
|
||||||
if (_lastActiveWindow == window) {
|
if (_lastActiveWindow == window) {
|
||||||
_lastActiveWindow = next;
|
setLastActiveWindow(next);
|
||||||
if (_lastActiveWindow) {
|
if (_lastActiveWindow) {
|
||||||
_lastActiveWindow->activate();
|
_lastActiveWindow->activate();
|
||||||
_lastActiveWindow->widget()->updateGlobalMenu();
|
_lastActiveWindow->widget()->updateGlobalMenu();
|
||||||
|
@ -1371,7 +1378,8 @@ void Application::closeChatFromWindows(not_null<PeerData*> peer) {
|
||||||
void Application::windowActivated(not_null<Window::Controller*> window) {
|
void Application::windowActivated(not_null<Window::Controller*> window) {
|
||||||
const auto was = _lastActiveWindow;
|
const auto was = _lastActiveWindow;
|
||||||
const auto now = window;
|
const auto now = window;
|
||||||
_lastActiveWindow = window;
|
|
||||||
|
setLastActiveWindow(window);
|
||||||
|
|
||||||
if (window->isPrimary()) {
|
if (window->isPrimary()) {
|
||||||
_lastActivePrimaryWindow = window;
|
_lastActivePrimaryWindow = window;
|
||||||
|
|
|
@ -258,12 +258,7 @@ public:
|
||||||
[[nodiscard]] QString changelogLink() const;
|
[[nodiscard]] QString changelogLink() const;
|
||||||
|
|
||||||
// Float player.
|
// Float player.
|
||||||
void setDefaultFloatPlayerDelegate(
|
void floatPlayerToggleGifsPaused(bool paused);
|
||||||
not_null<Media::Player::FloatDelegate*> delegate);
|
|
||||||
void replaceFloatPlayerDelegate(
|
|
||||||
not_null<Media::Player::FloatDelegate*> replacement);
|
|
||||||
void restoreFloatPlayerDelegate(
|
|
||||||
not_null<Media::Player::FloatDelegate*> replacement);
|
|
||||||
[[nodiscard]] rpl::producer<FullMsgId> floatPlayerClosed() const;
|
[[nodiscard]] rpl::producer<FullMsgId> floatPlayerClosed() const;
|
||||||
|
|
||||||
// Calls.
|
// Calls.
|
||||||
|
@ -339,6 +334,7 @@ private:
|
||||||
void startSystemDarkModeViewer();
|
void startSystemDarkModeViewer();
|
||||||
void startTray();
|
void startTray();
|
||||||
|
|
||||||
|
void setLastActiveWindow(Window::Controller *window);
|
||||||
void showAccount(not_null<Main::Account*> account);
|
void showAccount(not_null<Main::Account*> account);
|
||||||
void enumerateWindows(
|
void enumerateWindows(
|
||||||
Fn<void(not_null<Window::Controller*>)> callback) const;
|
Fn<void(not_null<Window::Controller*>)> callback) const;
|
||||||
|
@ -412,8 +408,8 @@ private:
|
||||||
const std::unique_ptr<Tray> _tray;
|
const std::unique_ptr<Tray> _tray;
|
||||||
|
|
||||||
std::unique_ptr<Media::Player::FloatController> _floatPlayers;
|
std::unique_ptr<Media::Player::FloatController> _floatPlayers;
|
||||||
Media::Player::FloatDelegate *_defaultFloatPlayerDelegate = nullptr;
|
rpl::lifetime _floatPlayerDelegateLifetime;
|
||||||
Media::Player::FloatDelegate *_replacementFloatPlayerDelegate = nullptr;
|
bool _floatPlayerGifsPaused = false;
|
||||||
|
|
||||||
rpl::variable<bool> _passcodeLock;
|
rpl::variable<bool> _passcodeLock;
|
||||||
bool _screenIsLocked = false;
|
bool _screenIsLocked = false;
|
||||||
|
|
|
@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/cached_round_corners.h"
|
#include "ui/cached_round_corners.h"
|
||||||
#include "window/section_widget.h"
|
#include "window/section_widget.h"
|
||||||
|
#include "window/window_controller.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "window/main_window.h"
|
#include "window/main_window.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
@ -31,7 +32,7 @@ LayerWidget::LayerWidget(
|
||||||
: _controller(controller)
|
: _controller(controller)
|
||||||
, _content(this, controller, Wrap::Layer, memento) {
|
, _content(this, controller, Wrap::Layer, memento) {
|
||||||
setupHeightConsumers();
|
setupHeightConsumers();
|
||||||
Core::App().replaceFloatPlayerDelegate(floatPlayerDelegate());
|
controller->window().replaceFloatPlayerDelegate(floatPlayerDelegate());
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerWidget::LayerWidget(
|
LayerWidget::LayerWidget(
|
||||||
|
@ -40,7 +41,7 @@ LayerWidget::LayerWidget(
|
||||||
: _controller(controller)
|
: _controller(controller)
|
||||||
, _content(memento->takeContent(this, Wrap::Layer)) {
|
, _content(memento->takeContent(this, Wrap::Layer)) {
|
||||||
setupHeightConsumers();
|
setupHeightConsumers();
|
||||||
Core::App().replaceFloatPlayerDelegate(floatPlayerDelegate());
|
controller->window().replaceFloatPlayerDelegate(floatPlayerDelegate());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto LayerWidget::floatPlayerDelegate()
|
auto LayerWidget::floatPlayerDelegate()
|
||||||
|
@ -52,6 +53,15 @@ not_null<Ui::RpWidget*> LayerWidget::floatPlayerWidget() {
|
||||||
return this;
|
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)
|
auto LayerWidget::floatPlayerGetSection(Window::Column column)
|
||||||
-> not_null<::Media::Player::FloatSectionDelegate*> {
|
-> not_null<::Media::Player::FloatSectionDelegate*> {
|
||||||
Expects(_content != nullptr);
|
Expects(_content != nullptr);
|
||||||
|
@ -357,7 +367,8 @@ void LayerWidget::paintEvent(QPaintEvent *e) {
|
||||||
void LayerWidget::restoreFloatPlayerDelegate() {
|
void LayerWidget::restoreFloatPlayerDelegate() {
|
||||||
if (!_floatPlayerDelegateRestored) {
|
if (!_floatPlayerDelegateRestored) {
|
||||||
_floatPlayerDelegateRestored = true;
|
_floatPlayerDelegateRestored = true;
|
||||||
Core::App().restoreFloatPlayerDelegate(floatPlayerDelegate());
|
_controller->window().restoreFloatPlayerDelegate(
|
||||||
|
floatPlayerDelegate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ private:
|
||||||
void restoreFloatPlayerDelegate();
|
void restoreFloatPlayerDelegate();
|
||||||
not_null<::Media::Player::FloatDelegate*> floatPlayerDelegate();
|
not_null<::Media::Player::FloatDelegate*> floatPlayerDelegate();
|
||||||
not_null<Ui::RpWidget*> floatPlayerWidget() override;
|
not_null<Ui::RpWidget*> floatPlayerWidget() override;
|
||||||
|
void floatPlayerToggleGifsPaused(bool paused) override;
|
||||||
not_null<::Media::Player::FloatSectionDelegate*> floatPlayerGetSection(
|
not_null<::Media::Player::FloatSectionDelegate*> floatPlayerGetSection(
|
||||||
Window::Column column) override;
|
Window::Column column) override;
|
||||||
void floatPlayerEnumerateSections(Fn<void(
|
void floatPlayerEnumerateSections(Fn<void(
|
||||||
|
|
|
@ -89,7 +89,7 @@ Widget::Widget(
|
||||||
this,
|
this,
|
||||||
account,
|
account,
|
||||||
rpl::single(true))) {
|
rpl::single(true))) {
|
||||||
Core::App().setDefaultFloatPlayerDelegate(floatPlayerDelegate());
|
controller->setDefaultFloatPlayerDelegate(floatPlayerDelegate());
|
||||||
|
|
||||||
getData()->country = ComputeNewAccountCountry();
|
getData()->country = ComputeNewAccountCountry();
|
||||||
|
|
||||||
|
@ -175,6 +175,9 @@ not_null<Ui::RpWidget*> Widget::floatPlayerWidget() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Widget::floatPlayerToggleGifsPaused(bool paused) {
|
||||||
|
}
|
||||||
|
|
||||||
auto Widget::floatPlayerGetSection(Window::Column column)
|
auto Widget::floatPlayerGetSection(Window::Column column)
|
||||||
-> not_null<Media::Player::FloatSectionDelegate*> {
|
-> not_null<Media::Player::FloatSectionDelegate*> {
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -158,6 +158,7 @@ private:
|
||||||
[[nodiscard]] auto floatPlayerSectionDelegate()
|
[[nodiscard]] auto floatPlayerSectionDelegate()
|
||||||
-> not_null<Media::Player::FloatSectionDelegate*>;
|
-> not_null<Media::Player::FloatSectionDelegate*>;
|
||||||
not_null<Ui::RpWidget*> floatPlayerWidget() override;
|
not_null<Ui::RpWidget*> floatPlayerWidget() override;
|
||||||
|
void floatPlayerToggleGifsPaused(bool paused) override;
|
||||||
not_null<Media::Player::FloatSectionDelegate*> floatPlayerGetSection(
|
not_null<Media::Player::FloatSectionDelegate*> floatPlayerGetSection(
|
||||||
Window::Column column) override;
|
Window::Column column) override;
|
||||||
void floatPlayerEnumerateSections(Fn<void(
|
void floatPlayerEnumerateSections(Fn<void(
|
||||||
|
|
|
@ -271,9 +271,9 @@ MainWidget::MainWidget(
|
||||||
_callTopBar->finishAnimating();
|
_callTopBar->finishAnimating();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPrimary()) {
|
controller->window().setDefaultFloatPlayerDelegate(
|
||||||
Core::App().setDefaultFloatPlayerDelegate(floatPlayerDelegate());
|
floatPlayerDelegate());
|
||||||
}
|
|
||||||
Core::App().floatPlayerClosed(
|
Core::App().floatPlayerClosed(
|
||||||
) | rpl::start_with_next([=](FullMsgId itemId) {
|
) | rpl::start_with_next([=](FullMsgId itemId) {
|
||||||
floatPlayerClosed(itemId);
|
floatPlayerClosed(itemId);
|
||||||
|
@ -431,6 +431,15 @@ not_null<Ui::RpWidget*> MainWidget::floatPlayerWidget() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWidget::floatPlayerToggleGifsPaused(bool paused) {
|
||||||
|
constexpr auto kReason = Window::GifPauseReason::RoundPlaying;
|
||||||
|
if (paused) {
|
||||||
|
_controller->enableGifPauseReason(kReason);
|
||||||
|
} else {
|
||||||
|
_controller->disableGifPauseReason(kReason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto MainWidget::floatPlayerGetSection(Window::Column column)
|
auto MainWidget::floatPlayerGetSection(Window::Column column)
|
||||||
-> not_null<Media::Player::FloatSectionDelegate*> {
|
-> not_null<Media::Player::FloatSectionDelegate*> {
|
||||||
if (isThreeColumn()) {
|
if (isThreeColumn()) {
|
||||||
|
|
|
@ -306,6 +306,7 @@ private:
|
||||||
[[nodiscard]] auto floatPlayerDelegate()
|
[[nodiscard]] auto floatPlayerDelegate()
|
||||||
-> not_null<Media::Player::FloatDelegate*>;
|
-> not_null<Media::Player::FloatDelegate*>;
|
||||||
not_null<Ui::RpWidget*> floatPlayerWidget() override;
|
not_null<Ui::RpWidget*> floatPlayerWidget() override;
|
||||||
|
void floatPlayerToggleGifsPaused(bool paused) override;
|
||||||
not_null<Media::Player::FloatSectionDelegate*> floatPlayerGetSection(
|
not_null<Media::Player::FloatSectionDelegate*> floatPlayerGetSection(
|
||||||
Window::Column column) override;
|
Window::Column column) override;
|
||||||
void floatPlayerEnumerateSections(Fn<void(
|
void floatPlayerEnumerateSections(Fn<void(
|
||||||
|
|
|
@ -130,6 +130,7 @@ public:
|
||||||
class FloatDelegate {
|
class FloatDelegate {
|
||||||
public:
|
public:
|
||||||
virtual not_null<Ui::RpWidget*> floatPlayerWidget() = 0;
|
virtual not_null<Ui::RpWidget*> floatPlayerWidget() = 0;
|
||||||
|
virtual void floatPlayerToggleGifsPaused(bool paused) = 0;
|
||||||
virtual not_null<FloatSectionDelegate*> floatPlayerGetSection(
|
virtual not_null<FloatSectionDelegate*> floatPlayerGetSection(
|
||||||
Window::Column column) = 0;
|
Window::Column column) = 0;
|
||||||
virtual void floatPlayerEnumerateSections(Fn<void(
|
virtual void floatPlayerEnumerateSections(Fn<void(
|
||||||
|
|
|
@ -25,12 +25,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
#include "data/data_media_types.h"
|
#include "data/data_media_types.h"
|
||||||
#include "data/data_file_origin.h"
|
#include "data/data_file_origin.h"
|
||||||
#include "window/window_session_controller.h"
|
|
||||||
#include "window/window_controller.h"
|
|
||||||
#include "core/shortcuts.h"
|
#include "core/shortcuts.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "main/main_domain.h" // Domain::activeSessionValue.
|
#include "core/core_settings.h"
|
||||||
|
#include "window/window_controller.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include "main/main_domain.h" // Domain::activeSessionValue.
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "main/main_account.h" // session->account().sessionChanges().
|
#include "main/main_account.h" // session->account().sessionChanges().
|
||||||
#include "main/main_session_settings.h"
|
#include "main/main_session_settings.h"
|
||||||
|
@ -308,13 +308,7 @@ void Instance::clearStreamed(not_null<Data*> data, bool savePosition) {
|
||||||
data->streamed = nullptr;
|
data->streamed = nullptr;
|
||||||
|
|
||||||
_roundPlaying = false;
|
_roundPlaying = false;
|
||||||
// #TODO windows
|
Core::App().floatPlayerToggleGifsPaused(false);
|
||||||
if (const auto window = Core::App().activePrimaryWindow()) {
|
|
||||||
if (const auto controller = window->sessionController()) {
|
|
||||||
controller->disableGifPauseReason(
|
|
||||||
Window::GifPauseReason::RoundPlaying);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::refreshPlaylist(not_null<Data*> data) {
|
void Instance::refreshPlaylist(not_null<Data*> data) {
|
||||||
|
@ -1277,10 +1271,6 @@ void Instance::setupShortcuts() {
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Instance::pauseGifByRoundVideo() const {
|
|
||||||
return _roundPlaying;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Instance::stopAndClose() {
|
void Instance::stopAndClose() {
|
||||||
_closePlayerRequests.fire({});
|
_closePlayerRequests.fire({});
|
||||||
|
|
||||||
|
@ -1303,13 +1293,7 @@ void Instance::handleStreamingUpdate(
|
||||||
requestRoundVideoRepaint();
|
requestRoundVideoRepaint();
|
||||||
});
|
});
|
||||||
_roundPlaying = true;
|
_roundPlaying = true;
|
||||||
// #TODO windows
|
Core::App().floatPlayerToggleGifsPaused(true);
|
||||||
if (const auto window = Core::App().activePrimaryWindow()) {
|
|
||||||
if (const auto controller = window->sessionController()) {
|
|
||||||
controller->enableGifPauseReason(
|
|
||||||
Window::GifPauseReason::RoundPlaying);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
requestRoundVideoResize();
|
requestRoundVideoResize();
|
||||||
}
|
}
|
||||||
emitUpdate(data->type);
|
emitUpdate(data->type);
|
||||||
|
|
|
@ -166,8 +166,6 @@ public:
|
||||||
[[nodiscard]] rpl::producer<Seeking> seekingChanges(
|
[[nodiscard]] rpl::producer<Seeking> seekingChanges(
|
||||||
AudioMsgId::Type type) const;
|
AudioMsgId::Type type) const;
|
||||||
|
|
||||||
[[nodiscard]] bool pauseGifByRoundVideo() const;
|
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<> closePlayerRequests() const {
|
[[nodiscard]] rpl::producer<> closePlayerRequests() const {
|
||||||
return _closePlayerRequests.events();
|
return _closePlayerRequests.events();
|
||||||
}
|
}
|
||||||
|
|
|
@ -480,6 +480,40 @@ auto Controller::openInMediaViewRequests() const
|
||||||
return _openInMediaViewRequests.events();
|
return _openInMediaViewRequests.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Controller::setDefaultFloatPlayerDelegate(
|
||||||
|
not_null<Media::Player::FloatDelegate*> delegate) {
|
||||||
|
_defaultFloatPlayerDelegate = delegate;
|
||||||
|
_replacementFloatPlayerDelegate = nullptr;
|
||||||
|
_floatPlayerDelegate = delegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Controller::replaceFloatPlayerDelegate(
|
||||||
|
not_null<Media::Player::FloatDelegate*> replacement) {
|
||||||
|
Expects(_defaultFloatPlayerDelegate != nullptr);
|
||||||
|
|
||||||
|
_replacementFloatPlayerDelegate = replacement;
|
||||||
|
_floatPlayerDelegate = replacement;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Controller::restoreFloatPlayerDelegate(
|
||||||
|
not_null<Media::Player::FloatDelegate*> replacement) {
|
||||||
|
Expects(_defaultFloatPlayerDelegate != nullptr);
|
||||||
|
|
||||||
|
if (_replacementFloatPlayerDelegate == replacement) {
|
||||||
|
_replacementFloatPlayerDelegate = nullptr;
|
||||||
|
_floatPlayerDelegate = _defaultFloatPlayerDelegate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Controller::floatPlayerDelegate() const -> FloatDelegate* {
|
||||||
|
return _floatPlayerDelegate.current();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Controller::floatPlayerDelegateValue() const
|
||||||
|
-> rpl::producer<FloatDelegate*> {
|
||||||
|
return _floatPlayerDelegate.value();
|
||||||
|
}
|
||||||
|
|
||||||
rpl::lifetime &Controller::lifetime() {
|
rpl::lifetime &Controller::lifetime() {
|
||||||
return _lifetime;
|
return _lifetime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,10 @@ namespace Media::View {
|
||||||
struct OpenRequest;
|
struct OpenRequest;
|
||||||
} // namespace Media::View
|
} // namespace Media::View
|
||||||
|
|
||||||
|
namespace Media::Player {
|
||||||
|
class FloatDelegate;
|
||||||
|
} // namespace Media::Player
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
|
|
||||||
class Controller final : public base::has_weak_ptr {
|
class Controller final : public base::has_weak_ptr {
|
||||||
|
@ -114,9 +118,20 @@ public:
|
||||||
[[nodiscard]] auto openInMediaViewRequests() const
|
[[nodiscard]] auto openInMediaViewRequests() const
|
||||||
-> rpl::producer<Media::View::OpenRequest>;
|
-> rpl::producer<Media::View::OpenRequest>;
|
||||||
|
|
||||||
QPoint getPointForCallPanelCenter() const;
|
[[nodiscard]] QPoint getPointForCallPanelCenter() const;
|
||||||
|
|
||||||
rpl::lifetime &lifetime();
|
using FloatDelegate = Media::Player::FloatDelegate;
|
||||||
|
void setDefaultFloatPlayerDelegate(
|
||||||
|
not_null<Media::Player::FloatDelegate*> delegate);
|
||||||
|
void replaceFloatPlayerDelegate(
|
||||||
|
not_null<Media::Player::FloatDelegate*> replacement);
|
||||||
|
void restoreFloatPlayerDelegate(
|
||||||
|
not_null<Media::Player::FloatDelegate*> replacement);
|
||||||
|
[[nodiscard]] FloatDelegate *floatPlayerDelegate() const;
|
||||||
|
[[nodiscard]] auto floatPlayerDelegateValue() const
|
||||||
|
-> rpl::producer<FloatDelegate*>;
|
||||||
|
|
||||||
|
[[nodiscard]] rpl::lifetime &lifetime();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CreateArgs {
|
struct CreateArgs {
|
||||||
|
@ -154,6 +169,10 @@ private:
|
||||||
|
|
||||||
rpl::event_stream<Media::View::OpenRequest> _openInMediaViewRequests;
|
rpl::event_stream<Media::View::OpenRequest> _openInMediaViewRequests;
|
||||||
|
|
||||||
|
FloatDelegate *_defaultFloatPlayerDelegate = nullptr;
|
||||||
|
FloatDelegate *_replacementFloatPlayerDelegate = nullptr;
|
||||||
|
rpl::variable<FloatDelegate*> _floatPlayerDelegate = nullptr;
|
||||||
|
|
||||||
rpl::lifetime _accountLifetime;
|
rpl::lifetime _accountLifetime;
|
||||||
rpl::lifetime _lifetime;
|
rpl::lifetime _lifetime;
|
||||||
|
|
||||||
|
|
|
@ -745,10 +745,6 @@ SessionController::SessionController(
|
||||||
}
|
}
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
|
|
||||||
if (Media::Player::instance()->pauseGifByRoundVideo()) {
|
|
||||||
enableGifPauseReason(GifPauseReason::RoundPlaying);
|
|
||||||
}
|
|
||||||
|
|
||||||
session->changes().peerUpdates(
|
session->changes().peerUpdates(
|
||||||
Data::PeerUpdate::Flag::FullInfo
|
Data::PeerUpdate::Flag::FullInfo
|
||||||
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
||||||
|
|
Loading…
Reference in a new issue