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

Avoid invoking Project::getInstance() while constructing the instance

parent 3b55a469
......@@ -31,6 +31,7 @@
#include "Media/Clip.h"
#include "Media/Media.h"
#include "Metadata/MetaDataManager.h"
#include "Project/ProjectManager.h"
#include "Settings/Settings.h"
#include "Tools/VlmcDebug.h"
#include "Project/Workspace.h"
......@@ -39,10 +40,14 @@
#include <QHash>
#include <QUuid>
Library::Library( Workspace *workspace )
Library::Library( Workspace *workspace , ProjectManager *projectManager )
: m_cleanState( true )
, m_workspace( workspace )
{
connect( projectManager, SIGNAL( projectClosed() ),
this, SLOT( clear() ) );
connect( projectManager, SIGNAL( cleanStateChanged( bool ) ),
this, SLOT( cleanChanged( bool ) ) );
}
void
......
......@@ -39,6 +39,7 @@ class QDomElement;
class Clip;
class Media;
class ProjectManager;
class Workspace;
/**
......@@ -51,7 +52,7 @@ class Library : public MediaContainer
Q_DISABLE_COPY( Library );
public:
Library( Workspace* workspace );
Library( Workspace* workspace, ProjectManager* projectManager );
virtual ~Library(){}
virtual void addMedia( Media* media );
virtual Media *addMedia( const QFileInfo &fileInfo );
......
......@@ -32,22 +32,22 @@
Project::Project()
{
m_projectManager = new ProjectManager;
m_settings = new Settings( QString() );
m_undoStack = new QUndoStack;
m_workflow = new MainWorkflow;
m_workflow = new MainWorkflow( m_projectManager );
m_workspace = new Workspace( m_settings );
m_library = new Library( m_workspace );
m_projectManager = new ProjectManager;
m_library = new Library( m_workspace, m_projectManager );
}
Project::~Project()
{
delete m_projectManager;
delete m_library;
delete m_workspace;
delete m_workflow;
delete m_undoStack;
delete m_settings;
delete m_projectManager;
}
Library*
......
......@@ -53,11 +53,6 @@ ProjectManager::ProjectManager()
: m_projectFile( NULL )
, m_needSave( false )
{
connect( this, SIGNAL( projectClosed() ), Project::getInstance()->library(), SLOT( clear() ) );
connect( this, SIGNAL( projectClosed() ), Project::getInstance()->workflow(), SLOT( clear() ) );
connect( Project::getInstance()->library(), SIGNAL( cleanStateChanged( bool ) ),
this, SLOT( cleanChanged( bool ) ) );
m_recentsProjects = VLMC_GET_STRINGLIST( SETTINGS_RECENTS );
//If the variable was empty, it will return a list with one empty string in it.
m_recentsProjects.removeAll( "" );
......
......@@ -26,17 +26,14 @@
#include "config.h"
class QTimer;
class QFile;
class QDomDocument;
class QXmlStreamWriter;
#include <QObject>
#include <QStringList>
#include <QDomElement>
#include "Tools/Singleton.hpp"
class QFile;
class QDomDocument;
class QXmlStreamWriter;
class IProjectManagerUiCb
{
public:
......
......@@ -28,6 +28,7 @@
#include "ClipWorkflow.h"
#include "Library/Library.h"
#include "MainWorkflow.h"
#include "Project/ProjectManager.h"
#include "TrackWorkflow.h"
#include "TrackHandler.h"
#include "Settings/Settings.h"
......@@ -37,7 +38,7 @@
#include <QDomElement>
#include <QMutex>
MainWorkflow::MainWorkflow( int trackCount ) :
MainWorkflow::MainWorkflow( ProjectManager *projectManager, int trackCount ) :
m_blackOutput( NULL ),
m_lengthFrame( 0 ),
m_renderStarted( false ),
......@@ -59,6 +60,7 @@ MainWorkflow::MainWorkflow( int trackCount ) :
this, SLOT( lengthUpdated( qint64 ) ) );
m_currentFrame[i] = 0;
}
connect( projectManager, SIGNAL( projectClosed() ), this, SLOT( clear() ) );
}
MainWorkflow::~MainWorkflow()
......
......@@ -32,6 +32,7 @@ class Clip;
class ClipHelper;
class EffectsEngine;
class Effect;
class ProjectManager;
class TrackHandler;
class TrackWorkflow;
namespace Workflow
......@@ -56,7 +57,7 @@ class MainWorkflow : public QObject
Q_OBJECT
public:
MainWorkflow( int trackCount = 64 );
MainWorkflow( ProjectManager* projectManager, int trackCount = 64 );
~MainWorkflow();
/**
......
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