Merge pull request #9345 from LazyBumHorse/delete_auto

finish up shader menu changes, add shader preset remove options to Qt
This commit is contained in:
Twinaphex 2019-08-24 16:56:41 +02:00 committed by GitHub
commit e5ac07f52f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 291 additions and 116 deletions

View File

@ -4084,7 +4084,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -5102,7 +5102,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -3860,7 +3860,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -3989,7 +3989,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -8066,7 +8066,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -3748,7 +3748,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -8218,7 +8218,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -9006,7 +9006,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -3969,7 +3969,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -9381,7 +9381,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -9213,7 +9213,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -843,6 +843,8 @@ MSG_HASH(MENU_ENUM_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE,
"no_playlist_entries_available") "no_playlist_entries_available")
MSG_HASH(MENU_ENUM_LABEL_NO_SETTINGS_FOUND, MSG_HASH(MENU_ENUM_LABEL_NO_SETTINGS_FOUND,
"menu_label_no_settings_found") "menu_label_no_settings_found")
MSG_HASH(MENU_ENUM_LABEL_NO_PRESETS_FOUND,
"menu_label_no_presets_found")
MSG_HASH(MENU_ENUM_LABEL_NO_SHADER_PARAMETERS, MSG_HASH(MENU_ENUM_LABEL_NO_SHADER_PARAMETERS,
"no_shader_parameters.") "no_shader_parameters.")
MSG_HASH(MENU_ENUM_LABEL_ONLINE, MSG_HASH(MENU_ENUM_LABEL_ONLINE,

View File

@ -3742,7 +3742,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -4533,7 +4533,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -9293,7 +9293,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -3814,7 +3814,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -4012,7 +4012,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -9018,7 +9018,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -2032,6 +2032,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_NO_SETTINGS_FOUND, MENU_ENUM_LABEL_VALUE_NO_SETTINGS_FOUND,
"No settings found." "No settings found."
) )
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NO_PRESETS_FOUND,
"No automatic shader presets found."
)
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_NO_SHADER_PARAMETERS, MENU_ENUM_LABEL_VALUE_NO_SHADER_PARAMETERS,
"No shader parameters." "No shader parameters."
@ -3874,7 +3878,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE,
"Save ..." "Save"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS,
@ -6594,7 +6598,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE,
"Save shader preset as ..." "Save the current shader preset."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_AS, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_AS,
@ -8542,6 +8546,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_REMOVE, MENU_ENUM_LABEL_VALUE_QT_REMOVE,
"Remove" "Remove"
) )
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_REMOVE_PASSES,
"Remove Passes"
)
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_APPLY, MENU_ENUM_LABEL_VALUE_QT_APPLY,
"Apply" "Apply"
@ -9525,10 +9533,10 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove an automatic shader preset.")
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_GLOBAL, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_GLOBAL,
"Remove Global Preset") "Remove Global Preset")

View File

@ -3904,7 +3904,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE,
"Remove ...") "Remove")
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE, MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_REMOVE,
"Remove shader presets of a specific type.") "Remove shader presets of a specific type.")

View File

@ -2739,10 +2739,16 @@ static int generic_action_ok_shader_preset_remove(const char *path,
} }
if (menu_shader_manager_remove_auto_preset(preset_type)) if (menu_shader_manager_remove_auto_preset(preset_type))
{
bool refresh = false;
runloop_msg_queue_push( runloop_msg_queue_push(
msg_hash_to_str(MSG_SHADER_PRESET_REMOVED_SUCCESSFULLY), msg_hash_to_str(MSG_SHADER_PRESET_REMOVED_SUCCESSFULLY),
1, 100, true, 1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
}
else else
runloop_msg_queue_push( runloop_msg_queue_push(
msg_hash_to_str(MSG_ERROR_REMOVING_SHADER_PRESET), msg_hash_to_str(MSG_ERROR_REMOVING_SHADER_PRESET),

View File

@ -2495,8 +2495,9 @@ static void materialui_list_insert(void *userdata,
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_CORE_INFORMATION_AVAILABLE)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_CORE_INFORMATION_AVAILABLE)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_CORE_OPTIONS_AVAILABLE)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_CORE_OPTIONS_AVAILABLE)) ||
(string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_INFORMATION))) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_INFORMATION)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_SETTINGS_FOUND)) string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_SETTINGS_FOUND)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_PRESETS_FOUND))
) )
{ {
node->texture_switch2_index = MUI_TEXTURE_INFO; node->texture_switch2_index = MUI_TEXTURE_INFO;

View File

@ -6291,13 +6291,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (settings->bools.video_shader_enable) if (settings->bools.video_shader_enable)
{ {
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER_APPLY_CHANGES),
msg_hash_to_str(MENU_ENUM_LABEL_SHADER_APPLY_CHANGES),
MENU_ENUM_LABEL_SHADER_APPLY_CHANGES,
MENU_SETTING_ACTION, 0, 0))
count++;
if (frontend_driver_can_watch_for_changes()) if (frontend_driver_can_watch_for_changes())
{ {
if (menu_entries_append_enum(info->list, if (menu_entries_append_enum(info->list,
@ -6328,12 +6321,20 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
MENU_SETTING_ACTION, 0, 0)) MENU_SETTING_ACTION, 0, 0))
count++; count++;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER_APPLY_CHANGES),
msg_hash_to_str(MENU_ENUM_LABEL_SHADER_APPLY_CHANGES),
MENU_ENUM_LABEL_SHADER_APPLY_CHANGES,
MENU_SETTING_ACTION, 0, 0))
count++;
if (menu_entries_append_enum(info->list, if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS), msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS),
MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS, MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS,
MENU_SETTING_ACTION, 0, 0)) MENU_SETTING_ACTION, 0, 0))
count++; count++;
if (menu_entries_append_enum(info->list, if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES), msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES),
@ -8214,6 +8215,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
{ {
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
if (menu_shader_manager_auto_preset_exists(SHADER_PRESET_GLOBAL))
if (menu_entries_append_enum(info->list, if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_GLOBAL), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_GLOBAL),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_GLOBAL), msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_GLOBAL),
@ -8221,6 +8223,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
MENU_SETTING_ACTION, 0, 0)) MENU_SETTING_ACTION, 0, 0))
count++; count++;
if (menu_shader_manager_auto_preset_exists(SHADER_PRESET_CORE))
if (menu_entries_append_enum(info->list, if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_CORE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_CORE),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_CORE), msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_CORE),
@ -8228,6 +8231,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
MENU_SETTING_ACTION, 0, 0)) MENU_SETTING_ACTION, 0, 0))
count++; count++;
if (menu_shader_manager_auto_preset_exists(SHADER_PRESET_PARENT))
if (menu_entries_append_enum(info->list, if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_PARENT), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_PARENT),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_PARENT), msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_PARENT),
@ -8235,12 +8239,20 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
MENU_SETTING_ACTION, 0, 0)) MENU_SETTING_ACTION, 0, 0))
count++; count++;
if (menu_shader_manager_auto_preset_exists(SHADER_PRESET_GAME))
if (menu_entries_append_enum(info->list, if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_GAME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_GAME),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_GAME), msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_GAME),
MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_GAME, MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_GAME,
MENU_SETTING_ACTION, 0, 0)) MENU_SETTING_ACTION, 0, 0))
count++; count++;
if (count == 0)
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_PRESETS_FOUND),
msg_hash_to_str(MENU_ENUM_LABEL_NO_PRESETS_FOUND),
MENU_ENUM_LABEL_NO_PRESETS_FOUND,
0, 0, 0);
#endif #endif
} }

View File

@ -45,6 +45,18 @@ void menu_shader_set_modified(bool modified)
menu_driver_shader_modified = modified; menu_driver_shader_modified = modified;
} }
static enum rarch_shader_type shader_types[] =
{
RARCH_SHADER_GLSL, RARCH_SHADER_SLANG, RARCH_SHADER_CG
};
enum auto_shader_operation
{
AUTO_SHADER_OP_SAVE = 0,
AUTO_SHADER_OP_REMOVE,
AUTO_SHADER_OP_EXISTS
};
struct video_shader *menu_shader_get(void) struct video_shader *menu_shader_get(void)
{ {
if (video_shader_any_supported()) if (video_shader_any_supported())
@ -316,8 +328,7 @@ static bool menu_shader_manager_save_preset_internal(
return ret; return ret;
} }
/** Saves or deletes an auto-shader, save = false requires no other parameters */ static bool menu_shader_manager_operate_auto_preset(enum auto_shader_operation op,
static bool menu_shader_manager_operate_auto_preset(bool save,
const struct video_shader *shader, enum auto_shader_type type, bool apply) const struct video_shader *shader, enum auto_shader_type type, bool apply)
{ {
char tmp[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH];
@ -379,25 +390,20 @@ static bool menu_shader_manager_operate_auto_preset(bool save,
return false; return false;
} }
if (save) if (op == AUTO_SHADER_OP_SAVE)
{ {
if (!path_is_directory(directory)) if (!path_is_directory(directory))
path_mkdir(directory); path_mkdir(directory);
return menu_shader_manager_save_preset_internal(shader, file, apply, true); return menu_shader_manager_save_preset_internal(shader, file, apply, true);
} }
else else if (op == AUTO_SHADER_OP_REMOVE)
{ {
/* remove all supported auto-shaders of given type */
char *end = file + strlen(file); char *end = file + strlen(file);
size_t i; size_t i;
bool success = false; bool success = false;
static enum rarch_shader_type shader_types[] =
{
RARCH_SHADER_GLSL, RARCH_SHADER_SLANG, RARCH_SHADER_CG
};
/* remove all supported auto-shaders of given type */
for (i = 0; i < ARRAY_SIZE(shader_types); i++) for (i = 0; i < ARRAY_SIZE(shader_types); i++)
{ {
const char *preset_ext; const char *preset_ext;
@ -414,6 +420,30 @@ static bool menu_shader_manager_operate_auto_preset(bool save,
return success; return success;
} }
else if (op == AUTO_SHADER_OP_EXISTS)
{
/* test if any supported auto-shaders of given type exists */
char *end = file + strlen(file);
size_t i;
for (i = 0; i < ARRAY_SIZE(shader_types); i++)
{
const char *preset_ext;
if (!video_shader_is_supported(shader_types[i]))
continue;
preset_ext = video_shader_get_preset_extension(shader_types[i]);
strlcpy(end, preset_ext, sizeof(file) - (end-file));
if (path_is_valid(file))
return true;
}
return false;
}
return false;
} }
/** /**
@ -433,7 +463,7 @@ static bool menu_shader_manager_operate_auto_preset(bool save,
bool menu_shader_manager_save_auto_preset(const struct video_shader *shader, bool menu_shader_manager_save_auto_preset(const struct video_shader *shader,
enum auto_shader_type type, bool apply) enum auto_shader_type type, bool apply)
{ {
return menu_shader_manager_operate_auto_preset(true, shader, type, apply); return menu_shader_manager_operate_auto_preset(AUTO_SHADER_OP_SAVE, shader, type, apply);
} }
/** /**
@ -459,7 +489,18 @@ bool menu_shader_manager_save_preset(const struct video_shader *shader,
**/ **/
bool menu_shader_manager_remove_auto_preset(enum auto_shader_type type) bool menu_shader_manager_remove_auto_preset(enum auto_shader_type type)
{ {
return menu_shader_manager_operate_auto_preset(false, NULL, type, false); return menu_shader_manager_operate_auto_preset(AUTO_SHADER_OP_REMOVE, NULL, type, false);
}
/**
* menu_shader_manager_auto_preset_exists:
* @type : type of shader preset
*
* Tests if an auto-shader of the given type exists.
**/
bool menu_shader_manager_auto_preset_exists(enum auto_shader_type type)
{
return menu_shader_manager_operate_auto_preset(AUTO_SHADER_OP_EXISTS, NULL, type, false);
} }
int menu_shader_manager_clear_num_passes(struct video_shader *shader) int menu_shader_manager_clear_num_passes(struct video_shader *shader)

View File

@ -124,6 +124,8 @@ void menu_shader_manager_clear_pass_path(struct video_shader *shader,
**/ **/
bool menu_shader_manager_remove_auto_preset(enum auto_shader_type type); bool menu_shader_manager_remove_auto_preset(enum auto_shader_type type);
bool menu_shader_manager_auto_preset_exists(enum auto_shader_type type);
void menu_shader_set_modified(bool modified); void menu_shader_set_modified(bool modified);
RETRO_END_DECLS RETRO_END_DECLS

View File

@ -1336,6 +1336,7 @@ enum msg_hash_enums
MENU_LABEL(LOAD_CONTENT_LIST), MENU_LABEL(LOAD_CONTENT_LIST),
MENU_LABEL(LOAD_CONTENT_SPECIAL), MENU_LABEL(LOAD_CONTENT_SPECIAL),
MENU_LABEL(NO_SETTINGS_FOUND), MENU_LABEL(NO_SETTINGS_FOUND),
MENU_LABEL(NO_PRESETS_FOUND),
MENU_LABEL(NO_NETWORKS_FOUND), MENU_LABEL(NO_NETWORKS_FOUND),
MENU_LABEL(NO_PERFORMANCE_COUNTERS), MENU_LABEL(NO_PERFORMANCE_COUNTERS),
MENU_LABEL(FRAME_THROTTLE_SETTINGS), MENU_LABEL(FRAME_THROTTLE_SETTINGS),
@ -2396,6 +2397,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_QT_LOAD, MENU_ENUM_LABEL_VALUE_QT_LOAD,
MENU_ENUM_LABEL_VALUE_QT_SAVE, MENU_ENUM_LABEL_VALUE_QT_SAVE,
MENU_ENUM_LABEL_VALUE_QT_REMOVE, MENU_ENUM_LABEL_VALUE_QT_REMOVE,
MENU_ENUM_LABEL_VALUE_QT_REMOVE_PASSES,
MENU_ENUM_LABEL_VALUE_QT_APPLY, MENU_ENUM_LABEL_VALUE_QT_APPLY,
MENU_ENUM_LABEL_VALUE_QT_SHADER_ADD_PASS, MENU_ENUM_LABEL_VALUE_QT_SHADER_ADD_PASS,
MENU_ENUM_LABEL_VALUE_QT_SHADER_CLEAR_ALL_PASSES, MENU_ENUM_LABEL_VALUE_QT_SHADER_CLEAR_ALL_PASSES,

View File

@ -2222,10 +2222,12 @@ bool retroarch_apply_shader(enum rarch_shader_type type, const char *preset_path
configuration_set_bool(settings, settings->bools.video_shader_enable, true); configuration_set_bool(settings, settings->bools.video_shader_enable, true);
retroarch_set_runtime_shader_preset(preset_path); retroarch_set_runtime_shader_preset(preset_path);
#ifdef HAVE_MENU
/* reflect in shader manager */ /* reflect in shader manager */
if (menu_shader_manager_set_preset(menu_shader_get(), type, preset_path, false)) if (menu_shader_manager_set_preset(menu_shader_get(), type, preset_path, false))
if (!string_is_empty(preset_path)) if (!string_is_empty(preset_path))
menu_shader_set_modified(false); menu_shader_set_modified(false);
#endif
/* Display message */ /* Display message */
snprintf(msg, sizeof(msg), snprintf(msg, sizeof(msg),

View File

@ -18,6 +18,7 @@
#include "shaderparamsdialog.h" #include "shaderparamsdialog.h"
#include "../ui_qt.h" #include "../ui_qt.h"
#include "../../../menu/menu_entries.h"
#ifndef CXX_BUILD #ifndef CXX_BUILD
extern "C" { extern "C" {
@ -51,11 +52,11 @@ extern "C" {
enum enum
{ {
SHADER_PRESET_SAVE_GLOBAL = 0, QT_SHADER_PRESET_GLOBAL = 0,
SHADER_PRESET_SAVE_CORE, QT_SHADER_PRESET_CORE,
SHADER_PRESET_SAVE_PARENT, QT_SHADER_PRESET_PARENT,
SHADER_PRESET_SAVE_GAME, QT_SHADER_PRESET_GAME,
SHADER_PRESET_SAVE_NORMAL QT_SHADER_PRESET_NORMAL
}; };
ShaderPass::ShaderPass(struct video_shader_pass *passToCopy) : ShaderPass::ShaderPass(struct video_shader_pass *passToCopy) :
@ -688,35 +689,38 @@ void ShaderParamsDialog::onShaderSavePresetAsClicked()
pathArray = path.toUtf8(); pathArray = path.toUtf8();
pathData = pathArray.constData(); pathData = pathArray.constData();
saveShaderPreset(pathData, SHADER_PRESET_SAVE_NORMAL); operateShaderPreset(true, pathData, QT_SHADER_PRESET_NORMAL);
} }
void ShaderParamsDialog::saveShaderPreset(const char *path, unsigned action_type) /** save or remove shader preset */
void ShaderParamsDialog::operateShaderPreset(bool save, const char *path, unsigned action_type)
{ {
bool ret; bool ret;
enum auto_shader_type preset_type; enum auto_shader_type preset_type;
switch (action_type) switch (action_type)
{ {
case SHADER_PRESET_SAVE_GLOBAL: case QT_SHADER_PRESET_GLOBAL:
preset_type = SHADER_PRESET_GLOBAL; preset_type = SHADER_PRESET_GLOBAL;
break; break;
case SHADER_PRESET_SAVE_CORE: case QT_SHADER_PRESET_CORE:
preset_type = SHADER_PRESET_CORE;
break;
case QT_SHADER_PRESET_PARENT:
preset_type = SHADER_PRESET_PARENT; preset_type = SHADER_PRESET_PARENT;
break; break;
case SHADER_PRESET_SAVE_PARENT: case QT_SHADER_PRESET_GAME:
preset_type = SHADER_PRESET_PARENT;
break;
case SHADER_PRESET_SAVE_GAME:
preset_type = SHADER_PRESET_GAME; preset_type = SHADER_PRESET_GAME;
break; break;
case SHADER_PRESET_SAVE_NORMAL: case QT_SHADER_PRESET_NORMAL:
break; break;
default: default:
return; return;
} }
if (action_type == SHADER_PRESET_SAVE_NORMAL) if (save)
{
if (action_type == QT_SHADER_PRESET_NORMAL)
ret = menu_shader_manager_save_preset(menu_shader_get(), path, true); ret = menu_shader_manager_save_preset(menu_shader_get(), path, true);
else else
ret = menu_shader_manager_save_auto_preset(menu_shader_get(), preset_type, true); ret = menu_shader_manager_save_auto_preset(menu_shader_get(), preset_type, true);
@ -736,28 +740,77 @@ void ShaderParamsDialog::saveShaderPreset(const char *path, unsigned action_type
MESSAGE_QUEUE_CATEGORY_ERROR MESSAGE_QUEUE_CATEGORY_ERROR
); );
} }
else
{
if (action_type != QT_SHADER_PRESET_NORMAL &&
menu_shader_manager_remove_auto_preset(preset_type))
{
#ifdef HAVE_MENU
bool refresh = false;
#endif
runloop_msg_queue_push(
msg_hash_to_str(MSG_SHADER_PRESET_REMOVED_SUCCESSFULLY),
1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO
);
#ifdef HAVE_MENU
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
#endif
}
else
runloop_msg_queue_push(
msg_hash_to_str(MSG_ERROR_REMOVING_SHADER_PRESET),
1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_ERROR
);
}
}
void ShaderParamsDialog::onShaderSaveGlobalPresetClicked() void ShaderParamsDialog::onShaderSaveGlobalPresetClicked()
{ {
saveShaderPreset(NULL, SHADER_PRESET_GLOBAL); operateShaderPreset(true, NULL, QT_SHADER_PRESET_GLOBAL);
} }
void ShaderParamsDialog::onShaderSaveCorePresetClicked() void ShaderParamsDialog::onShaderSaveCorePresetClicked()
{ {
saveShaderPreset(NULL, SHADER_PRESET_CORE); operateShaderPreset(true, NULL, QT_SHADER_PRESET_CORE);
} }
void ShaderParamsDialog::onShaderSaveParentPresetClicked() void ShaderParamsDialog::onShaderSaveParentPresetClicked()
{ {
saveShaderPreset(NULL, SHADER_PRESET_PARENT); operateShaderPreset(true, NULL, QT_SHADER_PRESET_PARENT);
} }
void ShaderParamsDialog::onShaderSaveGamePresetClicked() void ShaderParamsDialog::onShaderSaveGamePresetClicked()
{ {
saveShaderPreset(NULL, SHADER_PRESET_GAME); operateShaderPreset(true, NULL, QT_SHADER_PRESET_GAME);
} }
void ShaderParamsDialog::onShaderClearAllPassesClicked() void ShaderParamsDialog::onShaderRemoveGlobalPresetClicked()
{
operateShaderPreset(false, NULL, QT_SHADER_PRESET_GLOBAL);
}
void ShaderParamsDialog::onShaderRemoveCorePresetClicked()
{
operateShaderPreset(false, NULL, QT_SHADER_PRESET_CORE);
}
void ShaderParamsDialog::onShaderRemoveParentPresetClicked()
{
operateShaderPreset(false, NULL, QT_SHADER_PRESET_PARENT);
}
void ShaderParamsDialog::onShaderRemoveGamePresetClicked()
{
operateShaderPreset(false, NULL, QT_SHADER_PRESET_GAME);
}
void ShaderParamsDialog::onShaderRemoveAllPassesClicked()
{ {
struct video_shader *menu_shader = NULL; struct video_shader *menu_shader = NULL;
struct video_shader *video_shader = NULL; struct video_shader *video_shader = NULL;
@ -776,19 +829,13 @@ void ShaderParamsDialog::onShaderClearAllPassesClicked()
void ShaderParamsDialog::onShaderRemovePassClicked() void ShaderParamsDialog::onShaderRemovePassClicked()
{ {
int i;
QVariant passVariant; QVariant passVariant;
QAction *action = qobject_cast<QAction*>(sender()); QAction *action = qobject_cast<QAction*>(sender());
struct video_shader *menu_shader = NULL;
struct video_shader *video_shader = NULL;
int pass = 0; int pass = 0;
bool ok = false; bool ok = false;
getShaders(&menu_shader, &video_shader); if (!action)
if (!menu_shader || menu_shader->passes == 0 || !action)
return; return;
passVariant = action->data(); passVariant = action->data();
if (!passVariant.isValid()) if (!passVariant.isValid())
@ -799,6 +846,20 @@ void ShaderParamsDialog::onShaderRemovePassClicked()
if (!ok) if (!ok)
return; return;
onShaderRemovePass(pass);
}
void ShaderParamsDialog::onShaderRemovePass(int pass)
{
int i;
struct video_shader *menu_shader = NULL;
struct video_shader *video_shader = NULL;
getShaders(&menu_shader, &video_shader);
if (!menu_shader || menu_shader->passes == 0)
return;
if (pass < 0 || pass > static_cast<int>(menu_shader->passes)) if (pass < 0 || pass > static_cast<int>(menu_shader->passes))
return; return;
@ -818,6 +879,18 @@ void ShaderParamsDialog::onShaderApplyClicked()
command_event(CMD_EVENT_SHADERS_APPLY_CHANGES, NULL); command_event(CMD_EVENT_SHADERS_APPLY_CHANGES, NULL);
} }
void ShaderParamsDialog::updateRemovePresetButtonsState()
{
if (removeGlobalPresetAction)
removeGlobalPresetAction->setEnabled(menu_shader_manager_auto_preset_exists(SHADER_PRESET_GLOBAL));
if (removeCorePresetAction)
removeCorePresetAction->setEnabled(menu_shader_manager_auto_preset_exists(SHADER_PRESET_CORE));
if (removeParentPresetAction)
removeParentPresetAction->setEnabled(menu_shader_manager_auto_preset_exists(SHADER_PRESET_PARENT));
if (removeGamePresetAction)
removeGamePresetAction->setEnabled(menu_shader_manager_auto_preset_exists(SHADER_PRESET_GAME));
}
void ShaderParamsDialog::reload() void ShaderParamsDialog::reload()
{ {
buildLayout(); buildLayout();
@ -828,11 +901,13 @@ void ShaderParamsDialog::buildLayout()
QPushButton *loadButton = NULL; QPushButton *loadButton = NULL;
QPushButton *saveButton = NULL; QPushButton *saveButton = NULL;
QPushButton *removeButton = NULL; QPushButton *removeButton = NULL;
QPushButton *removePassButton = NULL;
QPushButton *applyButton = NULL; QPushButton *applyButton = NULL;
QHBoxLayout *topButtonLayout = NULL; QHBoxLayout *topButtonLayout = NULL;
QMenu *loadMenu = NULL; QMenu *loadMenu = NULL;
QMenu *saveMenu = NULL; QMenu *saveMenu = NULL;
QMenu *removeMenu = NULL; QMenu *removeMenu = NULL;
QMenu *removePassMenu = NULL;
struct video_shader *menu_shader = NULL; struct video_shader *menu_shader = NULL;
struct video_shader *video_shader = NULL; struct video_shader *video_shader = NULL;
struct video_shader *avail_shader = NULL; struct video_shader *avail_shader = NULL;
@ -905,6 +980,7 @@ void ShaderParamsDialog::buildLayout()
loadButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_LOAD), this); loadButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_LOAD), this);
saveButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SAVE), this); saveButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SAVE), this);
removeButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_REMOVE), this); removeButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_REMOVE), this);
removePassButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_REMOVE_PASSES), this);
applyButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_APPLY), this); applyButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_APPLY), this);
loadMenu = new QMenu(loadButton); loadMenu = new QMenu(loadButton);
@ -923,6 +999,16 @@ void ShaderParamsDialog::buildLayout()
saveButton->setMenu(saveMenu); saveButton->setMenu(saveMenu);
removeMenu = new QMenu(removeButton); removeMenu = new QMenu(removeButton);
removeGlobalPresetAction = removeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_GLOBAL), this, SLOT(onShaderRemoveGlobalPresetClicked()));
removeCorePresetAction = removeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_CORE), this, SLOT(onShaderRemoveCorePresetClicked()));
removeParentPresetAction = removeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_PARENT), this, SLOT(onShaderRemoveParentPresetClicked()));
removeGamePresetAction = removeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_GAME), this, SLOT(onShaderRemoveGamePresetClicked()));
removeButton->setMenu(removeMenu);
connect(removeMenu, SIGNAL(aboutToShow()), this, SLOT(updateRemovePresetButtonsState()));
removePassMenu = new QMenu(removeButton);
/* When there are no passes, at least on first startup, it seems video_shader erroneously shows 1 pass, with an empty source file. /* When there are no passes, at least on first startup, it seems video_shader erroneously shows 1 pass, with an empty source file.
* So we use menu_shader instead for that. * So we use menu_shader instead for that.
@ -933,15 +1019,15 @@ void ShaderParamsDialog::buildLayout()
{ {
QFileInfo fileInfo(menu_shader->pass[i].source.path); QFileInfo fileInfo(menu_shader->pass[i].source.path);
QString shaderBasename = fileInfo.completeBaseName(); QString shaderBasename = fileInfo.completeBaseName();
QAction *action = removeMenu->addAction(shaderBasename, this, SLOT(onShaderRemovePassClicked())); QAction *action = removePassMenu->addAction(shaderBasename, this, SLOT(onShaderRemovePassClicked()));
action->setData(i); action->setData(i);
} }
} }
removeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SHADER_CLEAR_ALL_PASSES), this, SLOT(onShaderClearAllPassesClicked())); removePassMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SHADER_CLEAR_ALL_PASSES), this, SLOT(onShaderRemoveAllPassesClicked()));
removeButton->setMenu(removeMenu); removePassButton->setMenu(removePassMenu);
connect(applyButton, SIGNAL(clicked()), this, SLOT(onShaderApplyClicked())); connect(applyButton, SIGNAL(clicked()), this, SLOT(onShaderApplyClicked()));
@ -949,6 +1035,7 @@ void ShaderParamsDialog::buildLayout()
topButtonLayout->addWidget(loadButton); topButtonLayout->addWidget(loadButton);
topButtonLayout->addWidget(saveButton); topButtonLayout->addWidget(saveButton);
topButtonLayout->addWidget(removeButton); topButtonLayout->addWidget(removeButton);
topButtonLayout->addWidget(removePassButton);
topButtonLayout->addWidget(applyButton); topButtonLayout->addWidget(applyButton);
m_layout->addLayout(topButtonLayout); m_layout->addLayout(topButtonLayout);
@ -1337,6 +1424,7 @@ void ShaderParamsDialog::onShaderParamSliderValueChanged(int)
if (param) if (param)
{ {
newValue = MainWindow::lerp(0, 100, param->minimum, param->maximum, slider->value()); newValue = MainWindow::lerp(0, 100, param->minimum, param->maximum, slider->value());
newValue = round(newValue / param->step) * param->step;
param->current = newValue; param->current = newValue;
} }
} }
@ -1357,6 +1445,7 @@ void ShaderParamsDialog::onShaderParamSliderValueChanged(int)
if (param) if (param)
{ {
newValue = MainWindow::lerp(0, 100, param->minimum, param->maximum, slider->value()); newValue = MainWindow::lerp(0, 100, param->minimum, param->maximum, slider->value());
newValue = round(newValue / param->step) * param->step;
param->current = newValue; param->current = newValue;
} }
} }

View File

@ -54,6 +54,9 @@ private slots:
void onShaderPassMoveUpClicked(); void onShaderPassMoveUpClicked();
void onShaderResetPass(int pass); void onShaderResetPass(int pass);
void onShaderResetAllPasses(); void onShaderResetAllPasses();
void onShaderRemovePass(int pass);
void onShaderRemoveAllPassesClicked();
void onShaderRemovePassClicked();
void onShaderResetParameter(QString parameter); void onShaderResetParameter(QString parameter);
void onShaderLoadPresetClicked(); void onShaderLoadPresetClicked();
void onShaderAddPassClicked(); void onShaderAddPassClicked();
@ -62,19 +65,26 @@ private slots:
void onShaderSaveParentPresetClicked(); void onShaderSaveParentPresetClicked();
void onShaderSaveGamePresetClicked(); void onShaderSaveGamePresetClicked();
void onShaderSaveGlobalPresetClicked(); void onShaderSaveGlobalPresetClicked();
void onShaderClearAllPassesClicked(); void onShaderRemoveCorePresetClicked();
void onShaderRemovePassClicked(); void onShaderRemoveParentPresetClicked();
void onShaderRemoveGamePresetClicked();
void onShaderRemoveGlobalPresetClicked();
void onShaderApplyClicked(); void onShaderApplyClicked();
void updateRemovePresetButtonsState();
void clearLayout(); void clearLayout();
void buildLayout(); void buildLayout();
private: private:
QString getFilterLabel(unsigned filter); QString getFilterLabel(unsigned filter);
void addShaderParam(struct video_shader_parameter *param, QFormLayout *form); void addShaderParam(struct video_shader_parameter *param, QFormLayout *form);
void getShaders(struct video_shader **menu_shader, struct video_shader **video_shader); void getShaders(struct video_shader **menu_shader, struct video_shader **video_shader);
void saveShaderPreset(const char *path, unsigned action_type); void operateShaderPreset(bool save, const char *path, unsigned action_type);
QPointer<QVBoxLayout> m_layout; QPointer<QVBoxLayout> m_layout;
QPointer<QScrollArea> m_scrollArea; QPointer<QScrollArea> m_scrollArea;
QAction *removeGlobalPresetAction;
QAction *removeCorePresetAction;
QAction *removeParentPresetAction;
QAction *removeGamePresetAction;
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);