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

Make WorkflowRenderer a project class.

It is now being constructed when a project is created.
parent 8ea45a58
......@@ -390,9 +390,7 @@ MainWindow::createStatusBar()
void
MainWindow::initializeDockWidgets()
{
m_renderer = new WorkflowRenderer( m_backend );
m_renderer->initializeRenderer();
m_timeline = new Timeline( m_renderer, this );
m_timeline = new Timeline( this );
m_timeline->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_timeline->show();
setCentralWidget( m_timeline );
......@@ -466,7 +464,6 @@ MainWindow::setupProjectPreview()
QDockWidget::AllDockWidgetFeatures );
m_projectPreview = new PreviewWidget( dockedWidget );
m_projectPreview->setRenderer( m_renderer );
m_projectPreview->setClipEdition( false );
KeyboardShortcutHelper* renderShortcut = new KeyboardShortcutHelper( "keyboard/renderpreview", this );
connect( renderShortcut, SIGNAL( activated() ), m_projectPreview, SLOT( on_pushButtonPlay_clicked() ) );
......@@ -582,13 +579,12 @@ MainWindow::renderVideo( const QString& outputFileName, quint32 width, quint32 h
{
if ( m_fileRenderer )
delete m_fileRenderer;
m_fileRenderer = new WorkflowFileRenderer( m_backend );
m_fileRenderer = new WorkflowFileRenderer( m_backend, Project::getInstance()->workflow() );
WorkflowFileRendererDialog *dialog = new WorkflowFileRendererDialog( m_fileRenderer, width, height );
dialog->setModal( true );
dialog->setOutputFileName( outputFileName );
m_fileRenderer->initializeRenderer();
m_fileRenderer->run( outputFileName, width, height, fps, vbitrate, abitrate );
if ( dialog->exec() == QDialog::Rejected )
......@@ -604,6 +600,8 @@ MainWindow::renderVideo( const QString& outputFileName, quint32 width, quint32 h
bool
MainWindow::renderVideoSettings( bool shareOnInternet )
{
Project::getInstance()->workflowRenderer()->stop();
RendererSettings *settings = new RendererSettings( shareOnInternet );
if ( settings->exec() == QDialog::Rejected )
......@@ -629,7 +627,6 @@ MainWindow::on_actionRender_triggered()
{
if ( checkVideoLength() )
{
m_renderer->stop();
//Setup dialog box for querying render parameters.
renderVideoSettings( false );
}
......@@ -640,8 +637,6 @@ MainWindow::on_actionShare_On_Internet_triggered()
{
if ( checkVideoLength() )
{
m_renderer->stop();
if( !renderVideoSettings( true ) )
return;
......@@ -849,6 +844,9 @@ MainWindow::onProjectLoaded(Project* project)
const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() );
connect( project->library(), SIGNAL( clipRemoved( const QUuid& ) ), clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) );
m_timeline->setRenderer( project->workflowRenderer() );
m_projectPreview->setRenderer( project->workflowRenderer() );
}
#ifdef WITH_CRASHBUTTON
......
......@@ -129,7 +129,6 @@ private:
PreviewWidget* m_clipPreview;
PreviewWidget* m_projectPreview;
WorkflowFileRenderer* m_fileRenderer;
WorkflowRenderer* m_renderer;
SettingsDialog* m_globalPreferences;
SettingsDialog* m_DefaultProjectPreferences;
SettingsDialog* m_projectPreferences;
......
......@@ -38,8 +38,9 @@
Timeline* Timeline::m_instance = NULL;
Timeline::Timeline( WorkflowRenderer* renderer, QWidget *parent ) :
QWidget( parent ), m_scale( 1.0 ), m_renderer( renderer )
Timeline::Timeline( QWidget *parent )
: QWidget( parent )
, m_scale( 1.0 )
{
Q_ASSERT( m_instance == NULL );
m_instance = this;
......@@ -228,3 +229,9 @@ Timeline::load( const QDomElement &root )
elem = elem.nextSiblingElement();
}
}
void
Timeline::setRenderer( WorkflowRenderer* renderer )
{
m_renderer = renderer;
}
......@@ -46,7 +46,7 @@ class Timeline : public QWidget
Q_OBJECT
Q_DISABLE_COPY( Timeline )
public:
explicit Timeline( WorkflowRenderer* renderer, QWidget *parent = 0 );
explicit Timeline( QWidget *parent = 0 );
virtual ~Timeline();
/// Return a pointer to the TracksView instance.
TracksView* tracksView() { return m_tracksView; }
......@@ -62,6 +62,7 @@ public:
void save( QXmlStreamWriter& project ) const;
void load( const QDomElement &root );
void setRenderer( WorkflowRenderer* renderer );
public slots:
/**
......
......@@ -27,6 +27,7 @@
#include <QUndoStack>
#include "AutomaticBackup.h"
#include "Backend/IBackend.h"
#include "Library/Library.h"
#include "Project.h"
#include "ProjectCallbacks.h"
......@@ -56,7 +57,7 @@ Project::Project()
m_workflow = new MainWorkflow();
m_workspace = new Workspace( m_settings );
m_library = new Library( m_workspace );
m_workflowRenderer = new WorkflowRenderer( Backend::getBackend(), m_workflow );
connectComponents();
}
......@@ -82,6 +83,12 @@ Project::workflow()
return m_workflow;
}
WorkflowRenderer*
Project::workflowRenderer()
{
return m_workflowRenderer;
}
QUndoStack*
Project::undoStack()
{
......
......@@ -42,6 +42,7 @@ class MainWorkflow;
class ProjectManager;
class Settings;
class Workspace;
class WorkflowRenderer;
class Project : public QObject, public Singleton<Project>
{
......@@ -141,9 +142,10 @@ class Project : public QObject, public Singleton<Project>
// Dependent components part below:
public:
Library* library();
MainWorkflow* workflow();
QUndoStack* undoStack();
Settings* settings();
MainWorkflow* workflow();
WorkflowRenderer* workflowRenderer();
Workspace* workspace();
private:
......@@ -152,6 +154,7 @@ class Project : public QObject, public Singleton<Project>
QUndoStack* m_undoStack;
Settings* m_settings;
Workspace* m_workspace;
WorkflowRenderer* m_workflowRenderer;
friend class Singleton<Project>;
};
......
......@@ -28,9 +28,9 @@
#include <QTime>
WorkflowFileRenderer::WorkflowFileRenderer( Backend::IBackend* backend )
: WorkflowRenderer( backend )
, m_renderVideoFrame( NULL )
WorkflowFileRenderer::WorkflowFileRenderer( Backend::IBackend* backend, MainWorkflow* workflow )
: WorkflowRenderer( backend, workflow )
, m_renderVideoFrame( NULL )
{
}
......
......@@ -35,7 +35,7 @@ class WorkflowFileRenderer : public WorkflowRenderer
Q_OBJECT
public:
WorkflowFileRenderer( Backend::IBackend* backend );
WorkflowFileRenderer( Backend::IBackend* backend , MainWorkflow* workflow );
virtual ~WorkflowFileRenderer();
void run(const QString& outputFileName, quint32 width,
......
......@@ -45,8 +45,8 @@
#include "Tools/VlmcDebug.h"
#include "Workflow/Types.h"
WorkflowRenderer::WorkflowRenderer( Backend::IBackend* backend ) :
m_mainWorkflow( Project::getInstance()->workflow() ),
WorkflowRenderer::WorkflowRenderer( Backend::IBackend* backend, MainWorkflow* mainWorkflow ) :
m_mainWorkflow( mainWorkflow ),
m_stopping( false ),
m_outputFps( 0.0f ),
m_aspectRatio( "" ),
......@@ -56,11 +56,6 @@ WorkflowRenderer::WorkflowRenderer( Backend::IBackend* backend ) :
m_effectFrame( NULL )
{
m_source = backend->createMemorySource();
}
void
WorkflowRenderer::initializeRenderer()
{
m_esHandler = new EsHandler;
m_esHandler->self = this;
......
......@@ -58,15 +58,9 @@ class WorkflowRenderer : public GenericRenderer
double fps; ///< The fps to use for this rendering session.
};
WorkflowRenderer( Backend::IBackend *backend );
WorkflowRenderer( Backend::IBackend *backend, MainWorkflow* workflow );
~WorkflowRenderer();
/**
* \brief Initialize the renderer.
*
* This will set the imem string, instantiate EsHandlers, connect signals.
*/
void initializeRenderer();
/**
* \brief Play or pause the media.
*
......
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