1 /***************************************************************************
2 * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
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. *
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. *
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 ***************************************************************************/
22 * @brief Manages the list of clips in a document.
23 * @author Jean-Baptiste Mardelle
39 #include "definitions.h"
44 class AbstractGroupItem;
51 class ClipManager: public QObject
55 ClipManager(KdenliveDoc *doc);
56 virtual ~ ClipManager();
57 void addClip(DocClipBase *clip);
58 DocClipBase *getClipAt(int pos);
59 void deleteClip(const QString &clipId);
61 /** @brief Add a file to the project.
62 * @ref slotAddClipList
63 * @param url file to add
64 * @param group name of the group to insert the file in (can be empty)
65 * @param groupId id of the group (if any) */
66 void slotAddClipFile(const KUrl url, const QString group, const QString &groupId);
68 /** @brief Adds a list of files to the project.
69 * @param urls files to add
70 * @param group name of the group to insert the files in (can be empty)
71 * @param groupId id of the group (if any)
72 * It checks for duplicated items and asks to the user for instructions. */
73 void slotAddClipList(const KUrl::List urls, const QString group, const QString &groupId);
74 void slotAddTextClipFile(const QString titleName, int out, const QString xml, const QString group, const QString &groupId);
75 void slotAddTextTemplateClip(QString titleName, const KUrl path, const QString group, const QString &groupId);
76 void slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const QString &groupId);
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 QString &groupId);
78 DocClipBase *getClipById(QString clipId);
79 const QList <DocClipBase *> getClipByResource(QString resource);
80 void slotDeleteClips(QStringList ids);
81 void setThumbsProgress(const QString &message, int progress);
82 void checkAudioThumbs();
83 QList <DocClipBase*> documentClipList() const;
84 QMap <QString, QString> documentFolderList() const;
86 int getFreeFolderId();
87 int lastClipId() const;
88 void startAudioThumbsGeneration();
89 void endAudioThumbsGeneration(const QString &requestedId);
90 void askForAudioThumb(const QString &id);
91 QString projectFolder() const;
92 void clearUnusedProducers();
93 void resetProducersList(const QList <Mlt::Producer *> prods);
94 void addFolder(const QString&, const QString&);
95 void deleteFolder(const QString&);
97 AbstractGroupItem *createGroup();
98 void removeGroup(AbstractGroupItem *group);
99 QDomElement groupsXml() const;
100 int clipsCount() const;
103 void updatePreviewSettings();
106 void slotClipModified(const QString &path);
107 void slotClipMissing(const QString &path);
108 void slotClipAvailable(const QString &path);
110 private: // Private attributes
111 /** the list of clips in the document */
112 QList <DocClipBase*> m_clipList;
113 /** the list of groups in the document */
114 QList <AbstractGroupItem *> m_groupsList;
115 QMap <QString, QString> m_folderList;
116 QList <QString> m_audioThumbsQueue;
117 /** the document undo stack*/
120 int m_folderIdCounter;
121 bool m_audioThumbsEnabled;
122 QString m_generatingAudioId;
123 KDirWatch m_fileWatcher;
126 void reloadClip(const QString &);
127 void missingClip(const QString &);
128 void availableClip(const QString &);
129 void checkAllClips();