qt: fix platform specific file dialog filters
Translations now only contain translation for the description and extensions are generated in code taking account platform specific differences.
This commit is contained in:
31
src/qt/qt_util.cpp
Normal file
31
src/qt/qt_util.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <QStringBuilder>
|
||||
#include <QStringList>
|
||||
#include "qt_util.hpp"
|
||||
|
||||
namespace util
|
||||
{
|
||||
|
||||
QString DlgFilter(std::initializer_list<QString> extensions, bool last)
|
||||
{
|
||||
QStringList temp;
|
||||
|
||||
for (auto ext : extensions)
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
if (ext == "*")
|
||||
{
|
||||
temp.append("*");
|
||||
continue;
|
||||
}
|
||||
temp.append("*." % ext.toUpper());
|
||||
#endif
|
||||
temp.append("*." % ext);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
temp.removeDuplicates();
|
||||
#endif
|
||||
return " (" % temp.join(' ') % ")" % (!last ? ";;" : "");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user