]> git.sesse.net Git - kdenlive/blob - src/kdenlivedoc.h
* Be more clever when adding several clips to a project
[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>
26 #include <QMap>
27 #include <QList>
28 #include <QObject>
29 #include <QUndoGroup>
30 #include <QUndoStack>
31 #include <QTimer>
32
33 #include <KUrl>
34
35 #include "gentime.h"
36 #include "timecode.h"
37 #include "definitions.h"
38 #include "guide.h"
39
40 class Render;
41 class ClipManager;
42 class DocClipBase;
43 class MainWindow;
44
45 class KdenliveDoc: public QObject {
46 Q_OBJECT public:
47
48     KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, MainWindow *parent = 0);
49     ~KdenliveDoc();
50     QDomNodeList producersList();
51     double fps() const;
52     int width() const;
53     int height() const;
54     KUrl url() const;
55     void backupMltPlaylist();
56     Timecode timecode() const;
57     QDomDocument toXml() const;
58     void setRenderer(Render *render);
59     QUndoStack *commandStack();
60     QString producerName(int id);
61     void setProducerDuration(int id, int duration);
62     int getProducerDuration(int id);
63     Render *renderer();
64     QDomElement m_guidesXml;
65     ClipManager *clipManager();
66     void addClip(const QDomElement &elem, const int clipId);
67     void addFolder(const QString foldername, int clipId, bool edit);
68     void deleteFolder(const QString foldername, int clipId);
69     void slotAddClipFile(const KUrl url, const QString group, const int groupId = -1);
70     void slotAddClipList(const KUrl::List urls, const QString group, const int groupId = -1);
71     void slotAddTextClipFile(const QString path, const QString xml, const QString group, const int groupId = -1);
72     void editTextClip(QString path, int id);
73     void slotAddFolder(const QString folderName);
74     void slotDeleteFolder(const QString folderName, const int id);
75     void slotEditFolder(const QString folderName, const QString oldfolderName, int clipId);
76     void slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const int groupId = -1);
77     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 int groupId = -1);
78     void deleteClip(const uint clipId);
79     int getFramePos(QString duration);
80     DocClipBase *getBaseClip(int clipId);
81     void updateClip(int id);
82     void deleteProjectClip(QList <int> ids);
83     void deleteProjectFolder(QMap <QString, int> map);
84     /** Inform application of the audio thumbnails generation progress */
85     void setThumbsProgress(const QString &message, int progress);
86     QString profilePath() const;
87     QString description() const;
88     /** Returns the document format: PAL or NTSC */
89     QString getDocumentStandard();
90     void setUrl(KUrl url);
91     QDomElement documentInfoXml();
92     void setProfilePath(QString path);
93     /** Set to true if document needs saving, false otherwise */
94     void setModified(bool mod);
95     int 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 updateAllProjectClips();
103     void syncGuides(QList <Guide *> guides);
104     void setZoom(int factor);
105     int zoom() const;
106     const double dar();
107
108 private:
109     KUrl m_url;
110     KUrl m_recoveryUrl;
111     QDomDocument m_document;
112     QString m_projectName;
113     double m_fps;
114     int m_zoom;
115     /** Cursor position at document opening */
116     int m_startPos;
117     int m_width;
118     int m_height;
119     Timecode m_timecode;
120     Render *m_render;
121     QUndoStack *m_commandStack;
122     QDomDocument generateSceneList();
123     ClipManager *m_clipManager;
124     MltVideoProfile m_profile;
125     QString m_scenelist;
126     QTimer *m_autoSaveTimer;
127     /** tells whether current doc has been changed since last save event */
128     bool m_modified;
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
135 public slots:
136     void slotCreateTextClip(QString group, int groupId);
137
138 private slots:
139     void slotAutoSave();
140
141 signals:
142     void addProjectClip(DocClipBase *);
143     void addProjectFolder(const QString, int, bool, bool edit = false);
144     void signalDeleteProjectClip(int);
145     void updateClipDisplay(int);
146     void deletTimelineClip(int);
147     void progressInfo(const QString &, int);
148     /** emited when the document state has been modified (= needs saving or not) */
149     void docModified(bool);
150     void refreshClipThumbnail(int);
151     void selectLastAddedClip(const int);
152 };
153
154 #endif