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 ***************************************************************************/
35 #include <kautosavefile.h>
39 #include "definitions.h"
48 class KdenliveDoc: public QObject {
51 KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QPoint tracks, Render *render, MainWindow *parent = 0);
53 QDomNodeList producersList();
58 KAutoSaveFile *m_autosave;
59 void backupMltPlaylist();
60 Timecode timecode() const;
62 //void setRenderer(Render *render);
63 QUndoStack *commandStack();
64 QString producerName(const QString &id);
65 void setProducerDuration(const QString &id, int duration);
66 int getProducerDuration(const QString &id);
68 QDomElement m_guidesXml;
69 QDomElement guidesXml() const;
70 ClipManager *clipManager();
71 void addClip(QDomElement elem, QString clipId, bool createClipItem = true);
72 void addClipInfo(QDomElement elem, QString clipId);
73 void addFolder(const QString foldername, const QString &clipId, bool edit);
74 void deleteFolder(const QString foldername, const QString &clipId);
75 void slotAddClipFile(const KUrl url, const QString group, const QString &groupId = QString());
76 void slotAddClipList(const KUrl::List urls, const QString group, const QString &groupId = QString());
77 void slotAddFolder(const QString folderName);
78 void slotDeleteFolder(const QString folderName, const QString &id);
79 void slotEditFolder(const QString folderName, const QString oldfolderName, const QString &clipId);
80 void slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const QString &groupId = QString());
81 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());
82 void deleteClip(const QString &clipId);
83 int getFramePos(QString duration);
84 DocClipBase *getBaseClip(const QString &clipId);
85 void updateClip(const QString &id);
86 void deleteProjectClip(QList <QString> ids);
87 void deleteProjectFolder(QMap <QString, QString> map);
88 /** Inform application of the audio thumbnails generation progress */
89 void setThumbsProgress(const QString &message, int progress);
90 QString profilePath() const;
91 MltVideoProfile mltProfile() const;
92 QString description() const;
93 void setUrl(KUrl url);
94 void setProfilePath(QString path);
95 const QString &getFreeClipId();
96 /** does the document need saving */
97 bool isModified() const;
98 /** Returns project folder, used to store project files (titles, effects,...) */
99 KUrl projectFolder() const;
100 /** Used to inform main app of the current document loading progress */
101 void loadingProgressed();
102 void syncGuides(QList <Guide *> guides);
103 void setZoom(int factor);
106 double projectDuration() const;
107 bool saveSceneList(const QString &path, QDomDocument sceneList);
108 int tracksCount() const;
109 TrackInfo trackInfoAt(int ix) const;
110 void insertTrack(int ix, TrackInfo type);
111 void deleteTrack(int ix);
112 void setTrackType(int ix, TrackInfo type);
113 const QList <TrackInfo> tracksList() const;
114 QPoint getTracksCount() const;
115 QString getTracksInfo() const;
116 void switchTrackVideo(int ix, bool hide);
117 void switchTrackAudio(int ix, bool hide);
118 void cachePixmap(const QString &fileId, const QPixmap &pix) const;
119 void setProjectFolder(KUrl url);
120 QString getLadspaFile() const;
121 void setZone(int start, int end);
126 QDomDocument m_document;
127 QString m_projectName;
130 /** Cursor position at document opening */
136 QUndoStack *m_commandStack;
137 QDomDocument generateSceneList();
138 ClipManager *m_clipManager;
139 MltVideoProfile m_profile;
141 QTimer *m_autoSaveTimer;
142 QString m_searchFolder;
143 /** tells whether current doc has been changed since last save event */
145 /** Project folder, used to store project files (titles, effects,...) */
146 KUrl m_projectFolder;
147 double m_documentLoadingStep;
148 double m_documentLoadingProgress;
152 QList <TrackInfo> m_tracksList;
154 bool convertDocument(double version);
155 QDomDocument createEmptyDocument(const int videotracks, const int audiotracks);
156 QString colorToString(const QColor& c);
157 void checkProjectClips();
158 void setNewClipResource(const QString &id, const QString &path);
159 QString searchFileRecursively(const QDir &dir, const QString &matchSize, const QString &matchHash) const;
160 void moveProjectData(KUrl url);
163 void slotCreateTextClip(QString group, const QString &groupId);
164 /** Set to true if document needs saving, false otherwise */
165 void setModified(bool mod = true);
171 void addProjectClip(DocClipBase *, bool getInfo = true);
172 void addProjectFolder(const QString, const QString &, bool, bool edit = false);
173 void signalDeleteProjectClip(const QString &);
174 void updateClipDisplay(const QString&);
175 void deleteTimelineClip(const QString&);
176 void progressInfo(const QString &, int);
177 /** emited when the document state has been modified (= needs saving or not) */
178 void docModified(bool);
179 void selectLastAddedClip(const QString &);
180 void guidesUpdated();