Add "don't show again" to hard reset and exit confirmations, further addressing #948
This commit is contained in:
13
src/config.c
13
src/config.c
@@ -484,6 +484,9 @@ load_general(void)
|
||||
|
||||
sound_gain = config_get_int(cat, "sound_gain", 0);
|
||||
|
||||
confirm_reset = config_get_int(cat, "confirm_reset", 1);
|
||||
confirm_exit = config_get_int(cat, "confirm_exit", 1);
|
||||
|
||||
#ifdef USE_LANGUAGE
|
||||
/*
|
||||
* Currently, 86Box is English (US) only, but in the future
|
||||
@@ -1647,6 +1650,16 @@ save_general(void)
|
||||
else
|
||||
config_delete_var(cat, "sound_gain");
|
||||
|
||||
if (confirm_reset != 1)
|
||||
config_set_int(cat, "confirm_reset", confirm_reset);
|
||||
else
|
||||
config_delete_var(cat, "confirm_reset");
|
||||
|
||||
if (confirm_exit != 1)
|
||||
config_set_int(cat, "confirm_exit", confirm_exit);
|
||||
else
|
||||
config_delete_var(cat, "confirm_exit");
|
||||
|
||||
#ifdef USE_LANGUAGE
|
||||
if (plat_langid == 0x0409)
|
||||
config_delete_var(cat, "language");
|
||||
|
@@ -66,7 +66,7 @@ extern int force_debug; /* (O) force debug output */
|
||||
extern int video_fps; /* (O) render speed in fps */
|
||||
#endif
|
||||
extern int settings_only; /* (O) show only the settings dialog */
|
||||
extern int no_quit_confirm; /* (O) do not ask for confirmation on quit */
|
||||
extern int confirm_exit_cmdl; /* (O) do not ask for confirmation on quit if set to 0 */
|
||||
#ifdef _WIN32
|
||||
extern uint64_t unique_id;
|
||||
extern uint64_t source_hwnd;
|
||||
@@ -109,6 +109,8 @@ extern int network_type; /* (C) net provider type */
|
||||
extern int network_card; /* (C) net interface num */
|
||||
extern char network_host[522]; /* (C) host network intf */
|
||||
extern int hdd_format_type; /* (C) hard disk file format */
|
||||
extern int confirm_reset, /* (C) enable reset confirmation */
|
||||
confirm_exit; /* (C) enable exit confirmation */
|
||||
#ifdef USE_DISCORD
|
||||
extern int enable_discord; /* (C) enable Discord integration */
|
||||
#endif
|
||||
|
6
src/pc.c
6
src/pc.c
@@ -101,7 +101,7 @@ int force_debug = 0; /* (O) force debug output */
|
||||
int video_fps = RENDER_FPS; /* (O) render speed in fps */
|
||||
#endif
|
||||
int settings_only = 0; /* (O) show only the settings dialog */
|
||||
int no_quit_confirm = 0; /* (O) do not ask for confirmation on quit */
|
||||
int confirm_exit_cmdl = 1; /* (O) do not ask for confirmation on quit if set to 0 */
|
||||
#ifdef _WIN32
|
||||
uint64_t unique_id = 0;
|
||||
uint64_t source_hwnd = 0;
|
||||
@@ -140,6 +140,8 @@ int cpu_manufacturer = 0, /* (C) cpu manufacturer */
|
||||
cpu = 3, /* (C) cpu type */
|
||||
fpu_type = 0; /* (C) fpu type */
|
||||
int time_sync = 0; /* (C) enable time sync */
|
||||
int confirm_reset = 1, /* (C) enable reset confirmation */
|
||||
confirm_exit = 1; /* (C) enable exit confirmation */
|
||||
#ifdef USE_DISCORD
|
||||
int enable_discord = 0; /* (C) enable Discord integration */
|
||||
#endif
|
||||
@@ -396,7 +398,7 @@ usage:
|
||||
settings_only = 1;
|
||||
} else if (!wcscasecmp(argv[c], L"--noconfirm") ||
|
||||
!wcscasecmp(argv[c], L"-N")) {
|
||||
no_quit_confirm = 1;
|
||||
confirm_exit_cmdl = 0;
|
||||
} else if (!wcscasecmp(argv[c], L"--crashdump") ||
|
||||
!wcscasecmp(argv[c], L"-R")) {
|
||||
enable_crashdump = 1;
|
||||
|
@@ -144,6 +144,7 @@ ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, voi
|
||||
else if (ret == IDCANCEL) ret = -1;
|
||||
else ret = 0;
|
||||
|
||||
/* 10 is added to the return value if "don't show again" is checked. */
|
||||
if (checked) ret += 10;
|
||||
|
||||
return(ret);
|
||||
|
@@ -315,9 +315,17 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case IDM_ACTION_HRESET:
|
||||
win_notify_dlg_open();
|
||||
i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2112, NULL, (wchar_t *) IDS_2137, (wchar_t *) IDS_2138, NULL);
|
||||
if (i == 0)
|
||||
if (confirm_reset)
|
||||
i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2112, NULL, (wchar_t *) IDS_2137, (wchar_t *) IDS_2138, NULL);
|
||||
else
|
||||
i = 0;
|
||||
if ((i % 10) == 0) {
|
||||
pc_reset_hard();
|
||||
if (i == 10) {
|
||||
confirm_reset = 0;
|
||||
config_save();
|
||||
}
|
||||
}
|
||||
win_notify_dlg_closed();
|
||||
break;
|
||||
|
||||
@@ -327,11 +335,15 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case IDM_ACTION_EXIT:
|
||||
win_notify_dlg_open();
|
||||
if (no_quit_confirm)
|
||||
i = 0;
|
||||
if (confirm_exit && confirm_exit_cmdl)
|
||||
i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL);
|
||||
else
|
||||
i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL);
|
||||
if (i == 0) {
|
||||
i = 0;
|
||||
if ((i % 10) == 0) {
|
||||
if (i == 10) {
|
||||
confirm_exit = 0;
|
||||
config_save();
|
||||
}
|
||||
#ifndef NO_KEYBOARD_HOOK
|
||||
UnhookWindowsHookEx(hKeyboardHook);
|
||||
#endif
|
||||
@@ -701,11 +713,15 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case WM_CLOSE:
|
||||
win_notify_dlg_open();
|
||||
if (no_quit_confirm)
|
||||
i = 0;
|
||||
if (confirm_exit && confirm_exit_cmdl)
|
||||
i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL);
|
||||
else
|
||||
i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL);
|
||||
if (i == 0) {
|
||||
i = 0;
|
||||
if ((i % 10) == 0) {
|
||||
if (i == 10) {
|
||||
confirm_exit = 0;
|
||||
config_save();
|
||||
}
|
||||
#ifndef NO_KEYBOARD_HOOK
|
||||
UnhookWindowsHookEx(hKeyboardHook);
|
||||
#endif
|
||||
@@ -744,9 +760,17 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (manager_wm)
|
||||
break;
|
||||
win_notify_dlg_open();
|
||||
i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2112, NULL, (wchar_t *) IDS_2137, (wchar_t *) IDS_2138, NULL);
|
||||
if (i == 0)
|
||||
if (confirm_reset)
|
||||
i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2112, NULL, (wchar_t *) IDS_2137, (wchar_t *) IDS_2138, NULL);
|
||||
else
|
||||
i = 0;
|
||||
if ((i % 10) == 0) {
|
||||
pc_reset_hard();
|
||||
if (i == 10) {
|
||||
confirm_reset = 0;
|
||||
config_save();
|
||||
}
|
||||
}
|
||||
win_notify_dlg_closed();
|
||||
break;
|
||||
|
||||
@@ -754,11 +778,15 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (manager_wm)
|
||||
break;
|
||||
win_notify_dlg_open();
|
||||
if (no_quit_confirm)
|
||||
i = 0;
|
||||
if (confirm_exit && confirm_exit_cmdl)
|
||||
i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL);
|
||||
else
|
||||
i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL);
|
||||
if (i == 0) {
|
||||
i = 0;
|
||||
if ((i % 10) == 0) {
|
||||
if (i == 10) {
|
||||
confirm_exit = 0;
|
||||
config_save();
|
||||
}
|
||||
#ifndef NO_KEYBOARD_HOOK
|
||||
UnhookWindowsHookEx(hKeyboardHook);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user