mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 05:07:10 +02:00
Improved title for separated windows with shared media.
This commit is contained in:
parent
f89bac7781
commit
97c4e79e96
1 changed files with 48 additions and 1 deletions
|
@ -87,7 +87,47 @@ base::options::toggle OptionDisableTouchbar({
|
|||
.restartRequired = true,
|
||||
});
|
||||
|
||||
} // namespace.
|
||||
[[nodiscard]] QString TitleFromSeparateId(
|
||||
const Core::WindowTitleContent &settings,
|
||||
const SeparateId &id) {
|
||||
if (id.sharedMedia == SeparateSharedMediaType::None
|
||||
|| !id.sharedMediaPeer()) {
|
||||
return QString();
|
||||
}
|
||||
const auto result = (id.sharedMedia == SeparateSharedMediaType::Photos)
|
||||
? tr::lng_media_type_photos(tr::now)
|
||||
: (id.sharedMedia == SeparateSharedMediaType::Videos)
|
||||
? tr::lng_media_type_videos(tr::now)
|
||||
: (id.sharedMedia == SeparateSharedMediaType::Files)
|
||||
? tr::lng_media_type_files(tr::now)
|
||||
: (id.sharedMedia == SeparateSharedMediaType::Audio)
|
||||
? tr::lng_media_type_songs(tr::now)
|
||||
: (id.sharedMedia == SeparateSharedMediaType::Links)
|
||||
? tr::lng_media_type_links(tr::now)
|
||||
: (id.sharedMedia == SeparateSharedMediaType::GIF)
|
||||
? tr::lng_media_type_gifs(tr::now)
|
||||
: (id.sharedMedia == SeparateSharedMediaType::Voices)
|
||||
? tr::lng_media_type_audios(tr::now)
|
||||
: QString();
|
||||
|
||||
if (settings.hideChatName) {
|
||||
return result;
|
||||
}
|
||||
const auto peer = id.sharedMediaPeer();
|
||||
const auto topicRootId = id.sharedMediaTopicRootId();
|
||||
const auto topic = topicRootId
|
||||
? peer->forumTopicFor(topicRootId)
|
||||
: nullptr;
|
||||
const auto name = topic
|
||||
? topic->title()
|
||||
: peer->isSelf()
|
||||
? tr::lng_saved_messages(tr::now)
|
||||
: peer->name();
|
||||
const auto wrapped = st::wrap_rtl(name);
|
||||
return name + u" @ "_q + result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const char kOptionNewWindowsSizeAsFirst[] = "new-windows-size-as-first";
|
||||
const char kOptionDisableTouchbar[] = "touchbar-disabled";
|
||||
|
@ -862,6 +902,13 @@ void MainWindow::updateTitle() {
|
|||
&& Core::App().domain().accountsAuthedCount() > 1)
|
||||
? st::wrap_rtl(session->authedName())
|
||||
: QString();
|
||||
const auto separateIdTitle = session
|
||||
? TitleFromSeparateId(settings, session->windowId())
|
||||
: QString();
|
||||
if (!separateIdTitle.isEmpty()) {
|
||||
setTitle(separateIdTitle);
|
||||
return;
|
||||
}
|
||||
const auto key = (session && !settings.hideChatName)
|
||||
? session->activeChatCurrent()
|
||||
: Dialogs::Key();
|
||||
|
|
Loading…
Add table
Reference in a new issue