GUI: options to import/export user presets
This commit is contained in:
parent
e7b0130e5c
commit
0ad7863d78
4 changed files with 114 additions and 11 deletions
|
|
@ -1961,11 +1961,30 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
|||
);
|
||||
break;
|
||||
case GUI_FILE_IMPORT_LAYOUT:
|
||||
if (!dirExists(workingDirKeybinds)) workingDirKeybinds=getHomeDir();
|
||||
if (!dirExists(workingDirLayout)) workingDirLayout=getHomeDir();
|
||||
hasOpened=fileDialog->openLoad(
|
||||
"Select Layout File",
|
||||
{".ini files", "*.ini"},
|
||||
workingDirKeybinds,
|
||||
workingDirLayout,
|
||||
dpiScale
|
||||
);
|
||||
break;
|
||||
case GUI_FILE_IMPORT_USER_PRESETS:
|
||||
case GUI_FILE_IMPORT_USER_PRESETS_REPLACE:
|
||||
if (!dirExists(workingDirConfig)) workingDirConfig=getHomeDir();
|
||||
hasOpened=fileDialog->openLoad(
|
||||
"Select User Presets File",
|
||||
{"configuration files", "*.cfgu"},
|
||||
workingDirConfig,
|
||||
dpiScale
|
||||
);
|
||||
break;
|
||||
case GUI_FILE_IMPORT_CONFIG:
|
||||
if (!dirExists(workingDirConfig)) workingDirConfig=getHomeDir();
|
||||
hasOpened=fileDialog->openLoad(
|
||||
"Select Settings File",
|
||||
{"configuration files", "*.cfg"},
|
||||
workingDirConfig,
|
||||
dpiScale
|
||||
);
|
||||
break;
|
||||
|
|
@ -1988,11 +2007,29 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
|||
);
|
||||
break;
|
||||
case GUI_FILE_EXPORT_LAYOUT:
|
||||
if (!dirExists(workingDirKeybinds)) workingDirKeybinds=getHomeDir();
|
||||
if (!dirExists(workingDirLayout)) workingDirLayout=getHomeDir();
|
||||
hasOpened=fileDialog->openSave(
|
||||
"Export Layout",
|
||||
{".ini files", "*.ini"},
|
||||
workingDirKeybinds,
|
||||
workingDirLayout,
|
||||
dpiScale
|
||||
);
|
||||
break;
|
||||
case GUI_FILE_EXPORT_USER_PRESETS:
|
||||
if (!dirExists(workingDirConfig)) workingDirConfig=getHomeDir();
|
||||
hasOpened=fileDialog->openSave(
|
||||
"Export User Presets",
|
||||
{"configuration files", "*.cfgu"},
|
||||
workingDirConfig,
|
||||
dpiScale
|
||||
);
|
||||
break;
|
||||
case GUI_FILE_EXPORT_CONFIG:
|
||||
if (!dirExists(workingDirConfig)) workingDirConfig=getHomeDir();
|
||||
hasOpened=fileDialog->openSave(
|
||||
"Export Settings",
|
||||
{"configuration files", "*.cfg"},
|
||||
workingDirConfig,
|
||||
dpiScale
|
||||
);
|
||||
break;
|
||||
|
|
@ -4852,6 +4889,13 @@ bool FurnaceGUI::loop() {
|
|||
case GUI_FILE_EXPORT_LAYOUT:
|
||||
workingDirLayout=fileDialog->getPath()+DIR_SEPARATOR_STR;
|
||||
break;
|
||||
case GUI_FILE_IMPORT_USER_PRESETS:
|
||||
case GUI_FILE_IMPORT_USER_PRESETS_REPLACE:
|
||||
case GUI_FILE_EXPORT_USER_PRESETS:
|
||||
case GUI_FILE_IMPORT_CONFIG:
|
||||
case GUI_FILE_EXPORT_CONFIG:
|
||||
workingDirConfig=fileDialog->getPath()+DIR_SEPARATOR_STR;
|
||||
break;
|
||||
case GUI_FILE_YRW801_ROM_OPEN:
|
||||
case GUI_FILE_TG100_ROM_OPEN:
|
||||
case GUI_FILE_MU5_ROM_OPEN:
|
||||
|
|
@ -4937,6 +4981,12 @@ bool FurnaceGUI::loop() {
|
|||
if (curFileDialog==GUI_FILE_EXPORT_LAYOUT) {
|
||||
checkExtension(".ini");
|
||||
}
|
||||
if (curFileDialog==GUI_FILE_EXPORT_USER_PRESETS) {
|
||||
checkExtension(".cfgu");
|
||||
}
|
||||
if (curFileDialog==GUI_FILE_EXPORT_CONFIG) {
|
||||
checkExtension(".cfg");
|
||||
}
|
||||
String copyOfName=fileName;
|
||||
switch (curFileDialog) {
|
||||
case GUI_FILE_OPEN:
|
||||
|
|
@ -5361,6 +5411,19 @@ bool FurnaceGUI::loop() {
|
|||
case GUI_FILE_IMPORT_LAYOUT:
|
||||
importLayout(copyOfName);
|
||||
break;
|
||||
case GUI_FILE_IMPORT_USER_PRESETS:
|
||||
if (!loadUserPresets(false,copyOfName,true)) {
|
||||
showError("could not import user presets!");
|
||||
}
|
||||
break;
|
||||
case GUI_FILE_IMPORT_USER_PRESETS_REPLACE:
|
||||
if (!loadUserPresets(false,copyOfName,false)) {
|
||||
showError(fmt::sprintf("could not import user presets! (%s)",strerror(errno)));
|
||||
}
|
||||
break;
|
||||
case GUI_FILE_IMPORT_CONFIG:
|
||||
importConfig(copyOfName);
|
||||
break;
|
||||
case GUI_FILE_EXPORT_COLORS:
|
||||
exportColors(copyOfName);
|
||||
break;
|
||||
|
|
@ -5370,6 +5433,14 @@ bool FurnaceGUI::loop() {
|
|||
case GUI_FILE_EXPORT_LAYOUT:
|
||||
exportLayout(copyOfName);
|
||||
break;
|
||||
case GUI_FILE_EXPORT_USER_PRESETS:
|
||||
if (!saveUserPresets(false,copyOfName)) {
|
||||
showError(fmt::sprintf("could not import user presets! (%s)",strerror(errno)));
|
||||
}
|
||||
break;
|
||||
case GUI_FILE_EXPORT_CONFIG:
|
||||
exportConfig(copyOfName);
|
||||
break;
|
||||
case GUI_FILE_YRW801_ROM_OPEN:
|
||||
settings.yrw801Path=copyOfName;
|
||||
break;
|
||||
|
|
@ -6614,6 +6685,7 @@ bool FurnaceGUI::init() {
|
|||
workingDirColors=e->getConfString("lastDirColors",workingDir);
|
||||
workingDirKeybinds=e->getConfString("lastDirKeybinds",workingDir);
|
||||
workingDirLayout=e->getConfString("lastDirLayout",workingDir);
|
||||
workingDirConfig=e->getConfString("lastDirConfig",workingDir);
|
||||
workingDirTest=e->getConfString("lastDirTest",workingDir);
|
||||
|
||||
editControlsOpen=e->getConfBool("editControlsOpen",true);
|
||||
|
|
@ -7173,6 +7245,7 @@ void FurnaceGUI::commitState() {
|
|||
e->setConf("lastDirColors",workingDirColors);
|
||||
e->setConf("lastDirKeybinds",workingDirKeybinds);
|
||||
e->setConf("lastDirLayout",workingDirLayout);
|
||||
e->setConf("lastDirConfig",workingDirConfig);
|
||||
e->setConf("lastDirTest",workingDirTest);
|
||||
|
||||
// commit last open windows
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue