2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Updated TDesktop sources to 3.5.2+95e806c

This commit is contained in:
RadRussianRus
2022-02-15 04:53:16 +03:00
475 changed files with 13888 additions and 8255 deletions

View File

@@ -52,7 +52,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace {
const auto kAnimatedStickerDimensions = QSize(
const auto kLottieStickerDimensions = QSize(
kStickerSideSize,
kStickerSideSize);
@@ -262,6 +262,22 @@ Data::FileOrigin StickerData::setOrigin() const {
: Data::FileOrigin();
}
bool StickerData::isStatic() const {
return (type == StickerType::Webp);
}
bool StickerData::isLottie() const {
return (type == StickerType::Tgs);
}
bool StickerData::isAnimated() const {
return !isStatic();
}
bool StickerData::isWebm() const {
return (type == StickerType::Webm);
}
VoiceData::~VoiceData() {
if (!waveform.isEmpty()
&& waveform[0] == -1
@@ -305,21 +321,25 @@ void DocumentData::setattributes(
dimensions = QSize(data.vw().v, data.vh().v);
}, [&](const MTPDdocumentAttributeAnimated &data) {
if (type == FileDocument
|| type == StickerDocument
|| type == VideoDocument) {
|| type == VideoDocument
|| (sticker() && sticker()->type != StickerType::Webm)) {
type = AnimatedDocument;
_additional = nullptr;
}
}, [&](const MTPDdocumentAttributeSticker &data) {
if (type == FileDocument) {
const auto was = type;
if (type == FileDocument || type == VideoDocument) {
type = StickerDocument;
_additional = std::make_unique<StickerData>();
}
if (sticker()) {
sticker()->alt = qs(data.valt());
if (!sticker()->set.id
if (const auto info = sticker()) {
if (was == VideoDocument) {
info->type = StickerType::Webm;
}
info->alt = qs(data.valt());
if (!info->set.id
|| data.vstickerset().type() == mtpc_inputStickerSetID) {
sticker()->set = data.vstickerset().match([&](
info->set = data.vstickerset().match([&](
const MTPDinputStickerSetID &data) {
return StickerSetIdentifier{
.id = data.vid().v,
@@ -339,6 +359,8 @@ void DocumentData::setattributes(
type = data.is_round_message()
? RoundVideoDocument
: VideoDocument;
} else if (const auto info = sticker()) {
info->type = StickerType::Webm;
}
_duration = data.vduration().v;
setMaybeSupportsStreaming(data.is_supports_streaming());
@@ -380,12 +402,19 @@ void DocumentData::setattributes(
}
if (type == StickerDocument
&& ((size > Storage::kMaxStickerBytesSize)
|| (!sticker()->animated
|| (!sticker()->isLottie()
&& !GoodStickerDimensions(
dimensions.width(),
dimensions.height())))) {
type = FileDocument;
_additional = nullptr;
} else if (type == FileDocument
&& hasMimeType(qstr("video/webm"))
&& (size < Storage::kMaxStickerBytesSize)
&& GoodStickerDimensions(dimensions.width(), dimensions.height())) {
type = StickerDocument;
_additional = std::make_unique<StickerData>();
sticker()->type = StickerType::Webm;
}
if (isAudioFile() || isAnimation() || isVoiceMessage()) {
setMaybeSupportsStreaming(true);
@@ -397,8 +426,8 @@ void DocumentData::validateLottieSticker() {
&& hasMimeType(qstr("application/x-tgsticker"))) {
type = StickerDocument;
_additional = std::make_unique<StickerData>();
sticker()->animated = true;
dimensions = kAnimatedStickerDimensions;
sticker()->type = StickerType::Tgs;
dimensions = kLottieStickerDimensions;
}
}
@@ -1158,6 +1187,9 @@ bool DocumentData::hasRemoteLocation() const {
}
bool DocumentData::useStreamingLoader() const {
if (const auto info = sticker()) {
return info->isWebm();
}
return isAnimation()
|| isVideoFile()
|| isAudioFile()
@@ -1372,6 +1404,10 @@ TimeId DocumentData::getDuration() const {
return std::max(voice->duration, 0);
} else if (isAnimation() || isVideoFile()) {
return std::max(_duration, 0);
} else if (const auto sticker = this->sticker()) {
if (sticker->isWebm()) {
return std::max(_duration, 0);
}
}
return -1;
}