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

View File

@ -449,7 +449,9 @@ void Panel::setIncomingSize(QSize size) {
if (_incomingFrameSize == size) {
return;
}
widget()->update(incomingFrameGeometry());
_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,

View File

@ -82,10 +82,31 @@ void Userpic::setup(rpl::producer<bool> 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 {

View File

@ -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;