vlc | branch: master | Jean-Baptiste Kempf <[email protected]> | Tue Feb 21 23:59:40 2012 +0100| [956e357d52599478042bee88394d723b32a0d42d] | committer: Jean-Baptiste Kempf
Qt: AspectRatio Box, code style > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=956e357d52599478042bee88394d723b32a0d42d --- modules/gui/qt4/components/controller_widget.cpp | 19 +++++++++++++------ modules/gui/qt4/components/controller_widget.hpp | 12 ++++++------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/modules/gui/qt4/components/controller_widget.cpp b/modules/gui/qt4/components/controller_widget.cpp index cd4dd68..4e945af 100644 --- a/modules/gui/qt4/components/controller_widget.cpp +++ b/modules/gui/qt4/components/controller_widget.cpp @@ -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() ) ); } diff --git a/modules/gui/qt4/components/controller_widget.hpp b/modules/gui/qt4/components/controller_widget.hpp index 04663f5..fa13ee0 100644 --- a/modules/gui/qt4/components/controller_widget.hpp +++ b/modules/gui/qt4/components/controller_widget.hpp @@ -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; }; _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
