Skip to content
Snippets Groups Projects
Commit 593cb0a6 authored by luyikei's avatar luyikei Committed by Hugo Beauzée-Luyssen
Browse files

Settings: Project and Library


Signed-off-by: default avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent 225f2064
No related branches found
No related tags found
No related merge requests found
......@@ -40,9 +40,17 @@
#include <QHash>
#include <QUuid>
Library::Library()
Library::Library( Settings *projectSettings )
: m_cleanState( true )
, m_settings( new Settings )
{
m_settings->createVar( SettingValue::List, QString( "medias" ), QVariantList(), "", "", SettingValue::Nothing );
projectSettings->addSettings( "Library", *m_settings );
}
Library::~Library()
{
delete m_settings;
}
void
......
......@@ -41,6 +41,7 @@ class Clip;
class Media;
class ProjectManager;
class Workspace;
class Settings;
/**
* \class Library
......@@ -52,8 +53,8 @@ class Library : public MediaContainer
Q_DISABLE_COPY( Library );
public:
Library();
virtual ~Library(){}
Library( Settings* projectSettings );
virtual ~Library();
virtual void addMedia( Media* media );
virtual Media *addMedia( const QFileInfo &fileInfo );
virtual bool addClip( Clip *clip );
......@@ -67,6 +68,7 @@ private:
bool m_cleanState;
Workspace* m_workspace;
Settings* m_settings;
private slots:
void mediaLoaded( const Media* m );
......
......@@ -47,13 +47,13 @@ Core::Core()
m_logger = new VlmcLogger;
createSettings();
m_currentProject = new Project( m_settings );
m_library = new Library( m_currentProject->settings() );
m_recentProjects = new RecentProjects( m_settings );
m_workspace = new Workspace( m_settings );
m_workflow = new MainWorkflow;
m_workflowRenderer = new WorkflowRenderer( Backend::getBackend(), m_workflow );
m_undoStack = new QUndoStack;
m_library = new Library;
m_currentProject = new Project( m_settings );
connect( m_undoStack, &QUndoStack::cleanChanged, m_currentProject, &Project::cleanChanged );
connect( m_currentProject, &Project::projectSaved, m_undoStack, &QUndoStack::setClean );
......
......@@ -137,6 +137,8 @@ Project::load( const QString& path )
doc.setContent( m_projectFile );
}
m_settings->setSettingsFile( path );
m_settings->load();
auto projectName = m_settings->value( "vlmc/ProjectName" )->get().toString();
emit projectLoading( projectName );
m_isClean = autoBackupFound == false;
......@@ -228,22 +230,8 @@ Project::initSettings()
void
Project::saveProject( const QString& fileName )
{
QByteArray projectString;
QXmlStreamWriter project( &projectString );
project.setAutoFormatting( true );
project.writeStartDocument();
project.writeStartElement( "vlmc" );
project.writeEndElement();
project.writeEndDocument();
// We are not necessarily saving the project to the "main" project file here
// so we don't use m_projectFile
QFile projectFile( fileName );
projectFile.open( QFile::WriteOnly );
projectFile.write( projectString );
m_settings->setSettingsFile( fileName );
m_settings->save();
emit projectSaved();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment