[vlmc-devel] [PATCH 10/12] Use AbstractUndoStack instead of QUndoStack

Yikai Lu luyikei.qmltu at gmail.com
Sun May 22 08:36:54 CEST 2016


---
 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 94f3667..8cabc70 100644
--- a/src/Commands/Commands.cpp
+++ b/src/Commands/Commands.cpp
@@ -31,6 +31,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 4a0e578..10d731a 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 "Workflow/ClipHelper.h"
 #include "EffectsEngine/EffectHelper.h"
 #include "GraphicsAudioItem.h"
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 04b93da..5bf3c80 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -27,6 +27,7 @@
 #include "Workflow/ClipHelper.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;
 };
-- 
1.9.1



More information about the Vlmc-devel mailing list