Improve narrow participants column design.

This commit is contained in:
John Preston 2021-05-14 21:32:43 +04:00
parent 64243d1437
commit 13b3de683a
5 changed files with 67 additions and 19 deletions

View file

@ -562,6 +562,11 @@ groupCallMembersListItem: PeerListItem(defaultPeerListItem) {
statusFgOver: groupCallMemberInactiveStatus; statusFgOver: groupCallMemberInactiveStatus;
statusFgActive: groupCallMemberActiveStatus; statusFgActive: groupCallMemberActiveStatus;
} }
groupCallNarrowMembersListItem: PeerListItem(groupCallMembersListItem) {
statusFg: groupCallMemberNotJoinedStatus;
statusFgOver: groupCallMemberNotJoinedStatus;
statusFgActive: groupCallMemberActiveStatus;
}
groupCallMembersList: PeerList(defaultPeerList) { groupCallMembersList: PeerList(defaultPeerList) {
bg: groupCallMembersBg; bg: groupCallMembersBg;
about: FlatLabel(defaultPeerListAbout) { about: FlatLabel(defaultPeerListAbout) {
@ -1157,8 +1162,8 @@ groupCallWideModeSize: size(960px, 580px);
// ripple: groupCallRipple; // ripple: groupCallRipple;
//} //}
groupCallNarrowInactiveCrossLine: CrossLineAnimation { groupCallNarrowInactiveCrossLine: CrossLineAnimation {
fg: groupCallMemberInactiveStatus; fg: groupCallMemberNotJoinedStatus;
icon: icon {{ "calls/video_mini_mute", groupCallMemberInactiveStatus }}; icon: icon {{ "calls/video_mini_mute", groupCallMemberNotJoinedStatus }};
startPosition: point(3px, 0px); startPosition: point(3px, 0px);
endPosition: point(13px, 12px); endPosition: point(13px, 12px);
stroke: 3px; stroke: 3px;
@ -1169,8 +1174,8 @@ groupCallNarrowColoredCrossLine: CrossLineAnimation(groupCallNarrowInactiveCross
icon: icon {{ "calls/video_mini_mute", groupCallMemberActiveStatus }}; icon: icon {{ "calls/video_mini_mute", groupCallMemberActiveStatus }};
} }
groupCallNarrowRaisedHand: icon {{ "calls/video_mini_speak", groupCallMemberInactiveStatus }}; groupCallNarrowRaisedHand: icon {{ "calls/video_mini_speak", groupCallMemberInactiveStatus }};
groupCallNarrowCameraIcon: icon {{ "calls/video_mini_video", groupCallMemberInactiveStatus }}; groupCallNarrowCameraIcon: icon {{ "calls/video_mini_video", groupCallMemberNotJoinedStatus }};
groupCallNarrowScreenIcon: icon {{ "calls/video_mini_screencast", groupCallMemberInactiveStatus }}; groupCallNarrowScreenIcon: icon {{ "calls/video_mini_screencast", groupCallMemberNotJoinedStatus }};
groupCallNarrowIconPosition: point(-4px, 2px); groupCallNarrowIconPosition: point(-4px, 2px);
groupCallNarrowIconSkip: 15px; groupCallNarrowIconSkip: 15px;
//groupCallVideoCrossLine: CrossLineAnimation(groupCallNarrowInactiveCrossLine) { //groupCallVideoCrossLine: CrossLineAnimation(groupCallNarrowInactiveCrossLine) {

View file

@ -99,6 +99,7 @@ public:
int outerWidth, int outerWidth,
not_null<MembersRow*> row, not_null<MembersRow*> row,
const IconState &state) override; const IconState &state) override;
bool rowIsNarrow() override;
//void rowPaintNarrowBackground( //void rowPaintNarrowBackground(
// Painter &p, // Painter &p,
// int x, // int x,
@ -989,7 +990,7 @@ void Members::Controller::rowPaintIcon(
// Just green icon, no cross, no coloring. // Just green icon, no cross, no coloring.
greenIcon.paintInCenter(p, rect); greenIcon.paintInCenter(p, rect);
return; return;
} else if (state.speaking == 0.) { } else if (state.speaking == 0. && (!narrow || !state.mutedByMe)) {
if (state.active == 1.) { if (state.active == 1.) {
// Just gray icon, no cross, no coloring. // Just gray icon, no cross, no coloring.
const auto &grayIcon = largeVideo const auto &grayIcon = largeVideo
@ -1051,7 +1052,7 @@ void Members::Controller::rowPaintIcon(
} }
const auto activeInactiveColor = anim::color( const auto activeInactiveColor = anim::color(
(narrow (narrow
? st::groupCallMemberInactiveStatus ? st::groupCallMemberNotJoinedStatus
: st::groupCallMemberInactiveIcon), : st::groupCallMemberInactiveIcon),
(narrow (narrow
? st::groupCallMemberActiveStatus ? st::groupCallMemberActiveStatus
@ -1107,19 +1108,56 @@ int Members::Controller::rowPaintStatusIcon(
rowPaintIcon(p, rect, state); rowPaintIcon(p, rect, state);
x += icon.width(); x += icon.width();
auto result = st::groupCallNarrowIconSkip; auto result = st::groupCallNarrowIconSkip;
if (_cameraActive.contains(row->peer())) { const auto participantPeer = row->peer();
st::groupCallNarrowCameraIcon.paint(p, x, y, outerWidth); const auto camera = _cameraActive.contains(participantPeer);
const auto screen = _screenActive.contains(participantPeer);
if (camera || screen) {
const auto activeInactiveColor = anim::color(
st::groupCallMemberNotJoinedStatus,
st::groupCallMemberActiveStatus,
state.speaking);
const auto iconColor = anim::color(
activeInactiveColor,
st::groupCallMemberNotJoinedStatus,
state.muted);
const auto other = state.mutedByMe
? st::groupCallMemberMutedIcon->c
: state.raisedHand
? st::groupCallMemberInactiveStatus->c
: iconColor;
const auto color = (state.speaking == 1. && !state.mutedByMe)
? st::groupCallMemberActiveStatus->c
: (state.speaking == 0.
? (state.active == 1.
? st::groupCallMemberNotJoinedStatus->c
: (state.active == 0.
? (state.muted == 1.
? (state.raisedHand
? st::groupCallMemberInactiveStatus->c
: st::groupCallMemberNotJoinedStatus->c)
: (state.muted == 0.
? st::groupCallMemberNotJoinedStatus->c
: other))
: other))
: other);
if (camera) {
st::groupCallNarrowCameraIcon.paint(p, x, y, outerWidth, other);
x += st::groupCallNarrowCameraIcon.width(); x += st::groupCallNarrowCameraIcon.width();
result += st::groupCallNarrowCameraIcon.width(); result += st::groupCallNarrowCameraIcon.width();
} }
if (_screenActive.contains(row->peer())) { if (screen) {
st::groupCallNarrowScreenIcon.paint(p, x, y, outerWidth); st::groupCallNarrowScreenIcon.paint(p, x, y, outerWidth, other);
x += st::groupCallNarrowScreenIcon.width(); x += st::groupCallNarrowScreenIcon.width();
result += st::groupCallNarrowScreenIcon.width(); result += st::groupCallNarrowScreenIcon.width();
} }
}
return result; return result;
} }
bool Members::Controller::rowIsNarrow() {
return (_mode == PanelMode::Wide);
}
//void Members::Controller::rowPaintNarrowBackground( //void Members::Controller::rowPaintNarrowBackground(
// Painter &p, // Painter &p,
// int x, // int x,
@ -1848,7 +1886,7 @@ void Members::refreshTilesGeometry() {
if (sizes.size() == 3) { if (sizes.size() == 3) {
put(sizes.front().first, 2, 0); put(sizes.front().first, 2, 0);
put((sizes.begin() + 1)->first, 0, 1); put((sizes.begin() + 1)->first, 0, 1);
put((sizes.begin() + 1)->first, 1, 1); put((sizes.begin() + 2)->first, 1, 1);
} else { } else {
auto row = 0; auto row = 0;
auto column = 0; auto column = 0;

View file

@ -765,9 +765,13 @@ void MembersRow::paintComplexStatusText(
p.translate(-translatedWidth, 0); p.translate(-translatedWidth, 0);
}); });
const auto &style = (!narrowMode
|| (_state == State::RaisedHand && _raisedHandStatus))
? st
: st::groupCallNarrowMembersListItem;
PeerListRow::paintStatusText( PeerListRow::paintStatusText(
p, p,
st, style,
x, x,
y, y,
availableWidth - translatedWidth, availableWidth - translatedWidth,
@ -799,7 +803,7 @@ void MembersRow::paintComplexStatusText(
} }
QSize MembersRow::actionSize() const { QSize MembersRow::actionSize() const {
return QSize( return _delegate->rowIsNarrow() ? QSize() : QSize(
st::groupCallActiveButton.width, st::groupCallActiveButton.width,
st::groupCallActiveButton.height); st::groupCallActiveButton.height);
} }

View file

@ -62,6 +62,7 @@ public:
int outerWidth, int outerWidth,
not_null<MembersRow*> row, not_null<MembersRow*> row,
const IconState &state) = 0; const IconState &state) = 0;
virtual bool rowIsNarrow() = 0;
//virtual void rowPaintNarrowBackground( //virtual void rowPaintNarrowBackground(
// Painter &p, // Painter &p,
// int x, // int x,

View file

@ -2015,7 +2015,7 @@ void Panel::updateMembersGeometry() {
skip, skip,
top, top,
membersWidth, membersWidth,
std::min(desiredHeight, widget()->height())); std::min(desiredHeight, widget()->height() - top - skip));
_pinnedVideoWrap->setGeometry( _pinnedVideoWrap->setGeometry(
membersWidth + 2 * skip, membersWidth + 2 * skip,
top, top,