Updated appearance for force muted state in group calls.

This commit is contained in:
23rd 2020-12-14 16:13:48 +03:00
parent b0925f97d0
commit 417413f026
2 changed files with 19 additions and 10 deletions

View file

@ -571,6 +571,8 @@ groupCallLive1: #0dcc39; // group call live button color1
groupCallLive2: #0bb6bd; // group call live button color2 groupCallLive2: #0bb6bd; // group call live button color2
groupCallMuted1: #0992ef; // group call muted button color1 groupCallMuted1: #0992ef; // group call muted button color1
groupCallMuted2: #16ccfb; // group call muted button color2 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 groupCallMenuBg: #292d33; // group call popup menu background
groupCallMenuBgOver: #343940; // group call popup menu with mouse over groupCallMenuBgOver: #343940; // group call popup menu with mouse over
groupCallMenuBgRipple: #3a4047; // group call popup menu ripple effect groupCallMenuBgRipple: #3a4047; // group call popup menu ripple effect

View file

@ -92,7 +92,7 @@ auto Colors() {
return base::flat_map<CallMuteButtonType, Vector>{ return base::flat_map<CallMuteButtonType, Vector>{
{ {
CallMuteButtonType::ForceMuted, CallMuteButtonType::ForceMuted,
Vector{ st::callIconBg->c, st::callIconBg->c } Vector{ st::groupCallForceMuted1->c, st::groupCallForceMuted2->c }
}, },
{ {
CallMuteButtonType::Active, CallMuteButtonType::Active,
@ -284,14 +284,14 @@ CallMuteButton::CallMuteButton(
std::move(hideBlobs), std::move(hideBlobs),
_state.value( _state.value(
) | rpl::map([](const CallMuteButtonState &state) { ) | rpl::map([](const CallMuteButtonState &state) {
return IsConnecting(state.type); return IsInactive(state.type);
}) })
) | rpl::map([](bool animDisabled, bool hide, bool isConnecting) { ) | rpl::map([](bool animDisabled, bool hide, bool isBadState) {
return isConnecting || !(!animDisabled && !hide); return isBadState || !(!animDisabled && !hide);
}))) })))
, _content(base::make_unique_q<AbstractButton>(parent)) , _content(base::make_unique_q<AbstractButton>(parent))
, _label(base::make_unique_q<FlatLabel>( , _label(base::make_unique_q<FlatLabel>(
_content, parent,
_state.value( _state.value(
) | rpl::map([](const CallMuteButtonState &state) { ) | rpl::map([](const CallMuteButtonState &state) {
return state.text; return state.text;
@ -314,12 +314,12 @@ void CallMuteButton::init() {
// Label text. // Label text.
_label->show(); _label->show();
rpl::combine( rpl::combine(
_content->sizeValue(), _content->geometryValue(),
_label->sizeValue() _label->geometryValue()
) | rpl::start_with_next([=](QSize my, QSize label) { ) | rpl::start_with_next([=](QRect my, QRect label) {
_label->moveToLeft( _label->moveToLeft(
(my.width() - label.width()) / 2, my.x() + (my.width() - label.width()) / 2,
my.height() - label.height(), my.y() + my.height() - label.height(),
my.width()); my.width());
}, _label->lifetime()); }, _label->lifetime());
_label->setAttribute(Qt::WA_TransparentForMouseEvents); _label->setAttribute(Qt::WA_TransparentForMouseEvents);
@ -519,6 +519,13 @@ void CallMuteButton::overridesColors(
CallMuteButtonType fromType, CallMuteButtonType fromType,
CallMuteButtonType toType, CallMuteButtonType toType,
float64 progress) { 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 toInactive = IsInactive(toType);
const auto fromInactive = IsInactive(fromType); const auto fromInactive = IsInactive(fromType);
if (toInactive && (progress == 1)) { if (toInactive && (progress == 1)) {