Commit 956e357d authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: AspectRatio Box, code style

parent 2c5bdf7a
...@@ -268,25 +268,32 @@ void LoopButton::updateButtonIcons( int value ) ...@@ -268,25 +268,32 @@ void LoopButton::updateButtonIcons( int value )
: QIcon( ":/buttons/playlist/repeat_all" ) ); : QIcon( ":/buttons/playlist/repeat_all" ) );
} }
void AspectRatioComboBox::updateRatios() { void AspectRatioComboBox::updateRatios()
{
/* Clear the list before updating */ /* Clear the list before updating */
this->clear(); clear();
vlc_value_t val_list, text_list; vlc_value_t val_list, text_list;
vout_thread_t* p_vout = THEMIM->getVout(); vout_thread_t* p_vout = THEMIM->getVout();
/* Disable if there is no vout */ /* Disable if there is no vout */
if( p_vout == NULL ) { if( p_vout == NULL )
{
addItem( qtr("Aspect Ratio") ); addItem( qtr("Aspect Ratio") );
setDisabled( true ); setDisabled( true );
return; return;
} }
var_Change( p_vout, "aspect-ratio", VLC_VAR_GETLIST, &val_list, &text_list ); 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++ ) 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 ); setEnabled( true );
var_FreeList( &val_list, &text_list ); var_FreeList( &val_list, &text_list );
} }
void AspectRatioComboBox::updateAspectRatio( int x ) { void AspectRatioComboBox::updateAspectRatio( int x )
{
vout_thread_t* p_vout = THEMIM->getVout(); 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: ...@@ -73,21 +73,21 @@ private slots:
class AspectRatioComboBox : public QComboBox class AspectRatioComboBox : public QComboBox
{ {
Q_OBJECT Q_OBJECT
public: public:
AspectRatioComboBox( intf_thread_t* _p_intf ) { AspectRatioComboBox( intf_thread_t* _p_intf ) : p_intf( _p_intf )
p_intf = _p_intf; {
CONNECT( THEMIM->getIM(), voutChanged( bool ), CONNECT( THEMIM->getIM(), voutChanged( bool ),
this, updateRatios() ); this, updateRatios() );
CONNECT( this, currentIndexChanged( int ), CONNECT( this, currentIndexChanged( int ),
this, updateAspectRatio( int ) ); this, updateAspectRatio( int ) );
this->updateRatios(); updateRatios();
} }
public slots: public slots:
void updateRatios(); void updateRatios();
void updateAspectRatio( int ); void updateAspectRatio( int );
private: private:
intf_thread_t* p_intf; 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