]> git.sesse.net Git - kdenlive/commitdiff
Fix track issues:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 7 Dec 2008 14:11:36 +0000 (14:11 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 7 Dec 2008 14:11:36 +0000 (14:11 +0000)
* Add default track number to Kdenlive Settings
* Do not allow to change track number in project settings
* Fix insert point when user wants to insert track "After" current
* Fix insertion of audio tracks
http://www.kdenlive.org:80/mantis/view.php?id=272

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

src/customtrackview.cpp
src/kdenlivesettings.kcfg
src/mainwindow.cpp
src/projectsettings.cpp
src/projectsettings.h
src/renderer.cpp
src/renderer.h
src/trackview.cpp
src/trackview.h
src/widgets/configmisc_ui.ui

index 465733e986dcc848d147bbe38426ce537c4372b2..0e1a27da0c29a73a1898241c6d438808c76f75bf 100644 (file)
@@ -1315,7 +1315,7 @@ void CustomTrackView::addTrack(TrackInfo type, int ix) {
     else {
         m_scene->m_tracksList.insert(m_scene->m_tracksList.count() - ix, type);
         // insert track in MLT playlist
-        m_document->renderer()->mltInsertTrack(m_scene->m_tracksList.count() - ix);
+        m_document->renderer()->mltInsertTrack(m_scene->m_tracksList.count() - ix, type.type == VIDEOTRACK);
 
         double startY = ix * m_tracksHeight + 1 + m_tracksHeight / 2;
         QRectF r(0, startY, sceneRect().width(), sceneRect().height() - startY);
@@ -1457,7 +1457,7 @@ void CustomTrackView::slotRemoveSpace() {
         return;
     }
     int length = m_document->renderer()->mltGetSpaceLength(pos, m_scene->m_tracksList.count() - track);
-    kDebug()<<"// GOT LENGT; "<<length;
+    //kDebug() << "// GOT LENGT; " << length;
     if (length <= 0) {
         emit displayMessage(i18n("You must be in an empty space to remove space (time=%1, track:%2)", m_document->timecode().getTimecodeFromFrames(mapToScene(m_menuPosition).x()), track), ErrorMessage);
         return;
@@ -2705,7 +2705,7 @@ void CustomTrackView::slotInsertTrack(int ix) {
     view.track_nb->setValue(ix);
 
     if (d.exec() == QDialog::Accepted) {
-        if (view.before_select->currentIndex() == 2) {
+        if (view.before_select->currentIndex() == 1) {
             kDebug() << "// AFTER";
             ix++;
         }
index f5cb379e9cfd803ad0f43c91d745bad70d46f203..767d2211be05d993679a4df4599b1f8556c22f1a 100644 (file)
       <label>Default image clip duration.</label>
       <default>00:00:05:00</default>
     </entry>
+
+    <entry name="videotracks" type="Int">
+      <label>Default number of video tracks.</label>
+      <default>3</default>
+    </entry>
+
+    <entry name="audiotracks" type="Int">
+      <label>Default number of audio tracks.</label>
+      <default>2</default>
+    </entry>
   </group>
 
   <group name="display">
index 3a2fe9e0c0c53ab543b940fc17162ea33fd145e5..f32f6f807a2708d761f2143496d5641a8b36ea5f 100644 (file)
@@ -906,12 +906,12 @@ void MainWindow::readOptions() {
 void MainWindow::newFile(bool showProjectSettings) {
     QString profileName;
     KUrl projectFolder;
-    QPoint projectTracks(3, 2);
+    QPoint projectTracks(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks());
     if (!showProjectSettings && m_timelineArea->count() == 0) {
         if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
         profileName = KdenliveSettings::default_profile();
     } else {
-        ProjectSettings *w = new ProjectSettings;
+        ProjectSettings *w = new ProjectSettings(projectTracks.x(), projectTracks.y(), false, this);
         if (w->exec() != QDialog::Accepted) return;
         if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
         profileName = w->selectedProfile();
@@ -1182,7 +1182,9 @@ void MainWindow::slotEditProfiles() {
 }
 
 void MainWindow::slotEditProjectSettings() {
-    ProjectSettings *w = new ProjectSettings;
+    QPoint p = m_activeTimeline->getTracksCount();
+    ProjectSettings *w = new ProjectSettings(p.x(), p.y(), true, this);
+
     if (w->exec() == QDialog::Accepted) {
         QString profile = w->selectedProfile();
         m_activeDocument->setProfilePath(profile);
index 5dbb528211b24f7721fe57b12db59aa43276e3d9..9e05027f85a9752c2ccc3b86cc3163047fd3161a 100644 (file)
@@ -26,7 +26,7 @@
 #include "profilesdialog.h"
 #include "projectsettings.h"
 
-ProjectSettings::ProjectSettings(QWidget * parent): QDialog(parent), m_isCustomProfile(false) {
+ProjectSettings::ProjectSettings(int videotracks, int audiotracks, bool readOnlyTracks, QWidget * parent): QDialog(parent), m_isCustomProfile(false) {
     m_view.setupUi(this);
 
     QMap <QString, QString> profilesInfo = ProfilesDialog::getProfilesInfo();
@@ -49,8 +49,12 @@ ProjectSettings::ProjectSettings(QWidget * parent): QDialog(parent), m_isCustomP
     //buttonOk->setEnabled(false);
     m_view.audio_thumbs->setChecked(KdenliveSettings::audiothumbnails());
     m_view.video_thumbs->setChecked(KdenliveSettings::videothumbnails());
-    m_view.audio_tracks->setValue(2);
-    m_view.video_tracks->setValue(3);
+    m_view.audio_tracks->setValue(audiotracks);
+    m_view.video_tracks->setValue(videotracks);
+    if (readOnlyTracks) {
+        m_view.video_tracks->setEnabled(false);
+        m_view.audio_tracks->setEnabled(false);
+    }
     slotUpdateDisplay();
     connect(m_view.profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
     connect(m_view.project_folder, SIGNAL(textChanged(const QString &)), this, SLOT(slotUpdateButton(const QString &)));
index 6175a7fa6ee6172f21400593e9ad8bdac72a2291..2cfecf84559542c167dbb5f26650c51652a0c0d6 100644 (file)
@@ -30,7 +30,7 @@ class ProjectSettings : public QDialog {
     Q_OBJECT
 
 public:
-    ProjectSettings(QWidget * parent = 0);
+    ProjectSettings(int videotracks, int audiotracks, bool readOnlyTracks, QWidget * parent = 0);
     QString selectedProfile() const;
     KUrl selectedFolder() const;
     QPoint tracks();
index 21300187fb2bb266293dc47adf50f62fd83d62f5..e621b396ebf35e82617ef30ba0c96c8b52327d03 100644 (file)
@@ -2031,7 +2031,6 @@ void Render::mltChangeTrackState(int track, bool mute, bool blind) {
     Mlt::Service service(m_mltProducer->parent().get_service());
     Mlt::Tractor tractor(service);
     Mlt::Producer trackProducer(tractor.track(track));
-    Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
     if (mute) {
         if (blind) trackProducer.set("hide", 3);
         else trackProducer.set("hide", 2);
@@ -2630,7 +2629,7 @@ QList <Mlt::Producer *> Render::producersList() {
     return prods;
 }
 
-void Render::mltInsertTrack(int ix) {
+void Render::mltInsertTrack(int ix, bool videoTrack) {
     blockSignals(true);
     m_isBlocked = true;
 
@@ -2647,6 +2646,8 @@ void Render::mltInsertTrack(int ix) {
     if (pos < ct) {
         Mlt::Producer *prodToMove = new Mlt::Producer(tractor.track(pos));
         tractor.set_track(*playlist, pos);
+        Mlt::Producer newProd(tractor.track(pos));
+        if (!videoTrack) newProd.set("hide", 1);
         pos++;
         for (; pos <= ct; pos++) {
             Mlt::Producer *prodToMove2 = new Mlt::Producer(tractor.track(pos));
index 1d7418269c1236526026da5c592b5da672487252..0da0dad2fa7ce6187e92af403177642fe07716a4 100644 (file)
@@ -171,7 +171,7 @@ Q_OBJECT public:
     void mltMoveTransparency(int startTime, int endTime, int startTrack, int endTrack, int id);
     void mltDeleteTransparency(int pos, int track, int id);
     void mltResizeTransparency(int oldStart, int newStart, int newEnd, int track, int id);
-    void mltInsertTrack(int ix);
+    void mltInsertTrack(int ix, bool videoTrack);
     void mltDeleteTrack(int ix);
     void mltUpdateClipProducer(int track, int pos, Mlt::Producer *prod);
 
index 06a57e102d86601932d7b48d7b533d1ba5481df8..85243374d37b51989a5c50df4c6b831f2e627fae 100644 (file)
@@ -328,6 +328,17 @@ void TrackView::refresh() {
     m_trackview->viewport()->update();
 }
 
+QPoint TrackView::getTracksCount() const {
+    QList <TrackInfo> list = m_trackview->tracksList();
+    int audio = 0;
+    int video = 0;
+    foreach(const TrackInfo &info, list) {
+        if (info.type == VIDEOTRACK) video++;
+        else audio++;
+    }
+    return QPoint(video, audio);
+}
+
 void TrackView::slotRebuildTrackHeaders() {
     QList <TrackInfo> list = m_trackview->tracksList();
     QList<HeaderTrack *> widgets = this->findChildren<HeaderTrack *>();
index deaf1c26d476887f4722e07c73fd09b1eb197774..de4899d73ec2f3a8b301ce5042fe37b7028698a4 100644 (file)
@@ -59,7 +59,7 @@ public:
     int outPoint() const;
     int inPoint() const;
     int fitZoom() const;
-
+    QPoint getTracksCount() const;
 
 public slots:
     void slotDeleteClip(const QString &clipId);
index b0cc1a36ca7756741f5cf29160653f13293b890a..ece8d35412aca4fe5a86efb7c0a75c7310e9f652 100644 (file)
@@ -5,12 +5,33 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>369</width>
-    <height>308</height>
+    <width>278</width>
+    <height>340</height>
    </rect>
   </property>
   <layout class="QGridLayout" name="gridLayout_4" >
-   <item row="3" column="0" >
+   <item row="0" column="0" colspan="6" >
+    <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" >
+    <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" >
+    <widget class="QCheckBox" name="kcfg_activatetabs" >
+     <property name="text" >
+      <string>Open projects in new tabs</string>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0" colspan="6" >
     <widget class="QGroupBox" name="groupBox" >
      <property name="title" >
       <string>Default Durations</string>
@@ -50,7 +71,7 @@
      </layout>
     </widget>
    </item>
-   <item row="4" column="0" >
+   <item row="4" column="0" colspan="6" >
     <widget class="QGroupBox" name="properties" >
      <property name="title" >
       <string>Default Profile</string>
     </widget>
    </item>
    <item row="5" column="0" >
-    <spacer>
+    <widget class="QLabel" name="label_6" >
+     <property name="text" >
+      <string>Video tracks</string>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="2" >
+    <spacer name="horizontalSpacer" >
      <property name="orientation" >
-      <enum>Qt::Vertical</enum>
+      <enum>Qt::Horizontal</enum>
      </property>
      <property name="sizeHint" stdset="0" >
       <size>
-       <width>20</width>
-       <height>40</height>
+       <width>13</width>
+       <height>25</height>
       </size>
      </property>
     </spacer>
    </item>
-   <item row="0" column="0" >
-    <widget class="QCheckBox" name="kcfg_openlastproject" >
+   <item row="5" column="3" >
+    <widget class="QLabel" name="label_7" >
      <property name="text" >
-      <string>Open last project on startup</string>
+      <string>Audio tracks</string>
      </property>
     </widget>
    </item>
-   <item row="1" column="0" >
-    <widget class="QCheckBox" name="kcfg_crashrecovery" >
-     <property name="text" >
-      <string>Crash recovery (automatic backup)</string>
+   <item row="6" column="0" colspan="6" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
      </property>
-    </widget>
-   </item>
-   <item row="2" column="0" >
-    <widget class="QCheckBox" name="kcfg_activatetabs" >
-     <property name="text" >
-      <string>Open projects in new tabs</string>
+     <property name="sizeHint" stdset="0" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
      </property>
-    </widget>
+    </spacer>
+   </item>
+   <item row="5" column="1" >
+    <widget class="KIntSpinBox" name="kcfg_videotracks" />
+   </item>
+   <item row="5" column="4" >
+    <widget class="KIntSpinBox" name="kcfg_audiotracks" />
    </item>
   </layout>
  </widget>
    <extends>QComboBox</extends>
    <header>kcombobox.h</header>
   </customwidget>
+  <customwidget>
+   <class>KIntSpinBox</class>
+   <extends>QSpinBox</extends>
+   <header>knuminput.h</header>
+  </customwidget>
   <customwidget>
    <class>KRestrictedLine</class>
    <extends>KLineEdit</extends>