From 465c661c453fcc8e1be36929be58f64ffbb20ecb Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 13 Aug 2020 19:48:20 +0400 Subject: [PATCH] Show peer-s microphone mute state on userpic. --- .../Resources/icons/calls_mute_userpic.png | Bin 0 -> 545 bytes .../Resources/icons/calls_mute_userpic@2x.png | Bin 0 -> 1110 bytes .../Resources/icons/calls_mute_userpic@3x.png | Bin 0 -> 1616 bytes Telegram/SourceFiles/calls/calls.style | 10 ++++++ Telegram/SourceFiles/calls/calls_panel.cpp | 8 ++++- Telegram/SourceFiles/calls/calls_userpic.cpp | 32 +++++++++++++++--- Telegram/SourceFiles/calls/calls_userpic.h | 4 +++ 7 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 Telegram/Resources/icons/calls_mute_userpic.png create mode 100644 Telegram/Resources/icons/calls_mute_userpic@2x.png create mode 100644 Telegram/Resources/icons/calls_mute_userpic@3x.png diff --git a/Telegram/Resources/icons/calls_mute_userpic.png b/Telegram/Resources/icons/calls_mute_userpic.png new file mode 100644 index 0000000000000000000000000000000000000000..286780ac118e84ba1a7a5d25df663cc57d7efd02 GIT binary patch literal 545 zcmV++0^a?JP)y{p1N48X6CCklQbZVrN*h^vE>xH>pF6v4sGvAc^?CpZ5B zchN;qH)nMhQCC61MGzDn@-D%YR@-Nvz6P#GbC>*@t;1{u zlu9M?GaL>f5D1VH1U^c)+kFq<^ZB6H>yf|FXhaay$+TD)v)SxD0EX!XGM~@i2QY-c z+8hZ-_c7oV`8IQ+LHEA>&pQWf?uR|u2At$w3%_uOZ3*k8Mq&1sO2#3Q?Knuuv$#dcB70_4<^qR;%UY9QF1Q zpyS00000NkvXXu0mjf3F+`M literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/calls_mute_userpic@2x.png b/Telegram/Resources/icons/calls_mute_userpic@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..d99d673c147ddf4067c681ef448d564acc6c5ce7 GIT binary patch literal 1110 zcmV-c1gZOpP)#2s*zM}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ometry()); _incomingFrameSize = size; + widget()->update(incomingFrameGeometry()); showControls(); } @@ -498,7 +500,7 @@ void Panel::reinitWithCall(Call *call) { _call->videoIncoming()->renderNextFrame( ) | rpl::start_with_next([=] { - setIncomingSize(_call->videoIncoming()->frameSize()); + setIncomingSize(_call->videoIncoming()->frame({}).size()); if (_incomingFrameSize.isEmpty()) { return; } @@ -686,6 +688,10 @@ void Panel::updateControlsGeometry() { (widget()->width() - _bodySt->photoSize) / 2, _bodyTop + _bodySt->photoTop, _bodySt->photoSize); + _userpic->setMuteLayout( + _bodySt->mutePosition, + _bodySt->muteSize, + _bodySt->muteStroke); _name->moveToLeft( (widget()->width() - _name->width()) / 2, diff --git a/Telegram/SourceFiles/calls/calls_userpic.cpp b/Telegram/SourceFiles/calls/calls_userpic.cpp index 145856ec6..446757af2 100644 --- a/Telegram/SourceFiles/calls/calls_userpic.cpp +++ b/Telegram/SourceFiles/calls/calls_userpic.cpp @@ -82,10 +82,31 @@ void Userpic::setup(rpl::producer muted) { _mutedAnimation.stop(); } +void Userpic::setMuteLayout(QPoint position, int size, int stroke) { + _mutePosition = position; + _muteSize = size; + _muteStroke = stroke; + _content.update(); +} + void Userpic::paint() { Painter p(&_content); p.drawPixmap(0, 0, _userPhoto); + if (_muted && _muteSize > 0) { + auto hq = PainterHighQualityEnabler(p); + auto pen = st::callBgOpaque->p; + pen.setWidth(_muteStroke); + p.setPen(pen); + p.setBrush(st::callHangupBg); + const auto rect = QRect( + _mutePosition.x() - _muteSize / 2, + _mutePosition.y() - _muteSize / 2, + _muteSize, + _muteSize); + p.drawEllipse(rect); + st::callMutedPeerIcon.paintInCenter(p, rect); + } } void Userpic::setMuted(bool muted) { @@ -93,11 +114,12 @@ void Userpic::setMuted(bool muted) { return; } _muted = muted; - _mutedAnimation.start( - [=] { _content.update(); }, - _muted ? 0. : 1., - _muted ? 1. : 0., - st::fadeWrapDuration); + _content.update(); + //_mutedAnimation.start( + // [=] { _content.update(); }, + // _muted ? 0. : 1., + // _muted ? 1. : 0., + // st::fadeWrapDuration); } int Userpic::size() const { diff --git a/Telegram/SourceFiles/calls/calls_userpic.h b/Telegram/SourceFiles/calls/calls_userpic.h index 8680e76ec..54bfcd8a5 100644 --- a/Telegram/SourceFiles/calls/calls_userpic.h +++ b/Telegram/SourceFiles/calls/calls_userpic.h @@ -30,6 +30,7 @@ public: void setVisible(bool visible); void setGeometry(int x, int y, int size); + void setMuteLayout(QPoint position, int size, int stroke); [[nodiscard]] rpl::lifetime &lifetime() { return _content.lifetime(); @@ -55,6 +56,9 @@ private: Ui::Animations::Simple _mutedAnimation; QPixmap _userPhoto; PhotoId _userPhotoId = 0; + QPoint _mutePosition; + int _muteSize = 0; + int _muteStroke = 0; bool _userPhotoFull = false; bool _muted = false;