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 "monitormanager.h"
25 #include <mlt++/Mlt.h>
27 MonitorManager::MonitorManager(QWidget *parent)
31 Timecode MonitorManager::timecode() {
35 void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor) {
36 m_clipMonitor = clipMonitor;
37 m_projectMonitor = projectMonitor;
40 void MonitorManager::activateMonitor(QString name) {
41 if (m_activeMonitor == name) return;
43 m_projectMonitor->stop();
44 m_clipMonitor->start();
45 emit raiseClipMonitor(true);
47 m_clipMonitor->stop();
48 m_projectMonitor->start();
49 m_projectMonitor->raise();
50 emit raiseClipMonitor(false);
52 m_activeMonitor = name;
55 void MonitorManager::switchMonitors() {
56 if (m_clipMonitor->isActive()) {
57 m_clipMonitor->stop();
58 m_projectMonitor->start();
59 m_projectMonitor->raise();
60 m_activeMonitor = m_projectMonitor->name();
61 emit raiseClipMonitor(false);
63 m_projectMonitor->stop();
64 m_clipMonitor->start();
65 m_activeMonitor = m_clipMonitor->name();
66 emit raiseClipMonitor(true);
70 void MonitorManager::stopActiveMonitor() {
71 if (m_clipMonitor->isActive()) m_clipMonitor->pause();
72 else m_projectMonitor->pause();
75 void MonitorManager::slotPlay() {
76 if (m_clipMonitor->isActive()) m_clipMonitor->slotPlay();
77 else m_projectMonitor->slotPlay();
80 void MonitorManager::slotPlayZone() {
81 if (m_clipMonitor->isActive()) m_clipMonitor->slotPlayZone();
82 else m_projectMonitor->slotPlayZone();
85 void MonitorManager::slotLoopZone() {
86 if (m_clipMonitor->isActive()) m_clipMonitor->slotLoopZone();
87 else m_projectMonitor->slotLoopZone();
90 void MonitorManager::slotRewind(double speed) {
91 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewind(speed);
92 else m_projectMonitor->slotRewind(speed);
95 void MonitorManager::slotForward(double speed) {
96 if (m_clipMonitor->isActive()) m_clipMonitor->slotForward(speed);
97 else m_projectMonitor->slotForward(speed);
100 void MonitorManager::slotRewindOneFrame() {
101 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame();
102 else m_projectMonitor->slotRewindOneFrame();
105 void MonitorManager::slotForwardOneFrame() {
106 if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame();
107 else m_projectMonitor->slotForwardOneFrame();
110 void MonitorManager::slotRewindOneSecond() {
111 if (m_clipMonitor->isActive()) m_clipMonitor->slotRewindOneFrame(m_timecode.fps());
112 else m_projectMonitor->slotRewindOneFrame(m_timecode.fps());
115 void MonitorManager::slotForwardOneSecond() {
116 if (m_clipMonitor->isActive()) m_clipMonitor->slotForwardOneFrame(m_timecode.fps());
117 else m_projectMonitor->slotForwardOneFrame(m_timecode.fps());
120 void MonitorManager::slotStart() {
121 if (m_clipMonitor->isActive()) m_clipMonitor->slotStart();
122 else m_projectMonitor->slotStart();
125 void MonitorManager::slotEnd() {
126 if (m_clipMonitor->isActive()) m_clipMonitor->slotEnd();
127 else m_projectMonitor->slotEnd();
130 void MonitorManager::resetProfiles(Timecode tc) {
135 void MonitorManager::slotResetProfiles() {
136 activateMonitor("clip");
137 m_clipMonitor->resetProfile();
138 activateMonitor("project");
139 m_projectMonitor->resetProfile();
140 //m_projectMonitor->refreshMonitor(true);
143 #include "monitormanager.moc"