]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Keyboard shortcuts for stop motion capture
[kdenlive] / src / mainwindow.cpp
index c4ce5d220a871aed7e4223bf2b88d5625c14bc66..1dfe6e491841317e3c664b8bc591f72cb25b0394 100644 (file)
@@ -341,6 +341,20 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
         layoutActions->addAction("save_layout" + QString::number(i), save);
     }
 
+    KAction *action;
+    // Stop motion actions. Beware of the order, we MUST use the same order in stopmotion/stopmotion.cpp
+    m_stopmotion_actions = new KActionCategory(i18n("Stop Motion"), actionCollection());
+    action = new KAction(KIcon("media-record"), i18n("Capture frame"), this);
+    action->setShortcut(Qt::Key_Space);
+    //action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    m_stopmotion_actions->addAction("stopmotion_capture", action);
+    action = new KAction(i18n("Switch live / captured frame"), this);
+    //action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    m_stopmotion_actions->addAction("stopmotion_switch", action);
+    action = new KAction(KIcon("edit-paste"), i18n("Show last frame over video"), this);
+    action->setCheckable(true);
+    action->setChecked(false);
+    m_stopmotion_actions->addAction("stopmotion_overlay", action);
     setupGUI();
 
 
@@ -379,7 +393,6 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
                                       static_cast<QMenu*>(factory()->container("transcoders", this)),
                                       clipInTimeline);
 
-    KAction *action;
     // build themes menus
     QMenu *themesMenu = static_cast<QMenu*>(factory()->container("themes_menu", this));
     QActionGroup *themegroup = new QActionGroup(this);
@@ -533,6 +546,9 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
     activateShuttleDevice();
 #endif /* NO_JOGSHUTTLE */
     m_projectListDock->raise();
+
+    actionCollection()->addAssociatedWidget(m_clipMonitor->container());
+    actionCollection()->addAssociatedWidget(m_projectMonitor->container());
 }
 
 MainWindow::~MainWindow()
@@ -556,7 +572,7 @@ MainWindow::~MainWindow()
 void MainWindow::queryQuit()
 {
     if (queryClose()) {
-        kapp->quit();
+        close();
     }
 }
 
@@ -1532,7 +1548,7 @@ void MainWindow::setupActions()
     connect(reloadClip , SIGNAL(triggered()), m_projectList, SLOT(slotReloadClip()));
     reloadClip->setEnabled(false);
 
-    QAction *stopMotion = new KAction(KIcon("image-x-generic"), i18n("Stopmotion Animation"), this);
+    QAction *stopMotion = new KAction(KIcon("image-x-generic"), i18n("Stop Motion Capture"), this);
     collection->addAction("stopmotion", stopMotion);
     connect(stopMotion , SIGNAL(triggered()), this, SLOT(slotOpenStopmotion()));
 
@@ -1964,6 +1980,12 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
     if (!m_timelineArea->isEnabled()) return;
     m_fileRevert->setEnabled(true);
 
+    // Recreate stopmotion widget on document change
+    if (m_stopmotion) {
+        delete m_stopmotion;
+        m_stopmotion = NULL;
+    }
+
     KProgressDialog progressDialog(this, i18n("Loading project"), i18n("Loading project"));
     progressDialog.setAllowCancel(false);
     progressDialog.progressBar()->setMaximum(4);
@@ -2160,6 +2182,12 @@ void MainWindow::slotUpdateProjectProfile(const QString &profile)
 {
     double dar = m_activeDocument->dar();
 
+    // Recreate the stopmotion widget if profile changes
+    if (m_stopmotion) {
+        delete m_stopmotion;
+        m_stopmotion = NULL;
+    }
+
     // Deselect current effect / transition
     m_effectStack->slotClipItemSelected(NULL, 0);
     m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
@@ -3857,8 +3885,8 @@ void MainWindow::slotSwitchMonitors()
 
 void MainWindow::slotSwitchFullscreen()
 {
-    /*if (m_projectMonitor->isActive()) m_projectMonitor->slotSwitchFullScreen();
-    else m_clipMonitor->slotSwitchFullScreen();*/
+    if (m_projectMonitor->isActive()) m_projectMonitor->slotSwitchFullScreen();
+    else m_clipMonitor->slotSwitchFullScreen();
 }
 
 void MainWindow::slotInsertZoneToTree()
@@ -3981,7 +4009,7 @@ void MainWindow::slotUpdateColorScopes()
 void MainWindow::slotOpenStopmotion()
 {
     if (m_stopmotion == NULL) {
-        m_stopmotion = new StopmotionWidget(m_activeDocument->projectFolder(), this);
+        m_stopmotion = new StopmotionWidget(m_activeDocument->projectFolder(), m_stopmotion_actions->actions(), this);
         connect(m_stopmotion, SIGNAL(addOrUpdateSequence(const QString)), m_projectList, SLOT(slotAddOrUpdateSequence(const QString)));
     }
     m_stopmotion->show();