]> git.sesse.net Git - kdenlive/blobdiff - src/projectlist.h
Check that the proxy has same length as original clip, otherwise mark it as "crashed...
[kdenlive] / src / projectlist.h
index f63191d2f0547260b11ad138e569611eceba9dc3..96214097ab8030b543799a454f79a2e41a43b680 100644 (file)
@@ -30,6 +30,7 @@
 #include <QUndoStack>
 #include <QTimer>
 #include <QApplication>
+#include <QFuture>
 
 #include <KTreeWidgetSearchLine>
 #include <KUrl>
@@ -116,16 +117,27 @@ public:
                 QString proxyText;
                 QBrush brush;
                 QColor color;
-                if (proxy == 1) {
-                    proxyText = i18n("Generating proxy...");
-                    brush = option.palette.highlight();
-                    color = option.palette.color(QPalette::HighlightedText);
-                }
-                else {
+                if (proxy == PROXYDONE) {
                     proxyText = i18n("Proxy");
                     brush = option.palette.mid();
                     color = option.palette.color(QPalette::WindowText);
                 }
+                else {
+                    switch (proxy)  {
+                        case CREATINGPROXY:
+                            proxyText = i18n("Generating proxy ...");
+                            break;
+                        case PROXYWAITING:
+                            proxyText = i18n("Waiting proxy ...");
+                            break;
+                        case PROXYCRASHED:
+                        default:
+                            proxyText = i18n("Proxy crashed");
+                    }
+                    brush = option.palette.highlight();
+                    color = option.palette.color(QPalette::HighlightedText);
+                }
+               
                 txtBounding = painter->boundingRect(r2, Qt::AlignRight | Qt::AlignVCenter, " " + proxyText + " ");
                 painter->setPen(Qt::NoPen);
                 painter->setBrush(brush);
@@ -191,18 +203,30 @@ public:
     QMap <QString, QString> getProxies();
     /** @brief Enable / disable proxies. */
     void updateProxyConfig();
+    /** @brief Get a property from the document. */
+    QString getDocumentProperty(const QString &key) const;
+    
+    /** @brief Does this project allow proxies. */
+    bool useProxy() const;
+    /** @brief Should we automatically create proxy clips for newly added clips. */
+    bool generateProxy() const;
+    /** @brief Should we automatically create proxy clips for newly added clips. */
+    bool generateImageProxy() const;
+    /** @brief Returns a list of the expanded folder ids. */
+    QStringList expandedFolders() const;
 
 public slots:
     void setDocument(KdenliveDoc *doc);
     void updateAllClips();
     void slotReplyGetImage(const QString &clipId, const QPixmap &pix);
-    void slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata, bool replace);
+    void slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata, bool replace, bool selectClip);
     void slotAddClip(DocClipBase *clip, bool getProperties);
     void slotDeleteClip(const QString &clipId);
     void slotUpdateClip(const QString &id);
     void slotRefreshClipThumbnail(const QString &clipId, bool update = true);
     void slotRefreshClipThumbnail(QTreeWidgetItem *item, bool update = true);
     void slotRemoveInvalidClip(const QString &id, bool replace);
+    void slotRemoveInvalidProxy(const QString &id, bool durationError);
     void slotSelectClip(const QString &ix);
 
     /** @brief Prepares removing the selected items. */
@@ -230,8 +254,8 @@ private:
     Render *m_render;
     Timecode m_timecode;
     double m_fps;
-    QTimer m_queueTimer;
     QMenu *m_menu;
+    QFuture<void> m_queueRunner;
     QUndoStack *m_commandStack;
     ProjectItem *getItemById(const QString &id);
     QTreeWidgetItem *getAnyItemById(const QString &id);
@@ -241,6 +265,7 @@ private:
     QMenu *m_transcodeAction;
     KdenliveDoc *m_doc;
     ItemDelegate *m_listViewDelegate;
+    /** @brief True if we have not yet finished opening the document. */
     bool m_refreshed;
     QToolButton *m_addButton;
     QToolButton *m_deleteButton;
@@ -250,6 +275,12 @@ private:
     void requestClipInfo(const QDomElement xml, const QString id);
     QList <QString> m_thumbnailQueue;
     QAction *m_proxyAction;
+    QStringList m_processingClips;
+    /** @brief Holds a list of ids for the clips that need to be proxied. */
+    QStringList m_proxyList;
+    /** @brief Holds a list of proxy clip that should be aborted. */
+    QStringList m_abortProxyId;
+    
     void requestClipThumbnail(const QString id);
 
     /** @brief Creates an EditFolderCommand to change the name of an folder item. */
@@ -268,6 +299,14 @@ private:
     /** @brief Sets the buttons enabled/disabled according to selected item. */
     void updateButtons() const;
 
+    /** @brief Set the Proxy status on a clip. 
+     * @param item The clip item to set status
+     * @param status The proxy status (see definitions.h) */
+    void setProxyStatus(const QString id, PROXYSTATUS status);
+    void setProxyStatus(ProjectItem *item, PROXYSTATUS status);
+
+    void monitorItemEditing(bool enable);
+
 private slots:
     void slotClipSelected();
     void slotAddSlideshowClip();
@@ -298,13 +337,19 @@ private slots:
     /** @brief Add a sequence from the stopmotion widget. */
     void slotAddOrUpdateSequence(const QString frameName);
     /** @brief A proxy clip was created, update display. */
-    void slotGotProxy(const QString id, bool success);
+    void slotGotProxy(const QString &id);
     /** @brief Enable / disable proxy for current clip. */
     void slotProxyCurrentItem(bool doProxy);
+    /** @brief Put clip in the proxy waiting list. */
+    void slotCreateProxy(const QString id, bool createProducer = true);
+    /** @brief Stop creation of this clip's proxy. */
+    void slotAbortProxy(const QString id);
+    /** @brief Start creation of proxy clip. */
+    void slotGenerateProxy(const QString id);
 
 signals:
     void clipSelected(DocClipBase *, QPoint zone = QPoint());
-    void getFileProperties(const QDomElement, const QString &, int pixHeight, bool);
+    void getFileProperties(const QDomElement, const QString &, int pixHeight, bool, bool);
     void receivedClipDuration(const QString &);
     void showClipProperties(DocClipBase *);
     void showClipProperties(QList <DocClipBase *>, QMap<QString, QString> commonproperties);
@@ -313,12 +358,16 @@ signals:
     void displayMessage(const QString, int progress);
     void clipNameChanged(const QString, const QString);
     void clipNeedsReload(const QString&, bool);
-    void refreshClip();
+    /** @brief A property affecting display was changed, so we need to update monitors and thumbnails
+     *  @param id: The clip's id string
+     *  @param resetThumbs Should we recreate the timeline thumbnails. */
+    void refreshClip(const QString &id, bool resetThumbs);
     void updateRenderStatus();
     void deleteProjectClips(QStringList ids, QMap <QString, QString> folderids);
     void findInTimeline(const QString &clipId);
     /** @brief Request a profile change for current document. */
     void updateProfile(const QString &);
+    void processNextThumbnail();
 };
 
 #endif