]> git.sesse.net Git - kdenlive/commitdiff
automatically select if we should export audio or not:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 25 Jul 2010 00:21:23 +0000 (00:21 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 25 Jul 2010 00:21:23 +0000 (00:21 +0000)
http://www.kdenlive.org/mantis/view.php?id=1672

svn path=/trunk/kdenlive/; revision=4642

18 files changed:
src/CMakeLists.txt
src/clipmanager.cpp
src/customtrackview.cpp
src/customtrackview.h
src/docclipbase.cpp
src/kdenlivesettingsdialog.cpp
src/kdenlivesettingsdialog.h
src/mainwindow.cpp
src/mainwindow.h
src/projectsettings.cpp
src/renderwidget.cpp
src/renderwidget.h
src/trackview.cpp
src/trackview.h
src/widgets/configmisc_ui.ui
src/widgets/configproject_ui.ui [new file with mode: 0644]
src/widgets/projectsettings_ui.ui
src/widgets/renderwidget_ui.ui

index 2d5ed34fee28b10d79a6edd65d821158aadc0d5d..9152782b28da777bacb7734c83ee1b4c6b569c68 100644 (file)
@@ -49,6 +49,7 @@ kde4_add_ui_files(kdenlive_UI
   widgets/configsdl_ui.ui
   widgets/configcapture_ui.ui
   widgets/configtranscode_ui.ui
+  widgets/configproject_ui.ui
   widgets/effectlist_ui.ui
   widgets/effectstack_ui.ui
   widgets/profiledialog_ui.ui
index d440b288c3eea7af452759857099b6dd41736ebd..9e7d0fdf2b22d5a0fc511844c17004848b7d4c6f 100644 (file)
@@ -301,7 +301,6 @@ void ClipManager::slotAddClipList(const KUrl::List urls, const QString group, co
                     foreach(const KFileMetaInfoItem& metaInfoItem, metaInfoItems) {
                         prod.setAttribute("meta.attr." + metaInfoItem.name().section("#", 1), metaInfoItem.value().toString());
                     }
-
                 }
             } else if (type->is("application/x-kdenlivetitle")) {
                 // opening a title file
index 789126badd5840ab6626e65e3c78f2b74d8d188c..7913e0d27616c2722d34abb77cb97a9f84cd2a1b 100644 (file)
@@ -173,6 +173,10 @@ CustomTrackView::CustomTrackView(KdenliveDoc *doc, CustomTrackScene* projectscen
     connect(&m_thumbsTimer, SIGNAL(timeout()), this, SLOT(slotFetchNextThumbs()));
     m_thumbsTimer.setInterval(500);
     m_thumbsTimer.setSingleShot(true);
+
+    connect(&m_audioMonitorTimer, SIGNAL(timeout()), this, SIGNAL(documentModified()));
+    m_audioMonitorTimer.setInterval(2000);
+    m_audioMonitorTimer.setSingleShot(true);
 }
 
 CustomTrackView::~CustomTrackView()
@@ -197,6 +201,7 @@ void CustomTrackView::keyPressEvent(QKeyEvent * event)
 void CustomTrackView::setDocumentModified()
 {
     m_document->setModified(true);
+    m_audioMonitorTimer.start();
 }
 
 void CustomTrackView::setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition, QActionGroup *clipTypeGroup, QMenu *markermenu)
@@ -914,7 +919,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
         bool selected = !m_dragItem->isSelected();
         if (dragGroup)
             dragGroup->setSelected(selected);
-        else 
+        else
             m_dragItem->setSelected(selected);
 
         groupSelectedItems();
@@ -3687,7 +3692,7 @@ void CustomTrackView::slotRazorGroup(QList <ItemInfo> clips1, QList <ItemInfo> t
                 break;
             }
         }
-        for(int i = 0; i < clipsCut.count(); ++i)
+        for (int i = 0; i < clipsCut.count(); ++i)
             cutClip(clipsCut.at(i), cutPos, false);
         // TODO: uncut transitonsCut
         doGroupClips(QList <ItemInfo>() << clips1 << clipsCut << clips2, QList <ItemInfo>() << transitions1 << transitionsCut << transitions2, true);
@@ -6196,3 +6201,19 @@ void CustomTrackView::setTipAnimation(AbstractClipItem *clip, OPERATIONTYPE mode
         m_animationTimer->start();
     }
 }
+
+bool CustomTrackView::hasAudio(int track) const
+{
+    QRectF rect(0, (double)(track * m_tracksHeight + 1), (double) sceneRect().width(), (double)(m_tracksHeight - 1));
+    QList<QGraphicsItem *> collisions = scene()->items(rect, Qt::IntersectsItemBoundingRect);
+    QGraphicsItem *item;
+    for (int i = 0; i < collisions.count(); i++) {
+        item = collisions.at(i);
+        if (!item->isEnabled()) continue;
+        if (item->type() == AVWIDGET) {
+            ClipItem *clip = static_cast <ClipItem *>(item);
+            if (!clip->isVideoOnly() && (clip->clipType() == AUDIO || clip->clipType() == AV || clip->clipType() == PLAYLIST)) return true;
+        }
+    }
+    return false;
+}
index 79b8758affda75e28d049a463308c5530f0f36e6..9c7af680e614216e279fdb3c96f58fcb8f8cb4a6 100644 (file)
@@ -175,6 +175,11 @@ public:
     KPixmapCache* pixmapCache;
     /** update the timeline objects when palette changes */
     void updatePalette();
+    /** @brief Returns true if a track has audio data on it.
+    * @param track The track number
+    *
+    * Check whether given track has a clip with audio in it. */
+    bool hasAudio(int track) const;
 
 public slots:
     void setCursorPos(int pos, bool seek = true);
@@ -300,6 +305,8 @@ private:
     QActionGroup *m_clipTypeGroup;
     QTimer m_scrollTimer;
     QTimer m_thumbsTimer;
+    /** @brief Monitor for changes in timeline (do we have audio data) */
+    QTimer m_audioMonitorTimer;
     int m_scrollOffset;
     bool m_clipDrag;
 
@@ -343,7 +350,7 @@ private:
     void adjustTimelineTransitions(EDITMODE mode, Transition *item, QUndoCommand *command);
     /** Adjust keyframes when pasted to another clip */
     void adjustKeyfames(GenTime oldstart, GenTime newstart, GenTime duration, QDomElement xml);
-    
+
     /** @brief Removes the tip and stops the animation timer. */
     void removeTipAnimation();
     /** @brief Creates a new tip animation.
@@ -401,6 +408,8 @@ signals:
     void updateClipMarkers(DocClipBase *);
     void updateTrackHeaders();
     void playMonitor();
+    /** @brief Monitor document changes (for example the presence of audio data in timeline for export widget.*/
+    void documentModified();
 };
 
 #endif
index 05085a36b8a4f923ebbf3223e3efce873aacdaf9..4e26b005f95650ea4786ff89171f3cc196ddcc1a 100644 (file)
@@ -58,8 +58,9 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin
     QDomNamedNodeMap attributes = xml.attributes();
     for (int i = 0; i < attributes.count(); i++) {
         QString name = attributes.item(i).nodeName();
-        if (name.startsWith("meta.attr.")) m_metadata.insert(name.section('.', 2, 3), attributes.item(i).nodeValue());
-        else m_properties.insert(name, attributes.item(i).nodeValue());
+        if (name.startsWith("meta.attr.")) {
+            m_metadata.insert(name.section('.', 2, 3), attributes.item(i).nodeValue());
+        } else m_properties.insert(name, attributes.item(i).nodeValue());
     }
 
     if (xml.hasAttribute("cutzones")) {
@@ -576,7 +577,6 @@ Mlt::Producer *DocClipBase::producer(int track)
             m_baseTrackProducers[track] = NULL;
             return NULL;
         }
-
         if (m_properties.contains("force_aspect_ratio")) m_baseTrackProducers[track]->set("force_aspect_ratio", m_properties.value("force_aspect_ratio").toDouble());
         if (m_properties.contains("force_fps")) m_baseTrackProducers[track]->set("force_fps", m_properties.value("force_fps").toDouble());
         if (m_properties.contains("force_progressive")) m_baseTrackProducers[track]->set("force_progressive", m_properties.value("force_progressive").toInt());
@@ -726,7 +726,11 @@ void DocClipBase::setMetadata(QMap <QString, QString> properties)
     QMapIterator<QString, QString> i(properties);
     while (i.hasNext()) {
         i.next();
-        m_metadata.insert(i.key(), i.value());
+        if (i.value().isEmpty() && m_metadata.contains(i.key())) {
+            m_metadata.remove(i.key());
+        } else {
+            m_metadata.insert(i.key(), i.value());
+        }
     }
 }
 
index e7a8f4321015ff65b1de52ed9eed3568ec4635ab..be47da821d504fd5f815dc9160c5d78bc8f9ed8c 100644 (file)
@@ -54,6 +54,10 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent) :
     // Hide multi tab option until Kdenlive really supports it
     m_configMisc.kcfg_activatetabs->setVisible(false);
 
+    QWidget *p8 = new QWidget;
+    m_configProject.setupUi(p8);
+    m_page8 = addPage(p8, i18n("Project Defaults"), "file-new");
+
     QWidget *p3 = new QWidget;
     m_configDisplay.setupUi(p3);
     m_page3 = addPage(p3, i18n("Display"), "video-display");
@@ -142,7 +146,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent) :
 
     connect(m_configSdl.kcfg_audio_driver, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCheckAlsaDriver()));
     initDevices();
-    connect(m_configMisc.kcfg_profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
+    connect(m_configProject.kcfg_profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
     connect(m_configCapture.kcfg_rmd_capture_type, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateRmdRegionStatus()));
 
     slotUpdateRmdRegionStatus();
@@ -195,18 +199,18 @@ void KdenliveSettingsDialog::slotUpdateRmdRegionStatus()
 
 void KdenliveSettingsDialog::checkProfile()
 {
-    m_configMisc.kcfg_profiles_list->clear();
+    m_configProject.kcfg_profiles_list->clear();
     QMap <QString, QString> profilesInfo = ProfilesDialog::getProfilesInfo();
     QMapIterator<QString, QString> i(profilesInfo);
     while (i.hasNext()) {
         i.next();
-        m_configMisc.kcfg_profiles_list->addItem(i.key(), i.value());
+        m_configProject.kcfg_profiles_list->addItem(i.key(), i.value());
     }
 
     if (!KdenliveSettings::default_profile().isEmpty()) {
-        for (int i = 0; i < m_configMisc.kcfg_profiles_list->count(); i++) {
-            if (m_configMisc.kcfg_profiles_list->itemData(i).toString() == KdenliveSettings::default_profile()) {
-                m_configMisc.kcfg_profiles_list->setCurrentIndex(i);
+        for (int i = 0; i < m_configProject.kcfg_profiles_list->count(); i++) {
+            if (m_configProject.kcfg_profiles_list->itemData(i).toString() == KdenliveSettings::default_profile()) {
+                m_configProject.kcfg_profiles_list->setCurrentIndex(i);
                 KdenliveSettings::setProfiles_list(i);
                 break;
             }
@@ -418,7 +422,7 @@ void KdenliveSettingsDialog::updateSettings()
 {
     //kDebug() << "// // // KCONFIG UPDATE called";
 
-    m_defaultProfile = m_configMisc.kcfg_profiles_list->currentText();
+    m_defaultProfile = m_configProject.kcfg_profiles_list->currentText();
     KdenliveSettings::setDefault_profile(m_defaultPath);
 
     bool resetProfile = false;
@@ -510,15 +514,15 @@ void KdenliveSettingsDialog::updateSettings()
 
 void KdenliveSettingsDialog::slotUpdateDisplay()
 {
-    QString currentProfile = m_configMisc.kcfg_profiles_list->itemData(m_configMisc.kcfg_profiles_list->currentIndex()).toString();
+    QString currentProfile = m_configProject.kcfg_profiles_list->itemData(m_configProject.kcfg_profiles_list->currentIndex()).toString();
     QMap< QString, QString > values = ProfilesDialog::getSettingsFromFile(currentProfile);
-    m_configMisc.p_size->setText(values.value("width") + 'x' + values.value("height"));
-    m_configMisc.p_fps->setText(values.value("frame_rate_num") + '/' + values.value("frame_rate_den"));
-    m_configMisc.p_aspect->setText(values.value("sample_aspect_num") + '/' + values.value("sample_aspect_den"));
-    m_configMisc.p_display->setText(values.value("display_aspect_num") + '/' + values.value("display_aspect_den"));
-    if (values.value("progressive").toInt() == 0) m_configMisc.p_progressive->setText(i18n("Interlaced"));
-    else m_configMisc.p_progressive->setText(i18n("Progressive"));
-    m_defaultProfile = m_configMisc.kcfg_profiles_list->itemText(m_configMisc.kcfg_profiles_list->currentIndex());
+    m_configProject.p_size->setText(values.value("width") + 'x' + values.value("height"));
+    m_configProject.p_fps->setText(values.value("frame_rate_num") + '/' + values.value("frame_rate_den"));
+    m_configProject.p_aspect->setText(values.value("sample_aspect_num") + '/' + values.value("sample_aspect_den"));
+    m_configProject.p_display->setText(values.value("display_aspect_num") + '/' + values.value("display_aspect_den"));
+    if (values.value("progressive").toInt() == 0) m_configProject.p_progressive->setText(i18n("Interlaced"));
+    else m_configProject.p_progressive->setText(i18n("Progressive"));
+    m_defaultProfile = m_configProject.kcfg_profiles_list->itemText(m_configProject.kcfg_profiles_list->currentIndex());
     m_defaultPath = currentProfile;
 }
 
index 971036111294fbfd9312f070a99e25c367b600bc..d167dda0eaed885aa586e67ab1cd7a2975c87b13 100644 (file)
@@ -33,6 +33,7 @@
 #include "ui_configjogshuttle_ui.h"
 #include "ui_configsdl_ui.h"
 #include "ui_configtranscode_ui.h"
+#include "ui_configproject_ui.h"
 
 class KdenliveSettingsDialog : public KConfigDialog
 {
@@ -73,6 +74,7 @@ private:
     KPageWidgetItem *m_page5;
     KPageWidgetItem *m_page6;
     KPageWidgetItem *m_page7;
+    KPageWidgetItem *m_page8;
     Ui::ConfigEnv_UI m_configEnv;
     Ui::ConfigMisc_UI m_configMisc;
     Ui::ConfigDisplay_UI m_configDisplay;
@@ -80,6 +82,7 @@ private:
     Ui::ConfigJogShuttle_UI m_configShuttle;
     Ui::ConfigSdl_UI m_configSdl;
     Ui::ConfigTranscode_UI m_configTranscode;
+    Ui::ConfigProject_UI m_configProject;
     QString m_defaultProfile;
     QString m_defaultPath;
     KProcess m_readProcess;
index faef4b2dd9190dcee87689cdd818b92fbf0e2e08..11b87847377ec34e3e6a319d1928e7f82c91af37 100644 (file)
@@ -504,8 +504,8 @@ bool MainWindow::queryClose()
     if (m_monitorManager) m_monitorManager->stopActiveMonitor();
     // warn the user to save if document is modified and we have clips in our project list
     if (m_activeDocument && m_activeDocument->isModified() &&
-        ((m_projectList->documentClipList().isEmpty() && !m_activeDocument->url().isEmpty()) ||
-            !m_projectList->documentClipList().isEmpty())) {
+            ((m_projectList->documentClipList().isEmpty() && !m_activeDocument->url().isEmpty()) ||
+             !m_projectList->documentClipList().isEmpty())) {
         QString message;
         if (m_activeDocument->url().fileName().isEmpty())
             message = i18n("Save changes to document?");
@@ -1682,7 +1682,9 @@ bool MainWindow::saveFileAs(const QString &outputFileName)
 bool MainWindow::saveFileAs()
 {
     QString outputFile = KFileDialog::getSaveFileName(m_activeDocument->projectFolder(), getMimeType());
-    if (outputFile.isEmpty()) { return false; }
+    if (outputFile.isEmpty()) {
+        return false;
+    }
     if (QFile::exists(outputFile)) {
         // Show the file dialog again if the user does not want to overwrite the file
         if (KMessageBox::questionYesNo(this, i18n("File already exists.\nDo you want to overwrite it?")) == KMessageBox::No)
@@ -1985,11 +1987,9 @@ void MainWindow::slotRenderProject()
             m_renderWidget->setDocumentPath(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash));
             m_renderWidget->setRenderProfile(m_activeDocument->getDocumentProperty("renderdestination"), m_activeDocument->getDocumentProperty("rendercategory"), m_activeDocument->getDocumentProperty("renderprofile"), m_activeDocument->getDocumentProperty("renderurl"));
         }
+        if (m_activeTimeline) connect(m_activeTimeline, SIGNAL(projectHasAudio(bool)), m_renderWidget, SLOT(slotEnableAudio(bool)));
     }
     slotCheckRenderStatus();
-    /*TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
-    if (currentTab) m_renderWidget->setTimeline(currentTab);
-    m_renderWidget->setDocument(m_activeDocument);*/
     m_renderWidget->show();
     m_renderWidget->showNormal();
 
@@ -2191,6 +2191,9 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
 
 
     trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu, m_clipTypeGroup, (QMenu*)(factory()->container("marker_menu", this)));
+    if (m_renderWidget) {
+        if (m_activeTimeline) disconnect(m_activeTimeline, SIGNAL(projectHasAudio(bool)), m_renderWidget, SLOT(slotEnableAudio(bool)));
+    }
     m_activeTimeline = trackView;
     if (m_renderWidget) {
         slotCheckRenderStatus();
@@ -2198,6 +2201,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
         m_renderWidget->setGuides(doc->guidesXml(), doc->projectDuration());
         m_renderWidget->setDocumentPath(doc->projectFolder().path(KUrl::AddTrailingSlash));
         m_renderWidget->setRenderProfile(doc->getDocumentProperty("renderdestination"), doc->getDocumentProperty("rendercategory"), doc->getDocumentProperty("renderprofile"), doc->getDocumentProperty("renderurl"));
+        connect(m_activeTimeline, SIGNAL(projectHasAudio(bool)), m_renderWidget, SLOT(slotEnableAudio(bool)));
     }
     //doc->setRenderer(m_projectMonitor->render);
     m_commandStack->setActiveStack(doc->commandStack());
@@ -2341,9 +2345,9 @@ void MainWindow::slotSwitchSnap()
 void MainWindow::slotDeleteItem()
 {
     if (QApplication::focusWidget() &&
-        QApplication::focusWidget()->parentWidget() &&
-        QApplication::focusWidget()->parentWidget()->parentWidget() &&
-        QApplication::focusWidget()->parentWidget()->parentWidget() == m_projectListDock) {
+            QApplication::focusWidget()->parentWidget() &&
+            QApplication::focusWidget()->parentWidget()->parentWidget() &&
+            QApplication::focusWidget()->parentWidget()->parentWidget() == m_projectListDock) {
         m_projectList->slotRemoveClip();
 
     } else {
@@ -3625,20 +3629,44 @@ void MainWindow::slotShowTitleBars(bool show)
         m_RGBParadeDock->setTitleBarWidget(0);
         m_histogramDock->setTitleBarWidget(0);
     } else {
-        if (!m_effectStackDock->isFloating()) { m_effectStackDock->setTitleBarWidget(new QWidget(this)); }
-        if (!m_clipMonitorDock->isFloating()) { m_clipMonitorDock->setTitleBarWidget(new QWidget(this)); }
-        if (!m_projectMonitorDock->isFloating()) { m_projectMonitorDock->setTitleBarWidget(new QWidget(this)); }
+        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(this)); }
+        if (!m_recMonitorDock->isFloating()) {
+            m_recMonitorDock->setTitleBarWidget(new QWidget);
+        }
 #endif
-        if (!m_effectListDock->isFloating()) { m_effectListDock->setTitleBarWidget(new QWidget(this)); }
-        if (!m_transitionConfigDock->isFloating()) { m_transitionConfigDock->setTitleBarWidget(new QWidget(this)); }
-        if (!m_projectListDock->isFloating()) { m_projectListDock->setTitleBarWidget(new QWidget(this)); }
-        if (!m_undoViewDock->isFloating()) { m_undoViewDock->setTitleBarWidget(new QWidget(this)); }
-        if (!m_vectorscopeDock->isFloating()) { m_vectorscopeDock->setTitleBarWidget(new QWidget(this)); }
-        if (!m_waveformDock->isFloating()) { m_waveformDock->setTitleBarWidget(new QWidget(this)); }
-        if (!m_RGBParadeDock->isFloating()) { m_RGBParadeDock->setTitleBarWidget(new QWidget(this)); }
-        if (!m_histogramDock->isFloating()) { m_histogramDock->setTitleBarWidget(new QWidget(this)); }
+        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));
+        }
     }
     KdenliveSettings::setShowtitlebars(show);
 }
index 67a4da1375bae3a9f9305c1ef2ce5e2f484d68dc..d0b24de6b21ca76b0f19ccb2b61022f629ef7634 100644 (file)
@@ -425,6 +425,7 @@ private slots:
     void slotUnGroupClips();
     void slotEditItemDuration();
     void slotClipInProjectTree();
+    //void slotClipToProjectTree();
     void slotSplitAudio();
     void slotUpdateClipType(QAction *action);
     void slotShowTimeline(bool show);
index cc99d9e957d1cbcfbd92d3a66c7d82c8ba56e659..9891810fe948e7f1dc56d7a2b289ec488e3d4f3a 100644 (file)
@@ -63,6 +63,7 @@ ProjectSettings::ProjectSettings(ProjectList *projectlist, QStringList lumas, in
     video_thumbs->setChecked(KdenliveSettings::videothumbnails());
     audio_tracks->setValue(audiotracks);
     video_tracks->setValue(videotracks);
+
     if (readOnlyTracks) {
         video_tracks->setEnabled(false);
         audio_tracks->setEnabled(false);
@@ -236,6 +237,7 @@ bool ProjectSettings::enableAudioThumbs() const
     return audio_thumbs->isChecked();
 }
 
+
 //static
 QStringList ProjectSettings::extractPlaylistUrls(QString path)
 {
index 7d447b7ad2e42578a7d873247626ad7ab27b6126..569d34d32bf6e2d2c31a31a9f3c7892bb23b0dca 100644 (file)
@@ -62,7 +62,8 @@ const int FINISHEDJOB = 2;
 RenderWidget::RenderWidget(const QString &projectfolder, QWidget * parent) :
         QDialog(parent),
         m_projectFolder(projectfolder),
-        m_blockProcessing(false)
+        m_blockProcessing(false),
+        m_autoAudio(false)
 {
     m_view.setupUi(this);
     setWindowTitle(i18n("Rendering"));
@@ -111,6 +112,9 @@ RenderWidget::RenderWidget(const QString &projectfolder, QWidget * parent) :
     m_view.errorLabel->setPalette(p);
     m_view.errorLabel->setHidden(true);
 
+    connect(m_view.export_audio, SIGNAL(stateChanged(int)), this, SLOT(slotUpdateAudioLabel(int)));
+    m_view.export_audio->setCheckState(Qt::PartiallyChecked);
+
     parseProfiles();
     parseScriptFiles();
 
@@ -748,7 +752,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
     else if (m_view.scanning_list->currentIndex() == 2) renderArgs.append(" progressive=0");
 
     // disable audio if requested
-    if (!m_view.export_audio->isChecked())
+    if (m_view.export_audio->checkState() == Qt::Unchecked || (m_view.export_audio->checkState() == Qt::PartiallyChecked && !m_autoAudio))
         renderArgs.append(" an=1 ");
 
     // Check if the rendering profile is different from project profile,
@@ -1787,9 +1791,10 @@ void RenderWidget::missingClips(bool hasMissing)
     } else m_view.errorLabel->setHidden(true);
 }
 
-void RenderWidget::enableAudio(bool enable)
+void RenderWidget::slotEnableAudio(bool enable)
 {
-    m_view.export_audio->setChecked(enable);
+    m_autoAudio = enable;
+    if (m_view.export_audio->checkState() == Qt::PartiallyChecked) m_view.export_audio->setText(m_autoAudio ? i18n("Export audio (on)") : i18n("Export audio (off)"));
 }
 
 void RenderWidget::slotUpdateRescaleWidth(int val)
@@ -1818,3 +1823,10 @@ void RenderWidget::slotSwitchAspectRatio()
     if (m_view.rescale_keep->isChecked()) slotUpdateRescaleWidth(m_view.rescale_width->value());
 }
 
+void RenderWidget::slotUpdateAudioLabel(int ix)
+{
+    if (ix == Qt::PartiallyChecked)
+        m_view.export_audio->setText(m_autoAudio ? i18n("Export audio (on)") : i18n("Export audio (off)"));
+    else
+        m_view.export_audio->setText(i18n("Audio export"));
+}
\ No newline at end of file
index 367c6177653e031e6921f88282236a49dc6b4ba1..353f420c370d2e343389244aabbd95626cdd7746 100644 (file)
@@ -113,10 +113,11 @@ public:
     QString getFreeScriptName(const QString &prefix = QString());
     bool startWaitingRenderJobs();
     void missingClips(bool hasMissing);
-    void enableAudio(bool enable);
 
 public slots:
     void slotExport(bool scriptExport, int zoneIn, int zoneOut, const QString &playlistPath, const QString &scriptPath);
+    /** @brief Enable / disable audio export if audio export checkbox is in auto mode. */
+    void slotEnableAudio(bool enable);
 
 private slots:
     void slotUpdateButtons(KUrl url);
@@ -150,6 +151,8 @@ private slots:
     void slotUpdateRescaleHeight(int);
     void slotUpdateRescaleWidth(int);
     void slotSwitchAspectRatio();
+    /** @brief Update export audio label depending on current settings. */
+    void slotUpdateAudioLabel(int ix);
 
 private:
     Ui::RenderWidget_UI m_view;
@@ -168,6 +171,8 @@ private:
     void saveProfile(QDomElement newprofile);
     QList <QListWidgetItem *> m_renderItems;
     QList <QListWidgetItem *> m_renderCategory;
+    /** @brief True if current project has audio, false otherwise. */
+    bool m_autoAudio;
 
 signals:
     void abortProcess(const QString &url);
index b8110fb7deb5d0d149d8381162bc52a3f9a5bb76..e086b21aff5bbb76a3c9eb68017bebd194de7ba7 100644 (file)
@@ -117,6 +117,7 @@ TrackView::TrackView(KdenliveDoc *doc, bool *ok, QWidget *parent) :
 
     slotChangeZoom(m_doc->zoom().x(), m_doc->zoom().y());
     slotSetZone(m_doc->zone());
+    connect(m_trackview, SIGNAL(documentModified()), this, SLOT(slotCheckProjectAudio()));
 }
 
 TrackView::~TrackView()
@@ -147,6 +148,21 @@ int TrackView::tracksNumber() const
     return m_projectTracks - 1;
 }
 
+void TrackView::slotCheckProjectAudio()
+{
+    bool hasAudio = false;
+    const QList <TrackInfo> list = m_doc->tracksList();
+    int max = list.count();
+    for (int i = 0; i < max; i++) {
+        TrackInfo info = list.at(max - i - 1);
+        if (!info.isMute && m_trackview->hasAudio(i)) {
+            hasAudio = true;
+            break;
+        }
+    }
+    emit projectHasAudio(hasAudio);
+}
+
 int TrackView::inPoint() const
 {
     return m_ruler->inPoint();
@@ -436,6 +452,7 @@ void TrackView::parseDocument(QDomDocument doc)
         else
             KMessageBox::information(this, i18n("Your project file was upgraded to the latest Kdenlive document version, but it was not possible to create a backup copy.", backupFile));
     }
+    slotCheckProjectAudio();
     //m_trackview->setCursorPos(cursorPos);
     //m_scrollBox->setGeometry(0, 0, 300 * zoomFactor(), m_scrollArea->height());
 }
index f82b661b736132673a10823dfdfcfa73e1f8c1a1..0529f8498237b522f489b27741444dd7709ac229 100644 (file)
@@ -63,12 +63,13 @@ public:
     int outPoint() const;
     int inPoint() const;
     int fitZoom() const;
-    
+
     /** @brief Updates (redraws) the ruler.
     *
     * Used to change from displaying frames to timecode or vice versa. */
     void updateRuler();
 
+
 protected:
     virtual void keyPressEvent(QKeyEvent * event);
 
@@ -119,6 +120,11 @@ private slots:
      * of the vertical scrollbar is maximal */
     void slotUpdateVerticalScroll(int min, int max);
 
+    /** @brief Parse tracks to see if project has audio in it.
+    *
+    * Parses all tracks to check if there is audio data. */
+    void slotCheckProjectAudio();
+
 signals:
     void mousePosition(int);
     void cursorMoved();
@@ -128,6 +134,8 @@ signals:
     void configTrack(int);
     void updateTracksInfo();
     void setZoom(int);
+    /** @brief Inform render widget if our project has audio */
+    void projectHasAudio(bool);
 };
 
 #endif
index 9476c69215c7631a7153e1eacb2038a14965416f..b9cfacad06e8254e915bb05c84b81edf8d775a03 100644 (file)
@@ -6,33 +6,33 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>338</width>
-    <height>359</height>
+    <width>298</width>
+    <height>220</height>
    </rect>
   </property>
   <layout class="QGridLayout" name="gridLayout_4">
-   <item row="0" column="0" colspan="6">
+   <item row="0" column="0" colspan="3">
     <widget class="QCheckBox" name="kcfg_openlastproject">
      <property name="text">
       <string>Open last project on startup</string>
      </property>
     </widget>
    </item>
-   <item row="1" column="0" colspan="6">
+   <item row="1" column="0" colspan="3">
     <widget class="QCheckBox" name="kcfg_crashrecovery">
      <property name="text">
       <string>Crash recovery (automatic backup)</string>
      </property>
     </widget>
    </item>
-   <item row="2" column="0" colspan="6">
+   <item row="2" column="0" colspan="3">
     <widget class="QCheckBox" name="kcfg_activatetabs">
      <property name="text">
       <string>Open projects in new tabs</string>
      </property>
     </widget>
    </item>
-   <item row="5" column="0" colspan="6">
+   <item row="5" column="0" colspan="3">
     <widget class="QGroupBox" name="groupBox">
      <property name="title">
       <string>Default Durations</string>
      </layout>
     </widget>
    </item>
-   <item row="6" column="0" colspan="6">
-    <widget class="QGroupBox" name="properties">
-     <property name="title">
-      <string>Default Profile</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_2">
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_3">
-        <property name="text">
-         <string>Profile</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="KComboBox" name="kcfg_profiles_list"/>
-      </item>
-      <item row="1" column="0" colspan="2">
-       <layout class="QGridLayout" name="gridLayout">
-        <item row="0" column="0">
-         <widget class="QLabel" name="label_5">
-          <property name="text">
-           <string>Size:</string>
-          </property>
-         </widget>
-        </item>
-        <item row="0" column="1">
-         <widget class="QLabel" name="p_size">
-          <property name="text">
-           <string>720x576</string>
-          </property>
-         </widget>
-        </item>
-        <item row="0" column="2">
-         <widget class="QLabel" name="label_4">
-          <property name="text">
-           <string>Frame rate:</string>
-          </property>
-         </widget>
-        </item>
-        <item row="0" column="3">
-         <widget class="QLabel" name="p_fps">
-          <property name="text">
-           <string>25/1</string>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="0">
-         <widget class="QLabel" name="label_9">
-          <property name="text">
-           <string>Aspect ratio:</string>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="1">
-         <widget class="QLabel" name="p_aspect">
-          <property name="text">
-           <string>59/54</string>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="2">
-         <widget class="QLabel" name="label_10">
-          <property name="text">
-           <string>Display ratio:</string>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="3">
-         <widget class="QLabel" name="p_display">
-          <property name="text">
-           <string>4/3</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item row="2" column="0" colspan="2">
-       <widget class="QLabel" name="p_progressive">
-        <property name="text">
-         <string>Interlaced</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="7" column="0">
-    <widget class="QLabel" name="label_6">
-     <property name="text">
-      <string>Video tracks</string>
-     </property>
-    </widget>
-   </item>
-   <item row="7" column="2">
-    <spacer name="horizontalSpacer">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>13</width>
-       <height>25</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item row="7" column="3">
-    <widget class="QLabel" name="label_7">
-     <property name="text">
-      <string>Audio tracks</string>
-     </property>
-    </widget>
-   </item>
-   <item row="8" column="0" colspan="6">
+   <item row="6" column="0" colspan="3">
     <spacer>
      <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
     </spacer>
    </item>
-   <item row="7" column="1">
-    <widget class="KIntSpinBox" name="kcfg_videotracks"/>
-   </item>
-   <item row="7" column="4">
-    <widget class="KIntSpinBox" name="kcfg_audiotracks"/>
-   </item>
-   <item row="3" column="0" colspan="5">
+   <item row="3" column="0" colspan="2">
     <widget class="QCheckBox" name="kcfg_usekuiserver">
      <property name="text">
       <string>Use KDE job tracking for render jobs</string>
      </property>
     </widget>
    </item>
-   <item row="4" column="0" colspan="5">
+   <item row="4" column="0" colspan="2">
     <widget class="QCheckBox" name="kcfg_splitaudio">
      <property name="text">
       <string>Automatically split audio from video</string>
   </layout>
  </widget>
  <customwidgets>
-  <customwidget>
-   <class>KIntSpinBox</class>
-   <extends>QSpinBox</extends>
-   <header>knuminput.h</header>
-  </customwidget>
   <customwidget>
    <class>KLineEdit</class>
    <extends>QLineEdit</extends>
    <header>klineedit.h</header>
   </customwidget>
-  <customwidget>
-   <class>KComboBox</class>
-   <extends>QComboBox</extends>
-   <header>kcombobox.h</header>
-  </customwidget>
   <customwidget>
    <class>KRestrictedLine</class>
    <extends>KLineEdit</extends>
diff --git a/src/widgets/configproject_ui.ui b/src/widgets/configproject_ui.ui
new file mode 100644 (file)
index 0000000..f3c4453
--- /dev/null
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConfigProject_UI</class>
+ <widget class="QWidget" name="ConfigProject_UI">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>268</width>
+    <height>148</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0" colspan="5">
+    <widget class="QGroupBox" name="properties">
+     <property name="title">
+      <string>Default Profile</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_2">
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_3">
+        <property name="text">
+         <string>Profile</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="KComboBox" name="kcfg_profiles_list"/>
+      </item>
+      <item row="1" column="0" colspan="2">
+       <layout class="QGridLayout" name="gridLayout_3">
+        <item row="0" column="0">
+         <widget class="QLabel" name="label_5">
+          <property name="text">
+           <string>Size:</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QLabel" name="p_size">
+          <property name="text">
+           <string>720x576</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="2">
+         <widget class="QLabel" name="label_4">
+          <property name="text">
+           <string>Frame rate:</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="3">
+         <widget class="QLabel" name="p_fps">
+          <property name="text">
+           <string>25/1</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QLabel" name="label_9">
+          <property name="text">
+           <string>Aspect ratio:</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <widget class="QLabel" name="p_aspect">
+          <property name="text">
+           <string>59/54</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="2">
+         <widget class="QLabel" name="label_10">
+          <property name="text">
+           <string>Display ratio:</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="3">
+         <widget class="QLabel" name="p_display">
+          <property name="text">
+           <string>4/3</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="2" column="0" colspan="2">
+       <widget class="QLabel" name="p_progressive">
+        <property name="text">
+         <string>Interlaced</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QLabel" name="label_6">
+     <property name="text">
+      <string>Video tracks</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="KIntSpinBox" name="kcfg_videotracks"/>
+   </item>
+   <item row="1" column="2">
+    <widget class="QLabel" name="label_7">
+     <property name="text">
+      <string>Audio tracks</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="3">
+    <widget class="KIntSpinBox" name="kcfg_audiotracks"/>
+   </item>
+   <item row="1" column="4">
+    <spacer name="horizontalSpacer">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>58</width>
+       <height>22</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="2" column="0">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>21</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KIntSpinBox</class>
+   <extends>QSpinBox</extends>
+   <header>knuminput.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KComboBox</class>
+   <extends>QComboBox</extends>
+   <header>kcombobox.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
index 3367de94d0a8db98de58224c94eeaf339c6a738a..da2dca9064c402aaae62dc7cade762412c30a5e1 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>305</width>
-    <height>323</height>
+    <width>349</width>
+    <height>320</height>
    </rect>
   </property>
   <property name="windowTitle">
        <string>Settings</string>
       </attribute>
       <layout class="QGridLayout" name="gridLayout_3">
-       <item row="0" column="0" colspan="2">
+       <item row="0" column="0">
         <widget class="QLabel" name="label_4">
          <property name="text">
           <string>Project folder</string>
          </property>
         </widget>
        </item>
-       <item row="0" column="2" colspan="5">
+       <item row="0" column="1" colspan="4">
         <widget class="KUrlRequester" name="project_folder"/>
        </item>
-       <item row="1" column="0" colspan="7">
+       <item row="1" column="0" colspan="6">
         <widget class="QGroupBox" name="properties">
          <property name="title">
           <string>Video Profile</string>
          </property>
         </widget>
        </item>
-       <item row="2" column="2">
+       <item row="2" column="1">
         <widget class="QSpinBox" name="video_tracks"/>
        </item>
-       <item row="2" column="3" colspan="2">
+       <item row="2" column="2" colspan="2">
         <widget class="QLabel" name="label_8">
          <property name="text">
           <string>Audio tracks</string>
          </property>
         </widget>
        </item>
-       <item row="2" column="5">
+       <item row="2" column="4">
         <widget class="QSpinBox" name="audio_tracks"/>
        </item>
-       <item row="2" column="6">
+       <item row="2" column="5">
         <spacer name="horizontalSpacer_2">
          <property name="orientation">
           <enum>Qt::Horizontal</enum>
          </property>
         </widget>
        </item>
-       <item row="3" column="1" colspan="2">
+       <item row="3" column="1">
         <widget class="QCheckBox" name="video_thumbs">
          <property name="text">
           <string>Video</string>
          </property>
         </widget>
        </item>
-       <item row="3" column="3">
+       <item row="3" column="2">
         <widget class="QCheckBox" name="audio_thumbs">
          <property name="text">
           <string>Audio</string>
          </property>
         </widget>
        </item>
-       <item row="3" column="4" colspan="3">
+       <item row="3" column="3" colspan="3">
         <spacer name="horizontalSpacer">
          <property name="orientation">
           <enum>Qt::Horizontal</enum>
          </property>
         </spacer>
        </item>
-       <item row="4" column="2" colspan="3">
+       <item row="4" column="0" colspan="3">
         <spacer name="verticalSpacer">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
index 293b5f75637e468bab2c2b1d01461c877cc60aa1..90a13f68bd8d349332790ce2e1f6030e165c112b 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>365</width>
-    <height>553</height>
+    <width>359</width>
+    <height>522</height>
    </rect>
   </property>
   <property name="windowTitle">
          <property name="checked">
           <bool>true</bool>
          </property>
+         <property name="tristate">
+          <bool>true</bool>
+         </property>
         </widget>
        </item>
        <item row="5" column="0" colspan="10">