]> git.sesse.net Git - kdenlive/blobdiff - src/monitormanager.cpp
Improve profile autodetection
[kdenlive] / src / monitormanager.cpp
index 9348c9de88e1a1026d0b53c299404cf3092bcebc..b482a92f5e73b0649b7ff455c4d598c3aec84467 100644 (file)
@@ -48,8 +48,10 @@ void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor)
 
 void MonitorManager::activateMonitor(QString name)
 {
-    if (m_blocked || m_clipMonitor == NULL) return;
-    if (m_activeMonitor == name) return;
+    if (m_blocked || m_clipMonitor == NULL || m_projectMonitor == NULL)
+        return;
+    if (m_activeMonitor == name)
+        return;
     if (name == "clip") {
         m_projectMonitor->stop();
         m_clipMonitor->start();
@@ -60,22 +62,15 @@ void MonitorManager::activateMonitor(QString name)
         emit raiseClipMonitor(false);
     }
     m_activeMonitor = name;
+    emit checkColorScopes();
 }
 
 void MonitorManager::slotSwitchMonitors(bool activateClip)
 {
-    if (m_blocked || m_clipMonitor == NULL) return;
-    if (!activateClip && m_clipMonitor->isActive()) {
-        m_clipMonitor->stop();
-        m_projectMonitor->start();
-        m_activeMonitor = m_projectMonitor->name();
-        emit raiseClipMonitor(false);
-    } else if (activateClip && m_projectMonitor->isActive()) {
-        m_projectMonitor->stop();
-        m_clipMonitor->start();
-        m_activeMonitor = m_clipMonitor->name();
-        emit raiseClipMonitor(true);
-    }
+    if (activateClip)
+        activateMonitor("clip");
+    else
+        activateMonitor("project");
 }
 
 void MonitorManager::stopActiveMonitor()
@@ -163,6 +158,7 @@ void MonitorManager::slotResetProfiles()
 {
     if (m_blocked) return;
     if (m_projectMonitor == NULL || m_clipMonitor == NULL) return;
+    QString active = m_activeMonitor;
     activateMonitor("clip");
     m_clipMonitor->resetProfile(KdenliveSettings::current_profile());
     m_clipMonitor->updateTimecodeFormat();
@@ -170,6 +166,7 @@ void MonitorManager::slotResetProfiles()
     m_projectMonitor->resetProfile(KdenliveSettings::current_profile());
     m_projectMonitor->updateTimecodeFormat();
     //m_projectMonitor->refreshMonitor(true);
+    activateMonitor(active);
 }