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)
37 Timecode MonitorManager::timecode()
42 void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor)
44 m_clipMonitor = clipMonitor;
45 m_projectMonitor = projectMonitor;
48 void MonitorManager::activateMonitor(QString name)
50 if (m_activeMonitor == name) return;
52 m_projectMonitor->stop();
53 m_clipMonitor->start();
54 emit raiseClipMonitor(true);
56 m_clipMonitor->stop();
57 m_projectMonitor->start();
58 m_projectMonitor->raise();
59 emit raiseClipMonitor(false);
61 m_activeMonitor = name;
64 void MonitorManager::switchMonitors()
66 if (m_clipMonitor->isActive()) {
67 m_clipMonitor->stop();
68 m_projectMonitor->start();
69 m_projectMonitor->raise();
70 m_activeMonitor = m_projectMonitor->name();
71 emit raiseClipMonitor(false);
73 m_projectMonitor->stop();
74 m_clipMonitor->start();
75 m_activeMonitor = m_clipMonitor->name();
76 emit raiseClipMonitor(true);
80 void MonitorManager::stopActiveMonitor()
82 if (m_clipMonitor->isActive()) m_clipMonitor->pause();
83 else m_projectMonitor->pause();
86 void MonitorManager::slotPlay()
88 if (m_clipMonitor->isActive()) m_clipMonitor->slotPlay();
89 else m_projectMonitor->slotPlay();
92 void MonitorManager::slotPlayZone()
94 if (m_clipMonitor->isActive()) m_clipMonitor->slotPlayZone();
95 else m_projectMonitor->slotPlayZone();
98 void MonitorManager::slotLoopZone()
100 if (m_clipMonitor->isActive()) m_clipMonitor->slotLoopZone();
101 else m_projectMonitor->slotLoopZone();
104 void MonitorManager::slotRewind(double speed)
106 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewind(speed);
107 else m_projectMonitor->slotRewind(speed);
110 void MonitorManager::slotForward(double speed)
112 if (m_clipMonitor->isActive()) m_clipMonitor->slotForward(speed);
113 else m_projectMonitor->slotForward(speed);
116 void MonitorManager::slotRewindOneFrame()
118 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame();
119 else m_projectMonitor->slotRewindOneFrame();
122 void MonitorManager::slotForwardOneFrame()
124 if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame();
125 else m_projectMonitor->slotForwardOneFrame();
128 void MonitorManager::slotRewindOneSecond()
130 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame(m_timecode.fps());
131 else m_projectMonitor->slotRewindOneFrame(m_timecode.fps());
134 void MonitorManager::slotForwardOneSecond()
136 if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame(m_timecode.fps());
137 else m_projectMonitor->slotForwardOneFrame(m_timecode.fps());
140 void MonitorManager::slotStart()
142 if (m_clipMonitor->isActive()) m_clipMonitor->slotStart();
143 else m_projectMonitor->slotStart();
146 void MonitorManager::slotEnd()
148 if (m_clipMonitor->isActive()) m_clipMonitor->slotEnd();
149 else m_projectMonitor->slotEnd();
152 void MonitorManager::resetProfiles(Timecode tc)
155 QTimer::singleShot(300, this, SLOT(slotResetProfiles()));
158 void MonitorManager::slotResetProfiles()
160 if (m_projectMonitor == NULL || m_clipMonitor == NULL) return;
161 activateMonitor("clip");
162 m_clipMonitor->resetProfile();
163 activateMonitor("project");
164 m_projectMonitor->resetProfile();
165 //m_projectMonitor->refreshMonitor(true);
168 #include "monitormanager.moc"