Skip to content

Add placeholder name with extension to save dialog #2443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 24 additions & 23 deletions src/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
bool hasOpened=false;

String shortName;
String saveNameTemplate=String(DIR_SEPARATOR_STR)+_("example");
size_t shortNamePos=curFileName.rfind(DIR_SEPARATOR);
if (shortNamePos!=String::npos && (shortNamePos+1)<curFileName.size()) {
shortName=curFileName.substr(shortNamePos+1);
Expand Down Expand Up @@ -1805,7 +1806,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Save File"),
{_("Furnace song"), "*.fur"},
workingDirSong,
workingDirSong+saveNameTemplate+".fur",
dpiScale
);
break;
Expand All @@ -1814,7 +1815,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export DMF"),
{_("DefleMask 1.1.3 module"), "*.dmf"},
workingDirSong,
workingDirSong+saveNameTemplate+".dmf",
dpiScale,
(settings.autoFillSave)?shortName:""
);
Expand All @@ -1824,7 +1825,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export DMF"),
{_("DefleMask 1.0/legacy module"), "*.dmf"},
workingDirSong,
workingDirSong+saveNameTemplate+".dmf",
dpiScale,
(settings.autoFillSave)?shortName:""
);
Expand Down Expand Up @@ -1892,7 +1893,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Save Instrument"),
{_("Furnace instrument"), "*.fui"},
workingDirIns,
workingDirIns+saveNameTemplate+".fui",
dpiScale,
(settings.autoFillSave)?e->getIns(curIns)->name:""
);
Expand All @@ -1902,7 +1903,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Save Instrument"),
{_("DefleMask preset"), "*.dmp"},
workingDirIns,
workingDirIns+saveNameTemplate+".dmp",
dpiScale,
(settings.autoFillSave)?e->getIns(curIns)->name:""
);
Expand Down Expand Up @@ -1933,7 +1934,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Save Wavetable"),
{_("Furnace wavetable"), ".fuw"},
workingDirWave,
workingDirWave+saveNameTemplate+".fuw",
dpiScale
);
break;
Expand All @@ -1942,7 +1943,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Save Wavetable"),
{_("DefleMask wavetable"), ".dmw"},
workingDirWave,
workingDirWave+saveNameTemplate+".dmw",
dpiScale
);
break;
Expand All @@ -1951,7 +1952,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Save Wavetable"),
{_("raw data"), ".raw"},
workingDirWave,
workingDirWave+saveNameTemplate+".raw",
dpiScale
);
break;
Expand Down Expand Up @@ -1990,7 +1991,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Save Sample"),
{_("Wave file"), "*.wav"},
workingDirSample,
workingDirSample+saveNameTemplate+".wav",
dpiScale,
(settings.autoFillSave)?e->getSample(curSample)->name:""
);
Expand All @@ -2000,7 +2001,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Save Raw Sample"),
{_("all files"), "*"},
workingDirSample,
workingDirSample+saveNameTemplate,
dpiScale,
(settings.autoFillSave)?e->getSample(curSample)->name:""
);
Expand All @@ -2018,7 +2019,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export Audio"),
{_("Wave file"), "*.wav"},
workingDirAudioExport,
workingDirAudioExport+saveNameTemplate+".wav",
dpiScale,
(settings.autoFillSave)?shortName:""
);
Expand All @@ -2028,7 +2029,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export Audio"),
{_("Wave file"), "*.wav"},
workingDirAudioExport,
workingDirAudioExport+saveNameTemplate+".wav",
dpiScale,
(settings.autoFillSave)?shortName:""
);
Expand All @@ -2038,7 +2039,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export Audio"),
{_("Wave file"), "*.wav"},
workingDirAudioExport,
workingDirAudioExport+saveNameTemplate+".wav",
dpiScale,
(settings.autoFillSave)?shortName:""
);
Expand All @@ -2048,7 +2049,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export VGM"),
{_("VGM file"), "*.vgm"},
workingDirVGMExport,
workingDirVGMExport+saveNameTemplate+".vgm",
dpiScale,
(settings.autoFillSave)?shortName:""
);
Expand All @@ -2058,7 +2059,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export Command Stream"),
{_("text file"), "*.txt"},
workingDirROMExport,
workingDirROMExport+saveNameTemplate+".txt",
dpiScale,
(settings.autoFillSave)?shortName:""
);
Expand All @@ -2068,7 +2069,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export Command Stream"),
{_("binary file"), "*.bin"},
workingDirROMExport,
workingDirROMExport+saveNameTemplate+".bin",
dpiScale,
(settings.autoFillSave)?shortName:""
);
Expand All @@ -2085,7 +2086,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export ROM"),
{romFilterName, "*"+romFilterExt},
workingDirROMExport,
workingDirROMExport+saveNameTemplate+romFilterExt,
dpiScale,
(settings.autoFillSave)?shortName:""
);
Expand Down Expand Up @@ -2169,7 +2170,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export Colors"),
{_("configuration files"), "*.cfgc"},
workingDirColors,
workingDirColors+saveNameTemplate+".cfgc",
dpiScale
);
break;
Expand All @@ -2178,7 +2179,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export Keybinds"),
{_("configuration files"), "*.cfgk"},
workingDirKeybinds,
workingDirKeybinds+saveNameTemplate+".cfgk",
dpiScale
);
break;
Expand All @@ -2187,7 +2188,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export Layout"),
{_(".ini files"), "*.ini"},
workingDirLayout,
workingDirLayout+saveNameTemplate+".ini",
dpiScale
);
break;
Expand All @@ -2196,7 +2197,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export User Presets"),
{_("configuration files"), "*.cfgu"},
workingDirConfig,
workingDirConfig+saveNameTemplate+".cfgu",
dpiScale
);
break;
Expand All @@ -2205,7 +2206,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
hasOpened=fileDialog->openSave(
_("Export Settings"),
{_("configuration files"), "*.cfg"},
workingDirConfig,
workingDirConfig+saveNameTemplate+".cfg",
dpiScale
);
break;
Expand Down Expand Up @@ -2274,7 +2275,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
_("Save Test"),
{_("Furnace song"), "*.fur",
_("DefleMask module"), "*.dmf"},
workingDirTest,
workingDirTest+saveNameTemplate+".fur",
dpiScale
);
break;
Expand Down