Fix up file filters for filename fields of device configs for consistency

- Filter descriptions are now translatable
- Extensions get uppercase and lowercase variations on *nix
- Add "All files" option
This commit is contained in:
Alexander Babikov
2025-06-07 20:30:51 +05:00
parent 1c02441706
commit aa9976d5c6
3 changed files with 43 additions and 3 deletions

View File

@@ -92,6 +92,29 @@ DlgFilter(std::initializer_list<QString> extensions, bool last)
return " (" % temp.join(' ') % ")" % (!last ? ";;" : "");
}
QString
DlgFilter(QStringList 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 ? ";;" : "");
}
QString currentUuid()
{
auto configPath = QFileInfo(cfg_path).dir().canonicalPath();