+ QString module = ModuleFromWidgetName( sender() );
+ std::cout << "Module name: " << module.toStdString() << std::endl;
+
+ QCheckBox *checkbox = qobject_cast<QCheckBox*>(sender());
+ QGroupBox *groupbox = qobject_cast<QGroupBox*>(sender());
+
+ ChangeVFiltersString( qtu(module),
+ checkbox ? checkbox->isChecked()
+ : groupbox->isChecked() );
+}
+
+void ExtVideo::setWidgetValue( QObject *widget )
+{
+ QString module = ModuleFromWidgetName( widget->parent() );
+ //std::cout << "Module name: " << module.toStdString() << std::endl;
+ QString option = OptionFromWidgetName( widget );
+ //std::cout << "Option name: " << option.toStdString() << std::endl;
+
+ vlc_object_t *p_obj = (vlc_object_t *)
+ vlc_object_find_name( p_intf->p_libvlc,
+ module.toStdString().c_str(),
+ FIND_CHILD );
+ int i_type;
+ vlc_value_t val;
+
+ if( !p_obj )
+ {
+ msg_Dbg( p_intf,
+ "Module instance %s not found, looking in config values.",
+ module.toStdString().c_str() );
+ i_type = config_GetType( p_intf, option.toStdString().c_str() ) & 0xf0;
+ switch( i_type )
+ {
+ case VLC_VAR_INTEGER:
+ case VLC_VAR_BOOL:
+ val.i_int = config_GetInt( p_intf, option.toStdString().c_str() );
+ break;
+ case VLC_VAR_FLOAT:
+ val.f_float = config_GetFloat( p_intf, option.toStdString().c_str() );
+ break;
+ case VLC_VAR_STRING:
+ val.psz_string = config_GetPsz( p_intf, option.toStdString().c_str() );
+ break;
+ }
+ }
+ else
+ {
+ i_type = var_Type( p_obj, option.toStdString().c_str() ) & 0xf0;
+ var_Get( p_obj, option.toStdString().c_str(), &val );
+ vlc_object_release( p_obj );
+ }
+
+ /* Try to cast to all the widgets we're likely to encounter. Only
+ * one of the casts is expected to work. */
+ QSlider *slider = qobject_cast<QSlider*> (widget);
+ QCheckBox *checkbox = qobject_cast<QCheckBox*> (widget);
+ QSpinBox *spinbox = qobject_cast<QSpinBox*> (widget);
+ QDoubleSpinBox *doublespinbox = qobject_cast<QDoubleSpinBox*>(widget);
+ QDial *dial = qobject_cast<QDial*> (widget);
+ QLineEdit *lineedit = qobject_cast<QLineEdit*> (widget);
+ QComboBox *combobox = qobject_cast<QComboBox*> (widget);
+
+ if( i_type == VLC_VAR_INTEGER || i_type == VLC_VAR_BOOL )
+ {
+ int i_int = 0;
+ if( slider ) slider->setValue( val.i_int );
+ else if( checkbox ) checkbox->setCheckState( val.i_int? Qt::Checked
+ : Qt::Unchecked );
+ else if( spinbox ) spinbox->setValue( val.i_int );
+ else if( dial ) dial->setValue( val.i_int );
+ else msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ );
+ }
+ else if( i_type == VLC_VAR_FLOAT )
+ {
+ double f_float = 0;
+ if( slider ) slider->setValue( (int)(val.f_float*(double)slider->tickInterval())); /* hack alert! */
+ else if( doublespinbox ) doublespinbox->setValue(val.f_float);
+ else msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ );
+ }
+ else if( i_type == VLC_VAR_STRING )
+ {
+ const char *psz_string = NULL;
+ if( lineedit ) lineedit->setText( val.psz_string );
+ else msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ );
+ free( val.psz_string );
+ }
+ else
+ msg_Err( p_intf,
+ "Module %s's %s variable is of an unsupported type (%d)",
+ module.toStdString().c_str(),
+ option.toStdString().c_str(),
+ i_type );
+}
+
+void ExtVideo::updateFilterOptions()
+{
+ QString module = ModuleFromWidgetName( sender()->parent() );
+ std::cout << "Module name: " << module.toStdString() << std::endl;
+ QString option = OptionFromWidgetName( sender() );
+ std::cout << "Option name: " << option.toStdString() << std::endl;
+
+ vlc_object_t *p_obj = (vlc_object_t *)
+ vlc_object_find_name( p_intf->p_libvlc,
+ module.toStdString().c_str(),
+ FIND_CHILD );
+ if( !p_obj )
+ {
+ msg_Err( p_intf, "Module %s not found.", module.toStdString().c_str() );
+ return;
+ }
+
+ int i_type = var_Type( p_obj, option.toStdString().c_str() );
+ if( !( i_type & VLC_VAR_ISCOMMAND ) )
+ {
+ vlc_object_release( p_obj );
+ msg_Err( p_intf, "Module %s's %s variable isn't a command.",
+ module.toStdString().c_str(),
+ option.toStdString().c_str() );
+ return;
+ }