]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Get rid of buggy "drop B frame" speedup feature
[kdenlive] / src / mainwindow.cpp
index b8ec9ec53f3791274b7bbcdff697942acde67869..55431d6f6ddd2d7d2fa79495bf6cb9454a0204f7 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);
@@ -503,9 +516,6 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
     m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor);
     slotConnectMonitors();
 
-    // Disable drop B frames, see Kdenlive issue #1330, see also kdenlivesettingsdialog.cpp
-    KdenliveSettings::setDropbframes(false);
-
     // Open or create a file.  Command line argument passed in Url has
     // precedence, then "openlastproject", then just a plain empty file.
     // If opening Url fails, openlastproject will _not_ be used.
@@ -540,6 +550,9 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
 
 MainWindow::~MainWindow()
 {
+    if (m_stopmotion) {
+        delete m_stopmotion;
+    }
     m_effectStack->slotClipItemSelected(NULL, 0);
     m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
 
@@ -559,7 +572,7 @@ MainWindow::~MainWindow()
 void MainWindow::queryQuit()
 {
     if (queryClose()) {
-        kapp->quit();
+        close();
     }
 }
 
@@ -1845,15 +1858,8 @@ bool MainWindow::saveFileAs(const QString &outputFileName)
 {
     QString currentSceneList;
     m_monitorManager->stopActiveMonitor();
-    if (KdenliveSettings::dropbframes()) {
-        KdenliveSettings::setDropbframes(false);
-        m_activeDocument->clipManager()->updatePreviewSettings();
-        currentSceneList = m_projectMonitor->sceneList();
-        KdenliveSettings::setDropbframes(true);
-        m_activeDocument->clipManager()->updatePreviewSettings();
-    } else currentSceneList = m_projectMonitor->sceneList();
-
-    if (m_activeDocument->saveSceneList(outputFileName, currentSceneList) == false)
+
+    if (m_activeDocument->saveSceneList(outputFileName, m_projectMonitor->sceneList()) == false)
         return false;
 
     // Save timeline thumbnails
@@ -1969,8 +1975,8 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
 
     // Recreate stopmotion widget on document change
     if (m_stopmotion) {
-       delete m_stopmotion;
-       m_stopmotion = NULL;
+        delete m_stopmotion;
+        m_stopmotion = NULL;
     }
 
     KProgressDialog progressDialog(this, i18n("Loading project"), i18n("Loading project"));
@@ -2171,8 +2177,8 @@ void MainWindow::slotUpdateProjectProfile(const QString &profile)
 
     // Recreate the stopmotion widget if profile changes
     if (m_stopmotion) {
-       delete m_stopmotion;
-       m_stopmotion = NULL;
+        delete m_stopmotion;
+        m_stopmotion = NULL;
     }
 
     // Deselect current effect / transition
@@ -2461,7 +2467,6 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
 #ifndef   Q_WS_MAC
     m_recMonitor->slotUpdateCaptureFolder(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash));
 #endif
-    if (KdenliveSettings::dropbframes()) slotUpdatePreviewSettings();
     //Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
     slotUpdateMousePosition(0);
     // set tool to select tool
@@ -2495,6 +2500,7 @@ void MainWindow::slotPreferences(int page, int option)
      * cached, in which case you want to display the cached dialog
      * instead of creating another one
      */
+    if (m_stopmotion) m_stopmotion->slotLive(false);
     if (KConfigDialog::showDialog("settings")) {
         KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
         if (page != -1) d->showPage(page, option);
@@ -2507,11 +2513,9 @@ void MainWindow::slotPreferences(int page, int option)
     connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
     //connect(dialog, SIGNAL(doResetProfile()), this, SLOT(slotDetectAudioDriver()));
     connect(dialog, SIGNAL(doResetProfile()), m_monitorManager, SLOT(slotResetProfiles()));
-    connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings()));
 #ifndef Q_WS_MAC
     connect(dialog, SIGNAL(updateCaptureFolder()), this, SLOT(slotUpdateCaptureFolder()));
 #endif
-    //connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings()));
     dialog->show();
     if (page != -1) dialog->showPage(page, option);
 }
@@ -2525,14 +2529,6 @@ void MainWindow::slotUpdateCaptureFolder()
 #endif
 }
 
-void MainWindow::slotUpdatePreviewSettings()
-{
-    if (m_activeDocument) {
-        m_clipMonitor->slotSetXml(NULL);
-        m_activeDocument->updatePreviewSettings();
-    }
-}
-
 void MainWindow::updateConfiguration()
 {
     //TODO: we should apply settings to all projects, not only the current one
@@ -3996,13 +3992,12 @@ 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();
 }
 
-
 void MainWindow::slotDeleteClip(const QString &id)
 {
     QList <ClipProperties *> list = findChildren<ClipProperties *>();