documentvalidator.h 2.76 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/***************************************************************************
 *   Copyright (C) 2009 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
 ***************************************************************************/

Alberto Villa's avatar
Alberto Villa committed
20 21
#ifndef DOCUMENTVALIDATOR_H
#define DOCUMENTVALIDATOR_H
22 23 24 25

#include <QDomDocument>
#include <QColor>

26
#include <QUrl>
27
#include <QMap>
28

Alberto Villa's avatar
Alberto Villa committed
29
class DocumentValidator
30 31 32
{

public:
33
    DocumentValidator(const QDomDocument &doc, const QUrl &documentUrl);
Alberto Villa's avatar
Alberto Villa committed
34 35
    bool isProject() const;
    bool validate(const double currentVersion);
36
    bool isModified() const;
37 38
    /** @brief Check if the project contains references to Movit stuff (GLSL), and try to convert if wanted. */
    bool checkMovit();
39 40 41

private:
    QDomDocument m_doc;
42
    QUrl m_url;
43
    bool m_modified;
44
    /** @brief Upgrade from a previous Kdenlive document version. */
Alberto Villa's avatar
Alberto Villa committed
45
    bool upgrade(double version, const double currentVersion);
46
    /** @brief Pass producer properties from previous Kdenlive versions. */
Laurent Montel's avatar
Laurent Montel committed
47
    void updateProducerInfo(const QDomElement &prod, const QDomElement &source);
48 49
    /** @brief Make sur we don't have orphaned producers (that are not in Bin). */
    void checkOrphanedProducers();
Laurent Montel's avatar
Laurent Montel committed
50
    QStringList getInfoFromEffectName(const QString &oldName);
Laurent Montel's avatar
Laurent Montel committed
51
    QString colorToString(const QColor &c);
Laurent Montel's avatar
Laurent Montel committed
52
    QString factorizeGeomValue(const QString &value, double factor);
53 54
    /** @brief Kdenlive <= 0.9.10 saved title clip item position/opacity with locale which was wrong, fix. */
    void fixTitleProducerLocale(QDomElement &producer);
Laurent Montel's avatar
Laurent Montel committed
55
    void convertKeyframeEffect(const QDomElement &effect, const QStringList &params, QMap<int, double> &values, int offset);
56 57 58
};

#endif