X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fprojectlist.h;h=7d7e384fd4b5f04a2fc6ea676592a6935b39dc94;hb=525c7c608d9f74d569ecbe88f8565eee5d3bfec4;hp=3d25bc71eaddb7356008719feb8f62cb3f83f82f;hpb=39c2d285a59bc005ae3e4880818e8713971dff69;p=kdenlive diff --git a/src/projectlist.h b/src/projectlist.h index 3d25bc71..7d7e384f 100644 --- a/src/projectlist.h +++ b/src/projectlist.h @@ -42,10 +42,6 @@ #include #include -#if KDE_IS_VERSION(4,7,0) -#include -#endif - #ifdef NEPOMUK #include #include @@ -59,6 +55,34 @@ #include "projecttree/abstractclipjob.h" #include +#if KDE_IS_VERSION(4,7,0) +#include +#else +// Dummy KMessageWidget to allow compilation of MyMessageWidget class since Qt's moc doesn work inside #ifdef +#include +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; @@ -80,7 +104,7 @@ class SmallInfoLabel: public QPushButton Q_OBJECT public: SmallInfoLabel(QWidget *parent = 0); - + static const QString getStyleSheet(const QPalette &p); private: QTimeLine* m_timeLine; @@ -148,25 +172,22 @@ public: QRectF bounding; painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , subText, &bounding); - int proxy = index.data(Qt::UserRole + 5).toInt(); - if (proxy != 0 && proxy != JOBDONE) { - QString proxyText; - QColor color; - if (proxy != JOBCRASHED) { - // Draw proxy progress bar - color = option.palette.alternateBase().color(); + 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() - 5, pixmap.width() - 2, 4); + QRect progress(pixmapPoint.x() + 1, pixmapPoint.y() + pixmap.height() - 9, pixmap.width() - 2, 8); painter->drawRect(progress); painter->setBrush(option.palette.text()); - if (proxy > 0) { + if (jobProgress > 0) { progress.adjust(1, 1, 0, -1); - progress.setWidth((pixmap.width() - 4) * proxy / 100); + progress.setWidth((pixmap.width() - 4) * jobProgress / 100); painter->drawRect(progress); - } - else if (proxy == JOBWAITING) { + } else if (jobProgress == JOBWAITING) { // Draw kind of a pause icon progress.adjust(1, 1, 0, -1); progress.setWidth(2); @@ -174,16 +195,15 @@ public: progress.moveLeft(progress.right() + 2); painter->drawRect(progress); } - } - else if (proxy == JOBCRASHED) { - proxyText = index.data(Qt::UserRole + 7).toString(); - if (!proxyText.isEmpty()) { - QRectF txtBounding = painter->boundingRect(r2, Qt::AlignRight | Qt::AlignVCenter, " " + proxyText + " "); + } else if (jobProgress == JOBCRASHED) { + QString jobText = index.data(Qt::UserRole + 7).toString(); + if (!jobText.isEmpty()) { + QRectF txtBounding = painter->boundingRect(r2, Qt::AlignRight | Qt::AlignVCenter, " " + jobText + " "); painter->setPen(Qt::NoPen); painter->setBrush(option.palette.highlight()); painter->drawRoundedRect(txtBounding, 2, 2); painter->setPen(option.palette.highlightedText().color()); - painter->drawText(txtBounding, Qt::AlignHCenter | Qt::AlignVCenter , proxyText); + painter->drawText(txtBounding, Qt::AlignCenter, jobText); } } } @@ -225,6 +245,8 @@ public: void setupGeneratorMenu(const QHash& 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; QDomDocument generateTemplateXml(QString data, const QString &replaceString); void cleanup(); void trashUnusedClips(); @@ -259,9 +281,15 @@ public: void clearSelection(); /** @brief Print required overlays over clip thumb (proxy, stabilized,...). */ void processThumbOverlays(ProjectItem *item, QPixmap &pix); + /** @brief Start an MLT process job. */ + 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 setDocument(KdenliveDoc *doc); void updateAllClips(bool displayRatioChanged, bool fpsChanged, QStringList brokenClips); void slotReplyGetImage(const QString &clipId, const QImage &img); void slotReplyGetImage(const QString &clipId, const QString &name, int width, int height); @@ -299,6 +327,11 @@ public slots: void slotDeleteProxy(const QString proxyPath); /** @brief Start a hard cut clip job. */ void slotCutClipJob(const QString &id, QPoint zone); + /** @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&); + private: ProjectListView *m_listView; @@ -311,8 +344,11 @@ private: ProjectItem *getItemById(const QString &id); QTreeWidgetItem *getAnyItemById(const QString &id); FolderProjectItem *getFolderItemById(const QString &id); + FolderProjectItem *getFolderItemByName(const QString &name); QAction *m_openAction; QAction *m_reloadAction; + QAction *m_discardCurrentClipJobs; + QMenu *m_extractAudioAction; QMenu *m_transcodeAction; QMenu *m_stabilizeAction; KdenliveDoc *m_doc; @@ -328,24 +364,20 @@ private: QMap m_producerQueue; QList m_thumbnailQueue; QAction *m_proxyAction; - QStringList m_processingClips; - /** @brief Holds a list of proxy urls that should be aborted. */ - QStringList m_abortProxy; - /** @brief Holds a list of proxy urls that are currently being created. */ - QStringList m_processingProxy; - QMutex m_mutex; + QMutex m_jobMutex; bool m_abortAllJobs; /** @brief We are cleaning up the project list, so stop processing signals. */ bool m_closing; QList m_jobList; - QFutureSynchronizer m_proxyThreads; + QFutureSynchronizer m_jobThreads; 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 @@ -372,23 +404,27 @@ private: /** @brief Set the Proxy status on a clip. * @param item The clip item to set status + * @param jobType The job type * @param status The job status (see definitions.h) * @param progress The job progress (in percents) - * @param jobType The job type * @param statusMessage The job info message */ - void setJobStatus(ProjectItem *item, CLIPJOBSTATUS status, int progress = 0, JOBTYPE jobType = NOJOBTYPE, const QString &statusMessage = QString()); + void setJobStatus(ProjectItem *item, JOBTYPE jobType, CLIPJOBSTATUS status, int progress = 0, const QString &statusMessage = QString()); void monitorItemEditing(bool enable); /** @brief Get cached thumbnail for a project's clip or create it if no cache. */ void getCachedThumbnail(ProjectItem *item); void getCachedThumbnail(SubProjectItem *item); /** @brief The clip is about to be reloaded, cancel thumbnail requests. */ void resetThumbsProducer(DocClipBase *clip); - /** @brief Check if it is necessary to start a job thread. */ - void startJobProcess(); - /** @brief Check if a clip has a running or pending proxy process. */ - bool hasPendingProxy(ProjectItem *item); + /** @brief Check if a clip has a running or pending job process. */ + bool hasPendingJob(ProjectItem *item, JOBTYPE type); /** @brief Delete pending jobs for a clip. */ void deleteJobsForClip(const QString &clipId); + /** @brief Discard specific job type for a clip. */ + void discardJobs(const QString &id, JOBTYPE type = NOJOBTYPE); + /** @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); private slots: void slotClipSelected(); @@ -402,7 +438,7 @@ private slots: void slotContextMenu(const QPoint &pos, QTreeWidgetItem *item); /** @brief Creates an AddFolderCommand. */ - void slotAddFolder(); + void slotAddFolder(const QString &name = QString()); /** @brief This is triggered when a clip description has been modified. */ void slotItemEdited(QTreeWidgetItem *item, int column); @@ -434,11 +470,26 @@ private slots: /** @brief Discard a running clip jobs. */ void slotCancelRunningJob(const QString id, stringMap); /** @brief Update a clip's job status. */ - void slotProcessLog(ProjectItem *item, int progress, int); - /** @brief A clip fob crashed, inform user. */ - void slotJobCrashed(ProjectItem *item, const QString &label, const QString &actionName = QString(), const QString details = QString()); + void slotProcessLog(const QString, int progress, int, const QString = QString()); + /** @brief A clip job crashed, inform user. */ + void slotUpdateJobStatus(const QString id, int type, int status, const QString label, const QString actionName, const QString details); + void slotUpdateJobStatus(ProjectItem *item, int type, int status, const QString &label, const QString &actionName = QString(), const QString details = QString()); /** @brief Display error log for last failed job. */ void slotShowJobLog(); + /** @brief A proxy clip is ready. */ + void slotGotProxyForId(const QString); + /** @brief Check if it is necessary to start a job thread. */ + void slotCheckJobProcess(); + /** @brief Fill the jobs menu with current clip's jobs. */ + 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(); signals: void clipSelected(DocClipBase *, QPoint zone = QPoint(), bool forceUpdate = false); @@ -465,10 +516,15 @@ signals: /** @brief Set number of running jobs. */ void jobCount(int); void cancelRunningJob(const QString, stringMap); - void processLog(ProjectItem *, int , int); + void processLog(const QString, int , int, const QString = QString()); void addClip(const QString, const QString &, const QString &); - void jobCrashed(ProjectItem *item, const QString &label, const QString &actionName = QString(), const QString details = QString()); + void updateJobStatus(const QString, int, int, const QString label = QString(), const QString actionName = QString(), const QString details = QString()); + 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); }; #endif +