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) {
 | 
			
		||||
	Expects(_videoSizes != nullptr);
 | 
			
		||||
 | 
			
		||||
	return (size == PhotoSize::Small)
 | 
			
		||||
	return (size == PhotoSize::Small && hasVideoSmall())
 | 
			
		||||
		? _videoSizes->small
 | 
			
		||||
		: _videoSizes->large;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -451,7 +451,7 @@ Data::CloudFile &PhotoData::videoFile(PhotoSize size) {
 | 
			
		|||
const Data::CloudFile &PhotoData::videoFile(PhotoSize size) const {
 | 
			
		||||
	Expects(_videoSizes != nullptr);
 | 
			
		||||
 | 
			
		||||
	return (size == PhotoSize::Small)
 | 
			
		||||
	return (size == PhotoSize::Small && hasVideoSmall())
 | 
			
		||||
		? _videoSizes->small
 | 
			
		||||
		: _videoSizes->large;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -461,6 +461,10 @@ bool PhotoData::hasVideo() const {
 | 
			
		|||
	return _videoSizes != nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool PhotoData::hasVideoSmall() const {
 | 
			
		||||
	return hasVideo() && _videoSizes->small.location.valid();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool PhotoData::videoLoading(Data::PhotoSize size) const {
 | 
			
		||||
	return _videoSizes && videoFile(size).loader != nullptr;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -127,6 +127,7 @@ public:
 | 
			
		|||
	[[nodiscard]] int imageByteSize(Data::PhotoSize size) const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] bool hasVideo() const;
 | 
			
		||||
	[[nodiscard]] bool hasVideoSmall() const;
 | 
			
		||||
	[[nodiscard]] bool videoLoading(Data::PhotoSize size) const;
 | 
			
		||||
	[[nodiscard]] bool videoFailed(Data::PhotoSize size) const;
 | 
			
		||||
	void loadVideo(Data::PhotoSize size, Data::FileOrigin origin);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -118,7 +118,8 @@ void PhotoMedia::set(
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
| 
						 | 
				
			
			@ -133,8 +134,8 @@ void PhotoMedia::videoWanted(PhotoSize size, Data::FileOrigin origin) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void PhotoMedia::setVideo(PhotoSize size, QByteArray content) {
 | 
			
		||||
	((size == PhotoSize::Large) ? _videoBytesLarge : _videoBytesSmall)
 | 
			
		||||
		= std::move(content);
 | 
			
		||||
	const auto small = (size == PhotoSize::Small) && _owner->hasVideoSmall();
 | 
			
		||||
	(small ? _videoBytesSmall : _videoBytesLarge) = std::move(content);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool PhotoMedia::loaded() const {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue