Commit a15751bb authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: profiles_selector: change/simplify widgets reset/selection behavior

parent 43084cb6
......@@ -75,7 +75,6 @@ VLCProfileSelector::VLCProfileSelector( QWidget *_parent ): QWidget( _parent )
CONNECT( profileBox, activated( int ),
this, updateOptions( int ) );
updateOptions( 0 );
}
......@@ -385,15 +384,6 @@ VLCProfileEditor::VLCProfileEditor( const QString& qs_name, const QString& value
}
loadCapabilities();
registerCodecs();
CONNECT( ui.valueholder_video_enable, toggled( bool ),
this, setVTranscodeOptions( bool ) );
CONNECT( ui.valueholder_audio_enable, toggled( bool ),
this, setATranscodeOptions( bool ) );
CONNECT( ui.valueholder_subtitles_enable, toggled( bool ),
this, setSTranscodeOptions( bool ) );
setVTranscodeOptions( false );
setATranscodeOptions( false );
setSTranscodeOptions( false );
QPushButton *saveButton = new QPushButton(
( qs_name.isEmpty() ) ? qtr( "Create" ) : qtr( "Save" ) );
......@@ -403,6 +393,12 @@ VLCProfileEditor::VLCProfileEditor( const QString& qs_name, const QString& value
ui.buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
BUTTONACT( cancelButton, reject() );
CONNECT( ui.valueholder_video_copy, stateChanged( int ),
this, activatePanels() );
CONNECT( ui.valueholder_audio_copy, stateChanged( int ),
this, activatePanels() );
reset();
fillProfile( value );
muxSelected();
}
......@@ -570,6 +566,11 @@ void VLCProfileEditor::fillProfile( const QString& qs )
QCheckBox *box = qobject_cast<QCheckBox *>( object );
box->setChecked( ! value.isEmpty() );
}
else if( object->inherits( "QGroupBox" ) )
{
QGroupBox *box = qobject_cast<QGroupBox *>( object );
box->setChecked( ! value.isEmpty() );
}
else if( object->inherits( "QSpinBox" ) )
{
QSpinBox *box = qobject_cast<QSpinBox *>( object );
......@@ -636,42 +637,6 @@ void VLCProfileEditor::fillProfileOldFormat( const QString& qs )
ui.valueholder_subtitles_overlay->setChecked( options[15].toInt() );
}
void VLCProfileEditor::setVTranscodeOptions( bool b_trans )
{
ui.vCodecLabel->setEnabled( b_trans );
ui.valueholder_video_codec->setEnabled( b_trans );
ui.vBitrateLabel->setEnabled( b_trans );
ui.valueholder_vcodec_bitrate->setEnabled( b_trans );
ui.vScaleLabel->setEnabled( b_trans );
ui.valueholder_vcodec_scale->setEnabled( b_trans );
ui.valueholder_vcodec_height->setEnabled( b_trans );
ui.heightLabel->setEnabled( b_trans );
ui.valueholder_vcodec_width->setEnabled( b_trans );
ui.widthLabel->setEnabled( b_trans );
ui.valueholder_vcodec_framerate->setEnabled( b_trans );
ui.vFrameLabel->setEnabled( b_trans );
ui.valueholder_video_copy->setEnabled( b_trans );
}
void VLCProfileEditor::setATranscodeOptions( bool b_trans )
{
ui.aCodecLabel->setEnabled( b_trans );
ui.valueholder_audio_codec->setEnabled( b_trans );
ui.aBitrateLabel->setEnabled( b_trans );
ui.valueholder_acodec_bitrate->setEnabled( b_trans );
ui.aChannelsLabel->setEnabled( b_trans );
ui.valueholder_acodec_channels->setEnabled( b_trans );
ui.aSampleLabel->setEnabled( b_trans );
ui.valueholder_acodec_samplerate->setEnabled( b_trans );
ui.valueholder_audio_copy->setEnabled( b_trans );
}
void VLCProfileEditor::setSTranscodeOptions( bool b_trans )
{
ui.valueholder_subtitles_codec->setEnabled( b_trans );
ui.valueholder_subtitles_overlay->setEnabled( b_trans );
}
void VLCProfileEditor::close()
{
if( ui.profileLine->text().isEmpty() )
......@@ -717,6 +682,11 @@ QString VLCProfileEditor::transcodeValue()
const QCheckBox *box = qobject_cast<const QCheckBox *>( object );
value = box->isChecked() ? "yes" : "";
}
else if( object->inherits( "QGroupBox" ) )
{
const QGroupBox *box = qobject_cast<const QGroupBox *>( object );
value = box->isChecked() ? "yes" : "";
}
else if( object->inherits( "QSpinBox" ) )
{
const QSpinBox *box = qobject_cast<const QSpinBox *>( object );
......@@ -741,6 +711,24 @@ QString VLCProfileEditor::transcodeValue()
return configuration.join( ";" );
}
void VLCProfileEditor::reset()
{
/* reset to default state as we can only check/enable existing values */
ui.valueholder_video_copy->setChecked( false );
ui.valueholder_audio_copy->setChecked( false );
activatePanels();
/* end with top level ones for cascaded setEnabled() */
ui.valueholder_video_enable->setChecked( false );
ui.valueholder_audio_enable->setChecked( false );
ui.valueholder_subtitles_enable->setChecked( false );
}
void VLCProfileEditor::activatePanels()
{
ui.transcodevideo->setEnabled( ! ui.valueholder_video_copy->isChecked() );
ui.transcodeaudio->setEnabled( ! ui.valueholder_audio_copy->isChecked() );
}
#undef CATPROP2NAME
#undef CATANDPROP
#undef OLDFORMAT
......@@ -78,13 +78,12 @@ private:
typedef QSet<QString> resultset;
QHash<QString, resultset> caps;
void loadCapabilities();
void reset();
protected slots:
virtual void close();
private slots:
void setVTranscodeOptions( bool );
void setATranscodeOptions( bool );
void setSTranscodeOptions( bool );
void muxSelected();
void activatePanels();
};
#endif
......@@ -13,27 +13,8 @@
<property name="windowTitle">
<string>Profile edition</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Profile Name</string>
</property>
<property name="margin">
<number>10</number>
</property>
<property name="buddy">
<cstring>profileLine</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="profileLine"/>
</item>
<item row="2" column="1">
<widget class="QDialogButtonBox" name="buttonBox"/>
</item>
<item row="1" column="0" colspan="2">
<layout class="QFormLayout" name="formLayout_4">
<item row="3" column="0" colspan="2">
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
......@@ -294,18 +275,39 @@
<attribute name="title">
<string>Video codec</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="valueholder_video_enable">
<property name="text">
<item>
<widget class="QGroupBox" name="valueholder_video_enable">
<property name="title">
<string>Video</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="valueholder_video_copy">
<property name="text">
<string>Keep original video track</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item>
<widget class="QWidget" name="transcodevideo" native="true">
<layout class="QFormLayout" name="formLayout_2">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="vCodecLabel">
<property name="enabled">
<bool>true</bool>
......@@ -318,14 +320,14 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<item row="0" column="1">
<widget class="QComboBox" name="valueholder_video_codec">
<property name="editable">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="1" column="0">
<widget class="QLabel" name="vBitrateLabel">
<property name="text">
<string>Bitrate</string>
......@@ -335,7 +337,17 @@
</property>
</widget>
</item>
<item row="3" column="2">
<item row="2" column="0">
<widget class="QLabel" name="vFrameLabel">
<property name="text">
<string>Frame Rate</string>
</property>
<property name="buddy">
<cstring>valueholder_vcodec_framerate</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="valueholder_vcodec_bitrate">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
......@@ -357,17 +369,7 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="vFrameLabel">
<property name="text">
<string>Frame Rate</string>
</property>
<property name="buddy">
<cstring>valueholder_vcodec_framerate</cstring>
</property>
</widget>
</item>
<item row="4" column="2">
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="valueholder_vcodec_framerate">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
......@@ -383,13 +385,16 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Resolution</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="4">
<property name="flat">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
......@@ -415,50 +420,29 @@
</property>
</widget>
</item>
<item row="1" column="3" colspan="2">
<item row="1" column="1">
<widget class="QComboBox" name="valueholder_vcodec_scale">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="widthLabel">
<property name="text">
<string>Width</string>
</property>
<property name="buddy">
<cstring>valueholder_vcodec_width</cstring>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="3">
<widget class="QLabel" name="heightLabel">
<property name="text">
<string>Height</string>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>valueholder_vcodec_height</cstring>
<cstring>valueholder_vcodec_width</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<item>
<widget class="QSpinBox" name="valueholder_vcodec_width">
<property name="specialValueText">
<string>Auto</string>
......@@ -474,7 +458,20 @@
</property>
</widget>
</item>
<item row="2" column="4">
<item>
<widget class="QLabel" name="heightLabel">
<property name="text">
<string>Height</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>valueholder_vcodec_height</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="valueholder_vcodec_height">
<property name="specialValueText">
<string>Auto</string>
......@@ -491,37 +488,56 @@
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="valueholder_video_copy">
<item row="2" column="0">
<widget class="QLabel" name="Framesize">
<property name="text">
<string>Keep original video track</string>
<string>Frame size</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="audioCodec">
<attribute name="title">
<string>Audio codec</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="valueholder_audio_enable">
<property name="text">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="valueholder_audio_enable">
<property name="title">
<string>Audio</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<property name="flat">
<bool>true</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="valueholder_audio_copy">
<property name="text">
<string>Keep original audio track</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item>
<widget class="QWidget" name="transcodeaudio" native="true">
<layout class="QFormLayout" name="_2">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="aCodecLabel">
<property name="text">
<string>Codec</string>
......@@ -531,10 +547,10 @@
</property>
</widget>
</item>
<item row="2" column="2" colspan="2">
<item row="0" column="1">
<widget class="QComboBox" name="valueholder_audio_codec"/>
</item>
<item row="3" column="0">
<item row="1" column="0">
<widget class="QLabel" name="aBitrateLabel">
<property name="text">
<string>Bitrate</string>
......@@ -544,7 +560,17 @@
</property>
</widget>
</item>
<item row="3" column="3">
<item row="2" column="0">
<widget class="QLabel" name="aChannelsLabel">
<property name="text">
<string>Channels</string>
</property>
<property name="buddy">
<cstring>valueholder_acodec_channels</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="valueholder_acodec_bitrate">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
......@@ -563,17 +589,7 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="aChannelsLabel">
<property name="text">
<string>Channels</string>
</property>
<property name="buddy">
<cstring>valueholder_acodec_channels</cstring>
</property>
</widget>
</item>
<item row="4" column="3">
<item row="2" column="1">
<widget class="QSpinBox" name="valueholder_acodec_channels">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
......@@ -589,7 +605,7 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="3" column="0">
<widget class="QLabel" name="aSampleLabel">
<property name="text">
<string>Sample Rate</string>
......@@ -599,10 +615,16 @@
</property>
</widget>
</item>
<item row="5" column="3">
<item row="3" column="1">
<widget class="QComboBox" name="valueholder_acodec_samplerate"/>
</item>
<item row="6" column="2">
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -621,18 +643,33 @@
<attribute name="title">
<string>Subtitles</string>
</attribute>
<layout class="QGridLayout" name="_4">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QGroupBox" name="valueholder_subtitles_enable">
<property name="title">
<string>Subtitles</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout_5">
<item row="0" column="0">
<widget class="QCheckBox" name="valueholder_subtitles_enable">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Subtitles</string>
<string>Codec</string>
</property>
<property name="buddy">
<cstring>valueholder_subtitles_codec</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="valueholder_subtitles_codec"/>
</item>
<item row="1" column="1">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="valueholder_subtitles_overlay">
<property name="text">
<string>Overlay subtitles on the video</string>
......@@ -641,8 +678,43 @@
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="4" column="1">
<widget class="QDialogButtonBox" name="buttonBox"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="profileLine"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Profile Name</string>
</property>
<property name="buddy">
<cstring>profileLine</cstring>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
......@@ -655,6 +727,19 @@
<tabstops>
<tabstop>profileLine</tabstop>
<tabstop>tabWidget</tabstop>
<tabstop>TSMux</tabstop>
<tabstop>WEBMux</tabstop>
<tabstop>OggMux</tabstop>
<tabstop>MOVMux</tabstop>
<tabstop>PSMux</tabstop>
<tabstop>MJPEGMux</tabstop>
<tabstop>WAVMux</tabstop>
<tabstop>FLVMux</tabstop>
<tabstop>MPEG1Mux</tabstop>
<tabstop>MKVMux</tabstop>
<tabstop>RAWMux</tabstop>
<tabstop>AVIMux</tabstop>
<tabstop>ASFMux</tabstop>
<tabstop>valueholder_video_enable</tabstop>
<tabstop>valueholder_video_copy</tabstop>
<tabstop>valueholder_video_codec</tabstop>
......
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