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 @@
#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() ) );
}
}
}
......@@ -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" ) );
......
......@@ -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];
......
......@@ -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;
}
......@@ -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>;
};
......
......@@ -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 );
......
......@@ -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
......
......@@ -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>;
......
......@@ -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 ) ) );
......
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