From: Jean-Baptiste Mardelle Date: Mon, 24 Oct 2011 01:26:01 +0000 (+0000) Subject: Do not uselessly switch monitors at startup X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=a54db1d1e6a90edadbbb58d46870937130c692e7;p=kdenlive Do not uselessly switch monitors at startup svn path=/trunk/kdenlive/; revision=5984 --- diff --git a/src/monitormanager.cpp b/src/monitormanager.cpp index 55a570c8..46650191 100644 --- a/src/monitormanager.cpp +++ b/src/monitormanager.cpp @@ -26,14 +26,13 @@ #include #include - +#include 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(); } diff --git a/src/monitormanager.h b/src/monitormanager.h index 7f35aa40..9369c5ac 100644 --- a/src/monitormanager.h +++ b/src/monitormanager.h @@ -76,7 +76,6 @@ private: Monitor *m_projectMonitor; Timecode m_timecode; AbstractMonitor *m_activeMonitor; - bool m_blocked; QList m_monitorsList; signals: diff --git a/src/renderer.cpp b/src/renderer.cpp index 88666e0f..ebee863c 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -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(); diff --git a/src/renderer.h b/src/renderer.h index 4fb5b1b5..70f91633 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -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. */