1/***************************************************************************
2 effectslist.h - description
3 -------------------
4 begin : Sat Aug 10 2002
5 copyright : (C) 2002 by Jason Wood
6 email : jasonwood@blueyonder.co.uk
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18/**
19 * @class EffectsList
20 * @brief List for effects objects.
21 * @author Jason Wood
22 *
23 * This is a list of DocClipBase objects, to be used instead of
24 * QList<DocClipBase> to enable sorting lists correctly. It also contains the
25 * ability to set a "master clip", which can be used by a number of operations
26 * where there is the need of one clip to act as a reference for what happens to
27 * all clips.
28 */
29
30#ifndef EFFECTSLIST_H
31#define EFFECTSLIST_H
32
33#include <QDomDocument>
34
35namespace Kdenlive {
36 enum EFFECTTYPE { simpleEffect, groupEffect };
37}
38
39class EffectsList: public QDomDocument
40{
41public:
42 EffectsList(bool indexRequired = false);
43 ~EffectsList();
44
45 /** @brief Returns the XML element of an effect.
46 * @param name name of the effect to be returned */
47 QDomElement getEffectByName(const QString & name) const;
48 QDomElement getEffectByTag(const QString & tag, const QString & id) const;
49
50 /** @brief Checks the existance of an effect.
51 * @param tag effect tag
52 * @param id effect id
53 * @return effect index if the effect exists, -1 otherwise */
54 int hasEffect(const QString & tag, const QString & id) const;
55
56 /** @brief Lists the core properties of an effect.
57 * @param ix effect index
58 * @return list of name, tag and id of an effect */
59 QStringList effectIdInfo(const int ix) const;
60
61 /** @brief Lists effects names. */
62 QStringList effectNames();
63 QString getInfo(const QString & tag, const QString & id) const;
64 QString getInfoFromIndex(const int ix) const;
65 QString getEffectInfo(const QDomElement &effect) const;
66 void clone(const EffectsList &original);
67 QDomElement append(QDomElement e);
68 bool isEmpty() const;
69 int count() const;
70 const QDomElement at(int ix) const;
71 void removeAt(int ix);
72 QDomElement itemFromIndex(int ix) const;
73 QDomElement insert(QDomElement effect);
74 void updateEffect(const QDomElement &effect);
75 static bool hasKeyFrames(const QDomElement &effect);
76 static void setParameter(QDomElement effect, const QString &name, const QString &value);
77 static QString parameter(const QDomElement &effect, const QString &name);
78 /** @brief Change the value of a 'property' element from the effect node. */
79 static void setProperty(QDomElement effect, const QString &name, const QString &value);
80 /** @brief Rename a 'property' element from the effect node. */
81 static void renameProperty(QDomElement effect, const QString &oldName, const QString &newName);
82 /** @brief Get the value of a 'property' element from the effect node. */
83 static QString property(QDomElement effect, const QString &name);
84 /** @brief Delete a 'property' element from the effect node. */
85 static void removeProperty(QDomElement effect, const QString &name);
86 /** @brief Remove all 'meta.*' properties from a producer, used when replacing proxy producers in xml for rendering. */
87 static void removeMetaProperties(QDomElement producer);
88 void clearList();
89 /** @brief Get am effect with effect index equal to ix. */
90 QDomElement effectFromIndex(const QDomNodeList &effects, int ix);
91 /** @brief Update all effects indexes to make sure they are 1, 2, 3, ... */
92 void updateIndexes(QDomNodeList effects, int startIndex);
93 /** @brief Enable / disable a list of effects */
94 void enableEffects(const QList<int> &indexes, bool disable);
95
96private:
97 QDomElement m_baseElement;
98 bool m_useIndex;
99
100 /** @brief Init effect default parameter values. */
101 void initEffect(const QDomElement &effect) const;
102
103};
104
105#endif
106