2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 23:55:12 +00:00

Allow photos not have some of the thumbnails.

This commit is contained in:
John Preston
2020-05-26 14:13:32 +04:00
parent e27d2bc2d5
commit 7ad660a0e7
18 changed files with 233 additions and 363 deletions

View File

@@ -298,7 +298,9 @@ Photo::Photo(
: ItemBase(delegate, parent)
, _data(photo)
, _link(std::make_shared<PhotoOpenClickHandler>(photo, parent->fullId())) {
if (_data->inlineThumbnailBytes().isEmpty()) {
if (_data->inlineThumbnailBytes().isEmpty()
&& (_data->hasExact(Data::PhotoSize::Small)
|| _data->hasExact(Data::PhotoSize::Thumbnail))) {
_data->load(Data::PhotoSize::Small, parent->fullId());
}
}
@@ -1476,9 +1478,14 @@ Link::Link(
}
int32 tw = 0, th = 0;
if (_page && _page->photo) {
_page->photo->load(Data::PhotoSize::Small, parent->fullId());
tw = style::ConvertScale(_page->photo->width());
th = style::ConvertScale(_page->photo->height());
const auto photo = _page->photo;
if (photo->inlineThumbnailBytes().isEmpty()
&& (photo->hasExact(Data::PhotoSize::Small)
|| photo->hasExact(Data::PhotoSize::Thumbnail))) {
photo->load(Data::PhotoSize::Small, parent->fullId());
}
tw = style::ConvertScale(photo->width());
th = style::ConvertScale(photo->height());
} else if (_page && _page->document && _page->document->hasThumbnail()) {
_page->document->loadThumbnail(parent->fullId());
const auto &location = _page->document->thumbnailLocation();