Fix title of wide mode video chat.

This commit is contained in:
John Preston 2021-05-06 20:28:14 +04:00
parent 00ce302b38
commit 9ac510a1ad

View file

@ -1571,6 +1571,16 @@ bool Panel::updateMode() {
return false; return false;
} }
_mode = mode; _mode = mode;
if (_title) {
_title->setTextColorOverride(wide
? std::make_optional(st::groupCallMemberNotJoinedStatus->c)
: std::nullopt);
}
if (wide && _subtitle) {
_subtitle.destroy();
} else if (!wide && !_subtitle) {
refreshTitle();
}
if (_members) { if (_members) {
_members->setMode(mode); _members->setMode(mode);
} }
@ -1775,7 +1785,7 @@ void Panel::refreshTitle() {
_title->setAttribute(Qt::WA_TransparentForMouseEvents); _title->setAttribute(Qt::WA_TransparentForMouseEvents);
} }
refreshTitleGeometry(); refreshTitleGeometry();
if (!_subtitle) { if (!_subtitle && _mode == PanelMode::Default) {
_subtitle.create( _subtitle.create(
widget(), widget(),
rpl::single( rpl::single(
@ -1801,15 +1811,17 @@ void Panel::refreshTitle() {
_subtitle->show(); _subtitle->show();
_subtitle->setAttribute(Qt::WA_TransparentForMouseEvents); _subtitle->setAttribute(Qt::WA_TransparentForMouseEvents);
} }
const auto middle = _title if (_subtitle) {
? (_title->x() + _title->width() / 2) const auto middle = _title
: (widget()->width() / 2); ? (_title->x() + _title->width() / 2)
const auto top = _title : (widget()->width() / 2);
? st::groupCallSubtitleTop const auto top = _title
: st::groupCallTitleTop; ? st::groupCallSubtitleTop
_subtitle->moveToLeft( : st::groupCallTitleTop;
(widget()->width() - _subtitle->width()) / 2, _subtitle->moveToLeft(
top); (widget()->width() - _subtitle->width()) / 2,
top);
}
} }
void Panel::refreshTitleGeometry() { void Panel::refreshTitleGeometry() {
@ -1828,7 +1840,10 @@ 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 = st::groupCallTitleTop; const auto top = (_mode == PanelMode::Default)
? st::groupCallTitleTop
: (st::groupCallWideVideoTop
- st::groupCallTitleLabel.style.font->height) / 2;
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);