X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmonitormanager.cpp;h=178ffc1d1aec12e4cf3724bcbef75bde06284cc1;hb=6c4cbe3a608165fa3403f35cf6c9191aeab9e93f;hp=1b0a7c6fb278400d20a2867947a0648408ea4681;hpb=664d1a3d5bf9c771936ca98d48163fa4df6ffc0e;p=kdenlive diff --git a/src/monitormanager.cpp b/src/monitormanager.cpp index 1b0a7c6f..178ffc1d 100644 --- a/src/monitormanager.cpp +++ b/src/monitormanager.cpp @@ -28,6 +28,7 @@ #include #include + MonitorManager::MonitorManager(QWidget *parent) : QObject(parent), m_clipMonitor(NULL), @@ -62,15 +63,28 @@ void MonitorManager::removeMonitor(AbstractMonitor *monitor) m_monitorsList.removeAll(monitor); } -bool MonitorManager::activateMonitor(const QString &name) +AbstractMonitor* MonitorManager::monitor(Kdenlive::MONITORID monitorName) +{ + AbstractMonitor *monitor = NULL; + for (int i = 0; i < m_monitorsList.size(); i++) { + if (m_monitorsList[i]->id() == monitorName) { + monitor = m_monitorsList[i]; + } + } + return monitor; +} + +bool MonitorManager::activateMonitor(Kdenlive::MONITORID name, bool forceRefresh) { if (m_clipMonitor == NULL || m_projectMonitor == NULL) return false; - if (m_activeMonitor && m_activeMonitor->name() == name) + if (m_activeMonitor && m_activeMonitor->id() == name) { + if (forceRefresh) m_activeMonitor->start(); return false; + } m_activeMonitor = NULL; for (int i = 0; i < m_monitorsList.count(); i++) { - if (m_monitorsList.at(i)->name() == name) { + if (m_monitorsList.at(i)->id() == name) { m_activeMonitor = m_monitorsList.at(i); } else m_monitorsList.at(i)->stop(); @@ -85,29 +99,28 @@ bool MonitorManager::activateMonitor(const QString &name) return (m_activeMonitor != NULL); } -bool MonitorManager::isActive(const QString &name) const +bool MonitorManager::isActive(Kdenlive::MONITORID id) const { - return m_activeMonitor ? m_activeMonitor->name() == name: false; + return m_activeMonitor ? m_activeMonitor->id() == id: false; } void MonitorManager::slotSwitchMonitors(bool activateClip) { if (activateClip) - activateMonitor("clip"); + activateMonitor(Kdenlive::clipMonitor); else - activateMonitor("project"); + activateMonitor(Kdenlive::projectMonitor); } void MonitorManager::stopActiveMonitor() { if (m_activeMonitor == m_clipMonitor) m_clipMonitor->pause(); - else m_projectMonitor->pause(); + else if (m_activeMonitor == m_projectMonitor) m_projectMonitor->pause(); } void MonitorManager::slotPlay() { - if (m_activeMonitor == m_clipMonitor) m_clipMonitor->slotPlay(); - else m_projectMonitor->slotPlay(); + if (m_activeMonitor) m_activeMonitor->slotPlay(); } void MonitorManager::slotPause() @@ -118,7 +131,7 @@ void MonitorManager::slotPause() void MonitorManager::slotPlayZone() { if (m_activeMonitor == m_clipMonitor) m_clipMonitor->slotPlayZone(); - else m_projectMonitor->slotPlayZone(); + else if (m_activeMonitor == m_projectMonitor) m_projectMonitor->slotPlayZone(); } void MonitorManager::slotLoopZone() @@ -130,49 +143,49 @@ void MonitorManager::slotLoopZone() void MonitorManager::slotRewind(double speed) { if (m_activeMonitor == m_clipMonitor) m_clipMonitor->slotRewind(speed); - else m_projectMonitor->slotRewind(speed); + else if (m_activeMonitor == m_projectMonitor) m_projectMonitor->slotRewind(speed); } void MonitorManager::slotForward(double speed) { if (m_activeMonitor == m_clipMonitor) m_clipMonitor->slotForward(speed); - else m_projectMonitor->slotForward(speed); + else if (m_activeMonitor == m_projectMonitor) m_projectMonitor->slotForward(speed); } void MonitorManager::slotRewindOneFrame() { if (m_activeMonitor == m_clipMonitor) m_clipMonitor->slotRewindOneFrame(); - else m_projectMonitor->slotRewindOneFrame(); + else if (m_activeMonitor == m_projectMonitor) m_projectMonitor->slotRewindOneFrame(); } void MonitorManager::slotForwardOneFrame() { if (m_activeMonitor == m_clipMonitor) m_clipMonitor->slotForwardOneFrame(); - else m_projectMonitor->slotForwardOneFrame(); + else if (m_activeMonitor == m_projectMonitor) m_projectMonitor->slotForwardOneFrame(); } void MonitorManager::slotRewindOneSecond() { if (m_activeMonitor == m_clipMonitor) m_clipMonitor->slotRewindOneFrame(m_timecode.fps()); - else m_projectMonitor->slotRewindOneFrame(m_timecode.fps()); + else if (m_activeMonitor == m_projectMonitor) m_projectMonitor->slotRewindOneFrame(m_timecode.fps()); } void MonitorManager::slotForwardOneSecond() { if (m_activeMonitor == m_clipMonitor) m_clipMonitor->slotForwardOneFrame(m_timecode.fps()); - else m_projectMonitor->slotForwardOneFrame(m_timecode.fps()); + else if (m_activeMonitor == m_projectMonitor) m_projectMonitor->slotForwardOneFrame(m_timecode.fps()); } void MonitorManager::slotStart() { if (m_activeMonitor == m_clipMonitor) m_clipMonitor->slotStart(); - else m_projectMonitor->slotStart(); + else if (m_activeMonitor == m_projectMonitor) m_projectMonitor->slotStart(); } void MonitorManager::slotEnd() { if (m_activeMonitor == m_clipMonitor) m_clipMonitor->slotEnd(); - else m_projectMonitor->slotEnd(); + else if (m_activeMonitor == m_projectMonitor) m_projectMonitor->slotEnd(); } void MonitorManager::resetProfiles(Timecode tc) @@ -186,17 +199,19 @@ void MonitorManager::slotResetProfiles() { if (m_projectMonitor == NULL || m_clipMonitor == NULL) return; blockSignals(true); - QString active = m_activeMonitor ? m_activeMonitor->name() : QString(); + Kdenlive::MONITORID active = m_activeMonitor ? m_activeMonitor->id() : Kdenlive::noMonitor; m_clipMonitor->resetProfile(KdenliveSettings::current_profile()); m_projectMonitor->resetProfile(KdenliveSettings::current_profile()); - if (!active.isEmpty()) activateMonitor(active); + if (active != Kdenlive::noMonitor) activateMonitor(active); blockSignals(false); if (m_activeMonitor) m_activeMonitor->parentWidget()->raise(); emit checkColorScopes(); } -void MonitorManager::slotRefreshCurrentMonitor() +void MonitorManager::slotRefreshCurrentMonitor(const QString &id) { + // Clip producer was modified, check if clip is currently displayed in clip monitor + m_clipMonitor->reloadProducer(id); if (m_activeMonitor == m_clipMonitor) m_clipMonitor->refreshMonitor(); else m_projectMonitor->refreshMonitor(); } @@ -204,11 +219,14 @@ void MonitorManager::slotRefreshCurrentMonitor() void MonitorManager::slotUpdateAudioMonitoring() { // if(...) added since they are 0x0 when the config wizard is running! --Granjow - if (m_clipMonitor) { + /*if (m_clipMonitor) { m_clipMonitor->render->analyseAudio = KdenliveSettings::monitor_audio(); } if (m_projectMonitor) { m_projectMonitor->render->analyseAudio = KdenliveSettings::monitor_audio(); + }*/ + for (int i = 0; i < m_monitorsList.count(); i++) { + if (m_monitorsList.at(i)->abstractRender()) m_monitorsList.at(i)->abstractRender()->analyseAudio = KdenliveSettings::monitor_audio(); } } @@ -230,4 +248,9 @@ AbstractRender *MonitorManager::activeRenderer() return NULL; } +void MonitorManager::slotSwitchFullscreen() +{ + if (m_activeMonitor) m_activeMonitor->slotSwitchFullScreen(); +} + #include "monitormanager.moc"