File indexing completed on 2025-01-05 04:01:16

0001 /*
0002  * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include "lottie_format.hpp"
0010 #include "model/visitor.hpp"
0011 
0012 namespace glaxnimate::io::lottie {
0013 
0014 class ValidationVisitor : public model::Visitor
0015 {
0016 public:
0017     explicit ValidationVisitor(LottieFormat* fmt) : fmt(fmt) {}
0018 
0019 protected:
0020     void show_error(model::DocumentNode * node, const QString& message, app::log::Severity severity)
0021     {
0022         fmt->message(i18n("%1: %2", node->object_name(), message), severity);
0023     }
0024 
0025     void on_visit_document(model::Document * document, model::Composition* main) override;
0026 
0027     LottieFormat* fmt;
0028     QSize fixed_size;
0029     std::vector<int> allowed_fps;
0030     int max_frames = 0;
0031 };
0032 
0033 /**
0034  * \brief Triggers warnings on \p format if \p document isn't suitable for Discord stickers
0035  */
0036 void validate_discord(model::Document* document, model::Composition* main, LottieFormat* format);
0037 
0038 
0039 } // namespace glaxnimate::io::lottie