Do not uselessly switch monitors at startup

svn path=/trunk/kdenlive/; revision=5984
parent e4006207
......@@ -26,14 +26,13 @@
#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();
}
......
......@@ -76,7 +76,6 @@ private:
Monitor *m_projectMonitor;
Timecode m_timecode;
AbstractMonitor *m_activeMonitor;
bool m_blocked;
QList <AbstractMonitor *>m_monitorsList;
signals:
......
......@@ -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();
......
......@@ -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. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment