From 417413f0262d0ddd71db86338a4e56617a5e09d1 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 14 Dec 2020 16:13:48 +0300 Subject: [PATCH] Updated appearance for force muted state in group calls. --- ui/colors.palette | 2 ++ ui/widgets/call_mute_button.cpp | 27 +++++++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/ui/colors.palette b/ui/colors.palette index 85ac37e..e765c28 100644 --- a/ui/colors.palette +++ b/ui/colors.palette @@ -571,6 +571,8 @@ groupCallLive1: #0dcc39; // group call live button color1 groupCallLive2: #0bb6bd; // group call live button color2 groupCallMuted1: #0992ef; // group call muted button color1 groupCallMuted2: #16ccfb; // group call muted button color2 +groupCallForceMuted1: #d4527c; // group call force muted button color1 +groupCallForceMuted2: #5d8efa; // group call force muted button color2 groupCallMenuBg: #292d33; // group call popup menu background groupCallMenuBgOver: #343940; // group call popup menu with mouse over groupCallMenuBgRipple: #3a4047; // group call popup menu ripple effect diff --git a/ui/widgets/call_mute_button.cpp b/ui/widgets/call_mute_button.cpp index e4a2151..f566229 100644 --- a/ui/widgets/call_mute_button.cpp +++ b/ui/widgets/call_mute_button.cpp @@ -92,7 +92,7 @@ auto Colors() { return base::flat_map{ { CallMuteButtonType::ForceMuted, - Vector{ st::callIconBg->c, st::callIconBg->c } + Vector{ st::groupCallForceMuted1->c, st::groupCallForceMuted2->c } }, { CallMuteButtonType::Active, @@ -284,14 +284,14 @@ CallMuteButton::CallMuteButton( std::move(hideBlobs), _state.value( ) | rpl::map([](const CallMuteButtonState &state) { - return IsConnecting(state.type); + return IsInactive(state.type); }) - ) | rpl::map([](bool animDisabled, bool hide, bool isConnecting) { - return isConnecting || !(!animDisabled && !hide); + ) | rpl::map([](bool animDisabled, bool hide, bool isBadState) { + return isBadState || !(!animDisabled && !hide); }))) , _content(base::make_unique_q(parent)) , _label(base::make_unique_q( - _content, + parent, _state.value( ) | rpl::map([](const CallMuteButtonState &state) { return state.text; @@ -314,12 +314,12 @@ void CallMuteButton::init() { // Label text. _label->show(); rpl::combine( - _content->sizeValue(), - _label->sizeValue() - ) | rpl::start_with_next([=](QSize my, QSize label) { + _content->geometryValue(), + _label->geometryValue() + ) | rpl::start_with_next([=](QRect my, QRect label) { _label->moveToLeft( - (my.width() - label.width()) / 2, - my.height() - label.height(), + my.x() + (my.width() - label.width()) / 2, + my.y() + my.height() - label.height(), my.width()); }, _label->lifetime()); _label->setAttribute(Qt::WA_TransparentForMouseEvents); @@ -519,6 +519,13 @@ void CallMuteButton::overridesColors( CallMuteButtonType fromType, CallMuteButtonType toType, float64 progress) { + const auto forceMutedToConnecting = [](CallMuteButtonType &type) { + if (type == CallMuteButtonType::ForceMuted) { + type = CallMuteButtonType::Connecting; + } + }; + forceMutedToConnecting(toType); + forceMutedToConnecting(fromType); const auto toInactive = IsInactive(toType); const auto fromInactive = IsInactive(fromType); if (toInactive && (progress == 1)) {