Improve title text in RTMP full screen.
This commit is contained in:
parent
d36315104e
commit
d5b9effd2e
Binary file not shown.
After Width: | Height: | Size: 389 B |
Binary file not shown.
After Width: | Height: | Size: 638 B |
Binary file not shown.
After Width: | Height: | Size: 892 B |
|
@ -1127,6 +1127,7 @@ groupCallPinOnTop: IconButton(groupCallTitleButton) {
|
||||||
iconOver: icon{{ "calls/navbar_pin", groupCallMembersFg }};
|
iconOver: icon{{ "calls/navbar_pin", groupCallMembersFg }};
|
||||||
iconPosition: point(0px, 2px);
|
iconPosition: point(0px, 2px);
|
||||||
}
|
}
|
||||||
|
groupCallPinnedOnTop: icon{{ "calls/navbar_pin_filled", groupCallMembersFg }};
|
||||||
|
|
||||||
groupCallMajorBlobIdleRadius: 2px;
|
groupCallMajorBlobIdleRadius: 2px;
|
||||||
groupCallMajorBlobMaxRadius: 4px;
|
groupCallMajorBlobMaxRadius: 4px;
|
||||||
|
|
|
@ -123,6 +123,11 @@ Panel::Panel(not_null<GroupCall*> call)
|
||||||
, _stickedTooltipsShown(Core::App().settings().hiddenGroupCallTooltips()
|
, _stickedTooltipsShown(Core::App().settings().hiddenGroupCallTooltips()
|
||||||
& ~StickedTooltip::Microphone) // Always show tooltip about mic.
|
& ~StickedTooltip::Microphone) // Always show tooltip about mic.
|
||||||
, _toasts(std::make_unique<Toasts>(this))
|
, _toasts(std::make_unique<Toasts>(this))
|
||||||
|
, _controlsBackgroundColor([] {
|
||||||
|
auto result = st::groupCallBg->c;
|
||||||
|
result.setAlphaF(kControlsBackgroundOpacity);
|
||||||
|
return result;
|
||||||
|
})
|
||||||
, _hideControlsTimer([=] { toggleWideControls(false); }) {
|
, _hideControlsTimer([=] { toggleWideControls(false); }) {
|
||||||
_layerBg->setStyleOverrides(&st::groupCallBox, &st::groupCallLayerBox);
|
_layerBg->setStyleOverrides(&st::groupCallBox, &st::groupCallLayerBox);
|
||||||
_layerBg->setHideByBackgroundClick(true);
|
_layerBg->setHideByBackgroundClick(true);
|
||||||
|
@ -914,6 +919,12 @@ void Panel::raiseControls() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_mute->raise();
|
_mute->raise();
|
||||||
|
if (_titleBackground) {
|
||||||
|
_titleBackground->raise();
|
||||||
|
}
|
||||||
|
if (_title) {
|
||||||
|
_title->raise();
|
||||||
|
}
|
||||||
if (_recordingMark) {
|
if (_recordingMark) {
|
||||||
_recordingMark->raise();
|
_recordingMark->raise();
|
||||||
}
|
}
|
||||||
|
@ -1137,8 +1148,8 @@ void Panel::createPinOnTop() {
|
||||||
if (const auto handle = window()->windowHandle()) {
|
if (const auto handle = window()->windowHandle()) {
|
||||||
handle->setFlag(Qt::WindowStaysOnTopHint, pin);
|
handle->setFlag(Qt::WindowStaysOnTopHint, pin);
|
||||||
_pinOnTop->setIconOverride(
|
_pinOnTop->setIconOverride(
|
||||||
pin ? &st::groupCallPinOnTop.iconOver : nullptr,
|
pin ? &st::groupCallPinnedOnTop : nullptr,
|
||||||
nullptr);
|
pin ? &st::groupCallPinnedOnTop : nullptr);
|
||||||
if (!_pinOnTop->isHidden()) {
|
if (!_pinOnTop->isHidden()) {
|
||||||
showToast({ pin
|
showToast({ pin
|
||||||
? tr::lng_group_call_pinned_on_top(tr::now)
|
? tr::lng_group_call_pinned_on_top(tr::now)
|
||||||
|
@ -1159,10 +1170,14 @@ void Panel::createPinOnTop() {
|
||||||
_hideControlsTimer.callOnce(kHideControlsTimeout);
|
_hideControlsTimer.callOnce(kHideControlsTimeout);
|
||||||
toggleWideControls(true);
|
toggleWideControls(true);
|
||||||
}, _hideControlsTimerLifetime);
|
}, _hideControlsTimerLifetime);
|
||||||
|
|
||||||
|
_hideControlsTimer.callOnce(kHideControlsTimeout);
|
||||||
} else {
|
} else {
|
||||||
_hideControlsTimerLifetime.destroy();
|
_hideControlsTimerLifetime.destroy();
|
||||||
_hideControlsTimer.cancel();
|
_hideControlsTimer.cancel();
|
||||||
|
refreshTitleGeometry();
|
||||||
}
|
}
|
||||||
|
refreshTitleBackground();
|
||||||
updateMembersGeometry();
|
updateMembersGeometry();
|
||||||
}, _pinOnTop->lifetime());
|
}, _pinOnTop->lifetime());
|
||||||
|
|
||||||
|
@ -1606,18 +1621,15 @@ void Panel::setupEmptyRtmp() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct Label {
|
struct Label {
|
||||||
Label(QWidget *parent, rpl::producer<QString> text)
|
Label(
|
||||||
|
QWidget *parent,
|
||||||
|
rpl::producer<QString> text,
|
||||||
|
const style::color &color)
|
||||||
: widget(parent, std::move(text), st::groupCallVideoLimitLabel)
|
: widget(parent, std::move(text), st::groupCallVideoLimitLabel)
|
||||||
, color([] {
|
, corners(st::groupCallControlsBackRadius, color) {
|
||||||
auto result = st::groupCallBg->c;
|
|
||||||
result.setAlphaF(kControlsBackgroundOpacity);
|
|
||||||
return result;
|
|
||||||
})
|
|
||||||
, corners(st::groupCallControlsBackRadius, color.color()) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ui::FlatLabel widget;
|
Ui::FlatLabel widget;
|
||||||
style::complex_color color;
|
|
||||||
Ui::RoundRect corners;
|
Ui::RoundRect corners;
|
||||||
};
|
};
|
||||||
_emptyRtmp.create(widget());
|
_emptyRtmp.create(widget());
|
||||||
|
@ -1627,7 +1639,8 @@ void Panel::setupEmptyRtmp() {
|
||||||
? tr::lng_group_call_no_stream(
|
? tr::lng_group_call_no_stream(
|
||||||
lt_group,
|
lt_group,
|
||||||
rpl::single(_peer->name))
|
rpl::single(_peer->name))
|
||||||
: tr::lng_group_call_no_stream_admin()));
|
: tr::lng_group_call_no_stream_admin()),
|
||||||
|
_controlsBackgroundColor.color());
|
||||||
_emptyRtmp->setAttribute(Qt::WA_TransparentForMouseEvents);
|
_emptyRtmp->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
_emptyRtmp->show();
|
_emptyRtmp->show();
|
||||||
_emptyRtmp->paintRequest(
|
_emptyRtmp->paintRequest(
|
||||||
|
@ -1677,6 +1690,31 @@ void Panel::refreshControlsBackground() {
|
||||||
updateButtonsGeometry();
|
updateButtonsGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Panel::refreshTitleBackground() {
|
||||||
|
if (!_fullScreenOrMaximized.current()) {
|
||||||
|
_titleBackground.destroy();
|
||||||
|
return;
|
||||||
|
} else if (_titleBackground) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_titleBackground.create(widget());
|
||||||
|
_titleBackground->show();
|
||||||
|
raiseControls();
|
||||||
|
auto &lifetime = _titleBackground->lifetime();
|
||||||
|
const auto corners = lifetime.make_state<Ui::RoundRect>(
|
||||||
|
st::roundRadiusLarge,
|
||||||
|
_controlsBackgroundColor.color());
|
||||||
|
_titleBackground->paintRequest(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
auto p = QPainter(_titleBackground.data());
|
||||||
|
corners->paintSomeRounded(
|
||||||
|
p,
|
||||||
|
_titleBackground->rect(),
|
||||||
|
RectPart::FullBottom);
|
||||||
|
}, lifetime);
|
||||||
|
refreshTitleGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
void Panel::setupControlsBackgroundNarrow() {
|
void Panel::setupControlsBackgroundNarrow() {
|
||||||
_controlsBackgroundNarrow = std::make_unique<ControlsBackgroundNarrow>(
|
_controlsBackgroundNarrow = std::make_unique<ControlsBackgroundNarrow>(
|
||||||
widget());
|
widget());
|
||||||
|
@ -1773,14 +1811,9 @@ void Panel::setupControlsBackgroundWide() {
|
||||||
_controlsBackgroundWide.create(widget());
|
_controlsBackgroundWide.create(widget());
|
||||||
_controlsBackgroundWide->show();
|
_controlsBackgroundWide->show();
|
||||||
auto &lifetime = _controlsBackgroundWide->lifetime();
|
auto &lifetime = _controlsBackgroundWide->lifetime();
|
||||||
const auto color = lifetime.make_state<style::complex_color>([] {
|
|
||||||
auto result = st::groupCallBg->c;
|
|
||||||
result.setAlphaF(kControlsBackgroundOpacity);
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
const auto corners = lifetime.make_state<Ui::RoundRect>(
|
const auto corners = lifetime.make_state<Ui::RoundRect>(
|
||||||
st::groupCallControlsBackRadius,
|
st::groupCallControlsBackRadius,
|
||||||
color->color());
|
_controlsBackgroundColor.color());
|
||||||
_controlsBackgroundWide->paintRequest(
|
_controlsBackgroundWide->paintRequest(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
auto p = QPainter(_controlsBackgroundWide.data());
|
auto p = QPainter(_controlsBackgroundWide.data());
|
||||||
|
@ -2156,6 +2189,9 @@ void Panel::updateButtonsGeometry() {
|
||||||
_controlsBackgroundWide->setGeometry(
|
_controlsBackgroundWide->setGeometry(
|
||||||
rect.marginsAdded(st::groupCallControlsBackMargin));
|
rect.marginsAdded(st::groupCallControlsBackMargin));
|
||||||
}
|
}
|
||||||
|
if (_fullScreenOrMaximized.current()) {
|
||||||
|
refreshTitleGeometry();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const auto muteTop = widget()->height()
|
const auto muteTop = widget()->height()
|
||||||
- st::groupCallMuteBottomSkip;
|
- st::groupCallMuteBottomSkip;
|
||||||
|
@ -2338,10 +2374,17 @@ void Panel::refreshTitleGeometry() {
|
||||||
: fullRect;
|
: fullRect;
|
||||||
const auto best = _title->naturalWidth();
|
const auto best = _title->naturalWidth();
|
||||||
const auto from = (widget()->width() - best) / 2;
|
const auto from = (widget()->width() - best) / 2;
|
||||||
const auto top = (mode() == PanelMode::Default)
|
const auto shownTop = (mode() == PanelMode::Default)
|
||||||
? st::groupCallTitleTop
|
? st::groupCallTitleTop
|
||||||
: (st::groupCallWideVideoTop
|
: (st::groupCallWideVideoTop
|
||||||
- st::groupCallTitleLabel.style.font->height) / 2;
|
- st::groupCallTitleLabel.style.font->height) / 2;
|
||||||
|
const auto top = anim::interpolate(
|
||||||
|
-_title->height() - st::boxRadius,
|
||||||
|
shownTop,
|
||||||
|
(_fullScreenOrMaximized.current()
|
||||||
|
? _wideControlsAnimation.value(
|
||||||
|
_wideControlsShown ? 1. : 0.)
|
||||||
|
: 1.));
|
||||||
const auto left = titleRect.x();
|
const auto left = titleRect.x();
|
||||||
if (from >= left && from + best <= left + titleRect.width()) {
|
if (from >= left && from + best <= left + titleRect.width()) {
|
||||||
_title->resizeToWidth(best);
|
_title->resizeToWidth(best);
|
||||||
|
@ -2362,6 +2405,21 @@ void Panel::refreshTitleGeometry() {
|
||||||
_title->x() + _title->width(),
|
_title->x() + _title->width(),
|
||||||
markTop - st::groupCallRecordingMarkSkip);
|
markTop - st::groupCallRecordingMarkSkip);
|
||||||
}
|
}
|
||||||
|
if (_titleBackground) {
|
||||||
|
const auto bottom = _title->y()
|
||||||
|
+ _title->height()
|
||||||
|
+ (st::boxRadius / 2);
|
||||||
|
const auto height = std::max(bottom, st::boxRadius * 2);
|
||||||
|
_titleBackground->setGeometry(
|
||||||
|
_title->x() - st::boxRadius,
|
||||||
|
bottom - height,
|
||||||
|
(_title->width()
|
||||||
|
+ st::boxRadius
|
||||||
|
+ (_recordingMark
|
||||||
|
? (_recordingMark->width() + st::boxRadius / 2)
|
||||||
|
: st::boxRadius)),
|
||||||
|
height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::paint(QRect clip) {
|
void Panel::paint(QRect clip) {
|
||||||
|
|
|
@ -152,6 +152,7 @@ private:
|
||||||
void updateButtonsStyles();
|
void updateButtonsStyles();
|
||||||
void updateMembersGeometry();
|
void updateMembersGeometry();
|
||||||
void refreshControlsBackground();
|
void refreshControlsBackground();
|
||||||
|
void refreshTitleBackground();
|
||||||
void setupControlsBackgroundWide();
|
void setupControlsBackgroundWide();
|
||||||
void setupControlsBackgroundNarrow();
|
void setupControlsBackgroundNarrow();
|
||||||
void showControls();
|
void showControls();
|
||||||
|
@ -209,6 +210,7 @@ private:
|
||||||
|
|
||||||
rpl::lifetime _callLifetime;
|
rpl::lifetime _callLifetime;
|
||||||
|
|
||||||
|
object_ptr<Ui::RpWidget> _titleBackground = { nullptr };
|
||||||
object_ptr<Ui::FlatLabel> _title = { nullptr };
|
object_ptr<Ui::FlatLabel> _title = { nullptr };
|
||||||
object_ptr<Ui::FlatLabel> _subtitle = { nullptr };
|
object_ptr<Ui::FlatLabel> _subtitle = { nullptr };
|
||||||
object_ptr<Ui::AbstractButton> _recordingMark = { nullptr };
|
object_ptr<Ui::AbstractButton> _recordingMark = { nullptr };
|
||||||
|
@ -255,6 +257,7 @@ private:
|
||||||
|
|
||||||
std::unique_ptr<MicLevelTester> _micLevelTester;
|
std::unique_ptr<MicLevelTester> _micLevelTester;
|
||||||
|
|
||||||
|
style::complex_color _controlsBackgroundColor;
|
||||||
base::Timer _hideControlsTimer;
|
base::Timer _hideControlsTimer;
|
||||||
rpl::lifetime _hideControlsTimerLifetime;
|
rpl::lifetime _hideControlsTimerLifetime;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue