Commit fd6840e2 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: AspectRatio Box, code style

(cherry picked from commit 956e357d)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 1f78fbd6
......@@ -268,25 +268,32 @@ void LoopButton::updateButtonIcons( int value )
: QIcon( ":/buttons/playlist/repeat_all" ) );
}
void AspectRatioComboBox::updateRatios() {
void AspectRatioComboBox::updateRatios()
{
/* Clear the list before updating */
this->clear();
clear();
vlc_value_t val_list, text_list;
vout_thread_t* p_vout = THEMIM->getVout();
/* Disable if there is no vout */
if( p_vout == NULL ) {
if( p_vout == NULL )
{
addItem( qtr("Aspect Ratio") );
setDisabled( true );
return;
}
var_Change( p_vout, "aspect-ratio", VLC_VAR_GETLIST, &val_list, &text_list );
for( int i = 0; i < val_list.p_list->i_count; i++ )
addItem( qfu( text_list.p_list->p_values[i].psz_string ), QString( val_list.p_list->p_values[i].psz_string ) );
addItem( qfu( text_list.p_list->p_values[i].psz_string ),
QString( val_list.p_list->p_values[i].psz_string ) );
setEnabled( true );
var_FreeList( &val_list, &text_list );
}
void AspectRatioComboBox::updateAspectRatio( int x ) {
void AspectRatioComboBox::updateAspectRatio( int x )
{
vout_thread_t* p_vout = THEMIM->getVout();
if( p_vout && x >= 0 ) var_SetString( p_vout, "aspect-ratio", qtu( itemData(x).toString() ) );
if( p_vout && x >= 0 )
var_SetString( p_vout, "aspect-ratio", qtu( itemData(x).toString() ) );
}
......@@ -73,21 +73,21 @@ private slots:
class AspectRatioComboBox : public QComboBox
{
Q_OBJECT
public:
AspectRatioComboBox( intf_thread_t* _p_intf ) {
p_intf = _p_intf;
public:
AspectRatioComboBox( intf_thread_t* _p_intf ) : p_intf( _p_intf )
{
CONNECT( THEMIM->getIM(), voutChanged( bool ),
this, updateRatios() );
CONNECT( this, currentIndexChanged( int ),
this, updateAspectRatio( int ) );
this->updateRatios();
updateRatios();
}
public slots:
public slots:
void updateRatios();
void updateAspectRatio( int );
private:
private:
intf_thread_t* p_intf;
};
......
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