diff options
author | John Stebbins <[email protected]> | 2016-10-31 09:32:22 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2016-10-31 09:33:22 -0700 |
commit | 0a913f088db821b964edfd5a711292cc6069cfa9 (patch) | |
tree | 5687a5f7e6134382ee927ef85f2a7a283a7aa091 /gtk | |
parent | 7fbb66885176a26dd13319e39a6bf083144eff12 (diff) |
LinGui: fix custom filter tooltips
Make them reflect the "key=value" format change we made to custom filter
settings.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/callbacks.c | 12 | ||||
-rw-r--r-- | gtk/src/ghb.m4 | 2 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 64 | ||||
-rw-r--r-- | gtk/src/hb-backend.h | 3 | ||||
-rw-r--r-- | gtk/src/main.c | 5 |
5 files changed, 84 insertions, 2 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 9183e0cb8..372d20280 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -2167,6 +2167,18 @@ deint_filter_changed_cb(GtkWidget *widget, signal_user_data_t *ud) } G_MODULE_EXPORT void +denoise_filter_changed_cb(GtkWidget *widget, signal_user_data_t *ud) +{ + ghb_widget_to_setting(ud->settings, widget); + ghb_check_dependency(ud, widget, NULL); + ghb_clear_presets_selection(ud); + ghb_live_reset(ud); + ghb_update_ui_combo_box(ud, "PictureDenoisePreset", NULL, FALSE); + ghb_ui_update(ud, "PictureDenoisePreset", + ghb_dict_get(ud->settings, "PictureDenoisePreset")); +} + +G_MODULE_EXPORT void title_angle_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { ghb_widget_to_setting(ud->settings, widget); diff --git a/gtk/src/ghb.m4 b/gtk/src/ghb.m4 index 7b32b7bd2..3d0f2f642 100644 --- a/gtk/src/ghb.m4 +++ b/gtk/src/ghb.m4 @@ -3206,7 +3206,7 @@ filter_output([ <property name="tooltip_text" translatable="yes">Denoise filtering reduces or removes the appearance of noise and grain. Film grain and other types of high frequency noise are difficult to compress. Using this filter on such sources can result in smaller file sizes.</property> - <signal name="changed" handler="setting_widget_changed_cb" swapped="no"/> + <signal name="changed" handler="denoise_filter_changed_cb" swapped="no"/> </object> <packing> <property name="top_attach">1</property> diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 9d4826423..a88afec50 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -23,6 +23,7 @@ #define _GNU_SOURCE #include <limits.h> +#include <ctype.h> #include <math.h> #include "hb.h" #include "ghbcompat.h" @@ -436,6 +437,8 @@ static void filter_opts_set(signal_user_data_t *ud, const gchar *name, void *opts, const void* data); static void deint_opts_set(signal_user_data_t *ud, const gchar *name, void *vopts, const void* data); +static void denoise_opts_set(signal_user_data_t *ud, const gchar *name, + void *vopts, const void* data); static GhbValue * generic_opt_get(const char *name, const void *opts, const GhbValue *gval, GhbType type); @@ -543,7 +546,7 @@ combo_name_map_t combo_name_map[] = { "PictureDenoisePreset", &nlmeans_preset_opts, - filter_opts_set, + denoise_opts_set, filter_opt_get }, { @@ -2553,6 +2556,24 @@ deint_opts_set(signal_user_data_t *ud, const gchar *name, opts->filter_id = ghb_settings_combo_int(ud->settings, "PictureDeinterlaceFilter"); filter_opts_set2(ud, name, opts->filter_id, opts->preset); + + ghb_set_custom_filter_tooltip(ud, "PictureDeinterlaceCustom", + "deinterlace", opts->filter_id); +} + +static void +denoise_opts_set(signal_user_data_t *ud, const gchar *name, + void *vopts, const void* data) +{ + (void)data; // Silence "unused variable" warning + + filter_opts_t *opts = (filter_opts_t*)vopts; + opts->filter_id = ghb_settings_combo_int(ud->settings, + "PictureDenoiseFilter"); + filter_opts_set2(ud, name, opts->filter_id, opts->preset); + + ghb_set_custom_filter_tooltip(ud, "PictureDenoiseCustom", + "denoise", opts->filter_id); } combo_name_map_t* @@ -3748,6 +3769,47 @@ ghb_lookup_filter_name(int filter_id, const char *short_name, int preset) return NULL; } +void +ghb_set_custom_filter_tooltip(signal_user_data_t *ud, + const char *name, const char * desc, + int filter_id) +{ + char ** keys = hb_filter_get_keys(filter_id); + char * colon = "", * newline; + char tooltip[1024]; + int ii, linelen = 0, pos = 0; + + if (keys == NULL) + { + // Filter not set + return; + } + pos += snprintf(tooltip + pos, 1024 - pos, + "Custom %s filter string format:\n\n", desc); + for (ii = 0; keys[ii] != NULL && pos < 1024; ii++) + { + int c = tolower(keys[ii][0]); + int len = strlen(keys[ii]) + 3; + if (linelen + len > 60) + { + newline = "\n"; + linelen = 0; + } + else + { + newline = ""; + } + pos += snprintf(tooltip + pos, 1024 - pos, "%s%s%s=%c", + colon, newline, keys[ii], c); + linelen += len; + colon = ":"; + } + hb_str_vfree(keys); + + GtkWidget *widget = GHB_WIDGET(ud->builder, name); + gtk_widget_set_tooltip_text(widget, tooltip); +} + gboolean ghb_validate_filters(GhbValue *settings, GtkWindow *parent) { diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h index 050b6e118..f50d703de 100644 --- a/gtk/src/hb-backend.h +++ b/gtk/src/hb-backend.h @@ -154,6 +154,9 @@ gboolean ghb_validate_vquality(GhbValue *settings); gboolean ghb_validate_audio(GhbValue *settings, GtkWindow *parent); gboolean ghb_validate_subtitles(GhbValue *settings, GtkWindow *parent); gboolean ghb_validate_video(GhbValue *settings, GtkWindow *parent); +void ghb_set_custom_filter_tooltip(signal_user_data_t *ud, + const char *name, const char * desc, + int filter_id); gboolean ghb_validate_filters(GhbValue *settings, GtkWindow *parent); void ghb_hb_cleanup(gboolean partial); gint ghb_lookup_combo_int(const gchar *name, const GhbValue *gval); diff --git a/gtk/src/main.c b/gtk/src/main.c index 399fce303..c8b087b58 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -1202,6 +1202,11 @@ main(int argc, char *argv[]) gtk_window_resize(GTK_WINDOW(ghb_window), window_width, window_height); + ghb_set_custom_filter_tooltip(ud, "PictureDetelecineCustom", + "detelecine", HB_FILTER_DETELECINE); + ghb_set_custom_filter_tooltip(ud, "PictureCombDetectCustom", + "interlace detection", HB_FILTER_DETELECINE); + gtk_widget_show(ghb_window); // Everything should be go-to-go. Lets rock! |