[vlmc-devel] MainWindow: Connect to projectLoaded event
Hugo Beauzée-Luyssen
git at videolan.org
Mon Mar 31 20:24:54 CEST 2014
vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Mar 31 21:22:50 2014 +0300| [8ea45a587bf5f97bf7923b563e87136317706e16] | committer: Hugo Beauzée-Luyssen
MainWindow: Connect to projectLoaded event
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=8ea45a587bf5f97bf7923b563e87136317706e16
---
src/Gui/MainWindow.cpp | 33 +++++++++++++++++++--------------
src/Gui/MainWindow.h | 4 +++-
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index a4f1ead..185e76f 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -75,6 +75,7 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
: QMainWindow( parent )
, m_backend( backend )
, m_fileRenderer( NULL )
+ , m_projectPreferences( NULL )
, m_wizard( NULL )
{
m_ui.setupUi( this );
@@ -88,7 +89,6 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
// GUI
DockWidgetManager::getInstance( this )->setMainWindow( this );
createGlobalPreferences();
- createProjectPreferences();
initializeDockWidgets();
initToolbar();
createStatusBar();
@@ -108,17 +108,6 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
connect( this, SIGNAL( toolChanged( ToolButtons ) ),
m_timeline, SLOT( setTool( ToolButtons ) ) );
- connect( Project::getInstance(), SIGNAL( projectUpdated( const QString&, bool ) ),
- this, SLOT( projectUpdated( const QString&, bool ) ) );
-
- // Undo/Redo
- connect( Project::getInstance()->undoStack(), SIGNAL( canRedoChanged( bool ) ),
- this, SLOT( canRedoChanged( bool ) ) );
- connect( Project::getInstance()->undoStack(), SIGNAL( canUndoChanged( bool ) ),
- this, SLOT( canUndoChanged( bool ) ) );
- canRedoChanged( Project::getInstance()->undoStack()->canRedo() );
- canUndoChanged( Project::getInstance()->undoStack()->canUndo() );
-
//Connecting Library stuff:
const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() );
Q_ASSERT( clipRenderer != NULL );
@@ -126,8 +115,7 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
clipRenderer, SLOT( setClip( Clip* ) ) );
connect( m_mediaLibrary, SIGNAL( importRequired() ),
this, SLOT( on_actionImport_triggered() ) );
- connect( Project::getInstance()->library(), SIGNAL( clipRemoved( const QUuid& ) ),
- clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) );
+
#ifdef WITH_CRASHHANDLER
if ( restoreSession() == true )
@@ -530,6 +518,7 @@ MainWindow::loadGlobalProxySettings()
void
MainWindow::createProjectPreferences()
{
+ delete m_projectPreferences;
m_projectPreferences = new SettingsDialog( Project::getInstance()->settings(), tr( "Project preferences" ), this );
m_projectPreferences->addCategory( "general", QT_TRANSLATE_NOOP( "Settings", "General" ), QIcon( ":/images/vlmc" ) );
m_projectPreferences->addCategory( "video", QT_TRANSLATE_NOOP( "Settings", "Video" ), QIcon( ":/images/video" ) );
@@ -846,6 +835,22 @@ MainWindow::canRedoChanged( bool canRedo )
m_ui.actionRedo->setEnabled( canRedo );
}
+void
+MainWindow::onProjectLoaded(Project* project)
+{
+ createProjectPreferences();
+ connect( project, SIGNAL( projectUpdated( const QString&, bool ) ), this, SLOT( projectUpdated( const QString&, bool ) ) );
+
+ // Undo/Redo
+ connect( project->undoStack(), SIGNAL( canUndoChanged( bool ) ), this, SLOT( canUndoChanged( bool ) ) );
+ connect( project->undoStack(), SIGNAL( canRedoChanged( bool ) ), this, SLOT( canRedoChanged( bool ) ) );
+ canUndoChanged( project->undoStack()->canUndo() );
+ canRedoChanged( project->undoStack()->canRedo() );
+
+ const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() );
+ connect( project->library(), SIGNAL( clipRemoved( const QUuid& ) ), clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) );
+}
+
#ifdef WITH_CRASHBUTTON
void
MainWindow::setupCrashTester()
diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h
index 4b510fc..be2a70b 100644
--- a/src/Gui/MainWindow.h
+++ b/src/Gui/MainWindow.h
@@ -36,6 +36,7 @@ class EffectsListView;
class ImportController;
class MediaLibrary;
class PreviewWidget;
+class Project;
class ProjectWizard;
class SettingsDialog;
class Timeline;
@@ -128,7 +129,7 @@ private:
PreviewWidget* m_clipPreview;
PreviewWidget* m_projectPreview;
WorkflowFileRenderer* m_fileRenderer;
- WorkflowRenderer *m_renderer;
+ WorkflowRenderer* m_renderer;
SettingsDialog* m_globalPreferences;
SettingsDialog* m_DefaultProjectPreferences;
SettingsDialog* m_projectPreferences;
@@ -159,6 +160,7 @@ private slots:
void cleanStateChanged( bool isClean );
void canUndoChanged( bool canUndo );
void canRedoChanged( bool canRedo );
+ void onProjectLoaded( Project* project );
signals:
void toolChanged( ToolButtons );
More information about the Vlmc-devel
mailing list