]> git.sesse.net Git - kdenlive/commitdiff
* Allow user to set number of audio/video tracks at project creation
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 22 Sep 2008 14:47:31 +0000 (14:47 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 22 Sep 2008 14:47:31 +0000 (14:47 +0000)
* Remove transitions that where not implemented

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

src/initeffects.cpp
src/kdenlivedoc.cpp
src/kdenlivedoc.h
src/mainwindow.cpp
src/projectsettings.cpp
src/projectsettings.h
src/widgets/projectsettings_ui.ui

index 27496efcbcc57eb3d320d79e86386f1eef676366..10d6a313b13af423a102841a1c119eb5914a26a0 100644 (file)
@@ -463,6 +463,11 @@ QDomDocument initEffects::createDescriptionFromMlt(Mlt::Repository* repository,
 }
 
 void initEffects::fillTransitionsList(Mlt::Repository * repository, EffectsList* transitions, QStringList names) {
+    // remove transitions that are not implemented
+    int pos = names.indexOf("mix");
+    if (pos != -1) names.takeAt(pos);
+    pos = names.indexOf("region");
+    if (pos != -1) names.takeAt(pos);
     foreach(const QString &name, names) {
         QDomDocument ret;
         QDomElement ktrans = ret.createElement("ktransition");
index 6f7332a8388514550aef29ba6d1fcf017362be5c..7c35b27303625c652926ea54306459a6373fb521 100644 (file)
@@ -37,7 +37,7 @@
 #include "mainwindow.h"
 
 
-KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, MainWindow *parent): QObject(parent), m_render(NULL), m_url(url), m_projectFolder(projectFolder), m_commandStack(new QUndoStack(undoGroup)), m_modified(false), m_documentLoadingProgress(0), m_documentLoadingStep(0.0), m_startPos(0), m_zoom(7), m_autosave(NULL) {
+KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QPoint tracks, MainWindow *parent): QObject(parent), m_render(NULL), m_url(url), m_projectFolder(projectFolder), m_commandStack(new QUndoStack(undoGroup)), m_modified(false), m_documentLoadingProgress(0), m_documentLoadingStep(0.0), m_startPos(0), m_zoom(7), m_autosave(NULL) {
     m_clipManager = new ClipManager(this);
     if (!url.isEmpty()) {
         QString tmpFile;
@@ -113,18 +113,18 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup
             } else {
                 parent->slotGotProgressInfo(i18n("File %1 is not a Kdenlive project file."), 100);
                 kWarning() << "  NO KDENLIVE INFO FOUND IN FILE: " << url.path();
-                m_document = createEmptyDocument();
+                m_document = createEmptyDocument(tracks.x(), tracks.y());
                 setProfilePath(profileName);
             }
             KIO::NetAccess::removeTempFile(tmpFile);
         } else {
             KMessageBox::error(parent, KIO::NetAccess::lastErrorString());
             parent->slotGotProgressInfo(i18n("File %1 is not a Kdenlive project file."), 100);
-            m_document = createEmptyDocument();
+            m_document = createEmptyDocument(tracks.x(), tracks.y());
             setProfilePath(profileName);
         }
     } else {
-        m_document = createEmptyDocument();
+        m_document = createEmptyDocument(tracks.x(), tracks.y());
         setProfilePath(profileName);
     }
     m_scenelist = m_document.toString();
@@ -144,7 +144,7 @@ KdenliveDoc::~KdenliveDoc() {
     m_autosave->remove();
 }
 
-QDomDocument KdenliveDoc::createEmptyDocument() {
+QDomDocument KdenliveDoc::createEmptyDocument(const int videotracks, const int audiotracks) {
     // Creating new document
     QDomDocument doc;
     QDomElement westley = doc.createElement("westley");
@@ -159,8 +159,6 @@ QDomDocument KdenliveDoc::createEmptyDocument() {
 
 
     // create playlists
-    const int audiotracks = 2;
-    const int videotracks = 3;
     int total = audiotracks + videotracks + 1;
 
     for (int i = 1; i < total; i++) {
@@ -765,7 +763,7 @@ void KdenliveDoc::slotCreateTextClip(QString group, const QString &groupId) {
         QString titleName = "title";
         int counter = 0;
         QString path = titlesFolder + titleName + QString::number(counter).rightJustified(3, '0', false);
-        while (QFile::exists(path + ".kdenlivetitle")) {
+        while (QFile::exists(path + ".png")) {
             counter++;
             path = titlesFolder + titleName + QString::number(counter).rightJustified(3, '0', false);
         }
index bf15ba55b83a9fd0d9c374545e8cb00a8c878c1f..f62c989d6fb7ff2f283a9e18c2cf38fa2e29a8d0 100644 (file)
@@ -46,7 +46,7 @@ class MainWindow;
 class KdenliveDoc: public QObject {
 Q_OBJECT public:
 
-    KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, MainWindow *parent = 0);
+    KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QPoint tracks, MainWindow *parent = 0);
     ~KdenliveDoc();
     QDomNodeList producersList();
     double fps() const;
@@ -129,7 +129,7 @@ private:
     double m_documentLoadingStep;
     double m_documentLoadingProgress;
     void convertDocument(double version);
-    QDomDocument createEmptyDocument();
+    QDomDocument createEmptyDocument(const int videotracks, const int audiotracks);
 
 public slots:
     void slotCreateTextClip(QString group, const QString &groupId);
index 630503560052007631d35c305782a349d062c86f..45ea96dfde24ce158527c127435f73f6d6ee1ace 100644 (file)
@@ -777,15 +777,17 @@ void MainWindow::readOptions() {
 void MainWindow::newFile() {
     QString profileName;
     KUrl projectFolder;
+    QPoint projectTracks(3, 2);
     if (m_timelineArea->count() == 0) profileName = KdenliveSettings::default_profile();
     else {
         ProjectSettings *w = new ProjectSettings;
         if (w->exec() != QDialog::Accepted) return;
         profileName = w->selectedProfile();
         projectFolder = w->selectedFolder();
+        projectTracks = w->tracks();
         delete w;
     }
-    KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, this);
+    KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, projectTracks,  this);
     doc->m_autosave = new KAutoSaveFile(KUrl(), doc);
     TrackView *trackView = new TrackView(doc, this);
     m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description());
@@ -899,7 +901,7 @@ void MainWindow::openFile(const KUrl &url) {
 
 void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale) {
     KdenliveDoc *doc;
-    doc = new KdenliveDoc(url, KUrl(), m_commandStack, QString(), this);
+    doc = new KdenliveDoc(url, KUrl(), m_commandStack, QString(), QPoint(3, 2), this);
     if (stale == NULL) {
         stale = new KAutoSaveFile(url, doc);
         doc->m_autosave = stale;
index e0f62a1fdbd7c90bc3ef658b864f76228ac77118..5dbb528211b24f7721fe57b12db59aa43276e3d9 100644 (file)
@@ -49,6 +49,8 @@ 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);
     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 &)));
@@ -79,6 +81,13 @@ KUrl ProjectSettings::selectedFolder() const {
     return m_view.project_folder->url();
 }
 
+QPoint ProjectSettings::tracks() {
+    QPoint p;
+    p.setX(m_view.video_tracks->value());
+    p.setY(m_view.audio_tracks->value());
+    return p;
+}
+
 #include "projectsettings.moc"
 
 
index e36fe8dfa1f18fcef1e89bac9bcd3b7ce9403def..6175a7fa6ee6172f21400593e9ad8bdac72a2291 100644 (file)
@@ -33,6 +33,7 @@ public:
     ProjectSettings(QWidget * parent = 0);
     QString selectedProfile() const;
     KUrl selectedFolder() const;
+    QPoint tracks();
 
 private slots:
     void slotUpdateDisplay();
index ff5c8ba40913ddda474bccba85a043271a671f17..f5660afeb13ccb01c13bb49913ddcf235f4f8939 100644 (file)
@@ -5,25 +5,25 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>370</width>
-    <height>257</height>
+    <width>315</width>
+    <height>273</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Project Settings</string>
   </property>
   <layout class="QGridLayout" name="gridLayout_3" >
-   <item row="0" column="0" colspan="2" >
+   <item row="0" column="0" colspan="3" >
     <widget class="QLabel" name="label_4" >
      <property name="text" >
       <string>Project folder</string>
      </property>
     </widget>
    </item>
-   <item row="0" column="2" colspan="3" >
+   <item row="0" column="3" colspan="5" >
     <widget class="KUrlRequester" name="project_folder" />
    </item>
-   <item row="1" column="0" colspan="5" >
+   <item row="1" column="0" colspan="8" >
     <widget class="QGroupBox" name="properties" >
      <property name="title" >
       <string>Video Profile</string>
      </layout>
     </widget>
    </item>
-   <item row="2" column="0" >
+   <item row="2" column="0" colspan="2" >
+    <widget class="QLabel" name="label_7" >
+     <property name="text" >
+      <string>Video tracks</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="2" colspan="2" >
+    <widget class="QSpinBox" name="video_tracks" />
+   </item>
+   <item row="2" column="4" colspan="2" >
+    <widget class="QLabel" name="label_8" >
+     <property name="text" >
+      <string>Audio tracks</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="6" >
+    <widget class="QSpinBox" name="audio_tracks" />
+   </item>
+   <item row="2" column="7" >
+    <spacer name="horizontalSpacer_2" >
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" stdset="0" >
+      <size>
+       <width>67</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="3" column="0" >
     <widget class="QLabel" name="label_2" >
      <property name="text" >
       <string>Thumbnails:</string>
      </property>
     </widget>
    </item>
-   <item row="2" column="1" colspan="2" >
+   <item row="3" column="1" colspan="3" >
     <widget class="QCheckBox" name="video_thumbs" >
      <property name="text" >
       <string>Video</string>
      </property>
     </widget>
    </item>
-   <item row="2" column="3" >
+   <item row="3" column="4" >
     <widget class="QCheckBox" name="audio_thumbs" >
      <property name="text" >
       <string>Audio</string>
      </property>
     </widget>
    </item>
-   <item row="2" column="4" >
+   <item row="3" column="5" colspan="3" >
     <spacer name="horizontalSpacer" >
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
      </property>
     </spacer>
    </item>
-   <item row="3" column="0" colspan="5" >
+   <item row="4" column="3" colspan="3" >
     <spacer name="verticalSpacer" >
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
      </property>
     </spacer>
    </item>
-   <item row="4" column="1" colspan="4" >
+   <item row="5" column="1" colspan="7" >
     <widget class="QDialogButtonBox" name="buttonBox" >
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
     </widget>
    </item>
   </layout>
+  <zorder>label_4</zorder>
+  <zorder>project_folder</zorder>
+  <zorder>properties</zorder>
+  <zorder>label_2</zorder>
+  <zorder>video_thumbs</zorder>
+  <zorder>audio_thumbs</zorder>
+  <zorder>buttonBox</zorder>
+  <zorder>label_6</zorder>
+  <zorder>horizontalSpacer_2</zorder>
+  <zorder>label_8</zorder>
+  <zorder>label_7</zorder>
+  <zorder>video_tracks</zorder>
+  <zorder>audio_tracks</zorder>
  </widget>
  <customwidgets>
   <customwidget>