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

Project: Instantiate & connect RecentProjects & AutomaticBackup when loading/creating a project

parent 0c33156c
......@@ -35,6 +35,7 @@
#include <EffectsEngine/EffectsEngine.h>
#include <Settings/Settings.h>
#include <Tools/VlmcLogger.h>
#include "Project/AutomaticBackup.h"
#include "Project/RecentProjects.h"
Core::Core()
......@@ -52,10 +53,12 @@ Core::Core()
+ QDir::separator() + qApp->applicationName() + ".conf";
m_settings = new Settings( configPath );
m_recentProjects = new RecentProjects( m_settings );
m_automaticBackup = new AutomaticBackup( m_settings );
}
Core::~Core()
{
delete m_automaticBackup;
delete m_settings;
delete m_logger;
delete m_effectsEngine;
......@@ -86,6 +89,12 @@ Core::recentProjects()
return m_recentProjects;
}
AutomaticBackup*
Core::automaticBackup()
{
return m_automaticBackup;
}
Settings*
Core::settings()
{
......
......@@ -23,6 +23,7 @@
#ifndef CORE_H
#define CORE_H
class AutomaticBackup;
class EffectsEngine;
class NotificationZone;
class RecentProjects;
......@@ -44,6 +45,7 @@ class Core : public Singleton<Core>
Settings* settings();
VlmcLogger* logger();
RecentProjects* recentProjects();
AutomaticBackup* automaticBackup();
private:
Core();
......@@ -53,6 +55,7 @@ class Core : public Singleton<Core>
Settings* m_settings;
VlmcLogger* m_logger;
RecentProjects* m_recentProjects;
AutomaticBackup* m_automaticBackup;
friend class Singleton<Core>;
};
......
......@@ -55,6 +55,8 @@ AutomaticBackup::setProject( Project* projectManager )
{
m_timer->disconnect();
connect( m_timer, SIGNAL( timeout() ), projectManager, SLOT(autoSaveRequired() ) );
connect( projectManager, SIGNAL( destroyed() ), m_timer, SLOT( stop() ) );
m_timer->start();
}
void
......
......@@ -26,11 +26,13 @@
#include <QFileInfo>
#include <QUndoStack>
#include "AutomaticBackup.h"
#include "Library/Library.h"
#include "Workflow/MainWorkflow.h"
#include "Project/Project.h"
#include "Project/Workspace.h"
#include "Project.h"
#include "RecentProjects.h"
#include "Settings/Settings.h"
#include "Workflow/MainWorkflow.h"
#include "Workspace.h"
#include "Tools/VlmcDebug.h"
......@@ -100,7 +102,7 @@ Project::workspace()
//////////////////////////////////////////////////////////////////////////////////////////
bool
Project::load(const QString& fileName )
Project::load( const QString& fileName )
{
Project* self = getInstance();
if ( fileName.isEmpty() == true )
......@@ -117,6 +119,8 @@ Project::load(const QString& fileName )
self->loadProject( fileName );
self->connectComponents();
Core::getInstance()->automaticBackup()->setProject( self );
Core::getInstance()->recentProjects()->setProject( self );
return true;
}
......@@ -129,6 +133,11 @@ Project::create(const QString& projectName, const QString& projectPath )
Project::destroyInstance();
self = Project::getInstance();
self->newProject( projectName, projectPath );
self->connectComponents();
Core::getInstance()->automaticBackup()->setProject( self );
Core::getInstance()->recentProjects()->setProject( self );
return true;
}
......
......@@ -35,6 +35,7 @@ class QString;
class QUndoStack;
class QXmlStreamWriter;
class AutomaticBackup;
class Library;
class MainWorkflow;
class ProjectManager;
......
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