forked from len0rd/rockbox
Move the playlist menu to the new system
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12268 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
26d8dce20a
commit
e84ff179cb
4 changed files with 55 additions and 107 deletions
|
|
@ -23,7 +23,6 @@ misc.c
|
||||||
onplay.c
|
onplay.c
|
||||||
playlist.c
|
playlist.c
|
||||||
playlist_catalog.c
|
playlist_catalog.c
|
||||||
playlist_menu.c
|
|
||||||
playlist_viewer.c
|
playlist_viewer.c
|
||||||
plugin.c
|
plugin.c
|
||||||
screens.c
|
screens.c
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <string.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
|
@ -28,5 +29,55 @@
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "playlist_menu.h"
|
#include "playlist_menu.h"
|
||||||
|
|
||||||
MENUITEM_FUNCTION(playlist_menu_item, ID2P(LANG_PLAYLIST_MENU), (menu_function)playlist_menu, NULL);
|
#include "menu.h"
|
||||||
|
#include "file.h"
|
||||||
|
#include "keyboard.h"
|
||||||
|
#include "playlist.h"
|
||||||
|
#include "tree.h"
|
||||||
|
#include "playlist_viewer.h"
|
||||||
|
#include "talk.h"
|
||||||
|
#include "playlist_catalog.h"
|
||||||
|
|
||||||
|
int save_playlist_screen(struct playlist_info* playlist)
|
||||||
|
{
|
||||||
|
char temp[MAX_PATH+1];
|
||||||
|
int len;
|
||||||
|
|
||||||
|
playlist_get_name(playlist, temp, sizeof(temp));
|
||||||
|
len = strlen(temp);
|
||||||
|
|
||||||
|
if (len > 4 && !strcasecmp(&temp[len-4], ".m3u"))
|
||||||
|
strcat(temp, "8");
|
||||||
|
|
||||||
|
if (len <= 5 || strcasecmp(&temp[len-5], ".m3u8"))
|
||||||
|
strcpy(temp, DEFAULT_DYNAMIC_PLAYLIST_NAME);
|
||||||
|
|
||||||
|
if (!kbd_input(temp, sizeof(temp)))
|
||||||
|
{
|
||||||
|
playlist_save(playlist, temp);
|
||||||
|
|
||||||
|
/* reload in case playlist was saved to cwd */
|
||||||
|
reload_directory();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
MENUITEM_FUNCTION(create_playlist_item, ID2P(LANG_CREATE_PLAYLIST),
|
||||||
|
(int(*)(void))create_playlist, NULL);
|
||||||
|
MENUITEM_FUNCTION(view_playlist, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
|
||||||
|
(int(*)(void))playlist_viewer, NULL);
|
||||||
|
MENUITEM_FUNCTION_WPARAM(save_playlist, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
|
||||||
|
(int(*)(void*))save_playlist_screen, NULL, NULL);
|
||||||
|
MENUITEM_FUNCTION(catalog, ID2P(LANG_CATALOG),
|
||||||
|
(int(*)(void))catalog_view_playlists, NULL);
|
||||||
|
MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL);
|
||||||
|
MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL);
|
||||||
|
|
||||||
|
MAKE_MENU(playlist_menu_item, ID2P(LANG_PLAYLIST_MENU), NULL,
|
||||||
|
&create_playlist_item, &view_playlist, &save_playlist, &catalog,
|
||||||
|
&recursive_dir_insert, &warn_on_erase);
|
||||||
|
|
||||||
|
bool playlist_menu(void)
|
||||||
|
{
|
||||||
|
return do_menu(&playlist_menu_item);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,103 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
||||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
||||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
||||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
||||||
* \/ \/ \/ \/ \/
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* Copyright (C) 2002 Björn Stenberg
|
|
||||||
*
|
|
||||||
* All files in this archive are subject to the GNU General Public License.
|
|
||||||
* See the file COPYING in the source tree root for full license agreement.
|
|
||||||
*
|
|
||||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
||||||
* KIND, either express or implied.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "menu.h"
|
|
||||||
#include "file.h"
|
|
||||||
#include "keyboard.h"
|
|
||||||
#include "playlist.h"
|
|
||||||
#include "tree.h"
|
|
||||||
#include "settings.h"
|
|
||||||
#include "playlist_viewer.h"
|
|
||||||
#include "talk.h"
|
|
||||||
#include "lang.h"
|
|
||||||
#include "playlist_catalog.h"
|
|
||||||
#include "playlist_menu.h"
|
|
||||||
|
|
||||||
static bool save_playlist(void)
|
|
||||||
{
|
|
||||||
save_playlist_screen(NULL);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool recurse_directory(void)
|
|
||||||
{
|
|
||||||
static const struct opt_items names[] = {
|
|
||||||
{ STR(LANG_OFF) },
|
|
||||||
{ STR(LANG_ON) },
|
|
||||||
{ STR(LANG_RESUME_SETTING_ASK)},
|
|
||||||
};
|
|
||||||
|
|
||||||
return set_option( (char *)str(LANG_RECURSE_DIRECTORY),
|
|
||||||
&global_settings.recursive_dir_insert, INT, names, 3,
|
|
||||||
NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool warnon_option(void)
|
|
||||||
{
|
|
||||||
return set_bool(str(LANG_WARN_ERASEDYNPLAYLIST_MENU),
|
|
||||||
&global_settings.warnon_erase_dynplaylist);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool playlist_menu(void)
|
|
||||||
{
|
|
||||||
int m;
|
|
||||||
bool result;
|
|
||||||
|
|
||||||
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_CATALOG), catalog_view_playlists },
|
|
||||||
{ ID2P(LANG_RECURSE_DIRECTORY), recurse_directory },
|
|
||||||
{ ID2P(LANG_WARN_ERASEDYNPLAYLIST_MENU), warnon_option },
|
|
||||||
};
|
|
||||||
|
|
||||||
m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL,
|
|
||||||
NULL, NULL, NULL );
|
|
||||||
result = menu_run(m);
|
|
||||||
menu_exit(m);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int save_playlist_screen(struct playlist_info* playlist)
|
|
||||||
{
|
|
||||||
char temp[MAX_PATH+1];
|
|
||||||
int len;
|
|
||||||
|
|
||||||
playlist_get_name(playlist, temp, sizeof(temp));
|
|
||||||
len = strlen(temp);
|
|
||||||
|
|
||||||
if (len > 4 && !strcasecmp(&temp[len-4], ".m3u"))
|
|
||||||
strcat(temp, "8");
|
|
||||||
|
|
||||||
if (len <= 5 || strcasecmp(&temp[len-5], ".m3u8"))
|
|
||||||
strcpy(temp, DEFAULT_DYNAMIC_PLAYLIST_NAME);
|
|
||||||
|
|
||||||
if (!kbd_input(temp, sizeof(temp)))
|
|
||||||
{
|
|
||||||
playlist_save(playlist, temp);
|
|
||||||
|
|
||||||
/* reload in case playlist was saved to cwd */
|
|
||||||
reload_directory();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -398,8 +398,9 @@ const struct settings_list settings[] = {
|
||||||
"playlist viewer indices",NULL),
|
"playlist viewer indices",NULL),
|
||||||
{F_T_INT,GS(playlist_viewer_track_display),LANG_TRACK_DISPLAY,
|
{F_T_INT,GS(playlist_viewer_track_display),LANG_TRACK_DISPLAY,
|
||||||
INT(0),"playlist viewer track display","track name,full path",UNUSED},
|
INT(0),"playlist viewer track display","track name,full path",UNUSED},
|
||||||
{F_T_INT,GS(recursive_dir_insert),LANG_RECURSE_DIRECTORY, INT(RECURSE_OFF),
|
CHOICE_SETTING(0, recursive_dir_insert, LANG_RECURSE_DIRECTORY , RECURSE_OFF,
|
||||||
"recursive directory insert",off_on_ask,UNUSED},
|
"recursive directory insert", off_on_ask, NULL , 3 ,
|
||||||
|
ID2P(LANG_OFF), ID2P(LANG_ON), ID2P(LANG_RESUME_SETTING_ASK)),
|
||||||
/* bookmarks */
|
/* bookmarks */
|
||||||
{F_T_INT,GS(autocreatebookmark),LANG_BOOKMARK_SETTINGS_AUTOCREATE,
|
{F_T_INT,GS(autocreatebookmark),LANG_BOOKMARK_SETTINGS_AUTOCREATE,
|
||||||
INT(BOOKMARK_NO),"autocreate bookmarks",
|
INT(BOOKMARK_NO),"autocreate bookmarks",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue