Show peer-s microphone mute state on userpic.

This commit is contained in:
John Preston 2020-08-13 19:48:20 +04:00
parent 8af40c22a4
commit 465c661c45
7 changed files with 48 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -45,6 +45,9 @@ CallBodyLayout {
photoSize: pixels; photoSize: pixels;
nameTop: pixels; nameTop: pixels;
statusTop: pixels; statusTop: pixels;
muteStroke: pixels;
muteSize: pixels;
mutePosition: point;
} }
callBodyLayout: CallBodyLayout { callBodyLayout: CallBodyLayout {
@ -53,6 +56,9 @@ callBodyLayout: CallBodyLayout {
photoSize: 160px; photoSize: 160px;
nameTop: 221px; nameTop: 221px;
statusTop: 254px; statusTop: 254px;
muteStroke: 3px;
muteSize: 36px;
mutePosition: point(142px, 135px);
} }
callBodyWithPreview: CallBodyLayout { callBodyWithPreview: CallBodyLayout {
height: 185px; height: 185px;
@ -60,7 +66,11 @@ callBodyWithPreview: CallBodyLayout {
photoSize: 100px; photoSize: 100px;
nameTop: 132px; nameTop: 132px;
statusTop: 163px; statusTop: 163px;
muteStroke: 3px;
muteSize: 0px;
mutePosition: point(90px, 84px);
} }
callMutedPeerIcon: icon {{ "calls_mute_userpic", callIconFg }};
callOutgoingPreviewMin: size(360px, 120px); callOutgoingPreviewMin: size(360px, 120px);
callOutgoingPreview: size(540px, 180px); // default, for height == callHeight. callOutgoingPreview: size(540px, 180px); // default, for height == callHeight.

View file

@ -449,7 +449,9 @@ void Panel::setIncomingSize(QSize size) {
if (_incomingFrameSize == size) { if (_incomingFrameSize == size) {
return; return;
} }
widget()->update(incomingFrameGeometry());
_incomingFrameSize = size; _incomingFrameSize = size;
widget()->update(incomingFrameGeometry());
showControls(); showControls();
} }
@ -498,7 +500,7 @@ void Panel::reinitWithCall(Call *call) {
_call->videoIncoming()->renderNextFrame( _call->videoIncoming()->renderNextFrame(
) | rpl::start_with_next([=] { ) | rpl::start_with_next([=] {
setIncomingSize(_call->videoIncoming()->frameSize()); setIncomingSize(_call->videoIncoming()->frame({}).size());
if (_incomingFrameSize.isEmpty()) { if (_incomingFrameSize.isEmpty()) {
return; return;
} }
@ -686,6 +688,10 @@ void Panel::updateControlsGeometry() {
(widget()->width() - _bodySt->photoSize) / 2, (widget()->width() - _bodySt->photoSize) / 2,
_bodyTop + _bodySt->photoTop, _bodyTop + _bodySt->photoTop,
_bodySt->photoSize); _bodySt->photoSize);
_userpic->setMuteLayout(
_bodySt->mutePosition,
_bodySt->muteSize,
_bodySt->muteStroke);
_name->moveToLeft( _name->moveToLeft(
(widget()->width() - _name->width()) / 2, (widget()->width() - _name->width()) / 2,

View file

@ -82,10 +82,31 @@ void Userpic::setup(rpl::producer<bool> muted) {
_mutedAnimation.stop(); _mutedAnimation.stop();
} }
void Userpic::setMuteLayout(QPoint position, int size, int stroke) {
_mutePosition = position;
_muteSize = size;
_muteStroke = stroke;
_content.update();
}
void Userpic::paint() { void Userpic::paint() {
Painter p(&_content); Painter p(&_content);
p.drawPixmap(0, 0, _userPhoto); 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) { void Userpic::setMuted(bool muted) {
@ -93,11 +114,12 @@ void Userpic::setMuted(bool muted) {
return; return;
} }
_muted = muted; _muted = muted;
_mutedAnimation.start( _content.update();
[=] { _content.update(); }, //_mutedAnimation.start(
_muted ? 0. : 1., // [=] { _content.update(); },
_muted ? 1. : 0., // _muted ? 0. : 1.,
st::fadeWrapDuration); // _muted ? 1. : 0.,
// st::fadeWrapDuration);
} }
int Userpic::size() const { int Userpic::size() const {

View file

@ -30,6 +30,7 @@ public:
void setVisible(bool visible); void setVisible(bool visible);
void setGeometry(int x, int y, int size); void setGeometry(int x, int y, int size);
void setMuteLayout(QPoint position, int size, int stroke);
[[nodiscard]] rpl::lifetime &lifetime() { [[nodiscard]] rpl::lifetime &lifetime() {
return _content.lifetime(); return _content.lifetime();
@ -55,6 +56,9 @@ private:
Ui::Animations::Simple _mutedAnimation; Ui::Animations::Simple _mutedAnimation;
QPixmap _userPhoto; QPixmap _userPhoto;
PhotoId _userPhotoId = 0; PhotoId _userPhotoId = 0;
QPoint _mutePosition;
int _muteSize = 0;
int _muteStroke = 0;
bool _userPhotoFull = false; bool _userPhotoFull = false;
bool _muted = false; bool _muted = false;