]> git.sesse.net Git - kdenlive/commitdiff
Do not uselessly switch monitors at startup
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 24 Oct 2011 01:26:01 +0000 (01:26 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 24 Oct 2011 01:26:01 +0000 (01:26 +0000)
svn path=/trunk/kdenlive/; revision=5984

src/monitormanager.cpp
src/monitormanager.h
src/renderer.cpp
src/renderer.h

index 55a570c8e2f7c64d57aa92883f99f543a2a42f05..466501913cb8b6fa9f971152792affd4862ef80b 100644 (file)
 
 #include <QObject>
 #include <QTimer>
-
+#include <KDebug>
 
 MonitorManager::MonitorManager(QWidget *parent) :
         QObject(parent),
         m_clipMonitor(NULL),
         m_projectMonitor(NULL),
-        m_activeMonitor(NULL),
-        m_blocked(false)
+        m_activeMonitor(NULL)
 {
 }
 
@@ -65,7 +64,7 @@ void MonitorManager::removeMonitor(AbstractMonitor *monitor)
 
 void MonitorManager::activateMonitor(QString name)
 {
-    if (m_blocked || m_clipMonitor == NULL || m_projectMonitor == NULL)
+    if (m_clipMonitor == NULL || m_projectMonitor == NULL)
         return;
     if (m_activeMonitor && m_activeMonitor->name() == name)
         return;
@@ -98,7 +97,6 @@ void MonitorManager::slotSwitchMonitors(bool activateClip)
 
 void MonitorManager::stopActiveMonitor()
 {
-    if (m_blocked) return;
     if (m_activeMonitor == m_clipMonitor) m_clipMonitor->pause();
     else m_projectMonitor->pause();
 }
@@ -176,7 +174,6 @@ void MonitorManager::slotEnd()
 
 void MonitorManager::resetProfiles(Timecode tc)
 {
-    if (m_blocked) return;
     m_timecode = tc;
     slotResetProfiles();
     //QTimer::singleShot(300, this, SLOT(slotResetProfiles()));
@@ -184,20 +181,22 @@ void MonitorManager::resetProfiles(Timecode tc)
 
 void MonitorManager::slotResetProfiles()
 {
-    if (m_blocked) return;
     if (m_projectMonitor == NULL || m_clipMonitor == NULL) return;
     blockSignals(true);
     QString active = m_activeMonitor ? m_activeMonitor->name() : QString();
-    activateMonitor("clip");
-    m_clipMonitor->resetProfile(KdenliveSettings::current_profile());
-    m_clipMonitor->updateTimecodeFormat();
-    activateMonitor("project");
-    m_projectMonitor->resetProfile(KdenliveSettings::current_profile());
-    m_projectMonitor->updateTimecodeFormat();
-    //m_projectMonitor->refreshMonitor(true);
+    if (!m_clipMonitor->render->hasProfile(KdenliveSettings::current_profile())) {
+        activateMonitor("clip");
+        m_clipMonitor->resetProfile(KdenliveSettings::current_profile());
+        m_clipMonitor->updateTimecodeFormat();
+    }
+    if (!m_projectMonitor->render->hasProfile(KdenliveSettings::current_profile())) {
+        activateMonitor("project");
+        m_projectMonitor->resetProfile(KdenliveSettings::current_profile());
+        m_projectMonitor->updateTimecodeFormat();
+    }
     if (!active.isEmpty()) activateMonitor(active);
     blockSignals(false);
-    m_activeMonitor->parentWidget()->raise();
+    if (m_activeMonitor) m_activeMonitor->parentWidget()->raise();
     emit checkColorScopes();
 }
 
index 7f35aa4031b8f00fbbe3e23e495ee5413dda8215..9369c5ace6bceeede8cc26929a24b8c8cab1853d 100644 (file)
@@ -76,7 +76,6 @@ private:
     Monitor *m_projectMonitor;
     Timecode m_timecode;
     AbstractMonitor *m_activeMonitor;
-    bool m_blocked;
     QList <AbstractMonitor *>m_monitorsList;
 
 signals:
index 88666e0fab08c0f80456d676900af20ec5416a00..ebee863cd116ae0142af6eed8f44df8ae2a5874c 100644 (file)
@@ -288,10 +288,13 @@ Mlt::Producer *Render::invalidProducer(const QString &id)
     return clip;
 }
 
+bool Render::hasProfile(const QString &profileName) const
+{
+    return m_activeProfile == profileName;
+}
+
 int Render::resetProfile(const QString &profileName, bool dropSceneList)
 {
-    QString scene;
-    if (!dropSceneList) scene = sceneList();
     if (m_mltConsumer) {
         if (m_externalConsumer == KdenliveSettings::external_display()) {
             if (KdenliveSettings::external_display() && m_activeProfile == profileName) return 1;
@@ -312,6 +315,8 @@ int Render::resetProfile(const QString &profileName, bool dropSceneList)
         delete m_mltConsumer;
         m_mltConsumer = NULL;
     }
+    QString scene;
+    if (!dropSceneList) scene = sceneList();
     int pos = 0;
     double current_fps = m_mltProfile->fps();
     double current_dar = m_mltProfile->dar();
index 4fb5b1b5fa6b0c6aa050283378093b9c84158efa..70f91633f8e99a17f8086f4f14deb92ed304802d 100644 (file)
@@ -179,8 +179,11 @@ Q_OBJECT public:
     /** @brief Change the Mlt PROFILE
      * @param profileName The MLT profile name
      * @param dropSceneList If true, the current playlist will be deleted
+     * @return true if the profile was changed
      * . */
     int resetProfile(const QString& profileName, bool dropSceneList = false);
+    /** @brief Returns true if the render uses profileName as current profile. */
+    bool hasProfile(const QString& profileName) const;
     double fps() const;
 
     /** @brief Returns the width of a frame for this profile. */