summaryrefslogtreecommitdiffstats
path: root/apps/onplay.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-07-20 14:11:15 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-07-20 14:11:15 +0000
commit97a4c1efa473e40b4dd7287571f3b1c9caaba97d (patch)
tree384bb5b81d5c4c5b6098bff835af9a7cc75161de /apps/onplay.c
parent4983d052a0d73340d09086a796b4ccbb45dfd88b (diff)
downloadrockbox-97a4c1efa473e40b4dd7287571f3b1c9caaba97d.tar.gz
rockbox-97a4c1efa473e40b4dd7287571f3b1c9caaba97d.tar.bz2
rockbox-97a4c1efa473e40b4dd7287571f3b1c9caaba97d.zip
FS#11808 - Major playlist handling changes (on disk playlists)
* Playlists are treated similar to directories in the browser, they now open in the viewer when selected instead of automatically starting the playlist. * Make the "Playlists" main menu item useful, it now displays the playlist catalog (and has been renamed accordingly) * Default to storing playlists in the catalog * Add a UI to move the catalog directory (other minor stuff too) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30177 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/onplay.c')
-rw-r--r--apps/onplay.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index a2a3671d3e..da06f937b6 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -315,7 +315,7 @@ MENUITEM_FUNCTION(view_playlist_item, 0, ID2P(LANG_VIEW),
view_playlist, NULL,
treeplaylist_callback, Icon_Playlist);
-MAKE_ONPLAYMENU( tree_playlist_menu, ID2P(LANG_PLAYLIST),
+MAKE_ONPLAYMENU( tree_playlist_menu, ID2P(LANG_CURRENT_PLAYLIST),
treeplaylist_callback, Icon_Playlist,
/* view */
@@ -382,6 +382,12 @@ static int treeplaylist_callback(int action,
return action;
}
+void onplay_show_playlist_menu(char* track_name)
+{
+ selected_file = track_name;
+ selected_file_attr = FILE_ATTR_AUDIO;
+ do_menu(&tree_playlist_menu, NULL, NULL, false);
+}
/* playlist catalog options */
static bool cat_add_to_a_playlist(void)
@@ -395,23 +401,37 @@ static bool cat_add_to_a_new_playlist(void)
return catalog_add_to_a_playlist(selected_file, selected_file_attr,
true, NULL);
}
+static int clipboard_callback(int action,const struct menu_item_ex *this_item);
+static bool set_catalogdir(void)
+{
+ catalog_set_directory(selected_file);
+ settings_save();
+ return false;
+}
+MENUITEM_FUNCTION(set_catalogdir_item, 0, ID2P(LANG_SET_AS_PLAYLISTCAT_DIR),
+ set_catalogdir, NULL, clipboard_callback, Icon_Playlist);
static int cat_playlist_callback(int action,
const struct menu_item_ex *this_item);
-MENUITEM_FUNCTION(cat_view_lists, 0, ID2P(LANG_CATALOG_VIEW),
- catalog_view_playlists, 0,
- cat_playlist_callback, Icon_Playlist);
MENUITEM_FUNCTION(cat_add_to_list, 0, ID2P(LANG_CATALOG_ADD_TO),
cat_add_to_a_playlist, 0, NULL, Icon_Playlist);
MENUITEM_FUNCTION(cat_add_to_new, 0, ID2P(LANG_CATALOG_ADD_TO_NEW),
cat_add_to_a_new_playlist, 0, NULL, Icon_Playlist);
MAKE_ONPLAYMENU(cat_playlist_menu, ID2P(LANG_CATALOG),
cat_playlist_callback, Icon_Playlist,
- &cat_view_lists, &cat_add_to_list, &cat_add_to_new);
+ &cat_add_to_list, &cat_add_to_new, &set_catalogdir_item);
+
+void onplay_show_playlist_cat_menu(char* track_name)
+{
+ selected_file = track_name;
+ selected_file_attr = FILE_ATTR_AUDIO;
+ do_menu(&cat_playlist_menu, NULL, NULL, false);
+}
static int cat_playlist_callback(int action,
const struct menu_item_ex *this_item)
{
+ (void)this_item;
if (!selected_file ||
(((selected_file_attr & FILE_ATTR_MASK) != FILE_ATTR_AUDIO) &&
((selected_file_attr & FILE_ATTR_MASK) != FILE_ATTR_M3U) &&
@@ -430,12 +450,7 @@ static int cat_playlist_callback(int action,
switch (action)
{
case ACTION_REQUEST_MENUITEM:
- if (this_item == &cat_view_lists)
- {
- return action;
- }
- else if ((audio_status() & AUDIO_STATUS_PLAY) ||
- context != CONTEXT_WPS)
+ if ((audio_status() & AUDIO_STATUS_PLAY) || context != CONTEXT_WPS)
{
return action;
}
@@ -1100,7 +1115,8 @@ static int clipboard_callback(int action,const struct menu_item_ex *this_item)
{
/* only for directories */
if (this_item == &delete_dir_item ||
- this_item == &set_startdir_item
+ this_item == &set_startdir_item ||
+ this_item == &set_catalogdir_item
#ifdef HAVE_RECORDING
|| this_item == &set_recdir_item
#endif