]> git.sesse.net Git - kdenlive/commitdiff
load & save guides
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 10 Jun 2008 21:35:28 +0000 (21:35 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 10 Jun 2008 21:35:28 +0000 (21:35 +0000)
svn path=/branches/KDE4/; revision=2245

src/customtrackview.cpp
src/customtrackview.h
src/kdenlivedoc.cpp
src/kdenlivedoc.h
src/mainwindow.cpp
src/trackview.cpp

index 8655f009ca6d2a14e8bea21f5dc3f0224e5fd411..6bcf56426e2c9c69da1ddc2719d4e8f1379b0f74 100644 (file)
@@ -1487,6 +1487,20 @@ void CustomTrackView::drawBackground(QPainter * painter, const QRectF & rect) {
     if (height() > lowerLimit)
         painter->fillRect(QRectF(rectInView.left(), lowerLimit, rectInView.width(), height() - lowerLimit), QBrush(base));
 }
+
+QDomElement CustomTrackView::xmlInfo() {
+    QDomDocument doc;
+    QDomElement e;
+    QDomElement guides = doc.createElement("guides");
+    for (int i = 0; i < m_guides.count(); i++) {
+        e = doc.createElement("guide");
+        e.setAttribute("time", m_guides.at(i)->position().ms() / 1000);
+        e.setAttribute("comment", m_guides.at(i)->label());
+        guides.appendChild(e);
+    }
+       return guides;
+}
+
 /*
 void CustomTrackView::drawForeground ( QPainter * painter, const QRectF & rect )
 {
index 118765174bf3dfb635b067d5efa062b9db96c4ff..016160866edb8fb529b4d361b33664c9925e292e 100644 (file)
@@ -82,6 +82,7 @@ public:
     void slotSeekToPreviousSnap();
     void slotSeekToNextSnap();
     double getSnapPointForPos(double pos);
+       QDomElement xmlInfo();
 
 public slots:
     void setCursorPos(int pos, bool seek = true);
@@ -100,6 +101,7 @@ public slots:
     void slotSwitchTrackVideo(int ix);
     void slotUpdateClip(int clipId);
     void slotAddClipMarker(int id, GenTime t, QString c);
+    void addGuide(const GenTime pos, const QString &comment);
     void slotAddGuide();
        void slotDeleteGuide();
     void editGuide(const GenTime oldPos, const GenTime pos, const QString &comment);
@@ -158,7 +160,6 @@ private:
     /** Get the index of the video track that is just below current track */
     int getPreviousVideoTrack(int track);
     void updateClipFade(ClipItem * item, bool updateFadeOut = false);
-    void addGuide(const GenTime pos, const QString &comment);
 
 signals:
     void cursorMoved(int, int);
index 6e0d2e5fe9f06a04ffaf13db0320b674ea32a34b..624a3e93acf082f138b0e39e835d503c9d72826c 100644 (file)
@@ -312,7 +312,7 @@ void KdenliveDoc::convertDocument(double version) {
     //kDebug() << "/////////////////  END CONVERTEDĀ DOC:";
 }
 
-QDomElement KdenliveDoc::documentInfoXml() {
+QDomElement KdenliveDoc::documentInfoXml(QDomElement timelineInfo) {
     QDomDocument doc;
     QDomElement e;
     QDomElement addedXml = doc.createElement("kdenlivedoc");
@@ -335,6 +335,7 @@ QDomElement KdenliveDoc::documentInfoXml() {
         }
     }
     addedXml.appendChild(markers);
+    addedXml.appendChild(doc.importNode(timelineInfo, true));
     //kDebug() << m_document.toString();
     return addedXml;
 }
index e6e972fa24c0f4a70cc65107fb33a5d3c6000d2c..463e4cda78af699bdd5c0642ee2d995d2bde7446 100644 (file)
@@ -84,7 +84,7 @@ Q_OBJECT public:
     /** Returns the document format: PAL or NTSC */
     QString getDocumentStandard();
     void setUrl(KUrl url);
-    QDomElement documentInfoXml();
+    QDomElement documentInfoXml(QDomElement timelineInfo);
     void setProfilePath(QString path);
     /** Set to true if document needs saving, false otherwise */
     void setModified(bool mod);
index d9a62246e6e49d22c65a6e6fcc783028e837f598..37a19f73700568b821979e3ba84a2ed757ba6ea0 100644 (file)
@@ -617,7 +617,7 @@ void MainWindow::slotRemoveTab() {
 }
 
 void MainWindow::saveFileAs(const QString &outputFileName) {
-    m_projectMonitor->saveSceneList(outputFileName, m_activeDocument->documentInfoXml());
+    m_projectMonitor->saveSceneList(outputFileName, m_activeDocument->documentInfoXml(m_activeTimeline->projectView()->xmlInfo()));
     m_activeDocument->setUrl(KUrl(outputFileName));
     setCaption(m_activeDocument->description());
     m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
index c8f7266dcba8ca2e7cc29066118db4f1304df1b5..fe941cbbfe5703dabb5cc7b53cf05ff5d15ba994 100644 (file)
@@ -233,6 +233,15 @@ void TrackView::parseDocument(QDomDocument doc) {
         }
     }
 
+       // Add guides
+    QDomNodeList guides = doc.elementsByTagName("guide");
+    kDebug() << "//////////// OPENING PRJECT FILE, FOUND: " << guides.count() << " GUIDES$$$$$$$$$";
+    for (int i = 0; i < guides.count(); i++) {
+        e = guides.item(i).toElement();
+               const QString comment = e.attribute("comment");
+               const GenTime pos = GenTime(e.attribute("time").toDouble());
+               m_trackview->addGuide(pos, comment);
+       }
 
     m_trackview->setDuration(duration);
     kDebug() << "///////////  TOTAL PROJECT DURATION: " << duration;