From 0789d42400b1343f2b6894aa06130b2325e69440 Mon Sep 17 00:00:00 2001 From: Robert Hak Date: Sat, 30 Nov 2002 09:42:13 +0000 Subject: updateing a build failure (ata_power_off) and first attempt to add 'playlist only' file display git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2894 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 6 ++++++ apps/recorder/oscillograph.c | 4 +++- apps/screens.c | 4 ++++ apps/settings.c | 30 ++++++++++++++++++------------ apps/settings.h | 17 +++++++++-------- apps/settings_menu.c | 3 ++- apps/tree.c | 8 ++++++++ 7 files changed, 50 insertions(+), 22 deletions(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 0469cdc317..82d22a7c7f 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -1156,3 +1156,9 @@ id: LANG_POWEROFF desc: disk poweroff flag eng: "Disk Poweroff" new: + +id: LANG_FILTER_PLAYLIST +desc: show only playlist +eng: "Playlists" +new: + diff --git a/apps/recorder/oscillograph.c b/apps/recorder/oscillograph.c index 7b91ed18e9..bf94db168f 100644 --- a/apps/recorder/oscillograph.c +++ b/apps/recorder/oscillograph.c @@ -202,4 +202,6 @@ bool oscillograph(void) return false; } -#endif /* #ifndef SIMULATOR */ \ No newline at end of file +#endif /* #ifndef SIMULATOR */ + + diff --git a/apps/screens.c b/apps/screens.c index ad7865ddad..89a97db0c6 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -289,6 +289,10 @@ bool f2_screen(void) case SHOW_MUSIC: ptr = str(LANG_FILTER_MUSIC); break; + + case SHOW_PLAYLIST: + ptr = str(LANG_FILTER_PLAYLIST); + break; } snprintf(buf, sizeof buf, "%s:", str(LANG_FILTER)); diff --git a/apps/settings.c b/apps/settings.c index 957f77d959..ead61d88f8 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -425,7 +425,11 @@ void settings_apply(void) backlight_set_timeout(global_settings.backlight_timeout); backlight_set_on_when_charging(global_settings.backlight_on_when_charging); ata_spindown(global_settings.disk_spindown); + +#ifdef ATA_POWER_OFF ata_poweroff(global_settings.disk_poweroff); +#endif + set_poweroff_timeout(global_settings.poweroff); #ifdef HAVE_CHARGE_CTRL charge_restart_level = global_settings.discharge ? @@ -1035,6 +1039,8 @@ bool set_time(char* string, int timedate[]) char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12}, {24, 16, 24}, {54, 16, 18}, {78, 16, 12}}; char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + + int monthname_len = 0, dayname_len = 0; #ifdef HAVE_LCD_BITMAP @@ -1068,9 +1074,7 @@ bool set_time(char* string, int timedate[]) (realyear - 1) / 100 + (realyear - 1) / 400 + 7 - 1) % 7; snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d ", - timedate[0], - timedate[1], - timedate[2]); + timedate[0], timedate[1], timedate[2]); lcd_puts(0, 1, buffer); /* recalculate the positions and offsets */ @@ -1106,23 +1110,25 @@ bool set_time(char* string, int timedate[]) lcd_getstringsize(buffer, &width, &prev_line_height); snprintf(buffer, sizeof(buffer), "%s 20%02d %s %02d ", - dayname[timedate[6]], - timedate[3], - monthname[timedate[4] - 1], + dayname[timedate[6]], timedate[3], monthname[timedate[4] - 1], timedate[5]); lcd_puts(0, 2, buffer); /* recalculate the positions and offsets */ lcd_getstringsize(buffer, &width, &line_height); + /* store these 2 to prevent _repeated_ strlen calls */ + monthname_len = strlen(monthname[timedate[4] - 1]); + dayname_len = strlen(dayname[timedate[6]]); + /* weekday */ - strncpy(reffub, buffer, strlen(dayname[timedate[6]])); - reffub[strlen(dayname[timedate[6]])] = '\0'; + strncpy(reffub, buffer, dayname_len); + reffub[dayname_len] = '\0'; lcd_getstringsize(reffub, &weekday_width, &height); lcd_getstringsize(" ", &separator_width, &height); /* year */ - strncpy(reffub, buffer + strlen(dayname[timedate[6]]) + 1, 4); + strncpy(reffub, buffer + dayname_len + 1, 4); reffub[4] = '\0'; lcd_getstringsize(reffub, &width, &height); cursor[3][INDEX_X] = weekday_width + separator_width; @@ -1130,8 +1136,8 @@ bool set_time(char* string, int timedate[]) cursor[3][INDEX_WIDTH] = width; /* month */ - strncpy(reffub, buffer + strlen(dayname[timedate[6]]) + 6, strlen(monthname[timedate[4] - 1])); - reffub[strlen(monthname[timedate[4] - 1])] = '\0'; + strncpy(reffub, buffer + dayname_len + 6, monthname_len); + reffub[monthname_len] = '\0'; lcd_getstringsize(reffub, &width, &height); cursor[4][INDEX_X] = weekday_width + separator_width + cursor[3][INDEX_WIDTH] + separator_width; @@ -1139,7 +1145,7 @@ bool set_time(char* string, int timedate[]) cursor[4][INDEX_WIDTH] = width; /* day */ - strncpy(reffub, buffer + strlen(dayname[timedate[6]]) + strlen(monthname[timedate[4] - 1]) + 7, 2); + strncpy(reffub, buffer + dayname_len + monthname_len + 7, 2); reffub[2] = '\0'; lcd_getstringsize(reffub, &width, &height); cursor[5][INDEX_X] = weekday_width + separator_width + diff --git a/apps/settings.h b/apps/settings.h index 69f56ec870..8399874016 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -149,13 +149,8 @@ bool set_bool_options(char* string, bool* variable, bool set_bool(char* string, bool* variable ); bool set_option(char* string, int* variable, char* options[], int numoptions, void (*function)(int)); -bool set_int(char* string, - char* unit, - int* variable, - void (*function)(int), - int step, - int min, - int max ); +bool set_int(char* string, char* unit, int* variable, + void (*function)(int), int step, int min, int max ); bool set_time(char* string, int timedate[]); /* global settings */ @@ -184,6 +179,12 @@ extern char rockboxdir[]; enum { REPEAT_OFF, REPEAT_ALL, REPEAT_ONE, NUM_REPEAT_MODES }; /* dir filter options */ -enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, NUM_FILTER_MODES }; +enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, NUM_FILTER_MODES }; #endif /* __SETTINGS_H__ */ + + + + + + diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 64164a638d..06fb9a757d 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -343,7 +343,8 @@ static bool dir_filter(void) { char* names[] = { str(LANG_FILTER_ALL), str(LANG_FILTER_SUPPORTED), - str(LANG_FILTER_MUSIC) }; + str(LANG_FILTER_MUSIC), + str(LANG_FILTER_PLAYLIST) }; return set_option( str(LANG_FILTER), &global_settings.dirfilter, names, 3, NULL ); diff --git a/apps/tree.c b/apps/tree.c index e775e9795a..645aab9c1c 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -272,6 +272,14 @@ static int showdir(char *path, int start) dptr->attr |= TREE_ATTR_MOD; } + /* filter out all non-playlist files */ + if ( global_settings.dirfilter == SHOW_PLAYLIST && + (!(dptr->attr & + (ATTR_DIRECTORY|TREE_ATTR_M3U))) ) { + i--; + continue; + } + /* filter out non-music files */ if ( global_settings.dirfilter == SHOW_MUSIC && (!(dptr->attr & -- cgit v1.2.3