Qt: set shader dialog title to current preset/shader name

This commit is contained in:
Brad Parker 2018-08-18 12:39:17 -04:00
parent 90efa02718
commit e4834250b9
3 changed files with 19 additions and 0 deletions

View File

@ -748,6 +748,8 @@ bool video_shader_read_conf_cgp(config_file_t *conf,
shader->passes = MIN(shaders, GFX_MAX_SHADERS); shader->passes = MIN(shaders, GFX_MAX_SHADERS);
attr.i = 0; attr.i = 0;
strlcpy(shader->path, conf->path, sizeof(shader->path));
if (settings->bools.video_shader_watch_files) if (settings->bools.video_shader_watch_files)
{ {
if (file_change_data) if (file_change_data)

View File

@ -147,6 +147,7 @@ struct video_shader
char prefix[64]; char prefix[64];
char script_class[512]; char script_class[512];
char script_path[PATH_MAX_LENGTH]; char script_path[PATH_MAX_LENGTH];
char path[PATH_MAX_LENGTH];
char *script; /* Dynamically allocated. Must be free'd. Only used by XML. */ char *script; /* Dynamically allocated. Must be free'd. Only used by XML. */
bool modern; /* Only used for XML shaders. */ bool modern; /* Only used for XML shaders. */

View File

@ -14,6 +14,7 @@
#include "../ui_qt.h" #include "../ui_qt.h"
extern "C" { extern "C" {
#include <string/stdstring.h>
#include "../../../command.h" #include "../../../command.h"
#ifdef HAVE_MENU #ifdef HAVE_MENU
#include "../../../menu/menu_shader.h" #include "../../../menu/menu_shader.h"
@ -284,6 +285,7 @@ void ShaderParamsDialog::reload()
{ {
struct video_shader *menu_shader = NULL; struct video_shader *menu_shader = NULL;
struct video_shader *video_shader = NULL; struct video_shader *video_shader = NULL;
const char *shader_path = NULL;
int i; int i;
unsigned j; unsigned j;
@ -295,10 +297,24 @@ void ShaderParamsDialog::reload()
*/ */
if ((video_shader && video_shader->passes == 0) || !video_shader) if ((video_shader && video_shader->passes == 0) || !video_shader)
{
setWindowTitle(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER_OPTIONS));
goto end; goto end;
}
clearLayout(m_layout); clearLayout(m_layout);
/* Only check video_shader for the path, menu_shader seems stale... e.g. if you remove all the shader passes,
* it still has the old path in it, but video_shader does not
*/
if (!string_is_empty(video_shader->path))
{
shader_path = video_shader->path;
setWindowTitle(QFileInfo(shader_path).completeBaseName());
}
else
setWindowTitle(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER_OPTIONS));
/* NOTE: We assume that parameters are always grouped in order by the pass number, e.g., all parameters for pass 0 come first, then params for pass 1, etc. */ /* NOTE: We assume that parameters are always grouped in order by the pass number, e.g., all parameters for pass 0 come first, then params for pass 1, etc. */
for (i = 0; i < static_cast<int>(video_shader->passes); i++) for (i = 0; i < static_cast<int>(video_shader->passes); i++)
{ {