Rename LargeVideo to Video in voice chats.

This commit is contained in:
John Preston 2021-05-30 18:46:51 +04:00
parent 90efbf1210
commit 97c7c0742c
12 changed files with 70 additions and 120 deletions

View file

@ -1170,29 +1170,8 @@ desktopCaptureSubmit: RoundButton(desktopCaptureCancel) {
groupCallNarrowSkip: 9px;
groupCallNarrowMembersWidth: 204px;
groupCallNarrowVideoHeight: 120px;
//groupCallNarrowRowSkip: 4px;
//groupCallNarrowSize: size(144px, 90px);
//groupCallNarrowUserpicTop: 13px;
//groupCallNarrowNameTop: 65px;
//groupCallNarrowIconTop: 62px;
//groupCallNarrowIconLess: 5px;
groupCallWideModeWidthMin: 600px;
groupCallWideModeSize: size(960px, 580px);
//groupCallNarrowAddMemberHeight: 32px;
//groupCallNarrowOutline: 2px;
//groupCallNarrowShadowHeight: 36px;
//groupCallNarrowAddMember: RoundButton(defaultActiveButton) {
// textFg: groupCallMemberNotJoinedStatus;
// textFgOver: groupCallMemberNotJoinedStatus;
// textBg: groupCallMembersBg;
// textBgOver: groupCallMembersBgOver;
//
// height: 32px;
// radius: roundRadiusLarge;
//
// ripple: groupCallRipple;
//}
groupCallNarrowInactiveCrossLine: CrossLineAnimation {
fg: groupCallMemberNotJoinedStatus;
icon: icon {{ "calls/video_mini_mute", groupCallMemberNotJoinedStatus }};
@ -1210,17 +1189,13 @@ groupCallNarrowCameraIcon: icon {{ "calls/video_mini_video", groupCallMemberNotJ
groupCallNarrowScreenIcon: icon {{ "calls/video_mini_screencast", groupCallMemberNotJoinedStatus }};
groupCallNarrowIconPosition: point(-4px, 2px);
groupCallNarrowIconSkip: 15px;
//groupCallVideoCrossLine: CrossLineAnimation(groupCallNarrowInactiveCrossLine) {
// fg: groupCallVideoTextFg;
// icon: icon {{ "calls/voice_mute_mini", groupCallVideoTextFg }};
//}
groupCallOutline: 2px;
groupCallLargeVideoCrossLine: CrossLineAnimation(groupCallMemberColoredCrossLine) {
groupCallVideoCrossLine: CrossLineAnimation(groupCallMemberColoredCrossLine) {
fg: groupCallVideoTextFg;
icon: icon {{ "calls/video_over_mute", groupCallVideoTextFg }};
}
GroupCallLargeVideo {
GroupCallVideoTile {
shadowHeight: pixels;
namePosition: point;
pin: CrossLineAnimation;
@ -1230,7 +1205,7 @@ GroupCallLargeVideo {
iconPosition: point;
}
groupCallLargeVideo: GroupCallLargeVideo {
groupCallVideoTile: GroupCallVideoTile {
shadowHeight: 40px;
namePosition: point(15px, 8px);
pin: CrossLineAnimation {
@ -1246,13 +1221,6 @@ groupCallLargeVideo: GroupCallLargeVideo {
pinTextPosition: point(1px, 3px);
iconPosition: point(10px, 5px);
}
//groupCallLargeVideoListItem: PeerListItem(groupCallMembersListItem) {
// nameFg: groupCallVideoTextFg;
// nameFgChecked: groupCallVideoTextFg;
// statusFg: groupCallVideoSubTextFg;
// statusFgOver: groupCallVideoSubTextFg;
// statusFgActive: groupCallVideoSubTextFg;
//}
groupCallVideoSmallSkip: 4px;
groupCallVideoLargeSkip: 6px;

View file

@ -182,7 +182,7 @@ private:
Ui::CrossLineAnimation _coloredCrossLine;
Ui::CrossLineAnimation _inactiveNarrowCrossLine;
Ui::CrossLineAnimation _coloredNarrowCrossLine;
Ui::CrossLineAnimation _videoLargeCrossLine;
Ui::CrossLineAnimation _videoCrossLine;
Ui::RoundRect _narrowRoundRectSelected;
Ui::RoundRect _narrowRoundRect;
QImage _narrowShadow;
@ -204,7 +204,7 @@ Members::Controller::Controller(
, _coloredCrossLine(st::groupCallMemberColoredCrossLine)
, _inactiveNarrowCrossLine(st::groupCallNarrowInactiveCrossLine)
, _coloredNarrowCrossLine(st::groupCallNarrowColoredCrossLine)
, _videoLargeCrossLine(st::groupCallLargeVideoCrossLine)
, _videoCrossLine(st::groupCallVideoCrossLine)
, _narrowRoundRectSelected(
ImageRoundRadius::Large,
st::groupCallMembersBgOver)
@ -894,7 +894,8 @@ void Members::Controller::rowPaintIcon(
Painter &p,
QRect rect,
const IconState &state) {
if (_mode == PanelMode::Wide && state.style == MembersRowStyle::None) {
if (_mode == PanelMode::Wide
&& state.style == MembersRowStyle::Default) {
return;
}
const auto narrow = (state.style == MembersRowStyle::Narrow);
@ -906,9 +907,9 @@ void Members::Controller::rowPaintIcon(
st::groupCallMemberInvited.size()));
return;
}
const auto largeVideo = (state.style == MembersRowStyle::LargeVideo);
const auto &greenIcon = largeVideo
? st::groupCallLargeVideoCrossLine.icon
const auto video = (state.style == MembersRowStyle::Video);
const auto &greenIcon = video
? st::groupCallVideoCrossLine.icon
: narrow
? st::groupCallNarrowColoredCrossLine.icon
: st::groupCallMemberColoredCrossLine.icon;
@ -921,8 +922,8 @@ void Members::Controller::rowPaintIcon(
} else if (state.speaking == 0. && (!narrow || !state.mutedByMe)) {
if (state.active == 1.) {
// Just gray icon, no cross, no coloring.
const auto &grayIcon = largeVideo
? st::groupCallLargeVideoCrossLine.icon
const auto &grayIcon = video
? st::groupCallVideoCrossLine.icon
: narrow
? st::groupCallNarrowInactiveCrossLine.icon
: st::groupCallMemberInactiveCrossLine.icon;
@ -937,12 +938,12 @@ void Members::Controller::rowPaintIcon(
return;
}
// Red crossed icon, colorized once, cached as last frame.
auto &line = largeVideo
? _videoLargeCrossLine
auto &line = video
? _videoCrossLine
: narrow
? _coloredNarrowCrossLine
: _coloredCrossLine;
const auto color = largeVideo
const auto color = video
? std::nullopt
: std::make_optional(narrow
? st::groupCallMemberNotJoinedStatus->c
@ -956,8 +957,8 @@ void Members::Controller::rowPaintIcon(
return;
} else if (state.muted == 0.) {
// Gray crossed icon, no coloring, cached as last frame.
auto &line = largeVideo
? _videoLargeCrossLine
auto &line = video
? _videoCrossLine
: narrow
? _inactiveNarrowCrossLine
: _inactiveCrossLine;
@ -982,7 +983,7 @@ void Members::Controller::rowPaintIcon(
? st::groupCallMemberNotJoinedStatus
: st::groupCallMemberMutedIcon),
state.muted);
const auto color = largeVideo
const auto color = video
? std::nullopt
: std::make_optional((narrow && state.mutedByMe)
? st::groupCallMemberMutedIcon->c
@ -993,8 +994,8 @@ void Members::Controller::rowPaintIcon(
// Don't use caching of the last frame,
// because 'muted' may animate color.
const auto crossProgress = std::min(1. - state.active, 0.9999);
auto &line = largeVideo
? _videoLargeCrossLine
auto &line = video
? _videoCrossLine
: narrow
? _inactiveNarrowCrossLine
: _inactiveCrossLine;
@ -1410,13 +1411,6 @@ std::unique_ptr<Row> Members::Controller::createRow(
const Data::GroupCallParticipant &participant) {
auto result = std::make_unique<Row>(this, participant.peer);
updateRow(result.get(), &participant);
//const auto &camera = computeCameraEndpoint(&participant);
//const auto &screen = computeScreenEndpoint(&participant);
//if (!screen.empty() && _largeEndpoint != screen) {
// setRowVideoEndpoint(result.get(), screen);
//} else if (!camera.empty() && _largeEndpoint != camera) {
// setRowVideoEndpoint(result.get(), camera);
//}
return result;
}
@ -1559,10 +1553,6 @@ void Members::setupAddMember(not_null<GroupCall*> call) {
updateControlsGeometry();
}
rpl::producer<> Members::enlargeVideo() const {
return _enlargeVideoClicks.events();
}
Row *Members::lookupRow(not_null<PeerData*> peer) const {
return _listController->findRow(peer);
}

View file

@ -55,7 +55,6 @@ public:
[[nodiscard]] rpl::producer<> addMembersRequests() const {
return _addMemberRequests.events();
}
[[nodiscard]] rpl::producer<> enlargeVideo() const;
[[nodiscard]] MembersRow *lookupRow(not_null<PeerData*> peer) const;
@ -99,7 +98,6 @@ private:
not_null<Ui::VerticalLayout*> _layout;
const not_null<Ui::RpWidget*> _videoWrap;
std::unique_ptr<Viewport> _viewport;
rpl::event_stream<> _enlargeVideoClicks;
rpl::variable<Ui::RpWidget*> _addMemberButton = nullptr;
RpWidget *_topSkip = nullptr;
RpWidget *_bottomSkip = nullptr;

View file

@ -581,7 +581,7 @@ void MembersRow::paintStatusText(
availableWidth,
outerWidth,
selected,
MembersRowStyle::None);
MembersRowStyle::Default);
}
void MembersRow::paintComplexStatusText(
@ -593,7 +593,7 @@ void MembersRow::paintComplexStatusText(
int outerWidth,
bool selected,
MembersRowStyle style) {
const auto skip = (style == MembersRowStyle::None)
const auto skip = (style == MembersRowStyle::Default)
? _delegate->rowPaintStatusIcon(
p,
x,
@ -606,7 +606,7 @@ void MembersRow::paintComplexStatusText(
x += skip;
availableWidth -= skip;
const auto &font = st::normalFont;
const auto about = (style == MembersRowStyle::LargeVideo)
const auto about = (style == MembersRowStyle::Video)
? QString()
: ((_state == State::RaisedHand && !_raisedHandStatus)
|| (_state != State::Active && _state != State::RaisedHand))
@ -638,7 +638,7 @@ void MembersRow::paintComplexStatusText(
return;
}
p.setFont(font);
if (style == MembersRowStyle::LargeVideo) {
if (style == MembersRowStyle::Video) {
p.setPen(st::groupCallVideoSubTextFg);
} else if (_state == State::MutedByMe) {
p.setPen(st::groupCallMemberMutedIcon);

View file

@ -24,9 +24,9 @@ class RippleAnimation;
namespace Calls::Group {
enum class MembersRowStyle {
None,
Default,
Narrow,
LargeVideo,
Video,
};
class MembersRow;
@ -39,7 +39,7 @@ public:
bool mutedByMe = false;
bool raisedHand = false;
bool invited = false;
MembersRowStyle style = MembersRowStyle::None;
MembersRowStyle style = MembersRowStyle::Default;
};
virtual bool rowIsMe(not_null<PeerData*> participantPeer) = 0;
virtual bool rowCanMuteMembers() = 0;
@ -152,9 +152,9 @@ public:
void paintMuteIcon(
Painter &p,
QRect iconRect,
MembersRowStyle style = MembersRowStyle::None);
MembersRowStyle style = MembersRowStyle::Default);
[[nodiscard]] MembersRowDelegate::IconState computeIconState(
MembersRowStyle style = MembersRowStyle::None) const;
MembersRowStyle style = MembersRowStyle::Default) const;
void showContextMenu();

View file

@ -1023,11 +1023,6 @@ void Panel::setupMembers() {
}
}, _callLifetime);
_members->enlargeVideo(
) | rpl::start_with_next([=] {
enlargeVideo();
}, _callLifetime);
_call->videoEndpointPinnedValue(
) | rpl::start_with_next([=](const VideoEndpoint &pinned) {
if (pinned && mode() != PanelMode::Wide) {
@ -1134,7 +1129,7 @@ void Panel::setupVideo(not_null<Viewport*> viewport) {
Assert(row != nullptr);
viewport->add(
endpoint,
LargeVideoTrack{ track.track.get(), row },
VideoTileTrack{ track.track.get(), row },
_call->videoEndpointPinnedValue() | rpl::map(_1 == endpoint));
};
for (const auto &[endpoint, track] : _call->activeVideoTracks()) {
@ -1167,8 +1162,8 @@ void Panel::setupVideo(not_null<Viewport*> viewport) {
viewport->clicks(
) | rpl::filter([=] {
return (_mode.current() == PanelMode::Default);
}) | rpl::start_with_next([=] {
enlargeVideo();
}) | rpl::start_with_next([=](VideoEndpoint &&endpoint) {
_call->pinVideoEndpoint(std::move(endpoint));
}, viewport->lifetime());
viewport->qualityRequests(

View file

@ -203,7 +203,7 @@ void Viewport::setControlsShown(float64 shown) {
void Viewport::add(
const VideoEndpoint &endpoint,
LargeVideoTrack track,
VideoTileTrack track,
rpl::producer<bool> pinned) {
_tiles.push_back(std::make_unique<VideoTile>(
endpoint,

View file

@ -9,10 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/rp_widget.h"
namespace style {
struct GroupCallLargeVideo;
} // namespace style
namespace Ui {
class AbstractButton;
class RpWidgetWrap;
@ -39,7 +35,7 @@ class MembersRow;
enum class PanelMode;
enum class VideoQuality;
struct LargeVideoTrack {
struct VideoTileTrack {
Webrtc::VideoTrack *track = nullptr;
MembersRow *row = nullptr;
@ -49,14 +45,14 @@ struct LargeVideoTrack {
};
[[nodiscard]] inline bool operator==(
LargeVideoTrack a,
LargeVideoTrack b) noexcept {
VideoTileTrack a,
VideoTileTrack b) noexcept {
return (a.track == b.track) && (a.row == b.row);
}
[[nodiscard]] inline bool operator!=(
LargeVideoTrack a,
LargeVideoTrack b) noexcept {
VideoTileTrack a,
VideoTileTrack b) noexcept {
return !(a == b);
}
@ -76,7 +72,7 @@ public:
void add(
const VideoEndpoint &endpoint,
LargeVideoTrack track,
VideoTileTrack track,
rpl::producer<bool> pinned);
void remove(const VideoEndpoint &endpoint);
void showLarge(const VideoEndpoint &endpoint);

View file

@ -240,12 +240,12 @@ void FillTexturedRectangle(
Viewport::RendererGL::RendererGL(not_null<Viewport*> owner)
: _owner(owner)
, _pinIcon(st::groupCallLargeVideo.pin)
, _muteIcon(st::groupCallLargeVideoCrossLine)
, _pinIcon(st::groupCallVideoTile.pin)
, _muteIcon(st::groupCallVideoCrossLine)
, _pinBackground(
(st::groupCallLargeVideo.pinPadding.top()
+ st::groupCallLargeVideo.pin.icon.height()
+ st::groupCallLargeVideo.pinPadding.bottom()) / 2,
(st::groupCallVideoTile.pinPadding.top()
+ st::groupCallVideoTile.pin.icon.height()
+ st::groupCallVideoTile.pinPadding.bottom()) / 2,
st::radialBg) {
style::PaletteChanged(
@ -437,12 +437,12 @@ void Viewport::RendererGL::paintTile(
const auto y = geometry.y();
const auto width = geometry.width();
const auto height = geometry.height();
const auto &st = st::groupCallLargeVideo;
const auto &st = st::groupCallVideoTile;
const auto shown = _owner->_controlsShownRatio;
const auto fullNameShift = st.namePosition.y() + st::normalFont->height;
const auto nameShift = anim::interpolate(fullNameShift, 0, shown);
const auto row = tile->row();
const auto style = row->computeIconState(MembersRowStyle::LargeVideo);
const auto style = row->computeIconState(MembersRowStyle::Video);
validateOutlineAnimation(tile, tileData);
const auto outline = tileData.outlined.value(tileData.outline ? 1. : 0.);
@ -487,7 +487,7 @@ void Viewport::RendererGL::paintTile(
const auto pinRect = transformRect(pin.geometry);
// Mute.
const auto &icon = st::groupCallLargeVideoCrossLine.icon;
const auto &icon = st::groupCallVideoCrossLine.icon;
const auto iconLeft = x + width - st.iconPosition.x() - icon.width();
const auto iconTop = y + (height
- st.iconPosition.y()
@ -905,7 +905,7 @@ void Viewport::RendererGL::ensureButtonsImage() {
const auto factor = cIntRetinaFactor();
const auto pinOnSize = VideoTile::PinInnerSize(true);
const auto pinOffSize = VideoTile::PinInnerSize(false);
const auto muteSize = st::groupCallLargeVideoCrossLine.icon.size();
const auto muteSize = st::groupCallVideoCrossLine.icon.size();
const auto fullSize = QSize(
std::max({
@ -961,7 +961,7 @@ void Viewport::RendererGL::ensureButtonsImage() {
void Viewport::RendererGL::validateDatas() {
const auto &tiles = _owner->_tiles;
const auto &st = st::groupCallLargeVideo;
const auto &st = st::groupCallVideoTile;
const auto count = int(tiles.size());
const auto factor = cIntRetinaFactor();
const auto nameHeight = st::semiboldFont->height * factor;
@ -979,7 +979,7 @@ void Viewport::RendererGL::validateDatas() {
const auto row = tiles[i]->row();
const auto hasWidth = tiles[i]->geometry().width()
- st.iconPosition.x()
- st::groupCallLargeVideoCrossLine.icon.width()
- st::groupCallVideoCrossLine.icon.width()
- st.namePosition.x();
return std::clamp(row->name().maxWidth(), 1, hasWidth) * factor;
};

View file

@ -20,11 +20,11 @@ namespace Calls::Group {
Viewport::Renderer::Renderer(not_null<Viewport*> owner)
: _owner(owner)
, _pinIcon(st::groupCallLargeVideo.pin)
, _pinIcon(st::groupCallVideoTile.pin)
, _pinBackground(
(st::groupCallLargeVideo.pinPadding.top()
+ st::groupCallLargeVideo.pin.icon.height()
+ st::groupCallLargeVideo.pinPadding.bottom()) / 2,
(st::groupCallVideoTile.pinPadding.top()
+ st::groupCallVideoTile.pin.icon.height()
+ st::groupCallVideoTile.pinPadding.bottom()) / 2,
st::radialBg) {
}
@ -141,7 +141,7 @@ void Viewport::Renderer::paintTileControls(
return;
}
const auto &st = st::groupCallLargeVideo;
const auto &st = st::groupCallVideoTile;
const auto fullShift = st.namePosition.y() + st::normalFont->height;
const auto shift = anim::interpolate(fullShift, 0, shown);
@ -171,7 +171,7 @@ void Viewport::Renderer::paintTileControls(
row->lazyInitialize(st::groupCallMembersListItem);
// Mute.
const auto &icon = st::groupCallLargeVideoCrossLine.icon;
const auto &icon = st::groupCallVideoCrossLine.icon;
const auto iconLeft = x + width - st.iconPosition.x() - icon.width();
const auto iconTop = y + (height
- st.iconPosition.y()
@ -180,7 +180,7 @@ void Viewport::Renderer::paintTileControls(
row->paintMuteIcon(
p,
{ iconLeft, iconTop, icon.width(), icon.height() },
MembersRowStyle::LargeVideo);
MembersRowStyle::Video);
// Name.
p.setPen(st::groupCallVideoTextFg);

View file

@ -19,7 +19,7 @@ namespace Calls::Group {
Viewport::VideoTile::VideoTile(
const VideoEndpoint &endpoint,
LargeVideoTrack track,
VideoTileTrack track,
rpl::producer<bool> pinned,
Fn<void()> update)
: _endpoint(endpoint)
@ -41,7 +41,7 @@ QRect Viewport::VideoTile::pinOuter() const {
int Viewport::VideoTile::pinSlide() const {
return anim::interpolate(
st::groupCallLargeVideo.pinPosition.y() + _pinInner.height(),
st::groupCallVideoTile.pinPosition.y() + _pinInner.height(),
0,
_pinShownAnimation.value(_pinShown ? 1. : 0.));
}
@ -68,7 +68,10 @@ void Viewport::VideoTile::togglePinShown(bool shown) {
}
bool Viewport::VideoTile::updateRequestedQuality(VideoQuality quality) {
if (_quality && *_quality == quality) {
if (_geometry.isEmpty()) {
_quality = std::nullopt;
return false;
} else if (_quality && *_quality == quality) {
return false;
}
_quality = quality;
@ -76,8 +79,8 @@ bool Viewport::VideoTile::updateRequestedQuality(VideoQuality quality) {
}
QSize Viewport::VideoTile::PinInnerSize(bool pinned) {
const auto &st = st::groupCallLargeVideo;
const auto &icon = st::groupCallLargeVideo.pin.icon;
const auto &st = st::groupCallVideoTile;
const auto &icon = st::groupCallVideoTile.pin.icon;
const auto innerWidth = icon.width()
+ st.pinTextPosition.x()
+ st::semiboldFont->width(pinned
@ -101,7 +104,7 @@ void Viewport::VideoTile::PaintPinButton(
int outerWidth,
not_null<Ui::RoundRect*> background,
not_null<Ui::CrossLineAnimation*> icon) {
const auto &st = st::groupCallLargeVideo;
const auto &st = st::groupCallVideoTile;
const auto rect = QRect(QPoint(x, y), PinInnerSize(pinned));
background->paint(p, rect);
icon->paint(
@ -113,7 +116,7 @@ void Viewport::VideoTile::PaintPinButton(
p.drawTextLeft(
(x
+ st.pinPadding.left()
+ st::groupCallLargeVideo.pin.icon.width()
+ st::groupCallVideoTile.pin.icon.width()
+ st.pinTextPosition.x()),
(y
+ st.pinPadding.top()
@ -126,7 +129,7 @@ void Viewport::VideoTile::PaintPinButton(
}
void Viewport::VideoTile::updatePinnedGeometry() {
const auto &st = st::groupCallLargeVideo;
const auto &st = st::groupCallVideoTile;
const auto buttonSize = PinInnerSize(_pinned);
const auto fullWidth = st.pinPosition.x() * 2 + buttonSize.width();
const auto fullHeight = st.pinPosition.y() * 2 + buttonSize.height();

View file

@ -25,7 +25,7 @@ class Viewport::VideoTile final {
public:
VideoTile(
const VideoEndpoint &endpoint,
LargeVideoTrack track,
VideoTileTrack track,
rpl::producer<bool> pinned,
Fn<void()> update);
@ -80,7 +80,7 @@ private:
const VideoEndpoint _endpoint;
const Fn<void()> _update;
LargeVideoTrack _track;
VideoTileTrack _track;
QRect _geometry;
rpl::variable<QSize> _trackSize;
QRect _pinOuter;