Updated colors for force muted state in group calls.

This commit is contained in:
23rd 2020-12-16 13:04:19 +03:00
parent 9eef2289a7
commit 526a816b7e
3 changed files with 30 additions and 19 deletions

View file

@ -571,8 +571,12 @@ 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 groupCallForceMutedBar1: #c65493; // group call force muted top bar color1
groupCallForceMuted2: #5d8efa; // group call force muted button color2 groupCallForceMutedBar2: #7a6af1; // group call force muted top bar color2
groupCallForceMutedBar3: #5f95e8; // group call force muted top bar color3
groupCallForceMuted1: #4f9cff; // group call force muted button color1
groupCallForceMuted2: #9b52e9; // group call force muted button color2
groupCallForceMuted3: #eb5353; // group call force muted button color3
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

@ -8,7 +8,6 @@
#include "base/flat_map.h" #include "base/flat_map.h"
#include "ui/abstract_button.h" #include "ui/abstract_button.h"
#include "ui/effects/gradient.h"
#include "ui/effects/radial_animation.h" #include "ui/effects/radial_animation.h"
#include "ui/paint/blobs.h" #include "ui/paint/blobs.h"
#include "ui/painter.h" #include "ui/painter.h"
@ -80,22 +79,26 @@ auto MuteBlobs() {
auto Colors() { auto Colors() {
using Vector = std::vector<QColor>; using Vector = std::vector<QColor>;
return base::flat_map<CallMuteButtonType, Vector>{ using Colors = anim::gradient_colors;
return base::flat_map<CallMuteButtonType, Colors>{
{ {
CallMuteButtonType::ForceMuted, CallMuteButtonType::ForceMuted,
Vector{ st::groupCallForceMuted1->c, st::groupCallForceMuted2->c } Colors(QGradientStops{
{ .0, st::groupCallForceMuted1->c },
{ .5, st::groupCallForceMuted2->c },
{ 1., st::groupCallForceMuted3->c } })
}, },
{ {
CallMuteButtonType::Active, CallMuteButtonType::Active,
Vector{ st::groupCallLive1->c, st::groupCallLive2->c } Colors(Vector{ st::groupCallLive1->c, st::groupCallLive2->c })
}, },
{ {
CallMuteButtonType::Connecting, CallMuteButtonType::Connecting,
Vector{ st::callIconBg->c, st::callIconBg->c } Colors(st::callIconBg->c)
}, },
{ {
CallMuteButtonType::Muted, CallMuteButtonType::Muted,
Vector{ st::groupCallMuted1->c, st::groupCallMuted2->c } Colors(Vector{ st::groupCallMuted1->c, st::groupCallMuted2->c })
}, },
}; };
} }
@ -343,7 +346,8 @@ void CallMuteButton::init() {
const auto blobsInner = [&] { const auto blobsInner = [&] {
// The point of the circle at 45 degrees. // The point of the circle at 45 degrees.
const auto mF = std::sqrt(_blobs->innerRect().width()) / 2.; const auto w = _blobs->innerRect().width();
const auto mF = (1 - std::cos(M_PI / 4.)) * (w / 2.);
return _blobs->innerRect().marginsRemoved(QMarginsF(mF, mF, mF, mF)); return _blobs->innerRect().marginsRemoved(QMarginsF(mF, mF, mF, mF));
}(); }();
@ -354,13 +358,15 @@ void CallMuteButton::init() {
auto glowColors = [&] { auto glowColors = [&] {
auto copy = _colors; auto copy = _colors;
for (auto &[type, colors] : copy) { for (auto &[type, stops] : copy) {
if (IsInactive(type)) { auto firstColor = IsInactive(type)
colors[0] = st::groupCallBg->c; ? st::groupCallBg->c
} else { : stops.stops[0].second;
colors[0].setAlpha(kGlowAlpha); firstColor.setAlpha(kGlowAlpha);
} stops.stops = QGradientStops{
colors[1] = QColor(Qt::transparent); { 0., std::move(firstColor) },
{ 1., QColor(Qt::transparent) }
};
} }
return copy; return copy;
}(); }();
@ -595,8 +601,8 @@ void CallMuteButton::overridesColors(
_colorOverrides.fire({ std::nullopt, std::nullopt }); _colorOverrides.fire({ std::nullopt, std::nullopt });
return; return;
} }
auto from = _colors.find(fromType)->second[0]; auto from = _colors.find(fromType)->second.stops[0].second;
auto to = _colors.find(toType)->second[0]; auto to = _colors.find(toType)->second.stops[0].second;
auto fromRipple = from; auto fromRipple = from;
auto toRipple = to; auto toRipple = to;
if (!toInactive) { if (!toInactive) {

View file

@ -9,6 +9,7 @@
#include "base/unique_qptr.h" #include "base/unique_qptr.h"
#include "ui/effects/animations.h" #include "ui/effects/animations.h"
#include "ui/effects/cross_line.h" #include "ui/effects/cross_line.h"
#include "ui/effects/gradient.h"
namespace Ui { namespace Ui {
@ -99,7 +100,7 @@ private:
int _labelShakeShift = 0; int _labelShakeShift = 0;
std::unique_ptr<InfiniteRadialAnimation> _radial; std::unique_ptr<InfiniteRadialAnimation> _radial;
const base::flat_map<CallMuteButtonType, std::vector<QColor>> _colors; const base::flat_map<CallMuteButtonType, anim::gradient_colors> _colors;
CrossLineAnimation _crossLineMuteAnimation; CrossLineAnimation _crossLineMuteAnimation;
Animations::Simple _switchAnimation; Animations::Simple _switchAnimation;