2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 09:05:14 +00:00

Preview lottie animations in media viewer.

This commit is contained in:
John Preston
2019-04-29 17:08:09 +04:00
parent 22c2054dcf
commit f073963582
3 changed files with 86 additions and 16 deletions

View File

@@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/image/image_source.h"
#include "mainwindow.h"
#include "core/application.h"
#include "lottie/lottie_animation.h"
#include "media/streaming/media_streaming_loader_mtproto.h"
#include "media/streaming/media_streaming_loader_local.h"
@@ -302,7 +303,11 @@ void DocumentOpenClickHandler::Open(
const auto guard = gsl::finally([&] {
location.accessDisable();
});
if (QImageReader(location.name()).canRead()) {
const auto path = location.name();
if (QImageReader(path).canRead()) {
Core::App().showDocument(data, context);
return;
} else if (Lottie::ValidateFile(path)) {
Core::App().showDocument(data, context);
return;
}