[Visual] Make chat sections header multiline

This commit is contained in:
Eric Kotato 2022-09-11 06:09:08 +03:00 committed by Eric Kotato
parent efd3b91e0f
commit 5281d7ac3e
2 changed files with 30 additions and 26 deletions

View file

@ -114,7 +114,7 @@ ScheduledWidget::ScheduledWidget(
listShowPremiumToast(emoji); listShowPremiumToast(emoji);
}, },
.mode = ComposeControls::Mode::Scheduled, .mode = ComposeControls::Mode::Scheduled,
.sendMenuType = SendMenu::Type::Disabled, .sendMenuType = SendMenu::Type::PreviewOnly,
.regularWindow = controller, .regularWindow = controller,
.stickerOrEmojiChosen = controller->stickerOrEmojiChosen(), .stickerOrEmojiChosen = controller->stickerOrEmojiChosen(),
})) }))
@ -140,6 +140,9 @@ ScheduledWidget::ScheduledWidget(
.section = Dialogs::EntryState::Section::Scheduled, .section = Dialogs::EntryState::Section::Scheduled,
}; };
_topBar->setActiveChat(state, nullptr); _topBar->setActiveChat(state, nullptr);
_topBar->setCustomTitle(_history->peer->isSelf()
? tr::lng_reminder_messages(tr::now)
: tr::lng_scheduled_messages(tr::now));
_composeControls->setCurrentDialogsEntryState(state); _composeControls->setCurrentDialogsEntryState(state);
controller->setCurrentDialogsEntryState(state); controller->setCurrentDialogsEntryState(state);

View file

@ -528,19 +528,12 @@ void TopBarWidget::paintTopBar(Painter &p) {
p.setPen(st::historyStatusFg); p.setPen(st::historyStatusFg);
p.drawTextLeft(nameleft, statustop, width(), _customTitleText); p.drawTextLeft(nameleft, statustop, width(), _customTitleText);
} }
} else if (folder } else if (folder || (peer && peer->sharedMediaInfo())) {
|| (peer && peer->sharedMediaInfo())
|| (_activeChat.section == Section::Scheduled)
|| (_activeChat.section == Section::Pinned)) {
auto text = (_activeChat.section == Section::Scheduled) auto text = (_activeChat.section == Section::Scheduled)
? ((peer && peer->isSelf()) ? tr::lng_reminder_messages(tr::now)
? tr::lng_reminder_messages(tr::now)
: tr::lng_scheduled_messages(tr::now))
: (_activeChat.section == Section::Pinned)
? _customTitleText
: folder : folder
? folder->chatListName() ? folder->chatListName()
: peer->isSelf() : (peer && peer->isSelf())
? tr::lng_saved_messages(tr::now) ? tr::lng_saved_messages(tr::now)
: peer->isRepliesChat() : peer->isRepliesChat()
? tr::lng_replies_messages(tr::now) ? tr::lng_replies_messages(tr::now)
@ -556,25 +549,33 @@ void TopBarWidget::paintTopBar(Painter &p) {
(height() - st::historySavedFont->height) / 2, (height() - st::historySavedFont->height) / 2,
width(), width(),
text); text);
} else if (_activeChat.section == Section::Replies) { } else if (_activeChat.section == Section::Replies
|| _activeChat.section == Section::Scheduled
|| _activeChat.section == Section::Pinned) {
p.setPen(st::dialogsNameFg); p.setPen(st::dialogsNameFg);
p.setFont(st::semiboldFont);
p.drawTextLeft( Ui::Text::String textStr;
nameleft, textStr.setText(
nametop, st::semiboldTextStyle,
width(), (_activeChat.section == Section::Replies
tr::lng_manage_discussion_group(tr::now)); ? tr::lng_manage_discussion_group(tr::now)
: history->peer->isSelf()
? tr::lng_saved_messages(tr::now)
: history->peer->topBarNameText().toString()),
Ui::NameTextOptions());
textStr.drawElided(p, nameleft, nametop, width());
p.setFont(st::dialogsTextFont); p.setFont(st::dialogsTextFont);
if (!paintConnectingState(p, nameleft, statustop, width()) if (!paintConnectingState(p, nameleft, statustop, width())
&& !paintSendAction( && (_activeChat.section != Section::Replies
p, || !paintSendAction(
nameleft, p,
statustop, nameleft,
availableWidth, statustop,
width(), availableWidth,
st::historyStatusFgTyping, width(),
now)) { st::historyStatusFgTyping,
now))) {
paintStatus(p, nameleft, statustop, availableWidth, width()); paintStatus(p, nameleft, statustop, availableWidth, width());
} }
} else if (namePeer) { } else if (namePeer) {