From d5b9effd2e0ba1f2a0ae1941f8f8d9f481ca8362 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 4 Mar 2022 18:24:44 +0400 Subject: [PATCH] Improve title text in RTMP full screen. --- .../icons/calls/navbar_pin_filled.png | Bin 0 -> 389 bytes .../icons/calls/navbar_pin_filled@2x.png | Bin 0 -> 638 bytes .../icons/calls/navbar_pin_filled@3x.png | Bin 0 -> 892 bytes Telegram/SourceFiles/calls/calls.style | 1 + .../calls/group/calls_group_panel.cpp | 94 ++++++++++++++---- .../calls/group/calls_group_panel.h | 3 + 6 files changed, 80 insertions(+), 18 deletions(-) create mode 100644 Telegram/Resources/icons/calls/navbar_pin_filled.png create mode 100644 Telegram/Resources/icons/calls/navbar_pin_filled@2x.png create mode 100644 Telegram/Resources/icons/calls/navbar_pin_filled@3x.png diff --git a/Telegram/Resources/icons/calls/navbar_pin_filled.png b/Telegram/Resources/icons/calls/navbar_pin_filled.png new file mode 100644 index 0000000000000000000000000000000000000000..9059f4c615cd621b63e73d961df67f4ec712254e GIT binary patch literal 389 zcmeAS@N?(olHy`uVBq!ia0vp^DnKm3!2~2_Z=H|?QjEnx?oJHr&dIz4a$Hg)JkxxA z8MJ_G4hF{dOa>N^5+IfWVg?501&j>LK$;OGwtxvPtFnL@&Xxcv^t->U8c4nOba4#v z;C(yEpUd4rqK%V%!_qkiY^Nk88n07OFJwJF!8@XexsW09hjd-OukYpjzi0Dw_U&8o zeCBuAwuSO{8&tF9mv73>yYtQ3n#|l-98K}8-(Z#1ucMwEo-f40xL3z>(r25~ zn^>a0baHRbogH^=TW+98(`kv@+ty}EeRO;K$f7T*aoKCO5VH@=lO|nHTIMQq7!(Aa Lu6{1-oD!M{@pFRx6Ih}r3IRABE6q0L7F1YI<53a#Xrz3z3) zWL8_2BU;rNB+II?e^JzIyC&;r83P+i#yu6Q1|VL?oYK{UVL2 zUa9-!+Tz z+=xN!Q~Ktck3V{pKD1X2UmY4?yG!+U$5#qPZD?f2i1oGDy#3wMf4dAQ{L z=94b2ELH8kc3P*(Y~&8VU$y*t;hZ^T3CH|h%k1U(*nb!%+B)9e_V)K*xi8(X8^5o4 zz3YO+ir+PM_SQ$_+Yc|?!E^9bgw|n$q<7o>mJ9ER3E+2kUDcDMJ^gf3QbDSz6z?wP zh2c3SC)nbr<}_W{mKynF-=h^C7iDf2?G%w})8(r$n|(IJBx&v%-ueG`-{pJo@V-lE zsF})MUj21dd*@w#?OjzWz#!_t8o(F=r+#c^vJbxa@aDVh-8!JS_jL7hS?83{1ORIk B1%Lnm literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/calls/navbar_pin_filled@3x.png b/Telegram/Resources/icons/calls/navbar_pin_filled@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..ab1a5b42589dc370395701f671f02060df7f9155 GIT binary patch literal 892 zcmeAS@N?(olHy`uVBq!ia0vp^IY8{e!2~4dShnv1QjEnx?oJHr&dIz4a$Hg)JkxxA z8MJ_G4hF{dOa>N^5+IfWVg?501&j>LK$;OGwtxvPo3nr!&h`K)JUc7+76Sv*Gfx-C zkP61PH_vxlCd#mXxU2v3;<^?gOAWtM;X6-w=6Oy0!|F9Vs@(keU-obN>RH8={2n!R zA8CE`=z+`6z?%L3*1DU!XCCC)Z2aEx#_`XOKc9KN_52@$&mS6inFJabSQHo-IUE?! znR#jpcHH!_@%!@UPtMjT^Vw&s_C7OQqvND0(v@O#Gso`lRr|o-~T>m-RUO|=TeOR91}@4SsQlyWr?1JUu655u+;?? zI>+X;-ca9t*G_^bBJkWR2Nvat9Rk(b_h$UDIu$tK*ZogVHR2uj$voAo*sIL){rT(e z{?{2MyZW0Z-F_RVBbFZ9clzlji97F#H`mUv{Av34?I};WL+~Cxke%eLJP=;^k5?i_coh6eiZFq1cYUUVfe+n*l{{yD!$W%}Y^=aj(z|Ni+YzFVhqCR4t&=V;QI z#VYr*HbxZfl&QQe&ckN8%BzHZJuyk8e99Bq|L56i+Hs{Z fSjzj6%JiR6jbTq$%${wTpp@_F>gTe~DWM4fU21)< literal 0 HcmV?d00001 diff --git a/Telegram/SourceFiles/calls/calls.style b/Telegram/SourceFiles/calls/calls.style index b8b366e70..beffca42b 100644 --- a/Telegram/SourceFiles/calls/calls.style +++ b/Telegram/SourceFiles/calls/calls.style @@ -1127,6 +1127,7 @@ groupCallPinOnTop: IconButton(groupCallTitleButton) { iconOver: icon{{ "calls/navbar_pin", groupCallMembersFg }}; iconPosition: point(0px, 2px); } +groupCallPinnedOnTop: icon{{ "calls/navbar_pin_filled", groupCallMembersFg }}; groupCallMajorBlobIdleRadius: 2px; groupCallMajorBlobMaxRadius: 4px; diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp index 738841d19..02a91665b 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp @@ -123,6 +123,11 @@ Panel::Panel(not_null call) , _stickedTooltipsShown(Core::App().settings().hiddenGroupCallTooltips() & ~StickedTooltip::Microphone) // Always show tooltip about mic. , _toasts(std::make_unique(this)) +, _controlsBackgroundColor([] { + auto result = st::groupCallBg->c; + result.setAlphaF(kControlsBackgroundOpacity); + return result; +}) , _hideControlsTimer([=] { toggleWideControls(false); }) { _layerBg->setStyleOverrides(&st::groupCallBox, &st::groupCallLayerBox); _layerBg->setHideByBackgroundClick(true); @@ -914,6 +919,12 @@ void Panel::raiseControls() { } } _mute->raise(); + if (_titleBackground) { + _titleBackground->raise(); + } + if (_title) { + _title->raise(); + } if (_recordingMark) { _recordingMark->raise(); } @@ -1137,8 +1148,8 @@ void Panel::createPinOnTop() { if (const auto handle = window()->windowHandle()) { handle->setFlag(Qt::WindowStaysOnTopHint, pin); _pinOnTop->setIconOverride( - pin ? &st::groupCallPinOnTop.iconOver : nullptr, - nullptr); + pin ? &st::groupCallPinnedOnTop : nullptr, + pin ? &st::groupCallPinnedOnTop : nullptr); if (!_pinOnTop->isHidden()) { showToast({ pin ? tr::lng_group_call_pinned_on_top(tr::now) @@ -1159,10 +1170,14 @@ void Panel::createPinOnTop() { _hideControlsTimer.callOnce(kHideControlsTimeout); toggleWideControls(true); }, _hideControlsTimerLifetime); + + _hideControlsTimer.callOnce(kHideControlsTimeout); } else { _hideControlsTimerLifetime.destroy(); _hideControlsTimer.cancel(); + refreshTitleGeometry(); } + refreshTitleBackground(); updateMembersGeometry(); }, _pinOnTop->lifetime()); @@ -1606,18 +1621,15 @@ void Panel::setupEmptyRtmp() { return; } struct Label { - Label(QWidget *parent, rpl::producer text) + Label( + QWidget *parent, + rpl::producer text, + const style::color &color) : widget(parent, std::move(text), st::groupCallVideoLimitLabel) - , color([] { - auto result = st::groupCallBg->c; - result.setAlphaF(kControlsBackgroundOpacity); - return result; - }) - , corners(st::groupCallControlsBackRadius, color.color()) { + , corners(st::groupCallControlsBackRadius, color) { } Ui::FlatLabel widget; - style::complex_color color; Ui::RoundRect corners; }; _emptyRtmp.create(widget()); @@ -1627,7 +1639,8 @@ void Panel::setupEmptyRtmp() { ? tr::lng_group_call_no_stream( lt_group, rpl::single(_peer->name)) - : tr::lng_group_call_no_stream_admin())); + : tr::lng_group_call_no_stream_admin()), + _controlsBackgroundColor.color()); _emptyRtmp->setAttribute(Qt::WA_TransparentForMouseEvents); _emptyRtmp->show(); _emptyRtmp->paintRequest( @@ -1677,6 +1690,31 @@ void Panel::refreshControlsBackground() { updateButtonsGeometry(); } +void Panel::refreshTitleBackground() { + if (!_fullScreenOrMaximized.current()) { + _titleBackground.destroy(); + return; + } else if (_titleBackground) { + return; + } + _titleBackground.create(widget()); + _titleBackground->show(); + raiseControls(); + auto &lifetime = _titleBackground->lifetime(); + const auto corners = lifetime.make_state( + st::roundRadiusLarge, + _controlsBackgroundColor.color()); + _titleBackground->paintRequest( + ) | rpl::start_with_next([=] { + auto p = QPainter(_titleBackground.data()); + corners->paintSomeRounded( + p, + _titleBackground->rect(), + RectPart::FullBottom); + }, lifetime); + refreshTitleGeometry(); +} + void Panel::setupControlsBackgroundNarrow() { _controlsBackgroundNarrow = std::make_unique( widget()); @@ -1773,14 +1811,9 @@ void Panel::setupControlsBackgroundWide() { _controlsBackgroundWide.create(widget()); _controlsBackgroundWide->show(); auto &lifetime = _controlsBackgroundWide->lifetime(); - const auto color = lifetime.make_state([] { - auto result = st::groupCallBg->c; - result.setAlphaF(kControlsBackgroundOpacity); - return result; - }); const auto corners = lifetime.make_state( st::groupCallControlsBackRadius, - color->color()); + _controlsBackgroundColor.color()); _controlsBackgroundWide->paintRequest( ) | rpl::start_with_next([=] { auto p = QPainter(_controlsBackgroundWide.data()); @@ -2156,6 +2189,9 @@ void Panel::updateButtonsGeometry() { _controlsBackgroundWide->setGeometry( rect.marginsAdded(st::groupCallControlsBackMargin)); } + if (_fullScreenOrMaximized.current()) { + refreshTitleGeometry(); + } } else { const auto muteTop = widget()->height() - st::groupCallMuteBottomSkip; @@ -2338,10 +2374,17 @@ void Panel::refreshTitleGeometry() { : fullRect; const auto best = _title->naturalWidth(); const auto from = (widget()->width() - best) / 2; - const auto top = (mode() == PanelMode::Default) + const auto shownTop = (mode() == PanelMode::Default) ? st::groupCallTitleTop : (st::groupCallWideVideoTop - st::groupCallTitleLabel.style.font->height) / 2; + const auto top = anim::interpolate( + -_title->height() - st::boxRadius, + shownTop, + (_fullScreenOrMaximized.current() + ? _wideControlsAnimation.value( + _wideControlsShown ? 1. : 0.) + : 1.)); const auto left = titleRect.x(); if (from >= left && from + best <= left + titleRect.width()) { _title->resizeToWidth(best); @@ -2362,6 +2405,21 @@ void Panel::refreshTitleGeometry() { _title->x() + _title->width(), markTop - st::groupCallRecordingMarkSkip); } + if (_titleBackground) { + const auto bottom = _title->y() + + _title->height() + + (st::boxRadius / 2); + const auto height = std::max(bottom, st::boxRadius * 2); + _titleBackground->setGeometry( + _title->x() - st::boxRadius, + bottom - height, + (_title->width() + + st::boxRadius + + (_recordingMark + ? (_recordingMark->width() + st::boxRadius / 2) + : st::boxRadius)), + height); + } } void Panel::paint(QRect clip) { diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.h b/Telegram/SourceFiles/calls/group/calls_group_panel.h index cc64b4102..f5de44893 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_panel.h +++ b/Telegram/SourceFiles/calls/group/calls_group_panel.h @@ -152,6 +152,7 @@ private: void updateButtonsStyles(); void updateMembersGeometry(); void refreshControlsBackground(); + void refreshTitleBackground(); void setupControlsBackgroundWide(); void setupControlsBackgroundNarrow(); void showControls(); @@ -209,6 +210,7 @@ private: rpl::lifetime _callLifetime; + object_ptr _titleBackground = { nullptr }; object_ptr _title = { nullptr }; object_ptr _subtitle = { nullptr }; object_ptr _recordingMark = { nullptr }; @@ -255,6 +257,7 @@ private: std::unique_ptr _micLevelTester; + style::complex_color _controlsBackgroundColor; base::Timer _hideControlsTimer; rpl::lifetime _hideControlsTimerLifetime;