Add View feature (#14467)

* Add View feature
Add saving of a filter set in the Explore menu into a so called "View" file which then gets listed alongside playlists.
This also adds the ability to filter a category by range in the Explore menu and not just filter on exact matches.

* Menu improvements for explore and views

* Collapse ozone sidebar in view

* Fix problems with the sidebar in explore/view

* Ignore view files in the Qt playlists menu

* Add missing semicolon

* Support downloading thumbnails in views
This commit is contained in:
Bernhard Schelling 2022-10-10 13:36:02 +09:00 committed by GitHub
parent 076a1a398c
commit c9bbe7683f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1024 additions and 607 deletions

View File

@ -7048,6 +7048,38 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_EXPLORE_BY_SYSTEM_NAME,
"By System Name"
)
MSG_HASH(
MENU_ENUM_LABEL_EXPLORE_RANGE_FILTER,
"Set Range Filter"
)
MSG_HASH(
MENU_ENUM_LABEL_EXPLORE_VIEW,
"View"
)
MSG_HASH(
MENU_ENUM_LABEL_EXPLORE_SAVE_VIEW,
"Save as View"
)
MSG_HASH(
MENU_ENUM_LABEL_EXPLORE_DELETE_VIEW,
"Delete this View"
)
MSG_HASH(
MENU_ENUM_LABEL_EXPLORE_NEW_VIEW,
"Enter name of new view"
)
MSG_HASH(
MENU_ENUM_LABEL_EXPLORE_VIEW_EXISTS,
"View already exists with the same name"
)
MSG_HASH(
MENU_ENUM_LABEL_EXPLORE_VIEW_SAVED,
"View was saved"
)
MSG_HASH(
MENU_ENUM_LABEL_EXPLORE_VIEW_DELETED,
"View was deleted"
)
/* Playlist > Playlist Item */

View File

@ -1251,6 +1251,17 @@ char* rjsonwriter_get_memory_buffer(rjsonwriter_t *writer, int* len)
return writer->buf;
}
int rjsonwriter_count_memory_buffer(rjsonwriter_t *writer)
{
return writer->buf_num;
}
void rjsonwriter_erase_memory_buffer(rjsonwriter_t *writer, int keep_len)
{
if (keep_len <= writer->buf_num)
writer->buf_num = (keep_len < 0 ? 0 : keep_len);
}
bool rjsonwriter_free(rjsonwriter_t *writer)
{
bool res;

View File

@ -195,6 +195,14 @@ rjsonwriter_t *rjsonwriter_open_user(rjsonwriter_io_t io, void *user_data);
* Returned buffer is only valid until writer is modified or freed. */
char* rjsonwriter_get_memory_buffer(rjsonwriter_t *writer, int* len);
/* When opened with rjsonwriter_open_memory, will return current length */
int rjsonwriter_count_memory_buffer(rjsonwriter_t *writer);
/* When opened with rjsonwriter_open_memory, will clear the buffer.
The buffer will be partially erased if keep_len is > 0.
No memory is freed or re-allocated with this function. */
void rjsonwriter_erase_memory_buffer(rjsonwriter_t *writer, int keep_len);
/* Free rjsonwriter handle and return result of final rjsonwriter_flush call */
bool rjsonwriter_free(rjsonwriter_t *writer);

View File

@ -70,6 +70,8 @@ static INLINE void rjsonwriter_add_int(rjsonwriter_t *writer, int value)
static INLINE void rjsonwriter_add_bool(rjsonwriter_t *writer, bool value)
{ rjsonwriter_raw(writer, (value ? "true" : "false"), (value ? 4 : 5)); }
static INLINE void rjsonwriter_add_null(rjsonwriter_t *writer)
{ rjsonwriter_raw(writer, "null", 4); }
RETRO_END_DECLS

View File

@ -1818,6 +1818,7 @@ int menu_cbs_init_bind_title(menu_file_list_cbs_t *cbs,
BIND_ACTION_GET_TITLE(cbs, action_get_title_default);
if (cbs->enum_idx != MENU_ENUM_LABEL_PLAYLIST_ENTRY &&
cbs->enum_idx != MENU_ENUM_LABEL_EXPLORE_ITEM &&
menu_cbs_init_bind_title_compare_label(cbs, label) == 0)
return 0;

View File

@ -455,7 +455,6 @@ struct ozone_handle
size_t categories_selection_ptr; /* active tab id */
size_t categories_active_idx_old;
size_t playlist_index;
size_t playlist_collection_offset;
size_t selection; /* currently selected entry */
size_t selection_old; /* previously selected entry (for fancy animation) */
@ -3619,12 +3618,25 @@ static void ozone_entries_update_thumbnail_bar(
}
}
static unsigned ozone_get_horizontal_selection_type(ozone_handle_t *ozone)
{
if (ozone->categories_selection_ptr > ozone->system_tab_end)
{
size_t i = ozone->categories_selection_ptr - ozone->system_tab_end-1;
return ozone->horizontal_list.list[i].type;
}
return 0;
}
static bool ozone_is_playlist(ozone_handle_t *ozone, bool depth)
{
bool is_playlist;
if (ozone->categories_selection_ptr > ozone->system_tab_end)
is_playlist = true;
{
unsigned type = ozone_get_horizontal_selection_type(ozone);
is_playlist = type == FILE_TYPE_PLAYLIST_COLLECTION;
}
else
{
switch (ozone->tabs[ozone->categories_selection_ptr])
@ -3687,7 +3699,8 @@ static void ozone_sidebar_update_collapse(
goto end;
/* Collapse it */
if (ozone_collapse_sidebar || (is_playlist && !ozone->cursor_in_sidebar))
if (ozone_collapse_sidebar || (!ozone->cursor_in_sidebar && (is_playlist ||
ozone_get_horizontal_selection_type(ozone) == MENU_EXPLORE_TAB)))
{
if (allow_animation)
{
@ -3838,15 +3851,12 @@ static void ozone_update_content_metadata(ozone_handle_t *ozone)
(selection < list_size) &&
ozone->is_explore_list)
{
playlist_index = menu_explore_get_entry_playlist_index(list->list[selection].type, &playlist, &entry);
playlist_index = menu_explore_get_entry_playlist_index(list->list[selection].type, &playlist, &entry, list, &selection, &list_size);
/* Fill play time if applicable */
if (content_runtime_log || content_runtime_log_aggr)
playlist_get_index(playlist, playlist_index, &entry);
/* Corrections */
list_size--;
/* Remember playlist index for metadata */
ozone->playlist_index = playlist_index;
}
@ -3872,7 +3882,7 @@ static void ozone_update_content_metadata(ozone_handle_t *ozone)
{
unsigned long _entry = (unsigned long)(playlist_index + 1);
if (ozone->is_explore_list)
_entry = (unsigned long)(selection);
_entry = (unsigned long)(selection + 1);
snprintf(ozone->selection_entry_enumeration,
sizeof(ozone->selection_entry_enumeration),
@ -4651,6 +4661,13 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
else
node->console_name = strdup(path);
}
else if (string_ends_with_size(ozone->horizontal_list.list[i].label, ".lvw",
strlen(ozone->horizontal_list.list[i].label), STRLEN_CONST(".lvw")))
{
/* For now use a default icon for views */
node->console_name = strdup(path + strlen(msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_VIEW)) + 2);
node->icon = ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_FILE];
}
}
}
@ -5449,14 +5466,7 @@ border_iterate:
}
else if (ozone->depth == 3 && entry.type == FILE_TYPE_PLAYLIST_COLLECTION)
{
size_t i_playlist = 0;
ozone_node_t *sidebar_node;
if (i >= ozone->playlist_collection_offset)
i_playlist = i - ozone->playlist_collection_offset;
sidebar_node = (ozone_node_t*) file_list_get_userdata_at_offset(&ozone->horizontal_list, i_playlist);
ozone_node_t *sidebar_node = (ozone_node_t*) file_list_get_userdata_at_offset(&ozone->horizontal_list, selection_buf->list[i].entry_idx);
if (sidebar_node && sidebar_node->icon)
texture = sidebar_node->icon;
}
@ -7096,48 +7106,17 @@ static void ozone_set_thumbnail_content(void *data, const char *s)
/* Explore list */
if (string_is_empty(s))
{
/* Selected entry */
menu_entry_t entry;
size_t selection = menu_navigation_get_selection();
MENU_ENTRY_INIT(entry);
entry.label_enabled = false;
entry.rich_label_enabled = false;
entry.value_enabled = false;
entry.sublabel_enabled = false;
menu_entry_get(&entry, 0, menu_navigation_get_selection(), NULL, true);
/* First entry */
menu_entry_get(&entry, 0, 0, NULL, true);
if (string_is_empty(entry.path))
return;
/* No thumbnails for intermediate lists without playlist items */
if (!string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADD_ADDITIONAL_FILTER)) &&
!string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_SEARCH_NAME)))
{
gfx_thumbnail_set_content_playlist(ozone->thumbnail_path_data, NULL, 0);
ozone->want_thumbnail_bar = ozone->fullscreen_thumbnails_available = false;
return;
}
/* Selected entry */
menu_entry_get(&entry, 0, selection, NULL, true);
if (string_is_empty(entry.path))
return;
/* No thumbnails for header non-items */
if (string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADD_ADDITIONAL_FILTER)) ||
string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_SEARCH_NAME)))
{
gfx_thumbnail_set_content_playlist(ozone->thumbnail_path_data, NULL, 0);
ozone->want_thumbnail_bar = ozone->fullscreen_thumbnails_available = false;
return;
}
else
{
ozone->want_thumbnail_bar = ozone->fullscreen_thumbnails_available =
(menu_explore_set_entry_playlist_index(entry.type, ozone->thumbnail_path_data) >= 0 &&
menu_explore_get_entry_icon(entry.type));
}
ozone->want_thumbnail_bar = ozone->fullscreen_thumbnails_available =
(menu_explore_set_playlist_thumbnail(entry.type, ozone->thumbnail_path_data) >= 0);
}
}
#endif
@ -10785,6 +10764,11 @@ static void ozone_populate_entries(void *data,
ozone->num_search_terms_old = num_search_terms;
}
}
else if (ozone->is_explore_list)
{
/* when refreshing the explore view, also refresh the title */
ozone_set_header(ozone);
}
return;
}
@ -10804,7 +10788,8 @@ static void ozone_populate_entries(void *data,
ozone->depth = new_depth;
ozone->is_db_manager_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DATABASE_MANAGER_LIST));
ozone->is_explore_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_EXPLORE_LIST)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_TAB));
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_TAB)) ||
ozone_get_horizontal_selection_type(ozone) == MENU_EXPLORE_TAB;
ozone->is_file_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES));
ozone->is_quick_menu = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RPL_ENTRY_ACTIONS)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_SETTINGS)) ||
@ -10822,30 +10807,15 @@ static void ozone_populate_entries(void *data,
ozone->skip_thumbnail_reset = true;
}
/* Quick Menu under Explore list must also be Quick Menu */
#if defined(HAVE_LIBRETRODB)
if (ozone->is_explore_list)
{
/* Quick Menu under Explore list must also be Quick Menu */
ozone->is_quick_menu |= menu_is_nonrunning_quick_menu() || menu_is_running_quick_menu();
if (ozone->is_quick_menu)
if (!menu_explore_is_content_list())
ozone->is_explore_list = false;
}
/* Determine the first playlist item under "Load Content > Playlists" */
ozone->playlist_collection_offset = 0;
if (settings->uints.menu_content_show_add_entry)
ozone->playlist_collection_offset++;
if (settings->uints.menu_content_show_contentless_cores)
ozone->playlist_collection_offset++;
if (settings->bools.menu_content_show_explore)
ozone->playlist_collection_offset++;
if (settings->bools.menu_content_show_favorites)
ozone->playlist_collection_offset++;
if (settings->bools.menu_content_show_images)
ozone->playlist_collection_offset++;
if (settings->bools.menu_content_show_music)
ozone->playlist_collection_offset++;
if (settings->bools.menu_content_show_video)
ozone->playlist_collection_offset++;
#endif
if (animate)
if (ozone->categories_selection_ptr == ozone->categories_active_idx_old)

View File

@ -6736,47 +6736,19 @@ static void rgui_scan_selected_entry_thumbnail(rgui_t *rgui, bool force_load)
{
/* Get playlist index corresponding
* to the selected entry */
if (list &&
(selection < list_size))
if (list && selection < list_size)
{
/* Selected entry */
menu_entry_t entry;
MENU_ENTRY_INIT(entry);
entry.label_enabled = false;
entry.rich_label_enabled = false;
entry.value_enabled = false;
entry.sublabel_enabled = false;
/* First entry */
menu_entry_get(&entry, 0, 0, NULL, true);
if (string_is_empty(entry.path))
return;
/* No thumbnails for intermediate lists without playlist items */
if (!string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADD_ADDITIONAL_FILTER)) &&
!string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_SEARCH_NAME)))
{
gfx_thumbnail_set_content_playlist(rgui->thumbnail_path_data, NULL, 0);
return;
}
/* Selected entry */
menu_entry_get(&entry, 0, selection, NULL, true);
if (string_is_empty(entry.path))
return;
/* No thumbnails for header non-items */
if (string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADD_ADDITIONAL_FILTER)) ||
string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_SEARCH_NAME)))
{
gfx_thumbnail_set_content_playlist(rgui->thumbnail_path_data, NULL, 0);
return;
}
else
{
rgui->playlist_index =
menu_explore_set_entry_playlist_index(entry.type, rgui->thumbnail_path_data);
}
rgui->playlist_index =
menu_explore_set_playlist_thumbnail(entry.type, rgui->thumbnail_path_data);
}
}
#endif

View File

@ -337,7 +337,6 @@ typedef struct xmb_handle
size_t categories_selection_ptr_old;
size_t selection_ptr_old;
size_t fullscreen_thumbnail_selection;
size_t playlist_collection_offset;
/* size of the current list */
size_t list_size;
@ -1290,6 +1289,16 @@ static unsigned xmb_get_system_tab(xmb_handle_t *xmb, unsigned i)
return UINT_MAX;
}
static unsigned xmb_get_horizontal_selection_type(xmb_handle_t *xmb)
{
if (xmb->categories_selection_ptr > xmb->system_tab_end)
{
size_t i = xmb->categories_selection_ptr - xmb->system_tab_end-1;
return xmb->horizontal_list.list[i].type;
}
return 0;
}
static void xmb_refresh_thumbnail_image(void *data, unsigned i)
{
xmb_handle_t *xmb = (xmb_handle_t*)data;
@ -1406,48 +1415,17 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
/* Explore list */
if (string_is_empty(s))
{
/* Selected entry */
menu_entry_t entry;
size_t selection = menu_navigation_get_selection();
MENU_ENTRY_INIT(entry);
entry.label_enabled = false;
entry.rich_label_enabled = false;
entry.value_enabled = false;
entry.sublabel_enabled = false;
menu_entry_get(&entry, 0, menu_navigation_get_selection(), NULL, true);
/* First entry */
menu_entry_get(&entry, 0, 0, NULL, true);
if (string_is_empty(entry.path))
return;
/* No thumbnails for intermediate lists without playlist items */
if (!string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADD_ADDITIONAL_FILTER)) &&
!string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_SEARCH_NAME)))
{
gfx_thumbnail_set_content_playlist(xmb->thumbnail_path_data, NULL, 0);
xmb->fullscreen_thumbnails_available = false;
return;
}
/* Selected entry */
menu_entry_get(&entry, 0, selection, NULL, true);
if (string_is_empty(entry.path))
return;
/* No thumbnails for header non-items */
if (string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADD_ADDITIONAL_FILTER)) ||
string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_SEARCH_NAME)))
{
gfx_thumbnail_set_content_playlist(xmb->thumbnail_path_data, NULL, 0);
xmb->fullscreen_thumbnails_available = false;
return;
}
else
{
xmb->fullscreen_thumbnails_available =
(menu_explore_set_entry_playlist_index(entry.type, xmb->thumbnail_path_data) >= 0 &&
menu_explore_get_entry_icon(entry.type));
}
xmb->fullscreen_thumbnails_available =
(menu_explore_set_playlist_thumbnail(entry.type, xmb->thumbnail_path_data) >= 0);
}
}
#endif
@ -2423,6 +2401,12 @@ static void xmb_context_reset_horizontal_list(
image_texture_free(&ti);
}
}
else if (string_ends_with_size(xmb->horizontal_list.list[i].label, ".lvw",
strlen(xmb->horizontal_list.list[i].label), STRLEN_CONST(".lvw")))
{
/* For now use a default icon for views */
node->icon = xmb->textures.list[XMB_TEXTURE_FILE];
}
}
xmb_toggle_horizontal_list(xmb);
@ -2551,7 +2535,7 @@ static void xmb_populate_entries(void *data,
const char *path,
const char *label, unsigned k)
{
unsigned xmb_system_tab;
unsigned xmb_system_tab, xmb_horizontal_type;
xmb_handle_t *xmb = (xmb_handle_t*)data;
settings_t *settings = config_get_ptr();
bool menu_dynamic_wallpaper_enable =
@ -2561,9 +2545,9 @@ static void xmb_populate_entries(void *data,
unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN);
if (!xmb)
return;
xmb_system_tab = xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr);
xmb_horizontal_type = (xmb_system_tab == UINT_MAX ? xmb_get_horizontal_selection_type(xmb) : 0);
/* Determine whether this is a playlist */
xmb_system_tab = xmb_get_system_tab(xmb,
(unsigned)xmb->categories_selection_ptr);
xmb->is_playlist = (depth == 1
&& ((xmb_system_tab == XMB_SYSTEM_TAB_FAVORITES)
|| (xmb_system_tab == XMB_SYSTEM_TAB_HISTORY)
@ -2575,7 +2559,7 @@ static void xmb_populate_entries(void *data,
|| (xmb_system_tab == XMB_SYSTEM_TAB_VIDEO)
#endif
))
|| string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU))
|| (xmb_horizontal_type == FILE_TYPE_PLAYLIST_COLLECTION)
|| string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST))
|| string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST))
|| string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST))
@ -2614,34 +2598,20 @@ static void xmb_populate_entries(void *data,
/* Explore list */
xmb->is_explore_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_EXPLORE_LIST)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_TAB));
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_TAB)) ||
xmb_horizontal_type == MENU_EXPLORE_TAB;
/* Quick Menu under Explore list must also be Quick Menu */
#if defined(HAVE_LIBRETRODB)
if (xmb->is_explore_list)
{
/* Quick Menu under Explore list must also be Quick Menu */
xmb->is_quick_menu |= menu_is_nonrunning_quick_menu() || menu_is_running_quick_menu();
if (xmb->is_quick_menu)
xmb->is_explore_list = false;
else
if (!menu_explore_is_content_list())
xmb->is_explore_list = show_entry_idx = false;
else if (!xmb->is_quick_menu)
xmb->skip_thumbnail_reset = true;
}
/* Determine the first playlist item under "Load Content > Playlists" */
xmb->playlist_collection_offset = 0;
if (settings->uints.menu_content_show_add_entry)
xmb->playlist_collection_offset++;
if (settings->uints.menu_content_show_contentless_cores)
xmb->playlist_collection_offset++;
if (settings->bools.menu_content_show_explore)
xmb->playlist_collection_offset++;
if (settings->bools.menu_content_show_favorites)
xmb->playlist_collection_offset++;
if (settings->bools.menu_content_show_images)
xmb->playlist_collection_offset++;
if (settings->bools.menu_content_show_music)
xmb->playlist_collection_offset++;
if (settings->bools.menu_content_show_video)
xmb->playlist_collection_offset++;
#endif
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PREVENT_POPULATE, NULL))
{
@ -2662,7 +2632,7 @@ static void xmb_populate_entries(void *data,
/* Determine whether to show entry index */
/* Update list size & entry index texts */
if ((xmb->entry_idx_enabled = show_entry_idx &&
(xmb->is_playlist || (xmb->is_explore_list && xmb->depth > 1))))
(xmb->is_playlist || xmb->is_explore_list)))
{
xmb->list_size = menu_entries_get_size();
snprintf(xmb->entry_index_str, sizeof(xmb->entry_index_str),
@ -3828,14 +3798,7 @@ static int xmb_draw_item(
/* "Load Content" playlists */
if (xmb->depth == 3 && entry_type == FILE_TYPE_PLAYLIST_COLLECTION)
{
size_t i_playlist = 0;
xmb_node_t *sidebar_node;
if (i >= xmb->playlist_collection_offset)
i_playlist = i - xmb->playlist_collection_offset;
sidebar_node = (xmb_node_t*) file_list_get_userdata_at_offset(&xmb->horizontal_list, i_playlist);
xmb_node_t *sidebar_node = (xmb_node_t*) file_list_get_userdata_at_offset(&xmb->horizontal_list, list->list[i].entry_idx);
if (sidebar_node && sidebar_node->icon)
texture = sidebar_node->icon;
}

View File

@ -3352,6 +3352,13 @@ static int menu_displaylist_parse_horizontal_list(
if (!item)
return -1;
if (item->type == MENU_EXPLORE_TAB)
{
/* when opening a saved view the explore menu will handle the list */
menu_displaylist_ctl(DISPLAYLIST_EXPLORE, info, settings);
return 0;
}
if (!string_is_empty(item->path))
{
char lpl_basename[256];
@ -4039,6 +4046,7 @@ static unsigned menu_displaylist_parse_playlists(
size_t i, list_size;
struct string_list str_list = {0};
unsigned count = 0;
unsigned content_count = 0;
const char *path = info->path;
bool show_hidden_files = settings->bools.show_hidden_files;
@ -4136,10 +4144,40 @@ static unsigned menu_displaylist_parse_playlists(
show_hidden_files, true, false))
return count;
content_count = count;
dir_list_sort(&str_list, true);
list_size = str_list.size;
#if defined(HAVE_LIBRETRODB)
if (settings->bools.menu_content_show_explore)
{
/* list any custom explore views above playlists */
for (i = 0; i < list_size; i++)
{
char label[512];
const char *path = str_list.elems[i].data;
const char *fname = path_basename(path);
const char *fext = path_get_extension(fname);
if (!string_is_equal_noncase(fext, "lvw"))
continue;
snprintf(label, sizeof(label), "%s: %.*s",
msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_VIEW),
(int)(fext - 1 - fname), fname);
if (menu_entries_append(info->list, label, path,
MENU_ENUM_LABEL_GOTO_EXPLORE,
MENU_EXPLORE_TAB, 0, (count - content_count), NULL))
{
menu_file_list_cbs_t *cbs = ((menu_file_list_cbs_t*)info->list->list[info->list->size-1].actiondata);
cbs->action_sublabel = NULL;
count++;
}
}
}
#endif
for (i = 0; i < list_size; i++)
{
const char *path = str_list.elems[i].data;
@ -4188,7 +4226,7 @@ static unsigned menu_displaylist_parse_playlists(
if (menu_entries_append(info->list, path, "",
MENU_ENUM_LABEL_PLAYLIST_COLLECTION_ENTRY,
file_type, 0, 0, NULL))
file_type, 0, (count - content_count), NULL))
count++;
}

View File

@ -667,12 +667,12 @@ typedef struct explore_state explore_state_t;
explore_state_t *menu_explore_build_list(const char *directory_playlist,
const char *directory_database);
uintptr_t menu_explore_get_entry_icon(unsigned type);
const char *menu_explore_get_entry_database(unsigned type);
ssize_t menu_explore_get_entry_playlist_index(unsigned type,
playlist_t **playlist,
const struct playlist_entry **entry);
ssize_t menu_explore_set_entry_playlist_index(unsigned type,
gfx_thumbnail_path_data_t *thumbnail_path_data);
playlist_t **playlist, const struct playlist_entry **entry,
file_list_t *list, size_t *list_pos, size_t *list_size);
ssize_t menu_explore_set_playlist_thumbnail(unsigned type,
gfx_thumbnail_path_data_t *thumbnail_path_data); /* returns list index */
bool menu_explore_is_content_list();
void menu_explore_context_init(void);
void menu_explore_context_deinit(void);
void menu_explore_free_state(explore_state_t *state);

File diff suppressed because it is too large Load Diff

View File

@ -2257,6 +2257,14 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_EXPLORE_BY_FRANCHISE,
MENU_ENUM_LABEL_VALUE_EXPLORE_BY_TAG,
MENU_ENUM_LABEL_VALUE_EXPLORE_BY_SYSTEM_NAME,
MENU_ENUM_LABEL_EXPLORE_RANGE_FILTER,
MENU_ENUM_LABEL_EXPLORE_VIEW,
MENU_ENUM_LABEL_EXPLORE_SAVE_VIEW,
MENU_ENUM_LABEL_EXPLORE_DELETE_VIEW,
MENU_ENUM_LABEL_EXPLORE_NEW_VIEW,
MENU_ENUM_LABEL_EXPLORE_VIEW_EXISTS,
MENU_ENUM_LABEL_EXPLORE_VIEW_SAVED,
MENU_ENUM_LABEL_EXPLORE_VIEW_DELETED,
/* Content information settings */
MENU_LABEL(CONTENT_INFO_LABEL),

View File

@ -72,7 +72,7 @@ static void cb_task_menu_explore_init(
void *user_data, const char *err)
{
menu_explore_init_handle_t *menu_explore = NULL;
const char *menu_label = NULL;
unsigned menu_type = 0;
if (!task)
return;
@ -88,18 +88,26 @@ static void cb_task_menu_explore_init(
/* If the explore menu is currently displayed,
* it must be refreshed */
menu_entries_get_last_stack(NULL, &menu_label, NULL, NULL, NULL);
menu_entries_get_last_stack(NULL, NULL, &menu_type, NULL, NULL);
if (string_is_empty(menu_label))
return;
if (string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_EXPLORE_LIST)) ||
string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_TAB)))
/* check if we are opening a saved view from the horizontal/tabs menu */
if (menu_type == MENU_SETTING_HORIZONTAL_MENU)
{
bool refresh = false;
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
menu_ctx_list_t tabs, horizontal;
tabs.type = MENU_LIST_TABS;
if (menu_driver_list_get_selection(&tabs) && menu_driver_list_get_size(&tabs))
{
horizontal.type = MENU_LIST_HORIZONTAL;
horizontal.idx = tabs.selection - (tabs.size + 1);
if (menu_driver_list_get_entry(&horizontal))
menu_type = ((struct item_file*)horizontal.entry)->type;
}
}
if (menu_type == MENU_EXPLORE_TAB)
{
bool refresh_nonblocking = false;
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh_nonblocking);
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
}
}

View File

@ -581,21 +581,8 @@ static void cb_task_pl_entry_thumbnail_refresh_menu(
else
#endif
{
char str[255];
menu_entries_get_label(str, sizeof(str));
/* Explore menu selection index does not match playlist index even in System list. */
if (string_is_equal(str, msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_TAB)))
{
if (!string_is_equal(pl_thumb->playlist_path,
playlist_get_conf_path(current_playlist)))
return;
}
else
if (((pl_thumb->list_index != menu_navigation_get_selection()) &&
(pl_thumb->list_index != menu->rpl_entry_selection_ptr)) ||
!string_is_equal(pl_thumb->playlist_path,
playlist_get_conf_path(current_playlist)))
if (!string_is_equal(pl_thumb->playlist_path,
playlist_get_conf_path(current_playlist)))
return;
}

View File

@ -1213,6 +1213,11 @@ void MainWindow::reloadPlaylists()
QString iconPath;
QListWidgetItem *item = NULL;
const QString &file = m_playlistFiles.at(i);
/* don't show view files */
if (file.endsWith(".lvw", Qt::CaseInsensitive))
continue;
QString fileDisplayName = file;
QString fileName = file;
bool hasIcon = false;