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;
67 void MonitorManager::slotSwitchMonitors(bool activateClip)
70 activateMonitor("clip");
72 activateMonitor("project");
75 void MonitorManager::stopActiveMonitor()
77 if (m_blocked) return;
78 if (m_clipMonitor->isActive()) m_clipMonitor->pause();
79 else m_projectMonitor->pause();
82 void MonitorManager::slotPlay()
84 if (m_clipMonitor->isActive()) m_clipMonitor->slotPlay();
85 else m_projectMonitor->slotPlay();
88 void MonitorManager::slotPlayZone()
90 if (m_clipMonitor->isActive()) m_clipMonitor->slotPlayZone();
91 else m_projectMonitor->slotPlayZone();
94 void MonitorManager::slotLoopZone()
96 if (m_clipMonitor->isActive()) m_clipMonitor->slotLoopZone();
97 else m_projectMonitor->slotLoopZone();
100 void MonitorManager::slotRewind(double speed)
102 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewind(speed);
103 else m_projectMonitor->slotRewind(speed);
106 void MonitorManager::slotForward(double speed)
108 if (m_clipMonitor->isActive()) m_clipMonitor->slotForward(speed);
109 else m_projectMonitor->slotForward(speed);
112 void MonitorManager::slotRewindOneFrame()
114 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame();
115 else m_projectMonitor->slotRewindOneFrame();
118 void MonitorManager::slotForwardOneFrame()
120 if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame();
121 else m_projectMonitor->slotForwardOneFrame();
124 void MonitorManager::slotRewindOneSecond()
126 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame(m_timecode.fps());
127 else m_projectMonitor->slotRewindOneFrame(m_timecode.fps());
130 void MonitorManager::slotForwardOneSecond()
132 if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame(m_timecode.fps());
133 else m_projectMonitor->slotForwardOneFrame(m_timecode.fps());
136 void MonitorManager::slotStart()
138 if (m_clipMonitor->isActive()) m_clipMonitor->slotStart();
139 else m_projectMonitor->slotStart();
142 void MonitorManager::slotEnd()
144 if (m_clipMonitor->isActive()) m_clipMonitor->slotEnd();
145 else m_projectMonitor->slotEnd();
148 void MonitorManager::resetProfiles(Timecode tc)
150 if (m_blocked) return;
153 //QTimer::singleShot(300, this, SLOT(slotResetProfiles()));
156 void MonitorManager::slotResetProfiles()
158 if (m_blocked) return;
159 if (m_projectMonitor == NULL || m_clipMonitor == NULL) return;
160 activateMonitor("clip");
161 m_clipMonitor->resetProfile(KdenliveSettings::current_profile());
162 m_clipMonitor->updateTimecodeFormat();
163 activateMonitor("project");
164 m_projectMonitor->resetProfile(KdenliveSettings::current_profile());
165 m_projectMonitor->updateTimecodeFormat();
166 //m_projectMonitor->refreshMonitor(true);
170 #include "monitormanager.moc"