Commit 885113ae authored by Yoann Peronneau's avatar Yoann Peronneau

* Use subtitles file extension filter for the "Open subtitles file" dialog.

parent 43caf180
...@@ -111,7 +111,7 @@ QStringList FileOpenPanel::browse(QString help) ...@@ -111,7 +111,7 @@ QStringList FileOpenPanel::browse(QString help)
void FileOpenPanel::browseFile() void FileOpenPanel::browseFile()
{ {
QString fileString = ""; QString fileString = "";
foreach( QString file, dialogBox->selectedFiles() ) { foreach( QString file, dialogBox->selectedFiles() ) {
fileString += "\"" + file + "\" "; fileString += "\"" + file + "\" ";
} }
ui.fileInput->setEditText( fileString ); ui.fileInput->setEditText( fileString );
...@@ -120,7 +120,11 @@ void FileOpenPanel::browseFile() ...@@ -120,7 +120,11 @@ void FileOpenPanel::browseFile()
void FileOpenPanel::browseFileSub() void FileOpenPanel::browseFileSub()
{ {
ui.subInput->setEditText( browse( qtr("Open subtitles file") ).join(" ") ); // FIXME We shouldn't allow the user to select more than one subtitles file
QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
false, false, false,
true, false );
ui.subInput->setEditText( files.join(" ") );
updateMRL(); updateMRL();
} }
......
...@@ -213,12 +213,15 @@ QStringList DialogsProvider::showSimpleOpen(QString help, bool all, ...@@ -213,12 +213,15 @@ QStringList DialogsProvider::showSimpleOpen(QString help, bool all,
if( pls ) { if( pls ) {
ADD_FILTER_PLAYLIST( fileTypes ); ADD_FILTER_PLAYLIST( fileTypes );
} }
if( subs ) {
ADD_FILTER_SUBTITLE( fileTypes );
}
ADD_FILTER_ALL( fileTypes ); ADD_FILTER_ALL( fileTypes );
fileTypes.replace(QString(";*"), QString(" *")); fileTypes.replace(QString(";*"), QString(" *"));
return QFileDialog::getOpenFileNames( NULL, return QFileDialog::getOpenFileNames( NULL,
help.isNull() ? help.isNull() ?
qfu(I_OP_SEL_FILES ) : help, qfu(I_OP_SEL_FILES ) : help,
qfu( p_intf->p_libvlc->psz_homedir ), qfu( p_intf->p_libvlc->psz_homedir ),
fileTypes ); fileTypes );
} }
......
...@@ -53,6 +53,11 @@ ...@@ -53,6 +53,11 @@
string += " ( "; \ string += " ( "; \
string += EXTENSIONS_PLAYLIST; \ string += EXTENSIONS_PLAYLIST; \
string += ");;"; string += ");;";
#define ADD_FILTER_SUBTITLE( string )\
string += _("Subtitles Files"); \
string += " ( "; \
string += EXTENSIONS_SUBTITLE; \
string += ");;";
#define ADD_FILTER_ALL( string ) \ #define ADD_FILTER_ALL( string ) \
string += _("All Files"); \ string += _("All Files"); \
string += " (*.*)"; string += " (*.*)";
...@@ -87,7 +92,7 @@ public: ...@@ -87,7 +92,7 @@ public:
QStringList showSimpleOpen( QString help = QString(), bool all = true, QStringList showSimpleOpen( QString help = QString(), bool all = true,
bool video = true, bool audio = true, bool video = true, bool audio = true,
bool subs = true, bool pls = true ); bool subs = false, bool pls = true );
protected: protected:
friend class QVLCMenu; friend class QVLCMenu;
QSignalMapper *menusMapper; QSignalMapper *menusMapper;
......
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