diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/ghb.ui | 23 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 18 | ||||
-rw-r--r-- | gtk/src/internal_defaults.xml | 2 | ||||
-rw-r--r-- | gtk/src/presets.c | 29 | ||||
-rw-r--r-- | gtk/src/resource_data.h | 34 | ||||
-rw-r--r-- | gtk/src/resources.plist | 25 |
6 files changed, 119 insertions, 12 deletions
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index ce1db677d..ba66bcb13 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -3421,6 +3421,21 @@ auto-generated destination name.</property> </packing> </child> <child> + <object class="GtkCheckButton" id="reduce_hd_preview"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text"> Automatically reduce the size of High Definition previews. +This is helpfull when working on laptops or similar +non-hidef screens. </property> + <property name="label" translatable="yes">Scale down High Definition previews</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="pref_changed_cb"/> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + <child> <object class="GtkCheckButton" id="noscale"> <property name="visible">True</property> <property name="can_focus">True</property> @@ -3434,7 +3449,7 @@ the required multiple.</property> <signal name="toggled" handler="pref_changed_cb"/> </object> <packing> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> <child> @@ -3453,7 +3468,7 @@ this setting.</property> <signal name="toggled" handler="vcodec_changed_cb"/> </object> <packing> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> <child> @@ -3464,7 +3479,7 @@ this setting.</property> <signal name="toggled" handler="tweaks_changed_cb"/> </object> <packing> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> <child> @@ -3475,7 +3490,7 @@ this setting.</property> <signal name="toggled" handler="hbfd_feature_changed_cb"/> </object> <packing> - <property name="position">5</property> + <property name="position">6</property> </packing> </child> </object> diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index b69083818..98c27dc20 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -3453,6 +3453,9 @@ ghb_pause_queue() } } +#define RED_HEIGHT 720.0 +#define RED_WIDTH 1280.0 + GdkPixbuf* ghb_get_preview_image( gint titleindex, @@ -3589,6 +3592,21 @@ ghb_get_preview_image( else dstHeight = dstHeight * par_height / par_width; } + if (ghb_settings_get_boolean(settings, "reduce_hd_preview")) + { + gdouble factor = 1.0; + + if (dstHeight > RED_HEIGHT) + { + factor = RED_HEIGHT / (gdouble)dstHeight; + } + if (dstWidth * factor > RED_WIDTH) + { + factor = RED_WIDTH / (gdouble)dstWidth; + } + dstHeight = dstHeight * factor + 0.5; + dstWidth = dstWidth * factor + 0.5; + } g_debug("scaled %d x %d\n", dstWidth, dstHeight); GdkPixbuf *scaled_preview; diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml index c445cdddf..282000051 100644 --- a/gtk/src/internal_defaults.xml +++ b/gtk/src/internal_defaults.xml @@ -98,6 +98,8 @@ <false /> <key>nocheckvquality</key> <false /> + <key>reduce_hd_preview</key> + <true /> <key>noscale</key> <false /> <key>show_presets</key> diff --git a/gtk/src/presets.c b/gtk/src/presets.c index bb5e2e70f..cfea98699 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -1723,6 +1723,7 @@ export_subtitle_xlat2(GValue *lin_val) gchar *str; GValue *gval; + if (lin_val == NULL) return NULL; str = ghb_value_string(lin_val); if (strcmp(str, "none") == 0) { @@ -1770,6 +1771,7 @@ import_subtitle_xlat2(GValue *mac_val) gchar *str; GValue *gval; + if (mac_val == NULL) return NULL; str = ghb_value_string(mac_val); if (strcmp(str, "None") == 0) { @@ -1793,6 +1795,7 @@ export_audio_track_xlat2(GValue *lin_val) gchar *str; GValue *gval = NULL; + if (lin_val == NULL) return NULL; str = ghb_value_string(lin_val); if (strcmp(str, "none") == 0) { @@ -1814,6 +1817,7 @@ import_audio_track_xlat2(GValue *mac_val) gchar *str; GValue *gval; + if (mac_val == NULL) return NULL; val = ghb_value_int(mac_val); if (val <= 0) { @@ -2323,6 +2327,25 @@ ghb_presets_reload(signal_user_data_t *ud) store_presets(); } +static gboolean +check_old_presets() +{ + gint count, ii; + + count = ghb_array_len(presetsPlist); + for (ii = count-1; ii >= 0; ii--) + { + GValue *dict; + GValue *type; + + dict = ghb_array_get_nth(presetsPlist, ii); + type = ghb_dict_lookup(dict, "Type"); + if (type == NULL) + return TRUE; + } + return FALSE; +} + void ghb_presets_load() { @@ -2338,6 +2361,12 @@ ghb_presets_load() presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets")); store_presets(); } + else if (check_old_presets()) + { + ghb_value_free(presetsPlist); + presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets")); + store_presets(); + } import_xlat_presets(presetsPlist); } diff --git a/gtk/src/resource_data.h b/gtk/src/resource_data.h index a54b4ffa1..c6f06f6f9 100644 --- a/gtk/src/resource_data.h +++ b/gtk/src/resource_data.h @@ -5620,6 +5620,30 @@ " </child>\n" " <child>\n" " <object class="GtkCheckButton" i" +"d="reduce_hd_preview">\n" +" <property name="visible">Tr" +"ue</property>\n" +" <property name="can_focus">" +"True</property>\n" +" <property name="tooltip_text"&" +"gt; Automatically reduce the size of High Definition previews.\n" +"This is helpfull when working on laptops or similar\n" +"non-hidef screens. </property>\n" +" <property name="label" transla" +"table="yes">Scale down High Definition previews</proper" +"ty>\n" +" <property name="draw_indicator"" +";>True</property>\n" +" <signal name="toggled" handler" +"="pref_changed_cb"/>\n" +" </object>\n" +" <packing>\n" +" <property name="position">2" +"</property>\n" +" </packing>\n" +" </child>\n" +" <child>\n" +" <object class="GtkCheckButton" i" "d="noscale">\n" " <property name="visible">Tr" "ue</property>\n" @@ -5639,7 +5663,7 @@ "="pref_changed_cb"/>\n" " </object>\n" " <packing>\n" -" <property name="position">2" +" <property name="position">3" "</property>\n" " </packing>\n" " </child>\n" @@ -5666,7 +5690,7 @@ "="vcodec_changed_cb"/>\n" " </object>\n" " <packing>\n" -" <property name="position">3" +" <property name="position">4" "</property>\n" " </packing>\n" " </child>\n" @@ -5683,7 +5707,7 @@ "="tweaks_changed_cb"/>\n" " </object>\n" " <packing>\n" -" <property name="position">4" +" <property name="position">5" "</property>\n" " </packing>\n" " </child>\n" @@ -5700,7 +5724,7 @@ "="hbfd_feature_changed_cb"/>\n" " </object>\n" " <packing>\n" -" <property name="position">5" +" <property name="position">6" "</property>\n" " </packing>\n" " </child>\n" @@ -10114,6 +10138,8 @@ " <false />\n" " <key>noscale</key>\n" " <false />\n" +" <key>reduce_hd_preview</key>\n" +" <true />\n" " <key>show_presets</key>\n" " <true />\n" " <key>use_source_name</key>\n" diff --git a/gtk/src/resources.plist b/gtk/src/resources.plist index 0dc6536a2..dccb730d1 100644 --- a/gtk/src/resources.plist +++ b/gtk/src/resources.plist @@ -3426,6 +3426,21 @@ auto-generated destination name.</property> </packing> </child> <child> + <object class="GtkCheckButton" id="reduce_hd_preview"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text"> Automatically reduce the size of High Definition previews. +This is helpfull when working on laptops or similar +non-hidef screens. </property> + <property name="label" translatable="yes">Scale down High Definition previews</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="pref_changed_cb"/> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + <child> <object class="GtkCheckButton" id="noscale"> <property name="visible">True</property> <property name="can_focus">True</property> @@ -3439,7 +3454,7 @@ the required multiple.</property> <signal name="toggled" handler="pref_changed_cb"/> </object> <packing> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> <child> @@ -3458,7 +3473,7 @@ this setting.</property> <signal name="toggled" handler="vcodec_changed_cb"/> </object> <packing> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> <child> @@ -3469,7 +3484,7 @@ this setting.</property> <signal name="toggled" handler="tweaks_changed_cb"/> </object> <packing> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> <child> @@ -3480,7 +3495,7 @@ this setting.</property> <signal name="toggled" handler="hbfd_feature_changed_cb"/> </object> <packing> - <property name="position">5</property> + <property name="position">6</property> </packing> </child> </object> @@ -4931,6 +4946,8 @@ R2RrUAAABBgBAQACAAAAQAAAABAAAAAQ////AP///wD///8A////AP///wD///8A////AP///wD///8A <false /> <key>noscale</key> <false /> + <key>reduce_hd_preview</key> + <true /> <key>show_presets</key> <true /> <key>use_source_name</key> |