Apply name filter if export file lacks extension#8212
Apply name filter if export file lacks extension#8212sakertooth wants to merge 4 commits intoLMMS:masterfrom
Conversation
|
Works fine for me in most cases. Only exception is when there is a file without any extensions with the same name (saving, for example, file diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
index 44ff2a687..714e06ebf 100644
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -1467,6 +1467,7 @@ void MainWindow::exportProject(bool multiExport)
efd.setFileMode(FileDialog::AnyFile);
efd.setAcceptMode(FileDialog::AcceptSave);
+ efd.setOptions(FileDialog::DontConfirmOverwrite);
efd.setNameFilters(types);
efd.setWindowTitle(tr("Select file for project-export..."));
@@ -1484,14 +1485,14 @@ void MainWindow::exportProject(bool multiExport)
exportFileName += device.m_extension;
break;
}
+ }
- // The file with the extension from the name filter might exist, so ask the user if they want to replace
- // it and back out if they do not
- if (QFile::exists(exportFileName)
- && !VersionedSaveDialog::fileExistsQuery(exportFileName, tr("Save project")))
- {
- return;
- }
+ // The file with the extension from the name filter might exist, so ask the user if they want to replace
+ // it and back out if they do not
+ if (QFile::exists(exportFileName)
+ && !VersionedSaveDialog::fileExistsQuery(exportFileName, tr("Save project")))
+ {
+ return;
}
auto epd = ExportProjectDialog{exportFileName, getGUI()->mainWindow(), multiExport}; |
But if they did actually mean to overwrite to |
|
What if we could change in the settings whether we want ALWAYS wav or OGG or MP3 formats? Maybe that feature could be in the settings, and then you would choose whether I want to always choose WAV first or OGG first |
|
That's a good idea, but I'd say that's not something that should be in this PR. |
When exporting the project, if no extension is specified in the filename, LMMS defaults to using
.wav. It would be much better for it to use the selected name filter's extension as a fallback if no extension is in the filename. This PR does exactly that. I also refactored the stuff since it was confusing (it intermingled multi export and non multi export code together).Note: There is another slightly related bug, where if the file format combobox changes to a new format and the filename already has an extension, the extension associated with the selected file format is appended to it instead of being changed accordingly. This should be looked into and fixed later.
Fixes #8205.