From 2696dbc959f29b773646d5ba6fc882a2ad468565 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 11 Mar 2021 19:16:26 +0400 Subject: [PATCH] Move CallMuteButton to td_ui for now. --- CMakeLists.txt | 2 - icons/calls/voice_muted_large.png | Bin 1229 -> 0 bytes icons/calls/voice_muted_large@2x.png | Bin 2288 -> 0 bytes icons/calls/voice_muted_large@3x.png | Bin 3575 -> 0 bytes icons/calls/voice_unmuted_large.png | Bin 963 -> 0 bytes icons/calls/voice_unmuted_large@2x.png | Bin 1800 -> 0 bytes icons/calls/voice_unmuted_large@3x.png | Bin 2708 -> 0 bytes ui/effects/animation_value.h | 4 +- ui/widgets/call_mute_button.cpp | 962 ------------------------- ui/widgets/call_mute_button.h | 126 ---- ui/widgets/widgets.style | 18 - 11 files changed, 2 insertions(+), 1110 deletions(-) delete mode 100644 icons/calls/voice_muted_large.png delete mode 100644 icons/calls/voice_muted_large@2x.png delete mode 100644 icons/calls/voice_muted_large@3x.png delete mode 100644 icons/calls/voice_unmuted_large.png delete mode 100644 icons/calls/voice_unmuted_large@2x.png delete mode 100644 icons/calls/voice_unmuted_large@3x.png delete mode 100644 ui/widgets/call_mute_button.cpp delete mode 100644 ui/widgets/call_mute_button.h diff --git a/CMakeLists.txt b/CMakeLists.txt index e1976e4..259e571 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,8 +141,6 @@ PRIVATE ui/widgets/buttons.h ui/widgets/call_button.cpp ui/widgets/call_button.h - ui/widgets/call_mute_button.cpp - ui/widgets/call_mute_button.h ui/widgets/checkbox.cpp ui/widgets/checkbox.h ui/widgets/dropdown_menu.cpp diff --git a/icons/calls/voice_muted_large.png b/icons/calls/voice_muted_large.png deleted file mode 100644 index ae5a118860945395e7ffabea5fdc1bb93497a842..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1229 zcmV;;1Ty=HP)_Pkx83pGC4kNg@eZ z$VTxG$U<275v43p3ME-s*vLjUHYf|p@1I4MN`8~rutAdY<9z4bueoOK%)Qrr-S=|p zb!X6BEhd;UPIVI3SOYkFJ=< zN9^}6E-ntn$H(F8>kD{!etw3Ah6cawa!fK@XlN)TB_-J!_xXIVv$Mll)$udg*n^Yil%5fP!9q>c6T^hiL)fsc<5C@3f}wP6E?^F+Xojt;@c%F2o< znFH^3BZz=bAQKW203m}KK?d2`*(vNZ>}+goKvYzekb)2r_bQv`$5s3m|JFcOR+a>4 z1{oV08yLX&_;^@aS^`>pLQPGL-~{iP$>!#!6iI&JAt50!GBN@uCnqpGJS^Dd^}gHY z5o~H|(iyM-4G#|&j2#^v>GzEdE69q93PIhf_Ov{c+}zyIMf{hTm>5!8TFScGm6lOL zpYPDBh%78D5V|M%VXe*Ed3$>!4-XHL4nH77h2GHnxOcGNWHL21rQbt6uh$D$E=}DW0d6f65X#W5yZo=H$obLbq{T(tgG6aM8xtpAv)OA!16=Y6M zj+TDv>goi03I=Pyva&M4Cq1!A5kaH5xw(Kxfd2k|7#$sz4pAydtb&aD+A$zbn3 zc_B37Bt1Qy)2+Xm8qKz=f@#Vq%DqCB9E}$j7wcb*ySqEnU0n^dG=sjrKCMDB=r{v0OcoY_koe}} r|20;6PVPDSl2F4z7uWV+pveCLXSK$G7W&?p00000NkvXXu0mjfDBLGG diff --git a/icons/calls/voice_muted_large@2x.png b/icons/calls/voice_muted_large@2x.png deleted file mode 100644 index cd1161ce379baba7d11a682029b993499072a897..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2288 zcmVPc^Bva0u`R&TMR zMvNFC`t|E48Z~MpYSyeNzI^#2of_wQU*%5O^rd z4I4HT6)IGS3kl|Dn>KBNQDmvbctv{l?8zG7+IZsf<;(pznKsYKlP8UJk!*ra!&5kZ z{CE~bIpt!viOZHP(*m)LlvBN+;c)cv0OHEoK$LS@PT{n4=~7!x%Jjt^ARvw#H;(Oz zT!>4SEKx$SiO2|mVL@EHc(DyD&$Jl>&<5g*7cZzqix#ZgdC{Upo?y6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ECfS5jjQIPn?ECx$i zc=Q>gJYNWK;R3T+XMZ}IBJH)6_qlBDZdZv&M%RIy51GO$H6Q(>~H+%5=vNKaX-7qVdHKAOK^nPHv=(3~I4& z23zTZc&==^c((DOE$K@`N`w^4P9&4a=KwlhtsKA{Kt}?O+5Z8ZL&@M?>Oe360000< KMNUMnLSTZtj4W6H diff --git a/icons/calls/voice_muted_large@3x.png b/icons/calls/voice_muted_large@3x.png deleted file mode 100644 index 3907746876820f9094207689a98f73532a12bb83..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3575 zcmV^#u%rMAL3L4DdV(Wezo3czy}=Xw}KDY2OQ@bi1X_C7VHC# za}C6K^-{-q{Q}j?ojW%xQ>F~dlP6E$lQLyWcICxK;!D!EyH~ zQltnUJ9aGJvu6)~{rWYx3rCI|;p4`Q;}t4Yh&w&t&W)=|0qnea^Z4`U&+V9oy|!}Y zN?xi|sd&;!`~dFUxif$K_;FZxq8DDgc)=4A5_qaqsp0{2>;q1hE*)R8WQiz0;dmQ1 zY~b0mXODHru?-kjwtDqyVQ8`uPnmVeZ>F% z`|o#jcHqDPUcP*JqYC-pgAe%a+qd75ZSsdtKmF8boeaQ5dDQ>|u3d{2-ISIsTN+cy z!i5V>vJ9E`wr$&t)kl?sKstHAXxQx9wJW3&f`3GJ!vthBdY(La5-iHKzZ*7e7;BK_ z0avP2Nm!wP+@eJbN0l;o@L*y2PDlLp*Iym2i+}~{%997&ty?!Ky*X{kyLa!FlJ8{X zyLa!#REt_^x-dnG6m;W>2WnL_y7O79R;|Png^8IqZCXYRxG-1E|C}vbHddoX4fBE= zlAr{5|Ni~b;sJT-(xr^v$Ub@P$xmM1MD^A{Q2{{3OQK<2IMck_(JQQ+@?(%WlIL+lP6E=7^ZOA zWDD49$kct||Ni^0FeufC$r^BSfSl|BI{~?E+qTM&>%4jM@_+vMN7X3ZqD zlcN=~4>+iAtqb|fj0r}XmV~$v|4>$~9Cm^?L*G}1zX_p~)0Y$K6>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1(09oVK(m=`WU!Gzvl%e!-*y>3|{XMSxZpbVo`g1 ze9Y46G@F>1&~h#7zN|Fn=H}$eRMd(CC%{oC7HVxtt4*&7)dAtsSXgv6{I|Fi!OsEQIUFE2?zx7$qu_V@S0 z>FFu4K>>@|#l=P7Pl4DU92^i^uh&cTRT#7Z1Azbucy)CJot>Q|sMTtP(a}*@US5V^ zFbF=M4|okoY;fR}l@$^zpU(r%*R%ooN>*)*;_*1xY_`fEHT#p3lkoojP5|fU z=WF_Lcx^z`kByDN$HxZ=espvMPN!4P0DvHmkB`LvAX)1&UkJnVA_lJ3CXl0e`PTcXzkS#}ptsudlDG29qw_+}uDSk$_k%2B}mEUS3`# z6**@z8Q}jy=!HW&eHoPOW@l%iSS*r3^$Pp@`_SIrZUoLaAcEp5-rU>-+?4BS7Z(>W zH8o`vOtLqYK`E1XZfk1;zuynxa9H)i#zllvVt9C18c6gk4p<4hy}eD6Xu`W!@oe<^#~pdFyH_H002ovPDHLkV1gE4tS|ro diff --git a/icons/calls/voice_unmuted_large@2x.png b/icons/calls/voice_unmuted_large@2x.png deleted file mode 100644 index c2e70b23c8c6ba9f6b7c08a3de1db0beb05107ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1800 zcmbtV={wtr7XF2ZiY-ygsCCjQW>9NMnIf3l5;7GLI#+5*LnaklG&G1^uNmqYJC%s7 z6YZcQT}H)7a7~-5T3p*ST7=P}VyU9)ruW0Wf583lp7%ZHJm=ec&bf{a^ihYNfC2!Z z?&s@$LC)AuI0li&68PpFIf2P23x8ZD#>#siQsn`g8{yh>tg_@Fb)9A6-bT~ zasYq=N8!H}EJyKw`cqTOBAyNakZXS4C>#T{Rv+MNX!jYb={;4J{qFN96lyS+U=zNx z)M$#p@swrx7C966_MC9-(hIADp1t9y7Hy*MxgtFiWw_GdF3Luicn3cSb)#UmY}V~l zoNK22Qiq;{D{C;D?we9}4caNpIS*!LQj?;UF!`nVVEi#(R(+!>$e&dYMh>1sO7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 100644 index d15a5fcbbccdccd2830ff49227ae8bf194435a84..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2708 zcmc&$_d6Tf8;>?-8=ERFdaY8cGmCb2!Wt#3slF002OcTSnG& z8}biWnCPtrT6K(WfbRNGeE^^~<-(~mBfYQgiiEg9p#WJrX8|z8KL7yfjDZe8Iskxk z1?T=d5>jyffBc`xYqG%;000{^#7G|z!m#CNm%w+Ecc{98bdbo%dm%9qS%XqUqC^q! zu0)P&80u3#D|iGaV{MF10*fkwck>m;hU_a$0TOOC9rym=OY`yG;LbwSWcW^=ib|GN zUw%7fd*~))=(zP|)~W;!&3dKyrHk7Y>&$b-V zCuOlICQ$4>*B~z$`chOxH&SkIch~#MOaw+q%~wv*@qO1)4Pr)AH?sG#iW^yvGy`n( zoHWx3Kd3}}JY}oA+cXxKJ}CLlpEg^+hhTg36lA)d!^!}+>(Nr*d&iK9iPNg_AH zSn9Q^8&^*0ht*Z>*i3fySMgXNdy#9LcYn~Pqqgo4_0k`$eRiIHve+Ke)}MHSneBOA z61=xINIBkH$Ca1e${-_drx9sIRVa->>PWE(;e)#KM_`7t*L1af)=lxKirmM&niX3j ztMqu|8=*foZrj(o7zbp1?kR|0450M)-D&hK0bkTDKd+4J8O+scoKOy8i#XYbxVgLI z`sgBKfaHemt)&elGj{OqK#@A06IV(8xmv+6^g!?7ud|GdF7 zHrR_8SWwdOlzALTn8;Fb|FGiMd)a`0zByR2$*5ka#bfrZ45Sr;lakP=PF2PDt8#(q z$yuUZUDLV?qS0J~Pua3dU%KR< zJe`u09XytK+E-{AsCEEJj#)9Funky0|I`072&Pa-q%Tg|N47?2)KlTBe#G=y*k6_6 zkK^r}Al2ccuZ&kod=G`~Gn7hEQ&wuGSYc;^W1Snc3`-P0FM#kn*qo6&3p?B%EVuTt z`7E2SPtw6;Dma>{?ye8#bDORz@n$+UKPIsJMTKbvZ{y2T+Q)o8VgEqa`+aaC$lgX$ zRQ$$Fm0+?<#ULTonis-q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6Q>C`MR<-V#(NVuB|3r<$4?Jgf2HSAIrDMuVWd4<2NCpmT)GZ=X#XEEpZETdx0n zTGo{&Zra}*yp#Tc*8u4nV;mW`5Q%g7&aB!Ob7Gia4c|n=@^zq6>IxOcAA20ot9P!Szml{^aq_$?MJ1FPn3KOoIWjmcFDb6*bw;}h=C9DSibgIyFzEwEuU zt$_vJhd2D|=7~v4Ozb85qx)ie^hP`}^evlXj?R7_8u-jY)4|YQPYgY8g{#e9s_(Tq zy;i#fUBOm9+;oedqfHkM=%%T_pfiMV}*z$fz86&YSlGI +#include namespace anim { diff --git a/ui/widgets/call_mute_button.cpp b/ui/widgets/call_mute_button.cpp deleted file mode 100644 index 10c5062..0000000 --- a/ui/widgets/call_mute_button.cpp +++ /dev/null @@ -1,962 +0,0 @@ -// This file is part of Desktop App Toolkit, -// a set of libraries for developing nice desktop applications. -// -// For license and copyright information please follow this link: -// https://github.com/desktop-app/legal/blob/master/LEGAL -// -#include "ui/widgets/call_mute_button.h" - -#include "base/flat_map.h" -#include "ui/abstract_button.h" -#include "ui/paint/blobs.h" -#include "ui/painter.h" -#include "ui/widgets/call_button.h" -#include "ui/widgets/labels.h" - -#include "styles/palette.h" -#include "styles/style_widgets.h" - -#include - -namespace Ui { -namespace { - -using Radiuses = Paint::Blob::Radiuses; - -constexpr auto kMaxLevel = 1.; - -constexpr auto kLevelDuration = 100. + 500. * 0.33; - -constexpr auto kScaleBig = 0.807 - 0.1; -constexpr auto kScaleSmall = 0.704 - 0.1; - -constexpr auto kScaleBigMin = 0.878; -constexpr auto kScaleSmallMin = 0.926; - -constexpr auto kScaleBigMax = (float)(kScaleBigMin + kScaleBig); -constexpr auto kScaleSmallMax = (float)(kScaleSmallMin + kScaleSmall); - -constexpr auto kMainRadiusFactor = (float)(50. / 57.); - -constexpr auto kGlowPaddingFactor = 1.2; -constexpr auto kGlowMinScale = 0.6; -constexpr auto kGlowAlpha = 150; - -constexpr auto kOverrideColorBgAlpha = 76; -constexpr auto kOverrideColorRippleAlpha = 50; - -constexpr auto kShiftDuration = crl::time(300); -constexpr auto kSwitchStateDuration = crl::time(120); -constexpr auto kSwitchLabelDuration = crl::time(180); - -// Switch state from Connecting animation. -constexpr auto kSwitchRadialDuration = crl::time(350); -constexpr auto kSwitchCirclelDuration = crl::time(275); -constexpr auto kBlobsScaleEnterDuration = crl::time(400); -constexpr auto kSwitchStateFromConnectingDuration = kSwitchRadialDuration - + kSwitchCirclelDuration - + kBlobsScaleEnterDuration; - -constexpr auto kRadialEndPartAnimation = float(kSwitchRadialDuration) - / kSwitchStateFromConnectingDuration; -constexpr auto kBlobsWidgetPartAnimation = 1. - kRadialEndPartAnimation; -constexpr auto kFillCirclePartAnimation = float(kSwitchCirclelDuration) - / (kSwitchCirclelDuration + kBlobsScaleEnterDuration); -constexpr auto kBlobPartAnimation = float(kBlobsScaleEnterDuration) - / (kSwitchCirclelDuration + kBlobsScaleEnterDuration); - -constexpr auto kOverlapProgressRadialHide = 1.2; - -constexpr auto kRadialFinishArcShift = 1200; - -auto MuteBlobs() { - return std::vector{ - { - .segmentsCount = 9, - .minScale = kScaleSmallMin / kScaleSmallMax, - .minRadius = st::callMuteMinorBlobMinRadius - * kScaleSmallMax - * kMainRadiusFactor, - .maxRadius = st::callMuteMinorBlobMaxRadius - * kScaleSmallMax - * kMainRadiusFactor, - .speedScale = 1., - .alpha = (76. / 255.), - }, - { - .segmentsCount = 12, - .minScale = kScaleBigMin / kScaleBigMax, - .minRadius = st::callMuteMajorBlobMinRadius - * kScaleBigMax - * kMainRadiusFactor, - .maxRadius = st::callMuteMajorBlobMaxRadius - * kScaleBigMax - * kMainRadiusFactor, - .speedScale = 1., - .alpha = (76. / 255.), - }, - }; -} - -auto Colors() { - using Vector = std::vector; - using Colors = anim::gradient_colors; - return base::flat_map{ - { - CallMuteButtonType::ForceMuted, - Colors(QGradientStops{ - { .0, st::groupCallForceMuted1->c }, - { .5, st::groupCallForceMuted2->c }, - { 1., st::groupCallForceMuted3->c } }) - }, - { - CallMuteButtonType::Active, - Colors(Vector{ st::groupCallLive1->c, st::groupCallLive2->c }) - }, - { - CallMuteButtonType::Connecting, - Colors(st::callIconBg->c) - }, - { - CallMuteButtonType::Muted, - Colors(Vector{ st::groupCallMuted1->c, st::groupCallMuted2->c }) - }, - }; -} - -bool IsMuted(CallMuteButtonType type) { - return (type != CallMuteButtonType::Active); -} - -bool IsConnecting(CallMuteButtonType type) { - return (type == CallMuteButtonType::Connecting); -} - -bool IsInactive(CallMuteButtonType type) { - return IsConnecting(type) || (type == CallMuteButtonType::ForceMuted); -} - -auto Clamp(float64 value) { - return std::clamp(value, 0., 1.); -} - -void ComputeRadialFinish( - int &value, - float64 progress, - int to = -RadialState::kFull) { - value = anim::interpolate(value, to, Clamp(progress)); -} - -} // namespace - -class AnimatedLabel final : public RpWidget { -public: - AnimatedLabel( - QWidget *parent, - rpl::producer &&text, - crl::time duration, - int additionalHeight, - const style::FlatLabel &st = st::defaultFlatLabel); - - int height() const; - -private: - int realHeight() const; - - void setText(const QString &text); - - const style::FlatLabel &_st; - const crl::time _duration; - const int _additionalHeight; - const TextParseOptions _options; - - Text::String _text; - Text::String _previousText; - - Animations::Simple _animation; - -}; - -AnimatedLabel::AnimatedLabel( - QWidget *parent, - rpl::producer &&text, - crl::time duration, - int additionalHeight, - const style::FlatLabel &st) -: RpWidget(parent) -, _st(st) -, _duration(duration) -, _additionalHeight(additionalHeight) -, _options({ 0, 0, 0, Qt::LayoutDirectionAuto }) { - std::move( - text - ) | rpl::start_with_next([=](const QString &value) { - setText(value); - }, lifetime()); - - paintRequest( - ) | rpl::start_with_next([=] { - Painter p(this); - const auto progress = _animation.value(1.); - - p.setFont(_st.style.font); - p.setPen(_st.textFg); - p.setTextPalette(_st.palette); - - const auto textHeight = height(); - const auto diffHeight = realHeight() - textHeight; - const auto center = (diffHeight) / 2; - - p.setOpacity(1. - progress); - if (p.opacity()) { - _previousText.draw( - p, - 0, - anim::interpolate(center, diffHeight, progress), - width(), - style::al_center); - } - - p.setOpacity(progress); - if (p.opacity()) { - _text.draw( - p, - 0, - anim::interpolate(0, center, progress), - width(), - style::al_center); - } - }, lifetime()); -} - -int AnimatedLabel::height() const { - return _st.style.font->height; -} - -int AnimatedLabel::realHeight() const { - return RpWidget::height(); -} - -void AnimatedLabel::setText(const QString &text) { - if (_text.toString() == text) { - return; - } - _previousText = _text; - _text.setText(_st.style, text, _options); - - const auto width = std::max( - _st.style.font->width(_text.toString()), - _st.style.font->width(_previousText.toString())); - resize(width + _additionalHeight, height() + _additionalHeight * 2); - - _animation.stop(); - _animation.start([=] { update(); }, 0., 1., _duration); -} - -class BlobsWidget final : public RpWidget { -public: - BlobsWidget( - not_null parent, - rpl::producer &&hideBlobs); - - void setLevel(float level); - void setBlobBrush(QBrush brush); - void setGlowBrush(QBrush brush); - - [[nodiscard]] QRectF innerRect() const; - - [[nodiscard]] float64 switchConnectingProgress() const; - void setSwitchConnectingProgress(float64 progress); - -private: - void init(); - - Paint::Blobs _blobs; - - const float _circleRadius; - QBrush _blobBrush; - QBrush _glowBrush; - int _center = 0; - QRectF _circleRect; - - float64 _switchConnectingProgress = 0.; - - crl::time _blobsLastTime = 0; - crl::time _blobsHideLastTime = 0; - - float64 _blobsScaleEnter = 0.; - crl::time _blobsScaleLastTime = 0; - - bool _hideBlobs = true; - - Animations::Basic _animation; - -}; - -BlobsWidget::BlobsWidget( - not_null parent, - rpl::producer &&hideBlobs) -: RpWidget(parent) -, _blobs(MuteBlobs(), kLevelDuration, kMaxLevel) -, _circleRadius(st::callMuteButtonActive.bgSize / 2.) -, _blobBrush(Qt::transparent) -, _glowBrush(Qt::transparent) -, _blobsLastTime(crl::now()) -, _blobsScaleLastTime(crl::now()) { - init(); - - std::move( - hideBlobs - ) | rpl::start_with_next([=](bool hide) { - if (_hideBlobs != hide) { - const auto now = crl::now(); - if ((now - _blobsScaleLastTime) >= kBlobsScaleEnterDuration) { - _blobsScaleLastTime = now; - } - _hideBlobs = hide; - } - if (hide) { - setLevel(0.); - } - _blobsHideLastTime = hide ? crl::now() : 0; - if (!hide && !_animation.animating()) { - _animation.start(); - } - }, lifetime()); -} - -void BlobsWidget::init() { - setAttribute(Qt::WA_TransparentForMouseEvents); - - const auto cutRect = [](Painter &p, const QRectF &r) { - p.save(); - p.setOpacity(1.); - p.setBrush(st::groupCallBg); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.drawEllipse(r); - p.restore(); - }; - - { - const auto s = _blobs.maxRadius() * 2 * kGlowPaddingFactor; - resize(s, s); - } - - sizeValue( - ) | rpl::start_with_next([=](QSize size) { - _center = size.width() / 2; - - { - const auto &r = _circleRadius; - const auto left = (size.width() - r * 2.) / 2.; - const auto add = st::callConnectingRadial.thickness / 2; - _circleRect = QRectF(left, left, r * 2, r * 2).marginsAdded( - style::margins(add, add, add, add)); - } - }, lifetime()); - - paintRequest( - ) | rpl::start_with_next([=] { - Painter p(this); - PainterHighQualityEnabler hq(p); - - p.setPen(Qt::NoPen); - - // Glow. - const auto s = kGlowMinScale - + (1. - kGlowMinScale) * _blobs.currentLevel(); - p.translate(_center, _center); - p.scale(s, s); - p.translate(-_center, -_center); - p.fillRect(rect(), _glowBrush); - p.resetTransform(); - - // Blobs. - p.translate(_center, _center); - const auto scale = (_switchConnectingProgress > 0.) - ? anim::easeOutBack( - 1., - _blobsScaleEnter * (1. - Clamp( - _switchConnectingProgress / kBlobPartAnimation))) - : _blobsScaleEnter; - _blobs.paint(p, _blobBrush, scale); - p.translate(-_center, -_center); - - if (scale < 1.) { - cutRect(p, _circleRect); - } - - // Main circle. - const auto circleProgress = - Clamp(_switchConnectingProgress - kBlobPartAnimation) - / kFillCirclePartAnimation; - const auto skipColoredCircle = (circleProgress == 1.); - - if (!skipColoredCircle) { - p.setBrush(_blobBrush); - p.drawEllipse(_circleRect); - } - - if (_switchConnectingProgress > 0.) { - p.resetTransform(); - - const auto mF = (_circleRect.width() / 2) * (1. - circleProgress); - const auto cutOutRect = _circleRect.marginsRemoved( - QMarginsF(mF, mF, mF, mF)); - - if (!skipColoredCircle) { - p.setBrush(st::callConnectingRadial.color); - p.setOpacity(circleProgress); - p.drawEllipse(_circleRect); - } - - p.setOpacity(1.); - - cutRect(p, cutOutRect); - - p.setBrush(st::callIconBg); - p.drawEllipse(cutOutRect); - } - }, lifetime()); - - _animation.init([=](crl::time now) { - if (const auto &last = _blobsHideLastTime; (last > 0) - && (now - last >= kBlobsScaleEnterDuration)) { - _animation.stop(); - return false; - } - _blobs.updateLevel(now - _blobsLastTime); - _blobsLastTime = now; - - const auto dt = Clamp( - (now - _blobsScaleLastTime) / float64(kBlobsScaleEnterDuration)); - _blobsScaleEnter = _hideBlobs - ? (1. - anim::easeInCirc(1., dt)) - : anim::easeOutBack(1., dt); - - update(); - return true; - }); - shownValue( - ) | rpl::start_with_next([=](bool shown) { - if (shown) { - _animation.start(); - } else { - _animation.stop(); - } - }, lifetime()); -} - -QRectF BlobsWidget::innerRect() const { - return _circleRect; -} - -void BlobsWidget::setBlobBrush(QBrush brush) { - if (_blobBrush == brush) { - return; - } - _blobBrush = brush; -} - -void BlobsWidget::setGlowBrush(QBrush brush) { - if (_glowBrush == brush) { - return; - } - _glowBrush = brush; -} - -void BlobsWidget::setLevel(float level) { - if (_blobsHideLastTime) { - return; - } - _blobs.setLevel(level); -} - -float64 BlobsWidget::switchConnectingProgress() const { - return _switchConnectingProgress; -} - -void BlobsWidget::setSwitchConnectingProgress(float64 progress) { - _switchConnectingProgress = progress; -} - -CallMuteButton::CallMuteButton( - not_null parent, - rpl::producer &&hideBlobs, - CallMuteButtonState initial) -: _state(initial) -, _st(st::callMuteButtonActive) -, _blobs(base::make_unique_q( - parent, - rpl::combine( - rpl::single(anim::Disabled()) | rpl::then(anim::Disables()), - std::move(hideBlobs), - _state.value( - ) | rpl::map([](const CallMuteButtonState &state) { - return IsInactive(state.type); - }) - ) | rpl::map([](bool animDisabled, bool hide, bool isBadState) { - return isBadState || !(!animDisabled && !hide); - }))) -, _content(base::make_unique_q(parent)) -, _centerLabel(base::make_unique_q( - parent, - _state.value( - ) | rpl::map([](const CallMuteButtonState &state) { - return state.subtext.isEmpty() ? state.text : QString(); - }), - kSwitchLabelDuration, - st::callMuteButtonLabelAdditional, - _st.label)) -, _label(base::make_unique_q( - parent, - _state.value( - ) | rpl::map([](const CallMuteButtonState &state) { - return state.subtext.isEmpty() ? QString() : state.text; - }), - kSwitchLabelDuration, - st::callMuteButtonLabelAdditional, - _st.label)) -, _sublabel(base::make_unique_q( - parent, - _state.value( - ) | rpl::map([](const CallMuteButtonState &state) { - return state.subtext; - }), - kSwitchLabelDuration, - st::callMuteButtonLabelAdditional, - st::callMuteButtonSublabel)) -, _radial(nullptr) -, _colors(Colors()) -, _crossLineMuteAnimation(st::callMuteCrossLine) { - init(); -} - -void CallMuteButton::init() { - _content->resize(_st.button.width, _st.button.height); - - style::PaletteChanged( - ) | rpl::start_with_next([=] { - _crossLineMuteAnimation.invalidate(); - }, lifetime()); - - // Label text. - _label->show(); - rpl::combine( - _content->geometryValue(), - _label->sizeValue() - ) | rpl::start_with_next([=](QRect my, QSize size) { - updateLabelGeometry(my, size); - }, _label->lifetime()); - _label->setAttribute(Qt::WA_TransparentForMouseEvents); - - _sublabel->show(); - rpl::combine( - _content->geometryValue(), - _sublabel->sizeValue() - ) | rpl::start_with_next([=](QRect my, QSize size) { - updateSublabelGeometry(my, size); - }, _sublabel->lifetime()); - _sublabel->setAttribute(Qt::WA_TransparentForMouseEvents); - - _centerLabel->show(); - rpl::combine( - _content->geometryValue(), - _centerLabel->sizeValue() - ) | rpl::start_with_next([=](QRect my, QSize size) { - updateCenterLabelGeometry(my, size); - }, _centerLabel->lifetime()); - _centerLabel->setAttribute(Qt::WA_TransparentForMouseEvents); - - rpl::combine( - _radialInfo.rawShowProgress.value(), - anim::Disables() - ) | rpl::start_with_next([=](float64 value, bool disabled) { - auto &info = _radialInfo; - info.realShowProgress = (1. - value) / kRadialEndPartAnimation; - - const auto guard = gsl::finally([&] { - _content->update(); - }); - - if (((value == 0.) || disabled) && _radial) { - _radial->stop(); - _radial = nullptr; - return; - } - if ((value > 0.) && !disabled && !_radial) { - _radial = std::make_unique( - [=] { _content->update(); }, - _radialInfo.st); - _radial->start(); - } - if ((info.realShowProgress < 1.) && !info.isDirectionToShow) { - if (_radial) { - _radial->stop(anim::type::instant); - _radial->start(); - } - info.state = std::nullopt; - return; - } - - if (value == 1.) { - info.state = std::nullopt; - } else { - if (_radial && !info.state.has_value()) { - info.state = _radial->computeState(); - } - } - }, lifetime()); - - // State type. - const auto previousType = - lifetime().make_state(_state.current().type); - setHandleMouseState(HandleMouseState::Disabled); - - const auto blobsInner = [&] { - // The point of the circle at 45 degrees. - 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)); - }(); - - auto linearGradients = anim::linear_gradients( - _colors, - QPointF(blobsInner.x() + blobsInner.width(), blobsInner.y()), - QPointF(blobsInner.x(), blobsInner.y() + blobsInner.height())); - - auto glowColors = [&] { - auto copy = _colors; - for (auto &[type, stops] : copy) { - auto firstColor = IsInactive(type) - ? st::groupCallBg->c - : stops.stops[0].second; - firstColor.setAlpha(kGlowAlpha); - stops.stops = QGradientStops{ - { 0., std::move(firstColor) }, - { 1., QColor(Qt::transparent) } - }; - } - return copy; - }(); - auto glows = anim::radial_gradients( - std::move(glowColors), - blobsInner.center(), - _blobs->width() / 2); - - _state.value( - ) | rpl::map([](const CallMuteButtonState &state) { - return state.type; - }) | rpl::start_with_next([=](CallMuteButtonType type) { - const auto previous = *previousType; - *previousType = type; - - const auto mouseState = HandleMouseStateFromType(type); - setHandleMouseState(HandleMouseState::Disabled); - if (mouseState != HandleMouseState::Enabled) { - setHandleMouseState(mouseState); - } - - const auto fromConnecting = IsConnecting(previous); - const auto toConnecting = IsConnecting(type); - - const auto crossFrom = IsMuted(previous) ? 0. : 1.; - const auto crossTo = IsMuted(type) ? 0. : 1.; - - const auto radialShowFrom = fromConnecting ? 1. : 0.; - const auto radialShowTo = toConnecting ? 1. : 0.; - - const auto from = (_switchAnimation.animating() && !fromConnecting) - ? (1. - _switchAnimation.value(0.)) - : 0.; - const auto to = 1.; - - _radialInfo.isDirectionToShow = fromConnecting; - - auto callback = [=](float64 value) { - const auto brushProgress = fromConnecting ? 1. : value; - _blobs->setBlobBrush(QBrush( - linearGradients.gradient(previous, type, brushProgress))); - _blobs->setGlowBrush(QBrush( - glows.gradient(previous, type, value))); - _blobs->update(); - - const auto crossProgress = (crossFrom == crossTo) - ? crossTo - : anim::interpolateF(crossFrom, crossTo, value); - if (crossProgress != _crossLineProgress) { - _crossLineProgress = crossProgress; - _content->update(_muteIconRect); - } - - const auto radialShowProgress = (radialShowFrom == radialShowTo) - ? radialShowTo - : anim::interpolateF(radialShowFrom, radialShowTo, value); - if (radialShowProgress != _radialInfo.rawShowProgress.current()) { - _radialInfo.rawShowProgress = radialShowProgress; - _blobs->setSwitchConnectingProgress(Clamp( - radialShowProgress / kBlobsWidgetPartAnimation)); - } - - overridesColors(previous, type, value); - - if (value == to) { - setHandleMouseState(mouseState); - } - }; - - _switchAnimation.stop(); - const auto duration = (1. - from) * ((fromConnecting || toConnecting) - ? kSwitchStateFromConnectingDuration - : kSwitchStateDuration); - _switchAnimation.start(std::move(callback), from, to, duration); - }, lifetime()); - - // Icon rect. - _content->sizeValue( - ) | rpl::start_with_next([=](QSize size) { - const auto &icon = _st.button.icon; - const auto &pos = _st.button.iconPosition; - - _muteIconRect = QRect( - (pos.x() < 0) ? ((size.width() - icon.width()) / 2) : pos.x(), - (pos.y() < 0) ? ((size.height() - icon.height()) / 2) : pos.y(), - icon.width(), - icon.height()); - }, lifetime()); - - // Paint. - _content->paintRequest( - ) | rpl::start_with_next([=](QRect clip) { - Painter p(_content); - - _crossLineMuteAnimation.paint( - p, - _muteIconRect.topLeft(), - 1. - _crossLineProgress); - - if (_radialInfo.state.has_value() && _switchAnimation.animating()) { - const auto radialProgress = _radialInfo.realShowProgress; - - auto r = *_radialInfo.state; - r.shown = 1.; - if (_radialInfo.isDirectionToShow) { - const auto to = r.arcFrom - kRadialFinishArcShift; - ComputeRadialFinish(r.arcFrom, radialProgress, to); - ComputeRadialFinish(r.arcLength, radialProgress); - } else { - r.arcLength = RadialState::kFull; - } - - const auto opacity = (radialProgress > kOverlapProgressRadialHide) - ? 0. - : _blobs->switchConnectingProgress(); - p.setOpacity(opacity); - InfiniteRadialAnimation::Draw( - p, - r, - _st.bgPosition, - _radialInfo.st.size, - _content->width(), - QPen(_radialInfo.st.color), - _radialInfo.st.thickness); - } else if (_radial) { - auto state = _radial->computeState(); - state.shown = 1.; - - InfiniteRadialAnimation::Draw( - p, - std::move(state), - _st.bgPosition, - _radialInfo.st.size, - _content->width(), - QPen(_radialInfo.st.color), - _radialInfo.st.thickness); - } - }, _content->lifetime()); -} - -void CallMuteButton::updateLabelsGeometry() { - updateLabelGeometry(_content->geometry(), _label->size()); - updateCenterLabelGeometry(_content->geometry(), _centerLabel->size()); - updateSublabelGeometry(_content->geometry(), _sublabel->size()); -} - -void CallMuteButton::updateLabelGeometry(QRect my, QSize size) { - const auto skip = st::callMuteButtonSublabelSkip - + st::callMuteButtonLabelsSkip; - _label->moveToLeft( - my.x() + (my.width() - size.width()) / 2 + _labelShakeShift, - my.y() + my.height() - _label->height() - skip, - my.width()); -} - -void CallMuteButton::updateCenterLabelGeometry(QRect my, QSize size) { - const auto skip = (st::callMuteButtonSublabelSkip / 2) - + st::callMuteButtonLabelsSkip; - _centerLabel->moveToLeft( - my.x() + (my.width() - size.width()) / 2 + _labelShakeShift, - my.y() + my.height() - _centerLabel->height() - skip, - my.width()); -} - -void CallMuteButton::updateSublabelGeometry(QRect my, QSize size) { - const auto skip = st::callMuteButtonLabelsSkip; - _sublabel->moveToLeft( - my.x() + (my.width() - size.width()) / 2 + _labelShakeShift, - my.y() + my.height() - _sublabel->height() - skip, - my.width()); -} - -void CallMuteButton::shake() { - if (_shakeAnimation.animating()) { - return; - } - const auto update = [=] { - const auto fullProgress = _shakeAnimation.value(1.) * 6; - const auto segment = std::clamp(int(std::floor(fullProgress)), 0, 5); - const auto part = fullProgress - segment; - const auto from = (segment == 0) - ? 0. - : (segment == 1 || segment == 3 || segment == 5) - ? 1. - : -1.; - const auto to = (segment == 0 || segment == 2 || segment == 4) - ? 1. - : (segment == 1 || segment == 3) - ? -1. - : 0.; - const auto shift = from * (1. - part) + to * part; - _labelShakeShift = int(std::round(shift * st::shakeShift)); - updateLabelsGeometry(); - }; - _shakeAnimation.start( - update, - 0., - 1., - kShiftDuration); -} - -CallMuteButton::HandleMouseState CallMuteButton::HandleMouseStateFromType( - CallMuteButtonType type) { - switch (type) { - case CallMuteButtonType::Active: - case CallMuteButtonType::Muted: - return HandleMouseState::Enabled; - case CallMuteButtonType::Connecting: - return HandleMouseState::Disabled; - case CallMuteButtonType::ForceMuted: - return HandleMouseState::Blocked; - } - Unexpected("Type in HandleMouseStateFromType."); -} - -void CallMuteButton::setState(const CallMuteButtonState &state) { - _state = state; -} - -void CallMuteButton::setLevel(float level) { - _level = level; - _blobs->setLevel(level); -} - -rpl::producer CallMuteButton::clicks() const { - return _content->clicks(); -} - -QSize CallMuteButton::innerSize() const { - return innerGeometry().size(); -} - -QRect CallMuteButton::innerGeometry() const { - const auto &skip = _st.outerRadius; - return QRect( - _content->x(), - _content->y(), - _content->width() - 2 * skip, - _content->width() - 2 * skip); -} - -void CallMuteButton::moveInner(QPoint position) { - const auto &skip = _st.outerRadius; - _content->move(position - QPoint(skip, skip)); - - { - const auto offset = QPoint( - (_blobs->width() - _content->width()) / 2, - (_blobs->height() - _content->width()) / 2); - _blobs->move(_content->pos() - offset); - } -} - -void CallMuteButton::setVisible(bool visible) { - _content->setVisible(visible); - _blobs->setVisible(visible); -} - -void CallMuteButton::raise() { - _blobs->raise(); - _content->raise(); -} - -void CallMuteButton::lower() { - _content->lower(); - _blobs->lower(); -} - -void CallMuteButton::setHandleMouseState(HandleMouseState state) { - if (_handleMouseState == state) { - return; - } - _handleMouseState = state; - const auto handle = (_handleMouseState != HandleMouseState::Disabled); - const auto pointer = (_handleMouseState == HandleMouseState::Enabled); - _content->setAttribute(Qt::WA_TransparentForMouseEvents, !handle); - _content->setPointerCursor(pointer); -} - -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)) { - _colorOverrides.fire({ std::nullopt, std::nullopt }); - return; - } - auto from = _colors.find(fromType)->second.stops[0].second; - auto to = _colors.find(toType)->second.stops[0].second; - auto fromRipple = from; - auto toRipple = to; - if (!toInactive) { - toRipple.setAlpha(kOverrideColorRippleAlpha); - to.setAlpha(kOverrideColorBgAlpha); - } - if (!fromInactive) { - fromRipple.setAlpha(kOverrideColorRippleAlpha); - from.setAlpha(kOverrideColorBgAlpha); - } - const auto resultBg = anim::color(from, to, progress); - const auto resultRipple = anim::color(fromRipple, toRipple, progress); - _colorOverrides.fire({ resultBg, resultRipple }); -} - -rpl::producer CallMuteButton::colorOverrides() const { - return _colorOverrides.events(); -} - -rpl::lifetime &CallMuteButton::lifetime() { - return _blobs->lifetime(); -} - -CallMuteButton::~CallMuteButton() = default; - -} // namespace Ui diff --git a/ui/widgets/call_mute_button.h b/ui/widgets/call_mute_button.h deleted file mode 100644 index 154bfb3..0000000 --- a/ui/widgets/call_mute_button.h +++ /dev/null @@ -1,126 +0,0 @@ -// This file is part of Desktop App Toolkit, -// a set of libraries for developing nice desktop applications. -// -// For license and copyright information please follow this link: -// https://github.com/desktop-app/legal/blob/master/LEGAL -// -#pragma once - -#include "base/unique_qptr.h" -#include "ui/effects/animations.h" -#include "ui/effects/cross_line.h" -#include "ui/effects/gradient.h" -#include "ui/effects/radial_animation.h" - -namespace Ui { - -class BlobsWidget; - -class AbstractButton; -class FlatLabel; -class RpWidget; -class AnimatedLabel; - -struct CallButtonColors; - -enum class CallMuteButtonType { - Connecting, - Active, - Muted, - ForceMuted, -}; - -struct CallMuteButtonState { - QString text; - QString subtext; - CallMuteButtonType type = CallMuteButtonType::Connecting; -}; - -class CallMuteButton final { -public: - explicit CallMuteButton( - not_null parent, - rpl::producer &&hideBlobs, - CallMuteButtonState initial = CallMuteButtonState()); - ~CallMuteButton(); - - void setState(const CallMuteButtonState &state); - void setLevel(float level); - [[nodiscard]] rpl::producer clicks() const; - - [[nodiscard]] QSize innerSize() const; - [[nodiscard]] QRect innerGeometry() const; - void moveInner(QPoint position); - - void shake(); - - void setVisible(bool visible); - void show() { - setVisible(true); - } - void hide() { - setVisible(false); - } - void raise(); - void lower(); - - [[nodiscard]] rpl::producer colorOverrides() const; - - [[nodiscard]] rpl::lifetime &lifetime(); - -private: - enum class HandleMouseState { - Enabled, - Blocked, - Disabled, - }; - struct RadialInfo { - std::optional state = std::nullopt; - bool isDirectionToShow = false; - rpl::variable rawShowProgress = 0.; - float64 realShowProgress = 0.; - const style::InfiniteRadialAnimation &st = st::callConnectingRadial; - }; - void init(); - void overridesColors( - CallMuteButtonType fromType, - CallMuteButtonType toType, - float64 progress); - - void setHandleMouseState(HandleMouseState state); - void updateCenterLabelGeometry(QRect my, QSize size); - void updateLabelGeometry(QRect my, QSize size); - void updateSublabelGeometry(QRect my, QSize size); - void updateLabelsGeometry(); - - [[nodiscard]] static HandleMouseState HandleMouseStateFromType( - CallMuteButtonType type); - - rpl::variable _state; - float _level = 0.; - float64 _crossLineProgress = 0.; - QRect _muteIconRect; - HandleMouseState _handleMouseState = HandleMouseState::Enabled; - - const style::CallButton &_st; - - const base::unique_qptr _blobs; - const base::unique_qptr _content; - const base::unique_qptr _centerLabel; - const base::unique_qptr _label; - const base::unique_qptr _sublabel; - int _labelShakeShift = 0; - - RadialInfo _radialInfo; - std::unique_ptr _radial; - const base::flat_map _colors; - - CrossLineAnimation _crossLineMuteAnimation; - Animations::Simple _switchAnimation; - Animations::Simple _shakeAnimation; - - rpl::event_stream _colorOverrides; - -}; - -} // namespace Ui diff --git a/ui/widgets/widgets.style b/ui/widgets/widgets.style index ec57cd1..cb7eaa1 100644 --- a/ui/widgets/widgets.style +++ b/ui/widgets/widgets.style @@ -1429,13 +1429,9 @@ callMuteMinorBlobMaxRadius: 74px; callMuteMajorBlobMinRadius: 67px; callMuteMajorBlobMaxRadius: 77px; -callMuteButtonActiveIcon: icon {{ "calls/voice_unmuted_large", groupCallIconFg }}; callMuteButtonActiveInner: IconButton { width: 136px; height: 165px; - - iconPosition: point(-1px, 50px); - icon: callMuteButtonActiveIcon; } callMuteButtonLabel: FlatLabel(defaultFlatLabel) { textFg: groupCallMembersFg; @@ -1460,29 +1456,15 @@ callMuteButtonActive: CallButton { label: callMuteButtonLabel; } callMuteButtonMuted: CallButton(callMuteButtonActive) { - button: IconButton(callMuteButtonActiveInner) { - icon: icon {{ "calls/voice_muted_large", groupCallIconFg }}; - } bg: groupCallMuted1; label: callMuteButtonLabel; } callMuteButtonConnecting: CallButton(callMuteButtonMuted) { - button: IconButton(callMuteButtonActiveInner) { - icon: icon {{ "calls/voice_muted_large", groupCallIconFg }}; - } bg: callIconBg; label: callMuteButtonLabel; } callMuteButtonLabelAdditional: 5px; -callMuteCrossLine: CrossLineAnimation { - fg: groupCallIconFg; - icon: callMuteButtonActiveIcon; - startPosition: point(7px, 2px); - endPosition: point(34px, 30px); - stroke: 4px; -} - callConnectingRadial: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) { color: lightButtonFg; thickness: 4px;