[vlmc-devel] Use AbstractUndoStack instead of QUndoStack

Yikai Lu git at videolan.org
Sat Jun 4 11:47:51 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sun May 22 13:27:31 2016 +0900| [ffeeeb4f3efe626a601269793ae8d71aa06b861e] | committer: Hugo Beauzée-Luyssen

Use AbstractUndoStack instead of QUndoStack

> https://code.videolan.org/videolan/vlmc/commit/ffeeeb4f3efe626a601269793ae8d71aa06b861e
---

 src/Commands/Commands.cpp        |  1 +
 src/Gui/MainWindow.cpp           |  2 +-
 src/Gui/timeline/TracksScene.cpp |  1 +
 src/Gui/timeline/TracksView.cpp  |  1 +
 src/Main/Core.cpp                | 12 +++++++-----
 src/Main/Core.h                  | 11 +++++++----
 6 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/Commands/Commands.cpp b/src/Commands/Commands.cpp
index 4064138..d80ff0b 100644
--- a/src/Commands/Commands.cpp
+++ b/src/Commands/Commands.cpp
@@ -30,6 +30,7 @@
 #include "EffectsEngine/EffectHelper.h"
 #include "EffectsEngine/EffectInstance.h"
 #include "Workflow/TrackWorkflow.h"
+#include "AbstractUndoStack.h"
 
 void
 Commands::trigger( Generic* command )
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index a69dde1..79ee286 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -30,7 +30,6 @@
 #include <QMessageBox>
 #include <QDesktopServices>
 #include <QUndoView>
-#include <QUndoStack>
 #include <QUrl>
 #include <QNetworkProxy>
 #include <QSysInfo>
@@ -44,6 +43,7 @@
 #include "Workflow/MainWorkflow.h"
 #include "Renderer/WorkflowRenderer.h"
 #include "Renderer/ClipRenderer.h"
+#include "Commands/AbstractUndoStack.h"
 
 /* Gui */
 #include "MainWindow.h"
diff --git a/src/Gui/timeline/TracksScene.cpp b/src/Gui/timeline/TracksScene.cpp
index 251916a..81523a4 100644
--- a/src/Gui/timeline/TracksScene.cpp
+++ b/src/Gui/timeline/TracksScene.cpp
@@ -23,6 +23,7 @@
 #include "TracksScene.h"
 
 #include "Commands/Commands.h"
+#include "Commands/AbstractUndoStack.h"
 #include "EffectsEngine/EffectHelper.h"
 #include "GraphicsAudioItem.h"
 #include "GraphicsMovieItem.h"
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index aa59288..1faabc8 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -26,6 +26,7 @@
 #include "Project/Project.h"
 #include "Workflow/ClipWorkflow.h"
 #include "Commands/Commands.h"
+#include "Commands/AbstractUndoStack.h"
 #include "EffectsEngine/EffectHelper.h"
 #include "GraphicsMovieItem.h"
 #include "GraphicsAudioItem.h"
diff --git a/src/Main/Core.cpp b/src/Main/Core.cpp
index 2d57d23..63b8e8f 100644
--- a/src/Main/Core.cpp
+++ b/src/Main/Core.cpp
@@ -25,7 +25,6 @@
 #include <QCoreApplication>
 #include <QDir>
 #include <QtGlobal>
-#include <QUndoStack>
 #include <QStandardPaths>
 
 
@@ -38,6 +37,7 @@
 #include <Settings/Settings.h>
 #include <Tools/VlmcLogger.h>
 #include "Workflow/MainWorkflow.h"
+#include "Commands/AbstractUndoStack.h"
 
 Core::Core()
 {
@@ -52,10 +52,12 @@ Core::Core()
     m_workspace = new Workspace( m_settings );
     m_workflow = new MainWorkflow( m_currentProject->settings() );
     m_workflowRenderer = new WorkflowRenderer( Backend::getBackend(), m_workflow );
-    m_undoStack = new QUndoStack;
+    m_undoStack = new Commands::AbstractUndoStack;
 
-    connect( m_undoStack, &QUndoStack::cleanChanged, m_currentProject, &Project::cleanChanged );
-    connect( m_currentProject, &Project::projectSaved, m_undoStack, &QUndoStack::setClean );
+    connect( m_undoStack, &Commands::AbstractUndoStack::cleanChanged,
+             m_currentProject, &Project::cleanChanged );
+    connect( m_currentProject, &Project::projectSaved,
+             m_undoStack, &Commands::AbstractUndoStack::setClean );
     connect( m_library, &Library::cleanStateChanged, m_currentProject, &Project::libraryCleanChanged );
     connect( m_currentProject, &Project::projectLoaded, m_recentProjects, &RecentProjects::projectLoaded );
     connect( m_currentProject, &Project::projectClosed, m_library, &Library::clear );
@@ -165,7 +167,7 @@ Core::workflow()
     return m_workflow;
 }
 
-QUndoStack*
+Commands::AbstractUndoStack*
 Core::undoStack()
 {
     return m_undoStack;
diff --git a/src/Main/Core.h b/src/Main/Core.h
index 72a36db..b7b90ce 100644
--- a/src/Main/Core.h
+++ b/src/Main/Core.h
@@ -35,13 +35,16 @@ class VlmcLogger;
 class Workspace;
 class WorkflowRenderer;
 
-class QUndoStack;
-
 namespace Backend
 {
     class IBackend;
 }
 
+namespace Commands
+{
+    class AbstractUndoStack;
+}
+
 #include <QObject>
 #include <QElapsedTimer>
 
@@ -59,7 +62,7 @@ class Core : public QObject
         Project*                project();
         WorkflowRenderer*       workflowRenderer();
         MainWorkflow*           workflow();
-        QUndoStack*             undoStack();
+        Commands::AbstractUndoStack*   undoStack();
         Library*                library();
         /**
          * @brief runtime returns the application runtime
@@ -88,7 +91,7 @@ class Core : public QObject
         Project*                m_currentProject;
         MainWorkflow*           m_workflow;
         WorkflowRenderer*       m_workflowRenderer;
-        QUndoStack*             m_undoStack;
+        Commands::AbstractUndoStack*   m_undoStack;
         Library*                m_library;
         QElapsedTimer           m_timer;
 };



More information about the Vlmc-devel mailing list