From: Jean-Baptiste Mardelle Date: Mon, 20 Sep 2010 18:30:23 +0000 (+0000) Subject: Implement document notes: X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=04d9ee1d73082325557f73929600ffca12701cf3;p=kdenlive Implement document notes: http://kdenlive.org/mantis/view.php?id=1768 svn path=/trunk/kdenlive/; revision=4915 --- diff --git a/src/kdenlivedoc.cpp b/src/kdenlivedoc.cpp index 3e60ea7b..ab638515 100644 --- a/src/kdenlivedoc.cpp +++ b/src/kdenlivedoc.cpp @@ -48,14 +48,15 @@ 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, diff --git a/src/kdenlivedoc.h b/src/kdenlivedoc.h index a938d8d8..e8953f1d 100644 --- a/src/kdenlivedoc.h +++ b/src/kdenlivedoc.h @@ -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; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 06f891e4..dd8e2d01 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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*))); diff --git a/src/mainwindow.h b/src/mainwindow.h index 710ebc01..62f5c681 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -142,6 +142,9 @@ private: EffectsListView *m_effectList; //KListWidget *m_effectList; + QDockWidget *m_notesDock; + KTextEdit *m_notesWidget; + QDockWidget *m_effectStackDock; EffectStackView *m_effectStack;