+
+/********* Integer range **********/
+IntegerRangeConfigControl::IntegerRangeConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QWidget *_parent, QGridLayout *l,
+ int &line ) :
+ IntegerConfigControl( _p_this, _p_item, _parent, l, line )
+{
+ finish();
+}
+
+IntegerRangeConfigControl::IntegerRangeConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QLabel *_label, QSpinBox *_spin ) :
+ IntegerConfigControl( _p_this, _p_item, _label, _spin )
+{
+ finish();
+}
+
+void IntegerRangeConfigControl::finish()
+{
+ spin->setMaximum( p_item->i_max );
+ spin->setMinimum( p_item->i_min );
+}
+
+/********* Integer / choice list **********/
+IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item, QWidget *_parent, bool bycat,
+ QGridLayout *l, int &line) :
+ VIntConfigControl( _p_this, _p_item, _parent )
+{
+ label = new QLabel( qfu(p_item->psz_text) );
+ combo = new QComboBox();
+ finish( bycat );
+ if( !l )
+ {
+ QHBoxLayout *layout = new QHBoxLayout();
+ layout->addWidget( label ); layout->addWidget( combo );
+ widget->setLayout( layout );
+ }
+ else
+ {
+ l->addWidget( label, line, 0 );
+ l->addWidget( combo, line, 1, Qt::AlignRight );
+ }
+}
+IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item, QLabel *_label, QComboBox *_combo,
+ bool bycat ) : VIntConfigControl( _p_this, _p_item )
+{
+ combo = _combo;
+ label = _label;
+ finish( bycat );
+}
+
+void IntegerListConfigControl::finish( bool bycat )
+{
+ combo->setEditable( false );
+
+ for( int i_index = 0; i_index < p_item->i_list; i_index++ )
+ {
+ combo->addItem( qfu(p_item->ppsz_list_text[i_index] ),
+ QVariant( p_item->pi_list[i_index] ) );
+ if( p_item->i_value == p_item->pi_list[i_index] )
+ combo->setCurrentIndex( combo->count() - 1 );
+ }
+ combo->setToolTip( qfu(p_item->psz_longtext) );
+ if( label )
+ label->setToolTip( qfu(p_item->psz_longtext) );
+}
+
+int IntegerListConfigControl::getValue()
+{
+ return combo->itemData( combo->currentIndex() ).toInt();
+}
+
+/*********** Boolean **************/
+BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QWidget *_parent, QGridLayout *l,
+ int &line ) :
+ VIntConfigControl( _p_this, _p_item, _parent )
+{
+ checkbox = new QCheckBox( qfu(p_item->psz_text) );
+ finish();
+
+ if( !l )
+ {
+ QHBoxLayout *layout = new QHBoxLayout();
+ layout->addWidget( checkbox, 0 );
+ widget->setLayout( layout );
+ }
+ else
+ {
+ l->addWidget( checkbox, line, 0 );
+ }
+}
+BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QLabel *_label,
+ QCheckBox *_checkbox,
+ bool bycat ) :
+ VIntConfigControl( _p_this, _p_item )
+{
+ checkbox = _checkbox;
+ finish();
+}
+
+void BoolConfigControl::finish()
+{
+ checkbox->setCheckState( p_item->i_value == VLC_TRUE ? Qt::Checked
+ : Qt::Unchecked );
+ checkbox->setToolTip( qfu(p_item->psz_longtext) );
+}
+
+int BoolConfigControl::getValue()
+{
+ return checkbox->checkState() == Qt::Checked ? VLC_TRUE : VLC_FALSE;
+}
+
+/**************************************************************************
+ * Float-based controls
+ *************************************************************************/
+
+/*********** Float **************/
+FloatConfigControl::FloatConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QWidget *_parent, QGridLayout *l,
+ int &line ) :
+ VFloatConfigControl( _p_this, _p_item, _parent )
+{
+ label = new QLabel( qfu(p_item->psz_text) );
+ spin = new QDoubleSpinBox; spin->setMinimumWidth( 80 );
+ spin->setMaximumWidth( 90 );
+ finish();
+
+ if( !l )
+ {
+ QHBoxLayout *layout = new QHBoxLayout();
+ layout->addWidget( label, 0 ); layout->addWidget( spin, 1 );
+ widget->setLayout( layout );
+ }
+ else
+ {
+ l->addWidget( label, line, 0 );
+ l->addWidget( spin, line, 1, Qt::AlignRight );
+ }
+}
+
+FloatConfigControl::FloatConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QLabel *_label,
+ QDoubleSpinBox *_spin ) :
+ VFloatConfigControl( _p_this, _p_item )
+{
+ spin = _spin;
+ label = _label;
+ finish();
+}
+
+void FloatConfigControl::finish()
+{
+ spin->setMaximum( 2000000000. );
+ spin->setMinimum( -2000000000. );
+ spin->setSingleStep( 0.1 );
+ spin->setValue( (double)p_item->f_value );
+ spin->setToolTip( qfu(p_item->psz_longtext) );
+ if( label )
+ label->setToolTip( qfu(p_item->psz_longtext) );
+}
+
+float FloatConfigControl::getValue()
+{
+ return (float)spin->value();
+}
+
+/*********** Float with range **************/
+FloatRangeConfigControl::FloatRangeConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QWidget *_parent, QGridLayout *l,
+ int &line ) :
+ FloatConfigControl( _p_this, _p_item, _parent, l, line )
+{
+ finish();
+}
+
+FloatRangeConfigControl::FloatRangeConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QLabel *_label,
+ QDoubleSpinBox *_spin ) :
+ FloatConfigControl( _p_this, _p_item, _label, _spin )
+{
+ finish();
+}
+
+void FloatRangeConfigControl::finish()
+{
+ spin->setMaximum( (double)p_item->f_max );
+ spin->setMinimum( (double)p_item->f_min );
+}
+
+
+/**********************************************************************
+ * Key selector widget
+ **********************************************************************/
+KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QWidget *_parent, QGridLayout *l,
+ int &line ) :
+ ConfigControl( _p_this, _p_item, _parent )
+
+{
+ label = new QLabel( qtr("Select an action to change the associated hotkey") );
+ table = new QTreeWidget( 0 );
+ finish();
+
+ if( !l )
+ {
+ QVBoxLayout *layout = new QVBoxLayout();
+ layout->addWidget( label, 0 ); layout->addWidget( table, 1 );
+ widget->setLayout( layout );
+ }
+ else
+ {
+ l->addWidget( label, line, 0, 1, 2 );
+ l->addWidget( table, line+1, 0, 1,2 );
+ }
+}
+
+void KeySelectorControl::finish()
+{
+ if( label )
+ label->setToolTip( qfu(p_item->psz_longtext) );
+
+ /* Fill the table */
+ table->setColumnCount( 2 );
+ table->setAlternatingRowColors( true );
+
+ module_t *p_main = config_FindModule( p_this, "main" );
+ assert( p_main );
+ module_config_t *p_item = p_main->p_config;
+
+ if( p_item ) do
+ {
+ if( p_item->i_type & CONFIG_ITEM && p_item->psz_name &&
+ strstr( p_item->psz_name , "key-" ) )
+ {
+ QTreeWidgetItem *treeItem = new QTreeWidgetItem();
+ treeItem->setText( 0, qfu( p_item->psz_text ) );
+ treeItem->setText( 1, p_item->psz_value );
+ treeItem->setData( 0, Qt::UserRole, QVariant( p_item->psz_name ) );
+ table->addTopLevelItem( treeItem );
+ }
+ } while( p_item->i_type != CONFIG_HINT_END && p_item++ );
+}
+
+void KeySelectorControl::doApply()
+{
+
+}