Add reset confirmations to Configurator,

Change location of some menu items.
This commit is contained in:
icenine451 2023-03-23 12:38:19 -04:00
parent 5de3e6db6b
commit 51b03094b5
2 changed files with 120 additions and 41 deletions

View file

@ -1379,3 +1379,17 @@ configurator_destination_choice_dialog() {
echo $choice echo $choice
} }
configurator_reset_confirmation_dialog() {
# This dialog provides a confirmation for any reset functions, before the reset is actually performed.
# USAGE: $(configurator_reset_confirmation_dialog "emulator being reset" "action text")
# This function will return a "true" if the user clicks Confirm, and "false" if they click Cancel.
choice=$(zenity --title "RetroDECK Configurator Utility - Reset $1" --question --no-wrap --cancel-label="Cancel" --ok-label="Confirm" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--text="$2")
if [[ $? == "0" ]]; then
echo "true"
else
echo "false"
fi
}

View file

@ -62,7 +62,7 @@ configurator_reset_dialog() {
--column="Choice" --column="Action" \ --column="Choice" --column="Action" \
"Reset Specific Emulator" "Reset only one specific emulator to default settings" \ "Reset Specific Emulator" "Reset only one specific emulator to default settings" \
"Reset All Emulators" "Reset all emulators to default settings" \ "Reset All Emulators" "Reset all emulators to default settings" \
"Reset All" "Reset RetroDECK to default settings" ) "Reset RetroDECK" "Reset RetroDECK to default settings" )
case $choice in case $choice in
@ -87,58 +87,113 @@ configurator_reset_dialog() {
case $emulator_to_reset in case $emulator_to_reset in
"RetroArch" ) "RetroArch" )
ra_init if [[ $(configurator_reset_confirmation_dialog "RetroArch" "Are you sure you want to reset the RetroArch emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
configurator_process_complete_dialog "resetting $emulator_to_reset" ra_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"Citra" ) "Citra" )
citra_init if [[ $(configurator_reset_confirmation_dialog "Citra" "Are you sure you want to reset the Citra emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
configurator_process_complete_dialog "resetting $emulator_to_reset" citra_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"Dolphin" ) "Dolphin" )
dolphin_init if [[ $(configurator_reset_confirmation_dialog "Dolphin" "Are you sure you want to reset the Dolphin emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
configurator_process_complete_dialog "resetting $emulator_to_reset" dolphin_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"Duckstation" ) "Duckstation" )
duckstation_init if [[ $(configurator_reset_confirmation_dialog "Duckstation" "Are you sure you want to reset the Duckstation emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
configurator_process_complete_dialog "resetting $emulator_to_reset" duckstation_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"MelonDS" ) "MelonDS" )
melonds_init if [[ $(configurator_reset_confirmation_dialog "MelonDS" "Are you sure you want to reset the MelonDS emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
configurator_process_complete_dialog "resetting $emulator_to_reset" melonds_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"PCSX2" ) "PCSX2" )
pcsx2_init if [[ $(configurator_reset_confirmation_dialog "PCSX2" "Are you sure you want to reset the PCSX2 emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
configurator_process_complete_dialog "resetting $emulator_to_reset" pcsx2_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"PPSSPP" ) "PPSSPP" )
ppssppsdl_init if [[ $(configurator_reset_confirmation_dialog "PPSSPP" "Are you sure you want to reset the PPSSPP emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
configurator_process_complete_dialog "resetting $emulator_to_reset" ppssppsdl_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"Primehack" ) "Primehack" )
primehack_init if [[ $(configurator_reset_confirmation_dialog "Primehack" "Are you sure you want to reset the Primehack emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
configurator_process_complete_dialog "resetting $emulator_to_reset" primehack_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"RPCS3" ) "RPCS3" )
rpcs3_init if [[ $(configurator_reset_confirmation_dialog "RPCS3" "Are you sure you want to reset the RPCS3 emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
configurator_process_complete_dialog "resetting $emulator_to_reset" rpcs3_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"XEMU" ) "XEMU" )
xemu_init if [[ $(configurator_reset_confirmation_dialog "XEMU" "Are you sure you want to reset the XEMU emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
configurator_process_complete_dialog "resetting $emulator_to_reset" xemu_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"Yuzu" ) "Yuzu" )
yuzu_init if [[ $(configurator_reset_confirmation_dialog "Yuzu" "Are you sure you want to reset the Yuzu emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
configurator_process_complete_dialog "resetting $emulator_to_reset" yuzu_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"" ) # No selection made or Back button clicked "" ) # No selection made or Back button clicked
@ -149,19 +204,29 @@ configurator_reset_dialog() {
;; ;;
"Reset All Emulators" ) "Reset All Emulators" )
ra_init if [[ $(configurator_reset_confirmation_dialog "all emulators" "Are you sure you want to reset all emulators to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
standalones_init ra_init
configurator_process_complete_dialog "resetting all emulators" standalones_init
configurator_process_complete_dialog "resetting all emulators"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"Reset All" ) "Reset RetroDECK" )
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ if [[ $(configurator_reset_confirmation_dialog "RetroDECK" "Are you sure you want to reset RetroDECK entirely?\n\nThis process cannot be undone.") == "true" ]]; then
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
--title "RetroDECK Configurator Utility - Reset RetroDECK" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--text="You are resetting RetroDECK to its default state.\n\nAfter the process is complete you will need to exit RetroDECK and run it again, where you will go through the initial setup process." --title "RetroDECK Configurator Utility - Reset RetroDECK" \
rm -f "$lockfile" --text="You are resetting RetroDECK to its default state.\n\nAfter the process is complete you will need to exit RetroDECK and run it again, where you will go through the initial setup process."
rm -f "$rd_conf" rm -f "$lockfile"
configurator_process_complete_dialog "resetting RetroDECK" rm -f "$rd_conf"
configurator_process_complete_dialog "resetting RetroDECK"
else
configurator_generic_dialog "Reset process cancelled."
configurator_reset_dialog
fi
;; ;;
"" ) # No selection made or Back button clicked "" ) # No selection made or Back button clicked
@ -605,6 +670,7 @@ configurator_troubleshooting_tools_dialog() {
choice=$(zenity --list --title="RetroDECK Configurator Utility - Change Options" --cancel-label="Back" \ choice=$(zenity --list --title="RetroDECK Configurator Utility - Change Options" --cancel-label="Back" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \
--column="Choice" --column="Action" \ --column="Choice" --column="Action" \
"Move RetroDECK" "Move RetroDECK files between internal/SD card or to a custom location" \
"Multi-file game structure check" "Verify the proper structure of multi-file or multi-disc games" \ "Multi-file game structure check" "Verify the proper structure of multi-file or multi-disc games" \
"Basic BIOS file check" "Show a list of systems that BIOS files are found for" \ "Basic BIOS file check" "Show a list of systems that BIOS files are found for" \
"Advanced BIOS file check" "Show advanced information about common BIOS files" \ "Advanced BIOS file check" "Show advanced information about common BIOS files" \
@ -612,6 +678,11 @@ configurator_troubleshooting_tools_dialog() {
case $choice in case $choice in
"Move RetroDECK" )
configurator_generic_dialog "This option will move the RetroDECK data folder (ROMs, saves, BIOS etc.) to a new location.\n\nPlease choose where to move the RetroDECK data folder."
configurator_move_dialog
;;
"Multi-file game structure check" ) "Multi-file game structure check" )
configurator_check_multifile_game_structure configurator_check_multifile_game_structure
;; ;;
@ -793,19 +864,13 @@ configurator_welcome_dialog() {
choice=$(zenity --list --title="RetroDECK Configurator Utility" --cancel-label="Quit" \ choice=$(zenity --list --title="RetroDECK Configurator Utility" --cancel-label="Quit" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \
--column="Choice" --column="Action" \ --column="Choice" --column="Action" \
"Move RetroDECK" "Move RetroDECK files between internal/SD card or to a custom location" \
"RetroArch Presets" "Change RetroArch presets, log into RetroAchievements etc." \ "RetroArch Presets" "Change RetroArch presets, log into RetroAchievements etc." \
"Emulator Options" "Launch and configure each emulators settings (for advanced users)" \ "Emulator Options" "Launch and configure each emulators settings (for advanced users)" \
"Tools and Troubleshooting" "Run RetroDECK troubleshooting tools for common issues" \ "Tools and Troubleshooting" "Move RetroDECK to a new location, compress games and perform basic troubleshooting" \
"Reset" "Reset specific parts or all of RetroDECK" ) "Reset" "Reset specific parts or all of RetroDECK" )
case $choice in case $choice in
"Move RetroDECK" )
configurator_generic_dialog "This option will move the RetroDECK data folder (ROMs, saves, BIOS etc.) to a new location.\n\nPlease choose where to move the RetroDECK data folder."
configurator_move_dialog
;;
"RetroArch Presets" ) "RetroArch Presets" )
configurator_retroarch_options_dialog configurator_retroarch_options_dialog
;; ;;