diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2021-11-21 11:31:11 +0100 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-12-02 17:37:15 -0500 |
commit | 0da0390b85edf0e27b8c79cd436881d959b1574e (patch) | |
tree | e471d284154daba2bf43793314f46e821053143e | |
parent | 2512ed1c56a7c415f5a13ac2f38f72278e3ac660 (diff) | |
download | rockbox-0da0390b85edf0e27b8c79cd436881d959b1574e.tar.gz rockbox-0da0390b85edf0e27b8c79cd436881d959b1574e.zip |
PictureFlow: Warn Before Erasing Playlist
Respect system-wide setting, in
consistence with browser behavior
Change-Id: I7df90554a466ed5ca1b99da179cc7d95360499b6
-rw-r--r-- | apps/plugin.c | 2 | ||||
-rw-r--r-- | apps/plugin.h | 3 | ||||
-rw-r--r-- | apps/plugins/pictureflow/pictureflow.c | 25 |
3 files changed, 25 insertions, 5 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index a19b3ee226..0225491d85 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -802,7 +802,7 @@ static const struct plugin_api rockbox_api = { | |||
802 | plugin_get_current_filename, | 802 | plugin_get_current_filename, |
803 | /* new stuff at the end, sort into place next time | 803 | /* new stuff at the end, sort into place next time |
804 | the API gets incompatible */ | 804 | the API gets incompatible */ |
805 | 805 | warn_on_pl_erase, | |
806 | }; | 806 | }; |
807 | 807 | ||
808 | static int plugin_buffer_handle; | 808 | static int plugin_buffer_handle; |
diff --git a/apps/plugin.h b/apps/plugin.h index e1b7c69f96..6ad495b5a6 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -155,7 +155,7 @@ int plugin_open(const char *plugin, const char *parameter); | |||
155 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 155 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
156 | 156 | ||
157 | /* increase this every time the api struct changes */ | 157 | /* increase this every time the api struct changes */ |
158 | #define PLUGIN_API_VERSION 245 | 158 | #define PLUGIN_API_VERSION 246 |
159 | 159 | ||
160 | /* update this to latest version if a change to the api struct breaks | 160 | /* update this to latest version if a change to the api struct breaks |
161 | backwards compatibility (and please take the opportunity to sort in any | 161 | backwards compatibility (and please take the opportunity to sort in any |
@@ -928,6 +928,7 @@ struct plugin_api { | |||
928 | char* (*plugin_get_current_filename)(void); | 928 | char* (*plugin_get_current_filename)(void); |
929 | /* new stuff at the end, sort into place next time | 929 | /* new stuff at the end, sort into place next time |
930 | the API gets incompatible */ | 930 | the API gets incompatible */ |
931 | bool (*warn_on_pl_erase)(void); | ||
931 | 932 | ||
932 | }; | 933 | }; |
933 | 934 | ||
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 07403083f0..aebbc9aa6d 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c | |||
@@ -3227,7 +3227,7 @@ static int main_menu(void) | |||
3227 | return -2; | 3227 | return -2; |
3228 | #if PF_PLAYBACK_CAPABLE | 3228 | #if PF_PLAYBACK_CAPABLE |
3229 | case PF_MENU_CLEAR_PLAYLIST: | 3229 | case PF_MENU_CLEAR_PLAYLIST: |
3230 | if(rb->playlist_remove_all_tracks(NULL) == 0) { | 3230 | if(rb->warn_on_pl_erase() && rb->playlist_remove_all_tracks(NULL) == 0) { |
3231 | rb->playlist_create(NULL, NULL); | 3231 | rb->playlist_create(NULL, NULL); |
3232 | rb->splash(HZ*2, ID2P(LANG_PLAYLIST_CLEARED)); | 3232 | rb->splash(HZ*2, ID2P(LANG_PLAYLIST_CLEARED)); |
3233 | } | 3233 | } |
@@ -3484,6 +3484,19 @@ static void select_prev_track(void) | |||
3484 | } | 3484 | } |
3485 | 3485 | ||
3486 | #if PF_PLAYBACK_CAPABLE | 3486 | #if PF_PLAYBACK_CAPABLE |
3487 | |||
3488 | static bool pf_warn_on_pl_erase(void) | ||
3489 | { | ||
3490 | #ifdef USEGSLIB | ||
3491 | grey_show(false); | ||
3492 | #endif | ||
3493 | bool ret = rb->warn_on_pl_erase(); | ||
3494 | #ifdef USEGSLIB | ||
3495 | grey_show(true); | ||
3496 | #endif | ||
3497 | return ret; | ||
3498 | } | ||
3499 | |||
3487 | /* | 3500 | /* |
3488 | * Puts the current tracklist into a newly created playlist and starts playling | 3501 | * Puts the current tracklist into a newly created playlist and starts playling |
3489 | */ | 3502 | */ |
@@ -3523,7 +3536,11 @@ play: | |||
3523 | * if shuffle, we can't predict the playing track easily, and for either | 3536 | * if shuffle, we can't predict the playing track easily, and for either |
3524 | * case the track list doesn't get auto scrolled*/ | 3537 | * case the track list doesn't get auto scrolled*/ |
3525 | if(!append) | 3538 | if(!append) |
3539 | { | ||
3526 | rb->playlist_start(position, 0, 0); | 3540 | rb->playlist_start(position, 0, 0); |
3541 | /* make warn on playlist erase work */ | ||
3542 | rb->playlist_get_current()->num_inserted_tracks = 0; | ||
3543 | } | ||
3527 | old_playlist = center_slide.slide_index; | 3544 | old_playlist = center_slide.slide_index; |
3528 | old_shuffle = shuffle; | 3545 | old_shuffle = shuffle; |
3529 | } | 3546 | } |
@@ -3956,6 +3973,8 @@ static int pictureflow_main(void) | |||
3956 | set_current_slide(target); | 3973 | set_current_slide(target); |
3957 | #if PF_PLAYBACK_CAPABLE | 3974 | #if PF_PLAYBACK_CAPABLE |
3958 | if(pf_cfg.auto_wps == 1) { | 3975 | if(pf_cfg.auto_wps == 1) { |
3976 | if (!pf_warn_on_pl_erase()) | ||
3977 | break; | ||
3959 | create_track_index(center_slide.slide_index); | 3978 | create_track_index(center_slide.slide_index); |
3960 | reset_track_list(); | 3979 | reset_track_list(); |
3961 | start_playback(false); | 3980 | start_playback(false); |
@@ -3970,15 +3989,15 @@ static int pictureflow_main(void) | |||
3970 | revert_cover_out_animation(); | 3989 | revert_cover_out_animation(); |
3971 | else if (pf_state == pf_cover_in) | 3990 | else if (pf_state == pf_cover_in) |
3972 | interrupt_cover_in_animation(); | 3991 | interrupt_cover_in_animation(); |
3973 | else if ( pf_state == pf_show_tracks ) { | ||
3974 | #if PF_PLAYBACK_CAPABLE | 3992 | #if PF_PLAYBACK_CAPABLE |
3993 | else if (pf_state == pf_show_tracks && pf_warn_on_pl_erase()) { | ||
3975 | start_playback(false); | 3994 | start_playback(false); |
3976 | if(pf_cfg.auto_wps != 0) { | 3995 | if(pf_cfg.auto_wps != 0) { |
3977 | pf_cfg.last_album = center_index; | 3996 | pf_cfg.last_album = center_index; |
3978 | return PLUGIN_GOTO_WPS; | 3997 | return PLUGIN_GOTO_WPS; |
3979 | } | 3998 | } |
3980 | #endif | ||
3981 | } | 3999 | } |
4000 | #endif | ||
3982 | break; | 4001 | break; |
3983 | default: | 4002 | default: |
3984 | exit_on_usb(button); | 4003 | exit_on_usb(button); |