mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Allow WebDocument video thumbnails.
This commit is contained in:
@@ -721,9 +721,7 @@ int DocumentData::thumbnailByteSize() const {
|
||||
}
|
||||
|
||||
bool DocumentData::hasVideoThumbnail() const {
|
||||
return _videoThumbnailLocation.valid()
|
||||
&& (_videoThumbnailLocation.width() > 0)
|
||||
&& (_videoThumbnailLocation.height() > 0);
|
||||
return _videoThumbnailLocation.valid();
|
||||
}
|
||||
|
||||
bool DocumentData::videoThumbnailLoading() const {
|
||||
|
@@ -2482,15 +2482,20 @@ void Session::documentConvert(
|
||||
|
||||
DocumentData *Session::documentFromWeb(
|
||||
const MTPWebDocument &data,
|
||||
const ImageLocation &thumbnailLocation) {
|
||||
const ImageLocation &thumbnailLocation,
|
||||
const ImageLocation &videoThumbnailLocation) {
|
||||
return data.match([&](const auto &data) {
|
||||
return documentFromWeb(data, thumbnailLocation);
|
||||
return documentFromWeb(
|
||||
data,
|
||||
thumbnailLocation,
|
||||
videoThumbnailLocation);
|
||||
});
|
||||
}
|
||||
|
||||
DocumentData *Session::documentFromWeb(
|
||||
const MTPDwebDocument &data,
|
||||
const ImageLocation &thumbnailLocation) {
|
||||
const ImageLocation &thumbnailLocation,
|
||||
const ImageLocation &videoThumbnailLocation) {
|
||||
const auto result = document(
|
||||
rand_value<DocumentId>(),
|
||||
uint64(0),
|
||||
@@ -2500,7 +2505,7 @@ DocumentData *Session::documentFromWeb(
|
||||
data.vmime_type().v,
|
||||
QByteArray(),
|
||||
ImageWithLocation{ .location = thumbnailLocation },
|
||||
ImageWithLocation(),
|
||||
ImageWithLocation{ .location = videoThumbnailLocation },
|
||||
MTP::maindc(),
|
||||
int32(0)); // data.vsize().v
|
||||
result->setWebLocation(WebFileLocation(
|
||||
@@ -2511,7 +2516,8 @@ DocumentData *Session::documentFromWeb(
|
||||
|
||||
DocumentData *Session::documentFromWeb(
|
||||
const MTPDwebDocumentNoProxy &data,
|
||||
const ImageLocation &thumbnailLocation) {
|
||||
const ImageLocation &thumbnailLocation,
|
||||
const ImageLocation &videoThumbnailLocation) {
|
||||
const auto result = document(
|
||||
rand_value<DocumentId>(),
|
||||
uint64(0),
|
||||
@@ -2521,7 +2527,7 @@ DocumentData *Session::documentFromWeb(
|
||||
data.vmime_type().v,
|
||||
QByteArray(),
|
||||
ImageWithLocation{ .location = thumbnailLocation },
|
||||
ImageWithLocation(),
|
||||
ImageWithLocation{ .location = videoThumbnailLocation },
|
||||
MTP::maindc(),
|
||||
int32(0)); // data.vsize().v
|
||||
result->setContentUrl(qs(data.vurl()));
|
||||
|
@@ -508,7 +508,8 @@ public:
|
||||
const MTPDocument &data);
|
||||
[[nodiscard]] DocumentData *documentFromWeb(
|
||||
const MTPWebDocument &data,
|
||||
const ImageLocation &thumbnailLocation);
|
||||
const ImageLocation &thumbnailLocation,
|
||||
const ImageLocation &videoThumbnailLocation);
|
||||
|
||||
[[nodiscard]] not_null<WebPageData*> webpage(WebPageId id);
|
||||
not_null<WebPageData*> processWebpage(const MTPWebPage &data);
|
||||
@@ -760,10 +761,12 @@ private:
|
||||
int32 size);
|
||||
DocumentData *documentFromWeb(
|
||||
const MTPDwebDocument &data,
|
||||
const ImageLocation &thumbnailLocation);
|
||||
const ImageLocation &thumbnailLocation,
|
||||
const ImageLocation &videoThumbnailLocation);
|
||||
DocumentData *documentFromWeb(
|
||||
const MTPDwebDocumentNoProxy &data,
|
||||
const ImageLocation &thumbnailLocation);
|
||||
const ImageLocation &thumbnailLocation,
|
||||
const ImageLocation &videoThumbnailLocation);
|
||||
|
||||
void webpageApplyFields(
|
||||
not_null<WebPageData*> page,
|
||||
|
Reference in New Issue
Block a user