1
0
Fork 0
forked from len0rd/rockbox

Put back the playlist creation options in the main menu

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6854 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2005-06-24 16:32:30 +00:00
parent 7600708a7a
commit 37d7c472ba
4 changed files with 28 additions and 5 deletions

View file

@ -53,8 +53,6 @@
#endif #endif
#include "main_menu.h" #include "main_menu.h"
#define DEFAULT_PLAYLIST_NAME "/dynamic.m3u"
static int context; static int context;
static char* selected_file = NULL; static char* selected_file = NULL;
static int selected_file_attr = 0; static int selected_file_attr = 0;
@ -146,7 +144,7 @@ static bool save_playlist(void)
{ {
char filename[MAX_PATH+1]; char filename[MAX_PATH+1];
strncpy(filename, DEFAULT_PLAYLIST_NAME, sizeof(filename)); strncpy(filename, DEFAULT_DYNAMIC_PLAYLIST_NAME, sizeof(filename));
if (!kbd_input(filename, sizeof(filename))) if (!kbd_input(filename, sizeof(filename)))
{ {

View file

@ -58,6 +58,8 @@ struct playlist_info
#define PLAYLIST_ATTR_QUEUED 0x01 #define PLAYLIST_ATTR_QUEUED 0x01
#define PLAYLIST_ATTR_INSERTED 0x02 #define PLAYLIST_ATTR_INSERTED 0x02
#define DEFAULT_DYNAMIC_PLAYLIST_NAME "/dynamic.m3u"
struct playlist_track_info struct playlist_track_info
{ {
char filename[MAX_PATH]; /* path name of mp3 file */ char filename[MAX_PATH]; /* path name of mp3 file */

View file

@ -20,13 +20,33 @@
#include <string.h> #include <string.h>
#include "menu.h" #include "menu.h"
#include "file.h"
#include "keyboard.h" #include "keyboard.h"
#include "playlist.h" #include "playlist.h"
#include "tree.h" #include "tree.h"
#include "settings.h" #include "settings.h"
#include "playlist_viewer.h"
#include "talk.h" #include "talk.h"
#include "lang.h" #include "lang.h"
/* FIXME: there is a very similar function in onplay.c */
static bool save_playlist(void)
{
char filename[MAX_PATH+1];
strncpy(filename, DEFAULT_DYNAMIC_PLAYLIST_NAME, sizeof(filename));
if (!kbd_input(filename, sizeof(filename)))
{
playlist_save(NULL, filename);
/* reload in case playlist was saved to cwd */
reload_directory();
}
return false;
}
static bool recurse_directory(void) static bool recurse_directory(void)
{ {
static const struct opt_items names[] = { static const struct opt_items names[] = {
@ -46,6 +66,9 @@ bool playlist_menu(void)
bool result; bool result;
static const struct menu_item items[] = { static const struct menu_item items[] = {
{ ID2P(LANG_CREATE_PLAYLIST), create_playlist },
{ ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer },
{ ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist },
{ ID2P(LANG_RECURSE_DIRECTORY), recurse_directory }, { ID2P(LANG_RECURSE_DIRECTORY), recurse_directory },
}; };

View file

@ -78,7 +78,7 @@
#define MAX_PLAYLIST_ENTRIES 200 #define MAX_PLAYLIST_ENTRIES 200
/* Default playlist name for saving */ /* Default playlist name for saving */
#define DEFAULT_PLAYLIST_NAME "/viewer.m3u" #define DEFAULT_VIEWER_PLAYLIST_NAME "/viewer.m3u"
/* Index of track on display line _pos */ /* Index of track on display line _pos */
#define INDEX(_pos) (viewer.first_display_index - viewer.first_index + (_pos)) #define INDEX(_pos) (viewer.first_display_index - viewer.first_index + (_pos))
@ -797,7 +797,7 @@ static bool save_playlist(void)
{ {
char filename[MAX_PATH+1]; char filename[MAX_PATH+1];
strncpy(filename, DEFAULT_PLAYLIST_NAME, sizeof(filename)); strncpy(filename, DEFAULT_VIEWER_PLAYLIST_NAME, sizeof(filename));
if (!kbd_input(filename, sizeof(filename))) if (!kbd_input(filename, sizeof(filename)))
{ {