Commit 3ce16b37 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: simplify media filters

parent f1790cf4
......@@ -401,21 +401,21 @@ QStringList DialogsProvider::showSimpleOpen( const QString& help,
{
QString fileTypes = "";
if( filters & EXT_FILTER_MEDIA ) {
ADD_FILTER_MEDIA( fileTypes );
ADD_EXT_FILTER( fileTypes, EXTENSIONS_MEDIA );
}
if( filters & EXT_FILTER_VIDEO ) {
ADD_FILTER_VIDEO( fileTypes );
ADD_EXT_FILTER( fileTypes, EXTENSIONS_VIDEO );
}
if( filters & EXT_FILTER_AUDIO ) {
ADD_FILTER_AUDIO( fileTypes );
ADD_EXT_FILTER( fileTypes, EXTENSIONS_AUDIO );
}
if( filters & EXT_FILTER_PLAYLIST ) {
ADD_FILTER_PLAYLIST( fileTypes );
ADD_EXT_FILTER( fileTypes, EXTENSIONS_PLAYLIST );
}
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( ";*", " *");
QStringList files = QFileDialog::getOpenFileNames( NULL,
......
......@@ -37,34 +37,17 @@
#include <QObject>
#include <QStringList>
#define ADD_FILTER_MEDIA( string ) \
string += qtr( "Media Files" ); \
string += " ( "; \
string += EXTENSIONS_MEDIA; \
string += ");;";
#define ADD_FILTER_VIDEO( string ) \
string += qtr( "Video Files" ); \
string += " ( "; \
string += EXTENSIONS_VIDEO; \
string += ");;";
#define ADD_FILTER_AUDIO( string ) \
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 += " (*)";
#define TITLE_EXTENSIONS_MEDIA qtr( "Media Files" )
#define TITLE_EXTENSIONS_VIDEO qtr( "Video Files" )
#define TITLE_EXTENSIONS_AUDIO qtr( "Audio Files" )
#define TITLE_EXTENSIONS_PLAYLIST qtr( "Playlist Files" )
#define TITLE_EXTENSIONS_SUBTITLE qtr( "Subtitles Files" )
#define TITLE_EXTENSIONS_ALL qtr( "All Files" )
#define EXTENSIONS_ALL "*"
#define ADD_EXT_FILTER( string, type ) \
string = string + QString("%1 ( %2 );;") \
.arg( TITLE_##type ) \
.arg( QString( type ) );
enum {
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