summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/wps.c11
-rw-r--r--apps/menus/playlist_menu.c12
-rw-r--r--apps/onplay.c8
-rw-r--r--apps/onplay.h3
-rw-r--r--apps/playlist_viewer.c32
-rw-r--r--apps/playlist_viewer.h10
-rw-r--r--apps/root_menu.c18
-rw-r--r--apps/root_menu.h1
8 files changed, 60 insertions, 35 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index fb70306..6afed43 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -859,11 +859,14 @@ long gui_wps_show(void)
case ACTION_WPS_CONTEXT:
{
gwps_leave_wps();
+ int retval = onplay(wps_state.id3->path,
+ FILE_ATTR_AUDIO, CONTEXT_WPS);
/* if music is stopped in the context menu we want to exit the wps */
- if (onplay(wps_state.id3->path,
- FILE_ATTR_AUDIO, CONTEXT_WPS) == ONPLAY_MAINMENU
+ if (retval == ONPLAY_MAINMENU
|| !audio_status())
return GO_TO_ROOT;
+ else if (retval == ONPLAY_PLAYLIST)
+ return GO_TO_PLAYLIST_VIEWER;
restore = true;
}
break;
@@ -1150,9 +1153,7 @@ long gui_wps_show(void)
break;
case ACTION_WPS_VIEW_PLAYLIST:
gwps_leave_wps();
- if (playlist_viewer()) /* true if USB connected */
- return GO_TO_ROOT;
- restore = true;
+ return GO_TO_PLAYLIST_VIEWER;
break;
default:
if(default_event_handler(button) == SYS_USB_CONNECTED)
diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c
index 87a61a9..aa4a060 100644
--- a/apps/menus/playlist_menu.c
+++ b/apps/menus/playlist_menu.c
@@ -60,10 +60,16 @@ int save_playlist_screen(struct playlist_info* playlist)
return 0;
}
+
+static int playlist_view_(void)
+{
+ return GO_TO_PLAYLIST_VIEWER;
+}
+
MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST),
(int(*)(void))create_playlist, NULL, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(view_playlist, 0, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
- (int(*)(void))playlist_viewer, NULL, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(view_cur_playlist, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
+ (int(*)(void))playlist_view_, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
(int(*)(void*))save_playlist_screen,
NULL, NULL, Icon_NOICON);
@@ -78,5 +84,5 @@ MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL,
&recursive_dir_insert, &warn_on_erase);
MAKE_MENU(playlist_options, ID2P(LANG_PLAYLISTS), NULL,
Icon_Playlist,
- &create_playlist_item, &view_playlist, &save_playlist, &catalog);
+ &create_playlist_item, &view_cur_playlist, &save_playlist, &catalog);
diff --git a/apps/onplay.c b/apps/onplay.c
index da3900d..8bff92f 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -137,15 +137,13 @@ static bool shuffle_playlist(void)
return false;
}
-
static bool save_playlist(void)
{
save_playlist_screen(NULL);
return false;
}
-MENUITEM_FUNCTION(playlist_viewer_item, 0, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
- playlist_viewer, NULL, NULL, Icon_Playlist);
+extern struct menu_item_ex view_cur_playlist; /* from playlist_menu.c */
MENUITEM_FUNCTION(search_playlist_item, 0, ID2P(LANG_SEARCH_IN_PLAYLIST),
search_playlist, NULL, NULL, Icon_Playlist);
MENUITEM_FUNCTION(playlist_save_item, 0, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
@@ -154,7 +152,7 @@ MENUITEM_FUNCTION(reshuffle_item, 0, ID2P(LANG_SHUFFLE_PLAYLIST),
shuffle_playlist, NULL, NULL, Icon_Playlist);
MAKE_ONPLAYMENU( wps_playlist_menu, ID2P(LANG_PLAYLIST),
NULL, Icon_Playlist,
- &playlist_viewer_item, &search_playlist_item,
+ &view_cur_playlist, &search_playlist_item,
&playlist_save_item, &reshuffle_item
);
@@ -1188,6 +1186,8 @@ int onplay(char* file, int attr, int from)
case GO_TO_ROOT:
case GO_TO_MAINMENU:
return ONPLAY_MAINMENU;
+ case GO_TO_PLAYLIST_VIEWER:
+ return ONPLAY_PLAYLIST;
default:
return onplay_result;
}
diff --git a/apps/onplay.h b/apps/onplay.h
index 23886df..b0f1a18 100644
--- a/apps/onplay.h
+++ b/apps/onplay.h
@@ -27,7 +27,8 @@ enum {
ONPLAY_MAINMENU = -1,
ONPLAY_OK = 0,
ONPLAY_RELOAD_DIR,
- ONPLAY_START_PLAY
+ ONPLAY_START_PLAY,
+ ONPLAY_PLAYLIST,
};
#endif
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 0a247fa..e2be36c 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -448,7 +448,8 @@ static int onplay_menu(int index)
playlist_buffer_get_track(&viewer.buffer, index);
MENUITEM_STRINGLIST(menu_items, ID2P(LANG_PLAYLIST), NULL,
ID2P(LANG_REMOVE), ID2P(LANG_MOVE),
- ID2P(LANG_CATALOG_ADD_TO), ID2P(LANG_CATALOG_ADD_TO_NEW));
+ ID2P(LANG_CATALOG_ADD_TO), ID2P(LANG_CATALOG_ADD_TO_NEW),
+ ID2P(LANG_PLAYLISTVIEWER_SETTINGS));
bool current = (current_track->index == viewer.current_playing_track);
result = do_menu(&menu_items, NULL, NULL, false);
@@ -503,6 +504,10 @@ static int onplay_menu(int index)
result==3, NULL);
ret = 0;
break;
+ case 4: /* playlist viewer settings */
+ /* true on usb connect */
+ ret = viewer_menu() ? -1 : 0;
+ break;
}
}
return ret;
@@ -531,7 +536,7 @@ static int save_playlist_func(void)
}
/* View current playlist */
-bool playlist_viewer(void)
+enum playlist_viewer_result playlist_viewer(void)
{
return playlist_viewer_ex(NULL);
}
@@ -606,9 +611,9 @@ static enum themable_icons playlist_callback_icons(int selected_item,
/* Main viewer function. Filename identifies playlist to be viewed. If NULL,
view current playlist. */
-bool playlist_viewer_ex(const char* filename)
+enum playlist_viewer_result playlist_viewer_ex(const char* filename)
{
- bool ret = false; /* return value */
+ enum playlist_viewer_result ret = PLAYLIST_VIEWER_OK;
bool exit=false; /* exit viewer */
int button;
struct gui_synclist playlist_lists;
@@ -730,7 +735,7 @@ bool playlist_viewer_ex(const char* filename)
if (ret_val < 0)
{
- ret = true;
+ ret = PLAYLIST_VIEWER_USB;
goto exit;
}
else if (ret_val > 0)
@@ -747,23 +752,12 @@ bool playlist_viewer_ex(const char* filename)
break;
}
case ACTION_STD_MENU:
- if (viewer_menu())
- {
- ret = true;
- goto exit;
- }
- gui_synclist_set_icon_callback(
- &playlist_lists,
- global_settings.playlist_viewer_icons?
- &playlist_callback_icons:NULL
- );
- gui_synclist_draw(&playlist_lists);
- break;
-
+ ret = PLAYLIST_VIEWER_MAINMENU;
+ goto exit;
default:
if(default_event_handler(button) == SYS_USB_CONNECTED)
{
- ret = true;
+ ret = PLAYLIST_VIEWER_USB;
goto exit;
}
break;
diff --git a/apps/playlist_viewer.h b/apps/playlist_viewer.h
index 8526d03..97f5b0b 100644
--- a/apps/playlist_viewer.h
+++ b/apps/playlist_viewer.h
@@ -23,8 +23,14 @@
#ifndef _PLAYLIST_VIEWER_H_
#define _PLAYLIST_VIEWER_H_
-bool playlist_viewer(void);
-bool playlist_viewer_ex(const char* filename);
+enum playlist_viewer_result playlist_viewer(void);
+enum playlist_viewer_result playlist_viewer_ex(const char* filename);
bool search_playlist(void);
+enum playlist_viewer_result {
+ PLAYLIST_VIEWER_OK,
+ PLAYLIST_VIEWER_USB,
+ PLAYLIST_VIEWER_MAINMENU,
+};
+
#endif
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 01ba3a0..5124375 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -60,6 +60,7 @@
#include "wps.h"
#include "bookmark.h"
#include "playlist.h"
+#include "playlist_viewer.h"
#include "menus/exported_menus.h"
#ifdef HAVE_RTC_ALARM
#include "rtc.h"
@@ -313,6 +314,20 @@ static int radio(void* param)
}
#endif
+static int playlist_view(void * param)
+{
+ (void)param;
+ switch (playlist_viewer())
+ {
+ case PLAYLIST_VIEWER_MAINMENU:
+ case PLAYLIST_VIEWER_USB:
+ return GO_TO_ROOT;
+ case PLAYLIST_VIEWER_OK:
+ return GO_TO_PREVIOUS;
+ }
+ return GO_TO_PREVIOUS;
+}
+
static int load_bmarks(void* param)
{
(void)param;
@@ -381,7 +396,8 @@ static const struct root_items items[] = {
#endif
[GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu },
- [GO_TO_BROWSEPLUGINS] = { plugins_menu, NULL, NULL },
+ [GO_TO_BROWSEPLUGINS] = { plugins_menu, NULL, NULL },
+ [GO_TO_PLAYLIST_VIEWER] = { playlist_view, NULL, NULL },
};
static const int nb_items = sizeof(items)/sizeof(*items);
diff --git a/apps/root_menu.h b/apps/root_menu.h
index 1090482..4113b64 100644
--- a/apps/root_menu.h
+++ b/apps/root_menu.h
@@ -52,6 +52,7 @@ enum {
will need editing if this is the case. */
GO_TO_BROWSEPLUGINS,
GO_TO_TIMESCREEN,
+ GO_TO_PLAYLIST_VIEWER,
};
extern const struct menu_item_ex root_menu_;