]> git.sesse.net Git - kdenlive/blobdiff - src/renderwidget.cpp
Position of z-index number field changed
[kdenlive] / src / renderwidget.cpp
index fc011e23d67c43bdc009aa35380665ead8983159..100af3434a20a47f8c06655dd20f7543fcf7749c 100644 (file)
@@ -121,6 +121,7 @@ RenderWidget::RenderWidget(const QString &projectfolder, QWidget * parent) :
     connect(m_view.buttonEdit, SIGNAL(clicked()), this, SLOT(slotEditProfile()));
     connect(m_view.buttonDelete, SIGNAL(clicked()), this, SLOT(slotDeleteProfile()));
     connect(m_view.abort_job, SIGNAL(clicked()), this, SLOT(slotAbortCurrentJob()));
+    connect(m_view.start_job, SIGNAL(clicked()), this, SLOT(slotStartCurrentJob()));
     connect(m_view.clean_up, SIGNAL(clicked()), this, SLOT(slotCLeanUpJobs()));
     connect(m_view.hide_log, SIGNAL(clicked()), this, SLOT(slotHideLog()));
 
@@ -839,23 +840,7 @@ void RenderWidget::checkRenderStatus()
         if (item->data(1, Qt::UserRole + 2).toInt() == WAITINGJOB) {
             item->setData(1, Qt::UserRole + 1, QTime::currentTime());
             waitingJob = true;
-            if (item->data(1, Qt::UserRole + 4).isNull()) {
-                // Normal render process
-                if (QProcess::startDetached(m_renderer, item->data(1, Qt::UserRole + 3).toStringList()) == false) {
-                    item->setData(1, Qt::UserRole + 2, FINISHEDJOB);
-                    item->setData(1, Qt::UserRole, i18n("Rendering crashed"));
-                    item->setIcon(0, KIcon("dialog-close"));
-                    item->setData(2, Qt::UserRole, 100);
-                } else KNotification::event("RenderStarted", i18n("Rendering <i>%1</i> started", item->text(1)), QPixmap(), this);
-            } else {
-                // Script item
-                if (QProcess::startDetached(item->data(1, Qt::UserRole + 3).toString()) == false) {
-                    item->setData(1, Qt::UserRole + 2, FINISHEDJOB);
-                    item->setData(1, Qt::UserRole, i18n("Rendering crashed"));
-                    item->setIcon(0, KIcon("dialog-close"));
-                    item->setData(2, Qt::UserRole, 100);
-                }
-            }
+            startRendering(item);
             break;
         }
         item = m_view.running_jobs->itemBelow(item);
@@ -863,6 +848,27 @@ void RenderWidget::checkRenderStatus()
     if (waitingJob == false && m_view.shutdown->isChecked()) emit shutdown();
 }
 
+void RenderWidget::startRendering(QTreeWidgetItem *item)
+{
+    if (item->data(1, Qt::UserRole + 4).isNull()) {
+        // Normal render process
+        if (QProcess::startDetached(m_renderer, item->data(1, Qt::UserRole + 3).toStringList()) == false) {
+            item->setData(1, Qt::UserRole + 2, FINISHEDJOB);
+            item->setData(1, Qt::UserRole, i18n("Rendering crashed"));
+            item->setIcon(0, KIcon("dialog-close"));
+            item->setData(2, Qt::UserRole, 100);
+        } else KNotification::event("RenderStarted", i18n("Rendering <i>%1</i> started", item->text(1)), QPixmap(), this);
+    } else {
+        // Script item
+        if (QProcess::startDetached(item->data(1, Qt::UserRole + 3).toString()) == false) {
+            item->setData(1, Qt::UserRole + 2, FINISHEDJOB);
+            item->setData(1, Qt::UserRole, i18n("Rendering crashed"));
+            item->setIcon(0, KIcon("dialog-close"));
+            item->setData(2, Qt::UserRole, 100);
+        }
+    }
+}
+
 int RenderWidget::waitingJobsCount() const
 {
     int count = 0;
@@ -1170,7 +1176,7 @@ void RenderWidget::parseFile(QString exportFile, bool editable)
     bool replaceVorbisCodec = false;
     if (!acodecsList.contains("vorbis") && acodecsList.contains("libvorbis")) replaceVorbisCodec = true;
     bool replaceLibfaacCodec = false;
-    if (!acodecsList.contains("libfaac") && acodecsList.contains("aac")) replaceLibfaacCodec = true;
+    if (!acodecsList.contains("aac") && acodecsList.contains("libfaac")) replaceLibfaacCodec = true;
 
 
     if (editable || groups.count() == 0) {
@@ -1224,9 +1230,9 @@ void RenderWidget::parseFile(QString exportFile, bool editable)
                 // replace vorbis with libvorbis
                 params = params.replace("vorbis", "libvorbis");
             }
-            if (replaceLibfaacCodec && params.contains("acodec=libfaac")) {
+            if (replaceLibfaacCodec && params.contains("acodec=aac")) {
                 // replace libfaac with aac
-                params = params.replace("libfaac", "aac");
+                params = params.replace("aac", "libfaac");
             }
 
             QString category = profile.attribute("category", i18n("Custom"));
@@ -1340,9 +1346,9 @@ void RenderWidget::parseFile(QString exportFile, bool editable)
                 // replace vorbis with libvorbis
                 params = params.replace("vorbis", "libvorbis");
             }
-            if (replaceLibfaacCodec && params.contains("acodec=libfaac")) {
+            if (replaceLibfaacCodec && params.contains("acodec=aac")) {
                 // replace libfaac with aac
-                params = params.replace("libfaac", "aac");
+                params = params.replace("aac", "libfaac");
             }
 
             prof_extension = profileElement.attribute("extension");
@@ -1451,14 +1457,26 @@ void RenderWidget::slotAbortCurrentJob()
     }
 }
 
+void RenderWidget::slotStartCurrentJob()
+{
+    QTreeWidgetItem *current = m_view.running_jobs->currentItem();
+    if (current && current->data(1, Qt::UserRole + 2).toInt() == WAITINGJOB)
+        startRendering(current);
+    m_view.start_job->setEnabled(false);
+}
+
 void RenderWidget::slotCheckJob()
 {
     bool activate = false;
     QTreeWidgetItem *current = m_view.running_jobs->currentItem();
     if (current) {
-        if (current->data(1, Qt::UserRole + 2).toInt() == RUNNINGJOB)
+        if (current->data(1, Qt::UserRole + 2).toInt() == RUNNINGJOB) {
             m_view.abort_job->setText(i18n("Abort Job"));
-        else m_view.abort_job->setText(i18n("Remove Job"));
+            m_view.start_job->setEnabled(false);
+        } else {
+            m_view.abort_job->setText(i18n("Remove Job"));
+            m_view.start_job->setEnabled(current->data(1, Qt::UserRole + 2).toInt() == WAITINGJOB);
+        }
         activate = true;
     }
     m_view.abort_job->setEnabled(activate);