mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added phrases for various types of albums in chats list.
This commit is contained in:
parent
9601207b2c
commit
a02c01cce7
2 changed files with 37 additions and 4 deletions
|
@ -1936,6 +1936,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_in_dlg_sticker" = "Sticker";
|
"lng_in_dlg_sticker" = "Sticker";
|
||||||
"lng_in_dlg_sticker_emoji" = "{emoji} Sticker";
|
"lng_in_dlg_sticker_emoji" = "{emoji} Sticker";
|
||||||
"lng_in_dlg_poll" = "Poll";
|
"lng_in_dlg_poll" = "Poll";
|
||||||
|
"lng_in_dlg_media_count#one" = "{count} media";
|
||||||
|
"lng_in_dlg_media_count#other" = "{count} media";
|
||||||
|
"lng_in_dlg_photo_count#one" = "{count} photo";
|
||||||
|
"lng_in_dlg_photo_count#other" = "{count} photos";
|
||||||
|
"lng_in_dlg_video_count#one" = "{count} video";
|
||||||
|
"lng_in_dlg_video_count#other" = "{count} videos";
|
||||||
|
"lng_in_dlg_file_count#one" = "{count} file";
|
||||||
|
"lng_in_dlg_file_count#other" = "{count} files";
|
||||||
|
"lng_in_dlg_audio_count#one" = "{count} audio";
|
||||||
|
"lng_in_dlg_audio_count#other" = "{count} audio";
|
||||||
|
|
||||||
"lng_ban_user" = "Ban User";
|
"lng_ban_user" = "Ban User";
|
||||||
"lng_delete_all_from_user" = "Delete all from {user}";
|
"lng_delete_all_from_user" = "Delete all from {user}";
|
||||||
|
|
|
@ -462,12 +462,23 @@ std::unique_ptr<HistoryView::Media> Media::createView(
|
||||||
ItemPreview Media::toGroupPreview(
|
ItemPreview Media::toGroupPreview(
|
||||||
const HistoryItemsList &items,
|
const HistoryItemsList &items,
|
||||||
ToPreviewOptions options) const {
|
ToPreviewOptions options) const {
|
||||||
const auto genericText = Ui::Text::PlainLink(
|
|
||||||
tr::lng_in_dlg_album(tr::now));
|
|
||||||
auto result = ItemPreview();
|
auto result = ItemPreview();
|
||||||
auto loadingContext = std::vector<std::any>();
|
auto loadingContext = std::vector<std::any>();
|
||||||
|
auto photoCount = 0;
|
||||||
|
auto videoCount = 0;
|
||||||
|
auto audioCount = 0;
|
||||||
|
auto fileCount = 0;
|
||||||
for (const auto &item : items) {
|
for (const auto &item : items) {
|
||||||
if (const auto media = item->media()) {
|
if (const auto media = item->media()) {
|
||||||
|
if (media->photo()) {
|
||||||
|
photoCount++;
|
||||||
|
} else if (const auto document = media->document()) {
|
||||||
|
(document->isVideoFile()
|
||||||
|
? videoCount
|
||||||
|
: document->isAudioFile()
|
||||||
|
? audioCount
|
||||||
|
: fileCount)++;
|
||||||
|
}
|
||||||
auto copy = options;
|
auto copy = options;
|
||||||
copy.ignoreGroup = true;
|
copy.ignoreGroup = true;
|
||||||
const auto already = int(result.images.size());
|
const auto already = int(result.images.size());
|
||||||
|
@ -490,13 +501,25 @@ ItemPreview Media::toGroupPreview(
|
||||||
if (result.text.text.isEmpty()) {
|
if (result.text.text.isEmpty()) {
|
||||||
result.text = original;
|
result.text = original;
|
||||||
} else {
|
} else {
|
||||||
result.text = genericText;
|
result.text = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result.text.text.isEmpty()) {
|
if (result.text.text.isEmpty()) {
|
||||||
result.text = genericText;
|
const auto mediaCount = photoCount + videoCount;
|
||||||
|
auto genericText = (photoCount && videoCount)
|
||||||
|
? tr::lng_in_dlg_media_count(tr::now, lt_count, mediaCount)
|
||||||
|
: photoCount
|
||||||
|
? tr::lng_in_dlg_photo_count(tr::now, lt_count, photoCount)
|
||||||
|
: videoCount
|
||||||
|
? tr::lng_in_dlg_video_count(tr::now, lt_count, videoCount)
|
||||||
|
: audioCount
|
||||||
|
? tr::lng_in_dlg_audio_count(tr::now, lt_count, audioCount)
|
||||||
|
: fileCount
|
||||||
|
? tr::lng_in_dlg_file_count(tr::now, lt_count, fileCount)
|
||||||
|
: tr::lng_in_dlg_album(tr::now);
|
||||||
|
result.text = Ui::Text::PlainLink(genericText);
|
||||||
}
|
}
|
||||||
if (!loadingContext.empty()) {
|
if (!loadingContext.empty()) {
|
||||||
result.loadingContext = std::move(loadingContext);
|
result.loadingContext = std::move(loadingContext);
|
||||||
|
|
Loading…
Add table
Reference in a new issue