(XMB) Display favorites tab, part 2

This commit is contained in:
Jean-André Santoni 2017-08-12 17:10:14 +02:00
parent 61cc899867
commit d037546a13
10 changed files with 69 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

@ -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

@ -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,