Added transforming blob to circle in mute button for connecting state.
This commit is contained in:
parent
0018276c5f
commit
ee969568ac
1 changed files with 21 additions and 2 deletions
|
|
@ -33,6 +33,9 @@ constexpr auto kScaleSmallMax = kScaleSmallMin + kScaleSmall;
|
||||||
|
|
||||||
constexpr auto kMainRadiusFactor = 50. / 57.;
|
constexpr auto kMainRadiusFactor = 50. / 57.;
|
||||||
|
|
||||||
|
constexpr auto kMainMinRadius = 57. * kMainRadiusFactor;
|
||||||
|
constexpr auto kMainMaxRadius = 63. * kMainRadiusFactor;
|
||||||
|
|
||||||
constexpr auto kSwitchStateDuration = 120;
|
constexpr auto kSwitchStateDuration = 120;
|
||||||
|
|
||||||
constexpr auto MuteBlobs() -> std::array<Paint::Blobs::BlobData, 3> {
|
constexpr auto MuteBlobs() -> std::array<Paint::Blobs::BlobData, 3> {
|
||||||
|
|
@ -40,8 +43,8 @@ constexpr auto MuteBlobs() -> std::array<Paint::Blobs::BlobData, 3> {
|
||||||
{
|
{
|
||||||
.segmentsCount = 6,
|
.segmentsCount = 6,
|
||||||
.minScale = 1.,
|
.minScale = 1.,
|
||||||
.minRadius = 57. * kMainRadiusFactor,
|
.minRadius = kMainMinRadius,
|
||||||
.maxRadius = 63. * kMainRadiusFactor,
|
.maxRadius = kMainMaxRadius,
|
||||||
.speedScale = .4,
|
.speedScale = .4,
|
||||||
.alpha = 1.,
|
.alpha = 1.,
|
||||||
},
|
},
|
||||||
|
|
@ -105,6 +108,7 @@ public:
|
||||||
|
|
||||||
void setLevel(float level);
|
void setLevel(float level);
|
||||||
void setBrush(QBrush brush);
|
void setBrush(QBrush brush);
|
||||||
|
void setMainRadius(rpl::producer<float> &&radius);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
|
@ -178,6 +182,10 @@ void BlobsWidget::setLevel(float level) {
|
||||||
_blobs.setLevel(level);
|
_blobs.setLevel(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BlobsWidget::setMainRadius(rpl::producer<float> &&radius) {
|
||||||
|
_blobs.setRadiusAt(std::move(radius), 0, true);
|
||||||
|
}
|
||||||
|
|
||||||
CallMuteButton::CallMuteButton(
|
CallMuteButton::CallMuteButton(
|
||||||
not_null<RpWidget*> parent,
|
not_null<RpWidget*> parent,
|
||||||
CallMuteButtonState initial)
|
CallMuteButtonState initial)
|
||||||
|
|
@ -276,6 +284,17 @@ void CallMuteButton::init() {
|
||||||
icon.height());
|
icon.height());
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
|
// Main blob radius.
|
||||||
|
{
|
||||||
|
auto radius = _state.value(
|
||||||
|
) | rpl::map([](const CallMuteButtonState &state) -> float {
|
||||||
|
return IsConnecting(state.type)
|
||||||
|
? kMainMinRadius
|
||||||
|
: kMainMaxRadius;
|
||||||
|
}) | rpl::distinct_until_changed();
|
||||||
|
_blobs->setMainRadius(std::move(radius));
|
||||||
|
}
|
||||||
|
|
||||||
// Paint.
|
// Paint.
|
||||||
auto filterCallback = [=](not_null<QEvent*> e) {
|
auto filterCallback = [=](not_null<QEvent*> e) {
|
||||||
if (e->type() != QEvent::Paint) {
|
if (e->type() != QEvent::Paint) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue