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

MainWindow: Connect to projectLoaded event

parent 7c57a78c
...@@ -75,6 +75,7 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent ) ...@@ -75,6 +75,7 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
: QMainWindow( parent ) : QMainWindow( parent )
, m_backend( backend ) , m_backend( backend )
, m_fileRenderer( NULL ) , m_fileRenderer( NULL )
, m_projectPreferences( NULL )
, m_wizard( NULL ) , m_wizard( NULL )
{ {
m_ui.setupUi( this ); m_ui.setupUi( this );
...@@ -88,7 +89,6 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent ) ...@@ -88,7 +89,6 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
// GUI // GUI
DockWidgetManager::getInstance( this )->setMainWindow( this ); DockWidgetManager::getInstance( this )->setMainWindow( this );
createGlobalPreferences(); createGlobalPreferences();
createProjectPreferences();
initializeDockWidgets(); initializeDockWidgets();
initToolbar(); initToolbar();
createStatusBar(); createStatusBar();
...@@ -108,17 +108,6 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent ) ...@@ -108,17 +108,6 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
connect( this, SIGNAL( toolChanged( ToolButtons ) ), connect( this, SIGNAL( toolChanged( ToolButtons ) ),
m_timeline, SLOT( setTool( 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: //Connecting Library stuff:
const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() ); const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() );
Q_ASSERT( clipRenderer != NULL ); Q_ASSERT( clipRenderer != NULL );
...@@ -126,8 +115,7 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent ) ...@@ -126,8 +115,7 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
clipRenderer, SLOT( setClip( Clip* ) ) ); clipRenderer, SLOT( setClip( Clip* ) ) );
connect( m_mediaLibrary, SIGNAL( importRequired() ), connect( m_mediaLibrary, SIGNAL( importRequired() ),
this, SLOT( on_actionImport_triggered() ) ); this, SLOT( on_actionImport_triggered() ) );
connect( Project::getInstance()->library(), SIGNAL( clipRemoved( const QUuid& ) ),
clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) );
#ifdef WITH_CRASHHANDLER #ifdef WITH_CRASHHANDLER
if ( restoreSession() == true ) if ( restoreSession() == true )
...@@ -530,6 +518,7 @@ MainWindow::loadGlobalProxySettings() ...@@ -530,6 +518,7 @@ MainWindow::loadGlobalProxySettings()
void void
MainWindow::createProjectPreferences() MainWindow::createProjectPreferences()
{ {
delete m_projectPreferences;
m_projectPreferences = new SettingsDialog( Project::getInstance()->settings(), tr( "Project preferences" ), this ); 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( "general", QT_TRANSLATE_NOOP( "Settings", "General" ), QIcon( ":/images/vlmc" ) );
m_projectPreferences->addCategory( "video", QT_TRANSLATE_NOOP( "Settings", "Video" ), QIcon( ":/images/video" ) ); m_projectPreferences->addCategory( "video", QT_TRANSLATE_NOOP( "Settings", "Video" ), QIcon( ":/images/video" ) );
...@@ -846,6 +835,22 @@ MainWindow::canRedoChanged( bool canRedo ) ...@@ -846,6 +835,22 @@ MainWindow::canRedoChanged( bool canRedo )
m_ui.actionRedo->setEnabled( 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 #ifdef WITH_CRASHBUTTON
void void
MainWindow::setupCrashTester() MainWindow::setupCrashTester()
......
...@@ -36,6 +36,7 @@ class EffectsListView; ...@@ -36,6 +36,7 @@ class EffectsListView;
class ImportController; class ImportController;
class MediaLibrary; class MediaLibrary;
class PreviewWidget; class PreviewWidget;
class Project;
class ProjectWizard; class ProjectWizard;
class SettingsDialog; class SettingsDialog;
class Timeline; class Timeline;
...@@ -128,7 +129,7 @@ private: ...@@ -128,7 +129,7 @@ private:
PreviewWidget* m_clipPreview; PreviewWidget* m_clipPreview;
PreviewWidget* m_projectPreview; PreviewWidget* m_projectPreview;
WorkflowFileRenderer* m_fileRenderer; WorkflowFileRenderer* m_fileRenderer;
WorkflowRenderer *m_renderer; WorkflowRenderer* m_renderer;
SettingsDialog* m_globalPreferences; SettingsDialog* m_globalPreferences;
SettingsDialog* m_DefaultProjectPreferences; SettingsDialog* m_DefaultProjectPreferences;
SettingsDialog* m_projectPreferences; SettingsDialog* m_projectPreferences;
...@@ -159,6 +160,7 @@ private slots: ...@@ -159,6 +160,7 @@ private slots:
void cleanStateChanged( bool isClean ); void cleanStateChanged( bool isClean );
void canUndoChanged( bool canUndo ); void canUndoChanged( bool canUndo );
void canRedoChanged( bool canRedo ); void canRedoChanged( bool canRedo );
void onProjectLoaded( Project* project );
signals: signals:
void toolChanged( ToolButtons ); void toolChanged( ToolButtons );
......
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