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