Commit 96f22ac4 authored by Yoann Peronneau's avatar Yoann Peronneau

* use an int to select extension filters

parent 78d552dd
...@@ -120,10 +120,9 @@ void FileOpenPanel::browseFile() ...@@ -120,10 +120,9 @@ void FileOpenPanel::browseFile()
void FileOpenPanel::browseFileSub() void FileOpenPanel::browseFileSub()
{ {
// FIXME We shouldn't allow the user to select more than one subtitles file // FIXME Handle selection of more than one subtitles file
QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"), QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
false, false, false, EXT_FILTER_SUBTITLE );
true, false );
ui.subInput->setEditText( files.join(" ") ); ui.subInput->setEditText( files.join(" ") );
updateMRL(); updateMRL();
} }
......
...@@ -195,25 +195,22 @@ void DialogsProvider::MLAppendDialog() ...@@ -195,25 +195,22 @@ void DialogsProvider::MLAppendDialog()
} }
/**** Simple open ****/ /**** Simple open ****/
QStringList DialogsProvider::showSimpleOpen( QString help, int filters )
QStringList DialogsProvider::showSimpleOpen(QString help, bool all,
bool audio, bool video,
bool subs, bool pls)
{ {
QString fileTypes = ""; QString fileTypes = "";
if( all ) { if( filters & EXT_FILTER_MEDIA ) {
ADD_FILTER_MEDIA( fileTypes ); ADD_FILTER_MEDIA( fileTypes );
} }
if( video ) { if( filters & EXT_FILTER_VIDEO ) {
ADD_FILTER_VIDEO( fileTypes ); ADD_FILTER_VIDEO( fileTypes );
} }
if( audio ) { if( filters & EXT_FILTER_AUDIO ) {
ADD_FILTER_AUDIO( fileTypes ); ADD_FILTER_AUDIO( fileTypes );
} }
if( pls ) { if( filters & EXT_FILTER_PLAYLIST ) {
ADD_FILTER_PLAYLIST( fileTypes ); ADD_FILTER_PLAYLIST( fileTypes );
} }
if( subs ) { if( filters & EXT_FILTER_SUBTITLE ) {
ADD_FILTER_SUBTITLE( fileTypes ); ADD_FILTER_SUBTITLE( fileTypes );
} }
ADD_FILTER_ALL( fileTypes ); ADD_FILTER_ALL( fileTypes );
...@@ -259,8 +256,8 @@ void DialogsProvider::simpleOpenDialog() ...@@ -259,8 +256,8 @@ void DialogsProvider::simpleOpenDialog()
void DialogsProvider::openPlaylist() void DialogsProvider::openPlaylist()
{ {
QStringList files = showSimpleOpen( qtr( "Open playlist file" ), false, QStringList files = showSimpleOpen( qtr( "Open playlist file" ),
false, false, false ); EXT_FILTER_PLAYLIST );
foreach( QString file, files ) foreach( QString file, files )
{ {
playlist_Import( THEPL, qtu(file) ); playlist_Import( THEPL, qtu(file) );
......
...@@ -33,6 +33,12 @@ ...@@ -33,6 +33,12 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#define EXT_FILTER_MEDIA 0x01
#define EXT_FILTER_VIDEO 0x02
#define EXT_FILTER_AUDIO 0x04
#define EXT_FILTER_PLAYLIST 0x08
#define EXT_FILTER_SUBTITLE 0x10
#define ADD_FILTER_MEDIA( string ) \ #define ADD_FILTER_MEDIA( string ) \
string += _("Media Files"); \ string += _("Media Files"); \
string += " ( "; \ string += " ( "; \
...@@ -90,9 +96,10 @@ public: ...@@ -90,9 +96,10 @@ public:
virtual ~DialogsProvider(); virtual ~DialogsProvider();
QTimer *fixed_timer; QTimer *fixed_timer;
QStringList showSimpleOpen( QString help = QString(), bool all = true, QStringList showSimpleOpen( QString help = QString(),
bool video = true, bool audio = true, int filters = EXT_FILTER_MEDIA |
bool subs = false, bool pls = true ); EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
EXT_FILTER_PLAYLIST );
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