1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
21 #include "monitormanager.h"
22 #include "kdenlivesettings.h"
24 #include <mlt++/Mlt.h>
30 MonitorManager::MonitorManager(QWidget *parent) :
33 m_projectMonitor(NULL),
38 Timecode MonitorManager::timecode()
43 void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor)
45 m_clipMonitor = clipMonitor;
46 m_projectMonitor = projectMonitor;
49 void MonitorManager::activateMonitor(QString name)
51 if (m_blocked || m_clipMonitor == NULL || m_projectMonitor == NULL)
53 if (m_activeMonitor == name)
56 m_projectMonitor->stop();
57 m_clipMonitor->start();
58 emit raiseClipMonitor(true);
60 m_clipMonitor->stop();
61 m_projectMonitor->start();
62 emit raiseClipMonitor(false);
64 m_activeMonitor = name;
65 emit checkColorScopes();
68 void MonitorManager::slotSwitchMonitors(bool activateClip)
71 activateMonitor("clip");
73 activateMonitor("project");
76 void MonitorManager::stopActiveMonitor()
78 if (m_blocked) return;
79 if (m_clipMonitor->isActive()) m_clipMonitor->pause();
80 else m_projectMonitor->pause();
83 void MonitorManager::slotPlay()
85 if (m_clipMonitor->isActive()) m_clipMonitor->slotPlay();
86 else m_projectMonitor->slotPlay();
89 void MonitorManager::slotPlayZone()
91 if (m_clipMonitor->isActive()) m_clipMonitor->slotPlayZone();
92 else m_projectMonitor->slotPlayZone();
95 void MonitorManager::slotLoopZone()
97 if (m_clipMonitor->isActive()) m_clipMonitor->slotLoopZone();
98 else m_projectMonitor->slotLoopZone();
101 void MonitorManager::slotRewind(double speed)
103 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewind(speed);
104 else m_projectMonitor->slotRewind(speed);
107 void MonitorManager::slotForward(double speed)
109 if (m_clipMonitor->isActive()) m_clipMonitor->slotForward(speed);
110 else m_projectMonitor->slotForward(speed);
113 void MonitorManager::slotRewindOneFrame()
115 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame();
116 else m_projectMonitor->slotRewindOneFrame();
119 void MonitorManager::slotForwardOneFrame()
121 if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame();
122 else m_projectMonitor->slotForwardOneFrame();
125 void MonitorManager::slotRewindOneSecond()
127 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame(m_timecode.fps());
128 else m_projectMonitor->slotRewindOneFrame(m_timecode.fps());
131 void MonitorManager::slotForwardOneSecond()
133 if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame(m_timecode.fps());
134 else m_projectMonitor->slotForwardOneFrame(m_timecode.fps());
137 void MonitorManager::slotStart()
139 if (m_clipMonitor->isActive()) m_clipMonitor->slotStart();
140 else m_projectMonitor->slotStart();
143 void MonitorManager::slotEnd()
145 if (m_clipMonitor->isActive()) m_clipMonitor->slotEnd();
146 else m_projectMonitor->slotEnd();
149 void MonitorManager::resetProfiles(Timecode tc)
151 if (m_blocked) return;
154 //QTimer::singleShot(300, this, SLOT(slotResetProfiles()));
157 void MonitorManager::slotResetProfiles()
159 if (m_blocked) return;
160 if (m_projectMonitor == NULL || m_clipMonitor == NULL) return;
161 QString active = m_activeMonitor;
162 activateMonitor("clip");
163 m_clipMonitor->resetProfile(KdenliveSettings::current_profile());
164 m_clipMonitor->updateTimecodeFormat();
165 activateMonitor("project");
166 m_projectMonitor->resetProfile(KdenliveSettings::current_profile());
167 m_projectMonitor->updateTimecodeFormat();
168 //m_projectMonitor->refreshMonitor(true);
169 activateMonitor(active);
173 #include "monitormanager.moc"