2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Use Data::DocumentMedia to store good thumbnails.

This commit is contained in:
John Preston
2020-03-27 15:40:50 +04:00
parent 61647275e8
commit 7db53599e8
29 changed files with 545 additions and 168 deletions

View File

@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/localimageloader.h"
#include "storage/file_download.h"
#include "data/data_document.h"
#include "data/data_document_media.h"
#include "data/data_photo.h"
#include "data/data_session.h"
#include "main/main_session.h"
@@ -193,9 +194,18 @@ void Uploader::upload(
std::move(file->thumb));
document->uploadingData = std::make_unique<Data::UploadState>(
document->size);
document->setGoodThumbnailOnUpload(
std::move(file->goodThumbnail),
std::move(file->goodThumbnailBytes));
if (!file->goodThumbnail.isNull()) {
if (const auto active = document->activeMediaView()) {
active->setGoodThumbnail(std::move(file->goodThumbnail));
}
}
if (!file->goodThumbnailBytes.isEmpty()) {
document->owner().cache().putIfEmpty(
document->goodThumbnailCacheKey(),
Storage::Cache::Database::TaggedValue(
std::move(file->goodThumbnailBytes),
Data::kImageCacheTag));
}
if (!file->content.isEmpty()) {
document->setDataAndCache(file->content);
if (file->type == SendMediaType::ThemeFile) {