]> git.sesse.net Git - kdenlive/blob - src/kdenlivedoc.h
Fix clip count & duration on document opening
[kdenlive] / src / kdenlivedoc.h
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
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.                                   *
8  *                                                                         *
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.                          *
13  *                                                                         *
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  ***************************************************************************/
19
20
21 #ifndef KDENLIVEDOC_H
22 #define KDENLIVEDOC_H
23
24 #include <qdom.h>
25 #include <qstring.h>
26 #include <qmap.h>
27 #include <QList>
28 #include <QObject>
29 #include <QUndoGroup>
30
31 #include <KUndoStack>
32 #include <kurl.h>
33
34 #include "gentime.h"
35 #include "timecode.h"
36 #include "definitions.h"
37
38 class Render;
39 class ClipManager;
40 class DocClipBase;
41 class MainWindow;
42
43 class KdenliveDoc: public QObject {
44 Q_OBJECT public:
45
46     KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoProfile profile, QUndoGroup *undoGroup, MainWindow *parent = 0);
47     ~KdenliveDoc();
48     QDomNodeList producersList();
49     double fps() const;
50     int width() const;
51     int height() const;
52     KUrl url() const;
53     void backupMltPlaylist();
54     Timecode timecode() const;
55     QDomDocument toXml() const;
56     void setRenderer(Render *render);
57     KUndoStack *commandStack();
58     QString producerName(int id);
59     void setProducerDuration(int id, int duration);
60     int getProducerDuration(int id);
61     Render *renderer();
62     ClipManager *clipManager();
63     void addClip(const QDomElement &elem, const int clipId);
64     void addFolder(const QString foldername, int clipId, bool edit);
65     void deleteFolder(const QString foldername, int clipId);
66     void slotAddClipFile(const KUrl url, const QString group, const int groupId = -1);
67     void slotAddTextClipFile(const QString path, const QString group, const int groupId = -1);
68     void editTextClip(QString path, int id);
69     void slotAddFolder(const QString folderName);
70     void slotDeleteFolder(const QString folderName, const int id);
71     void slotEditFolder(const QString folderName, const QString oldfolderName, int clipId);
72     void slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const int groupId = -1);
73     void slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, bool loop, const QString group, const int groupId = -1);
74     void deleteClip(const uint clipId);
75     int getFramePos(QString duration);
76     DocClipBase *getBaseClip(int clipId);
77     void updateClip(int id);
78     void deleteProjectClip(QList <int> ids);
79     void deleteProjectFolder(QMap <QString, int> map);
80     /** Inform application of the audio thumbnails generation progress */
81     void setThumbsProgress(const QString &message, int progress);
82     QString profilePath() const;
83     QString description() const;
84     /** Returns the document format: PAL or NTSC */
85     QString getDocumentStandard();
86     void setUrl(KUrl url);
87     QDomElement documentInfoXml(QDomElement timelineInfo);
88     void setProfilePath(QString path);
89     /** Set to true if document needs saving, false otherwise */
90     void setModified(bool mod);
91     int getFreeClipId();
92     /** does the document need saving */
93     bool isModified() const;
94     /** Returns project folder, used to store project files (titles, effects,...) */
95     KUrl projectFolder() const;
96     /** Used to inform main app of the current document loading progress */
97     void loadingProgressed();
98     void updateAllProjectClips();
99
100 private:
101     KUrl m_url;
102     QDomDocument m_document;
103     QString m_projectName;
104     double m_fps;
105     /** Cursor position at document opening */
106     int m_startPos;
107     int m_width;
108     int m_height;
109     Timecode m_timecode;
110     Render *m_render;
111     KUndoStack *m_commandStack;
112     QDomDocument generateSceneList();
113     ClipManager *m_clipManager;
114     MltVideoProfile m_profile;
115     QString m_scenelist;
116     /** tells whether current doc has been changed since last save event */
117     bool m_modified;
118     /** Project folder, used to store project files (titles, effects,...) */
119     KUrl m_projectFolder;
120     double m_documentLoadingStep;
121     double m_documentLoadingProgress;
122     void convertDocument(double version);
123
124 public slots:
125     void slotCreateTextClip(QString group, int groupId);
126
127 signals:
128     void addProjectClip(DocClipBase *);
129     void addProjectFolder(const QString, int, bool, bool edit = false);
130     void signalDeleteProjectClip(int);
131     void updateClipDisplay(int);
132     void deletTimelineClip(int);
133     void progressInfo(const QString &, int);
134     /** emited when the document state has been modified (= needs saving or not) */
135     void docModified(bool);
136     void refreshClipThumbnail(int);
137 };
138
139 #endif