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 Timecode timecode() const;
61 //void setRenderer(Render *render);
62 QUndoStack *commandStack();
63 QString producerName(const QString &id);
64 void setProducerDuration(const QString &id, int duration);
65 int getProducerDuration(const QString &id);
67 QDomElement m_guidesXml;
68 QDomElement guidesXml() const;
69 ClipManager *clipManager();
70 void addClip(QDomElement elem, QString clipId, bool createClipItem = true);
71 void addClipInfo(QDomElement elem, QDomElement orig, QString clipId);
72 void slotAddClipFile(const KUrl url, const QString group, const QString &groupId = QString());
73 void slotAddClipList(const KUrl::List urls, const QString group, const QString &groupId = QString());
74 void slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const QString &groupId = QString());
75 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());
76 void deleteClip(const QString &clipId);
77 int getFramePos(QString duration);
78 DocClipBase *getBaseClip(const QString &clipId);
79 void updateClip(const QString &id);
80 void deleteProjectClip(QList <QString> ids);
81 /** Inform application of the audio thumbnails generation progress */
82 void setThumbsProgress(const QString &message, int progress);
83 QString profilePath() const;
84 MltVideoProfile mltProfile() const;
85 QString description() const;
86 void setUrl(KUrl url);
87 void setProfilePath(QString path);
88 const QString &getFreeClipId();
89 /** does the document need saving */
90 bool isModified() const;
91 /** Returns project folder, used to store project files (titles, effects,...) */
92 KUrl projectFolder() const;
93 /** Used to inform main app of the current document loading progress */
94 void loadingProgressed();
95 void syncGuides(QList <Guide *> guides);
96 void setZoom(int factor);
99 double projectDuration() const;
100 bool saveSceneList(const QString &path, QDomDocument sceneList);
101 int tracksCount() const;
102 TrackInfo trackInfoAt(int ix) const;
103 void insertTrack(int ix, TrackInfo type);
104 void deleteTrack(int ix);
105 void setTrackType(int ix, TrackInfo type);
106 const QList <TrackInfo> tracksList() const;
107 QPoint getTracksCount() const;
108 QString getTracksInfo() const;
109 void switchTrackVideo(int ix, bool hide);
110 void switchTrackAudio(int ix, bool hide);
111 void cachePixmap(const QString &fileId, const QPixmap &pix) const;
112 void setProjectFolder(KUrl url);
113 QString getLadspaFile() const;
114 void setZone(int start, int end);
117 void updatePreviewSettings();
121 QDomDocument m_document;
122 QString m_projectName;
125 /** Cursor position at document opening */
131 QUndoStack *m_commandStack;
132 QDomDocument generateSceneList();
133 ClipManager *m_clipManager;
134 MltVideoProfile m_profile;
135 QTimer *m_autoSaveTimer;
136 QString m_searchFolder;
137 /** tells whether current doc has been changed since last save event */
139 /** Project folder, used to store project files (titles, effects,...) */
140 KUrl m_projectFolder;
141 double m_documentLoadingStep;
142 double m_documentLoadingProgress;
147 QList <TrackInfo> m_tracksList;
149 bool convertDocument(double version);
150 QDomDocument createEmptyDocument(const int videotracks, const int audiotracks);
151 QString colorToString(const QColor& c);
152 void checkProjectClips();
153 void setNewClipResource(const QString &id, const QString &path);
154 QString searchFileRecursively(const QDir &dir, const QString &matchSize, const QString &matchHash) const;
155 void moveProjectData(KUrl url);
158 void slotCreateTextClip(QString group, const QString &groupId);
159 /** Set to true if document needs saving, false otherwise */
160 void setModified(bool mod = true);
166 void resetProjectList();
167 void addProjectClip(DocClipBase *, bool getInfo = true);
168 void signalDeleteProjectClip(const QString &);
169 void updateClipDisplay(const QString&);
170 void deleteTimelineClip(const QString&);
171 void progressInfo(const QString &, int);
172 /** emited when the document state has been modified (= needs saving or not) */
173 void docModified(bool);
174 void selectLastAddedClip(const QString &);
175 void guidesUpdated();