From 702ca98657be0c4ab9dd8a8c20c7f7f6e16396c7 Mon Sep 17 00:00:00 2001 From: cold-brewed Date: Fri, 2 Dec 2022 15:06:25 -0500 Subject: [PATCH 1/2] qt: Allow img suffix to be specified on macOS for removable image files. Fix path issue when manually typing image file names. --- src/qt/qt_newfloppydialog.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qt/qt_newfloppydialog.cpp b/src/qt/qt_newfloppydialog.cpp index 1cb81d2ce..57227c71d 100644 --- a/src/qt/qt_newfloppydialog.cpp +++ b/src/qt/qt_newfloppydialog.cpp @@ -25,6 +25,7 @@ #include "qt_util.hpp" extern "C" { +#include <86box/86box.h> #include <86box/plat.h> #include <86box/random.h> #include <86box/scsi_device.h> @@ -130,20 +131,20 @@ NewFloppyDialog::NewFloppyDialog(MediaType type, QWidget *parent) Models::AddEntry(model, tr(floppyTypes[i].toUtf8().data()), i); } ui->fileField->setFilter( - tr("All images") % util::DlgFilter({ "86f", "dsk", "flp", "im?", "*fd?" }) % tr("Basic sector images") % util::DlgFilter({ "dsk", "flp", "im?", "img", "*fd?" }) % tr("Surface images") % util::DlgFilter({ "86f" }, true)); + tr("All images") % util::DlgFilter({ "86f", "dsk", "flp", "im?", "img", "*fd?" }) % tr("Basic sector images") % util::DlgFilter({ "dsk", "flp", "im?", "img", "*fd?" }) % tr("Surface images") % util::DlgFilter({ "86f" }, true)); break; case MediaType::Zip: for (int i = 0; i < zipTypes.size(); ++i) { Models::AddEntry(model, tr(zipTypes[i].toUtf8().data()), i); } - ui->fileField->setFilter(tr("ZIP images") % util::DlgFilter({ "im?", "zdi" }, true)); + ui->fileField->setFilter(tr("ZIP images") % util::DlgFilter({ "im?", "img", "zdi" }, true)); break; case MediaType::Mo: for (int i = 0; i < moTypes.size(); ++i) { Models::AddEntry(model, tr(moTypes[i].toUtf8().data()), i); } - ui->fileField->setFilter(tr("MO images") % util::DlgFilter({ "im?", "mdi" }) % tr("All files") % util::DlgFilter({ "*" }, true)); + ui->fileField->setFilter(tr("MO images") % util::DlgFilter({ "im?", "img", "mdi" }) % tr("All files") % util::DlgFilter({ "*" }, true)); break; } @@ -185,6 +186,8 @@ NewFloppyDialog::onCreate() { auto filename = ui->fileField->fileName(); QFileInfo fi(filename); + filename = (fi.isRelative() && !fi.filePath().isEmpty()) ? usr_path + fi.filePath() : fi.filePath(); + ui->fileField->setFileName(filename); FileType fileType; QProgressDialog progress("Creating floppy image", QString(), 0, 100, this); From ae60078d26f5770c04bef792c2548870391b5b26 Mon Sep 17 00:00:00 2001 From: cold-brewed Date: Fri, 2 Dec 2022 17:26:58 -0500 Subject: [PATCH 2/2] Add some parens to the ternary --- src/qt/qt_newfloppydialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_newfloppydialog.cpp b/src/qt/qt_newfloppydialog.cpp index 57227c71d..a445c47d3 100644 --- a/src/qt/qt_newfloppydialog.cpp +++ b/src/qt/qt_newfloppydialog.cpp @@ -186,7 +186,7 @@ NewFloppyDialog::onCreate() { auto filename = ui->fileField->fileName(); QFileInfo fi(filename); - filename = (fi.isRelative() && !fi.filePath().isEmpty()) ? usr_path + fi.filePath() : fi.filePath(); + filename = (fi.isRelative() && !fi.filePath().isEmpty()) ? (usr_path + fi.filePath()) : fi.filePath(); ui->fileField->setFileName(filename); FileType fileType;