Add icons and improve narrow participants column.

This commit is contained in:
John Preston 2021-05-14 16:08:48 +04:00
parent bd90cc4134
commit a730c88491
32 changed files with 552 additions and 364 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,001 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,023 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -1132,49 +1132,55 @@ desktopCaptureSubmit: RoundButton(desktopCaptureCancel) {
} }
groupCallNarrowSkip: 9px; groupCallNarrowSkip: 9px;
groupCallNarrowRowSkip: 4px; groupCallNarrowMembersWidth: 202px;
groupCallNarrowSize: size(144px, 90px); //groupCallNarrowRowSkip: 4px;
groupCallNarrowUserpicTop: 13px; //groupCallNarrowSize: size(144px, 90px);
groupCallNarrowNameTop: 65px; //groupCallNarrowUserpicTop: 13px;
groupCallNarrowIconTop: 62px; //groupCallNarrowNameTop: 65px;
groupCallNarrowIconLess: 5px; //groupCallNarrowIconTop: 62px;
groupCallWideModeWidthMin: 550px; //groupCallNarrowIconLess: 5px;
groupCallWideModeWidthMin: 600px;
groupCallWideModeSize: size(960px, 580px); groupCallWideModeSize: size(960px, 580px);
groupCallNarrowAddMemberHeight: 32px; //groupCallNarrowAddMemberHeight: 32px;
groupCallNarrowOutline: 2px; //groupCallNarrowOutline: 2px;
groupCallNarrowShadowHeight: 36px; //groupCallNarrowShadowHeight: 36px;
groupCallNarrowAddMember: RoundButton(defaultActiveButton) { //groupCallNarrowAddMember: RoundButton(defaultActiveButton) {
textFg: groupCallMemberNotJoinedStatus; // textFg: groupCallMemberNotJoinedStatus;
textFgOver: groupCallMemberNotJoinedStatus; // textFgOver: groupCallMemberNotJoinedStatus;
textBg: groupCallMembersBg; // textBg: groupCallMembersBg;
textBgOver: groupCallMembersBgOver; // textBgOver: groupCallMembersBgOver;
//
height: 32px; // height: 32px;
radius: roundRadiusLarge; // radius: roundRadiusLarge;
//
ripple: groupCallRipple; // ripple: groupCallRipple;
} //}
groupCallNarrowInactiveCrossLine: CrossLineAnimation { groupCallNarrowInactiveCrossLine: CrossLineAnimation {
fg: groupCallMemberInactiveIcon; fg: groupCallMemberInactiveStatus;
icon: icon {{ "calls/voice_mute_mini", groupCallMemberInactiveIcon }}; icon: icon {{ "calls/video_mini_mute", groupCallMemberInactiveStatus }};
startPosition: point(7px, 4px); startPosition: point(3px, 0px);
endPosition: point(17px, 16px); endPosition: point(13px, 12px);
stroke: 3px; stroke: 3px;
strokeDenominator: 2; strokeDenominator: 2;
} }
groupCallNarrowColoredCrossLine: CrossLineAnimation(groupCallNarrowInactiveCrossLine) { groupCallNarrowColoredCrossLine: CrossLineAnimation(groupCallNarrowInactiveCrossLine) {
fg: groupCallMemberMutedIcon; fg: groupCallMemberNotJoinedStatus;
icon: icon {{ "calls/voice_mute_mini", groupCallMemberActiveIcon }}; icon: icon {{ "calls/video_mini_mute", groupCallMemberActiveStatus }};
}
groupCallVideoCrossLine: CrossLineAnimation(groupCallNarrowInactiveCrossLine) {
fg: groupCallVideoTextFg;
icon: icon {{ "calls/voice_mute_mini", groupCallVideoTextFg }};
} }
groupCallNarrowRaisedHand: icon {{ "calls/video_mini_speak", groupCallMemberInactiveStatus }};
groupCallNarrowCameraIcon: icon {{ "calls/video_mini_video", groupCallMemberInactiveStatus }};
groupCallNarrowScreenIcon: icon {{ "calls/video_mini_screencast", groupCallMemberInactiveStatus }};
groupCallNarrowIconPosition: point(-4px, 2px);
groupCallNarrowIconSkip: 15px;
//groupCallVideoCrossLine: CrossLineAnimation(groupCallNarrowInactiveCrossLine) {
// fg: groupCallVideoTextFg;
// icon: icon {{ "calls/voice_mute_mini", groupCallVideoTextFg }};
//}
groupCallLargeVideoCrossLine: CrossLineAnimation(groupCallMemberColoredCrossLine) { groupCallLargeVideoCrossLine: CrossLineAnimation(groupCallMemberColoredCrossLine) {
fg: groupCallVideoSubTextFg; fg: groupCallVideoTextFg;
icon: icon {{ "calls/group_calls_unmuted", groupCallVideoSubTextFg }}; icon: icon {{ "calls/video_over_mute", groupCallVideoTextFg }};
} }
GroupCallLargeVideo { GroupCallLargeVideo {
@ -1196,16 +1202,16 @@ groupCallLargeVideoNarrow: GroupCallLargeVideo(groupCallLargeVideoWide) {
enlargeAlign: align(center); enlargeAlign: align(center);
pinPosition: point(-1px, -1px); pinPosition: point(-1px, -1px);
} }
groupCallLargeVideoListItem: PeerListItem(groupCallMembersListItem) { //groupCallLargeVideoListItem: PeerListItem(groupCallMembersListItem) {
nameFg: groupCallVideoTextFg; // nameFg: groupCallVideoTextFg;
nameFgChecked: groupCallVideoTextFg; // nameFgChecked: groupCallVideoTextFg;
statusFg: groupCallVideoSubTextFg; // statusFg: groupCallVideoSubTextFg;
statusFgOver: groupCallVideoSubTextFg; // statusFgOver: groupCallVideoSubTextFg;
statusFgActive: groupCallVideoSubTextFg; // statusFgActive: groupCallVideoSubTextFg;
} //}
groupCallLargeVideoPin: CrossLineAnimation { groupCallLargeVideoPin: CrossLineAnimation {
fg: groupCallVideoSubTextFg; fg: groupCallVideoTextFg;
icon: icon {{ "calls/voice_pin", groupCallVideoSubTextFg }}; icon: icon {{ "calls/voice_pin", groupCallVideoTextFg }};
startPosition: point(5px, 2px); startPosition: point(5px, 2px);
endPosition: point(20px, 17px); endPosition: point(20px, 17px);
stroke: 2px; stroke: 2px;

View file

@ -82,6 +82,7 @@ public:
-> rpl::producer<not_null<PeerData*>>; -> rpl::producer<not_null<PeerData*>>;
Row *findRow(not_null<PeerData*> participantPeer) const; Row *findRow(not_null<PeerData*> participantPeer) const;
void setMode(PanelMode mode);
bool rowIsMe(not_null<PeerData*> participantPeer) override; bool rowIsMe(not_null<PeerData*> participantPeer) override;
bool rowCanMuteMembers() override; bool rowCanMuteMembers() override;
@ -91,34 +92,41 @@ public:
Painter &p, Painter &p,
QRect rect, QRect rect,
const IconState &state) override; const IconState &state) override;
void rowPaintNarrowBackground( int rowPaintStatusIcon(
Painter &p, Painter &p,
int x, int x,
int y, int y,
bool selected) override; int outerWidth,
void rowPaintNarrowBorder( not_null<MembersRow*> row,
Painter &p, const IconState &state) override;
int x, //void rowPaintNarrowBackground(
int y, // Painter &p,
not_null<Row*> row) override; // int x,
void rowPaintNarrowShadow( // int y,
Painter &p, // bool selected) override;
int x, //void rowPaintNarrowBorder(
int y, // Painter &p,
int sizew, // int x,
int sizeh) override; // int y,
// not_null<Row*> row) override;
//void rowPaintNarrowShadow(
// Painter &p,
// int x,
// int y,
// int sizew,
// int sizeh) override;
int customRowHeight() override; //int customRowHeight() override;
void customRowPaint( //void customRowPaint(
Painter &p, // Painter &p,
crl::time now, // crl::time now,
not_null<PeerListRow*> row, // not_null<PeerListRow*> row,
bool selected) override; // bool selected) override;
bool customRowSelectionPoint( //bool customRowSelectionPoint(
not_null<PeerListRow*> row, // not_null<PeerListRow*> row,
int x, // int x,
int y) override; // int y) override;
Fn<QImage()> customRowRippleMaskGenerator() override; //Fn<QImage()> customRowRippleMaskGenerator() override;
private: private:
[[nodiscard]] std::unique_ptr<Row> createRowForMe(); [[nodiscard]] std::unique_ptr<Row> createRowForMe();
@ -167,6 +175,10 @@ private:
bool toggleRowVideo(not_null<PeerListRow*> row); bool toggleRowVideo(not_null<PeerListRow*> row);
void showRowMenu(not_null<PeerListRow*> row); void showRowMenu(not_null<PeerListRow*> row);
void toggleVideoEndpointActive(
const VideoEndpoint &endpoint,
bool active);
void appendInvitedUsers(); void appendInvitedUsers();
void scheduleRaisedHandStatusRemove(); void scheduleRaisedHandStatusRemove();
@ -188,17 +200,20 @@ private:
base::Timer _raisedHandStatusRemoveTimer; base::Timer _raisedHandStatusRemoveTimer;
base::flat_map<uint32, not_null<Row*>> _soundingRowBySsrc; base::flat_map<uint32, not_null<Row*>> _soundingRowBySsrc;
base::flat_map<std::string, not_null<Row*>> _videoEndpoints; //base::flat_map<std::string, not_null<Row*>> _videoEndpoints;
base::flat_set<not_null<PeerData*>> _cameraActive;
base::flat_set<not_null<PeerData*>> _screenActive;
Ui::Animations::Basic _soundingAnimation; Ui::Animations::Basic _soundingAnimation;
crl::time _soundingAnimationHideLastTime = 0; crl::time _soundingAnimationHideLastTime = 0;
bool _skipRowLevelUpdate = false; bool _skipRowLevelUpdate = false;
PanelMode _mode = PanelMode::Default;
Ui::CrossLineAnimation _inactiveCrossLine; Ui::CrossLineAnimation _inactiveCrossLine;
Ui::CrossLineAnimation _coloredCrossLine; Ui::CrossLineAnimation _coloredCrossLine;
Ui::CrossLineAnimation _inactiveNarrowCrossLine; Ui::CrossLineAnimation _inactiveNarrowCrossLine;
Ui::CrossLineAnimation _coloredNarrowCrossLine; Ui::CrossLineAnimation _coloredNarrowCrossLine;
Ui::CrossLineAnimation _videoNarrowCrossLine; //Ui::CrossLineAnimation _videoNarrowCrossLine;
Ui::CrossLineAnimation _videoLargeCrossLine; Ui::CrossLineAnimation _videoLargeCrossLine;
Ui::RoundRect _narrowRoundRectSelected; Ui::RoundRect _narrowRoundRectSelected;
Ui::RoundRect _narrowRoundRect; Ui::RoundRect _narrowRoundRect;
@ -219,7 +234,7 @@ Members::Controller::Controller(
, _coloredCrossLine(st::groupCallMemberColoredCrossLine) , _coloredCrossLine(st::groupCallMemberColoredCrossLine)
, _inactiveNarrowCrossLine(st::groupCallNarrowInactiveCrossLine) , _inactiveNarrowCrossLine(st::groupCallNarrowInactiveCrossLine)
, _coloredNarrowCrossLine(st::groupCallNarrowColoredCrossLine) , _coloredNarrowCrossLine(st::groupCallNarrowColoredCrossLine)
, _videoNarrowCrossLine(st::groupCallVideoCrossLine) //, _videoNarrowCrossLine(st::groupCallVideoCrossLine)
, _videoLargeCrossLine(st::groupCallLargeVideoCrossLine) , _videoLargeCrossLine(st::groupCallLargeVideoCrossLine)
, _narrowRoundRectSelected( , _narrowRoundRectSelected(
ImageRoundRadius::Large, ImageRoundRadius::Large,
@ -231,7 +246,7 @@ Members::Controller::Controller(
_coloredCrossLine.invalidate(); _coloredCrossLine.invalidate();
_inactiveNarrowCrossLine.invalidate(); _inactiveNarrowCrossLine.invalidate();
_coloredNarrowCrossLine.invalidate(); _coloredNarrowCrossLine.invalidate();
_videoNarrowCrossLine.invalidate(); //_videoNarrowCrossLine.invalidate();
}, _lifetime); }, _lifetime);
rpl::combine( rpl::combine(
@ -444,11 +459,64 @@ void Members::Controller::subscribeToChanges(not_null<Data::GroupCall*> real) {
} }
}, _lifetime); }, _lifetime);
for (const auto &[endpoint, track] : _call->activeVideoTracks()) {
toggleVideoEndpointActive(endpoint, true);
}
_call->videoStreamActiveUpdates(
) | rpl::start_with_next([=](const VideoEndpoint &endpoint) {
const auto active = _call->activeVideoTracks().contains(endpoint);
toggleVideoEndpointActive(endpoint, active);
}, _lifetime);
if (_prepared) { if (_prepared) {
appendInvitedUsers(); appendInvitedUsers();
} }
} }
void Members::Controller::toggleVideoEndpointActive(
const VideoEndpoint &endpoint,
bool active) {
const auto toggleOne = [=](
base::flat_set<not_null<PeerData*>> &set,
not_null<PeerData*> participantPeer,
bool active) {
if ((active && set.emplace(participantPeer).second)
|| (!active && set.remove(participantPeer))) {
if (_mode == PanelMode::Wide) {
if (const auto row = findRow(participantPeer)) {
delegate()->peerListUpdateRow(row);
}
}
}
};
const auto &id = endpoint.id;
const auto participantPeer = endpoint.peer;
const auto real = _call->lookupReal();
if (active) {
if (const auto participant = findParticipant(id)) {
if (computeCameraEndpoint(participant) == id) {
toggleOne(_cameraActive, participantPeer, true);
} else if (computeScreenEndpoint(participant) == id) {
toggleOne(_screenActive, participantPeer, true);
}
}
} else if (const auto participant = real->participantByPeer(
participantPeer)) {
const auto &camera = computeCameraEndpoint(participant);
const auto &screen = computeScreenEndpoint(participant);
if (camera == id || camera.empty()) {
toggleOne(_cameraActive, participantPeer, false);
}
if (screen == id || screen.empty()) {
toggleOne(_screenActive, participantPeer, false);
}
} else {
toggleOne(_cameraActive, participantPeer, false);
toggleOne(_screenActive, participantPeer, false);
}
}
void Members::Controller::appendInvitedUsers() { void Members::Controller::appendInvitedUsers() {
if (const auto id = _call->id()) { if (const auto id = _call->id()) {
for (const auto user : _peer->owner().invitedToCallUsers(id)) { for (const auto user : _peer->owner().invitedToCallUsers(id)) {
@ -714,6 +782,13 @@ Row *Members::Controller::findRow(
delegate()->peerListFindRow(participantPeer->id.value)); delegate()->peerListFindRow(participantPeer->id.value));
} }
void Members::Controller::setMode(PanelMode mode) {
if (_mode == mode) {
return;
}
_mode = mode;
}
const Data::GroupCallParticipant *Members::Controller::findParticipant( const Data::GroupCallParticipant *Members::Controller::findParticipant(
const std::string &endpoint) const { const std::string &endpoint) const {
if (endpoint.empty()) { if (endpoint.empty()) {
@ -884,14 +959,28 @@ void Members::Controller::rowPaintIcon(
Painter &p, Painter &p,
QRect rect, QRect rect,
const IconState &state) { const IconState &state) {
const auto narrowUserpic = (state.style == MembersRowStyle::Userpic); if (_mode == PanelMode::Wide && state.style == MembersRowStyle::None) {
const auto narrowVideo = (state.style == MembersRowStyle::Video); return;
}
//const auto narrowUserpic = (state.style == MembersRowStyle::Userpic);
//const auto narrowVideo = (state.style == MembersRowStyle::Video);
const auto narrow = (state.style == MembersRowStyle::Narrow);
if (!narrow && state.invited) {
st::groupCallMemberInvited.paintInCenter(
p,
QRect(
rect.topLeft() + st::groupCallMemberInvitedPosition,
st::groupCallMemberInvited.size()));
return;
}
const auto largeVideo = (state.style == MembersRowStyle::LargeVideo); const auto largeVideo = (state.style == MembersRowStyle::LargeVideo);
const auto &greenIcon = largeVideo const auto &greenIcon = largeVideo
? st::groupCallLargeVideoCrossLine.icon ? st::groupCallLargeVideoCrossLine.icon
: narrowVideo //: narrowVideo
? st::groupCallVideoCrossLine.icon //? st::groupCallVideoCrossLine.icon
: narrowUserpic //: narrowUserpic
//? st::groupCallNarrowColoredCrossLine.icon
: narrow
? st::groupCallNarrowColoredCrossLine.icon ? st::groupCallNarrowColoredCrossLine.icon
: st::groupCallMemberColoredCrossLine.icon; : st::groupCallMemberColoredCrossLine.icon;
const auto left = rect.x() + (rect.width() - greenIcon.width()) / 2; const auto left = rect.x() + (rect.width() - greenIcon.width()) / 2;
@ -905,9 +994,11 @@ void Members::Controller::rowPaintIcon(
// Just gray icon, no cross, no coloring. // Just gray icon, no cross, no coloring.
const auto &grayIcon = largeVideo const auto &grayIcon = largeVideo
? st::groupCallLargeVideoCrossLine.icon ? st::groupCallLargeVideoCrossLine.icon
: narrowVideo //: narrowVideo
? st::groupCallVideoCrossLine.icon //? st::groupCallVideoCrossLine.icon
: narrowUserpic //: narrowUserpic
//? st::groupCallNarrowInactiveCrossLine.icon
: narrow
? st::groupCallNarrowInactiveCrossLine.icon ? st::groupCallNarrowInactiveCrossLine.icon
: st::groupCallMemberInactiveCrossLine.icon; : st::groupCallMemberInactiveCrossLine.icon;
grayIcon.paintInCenter(p, rect); grayIcon.paintInCenter(p, rect);
@ -915,21 +1006,26 @@ void Members::Controller::rowPaintIcon(
} else if (state.active == 0.) { } else if (state.active == 0.) {
if (state.muted == 1.) { if (state.muted == 1.) {
if (state.raisedHand) { if (state.raisedHand) {
// #TODO narrow mode icon (narrow
st::groupCallMemberRaisedHand.paintInCenter(p, rect); ? st::groupCallNarrowRaisedHand
: st::groupCallMemberRaisedHand).paintInCenter(p, rect);
return; return;
} }
// Red crossed icon, colorized once, cached as last frame. // Red crossed icon, colorized once, cached as last frame.
auto &line = largeVideo auto &line = largeVideo
? _videoLargeCrossLine ? _videoLargeCrossLine
: narrowVideo //: narrowVideo
? _videoNarrowCrossLine //? _videoNarrowCrossLine
: narrowUserpic //: narrowUserpic
//? _coloredNarrowCrossLine
: narrow
? _coloredNarrowCrossLine ? _coloredNarrowCrossLine
: _coloredCrossLine; : _coloredCrossLine;
const auto color = (largeVideo || narrowVideo) const auto color = (largeVideo/* || narrowVideo*/)
? std::nullopt ? std::nullopt
: std::make_optional(st::groupCallMemberMutedIcon->c); : std::make_optional(narrow
? st::groupCallMemberNotJoinedStatus->c
: st::groupCallMemberMutedIcon->c);
line.paint( line.paint(
p, p,
left, left,
@ -941,9 +1037,11 @@ void Members::Controller::rowPaintIcon(
// Gray crossed icon, no coloring, cached as last frame. // Gray crossed icon, no coloring, cached as last frame.
auto &line = largeVideo auto &line = largeVideo
? _videoLargeCrossLine ? _videoLargeCrossLine
: narrowVideo //: narrowVideo
? _videoNarrowCrossLine //? _videoNarrowCrossLine
: narrowUserpic //: narrowUserpic
//? _inactiveNarrowCrossLine
: narrow
? _inactiveNarrowCrossLine ? _inactiveNarrowCrossLine
: _inactiveCrossLine; : _inactiveCrossLine;
line.paint(p, left, top, 1.); line.paint(p, left, top, 1.);
@ -952,119 +1050,163 @@ void Members::Controller::rowPaintIcon(
} }
} }
const auto activeInactiveColor = anim::color( const auto activeInactiveColor = anim::color(
st::groupCallMemberInactiveIcon, (narrow
(state.mutedByMe ? st::groupCallMemberInactiveStatus
: st::groupCallMemberInactiveIcon),
(narrow
? st::groupCallMemberActiveStatus
: state.mutedByMe
? st::groupCallMemberMutedIcon ? st::groupCallMemberMutedIcon
: st::groupCallMemberActiveIcon), : st::groupCallMemberActiveIcon),
state.speaking); state.speaking);
const auto iconColor = anim::color( const auto iconColor = anim::color(
activeInactiveColor, activeInactiveColor,
st::groupCallMemberMutedIcon, (narrow
? st::groupCallMemberNotJoinedStatus
: st::groupCallMemberMutedIcon),
state.muted); state.muted);
const auto color = (largeVideo || narrowVideo) const auto color = (largeVideo/* || narrowVideo*/)
? std::nullopt ? std::nullopt
: std::make_optional(iconColor); : std::make_optional((narrow && state.mutedByMe)
? st::groupCallMemberMutedIcon->c
: (narrow && state.raisedHand)
? st::groupCallMemberInactiveStatus->c
: iconColor);
// Don't use caching of the last frame, // Don't use caching of the last frame,
// because 'muted' may animate color. // because 'muted' may animate color.
const auto crossProgress = std::min(1. - state.active, 0.9999); const auto crossProgress = std::min(1. - state.active, 0.9999);
auto &line = largeVideo auto &line = largeVideo
? _videoLargeCrossLine ? _videoLargeCrossLine
: narrowVideo //: narrowVideo
? _videoNarrowCrossLine //? _videoNarrowCrossLine
: narrowUserpic //: narrowUserpic
//? _inactiveNarrowCrossLine
: narrow
? _inactiveNarrowCrossLine ? _inactiveNarrowCrossLine
: _inactiveCrossLine; : _inactiveCrossLine;
line.paint(p, left, top, crossProgress, color); line.paint(p, left, top, crossProgress, color);
} }
void Members::Controller::rowPaintNarrowBackground( int Members::Controller::rowPaintStatusIcon(
Painter &p, Painter &p,
int x, int x,
int y, int y,
bool selected) { int outerWidth,
(selected ? _narrowRoundRectSelected : _narrowRoundRect).paint( not_null<MembersRow*> row,
p, const IconState &state) {
{ QPoint(x, y), st::groupCallNarrowSize }); Expects(state.style == MembersRowStyle::Narrow);
}
void Members::Controller::rowPaintNarrowBorder( if (_mode != PanelMode::Wide) {
Painter &p, return 0;
int x,
int y,
not_null<Row*> row) {
//if (_call->videoEndpointLarge().peer != row->peer().get()) {
// return;
//}
//auto hq = PainterHighQualityEnabler(p);
//p.setBrush(Qt::NoBrush);
//auto pen = st::groupCallMemberActiveIcon->p;
//pen.setWidthF(st::groupCallNarrowOutline);
//p.setPen(pen);
//p.drawRoundedRect(
// QRect{ QPoint(x, y), st::groupCallNarrowSize },
// st::roundRadiusLarge,
// st::roundRadiusLarge);
}
void Members::Controller::rowPaintNarrowShadow(
Painter &p,
int x,
int y,
int sizew,
int sizeh) {
if (_narrowShadow.isNull()) {
_narrowShadow = GenerateShadow(
st::groupCallNarrowShadowHeight,
0,
kShadowMaxAlpha);
} }
const auto height = st::groupCallNarrowShadowHeight; const auto &icon = st::groupCallNarrowColoredCrossLine.icon;
p.drawImage( x += st::groupCallNarrowIconPosition.x();
QRect(x, y + sizeh - height, sizew, height), y += st::groupCallNarrowIconPosition.y();
_narrowShadow); const auto rect = QRect(x, y, icon.width(), icon.height());
rowPaintIcon(p, rect, state);
x += icon.width();
auto result = st::groupCallNarrowIconSkip;
if (_cameraActive.contains(row->peer())) {
st::groupCallNarrowCameraIcon.paint(p, x, y, outerWidth);
x += st::groupCallNarrowCameraIcon.width();
result += st::groupCallNarrowCameraIcon.width();
}
if (_screenActive.contains(row->peer())) {
st::groupCallNarrowScreenIcon.paint(p, x, y, outerWidth);
x += st::groupCallNarrowScreenIcon.width();
result += st::groupCallNarrowScreenIcon.width();
}
return result;
} }
int Members::Controller::customRowHeight() { //void Members::Controller::rowPaintNarrowBackground(
return st::groupCallNarrowSize.height() + st::groupCallNarrowRowSkip * 2; // Painter &p,
} // int x,
// int y,
void Members::Controller::customRowPaint( // bool selected) {
Painter &p, // (selected ? _narrowRoundRectSelected : _narrowRoundRect).paint(
crl::time now, // p,
not_null<PeerListRow*> row, // { QPoint(x, y), st::groupCallNarrowSize });
bool selected) { //}
const auto real = static_cast<Row*>(row.get()); //
const auto width = st::groupCallNarrowSize.width(); //void Members::Controller::rowPaintNarrowBorder(
const auto height = st::groupCallNarrowSize.height(); // Painter &p,
real->paintComplexUserpic( // int x,
p, // int y,
st::groupCallNarrowSkip, // not_null<Row*> row) {
st::groupCallNarrowRowSkip, // if (_call->videoEndpointLarge().peer != row->peer().get()) {
width, // return;
width, // }
height, // auto hq = PainterHighQualityEnabler(p);
PanelMode::Wide, // p.setBrush(Qt::NoBrush);
selected); // auto pen = st::groupCallMemberActiveIcon->p;
} // pen.setWidthF(st::groupCallNarrowOutline);
// p.setPen(pen);
bool Members::Controller::customRowSelectionPoint( // p.drawRoundedRect(
not_null<PeerListRow*> row, // QRect{ QPoint(x, y), st::groupCallNarrowSize },
int x, // st::roundRadiusLarge,
int y) { // st::roundRadiusLarge);
return x >= st::groupCallNarrowSkip //}
&& x < st::groupCallNarrowSkip + st::groupCallNarrowSize.width() //
&& y >= st::groupCallNarrowRowSkip //void Members::Controller::rowPaintNarrowShadow(
&& y < st::groupCallNarrowRowSkip + st::groupCallNarrowSize.height(); // Painter &p,
} // int x,
// int y,
Fn<QImage()> Members::Controller::customRowRippleMaskGenerator() { // int sizew,
return [] { // int sizeh) {
return Ui::RippleAnimation::roundRectMask( // if (_narrowShadow.isNull()) {
st::groupCallNarrowSize, // _narrowShadow = GenerateShadow(
st::roundRadiusLarge); // st::groupCallNarrowShadowHeight,
}; // 0,
} // kShadowMaxAlpha);
// }
// const auto height = st::groupCallNarrowShadowHeight;
// p.drawImage(
// QRect(x, y + sizeh - height, sizew, height),
// _narrowShadow);
//}
//
//int Members::Controller::customRowHeight() {
// return st::groupCallNarrowSize.height() + st::groupCallNarrowRowSkip * 2;
//}
//
//void Members::Controller::customRowPaint(
// Painter &p,
// crl::time now,
// not_null<PeerListRow*> row,
// bool selected) {
// const auto real = static_cast<Row*>(row.get());
// const auto width = st::groupCallNarrowSize.width();
// const auto height = st::groupCallNarrowSize.height();
// real->paintComplexUserpic(
// p,
// st::groupCallNarrowSkip,
// st::groupCallNarrowRowSkip,
// width,
// width,
// height,
// PanelMode::Wide,
// selected);
//}
//
//bool Members::Controller::customRowSelectionPoint(
// not_null<PeerListRow*> row,
// int x,
// int y) {
// return x >= st::groupCallNarrowSkip
// && x < st::groupCallNarrowSkip + st::groupCallNarrowSize.width()
// && y >= st::groupCallNarrowRowSkip
// && y < st::groupCallNarrowRowSkip + st::groupCallNarrowSize.height();
//}
//
//Fn<QImage()> Members::Controller::customRowRippleMaskGenerator() {
// return [] {
// return Ui::RippleAnimation::roundRectMask(
// st::groupCallNarrowSize,
// st::roundRadiusLarge);
// };
//}
auto Members::Controller::kickParticipantRequests() const auto Members::Controller::kickParticipantRequests() const
-> rpl::producer<not_null<PeerData*>>{ -> rpl::producer<not_null<PeerData*>>{
@ -1507,9 +1649,9 @@ int Members::desiredHeight() const {
return 0; return 0;
}(); }();
const auto use = std::max(count, _list->fullRowsCount()); const auto use = std::max(count, _list->fullRowsCount());
const auto single = (_mode.current() == PanelMode::Wide) const auto single = /*(_mode.current() == PanelMode::Wide)
? (st::groupCallNarrowSize.height() + st::groupCallNarrowRowSkip * 2) ? (st::groupCallNarrowSize.height() + st::groupCallNarrowRowSkip * 2)
: st::groupCallMembersList.item.height; : */st::groupCallMembersList.item.height;
return top return top
+ (use * single) + (use * single)
+ (use ? st::lineWidth : 0); + (use ? st::lineWidth : 0);
@ -1563,9 +1705,9 @@ void Members::setupAddMember(not_null<GroupCall*> call) {
} }
auto addMember = (Ui::AbstractButton*)nullptr; auto addMember = (Ui::AbstractButton*)nullptr;
auto wrap = [&]() -> object_ptr<Ui::RpWidget> { auto wrap = [&]() -> object_ptr<Ui::RpWidget> {
if (mode == PanelMode::Default) { //if (mode == PanelMode::Default) {
auto result = Settings::CreateButton( auto result = Settings::CreateButton(
this, _layout.get(),
tr::lng_group_call_invite(), tr::lng_group_call_invite(),
st::groupCallAddMember, st::groupCallAddMember,
&st::groupCallAddMemberIcon, &st::groupCallAddMemberIcon,
@ -1573,34 +1715,36 @@ void Members::setupAddMember(not_null<GroupCall*> call) {
&st::groupCallMemberInactiveIcon); &st::groupCallMemberInactiveIcon);
addMember = result.data(); addMember = result.data();
return result; return result;
} //}
auto result = object_ptr<Ui::RpWidget>(_layout.get()); //auto result = object_ptr<Ui::RpWidget>(_layout.get());
const auto skip = st::groupCallNarrowSkip; //const auto skip = st::groupCallNarrowSkip;
const auto fullwidth = st::groupCallNarrowSize.width() //const auto fullwidth = st::groupCallNarrowSize.width()
+ 2 * skip; // + 2 * skip;
const auto fullheight = st::groupCallNarrowAddMember.height //const auto fullheight = st::groupCallNarrowAddMember.height
+ st::groupCallNarrowRowSkip; // + st::groupCallNarrowRowSkip;
result->resize(fullwidth, fullheight); //result->resize(fullwidth, fullheight);
const auto button = Ui::CreateChild<Ui::RoundButton>( //const auto button = Ui::CreateChild<Ui::RoundButton>(
result.data(), // result.data(),
rpl::single(QString()), // rpl::single(QString()),
st::groupCallNarrowAddMember); // st::groupCallNarrowAddMember);
button->move(skip, 0); //button->move(skip, 0);
const auto width = fullwidth - 2 * skip; //const auto width = fullwidth - 2 * skip;
button->setFullWidth(width); //button->setFullWidth(width);
Settings::AddButtonIcon( //Settings::AddButtonIcon(
button, // button,
&st::groupCallAddMemberIcon, // &st::groupCallAddMemberIcon,
(width - st::groupCallAddMemberIcon.width()) / 2, // (width - st::groupCallAddMemberIcon.width()) / 2,
&st::groupCallMemberInactiveIcon); // &st::groupCallMemberInactiveIcon);
addMember = button; //addMember = button;
return result; //return result;
}(); }();
addMember->show(); addMember->show();
addMember->clicks( addMember->clicks(
) | rpl::to_empty | rpl::start_to_stream( ) | rpl::to_empty | rpl::start_to_stream(
_addMemberRequests, _addMemberRequests,
addMember->lifetime()); addMember->lifetime());
wrap->show();
wrap->resizeToWidth(_layout->width());
_addMemberButton = wrap.data(); _addMemberButton = wrap.data();
_layout->insert(1, std::move(wrap)); _layout->insert(1, std::move(wrap));
}, lifetime()); }, lifetime());
@ -1622,9 +1766,10 @@ void Members::setMode(PanelMode mode) {
for (const auto &tile : _videoTiles) { for (const auto &tile : _videoTiles) {
tile.video->setVisible(mode == PanelMode::Default); tile.video->setVisible(mode == PanelMode::Default);
} }
_list->setMode((mode == PanelMode::Wide) _listController->setMode(mode);
? PeerListContent::Mode::Custom //_list->setMode((mode == PanelMode::Wide)
: PeerListContent::Mode::Default); // ? PeerListContent::Mode::Custom
// : PeerListContent::Mode::Default);
} }
rpl::producer<int> Members::fullCountValue() const { rpl::producer<int> Members::fullCountValue() const {
@ -1763,15 +1908,26 @@ void Members::setupPinnedVideo() {
} }
_call->videoStreamActiveUpdates( _call->videoStreamActiveUpdates(
) | rpl::start_with_next([=](const VideoEndpoint &endpoint) { ) | rpl::start_with_next([=](const VideoEndpoint &endpoint) {
const auto &tracks = _call->activeVideoTracks(); if (_call->activeVideoTracks().contains(endpoint)) {
const auto i = tracks.find(endpoint); // Add async (=> the participant row is definitely in Members).
if (i != end(tracks)) { crl::on_main(_pinnedVideoWrap, [=] {
_videoTiles.push_back(setupTile(endpoint, i->second)); const auto &tracks = _call->activeVideoTracks();
const auto i = tracks.find(endpoint);
if (i != end(tracks)) {
_videoTiles.push_back(setupTile(endpoint, i->second));
}
});
} else { } else {
_videoTiles.erase( // Remove sync.
ranges::remove(_videoTiles, endpoint, &VideoTile::endpoint), const auto eraseTill = end(_videoTiles);
end(_videoTiles)); const auto eraseFrom = ranges::remove(
refreshTilesGeometry(); _videoTiles,
endpoint,
&VideoTile::endpoint);
if (eraseFrom != eraseTill) {
_videoTiles.erase(eraseFrom, eraseTill);
refreshTilesGeometry();
}
} }
}, _pinnedVideoWrap->lifetime()); }, _pinnedVideoWrap->lifetime());

View file

@ -412,15 +412,15 @@ bool MembersRow::paintVideo(
//return true; //return true;
} }
std::tuple<int, int, int> MembersRow::UserpicInNarrowMode( //std::tuple<int, int, int> MembersRow::UserpicInNarrowMode(
int x, // int x,
int y, // int y,
int sizew, // int sizew,
int sizeh) { // int sizeh) {
const auto useSize = st::groupCallMembersList.item.photoSize; // const auto useSize = st::groupCallMembersList.item.photoSize;
const auto skipx = (sizew - useSize) / 2; // const auto skipx = (sizew - useSize) / 2;
return { x + skipx, y + st::groupCallNarrowUserpicTop, useSize }; // return { x + skipx, y + st::groupCallNarrowUserpicTop, useSize };
} //}
void MembersRow::paintBlobs( void MembersRow::paintBlobs(
Painter &p, Painter &p,
@ -433,9 +433,9 @@ void MembersRow::paintBlobs(
return; return;
} }
auto size = sizew; auto size = sizew;
if (mode == PanelMode::Wide) { //if (mode == PanelMode::Wide) {
std::tie(x, y, size) = UserpicInNarrowMode(x, y, sizew, sizeh); // std::tie(x, y, size) = UserpicInNarrowMode(x, y, sizew, sizeh);
} //}
const auto mutedByMe = (_state == State::MutedByMe); const auto mutedByMe = (_state == State::MutedByMe);
const auto shift = QPointF(x + size / 2., y + size / 2.); const auto shift = QPointF(x + size / 2., y + size / 2.);
auto hq = PainterHighQualityEnabler(p); auto hq = PainterHighQualityEnabler(p);
@ -461,9 +461,9 @@ void MembersRow::paintScaledUserpic(
int sizeh, int sizeh,
PanelMode mode) { PanelMode mode) {
auto size = sizew; auto size = sizew;
if (mode == PanelMode::Wide) { //if (mode == PanelMode::Wide) {
std::tie(x, y, size) = UserpicInNarrowMode(x, y, sizew, sizeh); // std::tie(x, y, size) = UserpicInNarrowMode(x, y, sizew, sizeh);
} //}
if (!_blobsAnimation) { if (!_blobsAnimation) {
peer()->paintUserpicLeft(p, userpic, x, y, outerWidth, size); peer()->paintUserpicLeft(p, userpic, x, y, outerWidth, size);
return; return;
@ -503,72 +503,72 @@ void MembersRow::paintMuteIcon(
_delegate->rowPaintIcon(p, iconRect, computeIconState(style)); _delegate->rowPaintIcon(p, iconRect, computeIconState(style));
} }
void MembersRow::paintNarrowName( //void MembersRow::paintNarrowName(
Painter &p, // Painter &p,
int x, // int x,
int y, // int y,
int sizew, // int sizew,
int sizeh, // int sizeh,
MembersRowStyle style) { // MembersRowStyle style) {
if (_narrowName.isEmpty()) { // if (_narrowName.isEmpty()) {
_narrowName.setText( // _narrowName.setText(
st::semiboldTextStyle, // st::semiboldTextStyle,
generateShortName(), // generateShortName(),
Ui::NameTextOptions()); // Ui::NameTextOptions());
} // }
if (style == MembersRowStyle::Video) { // if (style == MembersRowStyle::Video) {
_delegate->rowPaintNarrowShadow(p, x, y, sizew, sizeh); // _delegate->rowPaintNarrowShadow(p, x, y, sizew, sizeh);
} // }
const auto &icon = st::groupCallVideoCrossLine.icon; // const auto &icon = st::groupCallVideoCrossLine.icon;
const auto added = icon.width() - st::groupCallNarrowIconLess; // const auto added = icon.width() - st::groupCallNarrowIconLess;
const auto available = sizew - 2 * st::normalFont->spacew - added; // const auto available = sizew - 2 * st::normalFont->spacew - added;
const auto use = std::min(available, _narrowName.maxWidth()); // const auto use = std::min(available, _narrowName.maxWidth());
const auto left = x + (sizew - use - added) / 2; // const auto left = x + (sizew - use - added) / 2;
const auto iconRect = QRect( // const auto iconRect = QRect(
left - st::groupCallNarrowIconLess, // left - st::groupCallNarrowIconLess,
y + st::groupCallNarrowIconTop, // y + st::groupCallNarrowIconTop,
icon.width(), // icon.width(),
icon.height()); // icon.height());
const auto &state = computeIconState(style); // const auto &state = computeIconState(style);
_delegate->rowPaintIcon(p, iconRect, state); // _delegate->rowPaintIcon(p, iconRect, state);
//
p.setPen([&] { // p.setPen([&] {
if (style == MembersRowStyle::Video) { // if (style == MembersRowStyle::Video) {
return st::groupCallVideoTextFg->p; // return st::groupCallVideoTextFg->p;
} else if (state.speaking == 1. && !state.mutedByMe) { // } else if (state.speaking == 1. && !state.mutedByMe) {
return st::groupCallMemberActiveIcon->p; // return st::groupCallMemberActiveIcon->p;
} else if (state.speaking == 0.) { // } else if (state.speaking == 0.) {
if (state.active == 1.) { // if (state.active == 1.) {
return st::groupCallMemberInactiveIcon->p; // return st::groupCallMemberInactiveIcon->p;
} else if (state.active == 0.) { // } else if (state.active == 0.) {
if (state.muted == 1.) { // if (state.muted == 1.) {
return state.raisedHand // return state.raisedHand
? st::groupCallMemberInactiveStatus->p // ? st::groupCallMemberInactiveStatus->p
: st::groupCallMemberMutedIcon->p; // : st::groupCallMemberMutedIcon->p;
} else if (state.muted == 0.) { // } else if (state.muted == 0.) {
return st::groupCallMemberInactiveIcon->p; // return st::groupCallMemberInactiveIcon->p;
} // }
} // }
} // }
const auto activeInactiveColor = anim::color( // const auto activeInactiveColor = anim::color(
st::groupCallMemberInactiveIcon, // st::groupCallMemberInactiveIcon,
(state.mutedByMe // (state.mutedByMe
? st::groupCallMemberMutedIcon // ? st::groupCallMemberMutedIcon
: st::groupCallMemberActiveIcon), // : st::groupCallMemberActiveIcon),
state.speaking); // state.speaking);
return anim::pen( // return anim::pen(
activeInactiveColor, // activeInactiveColor,
st::groupCallMemberMutedIcon, // st::groupCallMemberMutedIcon,
state.muted); // state.muted);
}()); // }());
const auto nameLeft = iconRect.x() + icon.width(); // const auto nameLeft = iconRect.x() + icon.width();
const auto nameTop = y + st::groupCallNarrowNameTop; // const auto nameTop = y + st::groupCallNarrowNameTop;
if (use == available) { // if (use == available) {
_narrowName.drawLeftElided(p, nameLeft, nameTop, available, sizew); // _narrowName.drawLeftElided(p, nameLeft, nameTop, available, sizew);
} else { // } else {
_narrowName.drawLeft(p, nameLeft, nameTop, available, sizew); // _narrowName.drawLeft(p, nameLeft, nameTop, available, sizew);
} // }
} //}
auto MembersRow::generatePaintUserpicCallback() -> PaintRoundImageCallback { auto MembersRow::generatePaintUserpicCallback() -> PaintRoundImageCallback {
return [=](Painter &p, int x, int y, int outerWidth, int size) { return [=](Painter &p, int x, int y, int outerWidth, int size) {
@ -586,20 +586,20 @@ void MembersRow::paintComplexUserpic(
int sizeh, int sizeh,
PanelMode mode, PanelMode mode,
bool selected) { bool selected) {
if (mode == PanelMode::Wide) { //if (mode == PanelMode::Wide) {
if (paintVideo(p, x, y, sizew, sizeh, mode)) { // if (paintVideo(p, x, y, sizew, sizeh, mode)) {
paintNarrowName(p, x, y, sizew, sizeh, MembersRowStyle::Video); // paintNarrowName(p, x, y, sizew, sizeh, MembersRowStyle::Video);
_delegate->rowPaintNarrowBorder(p, x, y, this); // _delegate->rowPaintNarrowBorder(p, x, y, this);
return; // return;
} // }
_delegate->rowPaintNarrowBackground(p, x, y, selected); // _delegate->rowPaintNarrowBackground(p, x, y, selected);
paintRipple(p, x, y, outerWidth); // paintRipple(p, x, y, outerWidth);
} //}
paintBlobs(p, x, y, sizew, sizeh, mode); paintBlobs(p, x, y, sizew, sizeh, mode);
if (mode == PanelMode::Default //if (mode == PanelMode::Default
&& paintVideo(p, x, y, sizew, sizeh, mode)) { // && paintVideo(p, x, y, sizew, sizeh, mode)) {
return; // return;
} //}
paintScaledUserpic( paintScaledUserpic(
p, p,
ensureUserpicView(), ensureUserpicView(),
@ -609,20 +609,22 @@ void MembersRow::paintComplexUserpic(
sizew, sizew,
sizeh, sizeh,
mode); mode);
if (mode == PanelMode::Wide) { //if (mode == PanelMode::Wide) {
paintNarrowName(p, x, y, sizew, sizeh, MembersRowStyle::Userpic); // paintNarrowName(p, x, y, sizew, sizeh, MembersRowStyle::Userpic);
_delegate->rowPaintNarrowBorder(p, x, y, this); // _delegate->rowPaintNarrowBorder(p, x, y, this);
} //}
} }
int MembersRow::statusIconWidth() const { int MembersRow::statusIconWidth(bool skipIcon) const {
if (!_statusIcon || !_speaking) { if (!_statusIcon || !_speaking) {
return 0; return 0;
} }
const auto shown = _statusIcon->shownAnimation.value( const auto shown = _statusIcon->shownAnimation.value(
_statusIcon->shown ? 1. : 0.); _statusIcon->shown ? 1. : 0.);
const auto full = _statusIcon->speaker.width() const auto iconWidth = skipIcon
+ _statusIcon->arcsWidth ? 0
: (_statusIcon->speaker.width() + _statusIcon->arcsWidth);
const auto full = iconWidth
+ _statusIcon->percentWidth + _statusIcon->percentWidth
+ st::normalFont->spacew; + st::normalFont->spacew;
return int(std::round(shown * full)); return int(std::round(shown * full));
@ -638,7 +640,8 @@ void MembersRow::paintStatusIcon(
int y, int y,
const style::PeerListItem &st, const style::PeerListItem &st,
const style::font &font, const style::font &font,
bool selected) { bool selected,
bool skipIcon) {
if (!_statusIcon) { if (!_statusIcon) {
return; return;
} }
@ -661,8 +664,10 @@ void MembersRow::paintStatusIcon(
+ QPoint( + QPoint(
speakerRect.width() - st::groupCallStatusSpeakerArcsSkip, speakerRect.width() - st::groupCallStatusSpeakerArcsSkip,
speakerRect.height() / 2); speakerRect.height() / 2);
const auto fullWidth = speakerRect.width() const auto iconWidth = skipIcon
+ _statusIcon->arcsWidth ? 0
: (speakerRect.width() + _statusIcon->arcsWidth);
const auto fullWidth = iconWidth
+ _statusIcon->percentWidth + _statusIcon->percentWidth
+ st::normalFont->spacew; + st::normalFont->spacew;
@ -674,18 +679,20 @@ void MembersRow::paintStatusIcon(
p.scale(shown, shown); p.scale(shown, shown);
p.translate(-centerx, -centery); p.translate(-centerx, -centery);
} }
_statusIcon->speaker.paint( if (!skipIcon) {
p, _statusIcon->speaker.paint(
speakerRect.topLeft(), p,
speakerRect.width(), speakerRect.topLeft(),
color); speakerRect.width(),
p.translate(arcPosition); color);
_statusIcon->arcs.paint(p, color); p.translate(arcPosition);
p.translate(-arcPosition); _statusIcon->arcs.paint(p, color);
p.translate(-arcPosition);
}
p.setFont(st::normalFont); p.setFont(st::normalFont);
p.setPen(st.statusFgActive); p.setPen(st.statusFgActive);
p.drawTextLeft( p.drawTextLeft(
x + speakerRect.width() + _statusIcon->arcsWidth, x + iconWidth,
y, y,
fullWidth, fullWidth,
_statusIcon->percent); _statusIcon->percent);
@ -728,20 +735,31 @@ void MembersRow::paintComplexStatusText(
int outerWidth, int outerWidth,
bool selected, bool selected,
MembersRowStyle style) { MembersRowStyle style) {
const auto skip = (style == MembersRowStyle::None)
? _delegate->rowPaintStatusIcon(
p,
x,
y,
outerWidth,
this,
computeIconState(MembersRowStyle::Narrow))
: 0;
const auto narrowMode = (skip > 0);
x += skip;
availableWidth -= skip;
const auto &font = st::normalFont; const auto &font = st::normalFont;
const auto about = (style == MembersRowStyle::LargeVideo) const auto about = (style == MembersRowStyle::LargeVideo)
? QString() ? QString()
: (_state == State::Inactive : ((_state == State::RaisedHand && !_raisedHandStatus)
|| _state == State::Muted || (_state != State::Active && _state != State::RaisedHand))
|| (_state == State::RaisedHand && !_raisedHandStatus))
? _aboutText ? _aboutText
: QString(); : QString();
if (about.isEmpty() if (about.isEmpty()
&& _state != State::Invited && _state != State::Invited
&& _state != State::MutedByMe) { && _state != State::MutedByMe) {
paintStatusIcon(p, x, y, st, font, selected); paintStatusIcon(p, x, y, st, font, selected, narrowMode);
const auto translatedWidth = statusIconWidth(); const auto translatedWidth = statusIconWidth(narrowMode);
p.translate(translatedWidth, 0); p.translate(translatedWidth, 0);
const auto guard = gsl::finally([&] { const auto guard = gsl::finally([&] {
p.translate(-translatedWidth, 0); p.translate(-translatedWidth, 0);
@ -762,6 +780,8 @@ void MembersRow::paintComplexStatusText(
p.setPen(st::groupCallVideoSubTextFg); p.setPen(st::groupCallVideoSubTextFg);
} else if (_state == State::MutedByMe) { } else if (_state == State::MutedByMe) {
p.setPen(st::groupCallMemberMutedIcon); p.setPen(st::groupCallMemberMutedIcon);
} else if (narrowMode && !about.isEmpty()) {
p.setPen(st::groupCallMembersFg);
} else { } else {
p.setPen(st::groupCallMemberNotJoinedStatus); p.setPen(st::groupCallMemberNotJoinedStatus);
} }
@ -814,11 +834,6 @@ void MembersRow::paintAction(
outerWidth); outerWidth);
if (_state == State::Invited) { if (_state == State::Invited) {
_actionRipple = nullptr; _actionRipple = nullptr;
st::groupCallMemberInvited.paint(
p,
QPoint(x, y) + st::groupCallMemberInvitedPosition,
outerWidth);
return;
} }
if (_actionRipple) { if (_actionRipple) {
_actionRipple->paint( _actionRipple->paint(
@ -847,6 +862,7 @@ MembersRowDelegate::IconState MembersRow::computeIconState(
.muted = muted, .muted = muted,
.mutedByMe = (_state == State::MutedByMe), .mutedByMe = (_state == State::MutedByMe),
.raisedHand = (_state == State::RaisedHand), .raisedHand = (_state == State::RaisedHand),
.invited = (_state == State::Invited),
.style = style, .style = style,
}; };
} }
@ -911,7 +927,7 @@ void MembersRow::addActionRipple(QPoint point, Fn<void()> updateCallback) {
void MembersRow::refreshName(const style::PeerListItem &st) { void MembersRow::refreshName(const style::PeerListItem &st) {
PeerListRow::refreshName(st); PeerListRow::refreshName(st);
_narrowName = Ui::Text::String(); //_narrowName = Ui::Text::String();
} }
void MembersRow::stopLastActionRipple() { void MembersRow::stopLastActionRipple() {

View file

@ -29,8 +29,9 @@ namespace Calls::Group {
enum class MembersRowStyle { enum class MembersRowStyle {
None, None,
Userpic, //Userpic,
Video, //Video,
Narrow,
LargeVideo, LargeVideo,
}; };
@ -43,6 +44,7 @@ public:
float64 muted = 0.; float64 muted = 0.;
bool mutedByMe = false; bool mutedByMe = false;
bool raisedHand = false; bool raisedHand = false;
bool invited = false;
MembersRowStyle style = MembersRowStyle::None; MembersRowStyle style = MembersRowStyle::None;
}; };
virtual bool rowIsMe(not_null<PeerData*> participantPeer) = 0; virtual bool rowIsMe(not_null<PeerData*> participantPeer) = 0;
@ -53,22 +55,29 @@ public:
Painter &p, Painter &p,
QRect rect, QRect rect,
const IconState &state) = 0; const IconState &state) = 0;
virtual void rowPaintNarrowBackground( virtual int rowPaintStatusIcon(
Painter &p, Painter &p,
int x, int x,
int y, int y,
bool selected) = 0; int outerWidth,
virtual void rowPaintNarrowBorder( not_null<MembersRow*> row,
Painter &p, const IconState &state) = 0;
int x, //virtual void rowPaintNarrowBackground(
int y, // Painter &p,
not_null<MembersRow*> row) = 0; // int x,
virtual void rowPaintNarrowShadow( // int y,
Painter &p, // bool selected) = 0;
int x, //virtual void rowPaintNarrowBorder(
int y, // Painter &p,
int sizew, // int x,
int sizeh) = 0; // int y,
// not_null<MembersRow*> row) = 0;
//virtual void rowPaintNarrowShadow(
// Painter &p,
// int x,
// int y,
// int sizew,
// int sizeh) = 0;
}; };
class MembersRow final : public PeerListRow { class MembersRow final : public PeerListRow {
@ -174,7 +183,7 @@ private:
struct BlobsAnimation; struct BlobsAnimation;
struct StatusIcon; struct StatusIcon;
int statusIconWidth() const; int statusIconWidth(bool skipIcon) const;
int statusIconHeight() const; int statusIconHeight() const;
void paintStatusIcon( void paintStatusIcon(
Painter &p, Painter &p,
@ -182,7 +191,8 @@ private:
int y, int y,
const style::PeerListItem &st, const style::PeerListItem &st,
const style::font &font, const style::font &font,
bool selected); bool selected,
bool skipIcon);
void refreshStatus() override; void refreshStatus() override;
void setSounding(bool sounding); void setSounding(bool sounding);
@ -201,11 +211,11 @@ private:
int sizew, int sizew,
int sizeh, int sizeh,
PanelMode mode); PanelMode mode);
[[nodiscard]] static std::tuple<int, int, int> UserpicInNarrowMode( //[[nodiscard]] static std::tuple<int, int, int> UserpicInNarrowMode(
int x, // int x,
int y, // int y,
int sizew, // int sizew,
int sizeh); // int sizeh);
void paintBlobs( void paintBlobs(
Painter &p, Painter &p,
int x, int x,

View file

@ -1923,7 +1923,7 @@ void Panel::updateButtonsGeometry() {
+ (_settings ? _settings : _callShare)->width() + skip + (_settings ? _settings : _callShare)->width() + skip
+ _hangup->width() + skip; + _hangup->width() + skip;
const auto membersSkip = st::groupCallNarrowSkip; const auto membersSkip = st::groupCallNarrowSkip;
const auto membersWidth = st::groupCallNarrowSize.width() const auto membersWidth = st::groupCallNarrowMembersWidth
+ 2 * membersSkip; + 2 * membersSkip;
auto left = (_mode == PanelMode::Default) auto left = (_mode == PanelMode::Default)
? (widget()->width() - fullWidth) / 2 ? (widget()->width() - fullWidth) / 2
@ -1998,17 +1998,17 @@ void Panel::updateMembersGeometry() {
const auto desiredHeight = _members->desiredHeight(); const auto desiredHeight = _members->desiredHeight();
if (_mode == PanelMode::Wide) { if (_mode == PanelMode::Wide) {
const auto skip = st::groupCallNarrowSkip; const auto skip = st::groupCallNarrowSkip;
const auto membersWidth = st::groupCallNarrowSize.width() + 2 * skip; const auto membersWidth = st::groupCallNarrowMembersWidth;
const auto top = st::groupCallWideVideoTop; const auto top = st::groupCallWideVideoTop;
_members->setGeometry( _members->setGeometry(
0, skip,
top, top,
membersWidth, membersWidth,
std::min(desiredHeight, widget()->height())); std::min(desiredHeight, widget()->height()));
_pinnedVideoWrap->setGeometry( _pinnedVideoWrap->setGeometry(
membersWidth, membersWidth + 2 * skip,
top, top,
widget()->width() - membersWidth - skip, widget()->width() - membersWidth - 3 * skip,
widget()->height() - top - skip); widget()->height() - top - skip);
} else { } else {
const auto membersBottom = _videoMode.current() const auto membersBottom = _videoMode.current()