diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2023-04-15 20:19:25 +0200 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2023-05-26 18:29:07 +0200 |
commit | 49b877470d07e74b3168117975f2540f47531010 (patch) | |
tree | 505c080b574b8a40a6e9b904fcd5bf355c69bfaa /apps/plugins/pictureflow | |
parent | bbef5988175a3d06488b2bd46ffcfaf9e5711fc5 (diff) | |
download | rockbox-49b877470d07e74b3168117975f2540f47531010.tar.gz rockbox-49b877470d07e74b3168117975f2540f47531010.zip |
PictureFlow: Add ability to go to last album
After launch, PictureFlow always goes to the currently playing
album, or to a selected album, if applicable. Which is probably
a useful default, but not always wanted. You can now get back
to the album you were looking at when PictureFlow was last
closed, or when the sorting was last changed.
Change-Id: Iba3e0d5388f6b49534d09fe0224b0dbfa65d5f1d
Diffstat (limited to 'apps/plugins/pictureflow')
-rw-r--r-- | apps/plugins/pictureflow/pictureflow.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 87db58aa34..9896ca45bf 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c | |||
@@ -3241,7 +3241,10 @@ static bool sort_albums(int new_sorting, bool from_settings) | |||
3241 | 3241 | ||
3242 | if(!rb->strcmp(pf_idx.album_names + album_idx, current_album_name) && | 3242 | if(!rb->strcmp(pf_idx.album_names + album_idx, current_album_name) && |
3243 | !rb->strcmp(pf_idx.artist_names + artist_idx, current_album_artist)) | 3243 | !rb->strcmp(pf_idx.artist_names + artist_idx, current_album_artist)) |
3244 | { | ||
3244 | set_current_slide(i); | 3245 | set_current_slide(i); |
3246 | pf_cfg.last_album = i; | ||
3247 | } | ||
3245 | } | 3248 | } |
3246 | return true; | 3249 | return true; |
3247 | } | 3250 | } |
@@ -3651,6 +3654,7 @@ static int settings_menu(void) | |||
3651 | */ | 3654 | */ |
3652 | enum { | 3655 | enum { |
3653 | PF_SHOW_TRACKS_WHILE_BROWSING, | 3656 | PF_SHOW_TRACKS_WHILE_BROWSING, |
3657 | PF_GOTO_LAST_ALBUM, | ||
3654 | PF_GOTO_WPS, | 3658 | PF_GOTO_WPS, |
3655 | #if PF_PLAYBACK_CAPABLE | 3659 | #if PF_PLAYBACK_CAPABLE |
3656 | PF_MENU_CLEAR_PLAYLIST, | 3660 | PF_MENU_CLEAR_PLAYLIST, |
@@ -3664,7 +3668,7 @@ enum { | |||
3664 | static int main_menu(void) | 3668 | static int main_menu(void) |
3665 | { | 3669 | { |
3666 | int selection = 0; | 3670 | int selection = 0; |
3667 | int result; | 3671 | int result, curr_album; |
3668 | 3672 | ||
3669 | #if LCD_DEPTH > 1 | 3673 | #if LCD_DEPTH > 1 |
3670 | rb->lcd_set_foreground(N_BRIGHT(255)); | 3674 | rb->lcd_set_foreground(N_BRIGHT(255)); |
@@ -3672,6 +3676,7 @@ static int main_menu(void) | |||
3672 | 3676 | ||
3673 | MENUITEM_STRINGLIST(main_menu, "PictureFlow Main Menu", NULL, | 3677 | MENUITEM_STRINGLIST(main_menu, "PictureFlow Main Menu", NULL, |
3674 | ID2P(LANG_SHOW_TRACKS_WHILE_BROWSING), | 3678 | ID2P(LANG_SHOW_TRACKS_WHILE_BROWSING), |
3679 | ID2P(LANG_GOTO_LAST_ALBUM), | ||
3675 | ID2P(LANG_GOTO_WPS), | 3680 | ID2P(LANG_GOTO_WPS), |
3676 | #if PF_PLAYBACK_CAPABLE | 3681 | #if PF_PLAYBACK_CAPABLE |
3677 | ID2P(LANG_CLEAR_PLAYLIST), | 3682 | ID2P(LANG_CLEAR_PLAYLIST), |
@@ -3692,6 +3697,24 @@ static int main_menu(void) | |||
3692 | } | 3697 | } |
3693 | show_tracks_while_browsing = true; | 3698 | show_tracks_while_browsing = true; |
3694 | return 0; | 3699 | return 0; |
3700 | case PF_GOTO_LAST_ALBUM: | ||
3701 | if (pf_state == pf_scrolling) | ||
3702 | curr_album = target; | ||
3703 | else | ||
3704 | curr_album = center_index; | ||
3705 | |||
3706 | if (pf_state == pf_show_tracks) | ||
3707 | free_borrowed_tracks(); | ||
3708 | if (pf_state == pf_show_tracks || | ||
3709 | pf_state == pf_cover_in || | ||
3710 | pf_state == pf_cover_out) | ||
3711 | skip_animation_to_idle_state(); | ||
3712 | |||
3713 | set_current_slide(pf_cfg.last_album); | ||
3714 | pf_cfg.last_album = curr_album; | ||
3715 | |||
3716 | pf_state = pf_idle; | ||
3717 | return 0; | ||
3695 | case PF_GOTO_WPS: /* WPS */ | 3718 | case PF_GOTO_WPS: /* WPS */ |
3696 | return -2; | 3719 | return -2; |
3697 | #if PF_PLAYBACK_CAPABLE | 3720 | #if PF_PLAYBACK_CAPABLE |
@@ -4848,7 +4871,10 @@ enum plugin_status plugin_start(const void *parameter) | |||
4848 | 4871 | ||
4849 | ret = file_id3 ? pictureflow_main(file) : pictureflow_main(NULL); | 4872 | ret = file_id3 ? pictureflow_main(file) : pictureflow_main(NULL); |
4850 | if ( ret == PLUGIN_OK || ret == PLUGIN_GOTO_WPS) { | 4873 | if ( ret == PLUGIN_OK || ret == PLUGIN_GOTO_WPS) { |
4851 | pf_cfg.last_album = center_index; | 4874 | if (pf_state == pf_scrolling) |
4875 | pf_cfg.last_album = target; | ||
4876 | else | ||
4877 | pf_cfg.last_album = center_index; | ||
4852 | if (configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, | 4878 | if (configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, |
4853 | CONFIG_VERSION)) | 4879 | CONFIG_VERSION)) |
4854 | { | 4880 | { |