X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmonitormanager.cpp;h=923f08ccb609dbdf239bd112dbb95500f648f620;hb=211a654bf4ff449637ce35800155f20844cebd72;hp=1765fa86cc4567ef0be401c32891741332050bf4;hpb=024a8b00915dadce2a470f3802101542528513f0;p=kdenlive diff --git a/src/monitormanager.cpp b/src/monitormanager.cpp index 1765fa86..923f08cc 100644 --- a/src/monitormanager.cpp +++ b/src/monitormanager.cpp @@ -18,33 +18,35 @@ ***************************************************************************/ -#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) +{ } -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) { +void MonitorManager::activateMonitor(QString name) +{ if (m_activeMonitor == name) return; if (name == "clip") { m_projectMonitor->stop(); @@ -59,8 +61,9 @@ void MonitorManager::activateMonitor(QString name) { m_activeMonitor = name; } -void MonitorManager::switchMonitors() { - if (m_activeMonitor == "clip") { +void MonitorManager::switchMonitors() +{ + if (m_clipMonitor->isActive()) { m_clipMonitor->stop(); m_projectMonitor->start(); m_projectMonitor->raise(); @@ -74,14 +77,92 @@ void MonitorManager::switchMonitors() { } } -void MonitorManager::slotPlay() { - if (m_activeMonitor == "clip") m_clipMonitor->slotPlay(); +void MonitorManager::stopActiveMonitor() +{ + 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::resetProfiles(QString prof) { - m_clipMonitor->resetProfile(prof); - m_projectMonitor->resetProfile(prof); +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(double speed) +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotForward(speed); + else m_projectMonitor->slotForward(speed); +} + +void MonitorManager::slotRewindOneFrame() +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame(); + else m_projectMonitor->slotRewindOneFrame(); +} + +void MonitorManager::slotForwardOneFrame() +{ + if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame(); + else m_projectMonitor->slotForwardOneFrame(); +} + +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) +{ + m_timecode = tc; + QTimer::singleShot(300, this, SLOT(slotResetProfiles())); +} + +void MonitorManager::slotResetProfiles() +{ + if (m_projectMonitor == NULL || m_clipMonitor == NULL) return; + activateMonitor("clip"); + m_clipMonitor->resetProfile(); + activateMonitor("project"); + m_projectMonitor->resetProfile(); + //m_projectMonitor->refreshMonitor(true); } #include "monitormanager.moc"