Commit e44c2ff2 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Make Workspace a Core component, instead of a Project component

parent f7bf7548
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "ui_MediaCellView.h" #include "ui_MediaCellView.h"
#include "Project/Project.h" #include "Project/Project.h"
#include "Main/Core.h"
#include "Media/Clip.h" #include "Media/Clip.h"
#include "ClipProperty.h" #include "ClipProperty.h"
#include "Backend/ISource.h" #include "Backend/ISource.h"
...@@ -293,10 +294,10 @@ MediaCellView::contextMenuEvent( QContextMenuEvent *event ) ...@@ -293,10 +294,10 @@ MediaCellView::contextMenuEvent( QContextMenuEvent *event )
return ; return ;
if ( copyInWorkspace == selectedAction ) 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" ), 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() ) );
} }
} }
} }
...@@ -106,7 +106,6 @@ ProjectWizard::accept() ...@@ -106,7 +106,6 @@ ProjectWizard::accept()
preferences->setValue( "vlmc/DefaultProjectLocation", field( "workspace" ) ); preferences->setValue( "vlmc/DefaultProjectLocation", field( "workspace" ) );
projectPreferences->setValue( "vlmc/Workspace", field( "projectPath" ) );
projectPreferences->setValue( "video/VLMCOutputFPS", field( "fps" ) ); projectPreferences->setValue( "video/VLMCOutputFPS", field( "fps" ) );
projectPreferences->setValue( "video/VideoProjectHeight", field( "height" ) ); projectPreferences->setValue( "video/VideoProjectHeight", field( "height" ) );
projectPreferences->setValue( "video/VideoProjectWidth", field( "width" ) ); projectPreferences->setValue( "video/VideoProjectWidth", field( "width" ) );
......
...@@ -213,7 +213,7 @@ MediaContainer::loadContainer( const QDomElement& clips, MediaContainer *parentM ...@@ -213,7 +213,7 @@ MediaContainer::loadContainer( const QDomElement& clips, MediaContainer *parentM
//Handle workspace stuff. //Handle workspace stuff.
if ( media.startsWith( Workspace::workspacePrefix ) == true ) 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 ) if ( m_medias.contains( media ) == true )
{ {
Media* m = m_medias[media]; Media* m = m_medias[media];
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <Tools/VlmcLogger.h> #include <Tools/VlmcLogger.h>
#include "Project/AutomaticBackup.h" #include "Project/AutomaticBackup.h"
#include "Project/RecentProjects.h" #include "Project/RecentProjects.h"
#include "Project/Workspace.h"
Core::Core() Core::Core()
{ {
...@@ -54,10 +55,12 @@ Core::Core() ...@@ -54,10 +55,12 @@ Core::Core()
m_settings = new Settings( configPath ); m_settings = new Settings( configPath );
m_recentProjects = new RecentProjects( m_settings ); m_recentProjects = new RecentProjects( m_settings );
m_automaticBackup = new AutomaticBackup( m_settings ); m_automaticBackup = new AutomaticBackup( m_settings );
m_workspace = new Workspace( m_settings );
} }
Core::~Core() Core::~Core()
{ {
delete m_workspace;
delete m_automaticBackup; delete m_automaticBackup;
delete m_settings; delete m_settings;
delete m_logger; delete m_logger;
...@@ -109,3 +112,10 @@ Core::settings() ...@@ -109,3 +112,10 @@ Core::settings()
{ {
return m_settings; return m_settings;
} }
Workspace*
Core::workspace()
{
return m_workspace;
}
...@@ -30,6 +30,7 @@ class Project; ...@@ -30,6 +30,7 @@ class Project;
class RecentProjects; class RecentProjects;
class Settings; class Settings;
class VlmcLogger; class VlmcLogger;
class Workspace;
namespace Backend namespace Backend
{ {
...@@ -51,6 +52,7 @@ class Core : public QObject, public Singleton<Core> ...@@ -51,6 +52,7 @@ class Core : public QObject, public Singleton<Core>
VlmcLogger* logger(); VlmcLogger* logger();
RecentProjects* recentProjects(); RecentProjects* recentProjects();
AutomaticBackup* automaticBackup(); AutomaticBackup* automaticBackup();
Workspace* workspace();
void onProjectLoaded( Project* project ); void onProjectLoaded( Project* project );
...@@ -74,6 +76,7 @@ class Core : public QObject, public Singleton<Core> ...@@ -74,6 +76,7 @@ class Core : public QObject, public Singleton<Core>
VlmcLogger* m_logger; VlmcLogger* m_logger;
RecentProjects* m_recentProjects; RecentProjects* m_recentProjects;
AutomaticBackup* m_automaticBackup; AutomaticBackup* m_automaticBackup;
Workspace* m_workspace;
friend class Singleton<Core>; friend class Singleton<Core>;
}; };
......
...@@ -52,7 +52,7 @@ Transcoder::~Transcoder() ...@@ -52,7 +52,7 @@ Transcoder::~Transcoder()
void void
Transcoder::transcodeToPs() Transcoder::transcodeToPs()
{ {
QString outputDir = VLMC_PROJECT_GET_STRING( "vlmc/Workspace" ); QString outputDir = VLMC_GET_STRING( "vlmc/Workspace" );
Backend::ISource* source = m_media->source(); Backend::ISource* source = m_media->source();
delete m_renderer; delete m_renderer;
m_renderer = source->createRenderer( m_eventWatcher ); m_renderer = source->createRenderer( m_eventWatcher );
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "RecentProjects.h" #include "RecentProjects.h"
#include "Settings/Settings.h" #include "Settings/Settings.h"
#include "Workflow/MainWorkflow.h" #include "Workflow/MainWorkflow.h"
#include "Workspace.h"
#include "Tools/VlmcDebug.h" #include "Tools/VlmcDebug.h"
...@@ -55,8 +54,7 @@ Project::Project() ...@@ -55,8 +54,7 @@ Project::Project()
m_settings = new Settings( QString() ); m_settings = new Settings( QString() );
m_undoStack = new QUndoStack; m_undoStack = new QUndoStack;
m_workflow = new MainWorkflow; m_workflow = new MainWorkflow;
m_workspace = new Workspace( m_settings ); m_library = new Library( Core::getInstance()->workspace() );
m_library = new Library( m_workspace );
m_workflowRenderer = new WorkflowRenderer( Backend::getBackend(), m_workflow ); m_workflowRenderer = new WorkflowRenderer( Backend::getBackend(), m_workflow );
connectComponents(); connectComponents();
} }
...@@ -65,7 +63,6 @@ Project::~Project() ...@@ -65,7 +63,6 @@ Project::~Project()
{ {
delete m_projectFile; delete m_projectFile;
delete m_library; delete m_library;
delete m_workspace;
delete m_workflow; delete m_workflow;
delete m_undoStack; delete m_undoStack;
delete m_settings; delete m_settings;
...@@ -101,12 +98,6 @@ Project::settings() ...@@ -101,12 +98,6 @@ Project::settings()
return m_settings; return m_settings;
} }
Workspace*
Project::workspace()
{
return m_workspace;
}
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
bool bool
...@@ -312,8 +303,6 @@ Project::initSettings() ...@@ -312,8 +303,6 @@ Project::initSettings()
QT_TRANSLATE_NOOP( "PreferenceWidget", "The project name" ), QT_TRANSLATE_NOOP( "PreferenceWidget", "The project name" ),
SettingValue::NotEmpty ); SettingValue::NotEmpty );
m_settings->watchValue( "vlmc/ProjectName", this, SLOT( projectNameChanged( QVariant ) ) ); m_settings->watchValue( "vlmc/ProjectName", this, SLOT( projectNameChanged( QVariant ) ) );
m_settings->createVar( SettingValue::String, "vlmc/Workspace", "", "", "", SettingValue::Private );
} }
QString QString
......
...@@ -42,7 +42,6 @@ class Library; ...@@ -42,7 +42,6 @@ class Library;
class MainWorkflow; class MainWorkflow;
class ProjectManager; class ProjectManager;
class Settings; class Settings;
class Workspace;
class WorkflowRenderer; class WorkflowRenderer;
class Project : public QObject, public Singleton<Project> class Project : public QObject, public Singleton<Project>
...@@ -147,14 +146,12 @@ class Project : public QObject, public Singleton<Project> ...@@ -147,14 +146,12 @@ class Project : public QObject, public Singleton<Project>
Settings* settings(); Settings* settings();
MainWorkflow* workflow(); MainWorkflow* workflow();
WorkflowRenderer* workflowRenderer(); WorkflowRenderer* workflowRenderer();
Workspace* workspace();
private: private:
Library* m_library; Library* m_library;
MainWorkflow* m_workflow; MainWorkflow* m_workflow;
QUndoStack* m_undoStack; QUndoStack* m_undoStack;
Settings* m_settings; Settings* m_settings;
Workspace* m_workspace;
WorkflowRenderer* m_workflowRenderer; WorkflowRenderer* m_workflowRenderer;
friend class Singleton<Project>; friend class Singleton<Project>;
......
...@@ -43,6 +43,7 @@ const QString Workspace::workspacePrefix = "workspace://"; ...@@ -43,6 +43,7 @@ const QString Workspace::workspacePrefix = "workspace://";
Workspace::Workspace(Settings *settings) Workspace::Workspace(Settings *settings)
: m_copyInProgress( false ) : m_copyInProgress( false )
{ {
settings->createVar( SettingValue::String, "vlmc/Workspace", "", "", "", SettingValue::Private );
SettingValue* workspaceDir = settings->value( "vlmc/Workspace" ); SettingValue* workspaceDir = settings->value( "vlmc/Workspace" );
connect(workspaceDir, SIGNAL( changed( QVariant ) ), connect(workspaceDir, SIGNAL( changed( QVariant ) ),
this, SLOT( workspaceChanged( QVariant ) ) ); this, SLOT( workspaceChanged( QVariant ) ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment