]> git.sesse.net Git - kdenlive/blob - src/kdenlivedoc.h
Cleanup some mess introduced by last commit, looking for missing slideshow clips...
[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 <QDir>
29 #include <QObject>
30 #include <QUndoGroup>
31 #include <QUndoStack>
32 #include <QTimer>
33
34 #include <KUrl>
35 #include <kautosavefile.h>
36
37 #include "gentime.h"
38 #include "timecode.h"
39 #include "definitions.h"
40 #include "guide.h"
41
42 class Render;
43 class ClipManager;
44 class DocClipBase;
45 class MainWindow;
46
47 class KdenliveDoc: public QObject {
48 Q_OBJECT public:
49
50     KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QPoint tracks, MainWindow *parent = 0);
51     ~KdenliveDoc();
52     QDomNodeList producersList();
53     double fps() const;
54     int width() const;
55     int height() const;
56     KUrl url() const;
57     KAutoSaveFile *m_autosave;
58     void backupMltPlaylist();
59     Timecode timecode() const;
60     QDomDocument toXml() 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);
66     Render *renderer();
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, QString clipId);
72     void addFolder(const QString foldername, const QString &clipId, bool edit);
73     void deleteFolder(const QString foldername, const QString &clipId);
74     void slotAddClipFile(const KUrl url, const QString group, const QString &groupId = QString());
75     void slotAddClipList(const KUrl::List urls, const QString group, const QString &groupId = QString());
76     void slotAddFolder(const QString folderName);
77     void slotDeleteFolder(const QString folderName, const QString &id);
78     void slotEditFolder(const QString folderName, const QString oldfolderName, const QString &clipId);
79     void slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const QString &groupId = QString());
80     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());
81     void deleteClip(const QString &clipId);
82     int getFramePos(QString duration);
83     DocClipBase *getBaseClip(const QString &clipId);
84     void updateClip(const QString &id);
85     void deleteProjectClip(QList <QString> ids);
86     void deleteProjectFolder(QMap <QString, QString> map);
87     /** Inform application of the audio thumbnails generation progress */
88     void setThumbsProgress(const QString &message, int progress);
89     QString profilePath() const;
90     MltVideoProfile mltProfile() const;
91     QString description() const;
92     void setUrl(KUrl url);
93     QDomElement documentInfoXml();
94     void setProfilePath(QString path);
95     const QString&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 syncGuides(QList <Guide *> guides);
103     void setZoom(int factor);
104     int zoom() const;
105     const double dar();
106     double projectDuration() const;
107     bool saveSceneList(const QString &path, QDomDocument sceneList);
108
109 private:
110     KUrl m_url;
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     QString m_searchFolder;
128     /** tells whether current doc has been changed since last save event */
129     bool m_modified;
130     /** Project folder, used to store project files (titles, effects,...) */
131     KUrl m_projectFolder;
132     double m_documentLoadingStep;
133     double m_documentLoadingProgress;
134     void convertDocument(double version);
135     QDomDocument createEmptyDocument(const int videotracks, const int audiotracks);
136     QString colorToString(const QColor& c);
137     void checkProjectClips();
138     void setNewClipResource(const QString &id, const QString &path);
139     QString searchFileRecursively(const QDir &dir, const QString &matchSize, const QString &matchHash) const;
140
141 public slots:
142     void slotCreateTextClip(QString group, const QString &groupId);
143     /** Set to true if document needs saving, false otherwise */
144     void setModified(bool mod = true);
145
146 private slots:
147     void slotAutoSave();
148
149 signals:
150     void addProjectClip(DocClipBase *);
151     void addProjectFolder(const QString, const QString &, bool, bool edit = false);
152     void signalDeleteProjectClip(const QString &);
153     void updateClipDisplay(const QString&);
154     void deleteTimelineClip(const QString&);
155     void progressInfo(const QString &, int);
156     /** emited when the document state has been modified (= needs saving or not) */
157     void docModified(bool);
158     void selectLastAddedClip(const QString &);
159     void guidesUpdated();
160 };
161
162 #endif