From 5ad2900c9c801b8687bfc106071f7b07b8a9754a Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 1 Mar 2022 19:12:51 +0300 Subject: [PATCH] Hide controls in full screen stream by timeout. --- .../SourceFiles/calls/group/calls_group_panel.cpp | 15 ++++++++++++++- .../SourceFiles/calls/group/calls_group_panel.h | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp index 721a7c2349..e75d8062bc 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp @@ -71,6 +71,7 @@ constexpr auto kRecordingOpacity = 0.6; constexpr auto kStartNoConfirmation = TimeId(10); constexpr auto kControlsBackgroundOpacity = 0.8; constexpr auto kOverrideActiveColorBgAlpha = 172; +constexpr auto kHideControlsTimeout = 5 * crl::time(1000); } // namespace @@ -121,7 +122,8 @@ Panel::Panel(not_null call) , _hangup(widget(), st::groupCallHangup) , _stickedTooltipsShown(Core::App().settings().hiddenGroupCallTooltips() & ~StickedTooltip::Microphone) // Always show tooltip about mic. -, _toasts(std::make_unique(this)) { +, _toasts(std::make_unique(this)) +, _hideControlsTimer([=] { toggleWideControls(false); }) { _layerBg->setStyleOverrides(&st::groupCallBox, &st::groupCallLayerBox); _layerBg->setHideByBackgroundClick(true); @@ -1170,6 +1172,17 @@ void Panel::createPinOnTop() { _pinOnTop->setVisible(!fullscreen); if (fullscreen) { pin(false); + + _viewport->rp()->events( + ) | rpl::filter([](not_null event) { + return (event->type() == QEvent::MouseMove); + }) | rpl::start_with_next([=] { + _hideControlsTimer.callOnce(kHideControlsTimeout); + toggleWideControls(true); + }, _hideControlsTimerLifetime); + } else { + _hideControlsTimerLifetime.destroy(); + _hideControlsTimer.cancel(); } }, _pinOnTop->lifetime()); diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.h b/Telegram/SourceFiles/calls/group/calls_group_panel.h index 7b9a30d9a8..e7a3688e61 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_panel.h +++ b/Telegram/SourceFiles/calls/group/calls_group_panel.h @@ -256,6 +256,9 @@ private: std::unique_ptr _micLevelTester; + base::Timer _hideControlsTimer; + rpl::lifetime _hideControlsTimerLifetime; + rpl::lifetime _peerLifetime; };