]> git.sesse.net Git - kdenlive/blobdiff - src/monitormanager.cpp
Initial support for Jog Shuttle devices
[kdenlive] / src / monitormanager.cpp
index 6ef4bd80eb1563c49ec17e8949f35d9fc50df839..9c163f07c91b7bdaae5996f6f7509184e797f821 100644 (file)
+/***************************************************************************
+ *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+
 #include <QObject>
 #include <QTimer>
 
 #include "monitormanager.h"
+#include <mlt++/Mlt.h>
 
 MonitorManager::MonitorManager(QWidget *parent)
-    : QObject(parent)
-{
+        : QObject(parent) {
+
+
+}
+
+void MonitorManager::setTimecode(Timecode tc) {
+    m_timecode = tc;
+}
 
+Timecode MonitorManager::timecode() {
+    return m_timecode;
+}
+
+void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor) {
+    m_clipMonitor = clipMonitor;
+    m_projectMonitor = projectMonitor;
+}
+
+
+void MonitorManager::activateMonitor(QString name) {
+    if (m_activeMonitor == name) return;
+    if (name == "clip") {
+        m_projectMonitor->stop();
+        m_clipMonitor->start();
+        emit raiseClipMonitor(true);
+    } else {
+        m_clipMonitor->stop();
+        m_projectMonitor->start();
+        m_projectMonitor->raise();
+        emit raiseClipMonitor(false);
+    }
+    m_activeMonitor = name;
+}
 
+void MonitorManager::switchMonitors() {
+    if (m_activeMonitor == "clip") {
+        m_clipMonitor->stop();
+        m_projectMonitor->start();
+        m_projectMonitor->raise();
+        m_activeMonitor = m_projectMonitor->name();
+        emit raiseClipMonitor(false);
+    } else {
+        m_projectMonitor->stop();
+        m_clipMonitor->start();
+        m_activeMonitor = m_clipMonitor->name();
+        emit raiseClipMonitor(true);
+    }
 }
 
-void MonitorManager::setTimecode(Timecode tc)
-{
-  m_timecode = tc;
+void MonitorManager::slotPlay() {
+    if (m_activeMonitor == "clip") m_clipMonitor->slotPlay();
+    else m_projectMonitor->slotPlay();
 }
 
-Timecode MonitorManager::timecode()
-{
-  return m_timecode;
+void MonitorManager::slotRewind(double speed) {
+    if (m_activeMonitor == "clip") m_clipMonitor->slotRewind(speed);
+    else m_projectMonitor->slotRewind(speed);
 }
 
-void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor)
-{
-  m_clipMonitor = clipMonitor;
-  m_projectMonitor = projectMonitor;
-  //QTimer::singleShot(750, this, SLOT(initClipMonitor()));
-  initClipMonitor();
-  //initProjectMonitor();
+void MonitorManager::slotForward(double speed) {
+    if (m_activeMonitor == "clip") m_clipMonitor->slotForward(speed);
+    else m_projectMonitor->slotForward(speed);
 }
 
-void MonitorManager::initClipMonitor()
-{
-  m_clipMonitor->initMonitor();
-  initProjectMonitor();
-  //QTimer::singleShot(1500, this, SLOT(initProjectMonitor()));
+void MonitorManager::slotRewindOneFrame() {
+    if (m_activeMonitor == "clip") m_clipMonitor->slotRewindOneFrame();
+    else m_projectMonitor->slotRewindOneFrame();
 }
 
-void MonitorManager::initProjectMonitor()
-{
-  m_clipMonitor->stop();
-  // m_projectMonitor->initMonitor();
-  // activateMonitor("project");
-  emit connectMonitors();
+void MonitorManager::slotForwardOneFrame() {
+    if (m_activeMonitor == "clip") m_clipMonitor->slotForwardOneFrame();
+    else m_projectMonitor->slotForwardOneFrame();
 }
 
-void MonitorManager::activateMonitor(QString name)
-{
-  if (m_activeMonitor == name) return;
-  if (name == "clip") {
-    m_projectMonitor->stop();
-    m_clipMonitor->start();
-    emit raiseClipMonitor(true);
-  }
-  else {
-    m_clipMonitor->stop();
-    m_projectMonitor->start();
-    m_projectMonitor->raise();
-    emit raiseClipMonitor(false);
-  }
-  m_activeMonitor = name;
+void MonitorManager::resetProfiles(QString prof) {
+    m_clipMonitor->resetProfile(prof);
+    m_projectMonitor->resetProfile(prof);
 }
 
 #include "monitormanager.moc"