2003-07-01 21:05:43 +00:00
|
|
|
|
/***************************************************************************
|
|
|
|
|
* __________ __ ___.
|
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2002 Bj<EFBFBD>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"
|
2005-06-24 16:32:30 +00:00
|
|
|
|
#include "file.h"
|
2003-07-01 21:05:43 +00:00
|
|
|
|
#include "keyboard.h"
|
|
|
|
|
#include "playlist.h"
|
|
|
|
|
#include "tree.h"
|
|
|
|
|
#include "settings.h"
|
2005-06-24 16:32:30 +00:00
|
|
|
|
#include "playlist_viewer.h"
|
2004-03-19 22:15:53 +00:00
|
|
|
|
#include "talk.h"
|
2003-07-01 21:05:43 +00:00
|
|
|
|
#include "lang.h"
|
2006-02-09 09:09:32 +00:00
|
|
|
|
#include "playlist_menu.h"
|
2003-07-01 21:05:43 +00:00
|
|
|
|
|
2005-06-24 16:32:30 +00:00
|
|
|
|
static bool save_playlist(void)
|
|
|
|
|
{
|
2006-02-09 09:09:32 +00:00
|
|
|
|
save_playlist_screen(NULL);
|
2005-06-24 16:32:30 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-01 21:05:43 +00:00
|
|
|
|
static bool recurse_directory(void)
|
|
|
|
|
{
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct opt_items names[] = {
|
2004-03-15 08:27:51 +00:00
|
|
|
|
{ STR(LANG_OFF) },
|
|
|
|
|
{ STR(LANG_ON) },
|
|
|
|
|
{ STR(LANG_RESUME_SETTING_ASK)},
|
|
|
|
|
};
|
2003-07-02 15:54:44 +00:00
|
|
|
|
|
2005-12-05 22:44:42 +00:00
|
|
|
|
return set_option( (char *)str(LANG_RECURSE_DIRECTORY),
|
2003-07-02 15:54:44 +00:00
|
|
|
|
&global_settings.recursive_dir_insert, INT, names, 3,
|
|
|
|
|
NULL );
|
2003-07-01 21:05:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-05 19:35:03 +00:00
|
|
|
|
static bool warnon_option(void)
|
|
|
|
|
{
|
|
|
|
|
return set_bool(str(LANG_WARN_ERASEDYNPLAYLIST_MENU),
|
|
|
|
|
&global_settings.warnon_erase_dynplaylist);
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-01 21:05:43 +00:00
|
|
|
|
bool playlist_menu(void)
|
|
|
|
|
{
|
|
|
|
|
int m;
|
|
|
|
|
bool result;
|
|
|
|
|
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct menu_item items[] = {
|
2005-06-24 16:32:30 +00:00
|
|
|
|
{ ID2P(LANG_CREATE_PLAYLIST), create_playlist },
|
|
|
|
|
{ ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer },
|
|
|
|
|
{ ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist },
|
2004-07-23 23:01:20 +00:00
|
|
|
|
{ ID2P(LANG_RECURSE_DIRECTORY), recurse_directory },
|
2006-02-05 19:35:03 +00:00
|
|
|
|
{ ID2P(LANG_WARN_ERASEDYNPLAYLIST_MENU), warnon_option},
|
2003-07-01 21:05:43 +00:00
|
|
|
|
};
|
2004-03-16 13:44:56 +00:00
|
|
|
|
|
|
|
|
|
m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL,
|
|
|
|
|
NULL, NULL, NULL );
|
2003-07-01 21:05:43 +00:00
|
|
|
|
result = menu_run(m);
|
|
|
|
|
menu_exit(m);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2006-02-09 09:09:32 +00:00
|
|
|
|
|
|
|
|
|
int save_playlist_screen(struct playlist_info* playlist)
|
|
|
|
|
{
|
|
|
|
|
char* filename;
|
|
|
|
|
char temp[MAX_PATH+1];
|
|
|
|
|
int len;
|
|
|
|
|
|
|
|
|
|
filename = playlist_get_name(playlist, temp, sizeof(temp));
|
|
|
|
|
|
|
|
|
|
if (!filename || (len=strlen(filename)) <= 4 ||
|
|
|
|
|
strcasecmp(&filename[len-4], ".m3u"))
|
2006-02-16 14:38:34 +00:00
|
|
|
|
strcpy(filename, DEFAULT_DYNAMIC_PLAYLIST_NAME);
|
2006-02-09 09:09:32 +00:00
|
|
|
|
|
2006-02-16 14:38:34 +00:00
|
|
|
|
if (!kbd_input(filename, sizeof(temp)))
|
2006-02-09 09:09:32 +00:00
|
|
|
|
{
|
|
|
|
|
playlist_save(playlist, filename);
|
|
|
|
|
|
|
|
|
|
/* reload in case playlist was saved to cwd */
|
|
|
|
|
reload_directory();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|