]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Improve profile selection in First run wizard
[kdenlive] / src / mainwindow.cpp
index f2fa6c322f2d26823d83c031a9ac94e3a4e44627..f4f28149768b730e04ca44d0fb8d70ff472059d8 100644 (file)
@@ -805,6 +805,18 @@ void MainWindow::setupActions() {
     collection->addAction("delete_space", removeSpace);
     connect(removeSpace, SIGNAL(triggered()), this, SLOT(slotRemoveSpace()));
 
+    KAction *insertTrack = new KAction(KIcon(), i18n("Insert Track"), this);
+    collection->addAction("insert_track", insertTrack);
+    connect(insertTrack, SIGNAL(triggered()), this, SLOT(slotInsertTrack()));
+
+    KAction *deleteTrack = new KAction(KIcon(), i18n("Delete Track"), this);
+    collection->addAction("delete_track", deleteTrack);
+    connect(deleteTrack, SIGNAL(triggered()), this, SLOT(slotDeleteTrack()));
+
+    KAction *changeTrack = new KAction(KIcon(), i18n("Change Track"), this);
+    collection->addAction("change_track", changeTrack);
+    connect(changeTrack, SIGNAL(triggered()), this, SLOT(slotChangeTrack()));
+
     KAction *addGuide = new KAction(KIcon("document-new"), i18n("Add Guide"), this);
     collection->addAction("add_guide", addGuide);
     connect(addGuide, SIGNAL(triggered()), this, SLOT(slotAddGuide()));
@@ -888,6 +900,13 @@ void MainWindow::readOptions() {
         } else {
             ::exit(1);
         }
+    } else if (initialGroup.readEntry("version") == "0.7") {
+        //Add new settings from 0.7.1
+        if (KdenliveSettings::defaultprojectfolder().isEmpty()) {
+            QString path = QDir::homePath() + "/kdenlive";
+            if (KStandardDirs::makeDir(path)  == false) kDebug() << "/// ERROR CREATING PROJECT FOLDER: " << path;
+            KdenliveSettings::setDefaultprojectfolder(path);
+        }
     }
     KConfigGroup treecolumns(config, "Project Tree");
     const QByteArray state = treecolumns.readEntry("columns", QByteArray());
@@ -898,12 +917,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(), KdenliveSettings::defaultprojectfolder(), false, this);
         if (w->exec() != QDialog::Accepted) return;
         if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
         profileName = w->selectedProfile();
@@ -1174,7 +1193,9 @@ void MainWindow::slotEditProfiles() {
 }
 
 void MainWindow::slotEditProjectSettings() {
-    ProjectSettings *w = new ProjectSettings;
+    QPoint p = m_activeDocument->getTracksCount();
+    ProjectSettings *w = new ProjectSettings(p.x(), p.y(), m_activeDocument->projectFolder().path(), true, this);
+
     if (w->exec() == QDialog::Accepted) {
         QString profile = w->selectedProfile();
         m_activeDocument->setProfilePath(profile);
@@ -1288,6 +1309,8 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
             disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeTimeline, SLOT(slotSetZone(QPoint)));
             disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
             disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
+
+
             disconnect(m_activeDocument, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
             disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
             disconnect(m_activeDocument, SIGNAL(addProjectFolder(const QString, const QString &, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, const QString &, bool, bool)));
@@ -1302,7 +1325,10 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
             disconnect(m_zoomSlider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
             disconnect(m_activeTimeline->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
             disconnect(m_activeTimeline->projectView(), SIGNAL(showClipFrame(DocClipBase *, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, const int)));
-
+            disconnect(m_activeTimeline, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
+            disconnect(m_activeTimeline, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
+            disconnect(m_activeTimeline, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
+            disconnect(m_activeTimeline, SIGNAL(changeTrack(int)), this, SLOT(slotChangeTrack(int)));
             disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
             disconnect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
             disconnect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
@@ -1331,6 +1357,9 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
     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()));
+    connect(trackView, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
+    connect(trackView, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
+    connect(trackView, SIGNAL(changeTrack(int)), this, SLOT(slotChangeTrack(int)));
     connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
     connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
     connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
@@ -1609,6 +1638,24 @@ void MainWindow::slotRemoveSpace() {
         m_activeTimeline->projectView()->slotRemoveSpace();
 }
 
+void MainWindow::slotInsertTrack(int ix) {
+    m_projectMonitor->activateMonitor();
+    if (m_activeTimeline)
+        m_activeTimeline->projectView()->slotInsertTrack(ix);
+}
+
+void MainWindow::slotDeleteTrack(int ix) {
+    m_projectMonitor->activateMonitor();
+    if (m_activeTimeline)
+        m_activeTimeline->projectView()->slotDeleteTrack(ix);
+}
+
+void MainWindow::slotChangeTrack(int ix) {
+    m_projectMonitor->activateMonitor();
+    if (m_activeTimeline)
+        m_activeTimeline->projectView()->slotChangeTrack(ix);
+}
+
 void MainWindow::slotEditGuide() {
     if (m_activeTimeline)
         m_activeTimeline->projectView()->slotEditGuide();