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

* use an int to select extension filters

parent 78d552dd
......@@ -55,7 +55,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
fileTypes.replace(QString(";*"), QString(" *"));
// Make this QFileDialog a child of tempWidget from the ui.
dialogBox = new QFileDialog( ui.tempWidget, NULL,
dialogBox = new QFileDialog( ui.tempWidget, NULL,
qfu( p_intf->p_libvlc->psz_homedir ), fileTypes );
dialogBox->setFileMode( QFileDialog::ExistingFiles );
/* We don't want to see a grip in the middle of the window, do we? */
......@@ -120,10 +120,9 @@ void FileOpenPanel::browseFile()
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"),
false, false, false,
true, false );
EXT_FILTER_SUBTITLE );
ui.subInput->setEditText( files.join(" ") );
updateMRL();
}
......
......@@ -195,25 +195,22 @@ void DialogsProvider::MLAppendDialog()
}
/**** Simple open ****/
QStringList DialogsProvider::showSimpleOpen(QString help, bool all,
bool audio, bool video,
bool subs, bool pls)
QStringList DialogsProvider::showSimpleOpen( QString help, int filters )
{
QString fileTypes = "";
if( all ) {
if( filters & EXT_FILTER_MEDIA ) {
ADD_FILTER_MEDIA( fileTypes );
}
if( video ) {
if( filters & EXT_FILTER_VIDEO ) {
ADD_FILTER_VIDEO( fileTypes );
}
if( audio ) {
if( filters & EXT_FILTER_AUDIO ) {
ADD_FILTER_AUDIO( fileTypes );
}
if( pls ) {
if( filters & EXT_FILTER_PLAYLIST ) {
ADD_FILTER_PLAYLIST( fileTypes );
}
if( subs ) {
if( filters & EXT_FILTER_SUBTITLE ) {
ADD_FILTER_SUBTITLE( fileTypes );
}
ADD_FILTER_ALL( fileTypes );
......@@ -259,8 +256,8 @@ void DialogsProvider::simpleOpenDialog()
void DialogsProvider::openPlaylist()
{
QStringList files = showSimpleOpen( qtr( "Open playlist file" ), false,
false, false, false );
QStringList files = showSimpleOpen( qtr( "Open playlist file" ),
EXT_FILTER_PLAYLIST );
foreach( QString file, files )
{
playlist_Import( THEPL, qtu(file) );
......
......@@ -33,6 +33,12 @@
#include <vlc/vlc.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 ) \
string += _("Media Files"); \
string += " ( "; \
......@@ -90,9 +96,10 @@ public:
virtual ~DialogsProvider();
QTimer *fixed_timer;
QStringList showSimpleOpen( QString help = QString(), bool all = true,
bool video = true, bool audio = true,
bool subs = false, bool pls = true );
QStringList showSimpleOpen( QString help = QString(),
int filters = EXT_FILTER_MEDIA |
EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
EXT_FILTER_PLAYLIST );
protected:
friend class QVLCMenu;
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