mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Show no stream channels warning even if we have a frame.
This commit is contained in:
parent
6e9e289dd7
commit
8cd579d443
2 changed files with 38 additions and 13 deletions
|
@ -1603,26 +1603,51 @@ void Panel::setupEmptyRtmp() {
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
_emptyRtmp.destroy();
|
_emptyRtmp.destroy();
|
||||||
return;
|
return;
|
||||||
} else if (_emptyRtmp || _call->hasVideoWithFrames()) {
|
} else if (_emptyRtmp) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto text = _call->rtmpInfo().url.isEmpty()
|
struct Label {
|
||||||
? tr::lng_group_call_no_stream(
|
Label(QWidget *parent, rpl::producer<QString> text)
|
||||||
lt_group,
|
: widget(parent, std::move(text), st::groupCallVideoLimitLabel)
|
||||||
rpl::single(_peer->name))
|
, color([] {
|
||||||
: tr::lng_group_call_no_stream_admin();
|
auto result = st::groupCallBg->c;
|
||||||
_emptyRtmp.create(
|
result.setAlphaF(kControlsBackgroundOpacity);
|
||||||
widget(),
|
return result;
|
||||||
std::move(text),
|
})
|
||||||
st::groupCallVideoLimitLabel);
|
, 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->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
_emptyRtmp->show();
|
_emptyRtmp->show();
|
||||||
|
_emptyRtmp->paintRequest(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
auto p = QPainter(_emptyRtmp.data());
|
||||||
|
label->corners.paint(p, _emptyRtmp->rect());
|
||||||
|
}, _emptyRtmp->lifetime());
|
||||||
|
|
||||||
widget()->sizeValue(
|
widget()->sizeValue(
|
||||||
) | rpl::start_with_next([=](QSize size) {
|
) | rpl::start_with_next([=](QSize size) {
|
||||||
|
const auto padding = st::groupCallWidth / 30;
|
||||||
const auto width = std::min(
|
const auto width = std::min(
|
||||||
size.width() - st::groupCallWidth / 10,
|
size.width() - padding * 4,
|
||||||
st::groupCallWidth);
|
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(
|
_emptyRtmp->move(
|
||||||
(size.width() - _emptyRtmp->width()) / 2,
|
(size.width() - _emptyRtmp->width()) / 2,
|
||||||
(size.height() - _emptyRtmp->height()) / 3);
|
(size.height() - _emptyRtmp->height()) / 3);
|
||||||
|
|
|
@ -226,7 +226,7 @@ private:
|
||||||
object_ptr<Ui::RpWidget> _countdown = { nullptr };
|
object_ptr<Ui::RpWidget> _countdown = { nullptr };
|
||||||
std::shared_ptr<Ui::GroupCallScheduledLeft> _countdownData;
|
std::shared_ptr<Ui::GroupCallScheduledLeft> _countdownData;
|
||||||
object_ptr<Ui::FlatLabel> _startsWhen = { nullptr };
|
object_ptr<Ui::FlatLabel> _startsWhen = { nullptr };
|
||||||
object_ptr<Ui::FlatLabel> _emptyRtmp = { nullptr };
|
object_ptr<Ui::RpWidget> _emptyRtmp = { nullptr };
|
||||||
ChooseJoinAsProcess _joinAsProcess;
|
ChooseJoinAsProcess _joinAsProcess;
|
||||||
std::optional<QRect> _lastSmallGeometry;
|
std::optional<QRect> _lastSmallGeometry;
|
||||||
std::optional<QRect> _lastLargeGeometry;
|
std::optional<QRect> _lastLargeGeometry;
|
||||||
|
|
Loading…
Add table
Reference in a new issue