]> git.sesse.net Git - kdenlive/blob - src/monitormanager.cpp
Alt + Left / Right to go to previous / next snap point
[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 void MonitorManager::setTimecode(Timecode tc) {
32     m_timecode = tc;
33 }
34
35 Timecode MonitorManager::timecode() {
36     return m_timecode;
37 }
38
39 void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor) {
40     m_clipMonitor = clipMonitor;
41     m_projectMonitor = projectMonitor;
42 }
43
44 bool MonitorManager::projectMonitorFocused() {
45     if (m_activeMonitor != "clip") return true;
46     return false;
47 }
48
49 void MonitorManager::activateMonitor(QString name) {
50     if (m_activeMonitor == name) return;
51     if (name == "clip") {
52         m_projectMonitor->stop();
53         m_clipMonitor->start();
54         emit raiseClipMonitor(true);
55     } else {
56         m_clipMonitor->stop();
57         m_projectMonitor->start();
58         m_projectMonitor->raise();
59         emit raiseClipMonitor(false);
60     }
61     m_activeMonitor = name;
62 }
63
64 void MonitorManager::switchMonitors() {
65     if (m_activeMonitor == "clip") {
66         m_clipMonitor->stop();
67         m_projectMonitor->start();
68         m_projectMonitor->raise();
69         m_activeMonitor = m_projectMonitor->name();
70         emit raiseClipMonitor(false);
71     } else {
72         m_projectMonitor->stop();
73         m_clipMonitor->start();
74         m_activeMonitor = m_clipMonitor->name();
75         emit raiseClipMonitor(true);
76     }
77 }
78
79 void MonitorManager::slotPlay() {
80     if (m_activeMonitor == "clip") m_clipMonitor->slotPlay();
81     else m_projectMonitor->slotPlay();
82 }
83
84 void MonitorManager::slotRewind(double speed) {
85     if (m_activeMonitor == "clip") m_clipMonitor->slotRewind(speed);
86     else m_projectMonitor->slotRewind(speed);
87 }
88
89 void MonitorManager::slotForward(double speed) {
90     if (m_activeMonitor == "clip") m_clipMonitor->slotForward(speed);
91     else m_projectMonitor->slotForward(speed);
92 }
93
94 void MonitorManager::slotRewindOneFrame() {
95     if (m_activeMonitor == "clip") m_clipMonitor->slotRewindOneFrame();
96     else m_projectMonitor->slotRewindOneFrame();
97 }
98
99 void MonitorManager::slotForwardOneFrame() {
100     if (m_activeMonitor == "clip") m_clipMonitor->slotForwardOneFrame();
101     else m_projectMonitor->slotForwardOneFrame();
102 }
103
104 void MonitorManager::resetProfiles(QString prof) {
105     m_clipMonitor->resetProfile(prof);
106     m_projectMonitor->resetProfile(prof);
107 }
108
109 #include "monitormanager.moc"