diff options
Diffstat (limited to 'apps/menus/eq_menu.c')
-rw-r--r-- | apps/menus/eq_menu.c | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c index 2c2e596496..b3e67e42ef 100644 --- a/apps/menus/eq_menu.c +++ b/apps/menus/eq_menu.c | |||
@@ -596,50 +596,17 @@ bool eq_menu_graphical(void) | |||
596 | return result; | 596 | return result; |
597 | } | 597 | } |
598 | 598 | ||
599 | /* Preset saver. | ||
600 | * TODO: Can the settings system be used to do this instead? | ||
601 | */ | ||
602 | static bool eq_save_preset(void) | 599 | static bool eq_save_preset(void) |
603 | { | 600 | { |
604 | int fd, i; | 601 | /* make sure that the eq is enabled for setting saving */ |
605 | char filename[MAX_PATH]; | 602 | bool enabled = global_settings.eq_enabled; |
606 | int *setting; | 603 | global_settings.eq_enabled = true; |
607 | |||
608 | create_numbered_filename(filename, EQS_DIR, "eq", ".cfg", 2 | ||
609 | IF_CNFN_NUM_(, NULL)); | ||
610 | |||
611 | /* allow user to modify filename */ | ||
612 | while (true) { | ||
613 | if (!kbd_input(filename, sizeof filename)) { | ||
614 | fd = creat(filename); | ||
615 | if (fd < 0) | ||
616 | gui_syncsplash(HZ, ID2P(LANG_FAILED)); | ||
617 | else | ||
618 | break; | ||
619 | } | ||
620 | else { | ||
621 | gui_syncsplash(HZ, ID2P(LANG_CANCEL)); | ||
622 | return false; | ||
623 | } | ||
624 | } | ||
625 | |||
626 | /* TODO: Should we really do this? */ | ||
627 | fdprintf(fd, "eq enabled: on\r\n"); | ||
628 | fdprintf(fd, "eq precut: %d\r\n", global_settings.eq_precut); | ||
629 | 604 | ||
630 | setting = &global_settings.eq_band0_cutoff; | 605 | bool result = settings_save_config(SETTINGS_SAVE_EQPRESET); |
631 | 606 | ||
632 | for(i = 0; i < 5; ++i) { | 607 | global_settings.eq_enabled = enabled; |
633 | fdprintf(fd, "eq band %d cutoff: %d\r\n", i, *setting++); | ||
634 | fdprintf(fd, "eq band %d q: %d\r\n", i, *setting++); | ||
635 | fdprintf(fd, "eq band %d gain: %d\r\n", i, *setting++); | ||
636 | } | ||
637 | |||
638 | close(fd); | ||
639 | 608 | ||
640 | gui_syncsplash(HZ, ID2P(LANG_SETTINGS_SAVED)); | 609 | return result; |
641 | |||
642 | return true; | ||
643 | } | 610 | } |
644 | 611 | ||
645 | /* Allows browsing of preset files */ | 612 | /* Allows browsing of preset files */ |
@@ -648,7 +615,6 @@ bool eq_browse_presets(void) | |||
648 | return rockbox_browse(EQS_DIR, SHOW_CFG); | 615 | return rockbox_browse(EQS_DIR, SHOW_CFG); |
649 | } | 616 | } |
650 | 617 | ||
651 | |||
652 | MENUITEM_FUNCTION(eq_graphical, 0, ID2P(LANG_EQUALIZER_GRAPHICAL), | 618 | MENUITEM_FUNCTION(eq_graphical, 0, ID2P(LANG_EQUALIZER_GRAPHICAL), |
653 | (int(*)(void))eq_menu_graphical, NULL, NULL, | 619 | (int(*)(void))eq_menu_graphical, NULL, NULL, |
654 | Icon_EQ); | 620 | Icon_EQ); |