[vlmc-devel] Make Workspace a Core component, instead of a Project component
Hugo Beauzée-Luyssen
git at videolan.org
Tue Apr 1 23:16:24 CEST 2014
vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Apr 1 23:50:38 2014 +0300| [e44c2ff2c9defa0d8df6d62a5c427e5309acb47b] | committer: Hugo Beauzée-Luyssen
Make Workspace a Core component, instead of a Project component
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=e44c2ff2c9defa0d8df6d62a5c427e5309acb47b
---
src/Gui/library/MediaCellView.cpp | 5 +++--
src/Gui/wizard/ProjectWizard.cpp | 1 -
src/Library/MediaContainer.cpp | 2 +-
src/Main/Core.cpp | 10 ++++++++++
src/Main/Core.h | 3 +++
src/Media/Transcoder.cpp | 2 +-
src/Project/Project.cpp | 13 +------------
src/Project/Project.h | 3 ---
src/Project/Workspace.cpp | 1 +
9 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/Gui/library/MediaCellView.cpp b/src/Gui/library/MediaCellView.cpp
index ddf5de1..c8181d6 100644
--- a/src/Gui/library/MediaCellView.cpp
+++ b/src/Gui/library/MediaCellView.cpp
@@ -25,6 +25,7 @@
#include "ui_MediaCellView.h"
#include "Project/Project.h"
+#include "Main/Core.h"
#include "Media/Clip.h"
#include "ClipProperty.h"
#include "Backend/ISource.h"
@@ -293,10 +294,10 @@ MediaCellView::contextMenuEvent( QContextMenuEvent *event )
return ;
if ( copyInWorkspace == selectedAction )
{
- if ( Project::getInstance()->workspace()->copyToWorkspace( m_clip->getMedia() ) == false )
+ if ( Core::getInstance()->workspace()->copyToWorkspace( m_clip->getMedia() ) == false )
{
QMessageBox::warning( NULL, tr( "Can't copy to workspace" ),
- tr( "Can't copy this media to workspace: %1" ).arg( Project::getInstance()->workspace()->lastError() ) );
+ tr( "Can't copy this media to workspace: %1" ).arg( Core::getInstance()->workspace()->lastError() ) );
}
}
}
diff --git a/src/Gui/wizard/ProjectWizard.cpp b/src/Gui/wizard/ProjectWizard.cpp
index dd7e8e5..dcef524 100644
--- a/src/Gui/wizard/ProjectWizard.cpp
+++ b/src/Gui/wizard/ProjectWizard.cpp
@@ -106,7 +106,6 @@ ProjectWizard::accept()
preferences->setValue( "vlmc/DefaultProjectLocation", field( "workspace" ) );
- projectPreferences->setValue( "vlmc/Workspace", field( "projectPath" ) );
projectPreferences->setValue( "video/VLMCOutputFPS", field( "fps" ) );
projectPreferences->setValue( "video/VideoProjectHeight", field( "height" ) );
projectPreferences->setValue( "video/VideoProjectWidth", field( "width" ) );
diff --git a/src/Library/MediaContainer.cpp b/src/Library/MediaContainer.cpp
index df4752a..feaf869 100644
--- a/src/Library/MediaContainer.cpp
+++ b/src/Library/MediaContainer.cpp
@@ -213,7 +213,7 @@ MediaContainer::loadContainer( const QDomElement& clips, MediaContainer *parentM
//Handle workspace stuff.
if ( media.startsWith( Workspace::workspacePrefix ) == true )
- media = media.replace( Workspace::workspacePrefix, VLMC_PROJECT_GET_STRING( "vlmc/Workspace" ) );
+ media = media.replace( Workspace::workspacePrefix, VLMC_GET_STRING( "vlmc/Workspace" ) );
if ( m_medias.contains( media ) == true )
{
Media* m = m_medias[media];
diff --git a/src/Main/Core.cpp b/src/Main/Core.cpp
index 122dc7a..b320917 100644
--- a/src/Main/Core.cpp
+++ b/src/Main/Core.cpp
@@ -37,6 +37,7 @@
#include <Tools/VlmcLogger.h>
#include "Project/AutomaticBackup.h"
#include "Project/RecentProjects.h"
+#include "Project/Workspace.h"
Core::Core()
{
@@ -54,10 +55,12 @@ Core::Core()
m_settings = new Settings( configPath );
m_recentProjects = new RecentProjects( m_settings );
m_automaticBackup = new AutomaticBackup( m_settings );
+ m_workspace = new Workspace( m_settings );
}
Core::~Core()
{
+ delete m_workspace;
delete m_automaticBackup;
delete m_settings;
delete m_logger;
@@ -109,3 +112,10 @@ Core::settings()
{
return m_settings;
}
+
+
+Workspace*
+Core::workspace()
+{
+ return m_workspace;
+}
diff --git a/src/Main/Core.h b/src/Main/Core.h
index 7aca3b3..59354fa 100644
--- a/src/Main/Core.h
+++ b/src/Main/Core.h
@@ -30,6 +30,7 @@ class Project;
class RecentProjects;
class Settings;
class VlmcLogger;
+class Workspace;
namespace Backend
{
@@ -51,6 +52,7 @@ class Core : public QObject, public Singleton<Core>
VlmcLogger* logger();
RecentProjects* recentProjects();
AutomaticBackup* automaticBackup();
+ Workspace* workspace();
void onProjectLoaded( Project* project );
@@ -74,6 +76,7 @@ class Core : public QObject, public Singleton<Core>
VlmcLogger* m_logger;
RecentProjects* m_recentProjects;
AutomaticBackup* m_automaticBackup;
+ Workspace* m_workspace;
friend class Singleton<Core>;
};
diff --git a/src/Media/Transcoder.cpp b/src/Media/Transcoder.cpp
index 74fb486..1357329 100644
--- a/src/Media/Transcoder.cpp
+++ b/src/Media/Transcoder.cpp
@@ -52,7 +52,7 @@ Transcoder::~Transcoder()
void
Transcoder::transcodeToPs()
{
- QString outputDir = VLMC_PROJECT_GET_STRING( "vlmc/Workspace" );
+ QString outputDir = VLMC_GET_STRING( "vlmc/Workspace" );
Backend::ISource* source = m_media->source();
delete m_renderer;
m_renderer = source->createRenderer( m_eventWatcher );
diff --git a/src/Project/Project.cpp b/src/Project/Project.cpp
index 4b86234..d6af900 100644
--- a/src/Project/Project.cpp
+++ b/src/Project/Project.cpp
@@ -34,7 +34,6 @@
#include "RecentProjects.h"
#include "Settings/Settings.h"
#include "Workflow/MainWorkflow.h"
-#include "Workspace.h"
#include "Tools/VlmcDebug.h"
@@ -55,8 +54,7 @@ Project::Project()
m_settings = new Settings( QString() );
m_undoStack = new QUndoStack;
m_workflow = new MainWorkflow;
- m_workspace = new Workspace( m_settings );
- m_library = new Library( m_workspace );
+ m_library = new Library( Core::getInstance()->workspace() );
m_workflowRenderer = new WorkflowRenderer( Backend::getBackend(), m_workflow );
connectComponents();
}
@@ -65,7 +63,6 @@ Project::~Project()
{
delete m_projectFile;
delete m_library;
- delete m_workspace;
delete m_workflow;
delete m_undoStack;
delete m_settings;
@@ -101,12 +98,6 @@ Project::settings()
return m_settings;
}
-Workspace*
-Project::workspace()
-{
- return m_workspace;
-}
-
//////////////////////////////////////////////////////////////////////////////////////////
bool
@@ -312,8 +303,6 @@ Project::initSettings()
QT_TRANSLATE_NOOP( "PreferenceWidget", "The project name" ),
SettingValue::NotEmpty );
m_settings->watchValue( "vlmc/ProjectName", this, SLOT( projectNameChanged( QVariant ) ) );
-
- m_settings->createVar( SettingValue::String, "vlmc/Workspace", "", "", "", SettingValue::Private );
}
QString
diff --git a/src/Project/Project.h b/src/Project/Project.h
index ff68ff7..adc2a81 100644
--- a/src/Project/Project.h
+++ b/src/Project/Project.h
@@ -42,7 +42,6 @@ class Library;
class MainWorkflow;
class ProjectManager;
class Settings;
-class Workspace;
class WorkflowRenderer;
class Project : public QObject, public Singleton<Project>
@@ -147,14 +146,12 @@ class Project : public QObject, public Singleton<Project>
Settings* settings();
MainWorkflow* workflow();
WorkflowRenderer* workflowRenderer();
- Workspace* workspace();
private:
Library* m_library;
MainWorkflow* m_workflow;
QUndoStack* m_undoStack;
Settings* m_settings;
- Workspace* m_workspace;
WorkflowRenderer* m_workflowRenderer;
friend class Singleton<Project>;
diff --git a/src/Project/Workspace.cpp b/src/Project/Workspace.cpp
index fc9b81c..0de8e67 100644
--- a/src/Project/Workspace.cpp
+++ b/src/Project/Workspace.cpp
@@ -43,6 +43,7 @@ const QString Workspace::workspacePrefix = "workspace://";
Workspace::Workspace(Settings *settings)
: m_copyInProgress( false )
{
+ settings->createVar( SettingValue::String, "vlmc/Workspace", "", "", "", SettingValue::Private );
SettingValue* workspaceDir = settings->value( "vlmc/Workspace" );
connect(workspaceDir, SIGNAL( changed( QVariant ) ),
this, SLOT( workspaceChanged( QVariant ) ) );
More information about the Vlmc-devel
mailing list