diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index d0836e5f2..f238341c5 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -2053,6 +2053,7 @@ escp_close(void *priv) free(dev->page); } + FT_Done_Face(dev->fontface); free(dev); } diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index af427d670..19975c2c9 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -2194,4 +2194,13 @@ msgid "Toggle pause" msgstr "Переключить паузу" msgid "Toggle mute" -msgstr "Переключить беззвучный режим" \ No newline at end of file +msgstr "Переключить беззвучный режим" + +msgid "Text files" +msgstr "Текстовые файлы" + +msgid "ROM files" +msgstr "Файлы ПЗУ" + +msgid "SoundFont files" +msgstr "Файлы SoundFont" diff --git a/src/qt/qt_deviceconfig.cpp b/src/qt/qt_deviceconfig.cpp index 54923be06..255b3c39f 100644 --- a/src/qt/qt_deviceconfig.cpp +++ b/src/qt/qt_deviceconfig.cpp @@ -31,6 +31,7 @@ #include #include #include +#include extern "C" { #include <86box/86box.h> @@ -45,6 +46,7 @@ extern "C" { #include "qt_filefield.hpp" #include "qt_models_common.hpp" +#include "qt_util.hpp" #ifdef Q_OS_LINUX # include # include @@ -276,11 +278,25 @@ DeviceConfig::ProcessConfig(void *dc, const void *c, const bool is_dep) } case CONFIG_FNAME: { - auto *fileField = new FileField(); + auto *fileField = new FileField(this); fileField->setObjectName(config->name); fileField->setFileName(selected); - fileField->setFilter(QString(config->file_filter).left(static_cast(strcspn(config->file_filter, - "|")))); + /* Get the actually used part of the filter */ + QString filter = QString(config->file_filter).left(static_cast(strcspn(config->file_filter, "|"))); + /* Extract the description and the extension list */ + QRegularExpressionMatch match = QRegularExpression("(.+) \\((.+)\\)$").match(filter); + QString description = match.captured(1); + QString extensions = match.captured(2); + QStringList extensionList; + /* Split the extension list up and strip the filename globs */ + QRegularExpression re("\\*\\.(.*)"); + int i = 0; + while (extensions.section(' ', i, i) != "") { + QString extension = re.match(extensions.section(' ', i, i)).captured(1); + extensionList.append(extension); + i++; + } + fileField->setFilter(tr(description.toUtf8().constData()) % util::DlgFilter(extensionList) % tr("All files") % util::DlgFilter({ "*" }, true)); this->ui->formLayout->addRow(tr(config->description), fileField); break; } diff --git a/src/qt/qt_util.cpp b/src/qt/qt_util.cpp index 0c78c2f5e..5baaaaacf 100644 --- a/src/qt/qt_util.cpp +++ b/src/qt/qt_util.cpp @@ -92,6 +92,29 @@ DlgFilter(std::initializer_list 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(); diff --git a/src/qt/qt_util.hpp b/src/qt/qt_util.hpp index 9432610b6..e0d2648d0 100644 --- a/src/qt/qt_util.hpp +++ b/src/qt/qt_util.hpp @@ -11,6 +11,7 @@ namespace util { static constexpr auto UUID_MIN_LENGTH = 36; /* Creates extension list for qt filedialog */ QString DlgFilter(std::initializer_list extensions, bool last = false); +QString DlgFilter(QStringList extensions, bool last = false); /* Returns screen the widget is on */ QScreen *screenOfWidget(QWidget *widget); #ifdef Q_OS_WINDOWS diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 027c85b79..1afefd905 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -161,6 +161,7 @@ fluidsynth_init(UNUSED(const device_t *info)) fluid_settings_setnum(data->settings, "synth.sample-rate", 44100); fluid_settings_setnum(data->settings, "synth.gain", device_get_config_int("output_gain") / 100.0f); + fluid_settings_setint(data->settings, "synth.dynamic-sample-loading", device_get_config_int("dynamic_sample_loading")); data->synth = new_fluid_synth(data->settings); @@ -324,7 +325,7 @@ static const device_config_t fluidsynth_config[] = { .type = CONFIG_FNAME, .default_string = NULL, .default_int = 0, - .file_filter = "SF2 Sound Fonts (*.sf2)|*.sf2", + .file_filter = "SoundFont files (*.sf2 *.sf3)|*.sf2,*.sf3", .spinner = { 0 }, .selection = { { 0 } }, .bios = { { 0 } } @@ -509,6 +510,17 @@ static const device_config_t fluidsynth_config[] = { }, .bios = { { 0 } } }, + { + .name = "dynamic_sample_loading", + .description = "Dynamic Sample Loading", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, { .name = "", .description = "", .type = CONFIG_END } // clang-format on };