forked from len0rd/rockbox
PictureFlow: Warn Before Erasing Playlist
Respect system-wide setting, in consistence with browser behavior Change-Id: I7df90554a466ed5ca1b99da179cc7d95360499b6
This commit is contained in:
parent
2512ed1c56
commit
0da0390b85
3 changed files with 25 additions and 5 deletions
|
|
@ -802,7 +802,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
plugin_get_current_filename,
|
plugin_get_current_filename,
|
||||||
/* new stuff at the end, sort into place next time
|
/* new stuff at the end, sort into place next time
|
||||||
the API gets incompatible */
|
the API gets incompatible */
|
||||||
|
warn_on_pl_erase,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int plugin_buffer_handle;
|
static int plugin_buffer_handle;
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ int plugin_open(const char *plugin, const char *parameter);
|
||||||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 245
|
#define PLUGIN_API_VERSION 246
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
|
|
@ -928,6 +928,7 @@ struct plugin_api {
|
||||||
char* (*plugin_get_current_filename)(void);
|
char* (*plugin_get_current_filename)(void);
|
||||||
/* new stuff at the end, sort into place next time
|
/* new stuff at the end, sort into place next time
|
||||||
the API gets incompatible */
|
the API gets incompatible */
|
||||||
|
bool (*warn_on_pl_erase)(void);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3227,7 +3227,7 @@ static int main_menu(void)
|
||||||
return -2;
|
return -2;
|
||||||
#if PF_PLAYBACK_CAPABLE
|
#if PF_PLAYBACK_CAPABLE
|
||||||
case PF_MENU_CLEAR_PLAYLIST:
|
case PF_MENU_CLEAR_PLAYLIST:
|
||||||
if(rb->playlist_remove_all_tracks(NULL) == 0) {
|
if(rb->warn_on_pl_erase() && rb->playlist_remove_all_tracks(NULL) == 0) {
|
||||||
rb->playlist_create(NULL, NULL);
|
rb->playlist_create(NULL, NULL);
|
||||||
rb->splash(HZ*2, ID2P(LANG_PLAYLIST_CLEARED));
|
rb->splash(HZ*2, ID2P(LANG_PLAYLIST_CLEARED));
|
||||||
}
|
}
|
||||||
|
|
@ -3484,6 +3484,19 @@ static void select_prev_track(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PF_PLAYBACK_CAPABLE
|
#if PF_PLAYBACK_CAPABLE
|
||||||
|
|
||||||
|
static bool pf_warn_on_pl_erase(void)
|
||||||
|
{
|
||||||
|
#ifdef USEGSLIB
|
||||||
|
grey_show(false);
|
||||||
|
#endif
|
||||||
|
bool ret = rb->warn_on_pl_erase();
|
||||||
|
#ifdef USEGSLIB
|
||||||
|
grey_show(true);
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Puts the current tracklist into a newly created playlist and starts playling
|
* Puts the current tracklist into a newly created playlist and starts playling
|
||||||
*/
|
*/
|
||||||
|
|
@ -3523,7 +3536,11 @@ play:
|
||||||
* if shuffle, we can't predict the playing track easily, and for either
|
* if shuffle, we can't predict the playing track easily, and for either
|
||||||
* case the track list doesn't get auto scrolled*/
|
* case the track list doesn't get auto scrolled*/
|
||||||
if(!append)
|
if(!append)
|
||||||
|
{
|
||||||
rb->playlist_start(position, 0, 0);
|
rb->playlist_start(position, 0, 0);
|
||||||
|
/* make warn on playlist erase work */
|
||||||
|
rb->playlist_get_current()->num_inserted_tracks = 0;
|
||||||
|
}
|
||||||
old_playlist = center_slide.slide_index;
|
old_playlist = center_slide.slide_index;
|
||||||
old_shuffle = shuffle;
|
old_shuffle = shuffle;
|
||||||
}
|
}
|
||||||
|
|
@ -3956,6 +3973,8 @@ static int pictureflow_main(void)
|
||||||
set_current_slide(target);
|
set_current_slide(target);
|
||||||
#if PF_PLAYBACK_CAPABLE
|
#if PF_PLAYBACK_CAPABLE
|
||||||
if(pf_cfg.auto_wps == 1) {
|
if(pf_cfg.auto_wps == 1) {
|
||||||
|
if (!pf_warn_on_pl_erase())
|
||||||
|
break;
|
||||||
create_track_index(center_slide.slide_index);
|
create_track_index(center_slide.slide_index);
|
||||||
reset_track_list();
|
reset_track_list();
|
||||||
start_playback(false);
|
start_playback(false);
|
||||||
|
|
@ -3970,15 +3989,15 @@ static int pictureflow_main(void)
|
||||||
revert_cover_out_animation();
|
revert_cover_out_animation();
|
||||||
else if (pf_state == pf_cover_in)
|
else if (pf_state == pf_cover_in)
|
||||||
interrupt_cover_in_animation();
|
interrupt_cover_in_animation();
|
||||||
else if ( pf_state == pf_show_tracks ) {
|
|
||||||
#if PF_PLAYBACK_CAPABLE
|
#if PF_PLAYBACK_CAPABLE
|
||||||
|
else if (pf_state == pf_show_tracks && pf_warn_on_pl_erase()) {
|
||||||
start_playback(false);
|
start_playback(false);
|
||||||
if(pf_cfg.auto_wps != 0) {
|
if(pf_cfg.auto_wps != 0) {
|
||||||
pf_cfg.last_album = center_index;
|
pf_cfg.last_album = center_index;
|
||||||
return PLUGIN_GOTO_WPS;
|
return PLUGIN_GOTO_WPS;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
exit_on_usb(button);
|
exit_on_usb(button);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue