From 5a9b7f9d1ac4e99d2e4fe92f0f98523eff7a370a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Tue, 8 Jan 2008 01:09:40 +0000 Subject: [PATCH] Qt4 - Open dialog: fix segfault on capture cards and fix the problematic layout on Win32. --- modules/gui/qt4/components/open_panels.cpp | 37 ++++++------- modules/gui/qt4/ui/open.ui | 62 +++++++--------------- 2 files changed, 35 insertions(+), 64 deletions(-) diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp index 8752b44491..b9b8c883b7 100644 --- a/modules/gui/qt4/components/open_panels.cpp +++ b/modules/gui/qt4/components/open_panels.cpp @@ -909,7 +909,6 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : CaptureOpenPanel::~CaptureOpenPanel() { - if( adv ) delete adv; } void CaptureOpenPanel::clear() @@ -1046,37 +1045,42 @@ void CaptureOpenPanel::updateButtons() break; } - if( adv ) - { - delete adv; - advMRL.clear(); - } + advMRL.clear(); } void CaptureOpenPanel::advancedDialog() { + /* Get selected device type */ int i_devicetype = ui.deviceCombo->itemData( ui.deviceCombo->currentIndex() ).toInt(); + + /* Get the corresponding module */ module_t *p_module = module_Find( VLC_OBJECT(p_intf), psz_devModule[i_devicetype] ); if( NULL == p_module ) return; - unsigned int i_confsize; + /* Init */ QList controls; + /* Get the confsize */ + unsigned int i_confsize; module_config_t *p_config; p_config = module_GetConfig( p_module, &i_confsize ); + /* New Adv Prop dialog */ adv = new QDialog( this ); adv->setWindowTitle( qtr( "Advanced options..." ) ); + /* A main Layout with a Frame */ QVBoxLayout *mainLayout = new QVBoxLayout( adv ); //TODO QScrollArea QFrame *advFrame = new QFrame; mainLayout->addWidget( advFrame ); + /* GridLayout inside the Frame */ QGridLayout *gLayout = new QGridLayout( advFrame ); + /* Create the options inside the FrameLayout */ for( int n = 0; n < i_confsize; n++ ) { module_config_t *p_item = p_config + n; @@ -1085,17 +1089,7 @@ void CaptureOpenPanel::advancedDialog() controls.append( config ); } - /* QGroupBox *optionGroup = new QGroupBox( qtr( "Advanced options..." ) ); - QHBoxLayout *grLayout = new QHBoxLayout( optionGroup ); - - QLabel *optionLabel = new QLabel( qtr( "Options" ) + ":" ); - grLayout->addWidget( optionLabel ); - - QLineEdit *optionLine = new QLineEdit; - grLayout->addWidget( optionLine ); - - gLayout->addWidget( optionGroup, i_confsize, 0, 1, -1 );*/ - + /* Button stuffs */ QDialogButtonBox *advButtonBox = new QDialogButtonBox( adv ); QPushButton *closeButton = new QPushButton( qtr( "Ok" ) ); QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) ); @@ -1108,6 +1102,7 @@ void CaptureOpenPanel::advancedDialog() gLayout->addWidget( advButtonBox, i_confsize + 1, 0, 1, -1 ); + /* Creation of the MRL */ if( adv->exec() ) { QString tempMRL = ""; @@ -1123,7 +1118,7 @@ void CaptureOpenPanel::advancedDialog() tempMRL += (i ? " :" : ":"); if( control->getType() == CONFIG_ITEM_BOOL ) - if( !( qobject_cast(control)->getValue() ) ) + if( !(qobject_cast(control)->getValue() ) ) tempMRL += "no-"; tempMRL += control->getName(); @@ -1145,7 +1140,9 @@ void CaptureOpenPanel::advancedDialog() } } advMRL = tempMRL; - msg_Dbg( p_intf, "%s", qtu( advMRL ) ); updateMRL(); + msg_Dbg( p_intf, "%s", qtu( advMRL ) ); } + delete adv; } + diff --git a/modules/gui/qt4/ui/open.ui b/modules/gui/qt4/ui/open.ui index 8d3365d719..3a445ee3e4 100644 --- a/modules/gui/qt4/ui/open.ui +++ b/modules/gui/qt4/ui/open.ui @@ -9,8 +9,8 @@ 0 0 - 450 - 296 + 432 + 285 @@ -22,8 +22,8 @@ Dialog - - + + @@ -36,7 +36,7 @@ - + _("Show extended options") @@ -46,7 +46,7 @@ - + @@ -180,57 +180,31 @@ - + - Qt::Vertical + Qt::Horizontal - QSizePolicy::MinimumExpanding + QSizePolicy::Minimum - 20 - 1 + 240 + 20 - - - - 6 + + + + Qt::Horizontal - - 0 + + QDialogButtonBox::NoButton - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 240 - 20 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::NoButton - - - - + -- 2.39.5