Add "Scan Content" options

This commit is contained in:
twinaphex 2015-07-04 01:51:41 +02:00
parent 7c1a5d3e31
commit 6f268d7dff
10 changed files with 146 additions and 10 deletions

View File

@ -189,6 +189,11 @@ static int deferred_push_content_settings(menu_displaylist_info_t *info)
return menu_displaylist_push_list(info, DISPLAYLIST_CONTENT_SETTINGS);
}
static int deferred_push_add_content_list(menu_displaylist_info_t *info)
{
return menu_displaylist_push_list(info, DISPLAYLIST_ADD_CONTENT_LIST);
}
static int deferred_push_load_content_list(menu_displaylist_info_t *info)
{
return menu_displaylist_push_list(info, DISPLAYLIST_LOAD_CONTENT_LIST);
@ -558,6 +563,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label(menu_file_list_cbs_t *
case MENU_LABEL_CONTENT_SETTINGS:
cbs->action_deferred_push = deferred_push_content_settings;
break;
case MENU_LABEL_ADD_CONTENT_LIST:
cbs->action_deferred_push = deferred_push_add_content_list;
break;
case MENU_LABEL_LOAD_CONTENT_LIST:
cbs->action_deferred_push = deferred_push_load_content_list;
break;

View File

@ -834,6 +834,12 @@ static int action_ok_path_use_directory(const char *path,
return menu_entry_pathdir_set_value(0, NULL);
}
static int action_ok_path_scan_directory(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return action_scan_directory(NULL, label, type, idx);
}
static int action_ok_core_deferred_set(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -1739,10 +1745,13 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_LABEL_MANAGEMENT:
case MENU_LABEL_ONLINE_UPDATER:
case MENU_LABEL_LOAD_CONTENT_LIST:
case MENU_LABEL_ADD_CONTENT_LIST:
case MENU_LABEL_INFORMATION_LIST:
case MENU_LABEL_CONTENT_SETTINGS:
cbs->action_ok = action_ok_push_default;
break;
case MENU_LABEL_SCAN_FILE:
case MENU_LABEL_SCAN_DIRECTORY:
case MENU_LABEL_LOAD_CONTENT:
case MENU_LABEL_DETECT_CORE_LIST:
cbs->action_ok = action_ok_push_content_list;
@ -1866,17 +1875,38 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
cbs->action_ok = action_ok_remap_file_load;
break;
case MENU_FILE_SHADER_PRESET:
cbs->action_ok = action_ok_shader_preset_load;
switch (menu_label_hash)
{
case MENU_LABEL_SCAN_FILE:
break;
default:
cbs->action_ok = action_ok_shader_preset_load;
}
break;
case MENU_FILE_SHADER:
cbs->action_ok = action_ok_shader_pass_load;
switch (menu_label_hash)
{
case MENU_LABEL_SCAN_FILE:
break;
default:
cbs->action_ok = action_ok_shader_pass_load;
}
break;
case MENU_FILE_IMAGE:
cbs->action_ok = action_ok_menu_wallpaper_load;
switch (menu_label_hash)
{
case MENU_LABEL_SCAN_FILE:
break;
default:
cbs->action_ok = action_ok_menu_wallpaper_load;
}
break;
case MENU_FILE_USE_DIRECTORY:
cbs->action_ok = action_ok_path_use_directory;
break;
case MENU_FILE_SCAN_DIRECTORY:
cbs->action_ok = action_ok_path_scan_directory;
break;
case MENU_FILE_CONFIG:
cbs->action_ok = action_ok_config_load;
break;
@ -1884,7 +1914,13 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
cbs->action_ok = action_ok_directory_push;
break;
case MENU_FILE_CARCHIVE:
cbs->action_ok = action_ok_compressed_archive_push;
switch (menu_label_hash)
{
case MENU_LABEL_SCAN_FILE:
break;
default:
cbs->action_ok = action_ok_compressed_archive_push;
}
break;
case MENU_FILE_CORE:
switch (menu_label_hash)
@ -1965,11 +2001,23 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
case MENU_FILE_MOVIE:
case MENU_FILE_MUSIC:
#ifdef HAVE_FFMPEG
cbs->action_ok = action_ok_file_load_ffmpeg;
switch (menu_label_hash)
{
case MENU_LABEL_SCAN_FILE:
break;
default:
cbs->action_ok = action_ok_file_load_ffmpeg;
}
#endif
break;
case MENU_FILE_IMAGEVIEWER:
cbs->action_ok = action_ok_file_load_imageviewer;
switch (menu_label_hash)
{
case MENU_LABEL_SCAN_FILE:
break;
default:
cbs->action_ok = action_ok_file_load_imageviewer;
}
break;
case MENU_SETTINGS:
case MENU_SETTING_GROUP:

View File

@ -21,7 +21,7 @@
#include "../../runloop_data.h"
static int action_scan_file(const char *path,
int action_scan_file(const char *path,
const char *label, unsigned type, size_t idx)
{
char fullpath[PATH_MAX_LENGTH] = {0};
@ -40,7 +40,7 @@ static int action_scan_file(const char *path,
return 0;
}
static int action_scan_directory(const char *path,
int action_scan_directory(const char *path,
const char *label, unsigned type, size_t idx)
{
char fullpath[PATH_MAX_LENGTH] = {0};
@ -53,7 +53,10 @@ static int action_scan_directory(const char *path,
menu_list_get_last_stack(menu_list, &menu_path, &menu_label, NULL, NULL);
fill_pathname_join(fullpath, menu_path, path, sizeof(fullpath));
strlcpy(fullpath, menu_path, sizeof(fullpath));
if (path)
fill_pathname_join(fullpath, fullpath, path, sizeof(fullpath));
rarch_main_data_msg_queue_push(DATA_TYPE_DB, fullpath, "cb_db_scan_folder", 0, 1, true);
return 0;

View File

@ -26,6 +26,14 @@ static const char *menu_hash_to_str_us_label(uint32_t hash)
{
switch (hash)
{
case MENU_LABEL_SCAN_THIS_DIRECTORY:
return "scan_this_directory";
case MENU_LABEL_SCAN_FILE:
return "scan_file";
case MENU_LABEL_SCAN_DIRECTORY:
return "scan_directory";
case MENU_LABEL_ADD_CONTENT_LIST:
return "add_content";
case MENU_LABEL_OVERLAY_AUTOLOAD_PREFERRED:
return "overlay_autoload_preferred";
case MENU_LABEL_INFORMATION_LIST:
@ -596,6 +604,14 @@ const char *menu_hash_to_str_us(uint32_t hash)
switch (hash)
{
case MENU_LABEL_VALUE_SCAN_THIS_DIRECTORY:
return "Scan This Directory";
case MENU_LABEL_VALUE_SCAN_FILE:
return "Scan File";
case MENU_LABEL_VALUE_SCAN_DIRECTORY:
return "Scan Directory";
case MENU_LABEL_VALUE_ADD_CONTENT_LIST:
return "Add Content";
case MENU_LABEL_OVERLAY_AUTOLOAD_PREFERRED:
return "Auto-load preferred overlay";
case MENU_LABEL_VALUE_INFORMATION_LIST:

View File

@ -78,6 +78,7 @@ typedef enum
MENU_FILE_FONT,
MENU_FILE_CONFIG,
MENU_FILE_USE_DIRECTORY,
MENU_FILE_SCAN_DIRECTORY,
MENU_FILE_CARCHIVE,
MENU_FILE_IN_CARCHIVE,
MENU_FILE_IMAGE,

View File

@ -126,6 +126,12 @@ int menu_cbs_init_bind_title(menu_file_list_cbs_t *cbs,
int deferred_push_content_list(void *data, void *userdata,
const char *path, const char *label, unsigned type);
int action_scan_directory(const char *path,
const char *label, unsigned type, size_t idx);
int action_scan_file(const char *path,
const char *label, unsigned type, size_t idx);
void menu_cbs_init(void *data,
const char *path, const char *label,
unsigned type, size_t idx);

View File

@ -1652,6 +1652,27 @@ static int menu_displaylist_parse_information_list(menu_displaylist_info_t *info
return 0;
}
static int menu_displaylist_parse_add_content_list(menu_displaylist_info_t *info)
{
global_t *global = global_get_ptr();
(void)global;
#ifdef HAVE_LIBRETRODB
menu_list_push(info->list,
menu_hash_to_str(MENU_LABEL_VALUE_SCAN_DIRECTORY),
menu_hash_to_str(MENU_LABEL_SCAN_DIRECTORY),
MENU_SETTING_ACTION, 0, 0);
menu_list_push(info->list,
menu_hash_to_str(MENU_LABEL_VALUE_SCAN_FILE),
menu_hash_to_str(MENU_LABEL_SCAN_FILE),
MENU_SETTING_ACTION, 0, 0);
#endif
return 0;
}
static int menu_displaylist_parse_load_content_list(menu_displaylist_info_t *info)
{
global_t *global = global_get_ptr();
@ -1882,6 +1903,12 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool *n
settings->menu.navigation.browser.filter.supported_extensions_enable
? info->exts : NULL, true);
if (hash_label == MENU_LABEL_SCAN_DIRECTORY)
menu_list_push(info->list,
menu_hash_to_str(MENU_LABEL_VALUE_SCAN_THIS_DIRECTORY),
menu_hash_to_str(MENU_LABEL_SCAN_THIS_DIRECTORY),
MENU_FILE_SCAN_DIRECTORY, 0 ,0);
if (push_dir)
menu_list_push(info->list,
menu_hash_to_str(MENU_LABEL_VALUE_USE_THIS_DIRECTORY),
@ -2121,6 +2148,13 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
menu_list_clear(info->list);
ret = menu_displaylist_parse_information_list(info);
need_push = true;
need_refresh = true;
break;
case DISPLAYLIST_ADD_CONTENT_LIST:
menu_list_clear(info->list);
ret = menu_displaylist_parse_add_content_list(info);
need_push = true;
need_refresh = true;
break;

View File

@ -79,7 +79,8 @@ enum
DISPLAYLIST_OPTIONS_REMAPPINGS,
DISPLAYLIST_OPTIONS_MANAGEMENT,
DISPLAYLIST_OPTIONS_DISK,
DISPLAYLIST_OPTIONS_SHADERS
DISPLAYLIST_OPTIONS_SHADERS,
DISPLAYLIST_ADD_CONTENT_LIST
};
typedef struct menu_displaylist_info

View File

@ -25,6 +25,18 @@ extern "C" {
#define MENU_VALUE_SEARCH 0xd0d5febbU
#define MENU_LABEL_SCAN_THIS_DIRECTORY 0x6921b775U
#define MENU_LABEL_VALUE_SCAN_THIS_DIRECTORY 0x2911e177U
#define MENU_LABEL_SCAN_DIRECTORY 0x57de303eU
#define MENU_LABEL_VALUE_SCAN_DIRECTORY 0x61af24dfU
#define MENU_LABEL_VALUE_SCAN_FILE 0x41be3aeaU
#define MENU_LABEL_SCAN_FILE 0xd5d1eee9U
#define MENU_LABEL_ADD_CONTENT_LIST 0x046f4668U
#define MENU_LABEL_VALUE_ADD_CONTENT_LIST 0x955da2c9U
#define MENU_LABEL_UPDATE_AUTOCONFIG_PROFILES_HID 0x1e94ee4dU
#define MENU_LABEL_VALUE_UPDATE_AUTOCONFIG_PROFILES_HID 0x524f4590U

View File

@ -2501,6 +2501,13 @@ static bool setting_append_list_main_menu_options(
parent_group);
}
CONFIG_ACTION(
menu_hash_to_str(MENU_LABEL_ADD_CONTENT_LIST),
menu_hash_to_str(MENU_LABEL_VALUE_ADD_CONTENT_LIST),
group_info.name,
subgroup_info.name,
parent_group);
#ifdef HAVE_NETWORKING
CONFIG_ACTION(
menu_hash_to_str(MENU_LABEL_ONLINE_UPDATER),