From 8b2769bb69d3d8e6780f389ae37d8f38f4f934b0 Mon Sep 17 00:00:00 2001 From: saker Date: Fri, 10 Nov 2023 18:45:25 -0500 Subject: [PATCH] Fix regression involving missed filters in #6962 (#6978) --- src/gui/FileBrowser.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/gui/FileBrowser.cpp b/src/gui/FileBrowser.cpp index 776ac0810b1..dc16a3bacc1 100644 --- a/src/gui/FileBrowser.cpp +++ b/src/gui/FileBrowser.cpp @@ -1456,15 +1456,27 @@ QString FileItem::extension(const QString & file ) QString FileItem::defaultFilters() { - // TODO: Supported extensions should be in a centralized location - auto simpleExtensions - = QString{"*.mmp *.mpt *.mmpz *.xpf *.xml *.xiz *.sf2 *.sf3 *.pat *.mid *.midi *.rmi *.dll *.lv2"}; + const auto projectFilters = QStringList{"*.mmp", "*.mpt", "*.mmpz"}; + const auto presetFilters = QStringList{"*.xpf", "*.xml", "*.xiz", "*.lv2"}; + const auto soundFontFilters = QStringList{"*.sf2", "*.sf3"}; + const auto patchFilters = QStringList{"*.pat"}; + const auto midiFilters = QStringList{"*.mid", "*.midi", "*.rmi"}; + + auto vstPluginFilters = QStringList{"*.dll"}; #ifdef LMMS_BUILD_LINUX - simpleExtensions += " *.so"; + vstPluginFilters.append("*.so"); +#endif + + auto audioFilters + = QStringList{"*.wav", "*.ogg", "*.ds", "*.flac", "*.spx", "*.voc", "*.aif", "*.aiff", "*.au", "*.raw"}; +#ifdef LMMS_HAVE_SNDFILE_MP3 + audioFilters.append("*.mp3"); #endif - auto audioExtensions = QString{"*.wav *.ogg *.ds *.flac *.spx *.voc *.aif *.aiff *.au *.raw *.wav *.ogg *.ds " - "*.flac *.spx *.voc *.aif *.aiff *.au *.raw"}; - return simpleExtensions + " " + audioExtensions; + + const auto extensions = projectFilters + presetFilters + soundFontFilters + patchFilters + midiFilters + + vstPluginFilters + audioFilters; + + return extensions.join(" "); }