2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Allow float video player across accounts.

This commit is contained in:
John Preston
2020-06-25 18:17:37 +04:00
parent 8171ed6c12
commit bf7aae5fc6
38 changed files with 257 additions and 176 deletions

View File

@@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history_item.h"
#include "history/view/history_view_element.h"
//#include "history/feed/history_feed_section.h" // #feed
#include "media/player/media_player_instance.h"
#include "data/data_media_types.h"
#include "data/data_session.h"
#include "data/data_folder.h"
@@ -128,6 +129,10 @@ SessionController::SessionController(
this)) {
init();
if (Media::Player::instance()->pauseGifByRoundVideo()) {
enableGifPauseReason(GifPauseReason::RoundPlaying);
}
subscribe(session->api().fullPeerUpdated(), [=](PeerData *peer) {
if (peer == _showEditPeer) {
_showEditPeer = nullptr;
@@ -414,6 +419,12 @@ bool SessionController::isGifPausedAtLeastFor(GifPauseReason reason) const {
return (static_cast<int>(_gifPauseReasons) >= 2 * static_cast<int>(reason)) || !widget()->isActive();
}
void SessionController::floatPlayerAreaUpdated() {
if (const auto main = widget()->sessionContent()) {
main->floatPlayerAreaUpdated();
}
}
int SessionController::dialogsSmallColumnWidth() const {
return st::dialogsPadding.x() + st::dialogsPhotoSize + st::dialogsPadding.x();
}
@@ -781,39 +792,6 @@ not_null<MainWidget*> SessionController::content() const {
return widget()->sessionContent();
}
void SessionController::setDefaultFloatPlayerDelegate(
not_null<Media::Player::FloatDelegate*> delegate) {
Expects(_defaultFloatPlayerDelegate == nullptr);
_defaultFloatPlayerDelegate = delegate;
_floatPlayers = std::make_unique<Media::Player::FloatController>(
delegate);
}
void SessionController::replaceFloatPlayerDelegate(
not_null<Media::Player::FloatDelegate*> replacement) {
Expects(_floatPlayers != nullptr);
_replacementFloatPlayerDelegate = replacement;
_floatPlayers->replaceDelegate(replacement);
}
void SessionController::restoreFloatPlayerDelegate(
not_null<Media::Player::FloatDelegate*> replacement) {
Expects(_floatPlayers != nullptr);
if (_replacementFloatPlayerDelegate == replacement) {
_replacementFloatPlayerDelegate = nullptr;
_floatPlayers->replaceDelegate(_defaultFloatPlayerDelegate);
}
}
rpl::producer<FullMsgId> SessionController::floatPlayerClosed() const {
Expects(_floatPlayers != nullptr);
return _floatPlayers->closeEvents();
}
int SessionController::filtersWidth() const {
return _filters ? st::windowFiltersWidth : 0;
}