]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Fix clip monitor not activated on open: http://kdenlive.org/mantis/view.php?id=2992
[kdenlive] / src / mainwindow.cpp
index cecbe4bb17542b3539c27cdc3d29a964567bdb93..f6fd491a8e2e8e2888e8313324c2257c4ef42cb4 100644 (file)
@@ -623,7 +623,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
        viewMenu->addAction(guiActions->addAction(viewActions.at(i).first, viewActions.at(i).second));
     
     // Populate encoding profiles
-    KConfig conf("encodingprofiles.rc", KConfig::FullConfig, "appdata");
+    KConfig conf("encodingprofiles.rc", KConfig::CascadeConfig, "appdata");
     if (KdenliveSettings::proxyparams().isEmpty() || KdenliveSettings::proxyextension().isEmpty()) {
         KConfigGroup group(&conf, "proxy");
         QMap< QString, QString > values = group.entryMap();
@@ -2012,6 +2012,7 @@ bool MainWindow::closeCurrentDocument(bool saveChanges)
     if (docToClose == m_activeDocument) {
         delete m_activeDocument;
         m_activeDocument = NULL;
+       m_monitorManager->setDocument(m_activeDocument);
         m_effectStack->clear();
         m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
     } else {
@@ -2110,13 +2111,23 @@ void MainWindow::openFile(const KUrl &url)
         // Opening a compressed project file, we need to process it
         kDebug()<<"Opening archive, processing";
         QPointer<ArchiveWidget> ar = new ArchiveWidget(url);
-        if (ar->exec() == QDialog::Accepted) openFile(KUrl(ar->extractedProjectFile()));
+        if (ar->exec() == QDialog::Accepted) {
+           openFile(KUrl(ar->extractedProjectFile()));
+       }
+       else if (!m_startUrl.isEmpty()) {
+           // we tried to open an invalid file from command line, init new project
+           newFile(false);
+       }
         delete ar;
         return;
     }
     if (!url.fileName().endsWith(".kdenlive")) {
         // This is not a Kdenlive project file, abort loading
         KMessageBox::sorry(this, i18n("File %1 is not a Kdenlive project file", url.path()));
+       if (!m_startUrl.isEmpty()) {
+           // we tried to open an invalid file from command line, init new project
+           newFile(false);
+       }
         return;
     }
 
@@ -2425,7 +2436,6 @@ void MainWindow::slotUpdateProjectProfile(const QString &profile)
     KdenliveSettings::setCurrent_profile(profile);
     KdenliveSettings::setProject_fps(m_activeDocument->fps());
     setCaption(m_activeDocument->description(), m_activeDocument->isModified());
-
     m_activeDocument->clipManager()->clearUnusedProducers();
     m_monitorManager->resetProfiles(m_activeDocument->timecode());
     m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
@@ -2440,6 +2450,7 @@ void MainWindow::slotUpdateProjectProfile(const QString &profile)
     m_commandStack->activeStack()->clear();
     //Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
     slotUpdateMousePosition(0);
+    m_projectList->slotReloadClip();
     // We need to desactivate & reactivate monitors to get a refresh
     //m_monitorManager->switchMonitors();
 }
@@ -2694,6 +2705,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
     m_saveAction->setEnabled(doc->isModified());
     m_normalEditTool->setChecked(true);
     m_activeDocument = doc;
+    m_monitorManager->setDocument(m_activeDocument);
     m_activeTimeline->updateProjectFps();
     m_activeDocument->checkProjectClips();
 #ifndef Q_WS_MAC
@@ -2701,7 +2713,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
 #endif
     //Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
     slotUpdateMousePosition(0);
-    m_monitorManager->activateMonitor(Kdenlive::clipMonitor);
+    m_monitorManager->activateMonitor(Kdenlive::clipMonitor, true);
     // set tool to select tool
     m_buttonSelectTool->setChecked(true);
 }
@@ -2890,8 +2902,11 @@ void MainWindow::slotAddClipMarker()
     CommentedTime marker(pos, i18n("Marker"), KdenliveSettings::default_marker_type());
     QPointer<MarkerDialog> d = new MarkerDialog(clip, marker,
                        m_activeDocument->timecode(), i18n("Add Marker"), this);
-    if (d->exec() == QDialog::Accepted)
+    if (d->exec() == QDialog::Accepted) {
         m_activeTimeline->projectView()->slotAddClipMarker(id, QList <CommentedTime>() << d->newMarker());
+       QString hash = clip->getClipHash();
+       if (!hash.isEmpty()) m_activeDocument->cacheImage(hash + '#' + QString::number(d->newMarker().time().frames(m_activeDocument->fps())), d->markerImage());
+    }
     delete d;
 }
 
@@ -2977,6 +2992,8 @@ void MainWindow::slotEditClipMarker()
                       m_activeDocument->timecode(), i18n("Edit Marker"), this);
     if (d->exec() == QDialog::Accepted) {
         m_activeTimeline->projectView()->slotAddClipMarker(id, QList <CommentedTime>() <<d->newMarker());
+       QString hash = clip->getClipHash();
+       if (!hash.isEmpty()) m_activeDocument->cacheImage(hash + '#' + QString::number(d->newMarker().time().frames(m_activeDocument->fps())), d->markerImage());
         if (d->newMarker().time() != pos) {
             // remove old marker
             oldMarker.setMarkerType(-1);
@@ -3355,14 +3372,25 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip)
         //m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
         return;
     }
+    
+    // Check if we already have a properties dialog opened for that clip
+    QList <ClipProperties *> list = findChildren<ClipProperties *>();
+    for (int i = 0; i < list.size(); ++i) {
+        if (list.at(i)->clipId() == clip->getId()) {
+           // We have one dialog, show it
+           list.at(i)->raise();
+           return;
+       }
+    }
 
     // any type of clip but a title
     ClipProperties *dia = new ClipProperties(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
 
     if (clip->clipType() == AV || clip->clipType() == VIDEO || clip->clipType() == PLAYLIST || clip->clipType() == SLIDESHOW) {
        // request clip thumbnails
-       m_activeDocument->clipManager()->requestThumbs(QString('?' + clip->getId()), QList<int>() << clip->getClipThumbFrame());
        connect(m_activeDocument->clipManager(), SIGNAL(gotClipPropertyThumbnail(const QString&,QImage)), dia, SLOT(slotGotThumbnail(const QString&,QImage)));
+       connect(dia, SIGNAL(requestThumb(const QString, QList <int>)), m_activeDocument->clipManager(), SLOT(slotRequestThumbs(QString,QList<int>)));
+       m_activeDocument->clipManager()->slotRequestThumbs(QString('?' + clip->getId()), QList<int>() << clip->getClipThumbFrame());
     }
     
     connect(dia, SIGNAL(addMarkers(const QString &, QList <CommentedTime>)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, QList <CommentedTime>)));
@@ -3642,12 +3670,13 @@ void MainWindow::slotClipInTimeline(const QString &clipId)
 void MainWindow::slotClipInProjectTree()
 {
     if (m_activeTimeline) {
-        const QStringList &clipIds = m_activeTimeline->projectView()->selectedClips();
+       QStringList clipIds;
+       if (m_mainClip) clipIds << m_mainClip->clipProducer();
+       else clipIds = m_activeTimeline->projectView()->selectedClips();
         if (clipIds.isEmpty())
             return;
         m_projectListDock->raise();
-        for (int i = 0; i < clipIds.count(); i++)
-            m_projectList->selectItemById(clipIds.at(i));
+        m_projectList->selectItemById(clipIds.at(0));
         if (m_projectMonitor->isActive())
             slotSwitchMonitors();
     }
@@ -4030,22 +4059,6 @@ void MainWindow::slotStartClipAction()
         filtername=action->data().toString();
     }
     m_projectList->startClipFilterJob(filtername, condition);
-    /*
-    if (ids.isEmpty()) {
-        m_messageLabel->setMessage(i18n("No clip to transcode"), ErrorMessage);
-        return;
-    }
-    QString destination;
-    ProjectItem *item = m_projectList->getClipById(ids.at(0));
-    if (ids.count() == 1) {
-
-    }
-    ClipStabilize *d = new ClipStabilize(destination, ids.count(), filtername);
-    //connect(d, SIGNAL(addClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
-    if (d->exec() == QDialog::Accepted) {
-        m_projectList->slotStabilizeClipJob(ids, d->autoAddClip(), d->params(), d->desc());
-    }
-    delete d;*/
 }
 
 void MainWindow::slotTranscode(KUrl::List urls)
@@ -4155,7 +4168,7 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QS
                 // Always insert a guide in pos 0
                 QDomElement chapter = doc.createElement("chapter");
                 chapters.insertBefore(chapter, QDomNode());
-                chapter.setAttribute("title", i18n("Start"));
+                chapter.setAttribute("title", i18nc("the first in a list of chapters", "Start"));
                 chapter.setAttribute("time", "0");
             }
             // save chapters file