mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
playlist: Fix warning when erasing playlist after reboot
Unless you had manually resumed the playlist, you didn't get any warning after Rockbox rebooted, when replacing a modified current playlist. Change-Id: Ibc83e3db4e6ee51e94204ac7732760894d2fb602
This commit is contained in:
parent
9310b51841
commit
fb26398622
3 changed files with 12 additions and 1 deletions
|
|
@ -2666,7 +2666,11 @@ int playlist_insert_track(struct playlist_info* playlist, const char *filename,
|
||||||
bool playlist_modified(const struct playlist_info* playlist)
|
bool playlist_modified(const struct playlist_info* playlist)
|
||||||
{
|
{
|
||||||
if (!playlist)
|
if (!playlist)
|
||||||
|
{
|
||||||
playlist = ¤t_playlist;
|
playlist = ¤t_playlist;
|
||||||
|
if (!current_playlist.control_created)
|
||||||
|
return global_status.resume_modified;
|
||||||
|
}
|
||||||
|
|
||||||
return !!(playlist->flags & PLAYLIST_FLAG_MODIFIED);
|
return !!(playlist->flags & PLAYLIST_FLAG_MODIFIED);
|
||||||
}
|
}
|
||||||
|
|
@ -3751,11 +3755,14 @@ int playlist_update_resume_info(const struct mp3entry* id3)
|
||||||
{
|
{
|
||||||
struct playlist_info* playlist = ¤t_playlist;
|
struct playlist_info* playlist = ¤t_playlist;
|
||||||
|
|
||||||
|
bool pl_modified = (PLAYLIST_FLAG_MODIFIED ==
|
||||||
|
(playlist->flags & PLAYLIST_FLAG_MODIFIED));
|
||||||
if (id3)
|
if (id3)
|
||||||
{
|
{
|
||||||
if (global_status.resume_index != playlist->index ||
|
if (global_status.resume_index != playlist->index ||
|
||||||
global_status.resume_elapsed != id3->elapsed ||
|
global_status.resume_elapsed != id3->elapsed ||
|
||||||
global_status.resume_offset != id3->offset)
|
global_status.resume_offset != id3->offset ||
|
||||||
|
global_status.resume_modified != pl_modified)
|
||||||
{
|
{
|
||||||
unsigned int crc = playlist_get_filename_crc32(playlist,
|
unsigned int crc = playlist_get_filename_crc32(playlist,
|
||||||
playlist->index);
|
playlist->index);
|
||||||
|
|
@ -3763,6 +3770,7 @@ int playlist_update_resume_info(const struct mp3entry* id3)
|
||||||
global_status.resume_crc32 = crc;
|
global_status.resume_crc32 = crc;
|
||||||
global_status.resume_elapsed = id3->elapsed;
|
global_status.resume_elapsed = id3->elapsed;
|
||||||
global_status.resume_offset = id3->offset;
|
global_status.resume_offset = id3->offset;
|
||||||
|
global_status.resume_modified = pl_modified;
|
||||||
status_save();
|
status_save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3772,6 +3780,7 @@ int playlist_update_resume_info(const struct mp3entry* id3)
|
||||||
global_status.resume_crc32 = -1;
|
global_status.resume_crc32 = -1;
|
||||||
global_status.resume_elapsed = -1;
|
global_status.resume_elapsed = -1;
|
||||||
global_status.resume_offset = -1;
|
global_status.resume_offset = -1;
|
||||||
|
global_status.resume_modified = false;
|
||||||
status_save();
|
status_save();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -340,6 +340,7 @@ struct system_status
|
||||||
int last_volume_change; /* tick the last volume change happened. skins use this */
|
int last_volume_change; /* tick the last volume change happened. skins use this */
|
||||||
int font_id[NB_SCREENS]; /* font id of the settings font for each screen */
|
int font_id[NB_SCREENS]; /* font id of the settings font for each screen */
|
||||||
|
|
||||||
|
bool resume_modified; /* playlist is modified (=> warn before erase) */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct user_settings
|
struct user_settings
|
||||||
|
|
|
||||||
|
|
@ -976,6 +976,7 @@ const struct settings_list settings[] = {
|
||||||
SYSTEM_SETTING(NVRAM(4), resume_crc32, -1),
|
SYSTEM_SETTING(NVRAM(4), resume_crc32, -1),
|
||||||
SYSTEM_SETTING(NVRAM(4), resume_elapsed, -1),
|
SYSTEM_SETTING(NVRAM(4), resume_elapsed, -1),
|
||||||
SYSTEM_SETTING(NVRAM(4), resume_offset, -1),
|
SYSTEM_SETTING(NVRAM(4), resume_offset, -1),
|
||||||
|
SYSTEM_SETTING(NVRAM(4), resume_modified, false),
|
||||||
CHOICE_SETTING(F_CB_ON_SELECT_ONLY|F_CB_ONLY_IF_CHANGED, repeat_mode,
|
CHOICE_SETTING(F_CB_ON_SELECT_ONLY|F_CB_ONLY_IF_CHANGED, repeat_mode,
|
||||||
LANG_REPEAT, REPEAT_OFF, "repeat", "off,all,one,shuffle"
|
LANG_REPEAT, REPEAT_OFF, "repeat", "off,all,one,shuffle"
|
||||||
#ifdef AB_REPEAT_ENABLE
|
#ifdef AB_REPEAT_ENABLE
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue