]> git.sesse.net Git - kdenlive/commitdiff
Inform user when no render profile is available (usually because frame rate not matching)
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 19 Nov 2011 20:11:59 +0000 (21:11 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 19 Nov 2011 20:11:59 +0000 (21:11 +0100)
src/definitions.h
src/mainwindow.cpp
src/renderwidget.cpp
src/renderwidget.h

index 1a3a255769ca9f47a027050d24c3c213173eb6f7..f37a36335e2de6e6f35c919ed3ac65ee24c64589 100644 (file)
@@ -97,6 +97,22 @@ struct MltVideoProfile {
     int display_aspect_num;
     int display_aspect_den;
     int colorspace;
+    bool operator==(const MltVideoProfile& point) const
+    {
+        if (!description.isEmpty() && point.description  == description) return true;
+        return      point.frame_rate_num == frame_rate_num &&
+                    point.frame_rate_den  == frame_rate_den  &&
+                    point.width == width &&
+                    point.height == height &&
+                    point.progressive == progressive &&
+                    point.sample_aspect_num == sample_aspect_num &&
+                    point.sample_aspect_den == sample_aspect_den &&
+                    point.display_aspect_den == display_aspect_den &&
+                    point.colorspace == colorspace;
+    }
+    bool operator!=(const MltVideoProfile &other) const {
+        return !(*this == other);
+    }
 };
 
 
index e073b9d4fa1bf1b1167a99b28f5a5483c66c9efb..e01b5e259611a91ee4d51f05a861fc7ca7617b71 100644 (file)
@@ -2351,7 +2351,9 @@ void MainWindow::slotRenderProject()
 {
     if (!m_renderWidget) {
         QString projectfolder = m_activeDocument ? m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) : KdenliveSettings::defaultprojectfolder();
-        m_renderWidget = new RenderWidget(projectfolder, m_projectList->useProxy(), this);
+        MltVideoProfile profile;
+        if (m_activeDocument) profile = m_activeDocument->mltProfile();
+        m_renderWidget = new RenderWidget(projectfolder, m_projectList->useProxy(), profile, this);
         connect(m_renderWidget, SIGNAL(shutdown()), this, SLOT(slotShutdown()));
         connect(m_renderWidget, SIGNAL(selectedRenderProfile(QMap <QString, QString>)), this, SLOT(slotSetDocumentRenderProfile(QMap <QString, QString>)));
         connect(m_renderWidget, SIGNAL(prepareRenderingData(bool, bool, const QString&)), this, SLOT(slotPrepareRendering(bool, bool, const QString&)));
index 121a1d8bcd038212debc99a367e532b41dd57ce2..24132878933ba613eae9e7e05b3e4bbedc613049 100644 (file)
@@ -66,9 +66,10 @@ const int RUNNINGJOB = 1;
 const int FINISHEDJOB = 2;
 
 
-RenderWidget::RenderWidget(const QString &projectfolder, bool enableProxy, QWidget * parent) :
+RenderWidget::RenderWidget(const QString &projectfolder, bool enableProxy, MltVideoProfile profile, QWidget * parent) :
         QDialog(parent),
         m_projectFolder(projectfolder),
+        m_profile(profile),
         m_blockProcessing(false)
 {
     m_view.setupUi(this);
@@ -1057,7 +1058,6 @@ int RenderWidget::waitingJobsCount() const
 
 void RenderWidget::setProfile(MltVideoProfile profile)
 {
-    m_profile = profile;
     m_view.scanning_list->setCurrentIndex(0);
     m_view.rescale_width->setValue(KdenliveSettings::defaultrescalewidth());
     if (!m_view.rescale_keep->isChecked()) {
@@ -1065,7 +1065,10 @@ void RenderWidget::setProfile(MltVideoProfile profile)
         m_view.rescale_height->setValue(KdenliveSettings::defaultrescaleheight());
         m_view.rescale_height->blockSignals(false);
     }
-    refreshView();
+    if (m_profile != profile) {
+        m_profile = profile;
+        refreshView();
+    }
 }
 
 void RenderWidget::refreshCategory()
@@ -1244,10 +1247,14 @@ void RenderWidget::refreshView()
     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);
-    if (m_view.size_list->count() > 0)
+    if (m_view.size_list->count() > 0) {
         refreshParams();
-    else
+    }
+    else {
+        // No matching profile
+        errorMessage(i18n("No matching profile"));
         m_view.advanced_params->clear();
+    }
 }
 
 KUrl RenderWidget::filenameWithExtension(KUrl url, QString extension)
@@ -1278,6 +1285,7 @@ void RenderWidget::refreshParams()
     // Format not available (e.g. codec not installed); Disable start button
     QListWidgetItem *item = m_view.size_list->currentItem();
     if (!item || item->isHidden()) {
+        if (!item) errorMessage(i18n("No matching profile"));
         m_view.advanced_params->clear();
         m_view.buttonRender->setEnabled(false);
         m_view.buttonGenerateScript->setEnabled(false);
index b6137b181d88f17c53db5786249b9e591134b372..c43cf62ed01a0bb0f5e4878a7fa042b31ccf67cf 100644 (file)
@@ -114,7 +114,7 @@ class RenderWidget : public QDialog
     Q_OBJECT
 
 public:
-    explicit RenderWidget(const QString &projectfolder, bool enableProxy, QWidget * parent = 0);
+    explicit RenderWidget(const QString &projectfolder, bool enableProxy, MltVideoProfile profile, QWidget * parent = 0);
     virtual ~RenderWidget();
     void setGuides(QDomElement guidesxml, double duration);
     void focusFirstVisibleItem();