Merge pull request #1 from Kivutar/favorites

Favorites
This commit is contained in:
Rob Loach 2017-08-12 11:31:51 -04:00 committed by GitHub
commit 8bda6e8a3a
16 changed files with 101 additions and 0 deletions

View File

@ -2034,6 +2034,13 @@ bool command_event(enum event_command cmd, void *data)
settings->paths.path_content_history,
content_history_size);
RARCH_LOG("%s: [%s].\n",
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
settings->paths.path_content_favorites);
g_defaults.content_favorites = playlist_init(
settings->paths.path_content_favorites,
content_history_size);
RARCH_LOG("%s: [%s].\n",
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
settings->paths.path_content_music_history);

View File

@ -1020,6 +1020,8 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
#endif
SETTING_PATH("content_history_path",
settings->paths.path_content_history, false, NULL, true);
SETTING_PATH("content_favorites_path",
settings->paths.path_content_favorites, false, NULL, true);
SETTING_PATH("content_music_history_path",
settings->paths.path_content_music_history, false, NULL, true);
SETTING_PATH("content_video_history_path",
@ -1655,6 +1657,7 @@ static void config_set_defaults(void)
*settings->paths.path_core_options = '\0';
*settings->paths.path_content_history = '\0';
*settings->paths.path_content_favorites = '\0';
*settings->paths.path_content_music_history = '\0';
*settings->paths.path_content_image_history = '\0';
*settings->paths.path_content_video_history = '\0';
@ -2482,6 +2485,25 @@ static bool config_load_file(const char *path, bool set_defaults,
}
}
if (string_is_empty(settings->paths.path_content_favorites))
{
if (string_is_empty(settings->paths.directory_content_history))
{
fill_pathname_resolve_relative(
settings->paths.path_content_favorites,
path_get(RARCH_PATH_CONFIG),
file_path_str(FILE_PATH_CONTENT_FAVORITES),
sizeof(settings->paths.path_content_favorites));
}
else
{
fill_pathname_join(settings->paths.path_content_favorites,
settings->paths.directory_content_history,
file_path_str(FILE_PATH_CONTENT_FAVORITES),
sizeof(settings->paths.path_content_favorites));
}
}
if (string_is_empty(settings->paths.path_content_music_history))
{
if (string_is_empty(settings->paths.directory_content_history))

View File

@ -382,6 +382,7 @@ typedef struct settings
char path_softfilter_plugin[PATH_MAX_LENGTH];
char path_core_options[PATH_MAX_LENGTH];
char path_content_history[PATH_MAX_LENGTH];
char path_content_favorites[PATH_MAX_LENGTH];
char path_content_music_history[PATH_MAX_LENGTH];
char path_content_image_history[PATH_MAX_LENGTH];
char path_content_video_history[PATH_MAX_LENGTH];
@ -398,6 +399,7 @@ typedef struct settings
char directory_video_filter[PATH_MAX_LENGTH];
char directory_video_shader[PATH_MAX_LENGTH];
char directory_content_history[PATH_MAX_LENGTH];
char directory_content_favorites[PATH_MAX_LENGTH];
char directory_libretro[PATH_MAX_LENGTH];
char directory_cursor[PATH_MAX_LENGTH];
char directory_input_remapping[PATH_MAX_LENGTH];

View File

@ -102,6 +102,7 @@ struct defaults
#ifndef IS_SALAMANDER
playlist_t *content_history;
playlist_t *content_favorites;
#ifdef HAVE_IMAGEVIEWER
playlist_t *image_history;
#endif

View File

@ -34,6 +34,7 @@ enum file_path_enum
FILE_PATH_LOG_ERROR,
FILE_PATH_LOG_INFO,
FILE_PATH_CONTENT_HISTORY,
FILE_PATH_CONTENT_FAVORITES,
FILE_PATH_CONTENT_MUSIC_HISTORY,
FILE_PATH_CONTENT_VIDEO_HISTORY,
FILE_PATH_CONTENT_IMAGE_HISTORY,

View File

@ -194,6 +194,9 @@ const char *file_path_str(enum file_path_enum enum_idx)
case FILE_PATH_CONTENT_HISTORY:
str = "content_history.lpl";
break;
case FILE_PATH_CONTENT_FAVORITES:
str = "content_favorites.lpl";
break;
case FILE_PATH_CONTENT_MUSIC_HISTORY:
str = "content_music_history.lpl";
break;

View File

@ -397,6 +397,8 @@ MSG_HASH(MENU_ENUM_LABEL_FILE_BROWSER_SHADER,
"file_browser_shader")
MSG_HASH(MENU_ENUM_LABEL_FILE_BROWSER_SHADER_PRESET,
"file_browser_shader_preset")
MSG_HASH(MENU_ENUM_LABEL_FAVORITES_TAB,
"favorites_tab")
MSG_HASH(MENU_ENUM_LABEL_FPS_SHOW,
"fps_show")
MSG_HASH(MENU_ENUM_LABEL_FRAME_THROTTLE_ENABLE,

View File

@ -615,6 +615,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_FALSE,
"False")
MSG_HASH(MENU_ENUM_LABEL_VALUE_FASTFORWARD_RATIO,
"Maximum Run Speed")
MSG_HASH(MENU_ENUM_LABEL_VALUE_FAVORITES_TAB,
"Favorites")
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_SHOW,
"Display Framerate")
MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE,

View File

@ -464,6 +464,7 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE:
if (
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) ||
@ -483,6 +484,7 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_TAKE_SCREENSHOT:
if (
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) ||
@ -584,6 +586,7 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs,
case MENU_SETTING_GROUP:
case MENU_SETTINGS_CORE_INFO_NONE:
if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) ||
@ -624,6 +627,7 @@ int menu_cbs_init_bind_left(menu_file_list_cbs_t *cbs,
if (type == MENU_SETTING_NO_ITEM)
{
if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) ||

View File

@ -458,6 +458,7 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
case MENU_SETTING_GROUP:
case MENU_SETTINGS_CORE_INFO_NONE:
if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) ||
@ -564,6 +565,7 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE:
if (
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) ||
@ -582,6 +584,7 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_START_VIDEO_PROCESSOR:
case MENU_ENUM_LABEL_TAKE_SCREENSHOT:
if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) ||
@ -621,6 +624,7 @@ int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs,
if (type == MENU_SETTING_NO_ITEM)
{
if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) ||
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) ||

View File

@ -247,6 +247,8 @@ static int action_get_title_group_settings(const char *path, const char *label,
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MAIN_MENU), len);
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)))
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_HISTORY_TAB), len);
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB)))
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FAVORITES_TAB), len);
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)))
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_IMAGES_TAB), len);
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)))

View File

@ -90,6 +90,7 @@ enum
XMB_TEXTURE_MAIN_MENU = 0,
XMB_TEXTURE_SETTINGS,
XMB_TEXTURE_HISTORY,
XMB_TEXTURE_FAVORITES,
XMB_TEXTURE_MUSICS,
#ifdef HAVE_FFMPEG
XMB_TEXTURE_MOVIES,
@ -126,6 +127,7 @@ enum
XMB_TEXTURE_FILE,
XMB_TEXTURE_FOLDER,
XMB_TEXTURE_ZIP,
XMB_TEXTURE_FAVORITE,
XMB_TEXTURE_MUSIC,
XMB_TEXTURE_IMAGE,
XMB_TEXTURE_MOVIE,
@ -150,6 +152,7 @@ enum
XMB_SYSTEM_TAB_MAIN = 0,
XMB_SYSTEM_TAB_SETTINGS,
XMB_SYSTEM_TAB_HISTORY,
XMB_SYSTEM_TAB_FAVORITES,
XMB_SYSTEM_TAB_MUSIC,
#ifdef HAVE_FFMPEG
XMB_SYSTEM_TAB_VIDEO,
@ -302,6 +305,7 @@ typedef struct xmb_handle
#endif
xmb_node_t settings_tab_node;
xmb_node_t history_tab_node;
xmb_node_t favorites_tab_node;
xmb_node_t add_tab_node;
xmb_node_t netplay_tab_node;
@ -1540,6 +1544,8 @@ static xmb_node_t* xmb_get_node(xmb_handle_t *xmb, unsigned i)
#endif
case XMB_SYSTEM_TAB_HISTORY:
return &xmb->history_tab_node;
case XMB_SYSTEM_TAB_FAVORITES:
return &xmb->favorites_tab_node;
#ifdef HAVE_NETWORKING
case XMB_SYSTEM_TAB_NETPLAY:
return &xmb->netplay_tab_node;
@ -2064,6 +2070,8 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
switch (xmb_get_system_tab(xmb, (unsigned)xmb->categories.selection_ptr))
{
case XMB_SYSTEM_TAB_FAVORITES:
return xmb->textures.list[XMB_TEXTURE_FAVORITE];
case XMB_SYSTEM_TAB_MUSIC:
return xmb->textures.list[XMB_TEXTURE_MUSIC];
#ifdef HAVE_IMAGEVIEWER
@ -3286,6 +3294,8 @@ static void *xmb_init(void **userdata, bool video_is_threaded)
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_SETTINGS;
if (settings->bools.menu_xmb_show_history)
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_HISTORY;
/* TODO if (settings->bools.menu_xmb_show_favorites)*/
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_FAVORITES;
#ifdef HAVE_IMAGEVIEWER
if (settings->bools.menu_xmb_show_images)
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_IMAGES;
@ -3435,6 +3445,8 @@ static const char *xmb_texture_path(unsigned id)
return "settings.png";
case XMB_TEXTURE_HISTORY:
return "history.png";
case XMB_TEXTURE_FAVORITES:
return "favorites.png";
case XMB_TEXTURE_MUSICS:
return "musics.png";
#ifdef HAVE_FFMPEG
@ -3499,6 +3511,8 @@ static const char *xmb_texture_path(unsigned id)
return "zip.png";
case XMB_TEXTURE_MUSIC:
return "music.png";
case XMB_TEXTURE_FAVORITE:
return "favorites-content.png";
case XMB_TEXTURE_IMAGE:
return "image.png";
case XMB_TEXTURE_MOVIE:
@ -3561,6 +3575,10 @@ static void xmb_context_reset_textures(
xmb->history_tab_node.alpha = xmb->categories.active.alpha;
xmb->history_tab_node.zoom = xmb->categories.active.zoom;
xmb->favorites_tab_node.icon = xmb->textures.list[XMB_TEXTURE_FAVORITES];
xmb->favorites_tab_node.alpha = xmb->categories.active.alpha;
xmb->favorites_tab_node.zoom = xmb->categories.active.zoom;
xmb->music_tab_node.icon = xmb->textures.list[XMB_TEXTURE_MUSICS];
xmb->music_tab_node.alpha = xmb->categories.active.alpha;
xmb->music_tab_node.zoom = xmb->categories.active.zoom;
@ -3872,6 +3890,12 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action
menu_stack->list[stack_size - 1].type =
MENU_HISTORY_TAB;
break;
case XMB_SYSTEM_TAB_FAVORITES:
menu_stack->list[stack_size - 1].label =
strdup(msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB));
menu_stack->list[stack_size - 1].type =
MENU_FAVORITES_TAB;
break;
#ifdef HAVE_NETWORKING
case XMB_SYSTEM_TAB_NETPLAY:
menu_stack->list[stack_size - 1].label =

View File

@ -3838,6 +3838,11 @@ static bool menu_displaylist_push_internal(
if (menu_displaylist_ctl(DISPLAYLIST_HISTORY, info))
return true;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB)))
{
if (menu_displaylist_ctl(DISPLAYLIST_FAVORITES, info))
return true;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SETTINGS_TAB)))
{
if (menu_displaylist_ctl(DISPLAYLIST_SETTINGS_ALL, info))
@ -4365,6 +4370,12 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
return menu_displaylist_process(info);
return false;
}
else if (string_is_equal(info->path, file_path_str(FILE_PATH_CONTENT_FAVORITES)))
{
if (menu_displaylist_ctl(DISPLAYLIST_FAVORITES, info))
return menu_displaylist_process(info);
return false;
}
else
{
char path_playlist[PATH_MAX_LENGTH];
@ -4428,6 +4439,19 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
info->need_push = true;
}
break;
case DISPLAYLIST_FAVORITES:
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
menu_displaylist_parse_playlist_history(menu, info,
g_defaults.content_favorites,
"favorites",
settings->paths.path_content_favorites,
&ret);
if (ret == 0)
{
info->need_refresh = true;
info->need_push = true;
}
break;
case DISPLAYLIST_MUSIC_HISTORY:
if (settings->bools.history_list_enable)
menu_displaylist_parse_playlist_history(menu, info,

View File

@ -61,6 +61,7 @@ enum menu_displaylist_ctl_state
DISPLAYLIST_HORIZONTAL,
DISPLAYLIST_HORIZONTAL_CONTENT_ACTIONS,
DISPLAYLIST_HISTORY,
DISPLAYLIST_FAVORITES,
DISPLAYLIST_VIDEO_HISTORY,
DISPLAYLIST_MUSIC_HISTORY,
DISPLAYLIST_IMAGES_HISTORY,

View File

@ -139,6 +139,7 @@ enum menu_settings_type
MENU_SETTINGS,
MENU_SETTINGS_TAB,
MENU_HISTORY_TAB,
MENU_FAVORITES_TAB,
MENU_MUSIC_TAB,
MENU_VIDEO_TAB,
MENU_IMAGES_TAB,

View File

@ -1197,6 +1197,7 @@ enum msg_hash_enums
MENU_LABEL(HORIZONTAL_MENU),
MENU_LABEL(SETTINGS_TAB),
MENU_LABEL(HISTORY_TAB),
MENU_LABEL(FAVORITES_TAB),
MENU_LABEL(ADD_TAB),
MENU_LABEL(NETPLAY_TAB),
MENU_LABEL(PLAYLISTS_TAB),