Warn admins about many voice chat participants.
This commit is contained in:
parent
b2e829904f
commit
bd78bac4bf
|
@ -2103,6 +2103,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_group_call_noise_suppression" = "Enable Noise Suppression";
|
"lng_group_call_noise_suppression" = "Enable Noise Suppression";
|
||||||
"lng_group_call_limit#one" = "Video is only available\nfor the first {count} member";
|
"lng_group_call_limit#one" = "Video is only available\nfor the first {count} member";
|
||||||
"lng_group_call_limit#other" = "Video is only available\nfor the first {count} members";
|
"lng_group_call_limit#other" = "Video is only available\nfor the first {count} members";
|
||||||
|
"lng_group_call_over_limit#one" = "The voice chat is over {count} member.\nNew participants only have access to audio stream.";
|
||||||
|
"lng_group_call_over_limit#other" = "The voice chat is over {count} members.\nNew participants only have access to audio stream.";
|
||||||
"lng_group_call_video_paused" = "Video is paused";
|
"lng_group_call_video_paused" = "Video is paused";
|
||||||
"lng_group_call_share_speaker" = "Users with this link can speak";
|
"lng_group_call_share_speaker" = "Users with this link can speak";
|
||||||
"lng_group_call_copy_speaker_link" = "Copy Speaker Link";
|
"lng_group_call_copy_speaker_link" = "Copy Speaker Link";
|
||||||
|
|
|
@ -742,6 +742,12 @@ groupCallTitleLabel: FlatLabel(groupCallSubtitleLabel) {
|
||||||
linkFontOver: font(semibold 14px);
|
linkFontOver: font(semibold 14px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
groupCallVideoLimitLabel: FlatLabel(defaultFlatLabel) {
|
||||||
|
align: align(top);
|
||||||
|
textFg: groupCallMemberNotJoinedStatus;
|
||||||
|
style: semiboldTextStyle;
|
||||||
|
minWidth: 96px;
|
||||||
|
}
|
||||||
groupCallAddButtonPosition: point(10px, 7px);
|
groupCallAddButtonPosition: point(10px, 7px);
|
||||||
groupCallMembersWidthMax: 480px;
|
groupCallMembersWidthMax: 480px;
|
||||||
groupCallRecordingMark: 6px;
|
groupCallRecordingMark: 6px;
|
||||||
|
|
|
@ -46,9 +46,16 @@ constexpr auto kUserpicBlurRadius = 8;
|
||||||
|
|
||||||
using Row = MembersRow;
|
using Row = MembersRow;
|
||||||
|
|
||||||
|
[[nodiscard]] int VideoParticipantsLimit(not_null<Main::Session*> session) {
|
||||||
|
return int(session->account().appConfig().get<double>(
|
||||||
|
"groupcall_video_participants_max",
|
||||||
|
30.));
|
||||||
|
}
|
||||||
|
|
||||||
void SetupVideoPlaceholder(
|
void SetupVideoPlaceholder(
|
||||||
not_null<Ui::RpWidget*> widget,
|
not_null<Ui::RpWidget*> widget,
|
||||||
not_null<PeerData*> chat) {
|
not_null<PeerData*> chat,
|
||||||
|
int limit) {
|
||||||
struct State {
|
struct State {
|
||||||
QImage blurred;
|
QImage blurred;
|
||||||
QImage rounded;
|
QImage rounded;
|
||||||
|
@ -128,9 +135,6 @@ void SetupVideoPlaceholder(
|
||||||
size.width());
|
size.width());
|
||||||
|
|
||||||
const auto skip = st::groupCallVideoLargeSkip;
|
const auto skip = st::groupCallVideoLargeSkip;
|
||||||
const auto limit = chat->session().account().appConfig().get<double>(
|
|
||||||
"groupcall_video_participants_max",
|
|
||||||
30.);
|
|
||||||
p.setPen(st::groupCallVideoTextFg);
|
p.setPen(st::groupCallVideoTextFg);
|
||||||
const auto text = QRect(
|
const auto text = QRect(
|
||||||
skip,
|
skip,
|
||||||
|
@ -145,6 +149,22 @@ void SetupVideoPlaceholder(
|
||||||
}, widget->lifetime());
|
}, widget->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetupVideoAboutLimit(
|
||||||
|
not_null<Ui::RpWidget*> widget,
|
||||||
|
not_null<Main::Session*> session,
|
||||||
|
int limit) {
|
||||||
|
const auto label = Ui::CreateChild<Ui::FlatLabel>(
|
||||||
|
widget.get(),
|
||||||
|
tr::lng_group_call_over_limit(lt_count, rpl::single(limit * 1.)),
|
||||||
|
st::groupCallVideoLimitLabel);
|
||||||
|
widget->widthValue(
|
||||||
|
) | rpl::start_with_next([=](int width) {
|
||||||
|
label->resizeToWidth(width);
|
||||||
|
label->moveToLeft(0, st::normalFont->height / 3);
|
||||||
|
widget->resize(width, label->height() + st::normalFont->height);
|
||||||
|
}, label->lifetime());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
class Members::Controller final
|
class Members::Controller final
|
||||||
|
@ -1605,6 +1625,7 @@ Members::Members(
|
||||||
object_ptr<Ui::VerticalLayout>(_scroll.data())))
|
object_ptr<Ui::VerticalLayout>(_scroll.data())))
|
||||||
, _videoWrap(_layout->add(object_ptr<Ui::RpWidget>(_layout.get())))
|
, _videoWrap(_layout->add(object_ptr<Ui::RpWidget>(_layout.get())))
|
||||||
, _videoPlaceholder(std::make_unique<Ui::RpWidget>(_videoWrap.get()))
|
, _videoPlaceholder(std::make_unique<Ui::RpWidget>(_videoWrap.get()))
|
||||||
|
, _videoAboutLimit(std::make_unique<Ui::RpWidget>(_videoWrap.get()))
|
||||||
, _viewport(
|
, _viewport(
|
||||||
std::make_unique<Viewport>(
|
std::make_unique<Viewport>(
|
||||||
_videoWrap.get(),
|
_videoWrap.get(),
|
||||||
|
@ -1842,6 +1863,7 @@ void Members::trackViewportGeometry() {
|
||||||
_scroll->scrollTopValue(
|
_scroll->scrollTopValue(
|
||||||
) | rpl::skip(1) | rpl::start_with_next(move, _viewport->lifetime());
|
) | rpl::skip(1) | rpl::start_with_next(move, _viewport->lifetime());
|
||||||
|
|
||||||
|
const auto videoLimit = VideoParticipantsLimit(&_call->peer()->session());
|
||||||
rpl::combine(
|
rpl::combine(
|
||||||
_layout->widthValue(),
|
_layout->widthValue(),
|
||||||
_call->hasNotShownVideoValue()
|
_call->hasNotShownVideoValue()
|
||||||
|
@ -1850,15 +1872,53 @@ void Members::trackViewportGeometry() {
|
||||||
_videoPlaceholder->setGeometry(0, 0, width, height);
|
_videoPlaceholder->setGeometry(0, 0, width, height);
|
||||||
}, _videoPlaceholder->lifetime());
|
}, _videoPlaceholder->lifetime());
|
||||||
|
|
||||||
SetupVideoPlaceholder(_videoPlaceholder.get(), _call->peer());
|
SetupVideoPlaceholder(_videoPlaceholder.get(), _call->peer(), videoLimit);
|
||||||
|
|
||||||
|
_layout->widthValue(
|
||||||
|
) | rpl::start_with_next([=](int width) {
|
||||||
|
_videoAboutLimit->resizeToWidth(width);
|
||||||
|
}, _videoAboutLimit->lifetime());
|
||||||
|
|
||||||
|
using namespace rpl::mappers;
|
||||||
|
auto aboutLimitRelevant = fullCountValue(
|
||||||
|
) | rpl::map(
|
||||||
|
_1 > videoLimit
|
||||||
|
) | rpl::distinct_until_changed();
|
||||||
|
auto aboutLimitShown = rpl::combine(
|
||||||
|
std::move(aboutLimitRelevant),
|
||||||
|
_call->canManageValue(),
|
||||||
|
_1 && _2);
|
||||||
|
|
||||||
|
SetupVideoAboutLimit(
|
||||||
|
_videoAboutLimit.get(),
|
||||||
|
&_call->peer()->session(),
|
||||||
|
videoLimit);
|
||||||
|
|
||||||
rpl::combine(
|
rpl::combine(
|
||||||
_videoPlaceholder->heightValue(),
|
_videoPlaceholder->heightValue(),
|
||||||
_viewport->fullHeightValue()
|
_viewport->fullHeightValue(),
|
||||||
) | rpl::start_with_next([=](int placeholder, int viewport) {
|
_videoAboutLimit->heightValue(),
|
||||||
|
std::move(aboutLimitShown)
|
||||||
|
) | rpl::start_with_next([=](
|
||||||
|
int placeholder,
|
||||||
|
int viewport,
|
||||||
|
int aboutLimit,
|
||||||
|
bool aboutLimitShown) {
|
||||||
|
if (placeholder > 0 || viewport <= 0 || !aboutLimitShown) {
|
||||||
|
aboutLimitShown = false;
|
||||||
|
aboutLimit = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This call may update _videoAboutLimit->height() :(
|
||||||
|
_videoAboutLimit->setVisible(aboutLimitShown);
|
||||||
|
|
||||||
|
_videoAboutLimit->move(0, viewport);
|
||||||
_videoWrap->resize(
|
_videoWrap->resize(
|
||||||
_videoWrap->width(),
|
_videoWrap->width(),
|
||||||
std::max(placeholder, viewport));
|
std::max(
|
||||||
|
placeholder,
|
||||||
|
(viewport
|
||||||
|
+ (aboutLimitShown ? _videoAboutLimit->height() : 0))));
|
||||||
if (viewport > 0) {
|
if (viewport > 0) {
|
||||||
move();
|
move();
|
||||||
resize();
|
resize();
|
||||||
|
|
|
@ -102,6 +102,7 @@ private:
|
||||||
not_null<Ui::VerticalLayout*> _layout;
|
not_null<Ui::VerticalLayout*> _layout;
|
||||||
const not_null<Ui::RpWidget*> _videoWrap;
|
const not_null<Ui::RpWidget*> _videoWrap;
|
||||||
const std::unique_ptr<Ui::RpWidget> _videoPlaceholder;
|
const std::unique_ptr<Ui::RpWidget> _videoPlaceholder;
|
||||||
|
const std::unique_ptr<Ui::RpWidget> _videoAboutLimit;
|
||||||
std::unique_ptr<Viewport> _viewport;
|
std::unique_ptr<Viewport> _viewport;
|
||||||
rpl::variable<Ui::RpWidget*> _addMemberButton = nullptr;
|
rpl::variable<Ui::RpWidget*> _addMemberButton = nullptr;
|
||||||
RpWidget *_topSkip = nullptr;
|
RpWidget *_topSkip = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue