]> git.sesse.net Git - kdenlive/blob - src/kdenlivedoc.h
Title clips now really usable (only transparency & duration change still missing)
[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
42 class KdenliveDoc: public QObject {
43 Q_OBJECT public:
44
45     KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoProfile profile, QUndoGroup *undoGroup, QWidget *parent = 0);
46     ~KdenliveDoc();
47     QDomNodeList producersList();
48     double fps() const;
49     int width() const;
50     int height() const;
51     KUrl url() const;
52     void backupMltPlaylist();
53     Timecode timecode() const;
54     QDomDocument toXml() const;
55     void setRenderer(Render *render);
56     KUndoStack *commandStack();
57     QString producerName(int id);
58     void setProducerDuration(int id, int duration);
59     int getProducerDuration(int id);
60     Render *renderer();
61     ClipManager *clipManager();
62     void addClip(const QDomElement &elem, const int clipId);
63     void addFolder(const QString foldername, int clipId, bool edit);
64     void deleteFolder(const QString foldername, int clipId);
65     void slotAddClipFile(const KUrl url, const QString group, const int groupId = -1);
66     void slotAddTextClipFile(const QString path, const QString group, const int groupId = -1);
67     void editTextClip(QString path, int id);
68     void slotAddFolder(const QString folderName);
69     void slotDeleteFolder(const QString folderName, const int id);
70     void slotEditFolder(const QString folderName, const QString oldfolderName, int clipId);
71     void slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const int groupId = -1);
72     void deleteClip(const uint clipId);
73     int getFramePos(QString duration);
74     DocClipBase *getBaseClip(int clipId);
75     void updateClip(int id);
76     void deleteProjectClip(QList <int> ids);
77     void deleteProjectFolder(QMap <QString, int> map);
78     /** Inform application of the audio thumbnails generation progress */
79     void setThumbsProgress(KUrl url, int progress);
80     QString profilePath() const;
81     QString description() const;
82     /** Returns the document format: PAL or NTSC */
83     QString getDocumentStandard();
84     void setUrl(KUrl url);
85     QDomElement documentInfoXml();
86     void setProfilePath(QString path);
87     /** Set to true if document needs saving, false otherwise */
88     void setModified(bool mod);
89     int getFreeClipId();
90     /** does the document need saving */
91     bool isModified() const;
92     /** Returns project folder, used to store project files (titles, effects,...) */
93     KUrl projectFolder() const;
94
95 private:
96     KUrl m_url;
97     QDomDocument m_document;
98     QString m_projectName;
99     double m_fps;
100     int m_width;
101     int m_height;
102     Timecode m_timecode;
103     Render *m_render;
104     KUndoStack *m_commandStack;
105     QDomDocument generateSceneList();
106     ClipManager *m_clipManager;
107     MltVideoProfile m_profile;
108     QString m_scenelist;
109     /** tells whether current doc has been changed since last save event */
110     bool m_modified;
111     /** Project folder, used to store project files (titles, effects,...) */
112     KUrl m_projectFolder;
113
114 public slots:
115     void slotCreateTextClip(QString group, int groupId);
116
117 signals:
118     void addProjectClip(DocClipBase *);
119     void addProjectFolder(const QString, int, bool, bool edit = false);
120     void signalDeleteProjectClip(int);
121     void updateClipDisplay(int);
122     void deletTimelineClip(int);
123     void thumbsProgress(KUrl, int);
124     /** emited when the document state has been modified (= needs saving or not) */
125     void docModified(bool);
126     void refreshClipThumbnail(int);
127 };
128
129 #endif