X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmonitormanager.cpp;h=6da71c26a0e20eab430326ebb4478cb21a1b68d3;hb=f9394be680a8ac3c2ff8e39c9d8439eae5b55acc;hp=aff200877f0f5221b97caa388cdc390c8c7e6641;hpb=451953a22971eb6e7081f94a35ea511fb964ba4d;p=kdenlive diff --git a/src/monitormanager.cpp b/src/monitormanager.cpp index aff20087..6da71c26 100644 --- a/src/monitormanager.cpp +++ b/src/monitormanager.cpp @@ -18,34 +18,40 @@ ***************************************************************************/ -#include -#include - #include "monitormanager.h" -#include +#include "kdenlivesettings.h" -MonitorManager::MonitorManager(QWidget *parent) - : QObject(parent) { +#include +#include +#include -} -void MonitorManager::setTimecode(Timecode tc) { - m_timecode = tc; +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(); @@ -53,55 +59,120 @@ 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_activeMonitor == "clip") { - 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::slotPlay() { - if (m_activeMonitor == "clip") m_clipMonitor->slotPlay(); +void MonitorManager::stopActiveMonitor() +{ + if (m_blocked) return; + if (m_clipMonitor->isActive()) m_clipMonitor->pause(); + else m_projectMonitor->pause(); +} + +void MonitorManager::slotPlay() +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotPlay(); else m_projectMonitor->slotPlay(); } -void MonitorManager::slotRewind() { - if (m_activeMonitor == "clip") m_clipMonitor->slotRewind(); - else m_projectMonitor->slotRewind(); +void MonitorManager::slotPlayZone() +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotPlayZone(); + else m_projectMonitor->slotPlayZone(); +} + +void MonitorManager::slotLoopZone() +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotLoopZone(); + else m_projectMonitor->slotLoopZone(); +} + +void MonitorManager::slotRewind(double speed) +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotRewind(speed); + else m_projectMonitor->slotRewind(speed); } -void MonitorManager::slotForward() { - if (m_activeMonitor == "clip") m_clipMonitor->slotForward(); - else m_projectMonitor->slotForward(); +void MonitorManager::slotForward(double speed) +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotForward(speed); + else m_projectMonitor->slotForward(speed); } -void MonitorManager::slotRewindOneFrame() { - if (m_activeMonitor == "clip") m_clipMonitor->slotRewindOneFrame(); +void MonitorManager::slotRewindOneFrame() +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame(); else m_projectMonitor->slotRewindOneFrame(); } -void MonitorManager::slotForwardOneFrame() { - if (m_activeMonitor == "clip") m_clipMonitor->slotForwardOneFrame(); +void MonitorManager::slotForwardOneFrame() +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame(); else m_projectMonitor->slotForwardOneFrame(); } -void MonitorManager::resetProfiles(QString prof) { - m_clipMonitor->resetProfile(prof); - m_projectMonitor->resetProfile(prof); +void MonitorManager::slotRewindOneSecond() +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame(m_timecode.fps()); + else m_projectMonitor->slotRewindOneFrame(m_timecode.fps()); +} + +void MonitorManager::slotForwardOneSecond() +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame(m_timecode.fps()); + else m_projectMonitor->slotForwardOneFrame(m_timecode.fps()); +} + +void MonitorManager::slotStart() +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotStart(); + else m_projectMonitor->slotStart(); +} + +void MonitorManager::slotEnd() +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotEnd(); + else m_projectMonitor->slotEnd(); +} + +void MonitorManager::resetProfiles(Timecode tc) +{ + if (m_blocked) return; + m_timecode = tc; + slotResetProfiles(); + //QTimer::singleShot(300, this, SLOT(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(KdenliveSettings::current_profile()); + m_clipMonitor->updateTimecodeFormat(); + activateMonitor("project"); + 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(); } #include "monitormanager.moc"