]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Fix timeline handling of objects (move them instead of changing their bounding rect
[kdenlive] / src / mainwindow.cpp
index 22cfe6864fd41fbeb442a5a66dc8b05d0c4bd31f..106fb0e092e7e688e33e8c9ff7d494a9361aaaf4 100644 (file)
@@ -244,6 +244,7 @@ MainWindow::MainWindow(QWidget *parent)
     m_timelineContextMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Paste)));
 
     m_timelineContextClipMenu->addAction(actionCollection()->action("delete_timeline_clip"));
+    m_timelineContextClipMenu->addAction(actionCollection()->action("change_clip_speed"));
     m_timelineContextClipMenu->addAction(actionCollection()->action("cut_timeline_clip"));
     m_timelineContextClipMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Copy)));
     m_timelineContextClipMenu->addAction(actionCollection()->action("paste_effects"));
@@ -315,7 +316,7 @@ void MainWindow::readProperties(KConfig *config) {
 void MainWindow::slotReloadEffects() {
     initEffects::parseCustomEffectsFile();
     m_customEffectsMenu->clear();
-    QStringList effects = customEffects.effectNames();
+    const QStringList effects = customEffects.effectNames();
     QAction *action;
     foreach(const QString &name, effects) {
         action = new QAction(name, this);
@@ -403,6 +404,9 @@ void MainWindow::slotConnectMonitors() {
     connect(m_projectList, SIGNAL(getFileProperties(const QDomElement &, int)), m_clipMonitor->render, SLOT(getFileProperties(const QDomElement &, int)));
     connect(m_clipMonitor->render, SIGNAL(replyGetImage(int, int, const QPixmap &, int, int)), m_projectList, SLOT(slotReplyGetImage(int, int, const QPixmap &, int, int)));
     connect(m_clipMonitor->render, SIGNAL(replyGetFileProperties(int, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &)), m_projectList, SLOT(slotReplyGetFileProperties(int, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &)));
+
+    connect(m_clipMonitor->render, SIGNAL(removeInvalidClip(int)), m_projectList, SLOT(slotRemoveInvalidClip(int)));
+
     connect(m_clipMonitor, SIGNAL(refreshClipThumbnail(int)), m_projectList, SLOT(slotRefreshClipThumbnail(int)));
 }
 
@@ -624,6 +628,10 @@ void MainWindow::setupActions() {
     actionCollection()->addAction("delete_timeline_clip", deleteTimelineClip);
     connect(deleteTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotDeleteTimelineClip()));
 
+    KAction* editTimelineClipSpeed = new KAction(KIcon("edit-delete"), i18n("Change Clip Speed"), this);
+    actionCollection()->addAction("change_clip_speed", editTimelineClipSpeed);
+    connect(editTimelineClipSpeed, SIGNAL(triggered(bool)), this, SLOT(slotChangeClipSpeed()));
+
     KAction* cutTimelineClip = new KAction(KIcon("edit-cut"), i18n("Cut Clip"), this);
     cutTimelineClip->setShortcut(Qt::SHIFT + Qt::Key_R);
     actionCollection()->addAction("cut_timeline_clip", cutTimelineClip);
@@ -692,11 +700,15 @@ void MainWindow::setupActions() {
     KStandardAction::paste(this, SLOT(slotPaste()),
                            actionCollection());
 
-    KStandardAction::undo(this, SLOT(undo()),
-                          actionCollection());
+    KAction *undo = KStandardAction::undo(m_commandStack, SLOT(undo()),
+                                          actionCollection());
+    undo->setEnabled(false);
+    connect(m_commandStack, SIGNAL(canUndoChanged(bool)), undo, SLOT(setEnabled(bool)));
 
-    KStandardAction::redo(this, SLOT(redo()),
-                          actionCollection());
+    KAction *redo = KStandardAction::redo(m_commandStack, SLOT(redo()),
+                                          actionCollection());
+    redo->setEnabled(false);
+    connect(m_commandStack, SIGNAL(canRedoChanged(bool)), redo, SLOT(setEnabled(bool)));
 
     KStandardAction::fullScreen(this, SLOT(slotFullScreen()), this, actionCollection());
 
@@ -708,14 +720,6 @@ void MainWindow::setupActions() {
     readOptions();
 }
 
-void MainWindow::undo() {
-    m_commandStack->undo();
-}
-
-void MainWindow::redo() {
-    m_commandStack->redo();
-}
-
 void MainWindow::slotDisplayActionMessage(QAction *a) {
     statusBar()->showMessage(a->data().toString(), 3000);
 }
@@ -813,8 +817,9 @@ void MainWindow::openFile() {
 
 void MainWindow::openLastFile() {
     KSharedConfigPtr config = KGlobal::config();
-    QString Lastproject = config->group("Recent Files").readPathEntry("File1", QString());
-    openFile(KUrl(Lastproject));
+    KUrl::List urls = m_fileOpenRecent->urls();
+    if (urls.isEmpty()) newFile();
+    else openFile(urls.last());
 }
 
 void MainWindow::openFile(const KUrl &url) {
@@ -1111,6 +1116,7 @@ void MainWindow::slotPreferences(int page, int option) {
     // create it :
     KdenliveSettingsDialog* dialog = new KdenliveSettingsDialog(this);
     connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
+    connect(dialog, SIGNAL(doResetProfile()), this, SLOT(resetProfiles()));
     dialog->show();
     if (page != -1) dialog->showPage(page, option);
 }
@@ -1129,6 +1135,10 @@ void MainWindow::updateConfiguration() {
 
 }
 
+void MainWindow::resetProfiles() {
+    m_monitorManager->resetProfiles(m_activeDocument->profilePath());
+}
+
 void MainWindow::slotSwitchVideoThumbs() {
     KdenliveSettings::setVideothumbnails(!KdenliveSettings::videothumbnails());
     if (m_activeTimeline) {
@@ -1167,6 +1177,12 @@ void MainWindow::slotDeleteTimelineClip() {
     }
 }
 
+void MainWindow::slotChangeClipSpeed() {
+    if (m_activeTimeline) {
+        m_activeTimeline->projectView()->changeClipSpeed();
+    }
+}
+
 void MainWindow::slotAddClipMarker() {
     if (m_activeTimeline) {
         m_activeTimeline->projectView()->slotAddClipMarker();