Commit 319a10e6 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: correctly split options and escape ':' so if your dshow devices or your...

Qt: correctly split options and escape ':' so if your dshow devices or your subtitle contains a " :" in the name, it is correctly opened.
parent 25cda001
...@@ -192,7 +192,7 @@ void FileOpenPanel::updateMRL() ...@@ -192,7 +192,7 @@ void FileOpenPanel::updateMRL()
fileList << ui.fileListWidg->item( i )->text(); fileList << ui.fileListWidg->item( i )->text();
if( ui.subCheckBox->isChecked() && !ui.subInput->text().isEmpty() ) { if( ui.subCheckBox->isChecked() && !ui.subInput->text().isEmpty() ) {
mrl.append( " :sub-file=\"" + ui.subInput->text() + "\"" ); mrl.append( " :sub-file=" + colon_escape( ui.subInput->text() ) );
int align = ui.alignSubComboBox->itemData( int align = ui.alignSubComboBox->itemData(
ui.alignSubComboBox->currentIndex() ).toInt(); ui.alignSubComboBox->currentIndex() ).toInt();
mrl.append( " :subsdec-align=" + QString().setNum( align ) ); mrl.append( " :subsdec-align=" + QString().setNum( align ) );
...@@ -1057,8 +1057,10 @@ void CaptureOpenPanel::updateMRL() ...@@ -1057,8 +1057,10 @@ void CaptureOpenPanel::updateMRL()
break; break;
case DSHOW_DEVICE: case DSHOW_DEVICE:
fileList << "dshow://"; fileList << "dshow://";
mrl+= " :dshow-vdev=" + QString("%1").arg( vdevDshowW->getValue() ); mrl+= " :dshow-vdev=" +
mrl+= " :dshow-adev=" + QString("%1").arg( adevDshowW->getValue() ); colon_escape( QString("%1").arg( vdevDshowW->getValue() ) );
mrl+= " :dshow-adev=" +
colon_escape( QString("%1").arg( adevDshowW->getValue() ) );
if( dshowVSizeLine->isModified() ) if( dshowVSizeLine->isModified() )
mrl += " :dshow-size=" + dshowVSizeLine->text(); mrl += " :dshow-size=" + dshowVSizeLine->text();
break; break;
...@@ -1252,7 +1254,7 @@ void CaptureOpenPanel::advancedDialog() ...@@ -1252,7 +1254,7 @@ void CaptureOpenPanel::advancedDialog()
case CONFIG_ITEM_FILE: case CONFIG_ITEM_FILE:
case CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM_DIRECTORY:
case CONFIG_ITEM_MODULE: case CONFIG_ITEM_MODULE:
tempMRL += QString("=%1").arg( qobject_cast<VStringConfigControl *>(control)->getValue() ); tempMRL += colon_escape( QString("=%1").arg( qobject_cast<VStringConfigControl *>(control)->getValue() ) );
break; break;
case CONFIG_ITEM_INTEGER: case CONFIG_ITEM_INTEGER:
tempMRL += QString("=%1").arg( qobject_cast<VIntConfigControl *>(control)->getValue() ); tempMRL += QString("=%1").arg( qobject_cast<VIntConfigControl *>(control)->getValue() );
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "dialogs_provider.hpp" #include "dialogs_provider.hpp"
#include "recents.hpp" #include "recents.hpp"
#include "util/qt_dirs.hpp"
#include <QTabWidget> #include <QTabWidget>
#include <QGridLayout> #include <QGridLayout>
...@@ -352,12 +353,12 @@ void OpenDialog::finish( bool b_enqueue = false ) ...@@ -352,12 +353,12 @@ void OpenDialog::finish( bool b_enqueue = false )
if( i == 0 ) if( i == 0 )
{ {
/* Take options from the UI, not from what we stored */ /* Take options from the UI, not from what we stored */
QStringList optionsList = ui.advancedLineInput->text().split( ":" ); QStringList optionsList = ui.advancedLineInput->text().split( " :" );
/* Insert options */ /* Insert options */
for( int j = 0; j < optionsList.size(); j++ ) for( int j = 0; j < optionsList.size(); j++ )
{ {
QString qs = optionsList[j].trimmed(); QString qs = colon_unescape( optionsList[j] );
if( !qs.isEmpty() ) if( !qs.isEmpty() )
{ {
input_item_AddOption( p_input, qtu( qs ), input_item_AddOption( p_input, qtu( qs ),
......
...@@ -611,7 +611,7 @@ void DialogsProvider::streamingDialog( QWidget *parent, ...@@ -611,7 +611,7 @@ void DialogsProvider::streamingDialog( QWidget *parent,
/* Add normal Options */ /* Add normal Options */
for( int j = 0; j < options.size(); j++ ) for( int j = 0; j < options.size(); j++ )
{ {
QString qs = options[j].trimmed(); QString qs = colon_unescape( options[j] );
if( !qs.isEmpty() ) if( !qs.isEmpty() )
{ {
input_item_AddOption( p_input, qtu( qs ), input_item_AddOption( p_input, qtu( qs ),
......
...@@ -47,5 +47,13 @@ static inline QString removeTrailingSlash( QString s ) ...@@ -47,5 +47,13 @@ static inline QString removeTrailingSlash( QString s )
#define toNativeSepNoSlash( a ) toNativeSeparators( removeTrailingSlash( a ) ) #define toNativeSepNoSlash( a ) toNativeSeparators( removeTrailingSlash( a ) )
static inline QString colon_escape( QString s )
{
return s.replace( ":", "\\:" );
}
static inline QString colon_unescape( QString s )
{
return s.replace( "\\:", ":" ).trimmed();
}
#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