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
52 KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, QString profileName, const QPoint tracks, Render *render, MainWindow *parent = 0);
54 QDomNodeList producersList();
59 KAutoSaveFile *m_autosave;
60 Timecode timecode() const;
62 //void setRenderer(Render *render);
63 QUndoStack *commandStack();
64 QString producerName(const QString &id);
66 QDomDocument m_guidesXml;
67 QDomElement guidesXml() const;
68 ClipManager *clipManager();
69 void addClip(QDomElement elem, QString clipId, bool createClipItem = true);
70 void addClipInfo(QDomElement elem, QDomElement orig, QString clipId);
71 void slotAddClipFile(const KUrl url, const QString group, const QString &groupId = QString());
72 void slotAddClipList(const KUrl::List urls, const QString group, const QString &groupId = QString());
73 void deleteClip(const QString &clipId);
74 int getFramePos(QString duration);
75 DocClipBase *getBaseClip(const QString &clipId);
76 void updateClip(const QString id);
77 /** Inform application of the audio thumbnails generation progress */
78 void setThumbsProgress(const QString &message, int progress);
79 const QString &profilePath() const;
80 MltVideoProfile mltProfile() const;
81 const QString description() const;
82 void setUrl(KUrl url);
83 /** update project profile, returns true if fps was changed */
84 bool setProfilePath(QString path);
85 const QString getFreeClipId();
86 /** does the document need saving */
87 bool isModified() const;
88 /** Returns project folder, used to store project files (titles, effects,...) */
89 KUrl projectFolder() const;
90 void syncGuides(QList <Guide *> guides);
91 void setZoom(int horizontal, int vertical);
94 double projectDuration() const;
95 bool saveSceneList(const QString &path, const QString &scene);
96 int tracksCount() const;
97 TrackInfo trackInfoAt(int ix) const;
98 void insertTrack(int ix, TrackInfo type);
99 void deleteTrack(int ix);
100 void setTrackType(int ix, TrackInfo type);
101 const QList <TrackInfo> tracksList() const;
102 QPoint getTracksCount() const;
103 void switchTrackVideo(int ix, bool hide);
104 void switchTrackAudio(int ix, bool hide);
105 void switchTrackLock(int ix, bool lock);
106 void cachePixmap(const QString &fileId, const QPixmap &pix) const;
107 void setProjectFolder(KUrl url);
108 QString getLadspaFile() const;
109 void setZone(int start, int end);
112 void updatePreviewSettings();
113 bool isTrackLocked(int ix) const;
114 void setDocumentProperty(const QString &name, const QString &value);
115 const QString getDocumentProperty(const QString &name) const;
119 QDomDocument m_document;
125 QUndoStack *m_commandStack;
126 ClipManager *m_clipManager;
127 MltVideoProfile m_profile;
128 QTimer *m_autoSaveTimer;
129 QString m_searchFolder;
130 /** tells whether current doc has been changed since last save event */
132 /** Project folder, used to store project files (titles, effects,...) */
133 KUrl m_projectFolder;
135 QMap <QString, QString> m_documentProperties;
137 QList <TrackInfo> m_tracksList;
138 void setNewClipResource(const QString &id, const QString &path);
139 QString searchFileRecursively(const QDir &dir, const QString &matchSize, const QString &matchHash) const;
140 void moveProjectData(KUrl url);
141 bool checkDocumentClips(QDomNodeList infoproducers);
142 /** Creates a new project */
143 QDomDocument createEmptyDocument(int videotracks, int audiotracks);
144 QDomDocument createEmptyDocument(QList <TrackInfo> tracks);
147 void slotCreateColorClip(const QString &name, const QString &color, const QString &duration, QString group, const QString &groupId);
148 void slotCreateSlideshowClipFile(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, QString group, const QString &groupId);
149 void slotCreateTextClip(QString group, const QString &groupId, const QString &templatePath = QString());
150 void slotCreateTextTemplateClip(QString group, const QString &groupId, KUrl path);
151 /** Set to true if document needs saving, false otherwise */
152 void setModified(bool mod = true);
153 void checkProjectClips();
159 void resetProjectList();
160 void addProjectClip(DocClipBase *, bool getInfo = true);
161 void signalDeleteProjectClip(const QString &);
162 void updateClipDisplay(const QString&);
163 void deleteTimelineClip(const QString&);
164 void progressInfo(const QString &, int);
165 /** emitted when the document state has been modified (= needs saving or not) */
166 void docModified(bool);
167 void selectLastAddedClip(const QString &);
168 void guidesUpdated();