]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Use QtConcurrent instead of custom thread to create audio thumbs, in an attempt to...
[kdenlive] / src / mainwindow.cpp
index 10224477cfaf6c3703fb01461c75b1cd284c309b..48242bc4fbde8b0f5c1581d3f13df96706fe3e4c 100644 (file)
@@ -39,6 +39,7 @@
 #include "transitionsettings.h"
 #include "renderwidget.h"
 #include "renderer.h"
+#include "audiosignal.h"
 #ifndef NO_JOGSHUTTLE
 #include "jogshuttle.h"
 #endif /* NO_JOGSHUTTLE */
@@ -56,6 +57,7 @@
 #include "waveform.h"
 #include "rgbparade.h"
 #include "histogram.h"
+#include "audiospectrum.h"
 
 #include <KApplication>
 #include <KAction>
@@ -95,6 +97,7 @@
 #endif /* KDE_IS_VERSION(4,3,80) */
 #include <KToolBar>
 #include <KColorScheme>
+#include <KProgressDialog>
 
 #include <QTextStream>
 #include <QTimer>
 static const char version[] = VERSION;
 
 static const int ID_TIMELINE_POS = 0;
-
 namespace Mlt
 {
 class Producer;
 };
 
+Q_DECLARE_METATYPE(QVector<int16_t>)
+
 EffectsList MainWindow::videoEffects;
 EffectsList MainWindow::audioEffects;
 EffectsList MainWindow::customEffects;
@@ -128,9 +132,10 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
 #ifndef NO_JOGSHUTTLE
     m_jogProcess(NULL),
 #endif /* NO_JOGSHUTTLE */
-    m_findActivated(false)
+    m_findActivated(false),
+    m_stopmotion(NULL)
 {
-
+    qRegisterMetaType<QVector<int16_t> > ();
     // Create DBus interface
     new MainWindowAdaptor(this);
     QDBusConnection dbus = QDBusConnection::sessionBus();
@@ -141,6 +146,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
     setFont(KGlobalSettings::toolBarFont());
     parseProfiles(MltPath);
     m_commandStack = new QUndoGroup;
+    setDockNestingEnabled(true);
     m_timelineArea = new KTabWidget(this);
     m_timelineArea->setTabReorderingEnabled(true);
     m_timelineArea->setTabBarHidden(true);
@@ -178,7 +184,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
 
     m_clipMonitorDock = new QDockWidget(i18n("Clip Monitor"), this);
     m_clipMonitorDock->setObjectName("clip_monitor");
-    m_clipMonitor = new Monitor("clip", m_monitorManager, QString());
+    m_clipMonitor = new Monitor("clip", m_monitorManager, QString(), m_timelineArea);
     m_clipMonitorDock->setWidget(m_clipMonitor);
     addDockWidget(Qt::TopDockWidgetArea, m_clipMonitorDock);
 
@@ -267,6 +273,44 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
     m_scopesList.append(m_histogramDock);
 
 
+    m_audiosignal = new AudioSignal;
+    m_audiosignalDock = new QDockWidget(i18n("Audio Signal"), this);
+    m_audiosignalDock->setObjectName("audiosignal");
+    m_audiosignalDock->setWidget(m_audiosignal);
+    addDockWidget(Qt::TopDockWidgetArea, m_audiosignalDock);
+    connect(m_audiosignal, SIGNAL(updateAudioMonitoring()), m_monitorManager, SLOT(slotUpdateAudioMonitoring()));
+    /*if (m_projectMonitor) {
+        connect(m_projectMonitor->render, SIGNAL(showAudioSignal(const QByteArray&)), m_audiosignal, SLOT(showAudio(const QByteArray&)));
+    }
+    if (m_clipMonitor) {
+        connect(m_clipMonitor->render, SIGNAL(showAudioSignal(const QByteArray&)), m_audiosignal, SLOT(showAudio(const QByteArray&)));
+    }*/
+
+    m_audioSpectrum = new AudioSpectrum(m_projectMonitor, m_clipMonitor);
+    m_audioSpectrumDock = new QDockWidget(i18n("AudioSpectrum"), this);
+    m_audioSpectrumDock->setObjectName(m_audioSpectrum->widgetName());
+    m_audioSpectrumDock->setWidget(m_audioSpectrum);
+    addDockWidget(Qt::TopDockWidgetArea, m_audioSpectrumDock);
+
+    // Connect the audio signal to the audio scope slots
+    bool b = true;
+    if (m_projectMonitor) {
+        qDebug() << "project monitor connected";
+        b &= connect(m_projectMonitor->render, SIGNAL(audioSamplesSignal(QVector<int16_t>, int, int, int)),
+                     m_audioSpectrum, SLOT(slotReceiveAudio(QVector<int16_t>, int, int, int)));
+        b &= connect(m_projectMonitor->render, SIGNAL(audioSamplesSignal(const QVector<int16_t>&, const int&, const int&, const int&)),
+                     m_audiosignal, SLOT(slotReceiveAudio(const QVector<int16_t>&, const int&, const int&, const int&)));
+    }
+    if (m_clipMonitor) {
+        qDebug() << "clip monitor connected";
+        b &= connect(m_clipMonitor->render, SIGNAL(audioSamplesSignal(QVector<int16_t>, int, int, int)),
+                     m_audioSpectrum, SLOT(slotReceiveAudio(QVector<int16_t>, int, int, int)));
+        b &= connect(m_clipMonitor->render, SIGNAL(audioSamplesSignal(const QVector<int16_t>&, int, int, int)),
+                     m_audiosignal, SLOT(slotReceiveAudio(const QVector<int16_t>&, int, int, int)));
+    }
+    // Ensure connection was set up correctly
+    Q_ASSERT(b);
+
     m_undoViewDock = new QDockWidget(i18n("Undo History"), this);
     m_undoViewDock->setObjectName("undo_history");
     m_undoView = new QUndoView();
@@ -323,6 +367,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();
 
 
@@ -361,7 +419,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);
@@ -485,9 +542,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.
@@ -515,10 +569,16 @@ 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()
 {
+    if (m_stopmotion) {
+        delete m_stopmotion;
+    }
     m_effectStack->slotClipItemSelected(NULL, 0);
     m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
 
@@ -538,7 +598,7 @@ MainWindow::~MainWindow()
 void MainWindow::queryQuit()
 {
     if (queryClose()) {
-        kapp->quit();
+        close();
     }
 }
 
@@ -718,7 +778,6 @@ void MainWindow::activateShuttleDevice()
     connect(m_jogProcess, SIGNAL(forward1()), m_monitorManager, SLOT(slotForwardOneFrame()));
     connect(m_jogProcess, SIGNAL(rewind(double)), m_monitorManager, SLOT(slotRewind(double)));
     connect(m_jogProcess, SIGNAL(forward(double)), m_monitorManager, SLOT(slotForward(double)));
-    connect(m_jogProcess, SIGNAL(stop()), m_monitorManager, SLOT(slotPlay()));
     connect(m_jogProcess, SIGNAL(button(int)), this, SLOT(slotShuttleButton(int)));
 }
 
@@ -837,7 +896,7 @@ void MainWindow::setupActions()
 
     KActionCollection* collection = actionCollection();
     m_timecodeFormat = new KComboBox(this);
-    m_timecodeFormat->addItem(i18n("hh:mm:ss::ff"));
+    m_timecodeFormat->addItem(i18n("hh:mm:ss:ff"));
     m_timecodeFormat->addItem(i18n("Frames"));
     if (KdenliveSettings::frametimecode()) m_timecodeFormat->setCurrentIndex(1);
     connect(m_timecodeFormat, SIGNAL(activated(int)), this, SLOT(slotUpdateTimecodeFormat(int)));
@@ -1153,6 +1212,11 @@ void MainWindow::setupActions()
     switchMon->setShortcut(Qt::Key_T);
     connect(switchMon, SIGNAL(triggered(bool)), this, SLOT(slotSwitchMonitors()));
 
+    KAction *fullMon = collection->addAction("monitor_fullscreen");
+    fullMon->setText(i18n("Switch monitor fullscreen"));
+    fullMon->setIcon(KIcon("view-fullscreen"));
+    connect(fullMon, SIGNAL(triggered(bool)), this, SLOT(slotSwitchFullscreen()));
+
     KAction *insertTree = collection->addAction("insert_project_tree");
     insertTree->setText(i18n("Insert zone in project tree"));
     insertTree->setShortcut(Qt::CTRL + Qt::Key_I);
@@ -1339,6 +1403,11 @@ void MainWindow::setupActions()
     collection->addAction("edit_clip_marker", editClipMarker);
     connect(editClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotEditClipMarker()));
 
+    KAction *addMarkerGuideQuickly = new KAction(KIcon("bookmark-new"), i18n("Add Marker/Guide quickly"), this);
+    addMarkerGuideQuickly->setShortcut(Qt::Key_Asterisk);
+    collection->addAction("add_marker_guide_quickly", addMarkerGuideQuickly);
+    connect(addMarkerGuideQuickly, SIGNAL(triggered(bool)), this, SLOT(slotAddMarkerGuideQuickly()));
+
     KAction* splitAudio = new KAction(KIcon("document-new"), i18n("Split Audio"), this);
     collection->addAction("split_audio", splitAudio);
     connect(splitAudio, SIGNAL(triggered(bool)), this, SLOT(slotSplitAudio()));
@@ -1504,6 +1573,10 @@ void MainWindow::setupActions()
     connect(reloadClip , SIGNAL(triggered()), m_projectList, SLOT(slotReloadClip()));
     reloadClip->setEnabled(false);
 
+    QAction *stopMotion = new KAction(KIcon("image-x-generic"), i18n("Stop Motion Capture"), this);
+    collection->addAction("stopmotion", stopMotion);
+    connect(stopMotion , SIGNAL(triggered()), this, SLOT(slotOpenStopmotion()));
+
     QMenu *addClips = new QMenu();
     addClips->addAction(addClip);
     addClips->addAction(addColorClip);
@@ -1810,15 +1883,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
@@ -1931,7 +1997,27 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
 {
     if (!m_timelineArea->isEnabled()) return;
     m_fileRevert->setEnabled(true);
-    KdenliveDoc *doc = new KdenliveDoc(url, KdenliveSettings::defaultprojectfolder(), m_commandStack, KdenliveSettings::default_profile(), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), m_projectMonitor->render, m_notesWidget, this);
+
+    // 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);
+    progressDialog.show();
+    progressDialog.progressBar()->setValue(0);
+    qApp->processEvents();
+
+    KdenliveDoc *doc = new KdenliveDoc(url, KdenliveSettings::defaultprojectfolder(), m_commandStack, KdenliveSettings::default_profile(), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), m_projectMonitor->render, m_notesWidget, this, &progressDialog);
+
+    progressDialog.progressBar()->setValue(1);
+    progressDialog.progressBar()->setMaximum(4);
+    progressDialog.setLabelText(i18n("Loading project"));
+    qApp->processEvents();
+
     if (stale == NULL) {
         stale = new KAutoSaveFile(url, doc);
         doc->m_autosave = stale;
@@ -1942,8 +2028,16 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
         stale->setParent(doc);
     }
     connectDocumentInfo(doc);
+
+    progressDialog.progressBar()->setValue(2);
+    qApp->processEvents();
+
     bool ok;
     TrackView *trackView = new TrackView(doc, &ok, this);
+
+    progressDialog.progressBar()->setValue(3);
+    qApp->processEvents();
+
     m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description()));
     if (!ok) {
         m_timelineArea->setEnabled(false);
@@ -1962,6 +2056,8 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
     m_projectMonitor->adjustRulerSize(trackView->duration());
     m_projectMonitor->slotZoneMoved(trackView->inPoint(), trackView->outPoint());
     m_clipMonitor->refreshMonitor(true);
+
+    progressDialog.progressBar()->setValue(4);
 }
 
 void MainWindow::recoverFiles(QList<KAutoSaveFile *> staleFiles)
@@ -2104,6 +2200,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);
@@ -2241,7 +2343,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
             disconnect(m_activeDocument, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
             disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
             disconnect(m_activeDocument, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
-            disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
+            disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(const QString &)), this, SLOT(slotDeleteClip(const QString &)));
             disconnect(m_activeDocument, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
             disconnect(m_activeDocument, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
             disconnect(m_activeDocument, SIGNAL(deleteTimelineClip(const QString &)), m_activeTimeline, SLOT(slotDeleteClip(const QString &)));
@@ -2278,7 +2380,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
         }
         //m_activeDocument->setRenderer(NULL);
         disconnect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
-        disconnect(m_projectList, SIGNAL(refreshClip()), m_clipMonitor, SLOT(refreshMonitor()));
+        disconnect(m_projectList, SIGNAL(refreshClip()), m_monitorManager, SLOT(slotRefreshCurrentMonitor()));
         m_clipMonitor->stop();
     }
     KdenliveSettings::setCurrent_profile(doc->profilePath());
@@ -2288,7 +2390,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
     m_transitionConfig->updateProjectFormat(doc->mltProfile(), doc->timecode(), doc->tracksList());
     m_effectStack->updateProjectFormat(doc->mltProfile(), doc->timecode());
     connect(m_projectList, SIGNAL(clipSelected(DocClipBase *, QPoint)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint)));
-    connect(m_projectList, SIGNAL(refreshClip()), m_clipMonitor, SLOT(refreshMonitor()));
+    connect(m_projectList, SIGNAL(refreshClip()), m_monitorManager, SLOT(slotRefreshCurrentMonitor()));
     connect(m_projectList, SIGNAL(clipNeedsReload(const QString&, bool)), trackView->projectView(), SLOT(slotUpdateClip(const QString &, bool)));
 
     connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified()));
@@ -2315,7 +2417,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
 
     connect(doc, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
     connect(doc, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
-    connect(doc, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
+    connect(doc, SIGNAL(signalDeleteProjectClip(const QString &)), this, SLOT(slotDeleteClip(const QString &)));
     connect(doc, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
     connect(doc, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
 
@@ -2390,7 +2492,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
@@ -2424,6 +2525,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);
@@ -2436,11 +2538,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);
 }
@@ -2454,14 +2554,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
@@ -2673,6 +2765,26 @@ void MainWindow::slotEditClipMarker()
     }
 }
 
+void MainWindow::slotAddMarkerGuideQuickly()
+{
+    if (!m_activeTimeline || !m_activeDocument)
+        return;
+
+    if (m_clipMonitor->isActive()) {
+        DocClipBase *clip = m_clipMonitor->activeClip();
+        GenTime pos = m_clipMonitor->position();
+
+        if (!clip) {
+            m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), ErrorMessage);
+            return;
+        }
+
+        m_activeTimeline->projectView()->slotAddClipMarker(clip->getId(), pos, m_activeDocument->timecode().getDisplayTimecode(pos, false));
+    } else {
+        m_activeTimeline->projectView()->slotAddGuide(false);
+    }
+}
+
 void MainWindow::slotAddGuide()
 {
     if (m_activeTimeline)
@@ -2987,6 +3099,13 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip)
                 // duration changed, we need to update duration
                 newprops.insert("out", QString::number(dia_ui->outPoint()));
             }
+            if (!path.isEmpty()) {
+                // we are editing an external file, asked if we want to detach from that file or save the result to that title file.
+                if (KMessageBox::questionYesNo(this, i18n("You are editing an external title clip (%1). Do you want to save your changes to the title file or save the changes for this project only?", path), i18n("Save Title"), KGuiItem(i18n("Save to title file")), KGuiItem(i18n("Save in project only"))) == KMessageBox::Yes) {
+                    // save to external file
+                    dia_ui->saveTitle(path);
+                } else newprops.insert("resource", QString());
+            }
             EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
             m_activeDocument->commandStack()->push(command);
             //m_activeTimeline->projectView()->slotUpdateClip(clip->getId());
@@ -2999,19 +3118,23 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip)
     }
 
     // any type of clip but a title
-    ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
-    connect(&dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
-    if (dia.exec() == QDialog::Accepted) {
-        QMap <QString, QString> newprops = dia.properties();
-        if (newprops.isEmpty()) return;
-        EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
-        m_activeDocument->commandStack()->push(command);
-        m_activeDocument->setModified();
+    ClipProperties *dia = new ClipProperties(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
+    connect(dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
+    connect(dia, SIGNAL(applyNewClipProperties(const QString, QMap <QString, QString> , QMap <QString, QString> , bool, bool)), this, SLOT(slotApplyNewClipProperties(const QString, QMap <QString, QString> , QMap <QString, QString> , bool, bool)));
+    dia->show();
+}
 
-        if (dia.needsTimelineRefresh()) {
-            // update clip occurences in timeline
-            m_activeTimeline->projectView()->slotUpdateClip(clip->getId(), dia.needsTimelineReload());
-        }
+
+void MainWindow::slotApplyNewClipProperties(const QString id, QMap <QString, QString> props, QMap <QString, QString> newprops, bool refresh, bool reload)
+{
+    if (newprops.isEmpty()) return;
+    EditClipCommand *command = new EditClipCommand(m_projectList, id, props, newprops, true);
+    m_activeDocument->commandStack()->push(command);
+    m_activeDocument->setModified();
+
+    if (refresh) {
+        // update clip occurences in timeline
+        m_activeTimeline->projectView()->slotUpdateClip(id, reload);
     }
 }
 
@@ -3775,6 +3898,12 @@ void MainWindow::slotSwitchMonitors()
     else m_projectList->focusTree();
 }
 
+void MainWindow::slotSwitchFullscreen()
+{
+    if (m_projectMonitor->isActive()) m_projectMonitor->slotSwitchFullScreen();
+    else m_clipMonitor->slotSwitchFullScreen();
+}
+
 void MainWindow::slotInsertZoneToTree()
 {
     if (!m_clipMonitor->isActive() || m_clipMonitor->activeClip() == NULL) return;
@@ -3806,63 +3935,15 @@ void MainWindow::slotDeleteProjectClips(QStringList ids, QMap<QString, QString>
 
 void MainWindow::slotShowTitleBars(bool show)
 {
-    if (show) {
-        m_effectStackDock->setTitleBarWidget(0);
-        m_clipMonitorDock->setTitleBarWidget(0);
-        m_projectMonitorDock->setTitleBarWidget(0);
-#ifndef Q_WS_MAC
-        m_recMonitorDock->setTitleBarWidget(0);
-#endif
-        m_effectListDock->setTitleBarWidget(0);
-        m_transitionConfigDock->setTitleBarWidget(0);
-        m_projectListDock->setTitleBarWidget(0);
-        m_undoViewDock->setTitleBarWidget(0);
-        m_vectorscopeDock->setTitleBarWidget(0);
-        m_waveformDock->setTitleBarWidget(0);
-        m_RGBParadeDock->setTitleBarWidget(0);
-        m_histogramDock->setTitleBarWidget(0);
-        m_notesDock->setTitleBarWidget(0);
-    } else {
-        if (!m_effectStackDock->isFloating()) {
-            m_effectStackDock->setTitleBarWidget(new QWidget);
-        }
-        if (!m_clipMonitorDock->isFloating()) {
-            m_clipMonitorDock->setTitleBarWidget(new QWidget);
-        }
-        if (!m_projectMonitorDock->isFloating()) {
-            m_projectMonitorDock->setTitleBarWidget(new QWidget);
-        }
-#ifndef Q_WS_MAC
-        if (!m_recMonitorDock->isFloating()) {
-            m_recMonitorDock->setTitleBarWidget(new QWidget);
-        }
-#endif
-        if (!m_effectListDock->isFloating()) {
-            m_effectListDock->setTitleBarWidget(new QWidget);
-        }
-        if (!m_transitionConfigDock->isFloating()) {
-            m_transitionConfigDock->setTitleBarWidget(new QWidget);
-        }
-        if (!m_projectListDock->isFloating()) {
-            m_projectListDock->setTitleBarWidget(new QWidget);
-        }
-        if (!m_undoViewDock->isFloating()) {
-            m_undoViewDock->setTitleBarWidget(new QWidget);
-        }
-        if (!m_vectorscopeDock->isFloating()) {
-            m_vectorscopeDock->setTitleBarWidget(new QWidget);
-        }
-        if (!m_waveformDock->isFloating()) {
-            m_waveformDock->setTitleBarWidget(new QWidget);
-        }
-        if (!m_RGBParadeDock->isFloating()) {
-            m_RGBParadeDock->setTitleBarWidget(new QWidget(this));
-        }
-        if (!m_histogramDock->isFloating()) {
-            m_histogramDock->setTitleBarWidget(new QWidget(this));
-        }
-        if (!m_notesDock->isFloating()) {
-            m_notesDock->setTitleBarWidget(new QWidget(this));
+    QList <QDockWidget *> docks = findChildren<QDockWidget *>();
+    for (int i = 0; i < docks.count(); i++) {
+        QDockWidget* dock = docks.at(i);
+        if (show) {
+            dock->setTitleBarWidget(0);
+        } else {
+            if (!dock->isFloating()) {
+                dock->setTitleBarWidget(new QWidget);
+            }
         }
     }
     KdenliveSettings::setShowtitlebars(show);
@@ -3940,5 +4021,29 @@ void MainWindow::slotUpdateColorScopes()
     }
 }
 
+void MainWindow::slotOpenStopmotion()
+{
+    if (m_stopmotion == NULL) {
+        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)));
+        for (int i = 0; i < m_scopesList.count(); i++) {
+            // Check if we need the renderer to send a new frame for update
+            /*if (!m_scopesList.at(i)->widget()->visibleRegion().isEmpty() && !(static_cast<AbstractScopeWidget *>(m_scopesList.at(i)->widget())->autoRefreshEnabled())) request = true;*/
+            connect(m_stopmotion, SIGNAL(gotFrame(QImage)), static_cast<AbstractScopeWidget *>(m_scopesList.at(i)->widget()), SLOT(slotRenderZoneUpdated(QImage)));
+            //static_cast<AbstractScopeWidget *>(m_scopesList.at(i)->widget())->slotMonitorCapture();
+        }
+    }
+    m_stopmotion->show();
+}
+
+void MainWindow::slotDeleteClip(const QString &id)
+{
+    QList <ClipProperties *> list = findChildren<ClipProperties *>();
+    for (int i = 0; i < list.size(); ++i) {
+        list.at(i)->disableClipId(id);
+    }
+    m_projectList->slotDeleteClip(id);
+}
+
 #include "mainwindow.moc"