Commit 2e02fbfc authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: ConfigControl: rework layout insertion.

Moving layout insertion outside of the constructors.
We no longer need constructor for creating a QWidget,
and we did not need at all to create a widget as a sublayout
is sufficient.
Removes many constructors and conditional code. gross -100 lines.

Also fixes an IntegerRangeConfigControl declaration which definition
was on IntegerRangeSliderConfigControl.
parent 67b43ed8
...@@ -723,12 +723,14 @@ void CaptureOpenPanel::initialize() ...@@ -723,12 +723,14 @@ void CaptureOpenPanel::initialize()
module_config_t *p_config = module_config_t *p_config =
config_FindConfig( VLC_OBJECT(p_intf), "dshow-vdev" ); config_FindConfig( VLC_OBJECT(p_intf), "dshow-vdev" );
vdevDshowW = new StringListConfigControl( vdevDshowW = new StringListConfigControl(
VLC_OBJECT(p_intf), p_config, this, dshowDevLayout, line ); VLC_OBJECT(p_intf), p_config, this );
vdevDshowW->insertIntoExistingGrid( dshowDevLayout, line );
line++; line++;
p_config = config_FindConfig( VLC_OBJECT(p_intf), "dshow-adev" ); p_config = config_FindConfig( VLC_OBJECT(p_intf), "dshow-adev" );
adevDshowW = new StringListConfigControl( adevDshowW = new StringListConfigControl(
VLC_OBJECT(p_intf), p_config, this, dshowDevLayout, line ); VLC_OBJECT(p_intf), p_config, this );
adevDshowW->insertIntoExistingGrid( dshowDevLayout, line );
line++; line++;
/* dshow Properties */ /* dshow Properties */
......
...@@ -82,83 +82,85 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this, ...@@ -82,83 +82,85 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
switch( p_item->i_type ) switch( p_item->i_type )
{ {
case CONFIG_ITEM_MODULE: case CONFIG_ITEM_MODULE:
p_control = new ModuleConfigControl( p_this, p_item, parent, false, p_control = new ModuleConfigControl( p_this, p_item, parent, false );
l, line );
break; break;
case CONFIG_ITEM_MODULE_CAT: case CONFIG_ITEM_MODULE_CAT:
p_control = new ModuleConfigControl( p_this, p_item, parent, true, p_control = new ModuleConfigControl( p_this, p_item, parent, true );
l, line );
break; break;
case CONFIG_ITEM_MODULE_LIST: case CONFIG_ITEM_MODULE_LIST:
p_control = new ModuleListConfigControl( p_this, p_item, parent, false, p_control = new ModuleListConfigControl( p_this, p_item, parent, false );
l, line );
break; break;
case CONFIG_ITEM_MODULE_LIST_CAT: case CONFIG_ITEM_MODULE_LIST_CAT:
p_control = new ModuleListConfigControl( p_this, p_item, parent, true, p_control = new ModuleListConfigControl( p_this, p_item, parent, true );
l, line );
break; break;
case CONFIG_ITEM_STRING: case CONFIG_ITEM_STRING:
if( !p_item->i_list ) if( !p_item->i_list )
p_control = new StringConfigControl( p_this, p_item, parent, p_control = new StringConfigControl( p_this, p_item, parent, false );
l, line, false );
else else
p_control = new StringListConfigControl( p_this, p_item, p_control = new StringListConfigControl( p_this, p_item, parent );
parent, l, line );
break; break;
case CONFIG_ITEM_PASSWORD: case CONFIG_ITEM_PASSWORD:
if( !p_item->i_list ) if( !p_item->i_list )
p_control = new StringConfigControl( p_this, p_item, parent, p_control = new StringConfigControl( p_this, p_item, parent, true );
l, line, true );
else else
p_control = new StringListConfigControl( p_this, p_item, p_control = new StringListConfigControl( p_this, p_item, parent );
parent, l, line );
break; break;
case CONFIG_ITEM_RGB: case CONFIG_ITEM_RGB:
p_control = new ColorConfigControl( p_this, p_item, parent, l, line ); p_control = new ColorConfigControl( p_this, p_item, parent );
break; break;
case CONFIG_ITEM_INTEGER: case CONFIG_ITEM_INTEGER:
if( p_item->i_list ) if( p_item->i_list )
p_control = new IntegerListConfigControl( p_this, p_item, p_control = new IntegerListConfigControl( p_this, p_item, parent, false );
parent, false, l, line );
else if( p_item->min.i || p_item->max.i ) else if( p_item->min.i || p_item->max.i )
p_control = new IntegerRangeConfigControl( p_this, p_item, parent, p_control = new IntegerRangeConfigControl( p_this, p_item, parent );
l, line );
else else
p_control = new IntegerConfigControl( p_this, p_item, parent, p_control = new IntegerConfigControl( p_this, p_item, parent );
l, line );
break; break;
case CONFIG_ITEM_LOADFILE: case CONFIG_ITEM_LOADFILE:
case CONFIG_ITEM_SAVEFILE: case CONFIG_ITEM_SAVEFILE:
p_control = new FileConfigControl( p_this, p_item, parent, l, line); p_control = new FileConfigControl( p_this, p_item, parent );
break; break;
case CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM_DIRECTORY:
p_control = new DirectoryConfigControl( p_this, p_item, parent, l, p_control = new DirectoryConfigControl( p_this, p_item, parent );
line );
break; break;
case CONFIG_ITEM_FONT: case CONFIG_ITEM_FONT:
p_control = new FontConfigControl( p_this, p_item, parent, l, p_control = new FontConfigControl( p_this, p_item, parent );
line);
break; break;
case CONFIG_ITEM_KEY: case CONFIG_ITEM_KEY:
p_control = new KeySelectorControl( p_this, p_item, parent, l, line ); p_control = new KeySelectorControl( p_this, p_item, parent );
break; break;
case CONFIG_ITEM_BOOL: case CONFIG_ITEM_BOOL:
p_control = new BoolConfigControl( p_this, p_item, parent, l, line ); p_control = new BoolConfigControl( p_this, p_item, parent );
break; break;
case CONFIG_ITEM_FLOAT: case CONFIG_ITEM_FLOAT:
if( p_item->min.f || p_item->max.f ) if( p_item->min.f || p_item->max.f )
p_control = new FloatRangeConfigControl( p_this, p_item, parent, p_control = new FloatRangeConfigControl( p_this, p_item, parent );
l, line );
else else
p_control = new FloatConfigControl( p_this, p_item, parent, p_control = new FloatConfigControl( p_this, p_item, parent );
l, line );
break; break;
default: default:
break; break;
} }
if ( p_control ) p_control->insertIntoExistingGrid( l, line );
return p_control; return p_control;
} }
/* Inserts controls into layouts
This is sub-optimal in the OO way, as controls's code still
depends on Layout classes. We should use layout inserters [friend]
classes, but it's unlikely we had to deal with a different layout.*/
void ConfigControl::insertInto( QBoxLayout *layout )
{
QGridLayout *sublayout = new QGridLayout();
fillGrid( sublayout, 0 );
layout->addLayout( sublayout );
}
void ConfigControl::insertIntoExistingGrid( QGridLayout *l, int line )
{
fillGrid( l, line );
}
/******************************************************* /*******************************************************
* Simple widgets * Simple widgets
*******************************************************/ *******************************************************/
...@@ -209,29 +211,21 @@ VStringConfigControl::doApply() ...@@ -209,29 +211,21 @@ VStringConfigControl::doApply()
/*********** String **************/ /*********** String **************/
StringConfigControl::StringConfigControl( vlc_object_t *_p_this, StringConfigControl::StringConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, module_config_t *_p_item,
QWidget *_parent, QGridLayout *l, QWidget *_parent,
int line, bool pwd ) : bool pwd ) :
VStringConfigControl( _p_this, _p_item, _parent ) VStringConfigControl( _p_this, _p_item )
{ {
label = new QLabel( qtr(p_item->psz_text) ); label = new QLabel( qtr(p_item->psz_text), _parent );
text = new QLineEdit( qfu(p_item->value.psz) ); text = new QLineEdit( qfu(p_item->value.psz), _parent );
if( pwd ) text->setEchoMode( QLineEdit::Password ); if( pwd ) text->setEchoMode( QLineEdit::Password );
finish(); finish();
}
if( !l ) void StringConfigControl::fillGrid( QGridLayout *l, int line )
{ {
widget = new QWidget( _parent ); l->addWidget( label, line, 0 );
QHBoxLayout *layout = new QHBoxLayout(); l->setColumnMinimumWidth( 1, 10 );
layout->addWidget( label, 0 ); layout->insertSpacing( 1, 10 ); l->addWidget( text, line, LAST_COLUMN, Qt::AlignRight );
layout->addWidget( text, LAST_COLUMN );
widget->setLayout( layout );
}
else
{
l->addWidget( label, line, 0 );
l->setColumnMinimumWidth( 1, 10 );
l->addWidget( text, line, LAST_COLUMN );
}
} }
StringConfigControl::StringConfigControl( vlc_object_t *_p_this, StringConfigControl::StringConfigControl( vlc_object_t *_p_this,
...@@ -263,40 +257,28 @@ void StringConfigControl::finish() ...@@ -263,40 +257,28 @@ void StringConfigControl::finish()
/*********** File **************/ /*********** File **************/
FileConfigControl::FileConfigControl( vlc_object_t *_p_this, FileConfigControl::FileConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, module_config_t *_p_item, QWidget *p ) :
QWidget *_parent, QGridLayout *l, VStringConfigControl( _p_this, _p_item )
int line ) :
VStringConfigControl( _p_this, _p_item, _parent )
{ {
label = new QLabel( qtr(p_item->psz_text) ); label = new QLabel( qtr(p_item->psz_text), p );
text = new QLineEdit( qfu(p_item->value.psz) ); text = new QLineEdit( qfu(p_item->value.psz), p );
browse = new QPushButton( qtr( "Browse..." ) ); browse = new QPushButton( qtr( "Browse..." ), p );
QHBoxLayout *textAndButton = new QHBoxLayout();
textAndButton->setMargin( 0 );
textAndButton->addWidget( text, 2 );
textAndButton->addWidget( browse, 0 );
BUTTONACT( browse, updateField() ); BUTTONACT( browse, updateField() );
finish(); finish();
if( !l )
{
widget = new QWidget( _parent );
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget( label, 0 );
layout->insertSpacing( 1, 10 );
layout->addLayout( textAndButton, LAST_COLUMN );
widget->setLayout( layout );
}
else
{
l->addWidget( label, line, 0 );
l->setColumnMinimumWidth( 1, 10 );
l->addLayout( textAndButton, line, LAST_COLUMN );
}
} }
void FileConfigControl::fillGrid( QGridLayout *l, int line )
{
l->addWidget( label, line, 0 );
l->setColumnMinimumWidth( 1, 10 );
QHBoxLayout *textAndButton = new QHBoxLayout();
textAndButton->setMargin( 0 );
textAndButton->addWidget( text, 2 );
textAndButton->addWidget( browse, 0 );
l->addLayout( textAndButton, line, LAST_COLUMN, 0 );
}
FileConfigControl::FileConfigControl( vlc_object_t *_p_this, FileConfigControl::FileConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, module_config_t *_p_item,
...@@ -344,9 +326,8 @@ void FileConfigControl::finish() ...@@ -344,9 +326,8 @@ void FileConfigControl::finish()
/********* String / Directory **********/ /********* String / Directory **********/
DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this, DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_p_widget, module_config_t *_p_item, QWidget *p ) :
QGridLayout *_p_layout, int _int ) : FileConfigControl( _p_this, _p_item, p )
FileConfigControl( _p_this, _p_item, _p_widget, _p_layout, _int )
{} {}
DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this, DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
...@@ -369,26 +350,12 @@ void DirectoryConfigControl::updateField() ...@@ -369,26 +350,12 @@ void DirectoryConfigControl::updateField()
/********* String / Font **********/ /********* String / Font **********/
FontConfigControl::FontConfigControl( vlc_object_t *_p_this, FontConfigControl::FontConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_parent, module_config_t *_p_item, QWidget *p ) :
QGridLayout *_p_layout, int line) : VStringConfigControl( _p_this, _p_item )
VStringConfigControl( _p_this, _p_item, _parent )
{ {
label = new QLabel( qtr(p_item->psz_text) ); label = new QLabel( qtr(p_item->psz_text), p );
font = new QFontComboBox( _parent ); font = new QFontComboBox( p );
font->setCurrentFont( QFont( qfu( p_item->value.psz) ) ); font->setCurrentFont( QFont( qfu( p_item->value.psz) ) );
if( !_p_layout )
{
widget = new QWidget( _parent );
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget( label, 0 );
layout->addWidget( font, 1 );
widget->setLayout( layout );
}
else
{
_p_layout->addWidget( label, line, 0 );
_p_layout->addWidget( font, line, 1, 1, -1 );
}
if( p_item->psz_longtext ) if( p_item->psz_longtext )
{ {
...@@ -396,6 +363,12 @@ FontConfigControl::FontConfigControl( vlc_object_t *_p_this, ...@@ -396,6 +363,12 @@ FontConfigControl::FontConfigControl( vlc_object_t *_p_this,
} }
} }
void FontConfigControl::fillGrid( QGridLayout *l, int line )
{
l->addWidget( label, line, 0 );
l->addWidget( font, line, 1, 1, -1 );
}
FontConfigControl::FontConfigControl( vlc_object_t *_p_this, FontConfigControl::FontConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QLabel *_p_label, module_config_t *_p_item, QLabel *_p_label,
QFontComboBox *_p_font): QFontComboBox *_p_font):
...@@ -413,30 +386,17 @@ FontConfigControl::FontConfigControl( vlc_object_t *_p_this, ...@@ -413,30 +386,17 @@ FontConfigControl::FontConfigControl( vlc_object_t *_p_this,
/********* String / choice list **********/ /********* String / choice list **********/
StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this, StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_parent, module_config_t *_p_item, QWidget *p ) :
QGridLayout *l, int line) : VStringConfigControl( _p_this, _p_item )
VStringConfigControl( _p_this, _p_item, _parent )
{ {
label = new QLabel( qtr(p_item->psz_text) ); label = new QLabel( qtr(p_item->psz_text), p );
combo = new QComboBox(); combo = new QComboBox( p );
combo->setMinimumWidth( MINWIDTH_BOX ); combo->setMinimumWidth( MINWIDTH_BOX );
combo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); combo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name ); module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
finish( p_module_config ); finish( p_module_config );
if( !l )
{
widget = new QWidget( _parent );
l = new QGridLayout();
l->addWidget( label, 0, 0 ); l->addWidget( combo, 0, LAST_COLUMN );
widget->setLayout( l );
}
else
{
l->addWidget( label, line, 0 );
l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
}
if( p_item->i_action ) if( p_item->i_action )
{ {
...@@ -446,17 +406,26 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this, ...@@ -446,17 +406,26 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
for( int i = 0; i < p_item->i_action; i++ ) for( int i = 0; i < p_item->i_action; i++ )
{ {
QPushButton *button = QPushButton *button =
new QPushButton( qtr( p_item->ppsz_action_text[i] )); new QPushButton( qtr( p_item->ppsz_action_text[i] ), p );
buttons << button;
CONNECT( button, clicked(), signalMapper, map() ); CONNECT( button, clicked(), signalMapper, map() );
signalMapper->setMapping( button, i ); signalMapper->setMapping( button, i );
l->addWidget( button, line, LAST_COLUMN - p_item->i_action + i,
Qt::AlignRight );
} }
CONNECT( signalMapper, mapped( int ), CONNECT( signalMapper, mapped( int ),
this, actionRequested( int ) ); this, actionRequested( int ) );
} }
} }
void StringListConfigControl::fillGrid( QGridLayout *l, int line )
{
l->addWidget( label, line, 0 );
l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
int i = 0;
foreach( QPushButton *button, buttons )
l->addWidget( button, line, LAST_COLUMN - p_item->i_action + i++,
Qt::AlignRight );
}
void StringListConfigControl::comboIndexChanged( int i_index ) void StringListConfigControl::comboIndexChanged( int i_index )
{ {
Q_UNUSED( i_index ); Q_UNUSED( i_index );
...@@ -484,6 +453,7 @@ void StringListConfigControl::actionRequested( int i_action ) ...@@ -484,6 +453,7 @@ void StringListConfigControl::actionRequested( int i_action )
p_module_config->b_dirty = false; p_module_config->b_dirty = false;
} }
} }
StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this, StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QLabel *_label, QComboBox *_combo, module_config_t *_p_item, QLabel *_label, QComboBox *_combo,
bool ) : VStringConfigControl( _p_this, _p_item ) bool ) : VStringConfigControl( _p_this, _p_item )
...@@ -599,26 +569,19 @@ void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf, ...@@ -599,26 +569,19 @@ void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf,
/********* Module **********/ /********* Module **********/
ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this, ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_parent, bool bycat, module_config_t *_p_item, QWidget *p, bool bycat ) :
QGridLayout *l, int line) : VStringConfigControl( _p_this, _p_item )
VStringConfigControl( _p_this, _p_item, _parent )
{ {
label = new QLabel( qtr(p_item->psz_text) ); label = new QLabel( qtr(p_item->psz_text), p );
combo = new QComboBox(); combo = new QComboBox( p );
combo->setMinimumWidth( MINWIDTH_BOX ); combo->setMinimumWidth( MINWIDTH_BOX );
finish( bycat ); finish( bycat );
if( !l ) }
{
widget = new QWidget( _parent ); void ModuleConfigControl::fillGrid( QGridLayout *l, int line )
QHBoxLayout *layout = new QHBoxLayout(); {
layout->addWidget( label ); layout->addWidget( combo, LAST_COLUMN ); l->addWidget( label, line, 0 );
widget->setLayout( layout ); l->addWidget( combo, line, LAST_COLUMN, 0 );
}
else
{
l->addWidget( label, line, 0 );
l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
}
} }
ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this, ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
...@@ -692,17 +655,16 @@ QString ModuleConfigControl::getValue() const ...@@ -692,17 +655,16 @@ QString ModuleConfigControl::getValue() const
/********* Module list **********/ /********* Module list **********/
ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this, ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_parent, bool bycat, module_config_t *_p_item, QWidget *p, bool bycat ) :
QGridLayout *l, int line) : VStringConfigControl( _p_this, _p_item )
VStringConfigControl( _p_this, _p_item, _parent )
{ {
groupBox = NULL; groupBox = NULL;
/* Special Hack */ /* Special Hack */
if( !p_item->psz_text ) return; if( !p_item->psz_text ) return;
groupBox = new QGroupBox ( qtr(p_item->psz_text), _parent ); groupBox = new QGroupBox ( qtr(p_item->psz_text), p );
text = new QLineEdit; text = new QLineEdit( p );
QGridLayout *layoutGroupBox = new QGridLayout( groupBox ); QGridLayout *layoutGroupBox = new QGridLayout( groupBox );
finish( bycat ); finish( bycat );
...@@ -716,22 +678,15 @@ ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this, ...@@ -716,22 +678,15 @@ ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this,
layoutGroupBox->addWidget( text, boxline, 0, 1, 2 ); layoutGroupBox->addWidget( text, boxline, 0, 1, 2 );
if( !l )
{
widget = new QWidget( _parent );
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget( groupBox, line, 0 );
widget->setLayout( layout );
}
else
{
l->addWidget( groupBox, line, 0, 1, -1 );
}
if( p_item->psz_longtext ) if( p_item->psz_longtext )
text->setToolTip( formatTooltip( qtr( p_item->psz_longtext) ) ); text->setToolTip( formatTooltip( qtr( p_item->psz_longtext) ) );
} }
void ModuleListConfigControl::fillGrid( QGridLayout *l, int line )
{
l->addWidget( groupBox, line, 0, 1, -1 );
}
ModuleListConfigControl::~ModuleListConfigControl() ModuleListConfigControl::~ModuleListConfigControl()
{ {
qDeleteAll( modules ); qDeleteAll( modules );
...@@ -834,7 +789,6 @@ void ModuleListConfigControl::changeVisibility( bool b ) ...@@ -834,7 +789,6 @@ void ModuleListConfigControl::changeVisibility( bool b )
foreach ( checkBoxListItem *it, modules ) foreach ( checkBoxListItem *it, modules )
it->checkBox->setVisible( b ); it->checkBox->setVisible( b );
groupBox->setVisible( b ); groupBox->setVisible( b );
ConfigControl::changeVisibility( b );
} }
void ModuleListConfigControl::onUpdate() void ModuleListConfigControl::onUpdate()
...@@ -871,30 +825,16 @@ VIntConfigControl::doApply() ...@@ -871,30 +825,16 @@ VIntConfigControl::doApply()
/*********** Integer **************/ /*********** Integer **************/
IntegerConfigControl::IntegerConfigControl( vlc_object_t *_p_this, IntegerConfigControl::IntegerConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, module_config_t *_p_item, QWidget *p ) :
QWidget *_parent, QGridLayout *l, VIntConfigControl( _p_this, _p_item )
int line ) :
VIntConfigControl( _p_this, _p_item, _parent )
{ {
label = new QLabel( qtr(p_item->psz_text) ); label = new QLabel( qtr(p_item->psz_text), p );
spin = new QSpinBox; spin->setMinimumWidth( MINWIDTH_BOX ); spin = new QSpinBox( p ); spin->setMinimumWidth( MINWIDTH_BOX );
spin->setAlignment( Qt::AlignRight ); spin->setAlignment( Qt::AlignRight );
spin->setMaximumWidth( MINWIDTH_BOX ); spin->setMaximumWidth( MINWIDTH_BOX );
finish(); finish();
if( !l )
{
widget = new QWidget( _parent );
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget( label, 0 ); layout->addWidget( spin, LAST_COLUMN );
widget->setLayout( layout );
}
else
{
l->addWidget( label, line, 0 );
l->addWidget( spin, line, LAST_COLUMN, Qt::AlignRight );
}
} }
IntegerConfigControl::IntegerConfigControl( vlc_object_t *_p_this, IntegerConfigControl::IntegerConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, module_config_t *_p_item,
QLabel *_label, QSpinBox *_spin ) : QLabel *_label, QSpinBox *_spin ) :
...@@ -905,6 +845,12 @@ IntegerConfigControl::IntegerConfigControl( vlc_object_t *_p_this, ...@@ -905,6 +845,12 @@ IntegerConfigControl::IntegerConfigControl( vlc_object_t *_p_this,
finish(); finish();
} }
void IntegerConfigControl::fillGrid( QGridLayout *l, int line )
{
l->addWidget( label, line, 0 );
l->addWidget( spin, line, LAST_COLUMN, Qt::AlignRight );
}
void IntegerConfigControl::finish() void IntegerConfigControl::finish()
{ {
spin->setMaximum( 2000000000 ); spin->setMaximum( 2000000000 );
...@@ -931,10 +877,8 @@ int VIntConfigControl::getType() const { return CONFIG_ITEM_INTEGER; } ...@@ -931,10 +877,8 @@ int VIntConfigControl::getType() const { return CONFIG_ITEM_INTEGER; }
/********* Integer range **********/ /********* Integer range **********/
IntegerRangeConfigControl::IntegerRangeConfigControl( vlc_object_t *_p_this, IntegerRangeConfigControl::IntegerRangeConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, module_config_t *_p_item, QWidget *p ) :
QWidget *_parent, QGridLayout *l, IntegerConfigControl( _p_this, _p_item, p )
int line ) :
IntegerConfigControl( _p_this, _p_item, _parent, l, line )
{ {
finish(); finish();
} }
...@@ -983,29 +927,16 @@ int IntegerRangeSliderConfigControl::getValue() const ...@@ -983,29 +927,16 @@ int IntegerRangeSliderConfigControl::getValue() const
/********* Integer / choice list **********/ /********* Integer / choice list **********/
IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this, IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_parent, bool, module_config_t *_p_item, QWidget *p, bool ) :
QGridLayout *l, int line) : VIntConfigControl( _p_this, _p_item )
VIntConfigControl( _p_this, _p_item, _parent )
{ {
label = new QLabel( qtr(p_item->psz_text) ); label = new QLabel( qtr(p_item->psz_text), p );
combo = new QComboBox(); combo = new QComboBox( p );
combo->setMinimumWidth( MINWIDTH_BOX ); combo->setMinimumWidth( MINWIDTH_BOX );
module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name ); module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
finish( p_module_config ); finish( p_module_config );
if( !l )
{
widget = new QWidget( _parent );
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget( label ); layout->addWidget( combo, LAST_COLUMN );
widget->setLayout( layout );
}
else
{
l->addWidget( label, line, 0 );
l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
}
if( p_item->i_action ) if( p_item->i_action )
{ {
...@@ -1015,17 +946,27 @@ IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this, ...@@ -1015,17 +946,27 @@ IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
for( int i = 0; i < p_item->i_action; i++ ) for( int i = 0; i < p_item->i_action; i++ )
{ {
QPushButton *button = QPushButton *button =
new QPushButton( qfu( p_item->ppsz_action_text[i] )); new QPushButton( qfu( p_item->ppsz_action_text[i] ), p );
buttons << button;
CONNECT( button, clicked(), signalMapper, map() ); CONNECT( button, clicked(), signalMapper, map() );
signalMapper->setMapping( button, i ); signalMapper->setMapping( button, i );
l->addWidget( button, line, LAST_COLUMN - p_item->i_action + i,
Qt::AlignRight );
} }
CONNECT( signalMapper, mapped( int ), CONNECT( signalMapper, mapped( int ),
this, actionRequested( int ) ); this, actionRequested( int ) );
} }
} }
void IntegerListConfigControl::fillGrid( QGridLayout *l, int line )
{
l->addWidget( label, line, 0 );
l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
int i = 0;
foreach( QPushButton *button, buttons )
l->addWidget( button, line, LAST_COLUMN - p_item->i_action + i++,
Qt::AlignRight );
}
IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this, IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QLabel *_label, QComboBox *_combo, module_config_t *_p_item, QLabel *_label, QComboBox *_combo,
bool ) : VIntConfigControl( _p_this, _p_item ) bool ) : VIntConfigControl( _p_this, _p_item )
...@@ -1104,25 +1045,16 @@ int IntegerListConfigControl::getValue() const ...@@ -1104,25 +1045,16 @@ int IntegerListConfigControl::getValue() const
/*********** Boolean **************/ /*********** Boolean **************/
BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this, BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, module_config_t *_p_item, QWidget *p ) :
QWidget *_parent, QGridLayout *l, VIntConfigControl( _p_this, _p_item )
int line ) :
VIntConfigControl( _p_this, _p_item, _parent )
{ {
checkbox = new QCheckBox( qtr(p_item->psz_text) ); checkbox = new QCheckBox( qtr(p_item->psz_text), p );
finish(); finish();
}
if( !l ) void BoolConfigControl::fillGrid( QGridLayout *l, int line )
{ {
widget = new QWidget( _parent ); l->addWidget( checkbox, line, 0, 1, -1, 0 );
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget( checkbox, 0 );
widget->setLayout( layout );
}
else
{
l->addWidget( checkbox, line, 0 );
}
} }
BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this, BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this,
...@@ -1152,27 +1084,18 @@ int BoolConfigControl::getValue() const ...@@ -1152,27 +1084,18 @@ int BoolConfigControl::getValue() const
/************* Color *************/ /************* Color *************/
ColorConfigControl::ColorConfigControl( vlc_object_t *_p_this, ColorConfigControl::ColorConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, module_config_t *_p_item, QWidget *p ) :
QWidget *_parent, QGridLayout *l, VIntConfigControl( _p_this, _p_item )
int line ) :
VIntConfigControl( _p_this, _p_item, _parent )
{ {
label = new QLabel; label = new QLabel( p );
color_but = new QToolButton; color_but = new QToolButton( p );
finish(); finish();
}
if( !l ) void ColorConfigControl::fillGrid( QGridLayout *l, int line )
{ {
widget = new QWidget( _parent ); l->addWidget( label, line, 0 );
QHBoxLayout *layout = new QHBoxLayout(); l->addWidget( color_but, line, LAST_COLUMN, Qt::AlignRight );
layout->addWidget( label, 0 ); layout->addWidget( color_but, LAST_COLUMN );
widget->setLayout( layout );
}
else
{
l->addWidget( label, line, 0 );
l->addWidget( color_but, line, LAST_COLUMN, Qt::AlignRight );
}
} }
ColorConfigControl::ColorConfigControl( vlc_object_t *_p_this, ColorConfigControl::ColorConfigControl( vlc_object_t *_p_this,
...@@ -1234,30 +1157,21 @@ VFloatConfigControl::doApply() ...@@ -1234,30 +1157,21 @@ VFloatConfigControl::doApply()
/*********** Float **************/ /*********** Float **************/
FloatConfigControl::FloatConfigControl( vlc_object_t *_p_this, FloatConfigControl::FloatConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, module_config_t *_p_item, QWidget *p ) :
QWidget *_parent, QGridLayout *l, VFloatConfigControl( _p_this, _p_item )
int line ) :
VFloatConfigControl( _p_this, _p_item, _parent )
{ {
label = new QLabel( qtr(p_item->psz_text) ); label = new QLabel( qtr(p_item->psz_text), p );
spin = new QDoubleSpinBox; spin = new QDoubleSpinBox( p );
spin->setMinimumWidth( MINWIDTH_BOX ); spin->setMinimumWidth( MINWIDTH_BOX );
spin->setMaximumWidth( MINWIDTH_BOX ); spin->setMaximumWidth( MINWIDTH_BOX );
spin->setAlignment( Qt::AlignRight ); spin->setAlignment( Qt::AlignRight );
finish(); finish();
}
if( !l ) void FloatConfigControl::fillGrid( QGridLayout *l, int line )
{ {
widget = new QWidget( _parent ); l->addWidget( label, line, 0 );
QHBoxLayout *layout = new QHBoxLayout(); l->addWidget( spin, line, LAST_COLUMN, Qt::AlignRight );
layout->addWidget( label, 0 ); layout->addWidget( spin, LAST_COLUMN );
widget->setLayout( layout );
}
else
{
l->addWidget( label, line, 0 );
l->addWidget( spin, line, LAST_COLUMN, Qt::AlignRight );
}
} }
int VFloatConfigControl::getType() const { return CONFIG_ITEM_FLOAT; } int VFloatConfigControl::getType() const { return CONFIG_ITEM_FLOAT; }
...@@ -1297,10 +1211,8 @@ float FloatConfigControl::getValue() const ...@@ -1297,10 +1211,8 @@ float FloatConfigControl::getValue() const
/*********** Float with range **************/ /*********** Float with range **************/
FloatRangeConfigControl::FloatRangeConfigControl( vlc_object_t *_p_this, FloatRangeConfigControl::FloatRangeConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, module_config_t *_p_item, QWidget *p ) :
QWidget *_parent, QGridLayout *l, FloatConfigControl( _p_this, _p_item, p )
int line ) :
FloatConfigControl( _p_this, _p_item, _parent, l, line )
{ {
finish(); finish();
} }
...@@ -1325,23 +1237,18 @@ void FloatRangeConfigControl::finish() ...@@ -1325,23 +1237,18 @@ void FloatRangeConfigControl::finish()
* Key selector widget * Key selector widget
**********************************************************************/ **********************************************************************/
KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this, KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
module_config_t *_p_item, module_config_t *_p_item, QWidget *p ) :
QWidget *_parent, QGridLayout *l, ConfigControl( _p_this, _p_item )
int line ) :
ConfigControl( _p_this, _p_item, _parent )
{ {
QWidget *keyContainer = new QWidget;
QGridLayout *gLayout = new QGridLayout( keyContainer );
label = new QLabel( label = new QLabel(
qtr( "Select or double click an action to change the associated " qtr( "Select or double click an action to change the associated "
"hotkey. Use delete key to remove hotkeys") ); "hotkey. Use delete key to remove hotkeys"), p );
QLabel *searchLabel = new QLabel( qtr( "Search" ) ); searchLabel = new QLabel( qtr( "Search" ), p );
SearchLineEdit *actionSearch = new SearchLineEdit( keyContainer ); actionSearch = new SearchLineEdit();
table = new QTreeWidget; table = new QTreeWidget( p );
table->setColumnCount(3); table->setColumnCount(3);
table->headerItem()->setText( 0, qtr( "Action" ) ); table->headerItem()->setText( 0, qtr( "Action" ) );
table->headerItem()->setText( 1, qtr( "Hotkey" ) ); table->headerItem()->setText( 1, qtr( "Hotkey" ) );
...@@ -1355,15 +1262,18 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this, ...@@ -1355,15 +1262,18 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
finish(); finish();
CONNECT( actionSearch, textChanged( const QString& ),
this, filter( const QString& ) );
}
void KeySelectorControl::fillGrid( QGridLayout *l, int line )
{
QGridLayout *gLayout = new QGridLayout();
gLayout->addWidget( label, 0, 0, 1, 4 ); gLayout->addWidget( label, 0, 0, 1, 4 );
gLayout->addWidget( searchLabel, 1, 0, 1, 2 ); gLayout->addWidget( searchLabel, 1, 0, 1, 2 );
gLayout->addWidget( actionSearch, 1, 2, 1, 2 ); gLayout->addWidget( actionSearch, 1, 2, 1, 2 );
gLayout->addWidget( table, 2, 0, 1, 4 ); gLayout->addWidget( table, 2, 0, 1, 4 );
l->addLayout( gLayout, line, 0, 1, -1 );
l->addWidget( keyContainer, line, 0, 1, -1 );
CONNECT( actionSearch, textChanged( const QString& ),
this, filter( const QString& ) );
} }
int KeySelectorControl::getType() const { return CONFIG_ITEM_KEY; } int KeySelectorControl::getType() const { return CONFIG_ITEM_KEY; }
...@@ -1474,7 +1384,7 @@ void KeySelectorControl::selectKey( QTreeWidgetItem *keyItem, int column ) ...@@ -1474,7 +1384,7 @@ void KeySelectorControl::selectKey( QTreeWidgetItem *keyItem, int column )
bool b_global = ( column == 2 ); bool b_global = ( column == 2 );
/* Launch a small dialog to ask for a new key */ /* Launch a small dialog to ask for a new key */
KeyInputDialog *d = new KeyInputDialog( table, keyItem->text( 0 ), widget, b_global ); KeyInputDialog *d = new KeyInputDialog( table, keyItem->text( 0 ), table, b_global );
d->exec(); d->exec();
if( d->result() == QDialog::Accepted ) if( d->result() == QDialog::Accepted )
......
...@@ -52,6 +52,8 @@ class QGroupBox; ...@@ -52,6 +52,8 @@ class QGroupBox;
class QGridLayout; class QGridLayout;
class QDialogButtonBox; class QDialogButtonBox;
class QVBoxLayout; class QVBoxLayout;
class QBoxLayout;
class SearchLineEdit;
/******************************************************* /*******************************************************
* Simple widgets * Simple widgets
...@@ -81,26 +83,25 @@ class ConfigControl : public QObject ...@@ -81,26 +83,25 @@ class ConfigControl : public QObject
public: public:
virtual int getType() const = 0; virtual int getType() const = 0;
const char * getName() const { return p_item->psz_name; } const char * getName() const { return p_item->psz_name; }
QWidget *getWidget() const { return widget; }
bool isAdvanced() const { return p_item->b_advanced; } bool isAdvanced() const { return p_item->b_advanced; }
void hide() { changeVisibility( false ); } void hide() { changeVisibility( false ); }
void show() { changeVisibility( true ); } void show() { changeVisibility( true ); }
/* ConfigControl factory */
static ConfigControl * createControl( vlc_object_t*, static ConfigControl * createControl( vlc_object_t*,
module_config_t*,QWidget*, module_config_t*,QWidget*,
QGridLayout *, int line = 0 ); QGridLayout *, int line = 0 );
/* Inserts control into another layout block, using a sublayout */
void insertInto( QBoxLayout * );
/* Inserts control into an existing grid layout */
void insertIntoExistingGrid( QGridLayout*, int );
virtual void doApply() = 0; virtual void doApply() = 0;
protected: protected:
ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf,
QWidget *p ) : p_this( _p_this ), p_item( _p_conf )
{ Q_UNUSED( p ); widget = NULL; }
ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf ) : ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf ) :
p_this (_p_this ), p_item( _p_conf ) p_this (_p_this ), p_item( _p_conf ) {}
{ widget = NULL; } virtual void changeVisibility( bool b ) { Q_UNUSED(b); };
virtual void changeVisibility( bool b ) { if ( widget ) widget->setVisible( b ); }
vlc_object_t *p_this; vlc_object_t *p_this;
module_config_t *p_item; module_config_t *p_item;
QWidget *widget; virtual void fillGrid( QGridLayout*, int ) {};
signals: signals:
void changed(); void changed();
#if 0 #if 0
...@@ -120,8 +121,6 @@ public: ...@@ -120,8 +121,6 @@ public:
virtual int getType() const; virtual int getType() const;
virtual void doApply(); virtual void doApply();
protected: protected:
VIntConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
ConfigControl(a,b,c) {};
VIntConfigControl( vlc_object_t *a, module_config_t *b ) : VIntConfigControl( vlc_object_t *a, module_config_t *b ) :
ConfigControl(a,b) {}; ConfigControl(a,b) {};
}; };
...@@ -130,12 +129,9 @@ class IntegerConfigControl : public VIntConfigControl ...@@ -130,12 +129,9 @@ class IntegerConfigControl : public VIntConfigControl
{ {
Q_OBJECT Q_OBJECT
public: public:
IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget *, IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget * );
QGridLayout *, int );
IntegerConfigControl( vlc_object_t *, module_config_t *, IntegerConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QSpinBox* ); QLabel*, QSpinBox* );
IntegerConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QSlider* );
virtual int getValue() const; virtual int getValue() const;
protected: protected:
QSpinBox *spin; QSpinBox *spin;
...@@ -143,8 +139,8 @@ protected: ...@@ -143,8 +139,8 @@ protected:
{ {
spin->setVisible( b ); spin->setVisible( b );
if ( label ) label->setVisible( b ); if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
} }
virtual void fillGrid( QGridLayout*, int );
private: private:
QLabel *label; QLabel *label;
void finish(); void finish();
...@@ -153,10 +149,11 @@ private: ...@@ -153,10 +149,11 @@ private:
class IntegerRangeConfigControl : public IntegerConfigControl class IntegerRangeConfigControl : public IntegerConfigControl
{ {
public: public:
IntegerRangeConfigControl( vlc_object_t *, module_config_t *, QWidget *, IntegerRangeConfigControl( vlc_object_t *, module_config_t *, QWidget * );
QGridLayout *, int );
IntegerRangeConfigControl( vlc_object_t *, module_config_t *, IntegerRangeConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QSpinBox* ); QLabel*, QSpinBox* );
IntegerRangeConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QSlider* );
private: private:
void finish(); void finish();
}; };
...@@ -173,7 +170,6 @@ protected: ...@@ -173,7 +170,6 @@ protected:
{ {
slider->setVisible( b ); slider->setVisible( b );
if ( label ) label->setVisible( b ); if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
} }
private: private:
QLabel *label; QLabel *label;
...@@ -184,8 +180,7 @@ class IntegerListConfigControl : public VIntConfigControl ...@@ -184,8 +180,7 @@ class IntegerListConfigControl : public VIntConfigControl
{ {
Q_OBJECT Q_OBJECT
public: public:
IntegerListConfigControl( vlc_object_t *, module_config_t *, QWidget *, IntegerListConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool );
bool, QGridLayout*, int );
IntegerListConfigControl( vlc_object_t *, module_config_t *, QLabel *, IntegerListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QComboBox*, bool ); QComboBox*, bool );
virtual int getValue() const; virtual int getValue() const;
...@@ -194,12 +189,13 @@ protected: ...@@ -194,12 +189,13 @@ protected:
{ {
combo->setVisible( b ); combo->setVisible( b );
if ( label ) label->setVisible( b ); if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
} }
virtual void fillGrid( QGridLayout*, int );
private: private:
void finish(module_config_t * ); void finish(module_config_t * );
QLabel *label; QLabel *label;
QComboBox *combo; QComboBox *combo;
QList<QPushButton *> buttons;
private slots: private slots:
void actionRequested( int ); void actionRequested( int );
...@@ -208,8 +204,7 @@ private slots: ...@@ -208,8 +204,7 @@ private slots:
class BoolConfigControl : public VIntConfigControl class BoolConfigControl : public VIntConfigControl
{ {
public: public:
BoolConfigControl( vlc_object_t *, module_config_t *, QWidget *, BoolConfigControl( vlc_object_t *, module_config_t *, QWidget * );
QGridLayout *, int );
BoolConfigControl( vlc_object_t *, module_config_t *, BoolConfigControl( vlc_object_t *, module_config_t *,
QLabel *, QAbstractButton* ); QLabel *, QAbstractButton* );
virtual int getValue() const; virtual int getValue() const;
...@@ -218,8 +213,8 @@ protected: ...@@ -218,8 +213,8 @@ protected:
virtual void changeVisibility( bool b ) virtual void changeVisibility( bool b )
{ {
checkbox->setVisible( b ); checkbox->setVisible( b );
ConfigControl::changeVisibility( b );
} }
virtual void fillGrid( QGridLayout*, int );
private: private:
QAbstractButton *checkbox; QAbstractButton *checkbox;
void finish(); void finish();
...@@ -229,8 +224,7 @@ class ColorConfigControl : public VIntConfigControl ...@@ -229,8 +224,7 @@ class ColorConfigControl : public VIntConfigControl
{ {
Q_OBJECT Q_OBJECT
public: public:
ColorConfigControl( vlc_object_t *, module_config_t *, QWidget *, ColorConfigControl( vlc_object_t *, module_config_t *, QWidget * );
QGridLayout *, int );
ColorConfigControl( vlc_object_t *, module_config_t *, ColorConfigControl( vlc_object_t *, module_config_t *,
QLabel *, QAbstractButton* ); QLabel *, QAbstractButton* );
virtual ~ColorConfigControl() { delete color_px; } virtual ~ColorConfigControl() { delete color_px; }
...@@ -240,8 +234,8 @@ protected: ...@@ -240,8 +234,8 @@ protected:
{ {
color_but->setVisible( b ); color_but->setVisible( b );
if ( label ) label->setVisible( b ); if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
} }
virtual void fillGrid( QGridLayout*, int );
private: private:
QLabel *label; QLabel *label;
QAbstractButton *color_but; QAbstractButton *color_but;
...@@ -263,8 +257,6 @@ public: ...@@ -263,8 +257,6 @@ public:
virtual int getType() const; virtual int getType() const;
virtual void doApply(); virtual void doApply();
protected: protected:
VFloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
ConfigControl(a,b,c) {};
VFloatConfigControl( vlc_object_t *a, module_config_t *b ) : VFloatConfigControl( vlc_object_t *a, module_config_t *b ) :
ConfigControl(a,b) {}; ConfigControl(a,b) {};
}; };
...@@ -273,8 +265,7 @@ class FloatConfigControl : public VFloatConfigControl ...@@ -273,8 +265,7 @@ class FloatConfigControl : public VFloatConfigControl
{ {
Q_OBJECT Q_OBJECT
public: public:
FloatConfigControl( vlc_object_t *, module_config_t *, QWidget *, FloatConfigControl( vlc_object_t *, module_config_t *, QWidget * );
QGridLayout *, int );
FloatConfigControl( vlc_object_t *, module_config_t *, FloatConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QDoubleSpinBox* ); QLabel*, QDoubleSpinBox* );
virtual float getValue() const; virtual float getValue() const;
...@@ -284,8 +275,8 @@ protected: ...@@ -284,8 +275,8 @@ protected:
{ {
spin->setVisible( b ); spin->setVisible( b );
if ( label ) label->setVisible( b ); if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
} }
virtual void fillGrid( QGridLayout*, int );
QDoubleSpinBox *spin; QDoubleSpinBox *spin;
private: private:
...@@ -297,8 +288,7 @@ class FloatRangeConfigControl : public FloatConfigControl ...@@ -297,8 +288,7 @@ class FloatRangeConfigControl : public FloatConfigControl
{ {
Q_OBJECT Q_OBJECT
public: public:
FloatRangeConfigControl( vlc_object_t *, module_config_t *, QWidget *, FloatRangeConfigControl( vlc_object_t *, module_config_t *, QWidget * );
QGridLayout *, int );
FloatRangeConfigControl( vlc_object_t *, module_config_t *, FloatRangeConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QDoubleSpinBox* ); QLabel*, QDoubleSpinBox* );
private: private:
...@@ -316,8 +306,6 @@ public: ...@@ -316,8 +306,6 @@ public:
virtual int getType() const; virtual int getType() const;
virtual void doApply(); virtual void doApply();
protected: protected:
VStringConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
ConfigControl(a,b,c) {};
VStringConfigControl( vlc_object_t *a, module_config_t *b ) : VStringConfigControl( vlc_object_t *a, module_config_t *b ) :
ConfigControl(a,b) {}; ConfigControl(a,b) {};
}; };
...@@ -326,8 +314,8 @@ class StringConfigControl : public VStringConfigControl ...@@ -326,8 +314,8 @@ class StringConfigControl : public VStringConfigControl
{ {
Q_OBJECT Q_OBJECT
public: public:
StringConfigControl( vlc_object_t *, module_config_t *, QWidget *, StringConfigControl( vlc_object_t *, module_config_t *,
QGridLayout *, int, bool pwd ); QWidget *, bool pwd );
StringConfigControl( vlc_object_t *, module_config_t *, QLabel *, StringConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QLineEdit*, bool pwd ); QLineEdit*, bool pwd );
virtual QString getValue() const { return text->text(); }; virtual QString getValue() const { return text->text(); };
...@@ -336,8 +324,8 @@ protected: ...@@ -336,8 +324,8 @@ protected:
{ {
text->setVisible( b ); text->setVisible( b );
if ( label ) label->setVisible( b ); if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
} }
virtual void fillGrid( QGridLayout*, int );
private: private:
void finish(); void finish();
QLineEdit *text; QLineEdit *text;
...@@ -348,8 +336,7 @@ class FileConfigControl : public VStringConfigControl ...@@ -348,8 +336,7 @@ class FileConfigControl : public VStringConfigControl
{ {
Q_OBJECT Q_OBJECT
public: public:
FileConfigControl( vlc_object_t *, module_config_t *, QWidget *, FileConfigControl( vlc_object_t *, module_config_t *, QWidget * );
QGridLayout *, int );
FileConfigControl( vlc_object_t *, module_config_t *, QLabel *, FileConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QLineEdit *, QPushButton * ); QLineEdit *, QPushButton * );
virtual QString getValue() const { return text->text(); }; virtual QString getValue() const { return text->text(); };
...@@ -361,8 +348,8 @@ protected: ...@@ -361,8 +348,8 @@ protected:
text->setVisible( b ); text->setVisible( b );
browse->setVisible( b ); browse->setVisible( b );
if ( label ) label->setVisible( b ); if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
} }
virtual void fillGrid( QGridLayout*, int );
void finish(); void finish();
QLineEdit *text; QLineEdit *text;
QLabel *label; QLabel *label;
...@@ -373,8 +360,7 @@ class DirectoryConfigControl : public FileConfigControl ...@@ -373,8 +360,7 @@ class DirectoryConfigControl : public FileConfigControl
{ {
Q_OBJECT Q_OBJECT
public: public:
DirectoryConfigControl( vlc_object_t *, module_config_t *, QWidget *, DirectoryConfigControl( vlc_object_t *, module_config_t *, QWidget * );
QGridLayout *, int );
DirectoryConfigControl( vlc_object_t *, module_config_t *, QLabel *, DirectoryConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QLineEdit *, QPushButton * ); QLineEdit *, QPushButton * );
public slots: public slots:
...@@ -385,8 +371,7 @@ class FontConfigControl : public VStringConfigControl ...@@ -385,8 +371,7 @@ class FontConfigControl : public VStringConfigControl
{ {
Q_OBJECT Q_OBJECT
public: public:
FontConfigControl( vlc_object_t *, module_config_t *, QWidget *, FontConfigControl( vlc_object_t *, module_config_t *, QWidget * );
QGridLayout *, int);
FontConfigControl( vlc_object_t *, module_config_t *, QLabel *, FontConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QFontComboBox *); QFontComboBox *);
virtual QString getValue() const { return font->currentFont().family(); } virtual QString getValue() const { return font->currentFont().family(); }
...@@ -395,8 +380,8 @@ protected: ...@@ -395,8 +380,8 @@ protected:
{ {
font->setVisible( b ); font->setVisible( b );
if ( label ) label->setVisible( b ); if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
} }
virtual void fillGrid( QGridLayout*, int );
QLabel *label; QLabel *label;
QFontComboBox *font; QFontComboBox *font;
}; };
...@@ -404,17 +389,17 @@ protected: ...@@ -404,17 +389,17 @@ protected:
class ModuleConfigControl : public VStringConfigControl class ModuleConfigControl : public VStringConfigControl
{ {
public: public:
ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool, ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool );
QGridLayout*, int );
ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *, ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QComboBox*, bool ); QComboBox*, bool );
virtual QString getValue() const; virtual QString getValue() const;
protected:
virtual void changeVisibility( bool b ) virtual void changeVisibility( bool b )
{ {
combo->setVisible( b ); combo->setVisible( b );
if ( label ) label->setVisible( b ); if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
} }
virtual void fillGrid( QGridLayout*, int );
private: private:
void finish( bool ); void finish( bool );
QLabel *label; QLabel *label;
...@@ -431,8 +416,7 @@ class ModuleListConfigControl : public VStringConfigControl ...@@ -431,8 +416,7 @@ class ModuleListConfigControl : public VStringConfigControl
Q_OBJECT Q_OBJECT
friend class ConfigControl; friend class ConfigControl;
public: public:
ModuleListConfigControl( vlc_object_t *, module_config_t *, QWidget *, ModuleListConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool );
bool, QGridLayout*, int );
// ModuleListConfigControl( vlc_object_t *, module_config_t *, QLabel *, // ModuleListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
// QComboBox*, bool ); // QComboBox*, bool );
virtual ~ModuleListConfigControl(); virtual ~ModuleListConfigControl();
...@@ -441,6 +425,7 @@ public slots: ...@@ -441,6 +425,7 @@ public slots:
void onUpdate(); void onUpdate();
protected: protected:
virtual void changeVisibility( bool ); virtual void changeVisibility( bool );
virtual void fillGrid( QGridLayout*, int );
private: private:
void finish( bool ); void finish( bool );
void checkbox_lists(module_t*); void checkbox_lists(module_t*);
...@@ -454,8 +439,7 @@ class StringListConfigControl : public VStringConfigControl ...@@ -454,8 +439,7 @@ class StringListConfigControl : public VStringConfigControl
{ {
Q_OBJECT Q_OBJECT
public: public:
StringListConfigControl( vlc_object_t *, module_config_t *, QWidget *, StringListConfigControl( vlc_object_t *, module_config_t *, QWidget * );
QGridLayout*, int );
StringListConfigControl( vlc_object_t *, module_config_t *, QLabel *, StringListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QComboBox*, bool ); QComboBox*, bool );
virtual QString getValue() const; virtual QString getValue() const;
...@@ -464,12 +448,13 @@ protected: ...@@ -464,12 +448,13 @@ protected:
{ {
combo->setVisible( b ); combo->setVisible( b );
if ( label ) label->setVisible( b ); if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
} }
virtual void fillGrid( QGridLayout*, int );
QComboBox *combo; QComboBox *combo;
private: private:
void finish(module_config_t * ); void finish(module_config_t * );
QLabel *label; QLabel *label;
QList<QPushButton *> buttons;
private slots: private slots:
void actionRequested( int ); void actionRequested( int );
void comboIndexChanged( int ); void comboIndexChanged( int );
...@@ -506,8 +491,7 @@ class KeySelectorControl : public ConfigControl ...@@ -506,8 +491,7 @@ class KeySelectorControl : public ConfigControl
{ {
Q_OBJECT Q_OBJECT
public: public:
KeySelectorControl( vlc_object_t *, module_config_t *, QWidget *, KeySelectorControl( vlc_object_t *, module_config_t *, QWidget * );
QGridLayout*, int );
virtual int getType() const; virtual int getType() const;
virtual void doApply(); virtual void doApply();
protected: protected:
...@@ -516,11 +500,13 @@ protected: ...@@ -516,11 +500,13 @@ protected:
{ {
table->setVisible( b ); table->setVisible( b );
if ( label ) label->setVisible( b ); if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
} }
virtual void fillGrid( QGridLayout*, int );
private: private:
void finish(); void finish();
QLabel *label; QLabel *label;
QLabel *searchLabel;
SearchLineEdit *actionSearch;
QTreeWidget *table; QTreeWidget *table;
QList<module_config_t *> values; QList<module_config_t *> values;
private slots: private slots:
......
...@@ -680,8 +680,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -680,8 +680,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
int line = 0; int line = 0;
panel_label->setText( qtr( "Configure Hotkeys" ) ); panel_label->setText( qtr( "Configure Hotkeys" ) );
control = new KeySelectorControl( VLC_OBJECT(p_intf), p_config , control = new KeySelectorControl( VLC_OBJECT(p_intf), p_config, this );
this, gLayout, line ); control->insertIntoExistingGrid( gLayout, line );
controls.append( control ); controls.append( control );
line++; line++;
...@@ -694,14 +694,16 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -694,14 +694,16 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
p_config = config_FindConfig( VLC_OBJECT(p_intf), "hotkeys-mousewheel-mode" ); p_config = config_FindConfig( VLC_OBJECT(p_intf), "hotkeys-mousewheel-mode" );
control = new IntegerListConfigControl( VLC_OBJECT(p_intf), control = new IntegerListConfigControl( VLC_OBJECT(p_intf),
p_config, this, false, gLayout, line ); p_config, this, false );
control->insertIntoExistingGrid( gLayout, line );
controls.append( control ); controls.append( control );
#ifdef WIN32 #ifdef WIN32
line++; line++;
p_config = config_FindConfig( VLC_OBJECT(p_intf), "qt-disable-volume-keys" ); p_config = config_FindConfig( VLC_OBJECT(p_intf), "qt-disable-volume-keys" );
control = new BoolConfigControl( VLC_OBJECT(p_intf), p_config, this, gLayout, line ); control = new BoolConfigControl( VLC_OBJECT(p_intf), p_config, this );
control->insertIntoExistingGrid( gLayout, line );
controls.append( control ); controls.append( control );
#endif #endif
......
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