]> git.sesse.net Git - kdenlive/blob - src/clipmanager.h
Update for new titler module, turn clip speed into an effect, mem leaks and more
[kdenlive] / src / clipmanager.h
1 /***************************************************************************
2  *   Copyright (C) 2008 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 #ifndef CLIPMANAGER_H
21 #define CLIPMANAGER_H
22
23 /**ClipManager manages the list of clips in a document
24   *@author Jean-Baptiste Mardelle
25   */
26
27 #include <qdom.h>
28 #include <QPixmap>
29 #include <QObject>
30
31 #include <KUrl>
32 #include <KUndoStack>
33 #include <KDirWatch>
34 #include <klocale.h>
35
36 #include "gentime.h"
37 #include "definitions.h"
38
39
40 class KdenliveDoc;
41 class DocClipBase;
42 class AbstractGroupItem;
43
44 namespace Mlt
45 {
46 class Producer;
47 };
48
49 class ClipManager: public QObject
50 {
51 Q_OBJECT public:
52
53     ClipManager(KdenliveDoc *doc);
54     virtual ~ ClipManager();
55     void addClip(DocClipBase *clip);
56     DocClipBase *getClipAt(int pos);
57     void deleteClip(const QString &clipId);
58     void slotAddClipFile(const KUrl url, const QString group, const QString &groupId);
59     void slotAddClipList(const KUrl::List urls, const QString group, const QString &groupId);
60     void slotAddTextClipFile(const QString titleName, int out, const QString xml, const QString group, const QString &groupId);
61     void slotAddTextTemplateClip(QString titleName, const QString imagePath, const KUrl path, const QString group, const QString &groupId);
62     void slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const QString &groupId);
63     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);
64     DocClipBase *getClipById(QString clipId);
65     DocClipBase *getClipByResource(QString resource);
66     void slotDeleteClip(const QString & clipId);
67     void setThumbsProgress(const QString &message, int progress);
68     void checkAudioThumbs();
69     QList <DocClipBase*> documentClipList() const;
70     QMap <QString, QString> documentFolderList() const;
71     int getFreeClipId();
72     int getFreeFolderId();
73     int lastClipId() const;
74     void startAudioThumbsGeneration();
75     void endAudioThumbsGeneration(const QString &requestedId);
76     void askForAudioThumb(const QString &id);
77     QString projectFolder() const;
78     void resetProducersList(QList <Mlt::Producer *> prods);
79     void addFolder(const QString&, const QString&);
80     void deleteFolder(const QString&);
81     void clear();
82     AbstractGroupItem *createGroup();
83     void removeGroup(AbstractGroupItem *group);
84     QDomElement groupsXml() const;
85
86 public slots:
87     void updatePreviewSettings();
88
89 private slots:
90     void slotClipModified(const QString &path);
91
92 private:   // Private attributes
93     /** the list of clips in the document */
94     QList <DocClipBase*> m_clipList;
95     /** the list of groups in the document */
96     QList <AbstractGroupItem *> m_groupsList;
97     QMap <QString, QString> m_folderList;
98     QList <QString> m_audioThumbsQueue;
99     /** the document undo stack*/
100     KdenliveDoc *m_doc;
101     int m_clipIdCounter;
102     int m_folderIdCounter;
103     bool m_audioThumbsEnabled;
104     QString m_generatingAudioId;
105     KDirWatch m_fileWatcher;
106
107 signals:
108     void reloadClip(const QString &);
109 };
110
111 #endif