summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Hak <adiamas@rockbox.org>2002-11-30 09:42:13 +0000
committerRobert Hak <adiamas@rockbox.org>2002-11-30 09:42:13 +0000
commit0789d42400b1343f2b6894aa06130b2325e69440 (patch)
tree0d082697e6d849ed75cff058f198422efc83ec51
parent3d4cc9b378bdf00c3334ec3efc0b6f5dd9a24a54 (diff)
downloadrockbox-0789d42400b1343f2b6894aa06130b2325e69440.tar.gz
rockbox-0789d42400b1343f2b6894aa06130b2325e69440.zip
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
-rw-r--r--apps/lang/english.lang6
-rw-r--r--apps/recorder/oscillograph.c4
-rw-r--r--apps/screens.c4
-rw-r--r--apps/settings.c30
-rw-r--r--apps/settings.h17
-rw-r--r--apps/settings_menu.c3
-rw-r--r--apps/tree.c8
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
1156desc: disk poweroff flag 1156desc: disk poweroff flag
1157eng: "Disk Poweroff" 1157eng: "Disk Poweroff"
1158new: 1158new:
1159
1160id: LANG_FILTER_PLAYLIST
1161desc: show only playlist
1162eng: "Playlists"
1163new:
1164
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)
202 return false; 202 return false;
203} 203}
204 204
205#endif /* #ifndef SIMULATOR */ \ No newline at end of file 205#endif /* #ifndef SIMULATOR */
206
207
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)
289 case SHOW_MUSIC: 289 case SHOW_MUSIC:
290 ptr = str(LANG_FILTER_MUSIC); 290 ptr = str(LANG_FILTER_MUSIC);
291 break; 291 break;
292
293 case SHOW_PLAYLIST:
294 ptr = str(LANG_FILTER_PLAYLIST);
295 break;
292 } 296 }
293 297
294 snprintf(buf, sizeof buf, "%s:", str(LANG_FILTER)); 298 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)
425 backlight_set_timeout(global_settings.backlight_timeout); 425 backlight_set_timeout(global_settings.backlight_timeout);
426 backlight_set_on_when_charging(global_settings.backlight_on_when_charging); 426 backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
427 ata_spindown(global_settings.disk_spindown); 427 ata_spindown(global_settings.disk_spindown);
428
429#ifdef ATA_POWER_OFF
428 ata_poweroff(global_settings.disk_poweroff); 430 ata_poweroff(global_settings.disk_poweroff);
431#endif
432
429 set_poweroff_timeout(global_settings.poweroff); 433 set_poweroff_timeout(global_settings.poweroff);
430#ifdef HAVE_CHARGE_CTRL 434#ifdef HAVE_CHARGE_CTRL
431 charge_restart_level = global_settings.discharge ? 435 charge_restart_level = global_settings.discharge ?
@@ -1035,6 +1039,8 @@ bool set_time(char* string, int timedate[])
1035 char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12}, 1039 char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12},
1036 {24, 16, 24}, {54, 16, 18}, {78, 16, 12}}; 1040 {24, 16, 24}, {54, 16, 18}, {78, 16, 12}};
1037 char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 1041 char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
1042
1043 int monthname_len = 0, dayname_len = 0;
1038 1044
1039 1045
1040#ifdef HAVE_LCD_BITMAP 1046#ifdef HAVE_LCD_BITMAP
@@ -1068,9 +1074,7 @@ bool set_time(char* string, int timedate[])
1068 (realyear - 1) / 100 + (realyear - 1) / 400 + 7 - 1) % 7; 1074 (realyear - 1) / 100 + (realyear - 1) / 400 + 7 - 1) % 7;
1069 1075
1070 snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d ", 1076 snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d ",
1071 timedate[0], 1077 timedate[0], timedate[1], timedate[2]);
1072 timedate[1],
1073 timedate[2]);
1074 lcd_puts(0, 1, buffer); 1078 lcd_puts(0, 1, buffer);
1075 1079
1076 /* recalculate the positions and offsets */ 1080 /* recalculate the positions and offsets */
@@ -1106,23 +1110,25 @@ bool set_time(char* string, int timedate[])
1106 lcd_getstringsize(buffer, &width, &prev_line_height); 1110 lcd_getstringsize(buffer, &width, &prev_line_height);
1107 1111
1108 snprintf(buffer, sizeof(buffer), "%s 20%02d %s %02d ", 1112 snprintf(buffer, sizeof(buffer), "%s 20%02d %s %02d ",
1109 dayname[timedate[6]], 1113 dayname[timedate[6]], timedate[3], monthname[timedate[4] - 1],
1110 timedate[3],
1111 monthname[timedate[4] - 1],
1112 timedate[5]); 1114 timedate[5]);
1113 lcd_puts(0, 2, buffer); 1115 lcd_puts(0, 2, buffer);
1114 1116
1115 /* recalculate the positions and offsets */ 1117 /* recalculate the positions and offsets */
1116 lcd_getstringsize(buffer, &width, &line_height); 1118 lcd_getstringsize(buffer, &width, &line_height);
1117 1119
1120 /* store these 2 to prevent _repeated_ strlen calls */
1121 monthname_len = strlen(monthname[timedate[4] - 1]);
1122 dayname_len = strlen(dayname[timedate[6]]);
1123
1118 /* weekday */ 1124 /* weekday */
1119 strncpy(reffub, buffer, strlen(dayname[timedate[6]])); 1125 strncpy(reffub, buffer, dayname_len);
1120 reffub[strlen(dayname[timedate[6]])] = '\0'; 1126 reffub[dayname_len] = '\0';
1121 lcd_getstringsize(reffub, &weekday_width, &height); 1127 lcd_getstringsize(reffub, &weekday_width, &height);
1122 lcd_getstringsize(" ", &separator_width, &height); 1128 lcd_getstringsize(" ", &separator_width, &height);
1123 1129
1124 /* year */ 1130 /* year */
1125 strncpy(reffub, buffer + strlen(dayname[timedate[6]]) + 1, 4); 1131 strncpy(reffub, buffer + dayname_len + 1, 4);
1126 reffub[4] = '\0'; 1132 reffub[4] = '\0';
1127 lcd_getstringsize(reffub, &width, &height); 1133 lcd_getstringsize(reffub, &width, &height);
1128 cursor[3][INDEX_X] = weekday_width + separator_width; 1134 cursor[3][INDEX_X] = weekday_width + separator_width;
@@ -1130,8 +1136,8 @@ bool set_time(char* string, int timedate[])
1130 cursor[3][INDEX_WIDTH] = width; 1136 cursor[3][INDEX_WIDTH] = width;
1131 1137
1132 /* month */ 1138 /* month */
1133 strncpy(reffub, buffer + strlen(dayname[timedate[6]]) + 6, strlen(monthname[timedate[4] - 1])); 1139 strncpy(reffub, buffer + dayname_len + 6, monthname_len);
1134 reffub[strlen(monthname[timedate[4] - 1])] = '\0'; 1140 reffub[monthname_len] = '\0';
1135 lcd_getstringsize(reffub, &width, &height); 1141 lcd_getstringsize(reffub, &width, &height);
1136 cursor[4][INDEX_X] = weekday_width + separator_width + 1142 cursor[4][INDEX_X] = weekday_width + separator_width +
1137 cursor[3][INDEX_WIDTH] + separator_width; 1143 cursor[3][INDEX_WIDTH] + separator_width;
@@ -1139,7 +1145,7 @@ bool set_time(char* string, int timedate[])
1139 cursor[4][INDEX_WIDTH] = width; 1145 cursor[4][INDEX_WIDTH] = width;
1140 1146
1141 /* day */ 1147 /* day */
1142 strncpy(reffub, buffer + strlen(dayname[timedate[6]]) + strlen(monthname[timedate[4] - 1]) + 7, 2); 1148 strncpy(reffub, buffer + dayname_len + monthname_len + 7, 2);
1143 reffub[2] = '\0'; 1149 reffub[2] = '\0';
1144 lcd_getstringsize(reffub, &width, &height); 1150 lcd_getstringsize(reffub, &width, &height);
1145 cursor[5][INDEX_X] = weekday_width + separator_width + 1151 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,
149bool set_bool(char* string, bool* variable ); 149bool set_bool(char* string, bool* variable );
150bool set_option(char* string, int* variable, char* options[], 150bool set_option(char* string, int* variable, char* options[],
151 int numoptions, void (*function)(int)); 151 int numoptions, void (*function)(int));
152bool set_int(char* string, 152bool set_int(char* string, char* unit, int* variable,
153 char* unit, 153 void (*function)(int), int step, int min, int max );
154 int* variable,
155 void (*function)(int),
156 int step,
157 int min,
158 int max );
159bool set_time(char* string, int timedate[]); 154bool set_time(char* string, int timedate[]);
160 155
161/* global settings */ 156/* global settings */
@@ -184,6 +179,12 @@ extern char rockboxdir[];
184enum { REPEAT_OFF, REPEAT_ALL, REPEAT_ONE, NUM_REPEAT_MODES }; 179enum { REPEAT_OFF, REPEAT_ALL, REPEAT_ONE, NUM_REPEAT_MODES };
185 180
186/* dir filter options */ 181/* dir filter options */
187enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, NUM_FILTER_MODES }; 182enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, NUM_FILTER_MODES };
188 183
189#endif /* __SETTINGS_H__ */ 184#endif /* __SETTINGS_H__ */
185
186
187
188
189
190
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)
343{ 343{
344 char* names[] = { str(LANG_FILTER_ALL), 344 char* names[] = { str(LANG_FILTER_ALL),
345 str(LANG_FILTER_SUPPORTED), 345 str(LANG_FILTER_SUPPORTED),
346 str(LANG_FILTER_MUSIC) }; 346 str(LANG_FILTER_MUSIC),
347 str(LANG_FILTER_PLAYLIST) };
347 348
348 return set_option( str(LANG_FILTER), &global_settings.dirfilter, 349 return set_option( str(LANG_FILTER), &global_settings.dirfilter,
349 names, 3, NULL ); 350 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)
272 dptr->attr |= TREE_ATTR_MOD; 272 dptr->attr |= TREE_ATTR_MOD;
273 } 273 }
274 274
275 /* filter out all non-playlist files */
276 if ( global_settings.dirfilter == SHOW_PLAYLIST &&
277 (!(dptr->attr &
278 (ATTR_DIRECTORY|TREE_ATTR_M3U))) ) {
279 i--;
280 continue;
281 }
282
275 /* filter out non-music files */ 283 /* filter out non-music files */
276 if ( global_settings.dirfilter == SHOW_MUSIC && 284 if ( global_settings.dirfilter == SHOW_MUSIC &&
277 (!(dptr->attr & 285 (!(dptr->attr &