diff options
-rw-r--r-- | apps/gui/icon.h | 1 | ||||
-rw-r--r-- | apps/gui/splash.h | 5 | ||||
-rw-r--r-- | apps/playlist.c | 61 |
3 files changed, 36 insertions, 31 deletions
diff --git a/apps/gui/icon.h b/apps/gui/icon.h index 3bafdd9084..1208820558 100644 --- a/apps/gui/icon.h +++ b/apps/gui/icon.h | |||
@@ -19,7 +19,6 @@ | |||
19 | 19 | ||
20 | #ifndef _GUI_ICON_H_ | 20 | #ifndef _GUI_ICON_H_ |
21 | #define _GUI_ICON_H_ | 21 | #define _GUI_ICON_H_ |
22 | #include "lcd.h" | ||
23 | #include "screen_access.h" | 22 | #include "screen_access.h" |
24 | /* Defines a type for the icons since it's not the same thing on | 23 | /* Defines a type for the icons since it's not the same thing on |
25 | * char-based displays and bitmap displays */ | 24 | * char-based displays and bitmap displays */ |
diff --git a/apps/gui/splash.h b/apps/gui/splash.h index ca4cf268dd..b1aece9dde 100644 --- a/apps/gui/splash.h +++ b/apps/gui/splash.h | |||
@@ -17,6 +17,9 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | #ifndef _GUI_SPLASH_H_ | ||
21 | #define _GUI_SPLASH_H_ | ||
22 | #include "screen_access.h" | ||
20 | /* | 23 | /* |
21 | * Puts a splash message on the given screen for a given period | 24 | * Puts a splash message on the given screen for a given period |
22 | * - screen : the screen to put the splash on | 25 | * - screen : the screen to put the splash on |
@@ -37,3 +40,5 @@ extern void gui_splash(struct screen * screen, int ticks, | |||
37 | */ | 40 | */ |
38 | extern void gui_syncsplash(int ticks, bool center, | 41 | extern void gui_syncsplash(int ticks, bool center, |
39 | const char *fmt, ...); | 42 | const char *fmt, ...); |
43 | |||
44 | #endif /* _GUI_ICON_H_ */ | ||
diff --git a/apps/playlist.c b/apps/playlist.c index 9ab1ad9f4a..8bf1fd2116 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -93,6 +93,7 @@ | |||
93 | 93 | ||
94 | #include "lang.h" | 94 | #include "lang.h" |
95 | #include "talk.h" | 95 | #include "talk.h" |
96 | #include "splash.h" | ||
96 | 97 | ||
97 | #define PLAYLIST_CONTROL_FILE ROCKBOX_DIR "/.playlist_control" | 98 | #define PLAYLIST_CONTROL_FILE ROCKBOX_DIR "/.playlist_control" |
98 | #define PLAYLIST_CONTROL_FILE_VERSION 2 | 99 | #define PLAYLIST_CONTROL_FILE_VERSION 2 |
@@ -245,7 +246,7 @@ static void new_playlist(struct playlist_info* playlist, const char *dir, | |||
245 | PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) | 246 | PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) |
246 | fsync(playlist->control_fd); | 247 | fsync(playlist->control_fd); |
247 | else | 248 | else |
248 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); | 249 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); |
249 | } | 250 | } |
250 | } | 251 | } |
251 | 252 | ||
@@ -260,7 +261,7 @@ static void create_control(struct playlist_info* playlist) | |||
260 | { | 261 | { |
261 | if (check_rockboxdir()) | 262 | if (check_rockboxdir()) |
262 | { | 263 | { |
263 | splash(HZ*2, true, "%s (%d)", | 264 | gui_syncsplash(HZ*2, true, "%s (%d)", |
264 | str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR), | 265 | str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR), |
265 | playlist->control_fd); | 266 | playlist->control_fd); |
266 | } | 267 | } |
@@ -294,7 +295,7 @@ static int check_control(struct playlist_info* playlist) | |||
294 | PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) | 295 | PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) |
295 | fsync(playlist->control_fd); | 296 | fsync(playlist->control_fd); |
296 | else | 297 | else |
297 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); | 298 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); |
298 | 299 | ||
299 | playlist->filename[playlist->dirlen-1] = c; | 300 | playlist->filename[playlist->dirlen-1] = c; |
300 | } | 301 | } |
@@ -353,7 +354,7 @@ static int add_indices_to_playlist(struct playlist_info* playlist, | |||
353 | lcd_setmargins(0, 0); | 354 | lcd_setmargins(0, 0); |
354 | #endif | 355 | #endif |
355 | 356 | ||
356 | splash(0, true, str(LANG_PLAYLIST_LOAD)); | 357 | gui_syncsplash(0, true, str(LANG_PLAYLIST_LOAD)); |
357 | 358 | ||
358 | if (!buffer) | 359 | if (!buffer) |
359 | { | 360 | { |
@@ -544,7 +545,7 @@ static int add_track_to_playlist(struct playlist_info* playlist, | |||
544 | 545 | ||
545 | if (result < 0) | 546 | if (result < 0) |
546 | { | 547 | { |
547 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); | 548 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); |
548 | return result; | 549 | return result; |
549 | } | 550 | } |
550 | } | 551 | } |
@@ -578,7 +579,7 @@ static int add_directory_to_playlist(struct playlist_info* playlist, | |||
578 | 579 | ||
579 | if (ft_load(tc, dirname) < 0) | 580 | if (ft_load(tc, dirname) < 0) |
580 | { | 581 | { |
581 | splash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); | 582 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); |
582 | global_settings.dirfilter = dirfilter; | 583 | global_settings.dirfilter = dirfilter; |
583 | return -1; | 584 | return -1; |
584 | } | 585 | } |
@@ -739,7 +740,7 @@ static int remove_track_from_playlist(struct playlist_info* playlist, | |||
739 | 740 | ||
740 | if (result < 0) | 741 | if (result < 0) |
741 | { | 742 | { |
742 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); | 743 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); |
743 | return result; | 744 | return result; |
744 | } | 745 | } |
745 | } | 746 | } |
@@ -1086,9 +1087,9 @@ static int get_filename(struct playlist_info* playlist, int seek, | |||
1086 | if (max < 0) | 1087 | if (max < 0) |
1087 | { | 1088 | { |
1088 | if (control_file) | 1089 | if (control_file) |
1089 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); | 1090 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); |
1090 | else | 1091 | else |
1091 | splash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); | 1092 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); |
1092 | 1093 | ||
1093 | return max; | 1094 | return max; |
1094 | } | 1095 | } |
@@ -1155,7 +1156,7 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion) | |||
1155 | 1156 | ||
1156 | if (ft_load(tc, (dir[0]=='\0')?"/":dir) < 0) | 1157 | if (ft_load(tc, (dir[0]=='\0')?"/":dir) < 0) |
1157 | { | 1158 | { |
1158 | splash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); | 1159 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); |
1159 | exit = true; | 1160 | exit = true; |
1160 | result = -1; | 1161 | result = -1; |
1161 | break; | 1162 | break; |
@@ -1240,7 +1241,7 @@ static int check_subdir_for_music(char *dir, char *subdir) | |||
1240 | 1241 | ||
1241 | if (ft_load(tc, dir) < 0) | 1242 | if (ft_load(tc, dir) < 0) |
1242 | { | 1243 | { |
1243 | splash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); | 1244 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); |
1244 | return -2; | 1245 | return -2; |
1245 | } | 1246 | } |
1246 | 1247 | ||
@@ -1293,7 +1294,7 @@ static int check_subdir_for_music(char *dir, char *subdir) | |||
1293 | 1294 | ||
1294 | /* we now need to reload our current directory */ | 1295 | /* we now need to reload our current directory */ |
1295 | if(ft_load(tc, dir) < 0) | 1296 | if(ft_load(tc, dir) < 0) |
1296 | splash(HZ*2, true, | 1297 | gui_syncsplash(HZ*2, true, |
1297 | str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); | 1298 | str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); |
1298 | } | 1299 | } |
1299 | 1300 | ||
@@ -1378,7 +1379,7 @@ static void display_playlist_count(int count, const char *fmt) | |||
1378 | lcd_setmargins(0, 0); | 1379 | lcd_setmargins(0, 0); |
1379 | #endif | 1380 | #endif |
1380 | 1381 | ||
1381 | splash(0, true, fmt, count, | 1382 | gui_syncsplash(0, true, fmt, count, |
1382 | #if CONFIG_KEYPAD == PLAYER_PAD | 1383 | #if CONFIG_KEYPAD == PLAYER_PAD |
1383 | str(LANG_STOP_ABORT) | 1384 | str(LANG_STOP_ABORT) |
1384 | #else | 1385 | #else |
@@ -1392,7 +1393,7 @@ static void display_playlist_count(int count, const char *fmt) | |||
1392 | */ | 1393 | */ |
1393 | static void display_buffer_full(void) | 1394 | static void display_buffer_full(void) |
1394 | { | 1395 | { |
1395 | splash(HZ*2, true, "%s %s", | 1396 | gui_syncsplash(HZ*2, true, "%s %s", |
1396 | str(LANG_PLAYINDICES_PLAYLIST), | 1397 | str(LANG_PLAYINDICES_PLAYLIST), |
1397 | str(LANG_PLAYINDICES_BUFFER)); | 1398 | str(LANG_PLAYINDICES_BUFFER)); |
1398 | } | 1399 | } |
@@ -1439,7 +1440,7 @@ static int flush_pending_control(struct playlist_info* playlist) | |||
1439 | 1440 | ||
1440 | if (result < 0) | 1441 | if (result < 0) |
1441 | { | 1442 | { |
1442 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); | 1443 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); |
1443 | return result; | 1444 | return result; |
1444 | } | 1445 | } |
1445 | } | 1446 | } |
@@ -1540,7 +1541,7 @@ int playlist_resume(void) | |||
1540 | playlist->control_fd = open(playlist->control_filename, O_RDWR); | 1541 | playlist->control_fd = open(playlist->control_filename, O_RDWR); |
1541 | if (playlist->control_fd < 0) | 1542 | if (playlist->control_fd < 0) |
1542 | { | 1543 | { |
1543 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); | 1544 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); |
1544 | return -1; | 1545 | return -1; |
1545 | } | 1546 | } |
1546 | playlist->control_created = true; | 1547 | playlist->control_created = true; |
@@ -1548,7 +1549,7 @@ int playlist_resume(void) | |||
1548 | control_file_size = filesize(playlist->control_fd); | 1549 | control_file_size = filesize(playlist->control_fd); |
1549 | if (control_file_size <= 0) | 1550 | if (control_file_size <= 0) |
1550 | { | 1551 | { |
1551 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); | 1552 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); |
1552 | return -1; | 1553 | return -1; |
1553 | } | 1554 | } |
1554 | 1555 | ||
@@ -1557,7 +1558,7 @@ int playlist_resume(void) | |||
1557 | PLAYLIST_COMMAND_SIZE<buflen?PLAYLIST_COMMAND_SIZE:buflen); | 1558 | PLAYLIST_COMMAND_SIZE<buflen?PLAYLIST_COMMAND_SIZE:buflen); |
1558 | if(nread <= 0) | 1559 | if(nread <= 0) |
1559 | { | 1560 | { |
1560 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); | 1561 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); |
1561 | return -1; | 1562 | return -1; |
1562 | } | 1563 | } |
1563 | 1564 | ||
@@ -1833,7 +1834,7 @@ int playlist_resume(void) | |||
1833 | 1834 | ||
1834 | if (result < 0) | 1835 | if (result < 0) |
1835 | { | 1836 | { |
1836 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_INVALID)); | 1837 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_INVALID)); |
1837 | return result; | 1838 | return result; |
1838 | } | 1839 | } |
1839 | 1840 | ||
@@ -1842,7 +1843,7 @@ int playlist_resume(void) | |||
1842 | if ((total_read + count) >= control_file_size) | 1843 | if ((total_read + count) >= control_file_size) |
1843 | { | 1844 | { |
1844 | /* no newline at end of control file */ | 1845 | /* no newline at end of control file */ |
1845 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_INVALID)); | 1846 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_INVALID)); |
1846 | return -1; | 1847 | return -1; |
1847 | } | 1848 | } |
1848 | 1849 | ||
@@ -1929,7 +1930,7 @@ int playlist_shuffle(int random_seed, int start_index) | |||
1929 | start_current = true; | 1930 | start_current = true; |
1930 | } | 1931 | } |
1931 | 1932 | ||
1932 | splash(0, true, str(LANG_PLAYLIST_SHUFFLE)); | 1933 | gui_syncsplash(0, true, str(LANG_PLAYLIST_SHUFFLE)); |
1933 | 1934 | ||
1934 | randomise_playlist(playlist, random_seed, start_current, true); | 1935 | randomise_playlist(playlist, random_seed, start_current, true); |
1935 | 1936 | ||
@@ -2138,7 +2139,7 @@ int playlist_next(int steps) | |||
2138 | 2139 | ||
2139 | if (result < 0) | 2140 | if (result < 0) |
2140 | { | 2141 | { |
2141 | splash(HZ*2, true, | 2142 | gui_syncsplash(HZ*2, true, |
2142 | str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); | 2143 | str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); |
2143 | return result; | 2144 | return result; |
2144 | } | 2145 | } |
@@ -2361,7 +2362,7 @@ int playlist_insert_track(struct playlist_info* playlist, | |||
2361 | 2362 | ||
2362 | if (check_control(playlist) < 0) | 2363 | if (check_control(playlist) < 0) |
2363 | { | 2364 | { |
2364 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); | 2365 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); |
2365 | return -1; | 2366 | return -1; |
2366 | } | 2367 | } |
2367 | 2368 | ||
@@ -2396,7 +2397,7 @@ int playlist_insert_directory(struct playlist_info* playlist, | |||
2396 | 2397 | ||
2397 | if (check_control(playlist) < 0) | 2398 | if (check_control(playlist) < 0) |
2398 | { | 2399 | { |
2399 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); | 2400 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); |
2400 | return -1; | 2401 | return -1; |
2401 | } | 2402 | } |
2402 | 2403 | ||
@@ -2443,14 +2444,14 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename, | |||
2443 | 2444 | ||
2444 | if (check_control(playlist) < 0) | 2445 | if (check_control(playlist) < 0) |
2445 | { | 2446 | { |
2446 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); | 2447 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); |
2447 | return -1; | 2448 | return -1; |
2448 | } | 2449 | } |
2449 | 2450 | ||
2450 | fd = open(filename, O_RDONLY); | 2451 | fd = open(filename, O_RDONLY); |
2451 | if (fd < 0) | 2452 | if (fd < 0) |
2452 | { | 2453 | { |
2453 | splash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); | 2454 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); |
2454 | return -1; | 2455 | return -1; |
2455 | } | 2456 | } |
2456 | 2457 | ||
@@ -2549,7 +2550,7 @@ int playlist_delete(struct playlist_info* playlist, int index) | |||
2549 | 2550 | ||
2550 | if (check_control(playlist) < 0) | 2551 | if (check_control(playlist) < 0) |
2551 | { | 2552 | { |
2552 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); | 2553 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); |
2553 | return -1; | 2554 | return -1; |
2554 | } | 2555 | } |
2555 | 2556 | ||
@@ -2583,7 +2584,7 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index) | |||
2583 | 2584 | ||
2584 | if (check_control(playlist) < 0) | 2585 | if (check_control(playlist) < 0) |
2585 | { | 2586 | { |
2586 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); | 2587 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); |
2587 | return -1; | 2588 | return -1; |
2588 | } | 2589 | } |
2589 | 2590 | ||
@@ -2837,7 +2838,7 @@ int playlist_save(struct playlist_info* playlist, char *filename) | |||
2837 | fd = open(tmp_buf, O_CREAT|O_WRONLY|O_TRUNC); | 2838 | fd = open(tmp_buf, O_CREAT|O_WRONLY|O_TRUNC); |
2838 | if (fd < 0) | 2839 | if (fd < 0) |
2839 | { | 2840 | { |
2840 | splash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); | 2841 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); |
2841 | return -1; | 2842 | return -1; |
2842 | } | 2843 | } |
2843 | 2844 | ||
@@ -2870,7 +2871,7 @@ int playlist_save(struct playlist_info* playlist, char *filename) | |||
2870 | 2871 | ||
2871 | if (fdprintf(fd, "%s\n", tmp_buf) < 0) | 2872 | if (fdprintf(fd, "%s\n", tmp_buf) < 0) |
2872 | { | 2873 | { |
2873 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); | 2874 | gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); |
2874 | result = -1; | 2875 | result = -1; |
2875 | break; | 2876 | break; |
2876 | } | 2877 | } |