1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Robert Hak 2002-11-30 09:42:13 +00:00
parent 3d4cc9b378
commit 0789d42400
7 changed files with 50 additions and 22 deletions

View file

@ -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:

View file

@ -202,4 +202,6 @@ bool oscillograph(void)
return false;
}
#endif /* #ifndef SIMULATOR */
#endif /* #ifndef SIMULATOR */

View file

@ -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));

View file

@ -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 +

View file

@ -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__ */

View file

@ -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 );

View file

@ -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 &