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,6 +1811,7 @@ void Panel::refreshTitle() {
_subtitle->show(); _subtitle->show();
_subtitle->setAttribute(Qt::WA_TransparentForMouseEvents); _subtitle->setAttribute(Qt::WA_TransparentForMouseEvents);
} }
if (_subtitle) {
const auto middle = _title const auto middle = _title
? (_title->x() + _title->width() / 2) ? (_title->x() + _title->width() / 2)
: (widget()->width() / 2); : (widget()->width() / 2);
@ -1811,6 +1822,7 @@ void Panel::refreshTitle() {
(widget()->width() - _subtitle->width()) / 2, (widget()->width() - _subtitle->width()) / 2,
top); top);
} }
}
void Panel::refreshTitleGeometry() { void Panel::refreshTitleGeometry() {
if (!_title) { if (!_title) {
@ -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);