2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Show information about absent RTMP stream.

This commit is contained in:
John Preston
2022-02-28 20:26:37 +03:00
parent 6d46590312
commit 7a602690bb
3 changed files with 39 additions and 2 deletions

View File

@@ -795,6 +795,7 @@ void Panel::setupMembers() {
_members->show();
setupEmptyRtmp();
refreshControlsBackground();
raiseControls();
@@ -1596,6 +1597,38 @@ void Panel::updateButtonsStyles() {
: st::groupCallHangup);
}
void Panel::setupEmptyRtmp() {
_call->emptyRtmpValue(
) | rpl::start_with_next([=](bool empty) {
if (!empty) {
_emptyRtmp.destroy();
return;
} else if (_emptyRtmp) {
return;
}
auto text = _call->rtmpUrl().isEmpty()
? tr::lng_group_call_no_stream(
lt_group,
rpl::single(_peer->name))
: tr::lng_group_call_no_stream_admin();
_emptyRtmp.create(
widget(),
std::move(text),
st::groupCallVideoLimitLabel);
widget()->sizeValue(
) | rpl::start_with_next([=](QSize size) {
const auto width = std::min(
size.width() - st::groupCallWidth / 10,
st::groupCallWidth);
_emptyRtmp->resizeToWidth(width);
_emptyRtmp->move(
(size.width() - _emptyRtmp->width()) / 2,
(size.height() - _emptyRtmp->height()) / 3);
}, _emptyRtmp->lifetime());
}, lifetime());
}
void Panel::refreshControlsBackground() {
if (!_members) {
return;

View File

@@ -161,6 +161,7 @@ private:
std::optional<bool> overrideWideMode = std::nullopt);
void refreshTopButton();
void createPinOnTop();
void setupEmptyRtmp();
void toggleWideControls(bool shown);
void updateWideControlsVisibility();
[[nodiscard]] bool videoButtonInNarrowMode() const;
@@ -225,6 +226,7 @@ private:
object_ptr<Ui::RpWidget> _countdown = { nullptr };
std::shared_ptr<Ui::GroupCallScheduledLeft> _countdownData;
object_ptr<Ui::FlatLabel> _startsWhen = { nullptr };
object_ptr<Ui::FlatLabel> _emptyRtmp = { nullptr };
ChooseJoinAsProcess _joinAsProcess;
std::optional<QRect> _lastSmallGeometry;
std::optional<QRect> _lastLargeGeometry;