]> git.sesse.net Git - kdenlive/blobdiff - src/renderwidget.cpp
Fix detection of missing codecs in render dialog, use kmessagewidget to inform user
[kdenlive] / src / renderwidget.cpp
index 9fdd7eb894c857dce8a0844efbbcace5b64356fa..39cc878a84708d3332bd70c2fe682b130e4a5571 100644 (file)
@@ -45,6 +45,7 @@
 #include <QDBusConnectionInterface>
 #include <QDBusInterface>
 #include <QThread>
+#include <QScriptEngine>
 
 const int GroupRole = Qt::UserRole;
 const int ExtensionRole = GroupRole + 1;
@@ -54,9 +55,10 @@ const int ParamsRole = GroupRole + 4;
 const int EditableRole = GroupRole + 5;
 const int MetaGroupRole = GroupRole + 6;
 const int ExtraRole = GroupRole + 7;
-const int TwoPassRole = GroupRole + 8;
-const int BitratesRole = GroupRole + 9;
-const int DefaultBitrateRole = GroupRole + 10;
+const int BitratesRole = GroupRole + 8;
+const int DefaultBitrateRole = GroupRole + 9;
+const int AudioBitratesRole = GroupRole + 10;
+const int DefaultAudioBitrateRole = GroupRole + 11;
 
 // Running job status
 const int WAITINGJOB = 0;
@@ -67,8 +69,7 @@ const int FINISHEDJOB = 2;
 RenderWidget::RenderWidget(const QString &projectfolder, bool enableProxy, QWidget * parent) :
         QDialog(parent),
         m_projectFolder(projectfolder),
-        m_blockProcessing(false),
-        m_isPal(true)
+        m_blockProcessing(false)
 {
     m_view.setupUi(this);
     setWindowTitle(i18n("Rendering"));
@@ -97,10 +98,10 @@ RenderWidget::RenderWidget(const QString &projectfolder, bool enableProxy, QWidg
     
     m_view.proxy_render->setHidden(!enableProxy);
 
-       m_view.encoder_threads->setMaximum(QThread::idealThreadCount());
-       m_view.encoder_threads->setValue(KdenliveSettings::encodethreads());
-       connect(m_view.encoder_threads, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateEncodeThreads(int)));
-       
+    m_view.encoder_threads->setMaximum(QThread::idealThreadCount());
+    m_view.encoder_threads->setValue(KdenliveSettings::encodethreads());
+    connect(m_view.encoder_threads, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateEncodeThreads(int)));
+
     m_view.rescale_keep->setChecked(KdenliveSettings::rescalekeepratio());
     connect(m_view.rescale_width, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateRescaleWidth(int)));
     connect(m_view.rescale_height, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateRescaleHeight(int)));
@@ -221,6 +222,20 @@ RenderWidget::RenderWidget(const QString &projectfolder, bool enableProxy, QWidg
         m_view.shutdown->setEnabled(false);
 
     focusFirstVisibleItem();
+    adjustSize();
+
+#if KDE_IS_VERSION(4,7,0)
+    m_infoMessage = new KMessageWidget;
+    QGridLayout *s =  static_cast <QGridLayout*> (m_view.tab->layout());
+    s->addWidget(m_infoMessage, 12, 0, 1, -1);
+    m_infoMessage->hide();
+#endif
+}
+
+QSize RenderWidget::sizeHint() const
+{
+    // Make sure the widget has minimum size on opening
+    return QSize(200, 200);
 }
 
 RenderWidget::~RenderWidget()
@@ -253,7 +268,7 @@ void RenderWidget::showInfoPanel()
     }
 }
 
-void RenderWidget::setDocumentPath(const QString path)
+void RenderWidget::setDocumentPath(const QString &path)
 {
     if (m_view.out_file->url().directory() == KUrl(m_projectFolder).directory()) {
         const QString fileName = m_view.out_file->url().fileName();
@@ -364,7 +379,8 @@ void RenderWidget::slotSaveProfile()
     if (customGroup.isEmpty()) customGroup = i18nc("Group Name", "Custom");
     ui.group_name->setText(customGroup);
 
-    ui.parameters->setText(m_view.advanced_params->toPlainText());
+    QStringList arguments = m_view.advanced_params->toPlainText().split(" ", QString::SkipEmptyParts);
+    ui.parameters->setText(arguments.join(" "));
     ui.extension->setText(m_view.size_list->currentItem()->data(ExtensionRole).toString());
     ui.profile_name->setFocus();
 
@@ -380,7 +396,24 @@ void RenderWidget::slotSaveProfile()
         profileElement.setAttribute("category", newGroupName);
         profileElement.setAttribute("destinationid", newMetaGroupId);
         profileElement.setAttribute("extension", ui.extension->text().simplified());
-        profileElement.setAttribute("args", ui.parameters->toPlainText().simplified());
+        QString args = ui.parameters->toPlainText().simplified();
+        profileElement.setAttribute("args", args);
+        if (args.contains("%bitrate")) {
+            // profile has a variable bitrate
+            profileElement.setAttribute("defaultbitrate", m_view.comboBitrates->currentText());
+            QStringList bitrateValues;
+            for (int i = 0; i < m_view.comboBitrates->count(); i++)
+                bitrateValues << m_view.comboBitrates->itemText(i);
+            profileElement.setAttribute("bitrates", bitrateValues.join(","));
+        }
+        if (args.contains("%audiobitrate")) {
+            // profile has a variable bitrate
+            profileElement.setAttribute("defaultaudiobitrate", m_view.comboAudioBitrates->currentText());
+            QStringList bitrateValues;
+            for (int i = 0; i < m_view.comboAudioBitrates->count(); i++)
+                bitrateValues << m_view.comboAudioBitrates->itemText(i);
+            profileElement.setAttribute("audiobitrates", bitrateValues.join(","));
+        }
         doc.appendChild(profileElement);
         saveProfile(doc.documentElement());
 
@@ -468,6 +501,10 @@ void RenderWidget::slotCopyToFavorites()
     profileElement.setAttribute("destinationid", "favorites");
     profileElement.setAttribute("extension", extension);
     profileElement.setAttribute("args", params);
+    profileElement.setAttribute("bitrates", item->data(BitratesRole).toStringList().join(","));
+    profileElement.setAttribute("defaultbitrate", item->data(DefaultBitrateRole).toString());
+    profileElement.setAttribute("audiobitrates", item->data(AudioBitratesRole).toStringList().join(","));
+    profileElement.setAttribute("defaultaudiobitrate", item->data(DefaultAudioBitrateRole).toString());
     doc.appendChild(profileElement);
     saveProfile(doc.documentElement());
     parseProfiles(m_view.destination_list->itemData(m_view.destination_list->currentIndex(), Qt::UserRole).toString(), currentGroup, currentProfile);
@@ -556,7 +593,25 @@ void RenderWidget::slotEditProfile()
         profileElement.setAttribute("category", newGroupName);
         profileElement.setAttribute("destinationid", newMetaGroupId);
         profileElement.setAttribute("extension", ui.extension->text().simplified());
-        profileElement.setAttribute("args", ui.parameters->toPlainText().simplified());
+        QString args = ui.parameters->toPlainText().simplified();
+        profileElement.setAttribute("args", args);
+        if (args.contains("%bitrate")) {
+            // profile has a variable bitrate
+            profileElement.setAttribute("defaultbitrate", m_view.comboBitrates->currentText());
+            QStringList bitrateValues;
+            for (int i = 0; i < m_view.comboBitrates->count(); i++)
+                bitrateValues << m_view.comboBitrates->itemText(i);
+            profileElement.setAttribute("bitrates", bitrateValues.join(","));
+        }
+        if (args.contains("%audiobitrate")) {
+            // profile has a variable bitrate
+            profileElement.setAttribute("defaultaudiobitrate", m_view.comboAudioBitrates->currentText());
+            QStringList bitrateValues;
+            for (int i = 0; i < m_view.comboAudioBitrates->count(); i++)
+                bitrateValues << m_view.comboAudioBitrates->itemText(i);
+            profileElement.setAttribute("audiobitrates", bitrateValues.join(","));
+        }
+
         profiles.appendChild(profileElement);
 
         //QCString save = doc.toString().utf8();
@@ -731,6 +786,14 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
     if (!scriptExport) render_process_args << "-erase";
     if (KdenliveSettings::usekuiserver()) render_process_args << "-kuiserver";
 
+    // get process id
+    render_process_args << QString("-pid:%1").arg(QCoreApplication::applicationPid());
+
+    // Set locale for render process if required
+    if (QLocale().decimalPoint() != QLocale::system().decimalPoint()) {
+        render_process_args << QString("-locale:%1").arg(QLocale().name());
+    }
+
     double guideStart = 0;
     double guideEnd = 0;
 
@@ -739,12 +802,16 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
         double fps = (double) m_profile.frame_rate_num / m_profile.frame_rate_den;
         guideStart = m_view.guide_start->itemData(m_view.guide_start->currentIndex()).toDouble();
         guideEnd = m_view.guide_end->itemData(m_view.guide_end->currentIndex()).toDouble();
-        render_process_args << "in=" + QString::number(GenTime(guideStart).frames(fps)) << "out=" + QString::number(GenTime(guideEnd).frames(fps));
+        render_process_args << "in=" + QString::number((int) GenTime(guideStart).frames(fps)) << "out=" + QString::number((int) GenTime(guideEnd).frames(fps));
     }
 
     if (!overlayargs.isEmpty()) render_process_args << "preargs=" + overlayargs.join(" ");
 
-    render_process_args << KdenliveSettings::rendererpath() << m_profile.path << item->data(RenderRole).toString();
+    if (scriptExport)
+        render_process_args << "$MELT";
+    else
+        render_process_args << KdenliveSettings::rendererpath();
+    render_process_args << m_profile.path << item->data(RenderRole).toString();
     if (m_view.play_after->isChecked()) render_process_args << KdenliveSettings::KdenliveSettings::defaultplayerapp();
     else render_process_args << "-";
 
@@ -760,7 +827,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
         width = m_profile.width;
         height = m_profile.height;
     }
-    renderArgs.replace("%dar", '@' + QString::number(m_profile.display_aspect_num) + '/' + QString::number(m_profile.display_aspect_den));
+
     //renderArgs.replace("%width", QString::number((int)(m_profile.height * m_profile.display_aspect_num / (double) m_profile.display_aspect_den + 0.5)));
     //renderArgs.replace("%height", QString::number((int)m_profile.height));
 
@@ -772,17 +839,11 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
     if (!exportAudio) renderArgs.append(" an=1 ");
 
     // Set the thread counts
-    renderArgs.append(QString(" threads=%1").arg(KdenliveSettings::encodethreads()));
+    if (!renderArgs.contains("threads=")) {
+        renderArgs.append(QString(" threads=%1").arg(KdenliveSettings::encodethreads()));
+    }
     renderArgs.append(QString(" real_time=-%1").arg(KdenliveSettings::mltthreads()));
 
-    // 2 pass
-    if (m_view.checkTwoPass->isEnabled() && m_view.checkTwoPass->isChecked())
-        renderArgs.append(" pass=2");
-
-    // bitrate
-    if (m_view.comboBitrates->isEnabled())
-        renderArgs.replace("%bitrate", m_view.comboBitrates->currentText());
-
     // Check if the rendering profile is different from project profile,
     // in which case we need to use the producer_comsumer from MLT
     QString std = renderArgs;
@@ -802,13 +863,28 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
     }
     bool resizeProfile = (subsize != currentSize);
     QStringList paramsList = renderArgs.split(" ", QString::SkipEmptyParts);
-    for (int i = 0; i < paramsList.count(); i++) {
-        if (paramsList.at(i).startsWith("profile=")) {
-            if (paramsList.at(i).section('=', 1) != m_profile.path) resizeProfile = true;
-            break;
+
+    QScriptEngine sEngine;
+    sEngine.globalObject().setProperty("bitrate", m_view.comboBitrates->currentText());
+    sEngine.globalObject().setProperty("audiobitrate", m_view.comboAudioBitrates->currentText());
+    sEngine.globalObject().setProperty("dar", '@' + QString::number(m_profile.display_aspect_num) + '/' + QString::number(m_profile.display_aspect_den));
+    sEngine.globalObject().setProperty("passes", static_cast<int>(m_view.checkTwoPass->isChecked()) + 1);
+
+    for (int i = 0; i < paramsList.count(); ++i) {
+        QString paramName = paramsList.at(i).section('=', 0, 0);
+        QString paramValue = paramsList.at(i).section('=', 1, 1);
+        // If the profiles do not match we need to use the consumer tag
+        if (paramName == "mlt_profile=" && paramValue != m_profile.path) {
+            resizeProfile = true;
+        }
+        // evaluate expression
+        if (paramValue.startsWith('%')) {
+            paramValue = sEngine.evaluate(paramValue.remove(0, 1)).toString();
+            paramsList[i] = paramName + '=' + paramValue;
         }
+        sEngine.globalObject().setProperty(paramName.toUtf8().constData(), paramValue);
     }
-       
+
     if (resizeProfile)
         render_process_args << "consumer:" + (scriptExport ? "$SOURCE" : playlistPath);
     else
@@ -831,9 +907,9 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
         outStream << "SOURCE=" << "\"" + playlistPath + "\"" << "\n";
         outStream << "TARGET=" << "\"" + KUrl(dest).url() + "\"" << "\n";
         outStream << "RENDERER=" << "\"" + m_renderer + "\"" << "\n";
-        outStream << "MELT=" << "\"" + render_process_args.takeFirst() + "\"" << "\n";
+        outStream << "MELT=" << "\"" + KdenliveSettings::rendererpath() + "\"" << "\n";
         outStream << "PARAMETERS=" << "\"" + render_process_args.join(" ") + "\"" << "\n";
-        outStream << "$RENDERER $MELT $PARAMETERS" << "\n" << "\n";
+        outStream << "$RENDERER $PARAMETERS" << "\n" << "\n";
         if (file.error() != QFile::NoError) {
             KMessageBox::error(this, i18n("Cannot write to file %1", scriptPath));
             file.close();
@@ -897,9 +973,9 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
     if (group == "dvd") {
         if (m_view.open_dvd->isChecked()) {
             renderItem->setData(0, Qt::UserRole, group);
-            if (renderArgs.contains("profile=")) {
+            if (renderArgs.contains("mlt_profile=")) {
                 // rendering profile contains an MLT profile, so pass it to the running jog item, useful for dvd
-                QString prof = renderArgs.section("profile=", 1, 1);
+                QString prof = renderArgs.section("mlt_profile=", 1, 1);
                 prof = prof.section(' ', 0, 0);
                 kDebug() << "// render profile: " << prof;
                 renderItem->setData(0, Qt::UserRole + 1, prof);
@@ -953,7 +1029,9 @@ void RenderWidget::startRendering(QTreeWidgetItem *item)
             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 {
+            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) {
@@ -979,11 +1057,6 @@ int RenderWidget::waitingJobsCount() const
 void RenderWidget::setProfile(MltVideoProfile profile)
 {
     m_profile = profile;
-    //WARNING: this way to tell the video standard is a bit hackish...
-    if (m_profile.description.contains("pal", Qt::CaseInsensitive) || m_profile.description.contains("25", Qt::CaseInsensitive) || m_profile.description.contains("50", Qt::CaseInsensitive))
-        m_isPal = true;
-    else
-        m_isPal = false;
     m_view.scanning_list->setCurrentIndex(0);
     m_view.rescale_width->setValue(KdenliveSettings::defaultrescalewidth());
     if (!m_view.rescale_keep->isChecked()) {
@@ -1035,7 +1108,9 @@ void RenderWidget::refreshCategory()
     }
     if (!item) {
         m_view.format_list->setEnabled(false);
+        m_view.format_list->clear();
         m_view.size_list->setEnabled(false);
+        m_view.size_list->clear();
         m_view.size_list->blockSignals(false);
         m_view.format_list->blockSignals(false);
         return;
@@ -1063,11 +1138,7 @@ void RenderWidget::refreshView()
     if (m_view.destination_list->currentIndex() > 0)
         destination = m_view.destination_list->itemData(m_view.destination_list->currentIndex()).toString();
     KIcon brokenIcon("dialog-close");
-
-    if (m_view.format_list->currentItem()->data(TwoPassRole).canConvert(QVariant::Bool))
-        m_view.checkTwoPass->setEnabled(m_view.format_list->currentItem()->data(TwoPassRole).toBool());
-    else
-        m_view.checkTwoPass->setEnabled(true);
+    KIcon warningIcon("dialog-warning");
 
     const QStringList formatsList = KdenliveSettings::supportedformats();
     const QStringList vcodecsList = KdenliveSettings::videocodecs();
@@ -1084,8 +1155,9 @@ void RenderWidget::refreshView()
         if ((sizeItem->data(GroupRole).toString() == group || sizeItem->data(GroupRole).toString().isEmpty()) && sizeItem->data(MetaGroupRole).toString() == destination) {
             std = sizeItem->data(StandardRole).toString();
             if (!std.isEmpty()) {
-                if (std.contains("PAL", Qt::CaseInsensitive) && m_isPal) dupItem = sizeItem->clone();
-                else if (std.contains("NTSC", Qt::CaseInsensitive) && !m_isPal)  dupItem = sizeItem->clone();
+                if ((std.contains("PAL", Qt::CaseInsensitive) && m_profile.frame_rate_num == 25 && m_profile.frame_rate_den == 1) ||
+                    (std.contains("NTSC", Qt::CaseInsensitive) && m_profile.frame_rate_num == 30000 && m_profile.frame_rate_den == 1001))
+                    dupItem = sizeItem->clone();
             } else {
                 dupItem = sizeItem->clone();
             }
@@ -1094,8 +1166,8 @@ void RenderWidget::refreshView()
                 m_view.size_list->addItem(dupItem);
                 std = dupItem->data(ParamsRole).toString();
                 // Make sure the selected profile uses the same frame rate as project profile
-                if (std.contains("profile=")) {
-                    QString profile = std.section("profile=", 1, 1).section(' ', 0, 0);
+                if (std.contains("mlt_profile=")) {
+                    QString profile = std.section("mlt_profile=", 1, 1).section(' ', 0, 0);
                     MltVideoProfile p = ProfilesDialog::getVideoProfile(profile);
                     if (p.frame_rate_den > 0) {
                         double profile_rate = (double) p.frame_rate_num / p.frame_rate_den;
@@ -1157,14 +1229,24 @@ void RenderWidget::refreshView()
                         }
                     }
                 }
+                if (std.contains(" profile=") || std.startsWith("profile=")) {
+                    // changed in MLT commit d8a3a5c9190646aae72048f71a39ee7446a3bd45
+                    // (http://www.mltframework.org/gitweb/mlt.git?p=mltframework.org/mlt.git;a=commit;h=d8a3a5c9190646aae72048f71a39ee7446a3bd45)
+                    dupItem->setToolTip(i18n("This render profile uses a 'profile' parameter.<br />Unless you know what you are doing you will probably have to change it to 'mlt_profile'."));
+                    dupItem->setIcon(warningIcon);
+                }
             }
         }
     }
     // m_view.size_list->sortItems();
     focusFirstVisibleItem();
+    m_view.size_list->setVisible(m_view.size_list->count() > 1 || m_view.format_list->count() <= 1);
     m_view.size_list->blockSignals(false);
     m_view.format_list->blockSignals(false);
-    refreshParams();
+    if (m_view.size_list->count() > 0)
+        refreshParams();
+    else
+        m_view.advanced_params->clear();
 }
 
 KUrl RenderWidget::filenameWithExtension(KUrl url, QString extension)
@@ -1194,13 +1276,13 @@ void RenderWidget::refreshParams()
 {
     // Format not available (e.g. codec not installed); Disable start button
     QListWidgetItem *item = m_view.size_list->currentItem();
-    errorMessage(item->toolTip());
     if (!item || item->isHidden()) {
         m_view.advanced_params->clear();
         m_view.buttonRender->setEnabled(false);
         m_view.buttonGenerateScript->setEnabled(false);
         return;
     }
+    errorMessage(item->toolTip());
     QString params = item->data(ParamsRole).toString();
     QString extension = item->data(ExtensionRole).toString();
     m_view.advanced_params->setPlainText(params);
@@ -1236,16 +1318,41 @@ void RenderWidget::refreshParams()
 
     // setup comboBox with bitrates
     m_view.comboBitrates->clear();
-    if (item->data(BitratesRole).canConvert(QVariant::StringList) && item->data(BitratesRole).toStringList().count()) {
+    if (params.contains("bitrate")) {
         m_view.comboBitrates->setEnabled(true);
-        QStringList bitrates = item->data(BitratesRole).toStringList();
-        foreach (QString bitrate, bitrates)
-            m_view.comboBitrates->addItem(bitrate);
-        if (item->data(DefaultBitrateRole).canConvert(QVariant::String))
-            m_view.comboBitrates->setCurrentIndex(bitrates.indexOf(item->data(DefaultBitrateRole).toString()));
+        m_view.bitrateLabel->setEnabled(true);
+        if ( item->data(BitratesRole).canConvert(QVariant::StringList) && item->data(BitratesRole).toStringList().count()) {
+            QStringList bitrates = item->data(BitratesRole).toStringList();
+            foreach (QString bitrate, bitrates)
+                m_view.comboBitrates->addItem(bitrate);
+            if (item->data(DefaultBitrateRole).canConvert(QVariant::String))
+                m_view.comboBitrates->setCurrentIndex(bitrates.indexOf(item->data(DefaultBitrateRole).toString()));
+        }
     } else {
         m_view.comboBitrates->setEnabled(false);
+        m_view.bitrateLabel->setEnabled(false);
+    }
+
+    // setup comboBox with audiobitrates
+    m_view.comboAudioBitrates->clear();
+    if (params.contains("audiobitrate")) {
+        m_view.comboAudioBitrates->setEnabled(true);
+        m_view.audiobitrateLabel->setEnabled(true);
+        if ( item->data(AudioBitratesRole).canConvert(QVariant::StringList) && item->data(AudioBitratesRole).toStringList().count()) {
+            QStringList audiobitrates = item->data(AudioBitratesRole).toStringList();
+            foreach (QString bitrate, audiobitrates)
+                m_view.comboAudioBitrates->addItem(bitrate);
+            if (item->data(DefaultAudioBitrateRole).canConvert(QVariant::String))
+                m_view.comboAudioBitrates->setCurrentIndex(audiobitrates.indexOf(item->data(DefaultAudioBitrateRole).toString()));
+        }
+    } else {
+        m_view.comboAudioBitrates->setEnabled(false);
+        m_view.audiobitrateLabel->setEnabled(false);
     }
+    
+    m_view.checkTwoPass->setEnabled(params.contains("passes"));
+
+    m_view.encoder_threads->setEnabled(!params.contains("threads="));
 
     m_view.buttonRender->setEnabled(m_view.size_list->currentItem()->toolTip().isEmpty());
     m_view.buttonGenerateScript->setEnabled(m_view.size_list->currentItem()->toolTip().isEmpty());
@@ -1429,6 +1536,10 @@ void RenderWidget::parseFile(QString exportFile, bool editable)
             item->setData(RenderRole, "avformat");
             item->setData(StandardRole, standard);
             item->setData(ParamsRole, params);
+            item->setData(BitratesRole, profile.attribute("bitrates").split(',', QString::SkipEmptyParts));
+            item->setData(DefaultBitrateRole, profile.attribute("defaultbitrate"));
+            item->setData(AudioBitratesRole, profile.attribute("audiobitrates").split(',', QString::SkipEmptyParts));
+            item->setData(DefaultAudioBitrateRole, profile.attribute("defaultaudiobitrate"));
             if (profile.hasAttribute("url")) item->setData(ExtraRole, profile.attribute("url"));
             if (editable) {
                 item->setData(EditableRole, exportFile);
@@ -1450,8 +1561,7 @@ void RenderWidget::parseFile(QString exportFile, bool editable)
     QString renderer;
     QString params;
     QString standard;
-    QString twoPass;
-    QString bitrates, defaultBitrate;
+    QString bitrates, defaultBitrate, audioBitrates, defaultAudioBitrate;
     KIcon icon;
 
     while (!groups.item(i).isNull()) {
@@ -1476,7 +1586,6 @@ void RenderWidget::parseFile(QString exportFile, bool editable)
         groupName = documentElement.attribute("name", i18nc("Attribute Name", "Custom"));
         extension = documentElement.attribute("extension", QString());
         renderer = documentElement.attribute("renderer", QString());
-        twoPass = documentElement.attribute("twopass", "true");
         bool exists = false;
         for (int j = 0; j < m_renderCategory.count(); j++) {
             if (m_renderCategory.at(j)->text() == groupName && m_renderCategory.at(j)->data(MetaGroupRole) == metagroupId) {
@@ -1487,7 +1596,6 @@ void RenderWidget::parseFile(QString exportFile, bool editable)
         if (!exists) {
             QListWidgetItem *itemcat = new QListWidgetItem(groupName); //, m_view.format_list);
             itemcat->setData(MetaGroupRole, metagroupId);
-            itemcat->setData(TwoPassRole, twoPass == "false" ? false : true);
             m_renderCategory.append(itemcat);
         }
 
@@ -1502,6 +1610,8 @@ void RenderWidget::parseFile(QString exportFile, bool editable)
             standard = profileElement.attribute("standard");
             bitrates = profileElement.attribute("bitrates");
             defaultBitrate = profileElement.attribute("defaultbitrate");
+            audioBitrates = profileElement.attribute("audiobitrates");
+            defaultAudioBitrate = profileElement.attribute("defaultaudiobitrate");
             params = profileElement.attribute("args");
 
             if (replaceVorbisCodec && params.contains("acodec=vorbis")) {
@@ -1524,6 +1634,8 @@ void RenderWidget::parseFile(QString exportFile, bool editable)
             item->setData(ParamsRole, params);
             item->setData(BitratesRole, bitrates.split(',', QString::SkipEmptyParts));
             item->setData(DefaultBitrateRole, defaultBitrate);
+            item->setData(AudioBitratesRole, audioBitrates.split(',', QString::SkipEmptyParts));
+            item->setData(DefaultAudioBitrateRole, defaultAudioBitrate);
             if (profileElement.hasAttribute("url")) item->setData(ExtraRole, profileElement.attribute("url"));
             if (editable) item->setData(EditableRole, exportFile);
             m_renderItems.append(item);
@@ -1713,12 +1825,12 @@ void RenderWidget::parseScriptFiles()
         item->setData(1, Qt::UserRole, KUrl(target).path());
         item->setData(1, Qt::UserRole + 1, scriptpath.path());
     }
-    bool activate = false;
+//     bool activate = false;
     QTreeWidgetItem *script = m_view.scripts_list->topLevelItem(0);
     if (script) {
         m_view.scripts_list->setCurrentItem(script);
         script->setSelected(true);
-        activate = true;
+//         activate = true;
     }
 //    m_view.start_script->setEnabled(activate);
 //    m_view.delete_script->setEnabled(activate);
@@ -1931,12 +2043,23 @@ void RenderWidget::missingClips(bool hasMissing)
 void RenderWidget::errorMessage(const QString &message)
 {
     if (!message.isEmpty()) {
+#if KDE_IS_VERSION(4,7,0)
+        m_infoMessage->setMessageType(KMessageWidget::Warning);
+        m_infoMessage->setText(message);
+        m_infoMessage->animatedShow();
+#else
         m_view.errorLabel->setText(message);
         m_view.errorBox->setHidden(false);
+#endif
     }
     else {
+#if KDE_IS_VERSION(4,7,0)
+        m_infoMessage->animatedHide();
+#else
         m_view.errorBox->setHidden(true);
         m_view.errorLabel->setText(QString());
+#endif
+
     }
 }