1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-01-18 06:48:23 +01:00

Added TomahawkUtils::supportedExtensions, returning all supported file-extensions.

This commit is contained in:
Christian Muehlhaeuser 2014-09-09 14:59:44 +02:00
parent 42162f6c99
commit 02b7ff875b
2 changed files with 32 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
@ -317,6 +317,34 @@ filesizeToString( unsigned int size )
}
QStringList
supportedExtensions()
{
//TODO supportedExtensions() and extensionToMimetype could share a QMap
//TODO and this method should just return map.keys()
static QStringList s_extensions;
if ( s_extensions.isEmpty() )
{
s_extensions << "mp3"
<< "ogg" << "oga"
<< "mpc"
<< "wma"
<< "aac" << "m4a" << "mp4"
<< "flac"
<< "aiff" << "aif"
<< "wv";
#if defined(TAGLIB_MAJOR_VERSION) && defined(TAGLIB_MINOR_VERSION)
#if TAGLIB_MAJOR_VERSION >= 1 && TAGLIB_MINOR_VERSION >= 9
s_extensions << "opus";
#endif
#endif
}
return s_extensions;
}
QString
extensionToMimetype( const QString& extension )
{

View File

@ -153,9 +153,11 @@ namespace TomahawkUtils
DLLEXPORT QString timeToString( int seconds );
DLLEXPORT QString ageToString( const QDateTime& time, bool appendAgoString = false );
DLLEXPORT QString filesizeToString( unsigned int size );
DLLEXPORT QString extensionToMimetype( const QString& extension );
DLLEXPORT QByteArray percentEncode( const QUrl& url );
DLLEXPORT QStringList supportedExtensions();
DLLEXPORT QString extensionToMimetype( const QString& extension );
DLLEXPORT void msleep( unsigned int ms );
DLLEXPORT bool newerVersion( const QString& oldVersion, const QString& newVersion );
DLLEXPORT int levenshtein( const QString& source, const QString& target );