From 87be00a3c1ff0bb9db870a4939b342226f83d1f0 Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Sun, 11 Sep 2022 06:09:08 +0300 Subject: [PATCH] [Visual] Make chat sections header multiline --- .../view/history_view_scheduled_section.cpp | 5 +- .../view/history_view_top_bar_widget.cpp | 51 ++++++++++--------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index 10dc40764..bcd71dca4 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -114,7 +114,7 @@ ScheduledWidget::ScheduledWidget( listShowPremiumToast(emoji); }, .mode = ComposeControls::Mode::Scheduled, - .sendMenuType = SendMenu::Type::Disabled, + .sendMenuType = SendMenu::Type::PreviewOnly, .regularWindow = controller, .stickerOrEmojiChosen = controller->stickerOrEmojiChosen(), })) @@ -140,6 +140,9 @@ ScheduledWidget::ScheduledWidget( .section = Dialogs::EntryState::Section::Scheduled, }; _topBar->setActiveChat(state, nullptr); + _topBar->setCustomTitle(_history->peer->isSelf() + ? tr::lng_reminder_messages(tr::now) + : tr::lng_scheduled_messages(tr::now)); _composeControls->setCurrentDialogsEntryState(state); controller->setCurrentDialogsEntryState(state); diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index 09322fd69..96ae99abf 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -528,19 +528,12 @@ void TopBarWidget::paintTopBar(Painter &p) { p.setPen(st::historyStatusFg); p.drawTextLeft(nameleft, statustop, width(), _customTitleText); } - } else if (folder - || (peer && peer->sharedMediaInfo()) - || (_activeChat.section == Section::Scheduled) - || (_activeChat.section == Section::Pinned)) { + } else if (folder || (peer && peer->sharedMediaInfo())) { auto text = (_activeChat.section == Section::Scheduled) - ? ((peer && peer->isSelf()) - ? tr::lng_reminder_messages(tr::now) - : tr::lng_scheduled_messages(tr::now)) - : (_activeChat.section == Section::Pinned) - ? _customTitleText + ? tr::lng_reminder_messages(tr::now) : folder ? folder->chatListName() - : peer->isSelf() + : (peer && peer->isSelf()) ? tr::lng_saved_messages(tr::now) : peer->isRepliesChat() ? tr::lng_replies_messages(tr::now) @@ -556,25 +549,33 @@ void TopBarWidget::paintTopBar(Painter &p) { (height() - st::historySavedFont->height) / 2, width(), 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.setFont(st::semiboldFont); - p.drawTextLeft( - nameleft, - nametop, - width(), - tr::lng_manage_discussion_group(tr::now)); + + Ui::Text::String textStr; + textStr.setText( + st::semiboldTextStyle, + (_activeChat.section == Section::Replies + ? 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); if (!paintConnectingState(p, nameleft, statustop, width()) - && !paintSendAction( - p, - nameleft, - statustop, - availableWidth, - width(), - st::historyStatusFgTyping, - now)) { + && (_activeChat.section != Section::Replies + || !paintSendAction( + p, + nameleft, + statustop, + availableWidth, + width(), + st::historyStatusFgTyping, + now))) { paintStatus(p, nameleft, statustop, availableWidth, width()); } } else if (namePeer) {