File indexing completed on 2024-03-24 04:54:20
0001 /* 0002 SPDX-FileCopyrightText: 2009 Jean-Baptiste Mardelle <jb@kdenlive.org> 0003 0004 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <QColor> 0010 #include <QDomDocument> 0011 0012 #include <QMap> 0013 #include <QUrl> 0014 #include <QtCore/QLocale> 0015 0016 class DocumentValidator 0017 { 0018 0019 public: 0020 DocumentValidator(const QDomDocument &doc, QUrl documentUrl); 0021 bool isProject() const; 0022 /** @brief Check if the document is a valid Kdenlive project 0023 * @param currentVersion The version of the document, with the current 0024 * version defined as DOCUMENTVERSION in kdenlivedoc.cpp. 0025 * @return A QPair with the first value true if the document is valid, and 0026 * the second value the original decimal point string only if upgradeTo100 0027 * changed the decimal point. 0028 */ 0029 QPair<bool, QString> validate(const double currentVersion); 0030 bool isModified() const; 0031 /** @brief Check if the project contains references to Movit stuff (GLSL), and try to convert if wanted. */ 0032 bool checkMovit(); 0033 0034 private: 0035 QDomDocument m_doc; 0036 QUrl m_url; 0037 bool m_modified; 0038 /** @brief Upgrade from a previous Kdenlive document version. */ 0039 bool upgrade(double version, const double currentVersion); 0040 0041 /** 0042 * Changes the decimal separator to . if it is something else. 0043 * @param documentLocale Locale which is used by the document 0044 * @return the original decimal point, if it was something else than “.”, or an empty string otherwise. 0045 */ 0046 QString upgradeTo100(const QLocale &documentLocale); 0047 0048 /** @brief Pass producer properties from previous Kdenlive versions. */ 0049 void updateProducerInfo(const QDomElement &prod, const QDomElement &source); 0050 /** @brief Make sur we don't have orphaned producers (that are not in Bin). */ 0051 void checkOrphanedProducers(); 0052 QStringList getInfoFromEffectName(const QString &oldName); 0053 QString colorToString(const QColor &c); 0054 QString factorizeGeomValue(const QString &value, double factor); 0055 /** @brief Kdenlive <= 0.9.10 saved title clip item position/opacity with locale which was wrong, fix. */ 0056 void fixTitleProducerLocale(QDomElement &producer); 0057 void convertKeyframeEffect_093(const QDomElement &effect, const QStringList ¶ms, QMap<int, double> &values, int offset); 0058 };