]> git.sesse.net Git - kdenlive/commitdiff
* Fix crash on renderer stopping
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 1 Sep 2008 19:44:55 +0000 (19:44 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 1 Sep 2008 19:44:55 +0000 (19:44 +0000)
* No more tabs by default
* small UI fixes

svn path=/branches/KDE4/; revision=2388

src/effectstackview.cpp
src/effectstackview.h
src/kdenlivedoc.h
src/kdenlivesettings.kcfg
src/mainwindow.cpp
src/mainwindow.h
src/projectlist.cpp
src/projectlist.h
src/renderer.cpp
src/widgets/configmisc_ui.ui

index 09c92f5f363ebc0a69971935cddcc05c5bf6260a..6c018c787298db7dbcdcbd46a79a806c555d132e 100644 (file)
@@ -288,4 +288,13 @@ void EffectStackView::raiseWindow(QWidget* dock) {
         dock->raise();
 }
 
+void EffectStackView::clear() {
+    ui.effectlist->clear();
+    ui.buttonDel->setEnabled(false);
+    ui.buttonSave->setEnabled(false);
+    ui.buttonReset->setEnabled(false);
+    ui.buttonUp->setEnabled(false);
+    ui.buttonDown->setEnabled(false);
+}
+
 #include "effectstackview.moc"
index 7b15c54de37a70c1f6feb1190f76611951bd52ab..ebafffa34f3eea06a4a3a784c81c6c4bb7a179cd 100644 (file)
@@ -29,6 +29,8 @@ class EffectStackView : public QWidget {
 public:
     EffectStackView(QWidget *parent = 0);
     void raiseWindow(QWidget*);
+    void clear();
+
 private:
     Ui::EffectStack_UI ui;
     ClipItem* clipref;
index 4c03b250c77aa86b3a749f779d73be631ef7a46e..d4f99a8748100c23ab7261ad3964c483dffb9660 100644 (file)
@@ -92,8 +92,6 @@ Q_OBJECT public:
     void setUrl(KUrl url);
     QDomElement documentInfoXml();
     void setProfilePath(QString path);
-    /** Set to true if document needs saving, false otherwise */
-    void setModified(bool mod);
     const QString&getFreeClipId();
     /** does the document need saving */
     bool isModified() const;
@@ -136,6 +134,8 @@ private:
 
 public slots:
     void slotCreateTextClip(QString group, const QString &groupId);
+    /** Set to true if document needs saving, false otherwise */
+    void setModified(bool mod = true);
 
 private slots:
     void slotAutoSave();
index 46fa17788e2f70fc3a3f2c06ce7d1a938b672e7b..619f2b0490c0f7106ec2beb5b43d6d867e6eebd0 100644 (file)
       <default>true</default>
     </entry>
 
+    <entry name="activatetabs" type="Bool">
+      <label>Create a new tab when opening a document.</label>
+      <default>false</default>
+    </entry>
+
     <entry name="color_duration" type="String">
       <label>Default color clip duration.</label>
       <default>00:00:05:00</default>
index d465ac41d5a2dba99eb7ecaa52e1e73ad3084b59..e248910aedff57e4e1aaa73886890d5eaae0ec2e 100644 (file)
@@ -105,7 +105,7 @@ MainWindow::MainWindow(QWidget *parent)
     m_timelineArea->setTabBarHidden(true);
 
     QToolButton *closeTabButton = new QToolButton;
-    connect(closeTabButton, SIGNAL(clicked()), this, SLOT(slotRemoveTab()));
+    connect(closeTabButton, SIGNAL(clicked()), this, SLOT(closeCurrentDocument()));
     closeTabButton->setIcon(KIcon("tab-close"));
     closeTabButton->adjustSize();
     closeTabButton->setToolTip(i18n("Close the current tab"));
@@ -710,8 +710,8 @@ void MainWindow::setupActions() {
     KStandardAction::open(this, SLOT(openFile()),
                           actionCollection());
 
-    KStandardAction::save(this, SLOT(saveFile()),
-                          actionCollection());
+    m_saveAction = KStandardAction::save(this, SLOT(saveFile()),
+                                         actionCollection());
 
     KStandardAction::saveAs(this, SLOT(saveFileAs()),
                             actionCollection());
@@ -794,13 +794,14 @@ void MainWindow::newFile() {
 }
 
 void MainWindow::activateDocument() {
+    if (m_timelineArea->currentWidget() == NULL) return;
     TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
     KdenliveDoc *currentDoc = currentTab->document();
     connectDocumentInfo(currentDoc);
     connectDocument(currentTab, currentDoc);
 }
 
-void MainWindow::slotRemoveTab() {
+void MainWindow::closeCurrentDocument() {
     QWidget *w = m_timelineArea->currentWidget();
     // closing current document
     int ix = m_timelineArea->currentIndex() + 1;
@@ -808,10 +809,23 @@ void MainWindow::slotRemoveTab() {
     m_timelineArea->setCurrentIndex(ix);
     TrackView *tabToClose = (TrackView *) w;
     KdenliveDoc *docToClose = tabToClose->document();
+    if (docToClose && docToClose->isModified()) {
+        switch (KMessageBox::warningYesNoCancel(this, i18n("Save changes to document ?"))) {
+        case KMessageBox::Yes :
+            // save document here. If saving fails, return false;
+            saveFile();
+            break;
+        case KMessageBox::Cancel :
+            return;
+        default:
+            break;
+        }
+    }
     m_timelineArea->removeTab(m_timelineArea->indexOf(w));
     if (m_timelineArea->count() == 1) m_timelineArea->setTabBarHidden(true);
     delete docToClose;
     delete w;
+    if (m_timelineArea->count() == 0) m_activeDocument = NULL;
 }
 
 void MainWindow::saveFileAs(const QString &outputFileName) {
@@ -861,7 +875,6 @@ void MainWindow::openLastFile() {
 
 void MainWindow::openFile(const KUrl &url) {
     // Check for backup file
-
     QList<KAutoSaveFile *> staleFiles = KAutoSaveFile::staleFiles(url);
     if (!staleFiles.isEmpty()) {
         if (KMessageBox::questionYesNo(this,
@@ -878,6 +891,7 @@ void MainWindow::openFile(const KUrl &url) {
             }
         }
     }
+    if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
     doOpenFile(url, NULL);
 }
 
@@ -903,6 +917,7 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale) {
 }
 
 void MainWindow::recoverFiles(QList<KAutoSaveFile *> staleFiles) {
+    if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
     foreach(KAutoSaveFile *stale, staleFiles) {
         /*if (!stale->open(QIODevice::QIODevice::ReadOnly)) {
                   // show an error message; we could not steal the lockfile
@@ -984,7 +999,7 @@ void MainWindow::slotEditProjectSettings() {
         m_activeDocument->setProfilePath(profile);
         KdenliveSettings::setCurrent_profile(profile);
         KdenliveSettings::setProject_fps(m_activeDocument->fps());
-        setCaption(m_activeDocument->description());
+        setCaption(m_activeDocument->description(), m_activeDocument->isModified());
         m_monitorManager->resetProfiles(m_activeDocument->timecode());
         if (m_renderWidget) m_renderWidget->setDocumentStandard(m_activeDocument->getDocumentStandard());
         m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
@@ -1046,6 +1061,7 @@ void MainWindow::slotUpdateMousePosition(int pos) {
 
 void MainWindow::slotUpdateDocumentState(bool modified) {
     setCaption(m_activeDocument->description(), modified);
+    m_saveAction->setEnabled(modified);
     if (modified) {
         m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Link));
         m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("document-save"));
@@ -1072,6 +1088,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
         if (m_activeTimeline) {
             disconnect(m_projectMonitor, SIGNAL(renderPosition(int)), m_activeTimeline, SLOT(moveCursorPos(int)));
             disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
+            disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
             disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
             disconnect(m_activeDocument, SIGNAL(addProjectFolder(const QString, const QString &, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, const QString &, bool, bool)));
             disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
@@ -1096,6 +1113,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
             disconnect(effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
             disconnect(transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
             disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
+            effectStack->clear();
         }
         m_activeDocument->setRenderer(NULL);
         disconnect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
@@ -1106,6 +1124,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
     m_monitorManager->resetProfiles(doc->timecode());
     m_projectList->setDocument(doc);
     connect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
+    connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified()));
     connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
     connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
     connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
@@ -1159,7 +1178,8 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
     //m_overView->scale(m_overView->width() / trackView->duration(), m_overView->height() / (50 * trackView->tracksNumber()));
     //m_overView->fitInView(m_overView->itemAt(0, 50), Qt::KeepAspectRatio);
 
-    setCaption(doc->description());
+    setCaption(doc->description(), doc->isModified());
+    m_saveAction->setEnabled(doc->isModified());
     m_activeDocument = doc;
 }
 
index 4190e29b4a4e26444cd9da5247877709833dd818..6063959d70b1714572ffb57f3246164d823391c4 100644 (file)
@@ -145,6 +145,7 @@ private:
     QAction *m_buttonRazorTool;
     QAction *m_buttonSnap;
     QActionGroup *m_toolGroup;
+    QAction *m_saveAction;
     QSlider *m_zoomSlider;
     StatusBarMessageLabel *m_messageLabel;
 
@@ -197,7 +198,7 @@ private slots:
     void slotZoomIn();
     void slotZoomOut();
     void slotFitZoom();
-    void slotRemoveTab();
+    void closeCurrentDocument();
     void slotDeleteTimelineClip();
     void slotAddClipMarker();
     void slotDeleteClipMarker();
index ede62c7ba5488e58dd77ba075fdb04df64b499ba..cc8e8f2dd05c4786b6a71ee5aca685f4bd0217da 100644 (file)
@@ -167,6 +167,7 @@ void ProjectList::slotUpdateClipProperties(ProjectItem *clip, QMap <QString, QSt
             Nepomuk::Resource f(clip->clipUrl().path());
             if (f.isValid()) f.setDescription(properties.value("description"));
         }
+        emit projectModified();
     }
 }
 
index 08b46510ec38e03f5113e3abf0395588fe825222..7f93191067d96a568fc4400041181302a52dd6a0 100644 (file)
@@ -155,13 +155,12 @@ private slots:
     void slotUpdateClipProperties(ProjectItem *item, QMap <QString, QString> properties);
     //void slotShowMenu(const QPoint &pos);
 
-
-
 signals:
     void clipSelected(DocClipBase *);
     void getFileProperties(const QDomElement&, const QString &);
     void receivedClipDuration(const QString &, int);
     void showClipProperties(DocClipBase *);
+    void projectModified();
 };
 
 #endif
index a024bdf5fffe40a0d87bc18bc33e82651244d2cc..253a5545edd4427efbfac528cd4c69c19fe53466 100644 (file)
@@ -935,7 +935,8 @@ void Render::clear() {
 void Render::stop() {
     if (m_mltConsumer && !m_mltConsumer->is_stopped()) {
         kDebug() << "/////////////   RENDER STOPPED: " << m_name;
-        //m_mltConsumer->set("refresh", 0);
+        m_isBlocked = true;
+        m_mltConsumer->set("refresh", 0);
         m_mltConsumer->stop();
     }
     kDebug() << "/////////////   RENDER STOP2-------";
index 4a32b4181f86411c9bb8f250a194a187f722c010..b0cc1a36ca7756741f5cf29160653f13293b890a 100644 (file)
@@ -6,11 +6,11 @@
     <x>0</x>
     <y>0</y>
     <width>369</width>
-    <height>285</height>
+    <height>308</height>
    </rect>
   </property>
   <layout class="QGridLayout" name="gridLayout_4" >
-   <item row="2" column="0" >
+   <item row="3" column="0" >
     <widget class="QGroupBox" name="groupBox" >
      <property name="title" >
       <string>Default Durations</string>
@@ -50,7 +50,7 @@
      </layout>
     </widget>
    </item>
-   <item row="3" column="0" >
+   <item row="4" column="0" >
     <widget class="QGroupBox" name="properties" >
      <property name="title" >
       <string>Default Profile</string>
      </layout>
     </widget>
    </item>
-   <item row="4" column="0" >
+   <item row="5" column="0" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
      <property name="text" >
       <string>Crash recovery (automatic backup)</string>
      </property>
-     <property name="checked" >
-      <bool>true</bool>
+    </widget>
+   </item>
+   <item row="2" column="0" >
+    <widget class="QCheckBox" name="kcfg_activatetabs" >
+     <property name="text" >
+      <string>Open projects in new tabs</string>
      </property>
     </widget>
    </item>