[vlmc-devel] Clear Library and MainWorkflow when a project is closed

Yikai Lu git at videolan.org
Sun Apr 10 14:18:09 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Apr 10 18:39:42 2016 +0900| [648ed77d3bb1b4be23e268fcc6dcd9ee7c9c1c23] | committer: Hugo Beauzée-Luyssen

Clear Library and MainWorkflow when a project is closed

Clearing only in postLoad causes a problem when a new project is created, which will call save() first.

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> https://code.videolan.org/videolan/vlmc/commit/648ed77d3bb1b4be23e268fcc6dcd9ee7c9c1c23
---

 src/Library/Library.cpp       | 1 -
 src/Main/Core.cpp             | 2 ++
 src/Workflow/MainWorkflow.cpp | 1 -
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Library/Library.cpp b/src/Library/Library.cpp
index 747ef42..555d860 100644
--- a/src/Library/Library.cpp
+++ b/src/Library/Library.cpp
@@ -69,7 +69,6 @@ Library::preSave()
 void
 Library::postLoad()
 {
-    clear();
     for ( const auto& var : m_settings->value( "medias" )->get().toList() )
         createMediaFromVariant( var );
 
diff --git a/src/Main/Core.cpp b/src/Main/Core.cpp
index a5c235b..2d496e1 100644
--- a/src/Main/Core.cpp
+++ b/src/Main/Core.cpp
@@ -59,6 +59,8 @@ Core::Core()
     connect( m_library, &Library::cleanStateChanged, m_currentProject, &Project::libraryCleanChanged );
     connect( m_currentProject, SIGNAL( projectLoaded( QString, QString ) ),
              m_recentProjects, SLOT( projectLoaded( QString, QString ) ) );
+    connect( m_currentProject, &Project::projectClosed, m_library, &Library::clear );
+    connect( m_currentProject, &Project::projectClosed, m_workflow, &MainWorkflow::clear );
 
     m_timer.start();
 }
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index f144353..264982b 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -337,7 +337,6 @@ MainWorkflow::preSave()
 void
 MainWorkflow::postLoad()
 {
-    clear();
     QVariantList l = m_settings->value( "tracks" )->get().toList();
     for ( unsigned int i = 0; i < Workflow::NbTrackType; ++i )
         m_tracks[i]->loadFromVariant( l[i] );



More information about the Vlmc-devel mailing list