]> git.sesse.net Git - kdenlive/blobdiff - src/projectlist.h
Use const'ref, change if(foo) delete foo => delete foo not necessary to check it...
[kdenlive] / src / projectlist.h
index bd04931dcb23227b251672ac937a85db1898d84e..04a55f6c2c7767dbe460fc3f6d4d46b9c889ed6d 100644 (file)
 #include <KIcon>
 #include <kdeversion.h>
 
-#if KDE_IS_VERSION(4,7,0)
-#include <KMessageWidget>
-#endif
-
 #ifdef NEPOMUK
 #include <nepomuk/kratingpainter.h>
 #include <nepomuk/resource.h>
 #include "projecttree/abstractclipjob.h"
 #include <kdialog.h>
 
+#if KDE_IS_VERSION(4,7,0)
+#include <KMessageWidget>
+#else
+// Dummy KMessageWidget to allow compilation of MyMessageWidget class since Qt's moc doesn work inside #ifdef
+#include <QLabel>
+
+class KMessageWidget: public QLabel
+{
+public:
+    KMessageWidget(QWidget * = 0) {};
+    KMessageWidget(const QString &, QWidget * = 0) {};
+    virtual ~KMessageWidget(){};
+};
+#endif
+
+class MyMessageWidget: public KMessageWidget
+{
+    Q_OBJECT
+public:
+    MyMessageWidget(QWidget *parent = 0);
+    MyMessageWidget(const QString &text, QWidget *parent = 0);
+
+protected:
+    bool event(QEvent* ev);
+
+signals:
+    void messageClosing();
+};
+
 namespace Mlt
 {
 class Producer;
-};
+}
 
 class ProjectItem;
 class ProjectListView;
@@ -80,7 +105,7 @@ class SmallInfoLabel: public QPushButton
     Q_OBJECT
 public:
     SmallInfoLabel(QWidget *parent = 0);
-
+    static const QString getStyleSheet(const QPalette &p);
 private:
     QTimeLine* m_timeLine;
 
@@ -144,31 +169,28 @@ public:
             QString subText = index.data(DurationRole).toString();
             int usage = index.data(UsageRole).toInt();
             if (usage != 0) subText.append(QString(" (%1)").arg(usage));
-            if (option.state & (QStyle::State_Selected)) painter->setPen(option.palette.color(QPalette::Mid));
             QRectF bounding;
             painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , subText, &bounding);
-            
             int jobProgress = index.data(Qt::UserRole + 5).toInt();
             if (jobProgress != 0 && jobProgress != JOBDONE && jobProgress != JOBABORTED) {
                 if (jobProgress != JOBCRASHED) {
                     // Draw job progress bar
                     QColor color = option.palette.alternateBase().color();
-                    painter->setPen(Qt::NoPen);
-                    color.setAlpha(180);
-                    painter->setBrush(QBrush(color));
-                    QRect progress(pixmapPoint.x() + 1, pixmapPoint.y() + pixmap.height() - 9, pixmap.width() - 2, 8);
-                    painter->drawRect(progress);
-                    painter->setBrush(option.palette.text());
-                    if (jobProgress > 0) {
-                        progress.adjust(1, 1, 0, -1);
-                        progress.setWidth((pixmap.width() - 4) * jobProgress / 100);
-                        painter->drawRect(progress);
-                    } else if (jobProgress == JOBWAITING) {
-                        // Draw kind of a pause icon
-                        progress.adjust(1, 1, 0, -1);
-                        progress.setWidth(2);
-                        painter->drawRect(progress);
-                        progress.moveLeft(progress.right() + 2);
+                   color.setAlpha(150);
+                    painter->setPen(option.palette.link().color());
+                    QRect progress(pixmapPoint.x() + 2, pixmapPoint.y() + pixmap.height() - 9, pixmap.width() - 4, 7);
+                   painter->setBrush(QBrush(color));
+                   painter->drawRect(progress);
+                   painter->setBrush(option.palette.link());
+                   progress.adjust(2, 2, -2, -2);
+                   if (jobProgress == JOBWAITING) {
+                       progress.setLeft(progress.right() - 2);
+                       painter->drawRect(progress);
+                       progress.moveLeft(progress.left() - 5);
+                       painter->drawRect(progress);
+                   }
+                   else if (jobProgress > 0) {
+                        progress.setWidth(progress.width() * jobProgress / 100);
                         painter->drawRect(progress);
                     }
                 } else if (jobProgress == JOBCRASHED) {
@@ -221,8 +243,8 @@ public:
     void setupGeneratorMenu(const QHash<QString,QMenu*>& menus);
     QString currentClipUrl() const;
     KUrl::List getConditionalUrls(const QString &condition) const;
-    /** @brief Get a list of selected clip Id's that match a condition. */
-    QStringList getConditionalIds(const QString &condition) const;
+    /** @brief Get a list of selected clip Id's and url's that match a condition. */
+    QMap <QString, QString> getConditionalIds(const QString &condition) const;
     QDomDocument generateTemplateXml(QString data, const QString &replaceString);
     void cleanup();
     void trashUnusedClips();
@@ -261,6 +283,9 @@ public:
     void startClipFilterJob(const QString &filterName, const QString &condition);
     /** @brief Set current document for the project tree. */
     void setDocument(KdenliveDoc *doc);
+    
+    /** @brief Palette was changed, update style. */
+    void updatePalette();
 
 public slots:
     void updateAllClips(bool displayRatioChanged, bool fpsChanged, QStringList brokenClips);
@@ -303,7 +328,8 @@ public slots:
     /** @brief Start transcoding selected clips. */
     void slotTranscodeClipJob(const QString &condition, QString params, QString desc);
     /** @brief Start an MLT process job. */
-    void slotStartFilterJob(ItemInfo, const QString&,const QString&,const QString&,const QString&,const QString&,const QString&,const QString&);
+    void slotStartFilterJob(ItemInfo, const QString&,const QString&,const QString&,const QString&,const QString&,const QMap <QString, QString>&);
+    void slotSetThumbnail(const QString &id, int framePos, QImage img);
     
 
 private:
@@ -323,7 +349,7 @@ private:
     QAction *m_discardCurrentClipJobs;
     QMenu *m_extractAudioAction;
     QMenu *m_transcodeAction;
-    QMenu *m_stabilizeAction;
+    QMenu *m_clipsActionsMenu;
     KdenliveDoc *m_doc;
     ItemDelegate *m_listViewDelegate;
     /** @brief False if we have not yet finished opening the document. */
@@ -338,6 +364,7 @@ private:
     QList <QString> m_thumbnailQueue;
     QAction *m_proxyAction;
     QMutex m_jobMutex;
+    QMutex m_processMutex;
     bool m_abortAllJobs;
     /** @brief We are cleaning up the project list, so stop processing signals. */
     bool m_closing;
@@ -346,10 +373,11 @@ private:
     InvalidDialog *m_invalidClipDialog;
     QMenu *m_jobsMenu;
     SmallInfoLabel *m_infoLabel;
+    /** @brief A list of strings containing the last error logs for clip jobs. */
+    QStringList m_errorLog;
+
 #if KDE_IS_VERSION(4,7,0)
-    KMessageWidget *m_infoMessage;
-    /** @brief A string containing the last error log for a clip job. */
-    QString m_errorLog;
+    MyMessageWidget *m_infoMessage;
     /** @brief The action that will trigger the log dialog. */
     QAction *m_logAction;
 #endif
@@ -396,7 +424,14 @@ private:
     /** @brief Get the list of job names for current clip. */
     QStringList getPendingJobs(const QString &id);
     /** @brief Start an MLT process job. */
-    void processClipJob(QStringList ids, const QString&destination, bool autoAdd, QStringList jobParams, const QString &description);
+    void processClipJob(QStringList ids, const QString&destination, bool autoAdd, QStringList jobParams, const QString &description, stringMap extraParams = stringMap());
+    /** @brief Create rounded shape pixmap for project tree thumb. */
+    QPixmap roundedPixmap(const QImage &img);
+    QPixmap roundedPixmap(const QPixmap &source);
+    /** @brief Extract a clip's metadata with the exiftool program. */
+    void extractMetadata(DocClipBase *clip);
+    /** @brief Add a special FFmpeg tag if clip matches some properties (for example set full_luma for Sony NEX camcorders. */
+    //void checkCamcorderFilters(DocClipBase *clip, QMap <QString, QString> meta);
 
 private slots:
     void slotClipSelected();
@@ -456,6 +491,14 @@ private slots:
     void slotPrepareJobsMenu();
     /** @brief Discard all jobs for current clip. */
     void slotDiscardClipJobs();
+    /** @brief Make sure current clip is visible in project tree. */
+    void slotCheckScrolling();
+    /** @brief Reset all text and log data from info message widget. */
+    void slotResetInfoMessage();
+    /** @brief close warning info passive popup. */
+    void slotClosePopup();
+    /** @brief process clip job result. */
+    void slotGotFilterJobResults(QString ,int , int, stringMap, stringMap);
 
 signals:
     void clipSelected(DocClipBase *, QPoint zone = QPoint(), bool forceUpdate = false);
@@ -464,7 +507,7 @@ signals:
     void showClipProperties(QList <DocClipBase *>, QMap<QString, QString> commonproperties);
     void projectModified();
     void loadingIsOver();
-    void displayMessage(const QString, int progress);
+    void displayMessage(const QString, int progress, MessageType type = DefaultMessage);
     void clipNameChanged(const QString, const QString);
     void clipNeedsReload(const QString&);
     /** @brief A property affecting display was changed, so we need to update monitors and thumbnails
@@ -478,7 +521,7 @@ signals:
     void updateProfile(const QString &);
     void processNextThumbnail();
     /** @brief Activate the clip monitor. */
-    void raiseClipMonitor();
+    void raiseClipMonitor(bool forceRefresh);
     /** @brief Set number of running jobs. */
     void jobCount(int);
     void cancelRunningJob(const QString, stringMap);
@@ -488,8 +531,12 @@ signals:
     void gotProxy(const QString);
     void checkJobProcess();
     /** @brief A Filter Job produced results, send them back to the clip. */
-    void gotFilterJobResults(const QString &id, int startPos, int track, const QString &filterName, stringMap params);
+    void gotFilterJobResults(const QString &id, int startPos, int track, stringMap params, stringMap extra);
+    void pauseMonitor();
+    void updateAnalysisData(DocClipBase *);
+    void addMarkers(const QString &, QList <CommentedTime>);
 };
 
 #endif
 
+