summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2022-01-02 13:59:20 +0100
committerWilliam Wilgus <me.theuser@yahoo.com>2022-01-04 18:04:53 -0500
commitde8ee6c9e98af821bcf1579ea2edac2a561a2fee (patch)
tree8b40b12bead6babbb92e1dd3cd8a8371c75cff32 /apps
parentd183959676bd269d1f2252517c4dac750c985482 (diff)
downloadrockbox-de8ee6c9e98af821bcf1579ea2edac2a561a2fee.tar.gz
rockbox-de8ee6c9e98af821bcf1579ea2edac2a561a2fee.zip
PictureFlow: Switch between albums from track view
Prev/next buttons on iPods or Fiio M3k can now be used to select another album without having to return to the albums view first. Scroll wheel/strip handles scrolling up and down in the track list as before. Other targets probably have the necessary buttons for this, so the keymap can be extended in the future (same goes for alphabetic browsing) Also prevents queue overflow and handles failure case for track list tagcache retrieval. Change-Id: Ic8ff4471e1583d1ab1f7d16911b15705a7f60aca
Diffstat (limited to 'apps')
-rw-r--r--apps/plugin.c1
-rw-r--r--apps/plugin.h3
-rw-r--r--apps/plugins/pictureflow/pictureflow.c45
3 files changed, 44 insertions, 5 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 0168a26323..aa69b9ca03 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -806,6 +806,7 @@ static const struct plugin_api rockbox_api = {
playlist_insert_playlist,
battery_current,
onplay_show_playlist_menu,
+ queue_remove_from_head,
};
static int plugin_buffer_handle;
diff --git a/apps/plugin.h b/apps/plugin.h
index d4d86e50bd..8ade3a05ac 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -155,7 +155,7 @@ int plugin_open(const char *plugin, const char *parameter);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 248
+#define PLUGIN_API_VERSION 249
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
@@ -933,6 +933,7 @@ struct plugin_api {
const char *filename, int position, bool queue);
int (*battery_current)(void);
void (*onplay_show_playlist_menu)(const char* path, void (*playlist_insert_cb));
+ void (*queue_remove_from_head)(struct event_queue *q, long id);
};
/* plugin header */
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index 74146d8172..2bf4127242 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -151,6 +151,10 @@ const struct button_mapping pf_context_buttons[] =
|| (CONFIG_KEYPAD == IPOD_3G_PAD) \
|| (CONFIG_KEYPAD == IPOD_4G_PAD) \
|| (CONFIG_KEYPAD == MPIO_HD300_PAD)
+ {PF_JMP_PREV, BUTTON_LEFT, BUTTON_NONE},
+ {PF_JMP_PREV, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
+ {PF_JMP, BUTTON_RIGHT, BUTTON_NONE},
+ {PF_JMP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
{PF_QUIT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU},
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
{PF_QUIT, BUTTON_RC_REC, BUTTON_NONE},
@@ -168,10 +172,10 @@ const struct button_mapping pf_context_buttons[] =
{PF_TRACKLIST, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD},
{PF_WPS, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY},
#elif CONFIG_KEYPAD == FIIO_M3K_PAD
- {PF_PREV, BUTTON_LEFT, BUTTON_NONE},
- {PF_PREV_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
- {PF_NEXT, BUTTON_RIGHT, BUTTON_NONE},
- {PF_NEXT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
+ {PF_JMP_PREV, BUTTON_LEFT, BUTTON_NONE},
+ {PF_JMP_PREV, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
+ {PF_JMP, BUTTON_RIGHT, BUTTON_NONE},
+ {PF_JMP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
{PF_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
{PF_QUIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER},
{PF_CONTEXT, BUTTON_MENU|BUTTON_REL, BUTTON_MENU},
@@ -2969,7 +2973,10 @@ static inline void set_current_slide(const int slide_index)
step = 0;
center_index = fbound(slide_index, 0, number_of_slides - 1);
if (old_center_index != center_index)
+ {
+ rb->queue_remove_from_head(&thread_q, EV_WAKEUP);
rb->queue_post(&thread_q, EV_WAKEUP, 0);
+ }
target = center_index;
slide_frame = slide_index << 16;
reset_slides();
@@ -3572,6 +3579,12 @@ static void show_track_list(void)
if ( center_slide.slide_index != pf_tracks.cur_idx ) {
show_track_list_loading();
create_track_index(center_slide.slide_index);
+ if (pf_tracks.count == 0)
+ {
+ pf_state = pf_cover_out;
+ free_borrowed_tracks();
+ return;
+ }
reset_track_list();
}
int titletxt_w, titletxt_x, color, titletxt_h;
@@ -3631,6 +3644,26 @@ static void select_prev_track(void)
}
}
+static void select_next_album(void)
+{
+ if (center_index < number_of_slides - 1) {
+ free_borrowed_tracks();
+ target = center_index + 1;
+ set_current_slide(target);
+ interrupt_cover_in_animation();
+ }
+}
+
+static void select_prev_album(void)
+{
+ if (center_index > 0) {
+ free_borrowed_tracks();
+ target = center_index - 1;
+ set_current_slide(target);
+ interrupt_cover_in_animation();
+ }
+}
+
#if PF_PLAYBACK_CAPABLE
static bool playlist_insert(int position, bool queue, bool create_new)
@@ -4167,6 +4200,8 @@ static int pictureflow_main(const char* selected_file)
pf_state = pf_idle;
set_current_slide(get_album_artist_alpha_next_index());
}
+ else if ( pf_state == pf_show_tracks )
+ select_next_album();
break;
case PF_JMP_PREV:
if (pf_state == pf_idle || pf_state == pf_scrolling)
@@ -4174,6 +4209,8 @@ static int pictureflow_main(const char* selected_file)
pf_state = pf_idle;
set_current_slide(get_album_artist_alpha_prev_index());
}
+ else if ( pf_state == pf_show_tracks )
+ select_prev_album();
break;
#if PF_PLAYBACK_CAPABLE
case PF_CONTEXT: