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 )
: 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()
......
......@@ -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 );
......
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