Commit 5a9b7f9d authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Open dialog: fix segfault on capture cards and fix the problematic layout on Win32.

parent ebc34a37
...@@ -909,7 +909,6 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : ...@@ -909,7 +909,6 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
CaptureOpenPanel::~CaptureOpenPanel() CaptureOpenPanel::~CaptureOpenPanel()
{ {
if( adv ) delete adv;
} }
void CaptureOpenPanel::clear() void CaptureOpenPanel::clear()
...@@ -1046,37 +1045,42 @@ void CaptureOpenPanel::updateButtons() ...@@ -1046,37 +1045,42 @@ void CaptureOpenPanel::updateButtons()
break; break;
} }
if( adv )
{
delete adv;
advMRL.clear(); advMRL.clear();
}
} }
void CaptureOpenPanel::advancedDialog() void CaptureOpenPanel::advancedDialog()
{ {
/* Get selected device type */
int i_devicetype = ui.deviceCombo->itemData( int i_devicetype = ui.deviceCombo->itemData(
ui.deviceCombo->currentIndex() ).toInt(); ui.deviceCombo->currentIndex() ).toInt();
/* Get the corresponding module */
module_t *p_module = module_t *p_module =
module_Find( VLC_OBJECT(p_intf), psz_devModule[i_devicetype] ); module_Find( VLC_OBJECT(p_intf), psz_devModule[i_devicetype] );
if( NULL == p_module ) return; if( NULL == p_module ) return;
unsigned int i_confsize; /* Init */
QList<ConfigControl *> controls; QList<ConfigControl *> controls;
/* Get the confsize */
unsigned int i_confsize;
module_config_t *p_config; module_config_t *p_config;
p_config = module_GetConfig( p_module, &i_confsize ); p_config = module_GetConfig( p_module, &i_confsize );
/* New Adv Prop dialog */
adv = new QDialog( this ); adv = new QDialog( this );
adv->setWindowTitle( qtr( "Advanced options..." ) ); adv->setWindowTitle( qtr( "Advanced options..." ) );
/* A main Layout with a Frame */
QVBoxLayout *mainLayout = new QVBoxLayout( adv ); QVBoxLayout *mainLayout = new QVBoxLayout( adv );
//TODO QScrollArea //TODO QScrollArea
QFrame *advFrame = new QFrame; QFrame *advFrame = new QFrame;
mainLayout->addWidget( advFrame ); mainLayout->addWidget( advFrame );
/* GridLayout inside the Frame */
QGridLayout *gLayout = new QGridLayout( advFrame ); QGridLayout *gLayout = new QGridLayout( advFrame );
/* Create the options inside the FrameLayout */
for( int n = 0; n < i_confsize; n++ ) for( int n = 0; n < i_confsize; n++ )
{ {
module_config_t *p_item = p_config + n; module_config_t *p_item = p_config + n;
...@@ -1085,17 +1089,7 @@ void CaptureOpenPanel::advancedDialog() ...@@ -1085,17 +1089,7 @@ void CaptureOpenPanel::advancedDialog()
controls.append( config ); controls.append( config );
} }
/* QGroupBox *optionGroup = new QGroupBox( qtr( "Advanced options..." ) ); /* Button stuffs */
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 );*/
QDialogButtonBox *advButtonBox = new QDialogButtonBox( adv ); QDialogButtonBox *advButtonBox = new QDialogButtonBox( adv );
QPushButton *closeButton = new QPushButton( qtr( "Ok" ) ); QPushButton *closeButton = new QPushButton( qtr( "Ok" ) );
QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) ); QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) );
...@@ -1108,6 +1102,7 @@ void CaptureOpenPanel::advancedDialog() ...@@ -1108,6 +1102,7 @@ void CaptureOpenPanel::advancedDialog()
gLayout->addWidget( advButtonBox, i_confsize + 1, 0, 1, -1 ); gLayout->addWidget( advButtonBox, i_confsize + 1, 0, 1, -1 );
/* Creation of the MRL */
if( adv->exec() ) if( adv->exec() )
{ {
QString tempMRL = ""; QString tempMRL = "";
...@@ -1123,7 +1118,7 @@ void CaptureOpenPanel::advancedDialog() ...@@ -1123,7 +1118,7 @@ void CaptureOpenPanel::advancedDialog()
tempMRL += (i ? " :" : ":"); tempMRL += (i ? " :" : ":");
if( control->getType() == CONFIG_ITEM_BOOL ) if( control->getType() == CONFIG_ITEM_BOOL )
if( !( qobject_cast<VIntConfigControl *>(control)->getValue() ) ) if( !(qobject_cast<VIntConfigControl *>(control)->getValue() ) )
tempMRL += "no-"; tempMRL += "no-";
tempMRL += control->getName(); tempMRL += control->getName();
...@@ -1145,7 +1140,9 @@ void CaptureOpenPanel::advancedDialog() ...@@ -1145,7 +1140,9 @@ void CaptureOpenPanel::advancedDialog()
} }
} }
advMRL = tempMRL; advMRL = tempMRL;
msg_Dbg( p_intf, "%s", qtu( advMRL ) );
updateMRL(); updateMRL();
msg_Dbg( p_intf, "%s", qtu( advMRL ) );
} }
delete adv;
} }
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>450</width> <width>432</width>
<height>296</height> <height>285</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
<property name="windowTitle" > <property name="windowTitle" >
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QGridLayout" >
<item> <item row="0" column="0" colspan="2" >
<widget class="QTabWidget" name="Tab" > <widget class="QTabWidget" name="Tab" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" > <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0" colspan="2" >
<widget class="QCheckBox" name="advancedCheckBox" > <widget class="QCheckBox" name="advancedCheckBox" >
<property name="toolTip" > <property name="toolTip" >
<string>_("Show extended options")</string> <string>_("Show extended options")</string>
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="2" column="0" colspan="2" >
<widget class="QFrame" name="advancedFrame" > <widget class="QFrame" name="advancedFrame" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Minimum" > <sizepolicy vsizetype="MinimumExpanding" hsizetype="Minimum" >
...@@ -180,31 +180,7 @@ ...@@ -180,31 +180,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="margin" >
<number>0</number>
</property>
<item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
...@@ -220,7 +196,7 @@ ...@@ -220,7 +196,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item> <item row="3" column="1" >
<widget class="QDialogButtonBox" name="buttonsBox" > <widget class="QDialogButtonBox" name="buttonsBox" >
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
...@@ -231,8 +207,6 @@ ...@@ -231,8 +207,6 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>Tab</tabstop> <tabstop>Tab</tabstop>
......
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