[vlc-commits] Qt: compressor: simplify by grouping
Francois Cartegnie
git at videolan.org
Wed Dec 26 16:34:59 CET 2012
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec 26 16:26:01 2012 +0100| [b5d005cef4842f258c196f3be79e8d758c3d063d] | committer: Francois Cartegnie
Qt: compressor: simplify by grouping
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b5d005cef4842f258c196f3be79e8d758c3d063d
---
modules/gui/qt4/components/extended_panels.cpp | 40 +++++++++---------------
modules/gui/qt4/components/extended_panels.hpp | 3 +-
2 files changed, 15 insertions(+), 28 deletions(-)
diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp
index ca13a08..6e9d55c 100644
--- a/modules/gui/qt4/components/extended_panels.cpp
+++ b/modules/gui/qt4/components/extended_panels.cpp
@@ -1258,11 +1258,12 @@ Compressor::Compressor( intf_thread_t *_p_intf, QWidget *_parent )
QFont smallFont = QApplication::font();
smallFont.setPointSize( smallFont.pointSize() - 2 );
- QGridLayout *layout = new QGridLayout( this );
-
- enableCheck = new QCheckBox( qtr( "Enable dynamic range compressor" ) );
- layout->addWidget( enableCheck, 0, 0, 1, NUM_CP_CTRL );
+ QVBoxLayout *layout = new QVBoxLayout( this );
+ compressorBox = new QGroupBox( qtr( "Enable dynamic range compressor" ) );
+ compressorBox->setCheckable( true );
+ layout->addWidget( compressorBox );
+ QGridLayout *ctrlLayout = new QGridLayout( compressorBox );
for( int i = 0 ; i < NUM_CP_CTRL ; i++ )
{
const int i_min = (int)( comp_controls[i].f_min
@@ -1287,16 +1288,14 @@ Compressor::Compressor( intf_thread_t *_p_intf, QWidget *_parent )
ctrl_readout[i]->setFont( smallFont );
ctrl_readout[i]->setAlignment( Qt::AlignHCenter );
- layout->addWidget( compCtrl[i], 1, i, Qt::AlignHCenter );
- layout->addWidget( ctrl_readout[i], 2, i, Qt::AlignHCenter );
- layout->addWidget( ctrl_texts[i], 3, i, Qt::AlignHCenter );
+ ctrlLayout->addWidget( compCtrl[i], 0, i, Qt::AlignHCenter );
+ ctrlLayout->addWidget( ctrl_readout[i], 1, i, Qt::AlignHCenter );
+ ctrlLayout->addWidget( ctrl_texts[i], 2, i, Qt::AlignHCenter );
}
for( int i = 0; i < NUM_CP_CTRL; i++ )
CONNECT( compCtrl[i], valueChanged( int ), this, setValues() );
- BUTTONACT( enableCheck, enable() );
-
/* Write down initial values */
vlc_object_t *p_aout = (vlc_object_t *)THEMIM->getAout();
char *psz_af;
@@ -1320,31 +1319,20 @@ Compressor::Compressor( intf_thread_t *_p_intf, QWidget *_parent )
comp_controls[i].psz_name );
}
}
+
if( psz_af && strstr( psz_af, "compressor" ) != NULL )
- {
- enableCheck->setChecked( true );
- }
+ compressorBox->setChecked( true );
+ else
+ compressorBox->setChecked( false );
+
free( psz_af );
- enable( enableCheck->isChecked() );
updateSliders( controlVars );
setValues();
}
void Compressor::enable()
{
- bool en = enableCheck->isChecked();
- playlist_EnableAudioFilter( THEPL, "compressor", en );
- enable( en );
-}
-
-void Compressor::enable( bool en )
-{
- for( int i = 0 ; i < NUM_CP_CTRL ; i++ )
- {
- compCtrl[i]->setEnabled( en );
- ctrl_texts[i]->setEnabled( en );
- ctrl_readout[i]->setEnabled( en );
- }
+ playlist_EnableAudioFilter( THEPL, "compressor", compressorBox->isChecked() );
}
void Compressor::updateSliders( float * p_controlVars )
diff --git a/modules/gui/qt4/components/extended_panels.hpp b/modules/gui/qt4/components/extended_panels.hpp
index 6679ee6..2dc25df 100644
--- a/modules/gui/qt4/components/extended_panels.hpp
+++ b/modules/gui/qt4/components/extended_panels.hpp
@@ -127,7 +127,7 @@ private:
float controlVars[NUM_CP_CTRL];
float oldControlVars[NUM_CP_CTRL];
- QCheckBox *enableCheck;
+ QGroupBox *compressorBox;
intf_thread_t *p_intf;
@@ -137,7 +137,6 @@ private:
void updateSliders(float *);
private slots:
- void enable(bool);
void enable();
void setValues();
};
More information about the vlc-commits
mailing list