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 ***************************************************************************/
24 #include <mlt++/Mlt.h>
26 #include "monitormanager.h"
27 #include "kdenlivesettings.h"
29 MonitorManager::MonitorManager(QWidget *parent)
33 Timecode MonitorManager::timecode() {
37 void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor) {
38 m_clipMonitor = clipMonitor;
39 m_projectMonitor = projectMonitor;
42 void MonitorManager::activateMonitor(QString name) {
43 if (m_activeMonitor == name) return;
45 m_projectMonitor->stop();
46 m_clipMonitor->start();
47 emit raiseClipMonitor(true);
49 m_clipMonitor->stop();
50 m_projectMonitor->start();
51 m_projectMonitor->raise();
52 emit raiseClipMonitor(false);
54 m_activeMonitor = name;
57 void MonitorManager::switchMonitors() {
58 if (m_clipMonitor->isActive()) {
59 m_clipMonitor->stop();
60 m_projectMonitor->start();
61 m_projectMonitor->raise();
62 m_activeMonitor = m_projectMonitor->name();
63 emit raiseClipMonitor(false);
65 m_projectMonitor->stop();
66 m_clipMonitor->start();
67 m_activeMonitor = m_clipMonitor->name();
68 emit raiseClipMonitor(true);
72 void MonitorManager::stopActiveMonitor() {
73 if (m_clipMonitor->isActive()) m_clipMonitor->pause();
74 else m_projectMonitor->pause();
77 void MonitorManager::slotPlay() {
78 if (m_clipMonitor->isActive()) m_clipMonitor->slotPlay();
79 else m_projectMonitor->slotPlay();
82 void MonitorManager::slotPlayZone() {
83 if (m_clipMonitor->isActive()) m_clipMonitor->slotPlayZone();
84 else m_projectMonitor->slotPlayZone();
87 void MonitorManager::slotLoopZone() {
88 if (m_clipMonitor->isActive()) m_clipMonitor->slotLoopZone();
89 else m_projectMonitor->slotLoopZone();
92 void MonitorManager::slotRewind(double speed) {
93 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewind(speed);
94 else m_projectMonitor->slotRewind(speed);
97 void MonitorManager::slotForward(double speed) {
98 if (m_clipMonitor->isActive()) m_clipMonitor->slotForward(speed);
99 else m_projectMonitor->slotForward(speed);
102 void MonitorManager::slotRewindOneFrame() {
103 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame();
104 else m_projectMonitor->slotRewindOneFrame();
107 void MonitorManager::slotForwardOneFrame() {
108 if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame();
109 else m_projectMonitor->slotForwardOneFrame();
112 void MonitorManager::slotRewindOneSecond() {
113 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame(m_timecode.fps());
114 else m_projectMonitor->slotRewindOneFrame(m_timecode.fps());
117 void MonitorManager::slotForwardOneSecond() {
118 if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame(m_timecode.fps());
119 else m_projectMonitor->slotForwardOneFrame(m_timecode.fps());
122 void MonitorManager::slotStart() {
123 if (m_clipMonitor->isActive()) m_clipMonitor->slotStart();
124 else m_projectMonitor->slotStart();
127 void MonitorManager::slotEnd() {
128 if (m_clipMonitor->isActive()) m_clipMonitor->slotEnd();
129 else m_projectMonitor->slotEnd();
132 void MonitorManager::resetProfiles(Timecode tc) {
134 QTimer::singleShot(300, this, SLOT(slotResetProfiles()));
137 void MonitorManager::slotResetProfiles() {
138 activateMonitor("clip");
139 m_clipMonitor->resetProfile();
140 activateMonitor("project");
141 m_projectMonitor->resetProfile();
142 //m_projectMonitor->refreshMonitor(true);
145 #include "monitormanager.moc"