]> git.sesse.net Git - kdenlive/commitdiff
Implement document notes:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 20 Sep 2010 18:30:23 +0000 (18:30 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 20 Sep 2010 18:30:23 +0000 (18:30 +0000)
http://kdenlive.org/mantis/view.php?id=1768

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

src/kdenlivedoc.cpp
src/kdenlivedoc.h
src/mainwindow.cpp
src/mainwindow.h

index 3e60ea7b250e9bab5f5f131be23b451e63cb4c7f..ab638515612c5ff41f84c86f8a67d371bb59e20e 100644 (file)
 
 const double DOCUMENTVERSION = 0.85;
 
-KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, QString profileName, const QPoint tracks, Render *render, MainWindow *parent) :
-        QObject(parent),
-        m_autosave(NULL),
-        m_url(url),
-        m_render(render),
-        m_commandStack(new QUndoStack(undoGroup)),
-        m_modified(false),
-        m_projectFolder(projectFolder)
+KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, QString profileName, const QPoint tracks, Render *render, KTextEdit *notes, MainWindow *parent) :
+    QObject(parent),
+    m_autosave(NULL),
+    m_url(url),
+    m_render(render),
+    m_notesWidget(notes),
+    m_commandStack(new QUndoStack(undoGroup)),
+    m_modified(false),
+    m_projectFolder(projectFolder)
 {
     m_clipManager = new ClipManager(this);
     m_autoSaveTimer = new QTimer(this);
@@ -108,6 +109,10 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup
                             QDomElement infoXml = mlt.firstChildElement("kdenlivedoc");
                             QDomElement e;
 
+                            // Read notes
+                            QDomElement notesxml = infoXml.firstChildElement("documentnotes");
+                            if (!notesxml.isNull()) m_notesWidget->setText(notesxml.firstChild().nodeValue());
+
                             // Build tracks
                             QDomElement tracksinfo = infoXml.firstChildElement("tracksinfo");
                             if (!tracksinfo.isNull()) {
@@ -515,6 +520,11 @@ bool KdenliveDoc::saveSceneList(const QString &path, const QString &scene)
     docproperties.setAttribute("position", m_render->seekPosition().frames(m_fps));
     addedXml.appendChild(docproperties);
 
+    QDomElement docnotes = sceneList.createElement("documentnotes");
+    QDomText value = sceneList.createTextNode(m_notesWidget->toPlainText());
+    docnotes.appendChild(value);
+    addedXml.appendChild(docnotes);
+
     // Add profile info
     QDomElement profileinfo = sceneList.createElement("profileinfo");
     profileinfo.setAttribute("description", m_profile.description);
@@ -1078,9 +1088,9 @@ void KdenliveDoc::slotCreateColorClip(const QString &name, const QString &color,
 }
 
 void KdenliveDoc::slotCreateSlideshowClipFile(const QString name, const QString path, int count, const QString duration,
-                                              const bool loop, const bool crop, const bool fade,
-                                              const QString &luma_duration, const QString &luma_file, const int softness,
-                                              const QString &animation, QString group, const QString &groupId)
+        const bool loop, const bool crop, const bool fade,
+        const QString &luma_duration, const QString &luma_file, const int softness,
+        const QString &animation, QString group, const QString &groupId)
 {
     m_clipManager->slotAddSlideshowClipFile(name, path, count, duration, loop,
                                             crop, fade, luma_duration,
index a938d8d88354dcfc8064601a4c4d8546629ac455..e8953f1de63866a280c44fb304ed60ae9d3feea4 100644 (file)
@@ -45,11 +45,13 @@ class DocClipBase;
 class MainWindow;
 class TrackInfo;
 
+class KTextEdit;
+
 class KdenliveDoc: public QObject
 {
 Q_OBJECT public:
 
-    KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, QString profileName, const QPoint tracks, Render *render, MainWindow *parent = 0);
+    KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, QString profileName, const QPoint tracks, Render *render, KTextEdit *notes, MainWindow *parent = 0);
     ~KdenliveDoc();
     QDomNodeList producersList();
     double fps() const;
@@ -147,6 +149,7 @@ private:
     int m_height;
     Timecode m_timecode;
     Render *m_render;
+    KTextEdit *m_notesWidget;
     QUndoStack *m_commandStack;
     ClipManager *m_clipManager;
     MltVideoProfile m_profile;
index 06f891e4bde9a58ec04b9e234dd95252c13c5c06..dd8e2d01637be992ec1202efd5fe6e623fc36251 100644 (file)
@@ -198,6 +198,14 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
     connect(m_recMonitor, SIGNAL(showConfigDialog(int, int)), this, SLOT(slotPreferences(int, int)));
 #endif
 
+    m_notesDock = new QDockWidget(i18n("Project Notes"), this);
+    m_notesDock->setObjectName("notes_widget");
+    m_notesWidget = new KTextEdit();
+    m_notesWidget->setTabChangesFocus(true);
+    m_notesWidget->setClickMessage(i18n("Enter your project notes here..."));
+    m_notesDock->setWidget(m_notesWidget);
+    addDockWidget(Qt::TopDockWidgetArea, m_notesDock);
+
     m_effectStackDock = new QDockWidget(i18n("Effect Stack"), this);
     m_effectStackDock->setObjectName("effect_stack");
     m_effectStack = new EffectStackView(m_projectMonitor);
@@ -1709,7 +1717,7 @@ void MainWindow::newFile(bool showProjectSettings, bool force)
     }
     m_timelineArea->setEnabled(true);
     m_projectList->setEnabled(true);
-    KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, projectTracks, m_projectMonitor->render, this);
+    KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, projectTracks, m_projectMonitor->render, m_notesWidget, this);
     doc->m_autosave = new KAutoSaveFile(KUrl(), doc);
     bool ok;
     TrackView *trackView = new TrackView(doc, &ok, this);
@@ -1915,7 +1923,7 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
 {
     if (!m_timelineArea->isEnabled()) return;
     m_fileRevert->setEnabled(true);
-    KdenliveDoc *doc = new KdenliveDoc(url, KdenliveSettings::defaultprojectfolder(), m_commandStack, KdenliveSettings::default_profile(), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), m_projectMonitor->render, this);
+    KdenliveDoc *doc = new KdenliveDoc(url, KdenliveSettings::defaultprojectfolder(), m_commandStack, KdenliveSettings::default_profile(), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), m_projectMonitor->render, m_notesWidget, this);
     if (stale == NULL) {
         stale = new KAutoSaveFile(url, doc);
         doc->m_autosave = stale;
@@ -2212,6 +2220,7 @@ 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_projectMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeDocument, SLOT(setModified()));
+            disconnect(m_notesWidget, SIGNAL(textChanged()), m_activeDocument, SLOT(setModified()));
             disconnect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeDocument, SLOT(setModified()));
             disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
             disconnect(m_projectList, SIGNAL(updateProfile(const QString &)), this, SLOT(slotUpdateProjectProfile(const QString &)));
@@ -2300,7 +2309,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
     connect(doc, SIGNAL(deleteTimelineClip(const QString &)), trackView, SLOT(slotDeleteClip(const QString &)));
     connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
     connect(doc, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
-
+    connect(m_notesWidget, SIGNAL(textChanged()), doc, SLOT(setModified()));
 
     connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), m_effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
     connect(trackView->projectView(), SIGNAL(updateClipMarkers(DocClipBase *)), this, SLOT(slotUpdateClipMarkers(DocClipBase*)));
index 710ebc011bb2e37bcbdd7bb0fecccfd676725fb6..62f5c68122e72e8fe32fdf51de7bbc628362d791 100644 (file)
@@ -142,6 +142,9 @@ private:
     EffectsListView *m_effectList;
     //KListWidget *m_effectList;
 
+    QDockWidget *m_notesDock;
+    KTextEdit *m_notesWidget;
+
     QDockWidget *m_effectStackDock;
     EffectStackView *m_effectStack;