(RGUI/GLUI) Clean up 'scan content' menu entries

This commit is contained in:
jdgleaver 2020-08-05 14:21:06 +01:00
parent db7e38fed5
commit 15cf483cd9
13 changed files with 144 additions and 31 deletions

View File

@ -520,7 +520,14 @@ static const bool content_show_netplay = true;
#endif
#endif
static const bool content_show_history = true;
static const bool content_show_add = true;
/* Specifies 'add content' visibility when using
* menus WITH a dedicated 'Import Content' tab */
#define DEFAULT_MENU_CONTENT_SHOW_ADD true
/* Specifies 'add content' visibility when using
* menus WITHOUT a dedicated 'Import Content' tab */
#define DEFAULT_MENU_CONTENT_SHOW_ADD_ENTRY MENU_ADD_CONTENT_ENTRY_DISPLAY_PLAYLISTS_TAB
static const bool content_show_playlists = true;
#if defined(HAVE_LIBRETRODB)
#define DEFAULT_MENU_CONTENT_SHOW_EXPLORE true

View File

@ -1589,7 +1589,7 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("content_show_netplay", &settings->bools.menu_content_show_netplay, true, content_show_netplay, false);
#endif
SETTING_BOOL("content_show_history", &settings->bools.menu_content_show_history, true, content_show_history, false);
SETTING_BOOL("content_show_add", &settings->bools.menu_content_show_add, true, content_show_add, false);
SETTING_BOOL("content_show_add", &settings->bools.menu_content_show_add, true, DEFAULT_MENU_CONTENT_SHOW_ADD, false);
SETTING_BOOL("content_show_playlists", &settings->bools.menu_content_show_playlists, true, content_show_playlists, false);
#if defined(HAVE_LIBRETRODB)
SETTING_BOOL("content_show_explore", &settings->bools.menu_content_show_explore, true, DEFAULT_MENU_CONTENT_SHOW_EXPLORE, false);
@ -1869,6 +1869,7 @@ static struct config_uint_setting *populate_settings_uint(
SETTING_UINT("menu_timedate_style", &settings->uints.menu_timedate_style, true, DEFAULT_MENU_TIMEDATE_STYLE, false);
SETTING_UINT("menu_timedate_date_separator", &settings->uints.menu_timedate_date_separator, true, DEFAULT_MENU_TIMEDATE_DATE_SEPARATOR, false);
SETTING_UINT("menu_ticker_type", &settings->uints.menu_ticker_type, true, DEFAULT_MENU_TICKER_TYPE, false);
SETTING_UINT("content_show_add_entry", &settings->uints.menu_content_show_add_entry, true, DEFAULT_MENU_CONTENT_SHOW_ADD_ENTRY, false);
#ifdef HAVE_RGUI
SETTING_UINT("rgui_menu_color_theme", &settings->uints.menu_rgui_color_theme, true, DEFAULT_RGUI_COLOR_THEME, false);
SETTING_UINT("rgui_thumbnail_downscaler", &settings->uints.menu_rgui_thumbnail_downscaler, true, rgui_thumbnail_downscaler, false);

View File

@ -602,6 +602,7 @@ typedef struct settings
unsigned menu_rgui_aspect_ratio_lock;
unsigned menu_rgui_particle_effect;
unsigned menu_ticker_type;
unsigned menu_content_show_add_entry;
unsigned playlist_entry_remove_enable;
unsigned playlist_show_inline_core_name;

View File

@ -3316,6 +3316,10 @@ MSG_HASH(
MENU_ENUM_LABEL_CONTENT_SHOW_ADD,
"content_show_add"
)
MSG_HASH(
MENU_ENUM_LABEL_CONTENT_SHOW_ADD_ENTRY,
"content_show_add_entry"
)
MSG_HASH(
MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLISTS,
"content_show_playlists"

View File

@ -101,11 +101,11 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST,
"Scan Content"
"Import Content"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_ADD_CONTENT_LIST,
"Scan content and add to database."
"Create and update playlists by scanning content."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SHOW_WIMP,
@ -3914,6 +3914,22 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD,
"Show the import content tab inside the main menu."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD_ENTRY,
"Show Import Content"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD_ENTRY,
"Show an import content entry inside the main menu or playlists tab/submenu."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_ADD_CONTENT_ENTRY_DISPLAY_MAIN_TAB,
"Main Menu"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_ADD_CONTENT_ENTRY_DISPLAY_PLAYLISTS_TAB,
"Playlists Menu"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_PLAYLISTS,
"Show Playlist Tabs"

View File

@ -729,6 +729,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_settings_tab,
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_settings_tab_enable_password, MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS_PASSWORD)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_history_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_import_content_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_import_content_entry, MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD_ENTRY)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_playlist_tabs, MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_explore_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_EXPLORE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_main_menu_enable_settings, MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS)
@ -1930,6 +1931,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_CONTENT_SHOW_ADD:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_import_content_tab);
break;
case MENU_ENUM_LABEL_CONTENT_SHOW_ADD_ENTRY:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_import_content_entry);
break;
case MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLISTS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_playlist_tabs);
break;

View File

@ -8442,6 +8442,12 @@ static int materialui_list_push(void *data, void *userdata,
}
#endif
#endif
if (settings->uints.menu_content_show_add_entry ==
MENU_ADD_CONTENT_ENTRY_DISPLAY_MAIN_TAB)
{
entry.enum_idx = MENU_ENUM_LABEL_ADD_CONTENT_LIST;
menu_displaylist_setting(&entry);
}
if (settings->bools.menu_content_show_netplay)
{

View File

@ -277,6 +277,7 @@ uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone,
case MENU_ENUM_LABEL_USER_SETTINGS:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_USER];
case MENU_ENUM_LABEL_DIRECTORY_SETTINGS:
case MENU_ENUM_LABEL_ADD_CONTENT_LIST:
case MENU_ENUM_LABEL_SCAN_DIRECTORY:
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_LIST:
case MENU_ENUM_LABEL_REMAP_FILE_SAVE_CONTENT_DIR:

View File

@ -2533,6 +2533,8 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
case MENU_ENUM_LABEL_FAVORITES: /* "Start Directory" */
case MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST:
return xmb->textures.list[XMB_TEXTURE_FOLDER];
case MENU_ENUM_LABEL_ADD_CONTENT_LIST:
return xmb->textures.list[XMB_TEXTURE_ADD];
case MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR:
return xmb->textures.list[XMB_TEXTURE_RDB];

View File

@ -122,6 +122,17 @@ enum menu_timedate_date_separator_type
MENU_TIMEDATE_DATE_SEPARATOR_LAST
};
/* Specifies location of the 'Scan Content' menu
* entry when using menu drivers without a
* dedicated 'Import Content' (horizontal) tab */
enum menu_add_content_entry_display_type
{
MENU_ADD_CONTENT_ENTRY_DISPLAY_HIDDEN = 0,
MENU_ADD_CONTENT_ENTRY_DISPLAY_MAIN_TAB,
MENU_ADD_CONTENT_ENTRY_DISPLAY_PLAYLISTS_TAB,
MENU_ADD_CONTENT_ENTRY_DISPLAY_LAST
};
enum rgui_color_theme
{
RGUI_THEME_CUSTOM = 0,

View File

@ -3077,36 +3077,24 @@ static unsigned menu_displaylist_parse_playlists(
if (!horizontal)
{
const char *menu_ident = menu_driver_ident();
bool show_add_content = false;
/* When using MaterialUI with the navigation bar
* hidden, these 'add content' entries are accessible
* from the main menu 'Scan Content' entry. Placing
* them here as well is unnecessary/ugly duplication */
if (settings->bools.menu_content_show_add &&
!(string_is_equal(menu_ident, "glui") &&
!settings->bools.menu_materialui_show_nav_bar))
{
#ifdef HAVE_LIBRETRODB
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY),
msg_hash_to_str(MENU_ENUM_LABEL_SCAN_DIRECTORY),
MENU_ENUM_LABEL_SCAN_DIRECTORY,
MENU_SETTING_ACTION, 0, 0))
count++;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_FILE),
msg_hash_to_str(MENU_ENUM_LABEL_SCAN_FILE),
MENU_ENUM_LABEL_SCAN_FILE,
MENU_SETTING_ACTION, 0, 0))
count++;
#if defined(HAVE_XMB) || defined(HAVE_OZONE)
if (string_is_equal(menu_ident, "xmb") ||
string_is_equal(menu_ident, "ozone"))
show_add_content = settings->bools.menu_content_show_add;
else
#endif
show_add_content = (settings->uints.menu_content_show_add_entry ==
MENU_ADD_CONTENT_ENTRY_DISPLAY_PLAYLISTS_TAB);
if (show_add_content)
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_LIST),
msg_hash_to_str(MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_LIST),
MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_LIST,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST),
msg_hash_to_str(MENU_ENUM_LABEL_ADD_CONTENT_LIST),
MENU_ENUM_LABEL_ADD_CONTENT_LIST,
MENU_SETTING_ACTION, 0, 0))
count++;
}
#if defined(HAVE_LIBRETRODB)
if (settings->bools.menu_content_show_explore)
@ -7486,6 +7474,7 @@ unsigned menu_displaylist_build_list(
{MENU_ENUM_LABEL_CONTENT_SHOW_NETPLAY, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_CONTENT_SHOW_HISTORY, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_CONTENT_SHOW_ADD, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_CONTENT_SHOW_ADD_ENTRY, PARSE_ONLY_UINT, true },
{MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLISTS, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_TIMEDATE_ENABLE, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_TIMEDATE_STYLE, PARSE_ONLY_UINT, true },
@ -11248,6 +11237,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
settings_t *settings = config_get_ptr();
rarch_system_info_t *sys_info = runloop_get_system_info();
const char *menu_ident = menu_driver_ident();
bool show_add_content = false;
if (rarch_ctl(RARCH_CTL_CORE_IS_RUNNING, NULL))
{
@ -11330,11 +11320,21 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
MENU_SETTING_ACTION, 0, 0))
count++;
if (settings->bools.menu_content_show_add)
#if defined(HAVE_XMB) || defined(HAVE_OZONE)
if (string_is_equal(menu_ident, "xmb") ||
string_is_equal(menu_ident, "ozone"))
show_add_content = settings->bools.menu_content_show_add;
else
#endif
show_add_content = (settings->uints.menu_content_show_add_entry ==
MENU_ADD_CONTENT_ENTRY_DISPLAY_MAIN_TAB);
if (show_add_content)
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list,
MENU_ENUM_LABEL_ADD_CONTENT_LIST,
PARSE_ACTION, false) == 0)
count++;
#ifdef HAVE_NETWORKING
if (settings->bools.menu_content_show_netplay)
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list,

View File

@ -3415,6 +3415,36 @@ static void setting_get_string_representation_uint_menu_timedate_date_separator(
}
}
static void setting_get_string_representation_uint_menu_add_content_entry_display_type(
rarch_setting_t *setting,
char *s, size_t len)
{
if (!setting)
return;
switch (*setting->value.target.unsigned_integer)
{
case MENU_ADD_CONTENT_ENTRY_DISPLAY_HIDDEN:
strlcpy(s,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_OFF),
len);
break;
case MENU_ADD_CONTENT_ENTRY_DISPLAY_MAIN_TAB:
strlcpy(s,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_MENU_ADD_CONTENT_ENTRY_DISPLAY_MAIN_TAB),
len);
break;
case MENU_ADD_CONTENT_ENTRY_DISPLAY_PLAYLISTS_TAB:
strlcpy(s,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_MENU_ADD_CONTENT_ENTRY_DISPLAY_PLAYLISTS_TAB),
len);
break;
}
}
static void setting_get_string_representation_uint_rgui_menu_color_theme(
rarch_setting_t *setting,
char *s, size_t len)
@ -14328,12 +14358,16 @@ static bool setting_append_list(
SD_FLAG_NONE);
#endif
#if defined(HAVE_XMB) || defined(HAVE_OZONE)
if (string_is_equal(settings->arrays.menu_driver, "xmb") ||
string_is_equal(settings->arrays.menu_driver, "ozone"))
{
CONFIG_BOOL(
list, list_info,
&settings->bools.menu_content_show_add,
MENU_ENUM_LABEL_CONTENT_SHOW_ADD,
MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD,
content_show_add,
DEFAULT_MENU_CONTENT_SHOW_ADD,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
@ -14343,6 +14377,28 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
}
else
#endif
{
CONFIG_UINT(
list, list_info,
&settings->uints.menu_content_show_add_entry,
MENU_ENUM_LABEL_CONTENT_SHOW_ADD_ENTRY,
MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD_ENTRY,
DEFAULT_MENU_CONTENT_SHOW_ADD_ENTRY,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_uint_menu_add_content_entry_display_type;
menu_settings_list_current_add_range(list, list_info, 0, MENU_ADD_CONTENT_ENTRY_DISPLAY_LAST-1, 1, true, true);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_COMBOBOX;
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
}
CONFIG_BOOL(
list, list_info,

View File

@ -1079,6 +1079,7 @@ enum msg_hash_enums
MENU_LABEL(CONTENT_SHOW_NETPLAY),
MENU_LABEL(CONTENT_SHOW_HISTORY),
MENU_LABEL(CONTENT_SHOW_ADD),
MENU_LABEL(CONTENT_SHOW_ADD_ENTRY),
MENU_LABEL(CONTENT_SHOW_PLAYLISTS),
MENU_LABEL(CONTENT_SHOW_EXPLORE),
MENU_LABEL(XMB_RIBBON_ENABLE),
@ -1164,6 +1165,9 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_SCROLL_NORMAL,
MENU_ENUM_LABEL_VALUE_SCROLL_FAST,
MENU_ENUM_LABEL_VALUE_MENU_ADD_CONTENT_ENTRY_DISPLAY_MAIN_TAB,
MENU_ENUM_LABEL_VALUE_MENU_ADD_CONTENT_ENTRY_DISPLAY_PLAYLISTS_TAB,
/* UI settings */
MENU_LABEL(VIDEO_DISABLE_COMPOSITION),
MENU_LABEL(UI_COMPANION_ENABLE),