From 58808b6216455d436128b29010e8ca361cfe4cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Doyon?= Date: Mon, 18 Aug 2008 01:03:07 +0000 Subject: [PATCH] Skip length: restore the ability to skip by just a few seconds (which was the point of that feature). See r18041. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18310 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 2 +- apps/gui/gwps.c | 2 +- apps/settings_list.c | 18 +++++++++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 26c5c5d637..dba703c1aa 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -164,7 +164,7 @@ void play_hop(int direction) if(!wps_state.id3 || !wps_state.id3->length || global_settings.skip_length == 0) return; -#define STEP ((unsigned)global_settings.skip_length*60*1000) +#define STEP ((unsigned)global_settings.skip_length*1000) if(direction == 1 && wps_state.id3->length - wps_state.id3->elapsed < STEP+1000) { #if CONFIG_CODEC == SWCODEC diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index ae0a230919..5fd87ec1db 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c @@ -414,7 +414,7 @@ long gui_wps_show(void) else if (global_settings.skip_length > 0 && current_tick -last_right < HZ) { - prev_track(3+global_settings.skip_length*60); + prev_track(3+global_settings.skip_length); update_track = true; } else ffwd_rew(ACTION_WPS_SEEKBACK); diff --git a/apps/settings_list.c b/apps/settings_list.c index b6ad01ef5d..bfa190139d 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -260,18 +260,24 @@ static int32_t getlang_unit_0_is_off(int value, int unit) static void formatter_unit_0_is_skip_track(char *buffer, size_t buffer_size, int val, const char *unit) { + (void)unit; if (val == 0) strcpy(buffer, str(LANG_SKIP_TRACK)); + else if (val % 60 == 0) + snprintf(buffer, buffer_size, "%d min", val/60); else - snprintf(buffer, buffer_size, "%d %s", val, unit); + snprintf(buffer, buffer_size, "%d s", val); } static int32_t getlang_unit_0_is_skip_track(int value, int unit) { + (void)unit; if (value == 0) return LANG_SKIP_TRACK; + else if (value % 60 == 0) + return TALK_ID(value/60, UNIT_MIN); else - return TALK_ID(value, unit); + return TALK_ID(value, UNIT_SEC); } #ifdef HAVE_BACKLIGHT @@ -1252,9 +1258,11 @@ const struct settings_list settings[] = { OFFON_SETTING(0,cuesheet,LANG_CUESHEET_ENABLE,false,"cuesheet support", NULL), TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, skip_length, - LANG_SKIP_LENGTH, 0, "skip length", "track", - UNIT_MIN, formatter_unit_0_is_skip_track, - getlang_unit_0_is_skip_track, NULL, 8, 0,1,2,3,4,5,10,15), + LANG_SKIP_LENGTH, 0, "skip length", + "track,1s,2s,3s,5s,7s,10s,15s,20s,30s,45s,1min,90s,2min,3min,5min,10min,15min", + UNIT_SEC, formatter_unit_0_is_skip_track, + getlang_unit_0_is_skip_track, NULL, + 18, 0,1,2,3,5,7,10,15,20,30,45,60,90,120,180,300,600,900), CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1, "start in screen", "previous,root,files,db,wps,menu," #ifdef HAVE_RECORDING