]> git.sesse.net Git - kdenlive/blobdiff - src/clipmanager.h
Improve reloading of externally modified clips (wait for 1.5 second before reloading...
[kdenlive] / src / clipmanager.h
index b3f06e649ccbfdf7c7be89bca8efa3bbf46f49d4..fe214673835f2a56af23782e9c800e56cb8d279e 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
  ***************************************************************************/
 
+/**
+ * @class ClipManager
+ * @brief Manages the list of clips in a document.
+ * @author Jean-Baptiste Mardelle
+ */
+
 #ifndef CLIPMANAGER_H
 #define CLIPMANAGER_H
 
-/**ClipManager manages the list of clips in a document
-  *@author Jean-Baptiste Mardelle
-  */
-
 #include <qdom.h>
 #include <QPixmap>
 #include <QObject>
+#include <QTimer>
 
 #include <KUrl>
 #include <KUndoStack>
@@ -55,7 +58,19 @@ Q_OBJECT public:
     void addClip(DocClipBase *clip);
     DocClipBase *getClipAt(int pos);
     void deleteClip(const QString &clipId);
+
+    /** @brief Add a file to the project.
+     * @ref slotAddClipList
+     * @param url file to add
+     * @param group name of the group to insert the file in (can be empty)
+     * @param groupId id of the group (if any) */
     void slotAddClipFile(const KUrl url, const QString group, const QString &groupId);
+
+    /** @brief Adds a list of files to the project.
+     * @param urls files to add
+     * @param group name of the group to insert the files in (can be empty)
+     * @param groupId id of the group (if any)
+     * It checks for duplicated items and asks to the user for instructions. */
     void slotAddClipList(const KUrl::List urls, const QString group, const QString &groupId);
     void slotAddTextClipFile(const QString titleName, int out, const QString xml, const QString group, const QString &groupId);
     void slotAddTextTemplateClip(QString titleName, const KUrl path, const QString group, const QString &groupId);
@@ -89,9 +104,12 @@ public slots:
     void updatePreviewSettings();
 
 private slots:
+    /** A clip was externally modified, monitor for more changes and prepare for reload */
     void slotClipModified(const QString &path);
     void slotClipMissing(const QString &path);
     void slotClipAvailable(const QString &path);
+    /** Check the list of externally modified clips, and process them if they were not modified in the last 1500 milliseconds */
+    void slotProcessModifiedClips();
 
 private:   // Private attributes
     /** the list of clips in the document */
@@ -104,12 +122,16 @@ private:   // Private attributes
     KdenliveDoc *m_doc;
     int m_clipIdCounter;
     int m_folderIdCounter;
-    bool m_audioThumbsEnabled;
     QString m_generatingAudioId;
     KDirWatch m_fileWatcher;
+    /** Timer used to reload clips when they have been externally modified */
+    QTimer m_modifiedTimer;
+    /** List of the clip IDs that need to be reloaded after being externally modified */
+    QMap <QString, QTime> m_modifiedClips;
 
 signals:
     void reloadClip(const QString &);
+    void modifiedClip(const QString &);
     void missingClip(const QString &);
     void availableClip(const QString &);
     void checkAllClips();