Commit e599998a authored by Francois Cartegnie's avatar Francois Cartegnie Committed by Jean-Baptiste Kempf

Qt: simplify media filters

(cherry picked from commit 3ce16b37046b703afe9d7f4fdaa7388c570d8e91)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 3a2a485c
...@@ -401,21 +401,21 @@ QStringList DialogsProvider::showSimpleOpen( const QString& help, ...@@ -401,21 +401,21 @@ QStringList DialogsProvider::showSimpleOpen( const QString& help,
{ {
QString fileTypes = ""; QString fileTypes = "";
if( filters & EXT_FILTER_MEDIA ) { if( filters & EXT_FILTER_MEDIA ) {
ADD_FILTER_MEDIA( fileTypes ); ADD_EXT_FILTER( fileTypes, EXTENSIONS_MEDIA );
} }
if( filters & EXT_FILTER_VIDEO ) { if( filters & EXT_FILTER_VIDEO ) {
ADD_FILTER_VIDEO( fileTypes ); ADD_EXT_FILTER( fileTypes, EXTENSIONS_VIDEO );
} }
if( filters & EXT_FILTER_AUDIO ) { if( filters & EXT_FILTER_AUDIO ) {
ADD_FILTER_AUDIO( fileTypes ); ADD_EXT_FILTER( fileTypes, EXTENSIONS_AUDIO );
} }
if( filters & EXT_FILTER_PLAYLIST ) { if( filters & EXT_FILTER_PLAYLIST ) {
ADD_FILTER_PLAYLIST( fileTypes ); ADD_EXT_FILTER( fileTypes, EXTENSIONS_PLAYLIST );
} }
if( filters & EXT_FILTER_SUBTITLE ) { if( filters & EXT_FILTER_SUBTITLE ) {
ADD_FILTER_SUBTITLE( fileTypes ); ADD_EXT_FILTER( fileTypes, EXTENSIONS_SUBTITLE );
} }
ADD_FILTER_ALL( fileTypes ); ADD_EXT_FILTER( fileTypes, EXTENSIONS_ALL );
fileTypes.replace( ";*", " *"); fileTypes.replace( ";*", " *");
QStringList files = QFileDialog::getOpenFileNames( NULL, QStringList files = QFileDialog::getOpenFileNames( NULL,
......
...@@ -37,34 +37,17 @@ ...@@ -37,34 +37,17 @@
#include <QObject> #include <QObject>
#include <QStringList> #include <QStringList>
#define ADD_FILTER_MEDIA( string ) \ #define TITLE_EXTENSIONS_MEDIA qtr( "Media Files" )
string += qtr( "Media Files" ); \ #define TITLE_EXTENSIONS_VIDEO qtr( "Video Files" )
string += " ( "; \ #define TITLE_EXTENSIONS_AUDIO qtr( "Audio Files" )
string += EXTENSIONS_MEDIA; \ #define TITLE_EXTENSIONS_PLAYLIST qtr( "Playlist Files" )
string += ");;"; #define TITLE_EXTENSIONS_SUBTITLE qtr( "Subtitles Files" )
#define ADD_FILTER_VIDEO( string ) \ #define TITLE_EXTENSIONS_ALL qtr( "All Files" )
string += qtr( "Video Files" ); \ #define EXTENSIONS_ALL "*"
string += " ( "; \ #define ADD_EXT_FILTER( string, type ) \
string += EXTENSIONS_VIDEO; \ string = string + QString("%1 ( %2 );;") \
string += ");;"; .arg( TITLE_##type ) \
#define ADD_FILTER_AUDIO( string ) \ .arg( QString( type ) );
string += qtr( "Audio Files" ); \
string += " ( "; \
string += EXTENSIONS_AUDIO; \
string += ");;";
#define ADD_FILTER_PLAYLIST( string ) \
string += qtr( "Playlist Files" ); \
string += " ( "; \
string += EXTENSIONS_PLAYLIST; \
string += ");;";
#define ADD_FILTER_SUBTITLE( string ) \
string += qtr( "Subtitles Files" );\
string += " ( "; \
string += EXTENSIONS_SUBTITLE; \
string += ");;";
#define ADD_FILTER_ALL( string ) \
string += qtr( "All Files" ); \
string += " (*)";
enum { enum {
EXT_FILTER_MEDIA = 0x01, EXT_FILTER_MEDIA = 0x01,
......
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