format_song_document_name.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #include "ui/text/format_song_document_name.h"
  8. #include "ui/text/text_utilities.h"
  9. #include "data/data_document.h"
  10. #include "lang/lang_keys.h"
  11. namespace Ui::Text {
  12. FormatSongName FormatSongNameFor(not_null<DocumentData*> document) {
  13. const auto song = document->song();
  14. return FormatSongName(
  15. document->filename(),
  16. song ? song->title : QString(),
  17. song ? song->performer : QString());
  18. }
  19. TextWithEntities FormatDownloadsName(not_null<DocumentData*> document) {
  20. return document->isVideoFile()
  21. ? Bold(tr::lng_in_dlg_video(tr::now))
  22. : document->isVoiceMessage()
  23. ? Bold(tr::lng_in_dlg_audio(tr::now))
  24. : document->isVideoMessage()
  25. ? Bold(tr::lng_in_dlg_video_message(tr::now))
  26. : document->sticker()
  27. ? Bold(document->sticker()->alt.isEmpty()
  28. ? tr::lng_in_dlg_sticker(tr::now)
  29. : tr::lng_in_dlg_sticker_emoji(
  30. tr::now,
  31. lt_emoji,
  32. document->sticker()->alt))
  33. : FormatSongNameFor(document).textWithEntities();
  34. }
  35. } // namespace Ui::Text