Commit 08d0d80f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: encode disc MRL correctly (fix #5638)

(cherry picked from commit 9b247e7c299f53c905278c45bf45545dc4bcd390)

Conflicts:

	modules/gui/qt4/components/open_panels.cpp
parent 69dba1e6
...@@ -489,16 +489,9 @@ void DiscOpenPanel::updateButtons() ...@@ -489,16 +489,9 @@ void DiscOpenPanel::updateButtons()
#undef setDrive #undef setDrive
#if !defined( WIN32 ) && !defined( __OS2__ )
# define LOCALHOST ""
#else
# define LOCALHOST "/"
#endif
/* Update the current MRL */ /* Update the current MRL */
void DiscOpenPanel::updateMRL() void DiscOpenPanel::updateMRL()
{ {
QString mrl;
QString discPath; QString discPath;
QStringList fileList; QStringList fileList;
...@@ -508,56 +501,61 @@ void DiscOpenPanel::updateMRL() ...@@ -508,56 +501,61 @@ void DiscOpenPanel::updateMRL()
discPath = ui.deviceCombo->currentText(); discPath = ui.deviceCombo->currentText();
/* MRL scheme */ /* MRL scheme */
const char *scheme;
/* DVD */ /* DVD */
if( ui.dvdRadioButton->isChecked() ) { if( ui.dvdRadioButton->isChecked() ) {
if( !ui.dvdsimple->isChecked() ) if( !ui.dvdsimple->isChecked() )
mrl = "dvd://" LOCALHOST; scheme = "dvd";
else else
mrl = "dvdsimple://" LOCALHOST; scheme = "dvdsimple";
} else if ( ui.bdRadioButton->isChecked() ) } else if ( ui.bdRadioButton->isChecked() )
mrl = "bluray://" LOCALHOST; scheme = "bluray";
/* VCD */ /* VCD */
else if ( ui.vcdRadioButton->isChecked() ) else if ( ui.vcdRadioButton->isChecked() )
mrl = "vcd://" LOCALHOST; scheme = "vcd";
/* CDDA */ /* CDDA */
else else
mrl = "cdda://" LOCALHOST; scheme = "cdda";
mrl += discPath; char *mrl = make_URI( qtu(discPath), scheme );
if( unlikely(mrl == NULL) )
return;
/* Title/chapter encoded in MRL */ /* Title/chapter encoded in MRL */
QString anchor = "";
if( ui.titleSpin->value() > 0 ) { if( ui.titleSpin->value() > 0 ) {
if( ui.dvdRadioButton->isChecked() || ui.bdRadioButton->isChecked() ) { if( ui.dvdRadioButton->isChecked() || ui.bdRadioButton->isChecked() ) {
mrl += QString("#%1").arg( ui.titleSpin->value() ); anchor = QString("#%1").arg( ui.titleSpin->value() );
if ( ui.chapterSpin->value() > 0 ) if ( ui.chapterSpin->value() > 0 )
mrl+= QString(":%1").arg( ui.chapterSpin->value() ); anchor += QString(":%1").arg( ui.chapterSpin->value() );
} }
else if ( ui.vcdRadioButton->isChecked() ) else if ( ui.vcdRadioButton->isChecked() )
mrl += QString("@%1").arg( ui.titleSpin->value() ); anchor = QString("#%1").arg( ui.titleSpin->value() );
} }
emit methodChanged( "disc-caching" ); emit methodChanged( "disc-caching" );
fileList << mrl; mrl = ""; fileList << (qfu(mrl) + anchor);
free(mrl);
QString opts = "";
/* Input item options */ /* Input item options */
if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() ) if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
{ {
if ( ui.audioSpin->value() >= 0 ) { if ( ui.audioSpin->value() >= 0 )
mrl += " :audio-track=" + opts += " :audio-track=" +
QString("%1").arg( ui.audioSpin->value() ); QString("%1").arg( ui.audioSpin->value() );
} if ( ui.subtitlesSpin->value() >= 0 )
if ( ui.subtitlesSpin->value() >= 0 ) { opts += " :sub-track=" +
mrl += " :sub-track=" +
QString("%1").arg( ui.subtitlesSpin->value() ); QString("%1").arg( ui.subtitlesSpin->value() );
} }
}
if( ui.audioCDRadioButton->isChecked() ) if( ui.audioCDRadioButton->isChecked() )
{ {
if( ui.titleSpin->value() > 0 ) if( ui.titleSpin->value() > 0 )
mrl += QString(" :cdda-track=%1").arg( ui.titleSpin->value() ); opts += QString(" :cdda-track=%1").arg( ui.titleSpin->value() );
} }
emit mrlUpdated( fileList, mrl ); emit mrlUpdated( fileList, opts );
} }
void DiscOpenPanel::browseDevice() void DiscOpenPanel::browseDevice()
......
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