diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-03-15 17:12:40 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2022-06-20 18:57:25 -0400 |
commit | ed37c2e8948960b45c9bac58f1ffb678fdf31f5d (patch) | |
tree | 8eeda559c74a45e21eb112e75fcd7e62c788a18e /apps | |
parent | 58bf7c7e6fc9d94cbf1dacf3bd6b889fc4844895 (diff) | |
download | rockbox-ed37c2e8948960b45c9bac58f1ffb678fdf31f5d.tar.gz rockbox-ed37c2e8948960b45c9bac58f1ffb678fdf31f5d.zip |
FS#13193 - Add option to disable settings reset on startup
Updated version of the patch originally by user cockroach
UNTESTED
Ipods?, Iriver H10,
I do not own these players so YMMV
https://www.rockbox.org/tracker/task/13193
Change-Id: I7924837f582cc5c49ee68c186d6822f577f65147
Diffstat (limited to 'apps')
-rw-r--r-- | apps/features.txt | 6 | ||||
-rw-r--r-- | apps/lang/english.lang | 17 | ||||
-rw-r--r-- | apps/main.c | 20 | ||||
-rw-r--r-- | apps/menus/settings_menu.c | 14 | ||||
-rw-r--r-- | apps/settings.h | 5 | ||||
-rw-r--r-- | apps/settings_list.c | 6 |
6 files changed, 58 insertions, 10 deletions
diff --git a/apps/features.txt b/apps/features.txt index 45e06e5e64..da2064ab2f 100644 --- a/apps/features.txt +++ b/apps/features.txt | |||
@@ -289,3 +289,9 @@ multi_boot | |||
289 | #if defined(HIBY_LINUX) | 289 | #if defined(HIBY_LINUX) |
290 | hibylinux | 290 | hibylinux |
291 | #endif | 291 | #endif |
292 | |||
293 | #if defined(SETTINGS_RESET) || \ | ||
294 | (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | ||
295 | (CONFIG_KEYPAD == IRIVER_H10_PAD) | ||
296 | clear_settings_on_hold | ||
297 | #endif | ||
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 3b505bb9a2..f4571aa6bc 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -16368,3 +16368,20 @@ | |||
16368 | *: "Keep Current Track When Replacing Playlist" | 16368 | *: "Keep Current Track When Replacing Playlist" |
16369 | </voice> | 16369 | </voice> |
16370 | </phrase> | 16370 | </phrase> |
16371 | <phrase> | ||
16372 | id: LANG_CLEAR_SETTINGS_ON_HOLD | ||
16373 | desc: in the system sub menu | ||
16374 | user: core | ||
16375 | <source> | ||
16376 | *: none | ||
16377 | clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup" | ||
16378 | </source> | ||
16379 | <dest> | ||
16380 | *: none | ||
16381 | clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup" | ||
16382 | </dest> | ||
16383 | <voice> | ||
16384 | *: none | ||
16385 | clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup" | ||
16386 | </voice> | ||
16387 | </phrase> | ||
diff --git a/apps/main.c b/apps/main.c index dff9dc5778..d52c17a67e 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -566,7 +566,12 @@ static void init(void) | |||
566 | pcm_init(); | 566 | pcm_init(); |
567 | dsp_init(); | 567 | dsp_init(); |
568 | 568 | ||
569 | #if defined(SETTINGS_RESET) || (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | 569 | CHART(">settings_load(ALL)"); |
570 | settings_load(SETTINGS_ALL); | ||
571 | CHART("<settings_load(ALL)"); | ||
572 | |||
573 | #if defined(SETTINGS_RESET) || \ | ||
574 | (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | ||
570 | (CONFIG_KEYPAD == IRIVER_H10_PAD) | 575 | (CONFIG_KEYPAD == IRIVER_H10_PAD) |
571 | #ifdef SETTINGS_RESET | 576 | #ifdef SETTINGS_RESET |
572 | /* Reset settings if holding the reset button. (Rec on Archos, | 577 | /* Reset settings if holding the reset button. (Rec on Archos, |
@@ -577,16 +582,13 @@ static void init(void) | |||
577 | if (button_hold()) | 582 | if (button_hold()) |
578 | #endif | 583 | #endif |
579 | { | 584 | { |
580 | splash(HZ*2, str(LANG_RESET_DONE_CLEAR)); | 585 | if (global_settings.clear_settings_on_hold) |
581 | settings_reset(); | 586 | { |
587 | splash(HZ*2, str(LANG_RESET_DONE_CLEAR)); | ||
588 | settings_reset(); | ||
589 | } | ||
582 | } | 590 | } |
583 | else | ||
584 | #endif | 591 | #endif |
585 | { | ||
586 | CHART(">settings_load(ALL)"); | ||
587 | settings_load(SETTINGS_ALL); | ||
588 | CHART("<settings_load(ALL)"); | ||
589 | } | ||
590 | 592 | ||
591 | #ifdef HAVE_DIRCACHE | 593 | #ifdef HAVE_DIRCACHE |
592 | CHART(">init_dircache(true)"); | 594 | CHART(">init_dircache(true)"); |
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 2539f17860..60f206c86f 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c | |||
@@ -584,6 +584,14 @@ MENUITEM_SETTING(keypress_restarts_sleeptimer, | |||
584 | &global_settings.keypress_restarts_sleeptimer, NULL); | 584 | &global_settings.keypress_restarts_sleeptimer, NULL); |
585 | MENUITEM_SETTING(show_shutdown_message, &global_settings.show_shutdown_message, NULL); | 585 | MENUITEM_SETTING(show_shutdown_message, &global_settings.show_shutdown_message, NULL); |
586 | 586 | ||
587 | #if defined(SETTINGS_RESET) || \ | ||
588 | (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | ||
589 | (CONFIG_KEYPAD == IRIVER_H10_PAD) | ||
590 | #define SETTINGS_CLEAR_ON_HOLD | ||
591 | MENUITEM_SETTING(clear_settings_on_hold, | ||
592 | &global_settings.clear_settings_on_hold, NULL); | ||
593 | #endif | ||
594 | |||
587 | MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN), | 595 | MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN), |
588 | 0, Icon_System_menu, | 596 | 0, Icon_System_menu, |
589 | &show_shutdown_message, | 597 | &show_shutdown_message, |
@@ -592,7 +600,11 @@ MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN), | |||
592 | &sleeptimer_toggle, | 600 | &sleeptimer_toggle, |
593 | &sleeptimer_duration, | 601 | &sleeptimer_duration, |
594 | &sleeptimer_on_startup, | 602 | &sleeptimer_on_startup, |
595 | &keypress_restarts_sleeptimer | 603 | &keypress_restarts_sleeptimer, |
604 | #if defined(SETTINGS_CLEAR_ON_HOLD) | ||
605 | &clear_settings_on_hold, | ||
606 | #undef SETTINGS_CLEAR_ON_HOLD | ||
607 | #endif | ||
596 | ); | 608 | ); |
597 | 609 | ||
598 | /* STARTUP/SHUTDOWN MENU */ | 610 | /* STARTUP/SHUTDOWN MENU */ |
diff --git a/apps/settings.h b/apps/settings.h index 9af8e27e5e..ae9b6f31ce 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -868,6 +868,11 @@ struct user_settings | |||
868 | #if defined(DX50) || defined(DX90) || (defined(HAVE_USB_POWER) && !defined(USB_NONE) && !defined(SIMULATOR)) | 868 | #if defined(DX50) || defined(DX90) || (defined(HAVE_USB_POWER) && !defined(USB_NONE) && !defined(SIMULATOR)) |
869 | int usb_mode; | 869 | int usb_mode; |
870 | #endif | 870 | #endif |
871 | #if defined(SETTINGS_RESET) || \ | ||
872 | (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | ||
873 | (CONFIG_KEYPAD == IRIVER_H10_PAD) | ||
874 | bool clear_settings_on_hold; | ||
875 | #endif | ||
871 | }; | 876 | }; |
872 | 877 | ||
873 | /** global variables **/ | 878 | /** global variables **/ |
diff --git a/apps/settings_list.c b/apps/settings_list.c index 0e39a58b1a..e230a5a081 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -2168,6 +2168,12 @@ const struct settings_list settings[] = { | |||
2168 | #endif | 2168 | #endif |
2169 | ), | 2169 | ), |
2170 | #endif | 2170 | #endif |
2171 | #if defined(SETTINGS_RESET) || \ | ||
2172 | (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | ||
2173 | (CONFIG_KEYPAD == IRIVER_H10_PAD) | ||
2174 | OFFON_SETTING(0, clear_settings_on_hold, LANG_CLEAR_SETTINGS_ON_HOLD, | ||
2175 | true, "clear settings on hold", NULL), | ||
2176 | #endif | ||
2171 | }; | 2177 | }; |
2172 | 2178 | ||
2173 | const int nb_settings = sizeof(settings)/sizeof(*settings); | 2179 | const int nb_settings = sizeof(settings)/sizeof(*settings); |