]> git.sesse.net Git - kdenlive/blob - src/monitormanager.cpp
Initial support for Jog Shuttle devices
[kdenlive] / src / monitormanager.cpp
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
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.                                   *
8  *                                                                         *
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.                          *
13  *                                                                         *
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  ***************************************************************************/
19
20
21 #include <QObject>
22 #include <QTimer>
23
24 #include "monitormanager.h"
25 #include <mlt++/Mlt.h>
26
27 MonitorManager::MonitorManager(QWidget *parent)
28         : QObject(parent) {
29
30
31 }
32
33 void MonitorManager::setTimecode(Timecode tc) {
34     m_timecode = tc;
35 }
36
37 Timecode MonitorManager::timecode() {
38     return m_timecode;
39 }
40
41 void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor) {
42     m_clipMonitor = clipMonitor;
43     m_projectMonitor = projectMonitor;
44 }
45
46
47 void MonitorManager::activateMonitor(QString name) {
48     if (m_activeMonitor == name) return;
49     if (name == "clip") {
50         m_projectMonitor->stop();
51         m_clipMonitor->start();
52         emit raiseClipMonitor(true);
53     } else {
54         m_clipMonitor->stop();
55         m_projectMonitor->start();
56         m_projectMonitor->raise();
57         emit raiseClipMonitor(false);
58     }
59     m_activeMonitor = name;
60 }
61
62 void MonitorManager::switchMonitors() {
63     if (m_activeMonitor == "clip") {
64         m_clipMonitor->stop();
65         m_projectMonitor->start();
66         m_projectMonitor->raise();
67         m_activeMonitor = m_projectMonitor->name();
68         emit raiseClipMonitor(false);
69     } else {
70         m_projectMonitor->stop();
71         m_clipMonitor->start();
72         m_activeMonitor = m_clipMonitor->name();
73         emit raiseClipMonitor(true);
74     }
75 }
76
77 void MonitorManager::slotPlay() {
78     if (m_activeMonitor == "clip") m_clipMonitor->slotPlay();
79     else m_projectMonitor->slotPlay();
80 }
81
82 void MonitorManager::slotRewind(double speed) {
83     if (m_activeMonitor == "clip") m_clipMonitor->slotRewind(speed);
84     else m_projectMonitor->slotRewind(speed);
85 }
86
87 void MonitorManager::slotForward(double speed) {
88     if (m_activeMonitor == "clip") m_clipMonitor->slotForward(speed);
89     else m_projectMonitor->slotForward(speed);
90 }
91
92 void MonitorManager::slotRewindOneFrame() {
93     if (m_activeMonitor == "clip") m_clipMonitor->slotRewindOneFrame();
94     else m_projectMonitor->slotRewindOneFrame();
95 }
96
97 void MonitorManager::slotForwardOneFrame() {
98     if (m_activeMonitor == "clip") m_clipMonitor->slotForwardOneFrame();
99     else m_projectMonitor->slotForwardOneFrame();
100 }
101
102 void MonitorManager::resetProfiles(QString prof) {
103     m_clipMonitor->resetProfile(prof);
104     m_projectMonitor->resetProfile(prof);
105 }
106
107 #include "monitormanager.moc"