X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmonitormanager.cpp;h=738a808445224f9044713f8aeb871cd50a92197b;hb=c59b232df628b84271a99765f32e03d606cc2733;hp=f38a210a0d93f45603b61e06759a5d55eb79d891;hpb=9ee79fd8451ad27df8202a62b7af2e6ab2a12dcf;p=kdenlive diff --git a/src/monitormanager.cpp b/src/monitormanager.cpp index f38a210a..738a8084 100644 --- a/src/monitormanager.cpp +++ b/src/monitormanager.cpp @@ -18,29 +18,41 @@ ***************************************************************************/ -#include -#include +#include "monitormanager.h" +#include "renderer.h" +#include "kdenlivesettings.h" #include -#include "monitormanager.h" -#include "kdenlivesettings.h" +#include +#include + -MonitorManager::MonitorManager(QWidget *parent) - : QObject(parent) { +MonitorManager::MonitorManager(QWidget *parent) : + QObject(parent), + m_clipMonitor(NULL), + m_projectMonitor(NULL), + m_blocked(false) +{ } -Timecode MonitorManager::timecode() { +Timecode MonitorManager::timecode() +{ return m_timecode; } -void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor) { +void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor) +{ m_clipMonitor = clipMonitor; m_projectMonitor = projectMonitor; } -void MonitorManager::activateMonitor(QString name) { - if (m_activeMonitor == name) return; +void MonitorManager::activateMonitor(QString name) +{ + if (m_blocked || m_clipMonitor == NULL || m_projectMonitor == NULL) + return; + if (m_activeMonitor == name) + return; if (name == "clip") { m_projectMonitor->stop(); m_clipMonitor->start(); @@ -48,103 +60,131 @@ void MonitorManager::activateMonitor(QString name) { } else { m_clipMonitor->stop(); m_projectMonitor->start(); - m_projectMonitor->raise(); emit raiseClipMonitor(false); } m_activeMonitor = name; + emit checkColorScopes(); } -void MonitorManager::switchMonitors() { - if (m_clipMonitor->isActive()) { - m_clipMonitor->stop(); - m_projectMonitor->start(); - m_projectMonitor->raise(); - m_activeMonitor = m_projectMonitor->name(); - emit raiseClipMonitor(false); - } else { - m_projectMonitor->stop(); - m_clipMonitor->start(); - m_activeMonitor = m_clipMonitor->name(); - emit raiseClipMonitor(true); - } +void MonitorManager::slotSwitchMonitors(bool activateClip) +{ + if (activateClip) + activateMonitor("clip"); + else + activateMonitor("project"); } -void MonitorManager::stopActiveMonitor() { +void MonitorManager::stopActiveMonitor() +{ + if (m_blocked) return; if (m_clipMonitor->isActive()) m_clipMonitor->pause(); else m_projectMonitor->pause(); } -void MonitorManager::slotPlay() { +void MonitorManager::slotPlay() +{ if (m_clipMonitor->isActive()) m_clipMonitor->slotPlay(); else m_projectMonitor->slotPlay(); } -void MonitorManager::slotPlayZone() { +void MonitorManager::slotPause() +{ + stopActiveMonitor(); +} + +void MonitorManager::slotPlayZone() +{ if (m_clipMonitor->isActive()) m_clipMonitor->slotPlayZone(); else m_projectMonitor->slotPlayZone(); } -void MonitorManager::slotLoopZone() { +void MonitorManager::slotLoopZone() +{ if (m_clipMonitor->isActive()) m_clipMonitor->slotLoopZone(); else m_projectMonitor->slotLoopZone(); } -void MonitorManager::slotRewind(double speed) { +void MonitorManager::slotRewind(double speed) +{ if (m_clipMonitor->isActive()) m_clipMonitor->slotRewind(speed); else m_projectMonitor->slotRewind(speed); } -void MonitorManager::slotForward(double speed) { +void MonitorManager::slotForward(double speed) +{ if (m_clipMonitor->isActive()) m_clipMonitor->slotForward(speed); else m_projectMonitor->slotForward(speed); } -void MonitorManager::slotRewindOneFrame() { +void MonitorManager::slotRewindOneFrame() +{ if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame(); else m_projectMonitor->slotRewindOneFrame(); } -void MonitorManager::slotForwardOneFrame() { +void MonitorManager::slotForwardOneFrame() +{ if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame(); else m_projectMonitor->slotForwardOneFrame(); } -void MonitorManager::slotRewindOneSecond() { +void MonitorManager::slotRewindOneSecond() +{ if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame(m_timecode.fps()); else m_projectMonitor->slotRewindOneFrame(m_timecode.fps()); } -void MonitorManager::slotForwardOneSecond() { +void MonitorManager::slotForwardOneSecond() +{ if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame(m_timecode.fps()); else m_projectMonitor->slotForwardOneFrame(m_timecode.fps()); } -void MonitorManager::slotStart() { +void MonitorManager::slotStart() +{ if (m_clipMonitor->isActive()) m_clipMonitor->slotStart(); else m_projectMonitor->slotStart(); } -void MonitorManager::slotEnd() { +void MonitorManager::slotEnd() +{ if (m_clipMonitor->isActive()) m_clipMonitor->slotEnd(); else m_projectMonitor->slotEnd(); } -void MonitorManager::resetProfiles(Timecode tc) { +void MonitorManager::resetProfiles(Timecode tc) +{ + if (m_blocked) return; m_timecode = tc; slotResetProfiles(); + //QTimer::singleShot(300, this, SLOT(slotResetProfiles())); } -void MonitorManager::slotResetProfiles() { +void MonitorManager::slotResetProfiles() +{ + if (m_blocked) return; + if (m_projectMonitor == NULL || m_clipMonitor == NULL) return; + QString active = m_activeMonitor; activateMonitor("clip"); - m_clipMonitor->resetProfile(); + m_clipMonitor->resetProfile(KdenliveSettings::current_profile()); + m_clipMonitor->updateTimecodeFormat(); activateMonitor("project"); - m_projectMonitor->resetProfile(); - char *tmp; - tmp = (char *) qstrdup(QString(KdenliveSettings::current_profile()).toUtf8().data()); - setenv("MLT_PROFILE", tmp, 1); - delete[] tmp; - + m_projectMonitor->resetProfile(KdenliveSettings::current_profile()); + m_projectMonitor->updateTimecodeFormat(); //m_projectMonitor->refreshMonitor(true); + activateMonitor(active); +} + +void MonitorManager::slotRefreshCurrentMonitor() +{ + if (m_clipMonitor->isActive()) m_clipMonitor->refreshMonitor(); + else m_projectMonitor->refreshMonitor(); +} + +void MonitorManager::slotUpdateAudioMonitoring() +{ + m_clipMonitor->render->analyseAudio = KdenliveSettings::monitor_audio(); + m_projectMonitor->render->analyseAudio = KdenliveSettings::monitor_audio(); } #include "monitormanager.moc"