]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Ask to save profile before closing profiles dialog, default to pal dv when profile...
[kdenlive] / src / mainwindow.cpp
index 4ce338028462ce39425ee063f3b8752dc92d3a98..1273c558f8e0bed595f6fe8fff48e15e42efb18e 100644 (file)
@@ -949,7 +949,12 @@ void MainWindow::saveFileAs(const QString &outputFileName) {
 }
 
 void MainWindow::saveFileAs() {
-    QString outputFile = KFileDialog::getSaveFileName(KUrl(), "application/x-kdenlive");
+    // Check that the Kdenlive mime type is correctly installed
+    QString mimetype = "application/x-kdenlive";
+    KMimeType::Ptr mime = KMimeType::mimeType(mimetype);
+    if (!mime) mimetype = "*.kdenlive";
+
+    QString outputFile = KFileDialog::getSaveFileName(KUrl(), mimetype);
     if (QFile::exists(outputFile)) {
         if (KMessageBox::questionYesNo(this, i18n("File already exists.\nDo you want to overwrite it ?")) == KMessageBox::No) return;
     }
@@ -967,7 +972,12 @@ void MainWindow::saveFile() {
 }
 
 void MainWindow::openFile() {
-    KUrl url = KFileDialog::getOpenUrl(KUrl(), "application/x-kdenlive");
+    // Check that the Kdenlive mime type is correctly installed
+    QString mimetype = "application/x-kdenlive";
+    KMimeType::Ptr mime = KMimeType::mimeType(mimetype);
+    if (!mime) mimetype = "*.kdenlive";
+
+    KUrl url = KFileDialog::getOpenUrl(KUrl(), mimetype);
     if (url.isEmpty()) return;
     m_fileOpenRecent->addUrl(url);
     openFile(url);
@@ -1137,7 +1147,7 @@ void MainWindow::slotEditProjectSettings() {
         KdenliveSettings::setProject_fps(m_activeDocument->fps());
         setCaption(m_activeDocument->description(), m_activeDocument->isModified());
         m_monitorManager->resetProfiles(m_activeDocument->timecode());
-        if (m_renderWidget) m_renderWidget->setDocumentStandard(m_activeDocument->getDocumentStandard());
+        if (m_renderWidget) m_renderWidget->setProfile(m_activeDocument->mltProfile());
         m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
 
         // We need to desactivate & reactivate monitors to get a refresh
@@ -1151,7 +1161,7 @@ void MainWindow::slotRenderProject() {
         m_renderWidget = new RenderWidget(this);
         connect(m_renderWidget, SIGNAL(doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double)), this, SLOT(slotDoRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double)));
         if (m_activeDocument) {
-            m_renderWidget->setDocumentStandard(m_activeDocument->getDocumentStandard());
+            m_renderWidget->setProfile(m_activeDocument->mltProfile());
             m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
         }
     }
@@ -1280,8 +1290,8 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
     KdenliveSettings::setProject_fps(doc->fps());
     m_monitorManager->resetProfiles(doc->timecode());
     m_projectList->setDocument(doc);
-    transitionConfig->updateProjectFormat(doc->mltProfile());
-    effectStack->updateProjectFormat(doc->mltProfile());
+    transitionConfig->updateProjectFormat(doc->mltProfile(), doc->timecode());
+    effectStack->updateProjectFormat(doc->mltProfile(), doc->timecode());
     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()));
@@ -1328,7 +1338,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
 
     trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu);
     m_activeTimeline = trackView;
-    if (m_renderWidget) m_renderWidget->setDocumentStandard(doc->getDocumentStandard());
+    if (m_renderWidget) m_renderWidget->setProfile(doc->mltProfile());
     doc->setRenderer(m_projectMonitor->render);
     m_commandStack->setActiveStack(doc->commandStack());
     KdenliveSettings::setProject_display_ratio(doc->dar());
@@ -1489,9 +1499,8 @@ void MainWindow::slotAddTransition(QAction *result) {
     QStringList info = result->data().toStringList();
     if (info.isEmpty()) return;
     QDomElement transition = transitions.getEffectByTag(info.at(1), info.at(2));
-    //QDomElement effect = transitions.getEffectByName(result->data().toString());
-    if (m_activeTimeline) {
-        m_activeTimeline->projectView()->slotAddTransitionToSelectedClips(transition);
+    if (m_activeTimeline && !transition.isNull()) {
+        m_activeTimeline->projectView()->slotAddTransitionToSelectedClips(transition.cloneNode().toElement());
     }
 }