1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
34 #include <kautosavefile.h>
38 #include "definitions.h"
46 class KdenliveDoc: public QObject {
49 KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QPoint tracks, MainWindow *parent = 0);
51 QDomNodeList producersList();
56 KAutoSaveFile *m_autosave;
57 void backupMltPlaylist();
58 Timecode timecode() const;
59 QDomDocument toXml() const;
60 void setRenderer(Render *render);
61 QUndoStack *commandStack();
62 QString producerName(const QString &id);
63 void setProducerDuration(const QString &id, int duration);
64 int getProducerDuration(const QString &id);
66 QDomElement m_guidesXml;
67 QDomElement guidesXml() const;
68 ClipManager *clipManager();
69 void addClip(QDomElement elem, QString clipId, bool createClipItem = true);
70 void addClipInfo(QDomElement elem, QString clipId);
71 void addFolder(const QString foldername, const QString &clipId, bool edit);
72 void deleteFolder(const QString foldername, const QString &clipId);
73 void slotAddClipFile(const KUrl url, const QString group, const QString &groupId = QString());
74 void slotAddClipList(const KUrl::List urls, const QString group, const QString &groupId = QString());
75 void slotAddFolder(const QString folderName);
76 void slotDeleteFolder(const QString folderName, const QString &id);
77 void slotEditFolder(const QString folderName, const QString oldfolderName, const QString &clipId);
78 void slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const QString &groupId = QString());
79 void slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, const bool loop, const bool fade, const QString &luma_duration, const QString &luma_file, const int softness, const QString group, const QString &groupId = QString());
80 void deleteClip(const QString &clipId);
81 int getFramePos(QString duration);
82 DocClipBase *getBaseClip(const QString &clipId);
83 void updateClip(const QString &id);
84 void deleteProjectClip(QList <QString> ids);
85 void deleteProjectFolder(QMap <QString, QString> map);
86 /** Inform application of the audio thumbnails generation progress */
87 void setThumbsProgress(const QString &message, int progress);
88 QString profilePath() const;
89 MltVideoProfile mltProfile() const;
90 QString description() const;
91 void setUrl(KUrl url);
92 QDomElement documentInfoXml();
93 void setProfilePath(QString path);
94 const QString&getFreeClipId();
95 /** does the document need saving */
96 bool isModified() const;
97 /** Returns project folder, used to store project files (titles, effects,...) */
98 KUrl projectFolder() const;
99 /** Used to inform main app of the current document loading progress */
100 void loadingProgressed();
101 void syncGuides(QList <Guide *> guides);
102 void setZoom(int factor);
105 double projectDuration() const;
106 bool saveSceneList(const QString &path, QDomDocument sceneList);
110 QDomDocument m_document;
111 QString m_projectName;
114 /** Cursor position at document opening */
120 QUndoStack *m_commandStack;
121 QDomDocument generateSceneList();
122 ClipManager *m_clipManager;
123 MltVideoProfile m_profile;
125 QTimer *m_autoSaveTimer;
126 QString m_searchFolder;
127 /** tells whether current doc has been changed since last save event */
129 /** Project folder, used to store project files (titles, effects,...) */
130 KUrl m_projectFolder;
131 double m_documentLoadingStep;
132 double m_documentLoadingProgress;
133 void convertDocument(double version);
134 QDomDocument createEmptyDocument(const int videotracks, const int audiotracks);
135 QString colorToString(const QColor& c);
136 void checkProjectClips();
137 void setNewClipResource(const QString &id, const QString &path);
140 void slotCreateTextClip(QString group, const QString &groupId);
141 /** Set to true if document needs saving, false otherwise */
142 void setModified(bool mod = true);
148 void addProjectClip(DocClipBase *);
149 void addProjectFolder(const QString, const QString &, bool, bool edit = false);
150 void signalDeleteProjectClip(const QString &);
151 void updateClipDisplay(const QString&);
152 void deleteTimelineClip(const QString&);
153 void progressInfo(const QString &, int);
154 /** emited when the document state has been modified (= needs saving or not) */
155 void docModified(bool);
156 void selectLastAddedClip(const QString &);
157 void guidesUpdated();