[vlmc-devel] [PATCH 07/14] Core: Mark WITH_GUI on Widget-related code
Yikai Lu
luyikei.qmltu at gmail.com
Mon Apr 11 08:09:18 CEST 2016
---
src/Main/Core.cpp | 10 ++++++++--
src/Main/Core.h | 8 ++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/Main/Core.cpp b/src/Main/Core.cpp
index 2d496e1..6e20128 100644
--- a/src/Main/Core.cpp
+++ b/src/Main/Core.cpp
@@ -25,7 +25,9 @@
#include <QCoreApplication>
#include <QDir>
#include <QtGlobal>
+#ifdef WITH_GUI
#include <QUndoStack>
+#endif
#include <QStandardPaths>
@@ -52,10 +54,12 @@ Core::Core()
m_workspace = new Workspace( m_settings );
m_workflow = new MainWorkflow( m_currentProject->settings() );
m_workflowRenderer = new WorkflowRenderer( Backend::getBackend(), m_workflow );
+#ifdef WITH_GUI
m_undoStack = new QUndoStack;
connect( m_undoStack, &QUndoStack::cleanChanged, m_currentProject, &Project::cleanChanged );
connect( m_currentProject, &Project::projectSaved, m_undoStack, &QUndoStack::setClean );
+#endif
connect( m_library, &Library::cleanStateChanged, m_currentProject, &Project::libraryCleanChanged );
connect( m_currentProject, SIGNAL( projectLoaded( QString, QString ) ),
m_recentProjects, SLOT( projectLoaded( QString, QString ) ) );
@@ -69,7 +73,9 @@ Core::~Core()
{
m_settings->save();
delete m_library;
+#ifdef WITH_GUI
delete m_undoStack;
+#endif
delete m_workflowRenderer;
delete m_workflow;
delete m_currentProject;
@@ -165,13 +171,13 @@ Core::workflow()
{
return m_workflow;
}
-
+#ifdef WITH_GUI
QUndoStack*
Core::undoStack()
{
return m_undoStack;
}
-
+#endif
Library*
Core::library()
{
diff --git a/src/Main/Core.h b/src/Main/Core.h
index 72a36db..1ce1993 100644
--- a/src/Main/Core.h
+++ b/src/Main/Core.h
@@ -34,9 +34,9 @@ class Settings;
class VlmcLogger;
class Workspace;
class WorkflowRenderer;
-
+#ifdef WITH_GUI
class QUndoStack;
-
+#endif
namespace Backend
{
class IBackend;
@@ -59,7 +59,9 @@ class Core : public QObject
Project* project();
WorkflowRenderer* workflowRenderer();
MainWorkflow* workflow();
+#ifdef WITH_GUI
QUndoStack* undoStack();
+#endif
Library* library();
/**
* @brief runtime returns the application runtime
@@ -88,7 +90,9 @@ class Core : public QObject
Project* m_currentProject;
MainWorkflow* m_workflow;
WorkflowRenderer* m_workflowRenderer;
+#ifdef WITH_GUI
QUndoStack* m_undoStack;
+#endif
Library* m_library;
QElapsedTimer m_timer;
};
--
1.9.1
More information about the Vlmc-devel
mailing list