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()
fileList << ui.fileListWidg->item( i )->text();
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(
ui.alignSubComboBox->currentIndex() ).toInt();
mrl.append( " :subsdec-align=" + QString().setNum( align ) );
......@@ -1057,8 +1057,10 @@ void CaptureOpenPanel::updateMRL()
break;
case DSHOW_DEVICE:
fileList << "dshow://";
mrl+= " :dshow-vdev=" + QString("%1").arg( vdevDshowW->getValue() );
mrl+= " :dshow-adev=" + QString("%1").arg( adevDshowW->getValue() );
mrl+= " :dshow-vdev=" +
colon_escape( QString("%1").arg( vdevDshowW->getValue() ) );
mrl+= " :dshow-adev=" +
colon_escape( QString("%1").arg( adevDshowW->getValue() ) );
if( dshowVSizeLine->isModified() )
mrl += " :dshow-size=" + dshowVSizeLine->text();
break;
......@@ -1252,7 +1254,7 @@ void CaptureOpenPanel::advancedDialog()
case CONFIG_ITEM_FILE:
case CONFIG_ITEM_DIRECTORY:
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;
case CONFIG_ITEM_INTEGER:
tempMRL += QString("=%1").arg( qobject_cast<VIntConfigControl *>(control)->getValue() );
......
......@@ -30,6 +30,7 @@
#include "dialogs_provider.hpp"
#include "recents.hpp"
#include "util/qt_dirs.hpp"
#include <QTabWidget>
#include <QGridLayout>
......@@ -352,12 +353,12 @@ void OpenDialog::finish( bool b_enqueue = false )
if( i == 0 )
{
/* Take options from the UI, not from what we stored */
QStringList optionsList = ui.advancedLineInput->text().split( ":" );
QStringList optionsList = ui.advancedLineInput->text().split( " :" );
/* Insert options */
for( int j = 0; j < optionsList.size(); j++ )
{
QString qs = optionsList[j].trimmed();
QString qs = colon_unescape( optionsList[j] );
if( !qs.isEmpty() )
{
input_item_AddOption( p_input, qtu( qs ),
......
......@@ -611,7 +611,7 @@ void DialogsProvider::streamingDialog( QWidget *parent,
/* Add normal Options */
for( int j = 0; j < options.size(); j++ )
{
QString qs = options[j].trimmed();
QString qs = colon_unescape( options[j] );
if( !qs.isEmpty() )
{
input_item_AddOption( p_input, qtu( qs ),
......
......@@ -47,5 +47,13 @@ static inline QString removeTrailingSlash( QString s )
#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
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