File indexing completed on 2025-01-05 04:01:17
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 <QJsonDocument> 0010 #include "io/base.hpp" 0011 #include "io/io_registry.hpp" 0012 0013 namespace glaxnimate::io::rive { 0014 0015 0016 class RiveFormat : public ImportExport 0017 { 0018 Q_OBJECT 0019 0020 public: 0021 static constexpr const int format_version = 7; 0022 0023 QString slug() const override { return "rive"; } 0024 QString name() const override { return i18n("Rive Animation"); } 0025 QStringList extensions() const override { return {"riv"}; } 0026 bool can_save() const override { return true; } 0027 bool can_open() const override { return true; } 0028 0029 static RiveFormat* instance() { return autoreg.registered; } 0030 0031 QJsonDocument to_json(const QByteArray& binary_data); 0032 0033 protected: 0034 bool on_save(QIODevice& file, const QString&, model::Composition* comp, const QVariantMap&) override; 0035 bool on_open(QIODevice& file, const QString&, model::Document* document, const QVariantMap&) override; 0036 0037 private: 0038 static Autoreg<RiveFormat> autoreg; 0039 }; 0040 0041 0042 } // namespace glaxnimate::io::rive 0043