mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-01 07:05:13 +00:00
Updated TDesktop sources to 3.0.1
This commit is contained in:
@@ -45,7 +45,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "mainwindow.h"
|
||||
#include "core/application.h"
|
||||
#include "lottie/lottie_animation.h"
|
||||
#include "app.h"
|
||||
|
||||
#include <QtCore/QBuffer>
|
||||
#include <QtCore/QMimeType>
|
||||
@@ -412,7 +411,7 @@ void DocumentData::setattributes(
|
||||
|
||||
void DocumentData::validateLottieSticker() {
|
||||
if (type == FileDocument
|
||||
&& _mimeString == qstr("application/x-tgsticker")) {
|
||||
&& hasMimeType(qstr("application/x-tgsticker"))) {
|
||||
type = StickerDocument;
|
||||
_additional = std::make_unique<StickerData>();
|
||||
sticker()->animated = true;
|
||||
@@ -443,9 +442,8 @@ bool DocumentData::checkWallPaperProperties() {
|
||||
|| !dimensions.height()
|
||||
|| dimensions.width() > Storage::kMaxWallPaperDimension
|
||||
|| dimensions.height() > Storage::kMaxWallPaperDimension
|
||||
|| size > Storage::kMaxWallPaperInMemory
|
||||
|| mimeString() == qstr("application/x-tgwallpattern")) {
|
||||
return false; // #TODO themes support svg patterns
|
||||
|| size > Storage::kMaxWallPaperInMemory) {
|
||||
return false;
|
||||
}
|
||||
type = WallPaperDocument;
|
||||
return true;
|
||||
@@ -488,9 +486,18 @@ bool DocumentData::isWallPaper() const {
|
||||
}
|
||||
|
||||
bool DocumentData::isPatternWallPaper() const {
|
||||
return isWallPaper()
|
||||
&& (isPatternWallPaperPNG() || isPatternWallPaperSVG());
|
||||
}
|
||||
|
||||
bool DocumentData::isPatternWallPaperPNG() const {
|
||||
return isWallPaper() && hasMimeType(qstr("image/png"));
|
||||
}
|
||||
|
||||
bool DocumentData::isPatternWallPaperSVG() const {
|
||||
return isWallPaper() && hasMimeType(qstr("application/x-tgwallpattern"));
|
||||
}
|
||||
|
||||
bool DocumentData::hasThumbnail() const {
|
||||
return _thumbnail.location.valid();
|
||||
}
|
||||
@@ -662,9 +669,9 @@ bool DocumentData::saveToCache() const {
|
||||
&& ((type == StickerDocument)
|
||||
|| isAnimation()
|
||||
|| isVoiceMessage()
|
||||
|| (type == WallPaperDocument)
|
||||
|| isWallPaper()
|
||||
|| isTheme()
|
||||
|| (mimeString() == qstr("image/png")
|
||||
|| (hasMimeType(qstr("image/png"))
|
||||
&& _filename.startsWith("image_")));
|
||||
}
|
||||
|
||||
@@ -1238,11 +1245,12 @@ QString DocumentData::mimeString() const {
|
||||
}
|
||||
|
||||
bool DocumentData::hasMimeType(QLatin1String mime) const {
|
||||
return !_mimeString.compare(mime, Qt::CaseInsensitive);
|
||||
return (_mimeString == mime);
|
||||
}
|
||||
|
||||
void DocumentData::setMimeString(const QString &mime) {
|
||||
_mimeString = mime;
|
||||
_mimeString = std::move(_mimeString).toLower();
|
||||
}
|
||||
|
||||
MediaKey DocumentData::mediaKey() const {
|
||||
@@ -1268,7 +1276,7 @@ uint8 DocumentData::cacheTag() const {
|
||||
return Data::kVideoMessageCacheTag;
|
||||
} else if (isAnimation()) {
|
||||
return Data::kAnimationCacheTag;
|
||||
} else if (type == WallPaperDocument) {
|
||||
} else if (isWallPaper()) {
|
||||
return Data::kImageCacheTag;
|
||||
}
|
||||
return 0;
|
||||
@@ -1303,14 +1311,9 @@ bool DocumentData::isGifv() const {
|
||||
}
|
||||
|
||||
bool DocumentData::isTheme() const {
|
||||
return
|
||||
_mimeString == qstr("application/x-tgtheme-tdesktop")
|
||||
|| _filename.endsWith(
|
||||
qstr(".tdesktop-theme"),
|
||||
Qt::CaseInsensitive)
|
||||
|| _filename.endsWith(
|
||||
qstr(".tdesktop-palette"),
|
||||
Qt::CaseInsensitive);
|
||||
return hasMimeType(qstr("application/x-tgtheme-tdesktop"))
|
||||
|| _filename.endsWith(qstr(".tdesktop-theme"), Qt::CaseInsensitive)
|
||||
|| _filename.endsWith(qstr(".tdesktop-palette"), Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
bool DocumentData::isSong() const {
|
||||
|
Reference in New Issue
Block a user