diff options
-rw-r--r-- | gtk/src/callbacks.c | 20 | ||||
-rw-r--r-- | gtk/src/ghb.ui | 139 | ||||
-rw-r--r-- | gtk/src/settings.c | 45 | ||||
-rw-r--r-- | gtk/todo | 15 |
4 files changed, 212 insertions, 7 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 9bd155822..a071674b3 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -1851,6 +1851,18 @@ presets_save_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) } void +prefs_dialog_cb(GtkWidget *xwidget, signal_user_data_t *ud) +{ + GtkWidget *dialog; + GtkResponseType response; + + g_debug("prefs_dialog_cb ()\n"); + dialog = GHB_WIDGET(ud->builder, "prefs_dialog"); + response = gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_hide(dialog); +} + +void presets_remove_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) { GtkTreeView *treeview; @@ -3190,6 +3202,14 @@ hbfd_toggled_cb(GtkWidget *widget, signal_user_data_t *ud) } void +pref_changed_cb(GtkWidget *widget, signal_user_data_t *ud) +{ + g_debug("pref_changed_cb\n"); + ghb_widget_to_setting (ud->settings, widget); + ghb_prefs_save(ud->settings); +} + +void ghb_file_menu_add_dvd(signal_user_data_t *ud) { GList *link, *drives; diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index 4602e21cd..cafbd0829 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -179,6 +179,13 @@ </object> </child> <child> + <object class="GtkAction" id="preferences"> + <property name="stock_id">gtk-preferences</property> + <property name="name">preferences</property> + <signal handler="prefs_dialog_cb" name="activate"/> + </object> + </child> + <child> <object class="GtkAction" id="quit1"> <property name="stock_id">gtk-quit</property> <property name="name">quit1</property> @@ -292,6 +299,8 @@ <menuitem action="source1"/> <menuitem action="destination1"/> <separator/> + <menuitem action="preferences"/> + <separator/> <menuitem action="quit1"/> </menu> <menu action="menuitem2"> @@ -3544,6 +3553,136 @@ </object> </child> </object> + <object class="GtkDialog" id="prefs_dialog"> + <property name="border_width">5</property> + <property name="modal">True</property> + <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="skip_taskbar_hint">True</property> + <property name="skip_pager_hint">True</property> + <property name="has_separator">False</property> + <signal handler="gtk_widget_hide_on_delete" name="delete_event"/> + <child internal-child="vbox"> + <object class="GtkVBox" id="dialog-vbox6"> + <property name="visible">True</property> + <property name="spacing">2</property> + <child> + <object class="GtkFrame" id="frame16"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">GTK_SHADOW_ETCHED_OUT</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="left_padding">12</property> + <child> + <object class="GtkVBox" id="vbox29"> + <property name="visible">True</property> + <child> + <object class="GtkCheckButton" id="use_source_name"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip-text" translatable="yes">The destination filename will be automatically +generated from the source filename or volume +label.</property> + <property name="label" translatable="yes">Derive destination name from source</property> + <property name="draw_indicator">True</property> + <signal handler="pref_changed_cb" name="toggled"/> + </object> + </child> + <child> + <object class="GtkCheckButton" id="linear_vquality"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip-text" translatable="yes">x264 uses a different scale for video quality than +other codecs. This adjusts the scale so that +similar values give similar quality across all the +video codecs.</property> + <property name="label" translatable="yes">Adjust x264 video quality scale</property> + <property name="draw_indicator">True</property> + <signal handler="pref_changed_cb" name="toggled"/> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="noscale"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip-text" translatable="yes">When picture settings require that the image +dimensions be rounded to some multiple number +of pixels. This setting will crop a few extra pixels +instead of doing exact cropping and scaling to +the required multiple.</property> + <property name="label" translatable="yes">Loose cropping</property> + <property name="draw_indicator">True</property> + <signal handler="pref_changed_cb" name="toggled"/> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="directqp"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip-text" translatable="yes">HandBrake allows entry of QP/CRF values for x264 +and FFMPEG instead of the percentage metric. +This preference is associated with the current +preset only. + +You *MUST* save the current preset to preserve +this setting.</property> + <property name="label" translatable="yes">Allow direct QP/CRF</property> + <property name="draw_indicator">True</property> + <signal handler="vcodec_changed_cb" name="toggled"/> + </object> + <packing> + <property name="position">3</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Preferences</b></property> + <property name="use_markup">True</property> + </object> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child internal-child="action_area"> + <object class="GtkHButtonBox" id="dialog-action_area6"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + <child> + <object class="GtkButton" id="pref_ok"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="label" translatable="yes">gtk-ok</property> + <property name="use_stock">True</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="-5">pref_ok</action-widget> + </action-widgets> + </object> <object class="GtkDialog" id="preset_save_dialog"> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="border_width">5</property> diff --git a/gtk/src/settings.c b/gtk/src/settings.c index 619ad7d45..eced5a607 100644 --- a/gtk/src/settings.c +++ b/gtk/src/settings.c @@ -1183,6 +1183,8 @@ ghb_prefs_to_ui(signal_user_data_t *ud) g_free(path); } +static gboolean prefs_initializing = FALSE; + void ghb_prefs_save(GHashTable *settings) { @@ -1191,6 +1193,7 @@ ghb_prefs_save(GHashTable *settings) gchar **keys; gsize length; + if (prefs_initializing) return; keys = g_key_file_get_keys(internalKeyFile, "Preferences", &length, NULL); if (keys != NULL) { @@ -1208,6 +1211,40 @@ ghb_prefs_save(GHashTable *settings) } void +dump_key_file(GKeyFile *keyFile, const gchar *section) +{ + gint ii; + gchar **keys; + gsize length; + + // Get defaults from internal defaults + keys = g_key_file_get_keys(keyFile, section, &length, NULL); + if (keys != NULL) + { + for (ii = 0; keys[ii] != NULL; ii++) + { + gchar *str; + + str = g_key_file_get_string(keyFile, section, keys[ii], NULL); + if (str != NULL) + { + g_message("Preference: key (%s) -- str (%s)\n", keys[ii], str); + g_free(str); + } + else + { + g_message("Preference: key (%s) -- str **none**\n", keys[ii]); + } + } + g_strfreev(keys); + } + else + { + g_message("no keys"); + } +} + +void ghb_prefs_load(signal_user_data_t *ud) { gint ii; @@ -1218,6 +1255,7 @@ ghb_prefs_load(signal_user_data_t *ud) gsize length; gboolean res; + prefs_initializing = TRUE; internalKeyFile = g_key_file_new(); res = g_key_file_load_from_data( internalKeyFile, defaultSettings, sizeof(defaultSettings), G_KEY_FILE_NONE, NULL); @@ -1251,6 +1289,7 @@ ghb_prefs_load(signal_user_data_t *ud) { g_key_file_load_from_file( prefsKeyFile, config, G_KEY_FILE_KEEP_COMMENTS, NULL); } +dump_key_file(prefsKeyFile, "Preferences"); value = g_key_file_get_value(prefsKeyFile, "Preferences", "version", NULL); if (value == NULL) { @@ -1269,6 +1308,7 @@ ghb_prefs_load(signal_user_data_t *ud) { g_debug("Preference: key (%s) -- str (%s)\n", keys[ii], str); g_key_file_set_value(prefsKeyFile, "Preferences", keys[ii], str); +g_message("default key (%s) str (%s)", keys[ii], str); g_free(str); } } @@ -1279,15 +1319,18 @@ ghb_prefs_load(signal_user_data_t *ud) store_key_file(prefsKeyFile, "preferences"); } g_free(config); +dump_key_file(prefsKeyFile, "Preferences"); keys = g_key_file_get_keys(internalKeyFile, "Preferences", &length, NULL); if (keys != NULL) { for (ii = 0; keys[ii] != NULL; ii++) { value = g_key_file_get_value(prefsKeyFile, "Preferences", keys[ii], NULL); +g_message("key (%s) value (%s)", keys[ii], value); if (value != NULL) { ghb_settings_set_string(ud->settings, keys[ii], value); + ghb_ui_update(ud, keys[ii], value); g_free(value); } else @@ -1296,6 +1339,7 @@ ghb_prefs_load(signal_user_data_t *ud) if (value != NULL) { ghb_settings_set_string(ud->settings, keys[ii], value); + ghb_ui_update(ud, keys[ii], value); g_free(value); } } @@ -1316,6 +1360,7 @@ ghb_prefs_load(signal_user_data_t *ud) { ghb_ui_update_int(ud, "hbfd", 0); } + prefs_initializing = FALSE; } void @@ -22,10 +22,6 @@ X - theora not allowed in mp4 files. X - mp4 faac and ac3 X - avi lame and ac3 X - ogm vorbis and lame (not ac3?) -P - submitted patch - move vfr to video tab? -P - submitted patch - ffmpeg loose ana trunc patch -P - submitted patch - job cancel patch -P - submitted patch - preview correption padding patch X - when vfr selected, force framerate conbo to same as source X - chapters - after edit, <CR> should start editing next chapter name X - add decomb option to picture cleanup @@ -51,10 +47,15 @@ X - make selected audio red if not same as combo's. instead, I eliminated now updates as you change the combo boxes. Add creates a new entry in the list with the current settings. i.e. you start with a duplicate of the current selection. -clean up hb.XXXXX turds in /tmp. it seems many linux distros don't clean -/tmp so this shite piles up. +X - submitted patch - ffmpeg loose ana trunc patch +X - clean up hb.XXXXX turds in /tmp. it seems many linux distros don't clean + /tmp so this shite piles up. +X - add detailed help. added link to HandBrake Guide +X - add preferences dialog to give access to some settings add ability to delete builtin presets and restore them add ability to drag-n-drop presets to reorder them -add detailed help force m4v when x264+ac3+mp4 preview using vlc? +move vfr to video tab? +P - submitted patch - job cancel patch +P - submitted patch - preview correption padding patch |