]> git.sesse.net Git - kdenlive/blobdiff - src/renderwidget.h
Updated the rendering dialog:
[kdenlive] / src / renderwidget.h
index afc586c1efc68e8d6ace585235c217df0bb20b1f..1a0015a00cb94b9a33415d07ed0657071f26007e 100644 (file)
 #include <QDialog>
 #include <QPushButton>
 
+#include "definitions.h"
 #include "ui_renderwidget_ui.h"
 
+
+// RenderViewDelegate is used to draw the progress bars.
+class RenderViewDelegate : public QItemDelegate {
+    Q_OBJECT
+public:
+    RenderViewDelegate(QWidget *parent) : QItemDelegate(parent) {}
+
+    void paint(QPainter *painter, const QStyleOptionViewItem &option,
+               const QModelIndex &index) const {
+        if (index.column() != 1) {
+            QItemDelegate::paint(painter, option, index);
+            return;
+        }
+
+        // Set up a QStyleOptionProgressBar to precisely mimic the
+        // environment of a progress bar.
+        QStyleOptionProgressBar progressBarOption;
+        progressBarOption.state = QStyle::State_Enabled;
+        progressBarOption.direction = QApplication::layoutDirection();
+        progressBarOption.rect = option.rect;
+        progressBarOption.fontMetrics = QApplication::fontMetrics();
+        progressBarOption.minimum = 0;
+        progressBarOption.maximum = 100;
+        progressBarOption.textAlignment = Qt::AlignCenter;
+        progressBarOption.textVisible = true;
+
+        // Set the progress and text values of the style option.
+        int progress = index.data(Qt::UserRole).toInt();
+        progressBarOption.progress = progress < 0 ? 0 : progress;
+        progressBarOption.text = QString().sprintf("%d%%", progressBarOption.progress);
+
+        // Draw the progress bar onto the view.
+        QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter);
+    }
+};
+
+
 class RenderWidget : public QDialog {
     Q_OBJECT
 
 public:
     RenderWidget(QWidget * parent = 0);
-    void setDocumentStandard(QString std);
+    void setGuides(QDomElement guidesxml, double duration);
+    void focusFirstVisibleItem();
+    void setProfile(MltVideoProfile profile);
+    void setRenderJob(const QString &dest, int progress = 0);
+    void setRenderStatus(const QString &dest, int status, const QString &error);
 
 private slots:
     void slotUpdateButtons();
@@ -39,16 +81,24 @@ private slots:
     void refreshView();
     void refreshParams();
     void slotSaveProfile();
+    void slotEditProfile();
     void slotDeleteProfile();
+    void slotUpdateGuideBox();
+    void slotCheckStartGuidePosition();
+    void slotCheckEndGuidePosition();
+    void showInfoPanel();
+    void slotAbortCurrentJob();
 
 private:
     Ui::RenderWidget_UI m_view;
-    QString m_standard;
+    MltVideoProfile m_profile;
     void parseProfiles(QString group = QString(), QString profile = QString());
     void parseFile(QString exportFile, bool editable);
+    void updateButtons();
 
 signals:
-    void doRender(const QString&, const QString&, const QStringList &, bool, bool);
+    void doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double, bool);
+    void abortProcess(const QString &url);
 };