Commit 78d552dd authored by Yoann Peronneau's avatar Yoann Peronneau

* open dialog: options like :sub-file= are now added to input (ie "use subtitles" now works)

parent 4c906ee3
...@@ -127,33 +127,39 @@ void OpenDialog::playOrEnqueue( bool b_enqueue = false ) ...@@ -127,33 +127,39 @@ void OpenDialog::playOrEnqueue( bool b_enqueue = false )
{ {
this->toggleVisible(); this->toggleVisible();
mrl = ui.advancedLineInput->text(); mrl = ui.advancedLineInput->text();
QStringList tempMRL = mrl.split( QRegExp("\"\\s+\""),
QString::SkipEmptyParts );
if( !isModal() ) if( !isModal() )
{ {
for( size_t i = 0 ; i< tempMRL.size(); i++ ) QStringList tempMRL = SeparateEntries( mrl );
for( size_t i = 0; i < tempMRL.size(); i++ )
{ {
QString mrli = tempMRL[i].remove( QRegExp( "^\"" ) ). bool b_start = !i && !b_enqueue;
remove( QRegExp( "\"\\s+$" ) ); input_item_t *p_input;
const char * psz_utf8 = qtu( tempMRL[i] ); const char *psz_utf8 = qtu( tempMRL[i] );
if ( b_enqueue )
{ p_input = input_ItemNew( p_intf, psz_utf8, NULL );
/* Enqueue and Preparse all items*/
playlist_Add( THEPL, psz_utf8, NULL, /* Insert options */
PLAYLIST_APPEND | PLAYLIST_PREPARSE, while( i + 1 < tempMRL.size() && tempMRL[i + 1].startsWith( ":" ) )
PLAYLIST_END, VLC_TRUE, VLC_FALSE ); {
i++;
} psz_utf8 = qtu( tempMRL[i] );
else input_ItemAddOption( p_input, psz_utf8 );
{ }
/* Play the first one, parse and enqueue the other ones */
playlist_Add( THEPL, psz_utf8, NULL, if( b_start )
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) | {
( i ? PLAYLIST_PREPARSE : 0 ), playlist_AddInput( THEPL, p_input,
PLAYLIST_END, VLC_TRUE, VLC_FALSE ); PLAYLIST_APPEND | PLAYLIST_GO,
} PLAYLIST_END, VLC_TRUE, VLC_FALSE );
}
else
{
playlist_AddInput( THEPL, p_input,
PLAYLIST_APPEND|PLAYLIST_PREPARSE,
PLAYLIST_END, VLC_TRUE, VLC_FALSE );
}
} }
} }
else else
accept(); accept();
...@@ -207,7 +213,7 @@ void OpenDialog::newMethod(QString method) ...@@ -207,7 +213,7 @@ void OpenDialog::newMethod(QString method)
} }
} }
QStringList SeparateEntries( QString entries ) QStringList OpenDialog::SeparateEntries( QString entries )
{ {
bool b_quotes_mode = false; bool b_quotes_mode = false;
...@@ -217,9 +223,9 @@ QStringList SeparateEntries( QString entries ) ...@@ -217,9 +223,9 @@ QStringList SeparateEntries( QString entries )
int index = 0; int index = 0;
while( index < entries.size() ) while( index < entries.size() )
{ {
int delim_pos = entries.indexOf( QRegExp( "\\s+" ), index ); int delim_pos = entries.indexOf( QRegExp( "\\s+|\"" ), index );
if( delim_pos < 0 ) delim_pos = entries.size() - 1; if( delim_pos < 0 ) delim_pos = entries.size() - 1;
entry += entries.mid( index, delim_pos ); entry += entries.mid( index, delim_pos - index + 1 );
index = delim_pos + 1; index = delim_pos + 1;
if( entry.isEmpty() ) continue; if( entry.isEmpty() ) continue;
...@@ -244,7 +250,7 @@ QStringList SeparateEntries( QString entries ) ...@@ -244,7 +250,7 @@ QStringList SeparateEntries( QString entries )
entry.endsWith( "\r" ) || entry.endsWith( "\n" ) ) entry.endsWith( "\r" ) || entry.endsWith( "\n" ) )
entry.truncate( entry.size() - 1 ); entry.truncate( entry.size() - 1 );
if( !entry.isEmpty() ) entries_array.append( entry ); if( !entry.isEmpty() ) entries_array.append( entry );
entry = ""; entry.clear();
} }
else else
{;} {;}
......
...@@ -66,6 +66,7 @@ private: ...@@ -66,6 +66,7 @@ private:
int advHeight, mainHeight; int advHeight, mainHeight;
void playOrEnqueue( bool ); void playOrEnqueue( bool );
QStringList SeparateEntries( QString );
private slots: private slots:
void cancel(); void cancel();
void play(); void play();
......
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