mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
some multi-screen work in playlist.c, properly formated splash.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7766 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e7461b3609
commit
3aa842c9a3
3 changed files with 36 additions and 31 deletions
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#ifndef _GUI_ICON_H_
|
#ifndef _GUI_ICON_H_
|
||||||
#define _GUI_ICON_H_
|
#define _GUI_ICON_H_
|
||||||
#include "lcd.h"
|
|
||||||
#include "screen_access.h"
|
#include "screen_access.h"
|
||||||
/* Defines a type for the icons since it's not the same thing on
|
/* Defines a type for the icons since it's not the same thing on
|
||||||
* char-based displays and bitmap displays */
|
* char-based displays and bitmap displays */
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _GUI_SPLASH_H_
|
||||||
|
#define _GUI_SPLASH_H_
|
||||||
|
#include "screen_access.h"
|
||||||
/*
|
/*
|
||||||
* Puts a splash message on the given screen for a given period
|
* Puts a splash message on the given screen for a given period
|
||||||
* - screen : the screen to put the splash on
|
* - screen : the screen to put the splash on
|
||||||
|
@ -37,3 +40,5 @@ extern void gui_splash(struct screen * screen, int ticks,
|
||||||
*/
|
*/
|
||||||
extern void gui_syncsplash(int ticks, bool center,
|
extern void gui_syncsplash(int ticks, bool center,
|
||||||
const char *fmt, ...);
|
const char *fmt, ...);
|
||||||
|
|
||||||
|
#endif /* _GUI_ICON_H_ */
|
||||||
|
|
|
@ -93,6 +93,7 @@
|
||||||
|
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "talk.h"
|
#include "talk.h"
|
||||||
|
#include "splash.h"
|
||||||
|
|
||||||
#define PLAYLIST_CONTROL_FILE ROCKBOX_DIR "/.playlist_control"
|
#define PLAYLIST_CONTROL_FILE ROCKBOX_DIR "/.playlist_control"
|
||||||
#define PLAYLIST_CONTROL_FILE_VERSION 2
|
#define PLAYLIST_CONTROL_FILE_VERSION 2
|
||||||
|
@ -245,7 +246,7 @@ static void new_playlist(struct playlist_info* playlist, const char *dir,
|
||||||
PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0)
|
PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0)
|
||||||
fsync(playlist->control_fd);
|
fsync(playlist->control_fd);
|
||||||
else
|
else
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +261,7 @@ static void create_control(struct playlist_info* playlist)
|
||||||
{
|
{
|
||||||
if (check_rockboxdir())
|
if (check_rockboxdir())
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, "%s (%d)",
|
gui_syncsplash(HZ*2, true, "%s (%d)",
|
||||||
str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR),
|
str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR),
|
||||||
playlist->control_fd);
|
playlist->control_fd);
|
||||||
}
|
}
|
||||||
|
@ -294,7 +295,7 @@ static int check_control(struct playlist_info* playlist)
|
||||||
PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0)
|
PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0)
|
||||||
fsync(playlist->control_fd);
|
fsync(playlist->control_fd);
|
||||||
else
|
else
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
||||||
|
|
||||||
playlist->filename[playlist->dirlen-1] = c;
|
playlist->filename[playlist->dirlen-1] = c;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +354,7 @@ static int add_indices_to_playlist(struct playlist_info* playlist,
|
||||||
lcd_setmargins(0, 0);
|
lcd_setmargins(0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
splash(0, true, str(LANG_PLAYLIST_LOAD));
|
gui_syncsplash(0, true, str(LANG_PLAYLIST_LOAD));
|
||||||
|
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
{
|
{
|
||||||
|
@ -544,7 +545,7 @@ static int add_track_to_playlist(struct playlist_info* playlist,
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -578,7 +579,7 @@ static int add_directory_to_playlist(struct playlist_info* playlist,
|
||||||
|
|
||||||
if (ft_load(tc, dirname) < 0)
|
if (ft_load(tc, dirname) < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
|
||||||
global_settings.dirfilter = dirfilter;
|
global_settings.dirfilter = dirfilter;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -739,7 +740,7 @@ static int remove_track_from_playlist(struct playlist_info* playlist,
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1086,9 +1087,9 @@ static int get_filename(struct playlist_info* playlist, int seek,
|
||||||
if (max < 0)
|
if (max < 0)
|
||||||
{
|
{
|
||||||
if (control_file)
|
if (control_file)
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
||||||
else
|
else
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR));
|
||||||
|
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
@ -1155,7 +1156,7 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion)
|
||||||
|
|
||||||
if (ft_load(tc, (dir[0]=='\0')?"/":dir) < 0)
|
if (ft_load(tc, (dir[0]=='\0')?"/":dir) < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
|
||||||
exit = true;
|
exit = true;
|
||||||
result = -1;
|
result = -1;
|
||||||
break;
|
break;
|
||||||
|
@ -1240,7 +1241,7 @@ static int check_subdir_for_music(char *dir, char *subdir)
|
||||||
|
|
||||||
if (ft_load(tc, dir) < 0)
|
if (ft_load(tc, dir) < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1293,7 +1294,7 @@ static int check_subdir_for_music(char *dir, char *subdir)
|
||||||
|
|
||||||
/* we now need to reload our current directory */
|
/* we now need to reload our current directory */
|
||||||
if(ft_load(tc, dir) < 0)
|
if(ft_load(tc, dir) < 0)
|
||||||
splash(HZ*2, true,
|
gui_syncsplash(HZ*2, true,
|
||||||
str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
|
str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1378,7 +1379,7 @@ static void display_playlist_count(int count, const char *fmt)
|
||||||
lcd_setmargins(0, 0);
|
lcd_setmargins(0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
splash(0, true, fmt, count,
|
gui_syncsplash(0, true, fmt, count,
|
||||||
#if CONFIG_KEYPAD == PLAYER_PAD
|
#if CONFIG_KEYPAD == PLAYER_PAD
|
||||||
str(LANG_STOP_ABORT)
|
str(LANG_STOP_ABORT)
|
||||||
#else
|
#else
|
||||||
|
@ -1392,7 +1393,7 @@ static void display_playlist_count(int count, const char *fmt)
|
||||||
*/
|
*/
|
||||||
static void display_buffer_full(void)
|
static void display_buffer_full(void)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, "%s %s",
|
gui_syncsplash(HZ*2, true, "%s %s",
|
||||||
str(LANG_PLAYINDICES_PLAYLIST),
|
str(LANG_PLAYINDICES_PLAYLIST),
|
||||||
str(LANG_PLAYINDICES_BUFFER));
|
str(LANG_PLAYINDICES_BUFFER));
|
||||||
}
|
}
|
||||||
|
@ -1439,7 +1440,7 @@ static int flush_pending_control(struct playlist_info* playlist)
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1540,7 +1541,7 @@ int playlist_resume(void)
|
||||||
playlist->control_fd = open(playlist->control_filename, O_RDWR);
|
playlist->control_fd = open(playlist->control_filename, O_RDWR);
|
||||||
if (playlist->control_fd < 0)
|
if (playlist->control_fd < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
playlist->control_created = true;
|
playlist->control_created = true;
|
||||||
|
@ -1548,7 +1549,7 @@ int playlist_resume(void)
|
||||||
control_file_size = filesize(playlist->control_fd);
|
control_file_size = filesize(playlist->control_fd);
|
||||||
if (control_file_size <= 0)
|
if (control_file_size <= 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1557,7 +1558,7 @@ int playlist_resume(void)
|
||||||
PLAYLIST_COMMAND_SIZE<buflen?PLAYLIST_COMMAND_SIZE:buflen);
|
PLAYLIST_COMMAND_SIZE<buflen?PLAYLIST_COMMAND_SIZE:buflen);
|
||||||
if(nread <= 0)
|
if(nread <= 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1833,7 +1834,7 @@ int playlist_resume(void)
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_INVALID));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_INVALID));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1842,7 +1843,7 @@ int playlist_resume(void)
|
||||||
if ((total_read + count) >= control_file_size)
|
if ((total_read + count) >= control_file_size)
|
||||||
{
|
{
|
||||||
/* no newline at end of control file */
|
/* no newline at end of control file */
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_INVALID));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_INVALID));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1929,7 +1930,7 @@ int playlist_shuffle(int random_seed, int start_index)
|
||||||
start_current = true;
|
start_current = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
splash(0, true, str(LANG_PLAYLIST_SHUFFLE));
|
gui_syncsplash(0, true, str(LANG_PLAYLIST_SHUFFLE));
|
||||||
|
|
||||||
randomise_playlist(playlist, random_seed, start_current, true);
|
randomise_playlist(playlist, random_seed, start_current, true);
|
||||||
|
|
||||||
|
@ -2138,7 +2139,7 @@ int playlist_next(int steps)
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true,
|
gui_syncsplash(HZ*2, true,
|
||||||
str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2361,7 +2362,7 @@ int playlist_insert_track(struct playlist_info* playlist,
|
||||||
|
|
||||||
if (check_control(playlist) < 0)
|
if (check_control(playlist) < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2396,7 +2397,7 @@ int playlist_insert_directory(struct playlist_info* playlist,
|
||||||
|
|
||||||
if (check_control(playlist) < 0)
|
if (check_control(playlist) < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2443,14 +2444,14 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
|
||||||
|
|
||||||
if (check_control(playlist) < 0)
|
if (check_control(playlist) < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open(filename, O_RDONLY);
|
fd = open(filename, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2549,7 +2550,7 @@ int playlist_delete(struct playlist_info* playlist, int index)
|
||||||
|
|
||||||
if (check_control(playlist) < 0)
|
if (check_control(playlist) < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2583,7 +2584,7 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
|
||||||
|
|
||||||
if (check_control(playlist) < 0)
|
if (check_control(playlist) < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2837,7 +2838,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
|
||||||
fd = open(tmp_buf, O_CREAT|O_WRONLY|O_TRUNC);
|
fd = open(tmp_buf, O_CREAT|O_WRONLY|O_TRUNC);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2870,7 +2871,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
|
||||||
|
|
||||||
if (fdprintf(fd, "%s\n", tmp_buf) < 0)
|
if (fdprintf(fd, "%s\n", tmp_buf) < 0)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
|
||||||
result = -1;
|
result = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue