WorkflowFileRendererDialog.cpp 2.56 KB
Newer Older
1 2 3
/*****************************************************************************
 * WorkflowFileRendererDialog.cpp: Display a render feedback.
 *****************************************************************************
Ludovic Fauvet's avatar
Ludovic Fauvet committed
4
 * Copyright (C) 2008-2010 VideoLAN
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *
 * Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
 *          Christophe Courtaut <christophe.courtaut@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

Ludovic Fauvet's avatar
Ludovic Fauvet committed
24
#include "vlmc.h"
25 26
#include "WorkflowFileRendererDialog.h"

27 28 29
WorkflowFileRendererDialog::WorkflowFileRendererDialog( quint32 width, quint32 height ) :
        m_width( width ),
        m_height( height )
30 31
{
    m_ui.setupUi( this );
32 33 34
    m_workflow = MainWorkflow::getInstance();
    connect( m_workflow, SIGNAL( frameChanged( qint64, MainWorkflow::FrameChangedReason ) ),
             this, SLOT( frameChanged( qint64, MainWorkflow::FrameChangedReason ) ) );
35 36 37 38 39
}

void    WorkflowFileRendererDialog::setOutputFileName( const QString& outputFileName )
{
    m_ui.nameLabel->setText( outputFileName );
40
    m_ui.previewLabel->setMinimumSize( m_width, m_height );
41 42 43 44 45 46 47
    setWindowTitle( "Rendering to " + outputFileName );
}

void    WorkflowFileRendererDialog::setProgressBarValue( int val )
{
    m_ui.progressBar->setValue( val );
}
48 49 50

void    WorkflowFileRendererDialog::updatePreview( const uchar* buff )
{
51
    m_ui.previewLabel->setPixmap(
52
            QPixmap::fromImage( QImage( buff, m_width, m_height,
53
                                        QImage::Format_RGB888 ).rgbSwapped() ) );
54
}
55 56 57 58 59 60 61

void    WorkflowFileRendererDialog::frameChanged( qint64 frame, MainWorkflow::FrameChangedReason reason )
{
    if ( reason == MainWorkflow::Renderer )
        m_ui.frameCounter->setText( tr("Rendering frame %1 / %2").arg(QString::number( frame ),
                                                                QString::number(m_workflow->getLengthFrame() ) ) );
}