From 8cd579d443bbede02e40bae1c6cb8685f91ae9c9 Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Tue, 1 Mar 2022 13:58:45 +0300
Subject: [PATCH] Show no stream channels warning even if we have a frame.

---
 .../calls/group/calls_group_panel.cpp         | 49 ++++++++++++++-----
 .../calls/group/calls_group_panel.h           |  2 +-
 2 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp
index e24348260..f62d2afdb 100644
--- a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp
+++ b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp
@@ -1603,26 +1603,51 @@ void Panel::setupEmptyRtmp() {
 		if (!empty) {
 			_emptyRtmp.destroy();
 			return;
-		} else if (_emptyRtmp || _call->hasVideoWithFrames()) {
+		} else if (_emptyRtmp) {
 			return;
 		}
-		auto text = _call->rtmpInfo().url.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);
+		struct Label {
+			Label(QWidget *parent, rpl::producer<QString> text)
+			: widget(parent, std::move(text), st::groupCallVideoLimitLabel)
+			, color([] {
+				auto result = st::groupCallBg->c;
+				result.setAlphaF(kControlsBackgroundOpacity);
+				return result;
+			})
+			, corners(st::groupCallControlsBackRadius, color.color()) {
+			}
+
+			Ui::FlatLabel widget;
+			style::complex_color color;
+			Ui::RoundRect corners;
+		};
+		_emptyRtmp.create(widget());
+		const auto label = _emptyRtmp->lifetime().make_state<Label>(
+			_emptyRtmp.data(),
+			(_call->rtmpInfo().url.isEmpty()
+				? tr::lng_group_call_no_stream(
+					lt_group,
+					rpl::single(_peer->name))
+				: tr::lng_group_call_no_stream_admin()));
 		_emptyRtmp->setAttribute(Qt::WA_TransparentForMouseEvents);
 		_emptyRtmp->show();
+		_emptyRtmp->paintRequest(
+		) | rpl::start_with_next([=] {
+			auto p = QPainter(_emptyRtmp.data());
+			label->corners.paint(p, _emptyRtmp->rect());
+		}, _emptyRtmp->lifetime());
+
 		widget()->sizeValue(
 		) | rpl::start_with_next([=](QSize size) {
+			const auto padding = st::groupCallWidth / 30;
 			const auto width = std::min(
-				size.width() - st::groupCallWidth / 10,
+				size.width() - padding * 4,
 				st::groupCallWidth);
-			_emptyRtmp->resizeToWidth(width);
+			label->widget.resizeToWidth(width);
+			label->widget.move(padding, padding);
+			_emptyRtmp->resize(
+				width + 2 * padding,
+				label->widget.height() + 2 * padding);
 			_emptyRtmp->move(
 				(size.width() - _emptyRtmp->width()) / 2,
 				(size.height() - _emptyRtmp->height()) / 3);
diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.h b/Telegram/SourceFiles/calls/group/calls_group_panel.h
index cbbd2764c..7b9a30d9a 100644
--- a/Telegram/SourceFiles/calls/group/calls_group_panel.h
+++ b/Telegram/SourceFiles/calls/group/calls_group_panel.h
@@ -226,7 +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 };
+	object_ptr<Ui::RpWidget> _emptyRtmp = { nullptr };
 	ChooseJoinAsProcess _joinAsProcess;
 	std::optional<QRect> _lastSmallGeometry;
 	std::optional<QRect> _lastLargeGeometry;