mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fallback to large profile video in chat / chats list.
This commit is contained in:
parent
a8ffb21bfa
commit
855d4692fe
3 changed files with 11 additions and 5 deletions
|
@ -443,7 +443,7 @@ int PhotoData::height() const {
|
||||||
Data::CloudFile &PhotoData::videoFile(PhotoSize size) {
|
Data::CloudFile &PhotoData::videoFile(PhotoSize size) {
|
||||||
Expects(_videoSizes != nullptr);
|
Expects(_videoSizes != nullptr);
|
||||||
|
|
||||||
return (size == PhotoSize::Small)
|
return (size == PhotoSize::Small && hasVideoSmall())
|
||||||
? _videoSizes->small
|
? _videoSizes->small
|
||||||
: _videoSizes->large;
|
: _videoSizes->large;
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ Data::CloudFile &PhotoData::videoFile(PhotoSize size) {
|
||||||
const Data::CloudFile &PhotoData::videoFile(PhotoSize size) const {
|
const Data::CloudFile &PhotoData::videoFile(PhotoSize size) const {
|
||||||
Expects(_videoSizes != nullptr);
|
Expects(_videoSizes != nullptr);
|
||||||
|
|
||||||
return (size == PhotoSize::Small)
|
return (size == PhotoSize::Small && hasVideoSmall())
|
||||||
? _videoSizes->small
|
? _videoSizes->small
|
||||||
: _videoSizes->large;
|
: _videoSizes->large;
|
||||||
}
|
}
|
||||||
|
@ -461,6 +461,10 @@ bool PhotoData::hasVideo() const {
|
||||||
return _videoSizes != nullptr;
|
return _videoSizes != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PhotoData::hasVideoSmall() const {
|
||||||
|
return hasVideo() && _videoSizes->small.location.valid();
|
||||||
|
}
|
||||||
|
|
||||||
bool PhotoData::videoLoading(Data::PhotoSize size) const {
|
bool PhotoData::videoLoading(Data::PhotoSize size) const {
|
||||||
return _videoSizes && videoFile(size).loader != nullptr;
|
return _videoSizes && videoFile(size).loader != nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,7 @@ public:
|
||||||
[[nodiscard]] int imageByteSize(Data::PhotoSize size) const;
|
[[nodiscard]] int imageByteSize(Data::PhotoSize size) const;
|
||||||
|
|
||||||
[[nodiscard]] bool hasVideo() const;
|
[[nodiscard]] bool hasVideo() const;
|
||||||
|
[[nodiscard]] bool hasVideoSmall() const;
|
||||||
[[nodiscard]] bool videoLoading(Data::PhotoSize size) const;
|
[[nodiscard]] bool videoLoading(Data::PhotoSize size) const;
|
||||||
[[nodiscard]] bool videoFailed(Data::PhotoSize size) const;
|
[[nodiscard]] bool videoFailed(Data::PhotoSize size) const;
|
||||||
void loadVideo(Data::PhotoSize size, Data::FileOrigin origin);
|
void loadVideo(Data::PhotoSize size, Data::FileOrigin origin);
|
||||||
|
|
|
@ -118,7 +118,8 @@ void PhotoMedia::set(
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray PhotoMedia::videoContent(PhotoSize size) const {
|
QByteArray PhotoMedia::videoContent(PhotoSize size) const {
|
||||||
return (size == PhotoSize::Large) ? _videoBytesLarge : _videoBytesSmall;
|
const auto small = (size == PhotoSize::Small) && _owner->hasVideoSmall();
|
||||||
|
return small ? _videoBytesSmall : _videoBytesLarge;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize PhotoMedia::videoSize(PhotoSize size) const {
|
QSize PhotoMedia::videoSize(PhotoSize size) const {
|
||||||
|
@ -133,8 +134,8 @@ void PhotoMedia::videoWanted(PhotoSize size, Data::FileOrigin origin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoMedia::setVideo(PhotoSize size, QByteArray content) {
|
void PhotoMedia::setVideo(PhotoSize size, QByteArray content) {
|
||||||
((size == PhotoSize::Large) ? _videoBytesLarge : _videoBytesSmall)
|
const auto small = (size == PhotoSize::Small) && _owner->hasVideoSmall();
|
||||||
= std::move(content);
|
(small ? _videoBytesSmall : _videoBytesLarge) = std::move(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PhotoMedia::loaded() const {
|
bool PhotoMedia::loaded() const {
|
||||||
|
|
Loading…
Add table
Reference in a new issue