Commit 8a5992d9 authored by Rohit Yadav's avatar Rohit Yadav Committed by Hugo Beauzée-Luyssen

Add video presets to RendererSettings.

Adds popular presets like VGA, SVGA, XVGA, 420p, 720p etc. Also, refactored to be used during video export to web, viz. YouTube etc. This way, user has freedom to config video export with custom settings for services like: YouTube, Vimeo etc.
Signed-off-by: 's avatarHugo Beauzée-Luyssen <beauze.h@gmail.com>
parent 44726e79
......@@ -33,12 +33,17 @@
#include <QDirModel>
#include <QFileInfo>
RendererSettings::RendererSettings()
RendererSettings::RendererSettings( bool exportType )
{
m_ui.setupUi( this );
setWindowFlags( windowFlags() | Qt::Sheet ); // Qt::Sheet is for UI on Mac
connect( m_ui.outputFileNameButton, SIGNAL(clicked() ),
this, SLOT(selectOutputFileName() ) );
m_ui.setupUi( this );
if( exportType )
{
m_ui.outputFileName->setEnabled( false );
m_ui.outputFileNameButton->setEnabled( false );
m_ui.outputFileName->setText("Export to Web");
}
m_ui.width->setValue( VLMC_PROJECT_GET_INT( "video/VideoProjectWidth" ) );
m_ui.height->setValue( VLMC_PROJECT_GET_INT( "video/VideoProjectHeight" ) );
m_ui.fps->setValue( VLMC_PROJECT_GET_DOUBLE( "video/VLMCOutputFPS" ) );
......@@ -46,6 +51,11 @@ RendererSettings::RendererSettings()
QCompleter* completer = new QCompleter( this );
completer->setModel( new QDirModel( completer ) );
m_ui.outputFileName->setCompleter( completer );
connect( m_ui.outputFileNameButton, SIGNAL( clicked() ),
this, SLOT(selectOutputFileName() ) );
connect( m_ui.videoPresetBox, SIGNAL( activated( int ) ),
this, SLOT( updateVideoPreset( int ) ) );
}
void
......@@ -57,6 +67,39 @@ RendererSettings::selectOutputFileName()
m_ui.outputFileName->setText( outputFileName );
}
void
RendererSettings::setPreset( quint32 width, quint32 height, quint32 fps )
{
m_ui.width->setValue( width );
m_ui.height->setValue( height );
m_ui.fps->setValue( fps );
}
void
RendererSettings::updateVideoPreset( int index )
{
m_ui.width->setEnabled( false );
m_ui.height->setEnabled( false );
m_ui.fps->setEnabled( false );
switch( index )
{
case QVGA: setPreset( 320, 240, 30); break;
case VGA: setPreset( 640, 480, 30); break;
case SVGA: setPreset( 800, 600, 30); break;
case XVGA: setPreset( 1024, 768, 30); break;
case P480: setPreset( 720, 480, 30); break;
case P576: setPreset( 720, 576, 25); break;
case P720: setPreset( 1280, 720, 30); break;
case P1080: setPreset( 1920, 1080, 30); break;
case Custom:
default:
m_ui.width->setEnabled( true );
m_ui.height->setEnabled( true );
m_ui.fps->setEnabled( true );
}
}
void
RendererSettings::accept()
{
......
......@@ -30,8 +30,22 @@ class RendererSettings : public QDialog
{
Q_OBJECT
enum VideoPresets
{
Custom = 0,
QVGA,
VGA,
SVGA,
XVGA,
P480,
P576,
P720,
P1080
};
public:
RendererSettings();
RendererSettings( bool exportType = false );
quint32 width() const;
quint32 height() const;
double fps() const;
......@@ -41,10 +55,12 @@ class RendererSettings : public QDialog
private slots:
void selectOutputFileName();
void updateVideoPreset( int index );
virtual void accept();
private:
Ui::RendererSettings m_ui;
void setPreset( quint32 width, quint32 height, quint32 fps );
};
#endif // RENDERERSETTINGS_H
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<height>358</height>
</rect>
</property>
<property name="windowTitle">
......@@ -24,7 +24,11 @@
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="outputFileName"/>
<widget class="QLineEdit" name="outputFileName">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="outputFileNameButton">
......@@ -35,15 +39,21 @@
</item>
</layout>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QSpinBox" name="width">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimum">
<number>320</number>
</property>
......@@ -52,55 +62,67 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QSpinBox" name="height">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimum">
<number>200</number>
<number>240</number>
</property>
<property name="maximum">
<number>1080</number>
</property>
<property name="value">
<number>240</number>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>FPS</string>
<string>Frame Rate</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="fps">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="value">
<double>29.969999999999999</double>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Video quality</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Audio quality</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QSlider" name="audioQuality">
<property name="minimum">
<number>8</number>
......@@ -116,14 +138,14 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Video codec</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QComboBox" name="videoCodec">
<property name="enabled">
<bool>false</bool>
......@@ -135,14 +157,14 @@
</item>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Audio codec</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QComboBox" name="audioCodec">
<property name="enabled">
<bool>false</bool>
......@@ -154,7 +176,7 @@
</item>
</widget>
</item>
<item row="9" column="0" colspan="2">
<item row="10" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -164,7 +186,7 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -177,7 +199,7 @@
</property>
</spacer>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QSlider" name="videoQuality">
<property name="minimum">
<number>8</number>
......@@ -196,6 +218,62 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="videoPresetBox">
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
<item>
<property name="text">
<string>QVGA (320x240) - 30 fps</string>
</property>
</item>
<item>
<property name="text">
<string>VGA (640x480) - 30 fps</string>
</property>
</item>
<item>
<property name="text">
<string>SVGA (800x600) - 30 fps</string>
</property>
</item>
<item>
<property name="text">
<string>XVGA (1024x768) - 30 fps</string>
</property>
</item>
<item>
<property name="text">
<string>480p NTSC (720x480) - 30 fps</string>
</property>
</item>
<item>
<property name="text">
<string>576p PAL (720x576) - 25 fps</string>
</property>
</item>
<item>
<property name="text">
<string>720p (1280x720) - 30 fps</string>
</property>
</item>
<item>
<property name="text">
<string>1080p (1920x1080) - 30 fps</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Preset</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
......
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