Improved design of volume info in list of participants in group calls.

This commit is contained in:
23rd 2021-01-27 04:29:20 +03:00
parent 5a88b4f0b9
commit 3001ad4b89

View file

@ -587,7 +587,9 @@ int Row::statusIconWidth() const {
return 0; return 0;
} }
return _speaking return _speaking
? 2 * (_statusIcon->speaker.width() + st::groupCallMenuVolumeSkip) ? (_statusIcon->speaker.width() / 2
+ _statusIcon->arcs->width()
+ st::groupCallMenuVolumeSkip)
: 0; : 0;
} }
@ -618,9 +620,6 @@ void Row::paintStatusIcon(
st.statusPosition st.statusPosition
+ QPoint(0, (font->height - statusIconHeight()) / 2), + QPoint(0, (font->height - statusIconHeight()) / 2),
_statusIcon->speaker.size()); _statusIcon->speaker.size());
const auto volumeRect = speakerRect.translated(
_statusIcon->speaker.width() + st::groupCallMenuVolumeSkip,
0);
const auto arcPosition = speakerRect.center() const auto arcPosition = speakerRect.center()
+ QPoint(0, st::groupCallMenuSpeakerArcsSkip); + QPoint(0, st::groupCallMenuSpeakerArcsSkip);
@ -630,7 +629,6 @@ void Row::paintStatusIcon(
speakerRect.topLeft(), speakerRect.topLeft(),
speakerRect.width(), speakerRect.width(),
color); color);
p.drawText(volumeRect, QString("%1%").arg(volume), style::al_center);
p.save(); p.save();
p.translate(arcPosition); p.translate(arcPosition);
@ -649,7 +647,8 @@ void Row::paintStatusText(
p.save(); p.save();
const auto &font = st::normalFont; const auto &font = st::normalFont;
paintStatusIcon(p, st, font, selected); paintStatusIcon(p, st, font, selected);
p.translate(statusIconWidth(), 0); const auto translatedWidth = statusIconWidth();
p.translate(translatedWidth, 0);
const auto guard = gsl::finally([&] { p.restore(); }); const auto guard = gsl::finally([&] { p.restore(); });
if (_state != State::Invited && _state != State::MutedByMe) { if (_state != State::Invited && _state != State::MutedByMe) {
PeerListRow::paintStatusText( PeerListRow::paintStatusText(
@ -657,7 +656,7 @@ void Row::paintStatusText(
st, st,
x, x,
y, y,
availableWidth, availableWidth - translatedWidth,
outerWidth, outerWidth,
selected); selected);
return; return;
@ -723,7 +722,9 @@ void Row::paintAction(
void Row::refreshStatus() { void Row::refreshStatus() {
setCustomStatus( setCustomStatus(
(_speaking (_speaking
? tr::lng_group_call_active(tr::now) ? u"%1% %2"_q
.arg(std::round(_volume / 100.))
.arg(tr::lng_group_call_active(tr::now))
: tr::lng_group_call_inactive(tr::now)), : tr::lng_group_call_inactive(tr::now)),
_speaking); _speaking);
} }