]> git.sesse.net Git - kdenlive/blobdiff - src/renderwidget.h
Default rendering path should be the project folder:
[kdenlive] / src / renderwidget.h
index d4a86e3a3746903e40fd7ea970e133a49cec2a2d..f903f07bee20cae42e4e43644b8c972db29be23a 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <QDialog>
 #include <QPushButton>
+#include <QPainter>
 
 #include "definitions.h"
 #include "ui_renderwidget_ui.h"
@@ -36,17 +37,46 @@ public:
 
     void paint(QPainter *painter, const QStyleOptionViewItem &option,
                const QModelIndex &index) const {
-        if (index.column() != 1) {
+        if (index.column() == 0) {
             QItemDelegate::paint(painter, option, index);
             return;
+        } else if (index.column() == 1) {
+            QRect r1 = option.rect;
+            painter->save();
+            if (option.state & (QStyle::State_Selected)) {
+                painter->setPen(option.palette.color(QPalette::HighlightedText));
+                painter->fillRect(r1, option.palette.highlight());
+            } else painter->setPen(option.palette.color(QPalette::Text));
+            QFont font = painter->font();
+            font.setBold(true);
+            painter->setFont(font);
+            int mid = (int)((r1.height() / 2));
+            r1.setBottom(r1.y() + mid);
+            QRect r2 = option.rect;
+            r2.setTop(r2.y() + mid);
+            painter->drawText(r1, Qt::AlignLeft | Qt::AlignBottom , index.data().toString());
+            font.setBold(false);
+            painter->setFont(font);
+            painter->setPen(option.palette.color(QPalette::Mid));
+            painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , index.data(Qt::UserRole).toString());
+            painter->restore();
+            return;
         }
-
         // Set up a QStyleOptionProgressBar to precisely mimic the
         // environment of a progress bar.
         QStyleOptionProgressBar progressBarOption;
-        progressBarOption.state = QStyle::State_Enabled;
+        progressBarOption.state = option.state;
         progressBarOption.direction = QApplication::layoutDirection();
-        progressBarOption.rect = option.rect;
+        QRect rect = option.rect;
+        if (option.state & (QStyle::State_Selected)) {
+            painter->setPen(option.palette.color(QPalette::HighlightedText));
+            painter->fillRect(rect, option.palette.highlight());
+        }
+
+        int mid = rect.height() / 2;
+        rect.setTop(rect.top() + mid / 2);
+        rect.setHeight(mid);
+        progressBarOption.rect = rect;
         progressBarOption.fontMetrics = QApplication::fontMetrics();
         progressBarOption.minimum = 0;
         progressBarOption.maximum = 100;
@@ -68,12 +98,13 @@ class RenderWidget : public QDialog {
     Q_OBJECT
 
 public:
-    RenderWidget(QWidget * parent = 0);
+    RenderWidget(const QString &projectfolder, QWidget * parent = 0);
     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);
+    void setDocumentPath(const QString path);
 
 private slots:
     void slotUpdateButtons(KUrl url);
@@ -93,6 +124,7 @@ private slots:
 private:
     Ui::RenderWidget_UI m_view;
     MltVideoProfile m_profile;
+    QString m_projectFolder;
     void parseProfiles(QString group = QString(), QString profile = QString());
     void parseFile(QString exportFile, bool editable);
     void updateButtons();