]> granicus.if.org Git - handbrake/commitdiff
LinGui: remove "Reset All Titles" button
authorJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 20 Dec 2017 17:53:43 +0000 (09:53 -0800)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 20 Dec 2017 17:53:43 +0000 (09:53 -0800)
Replace with a preference option that synchronizes all title settings by
default.  This makes the linux gui behaviour consistant with the other
guis by default.  Titles can have independent settings by unchecking the
preference option.

gtk/src/callbacks.c
gtk/src/callbacks.h
gtk/src/ghb.m4
gtk/src/internal_defaults.json
gtk/src/presets.c
gtk/src/queuehandler.c

index b7597e545aaacb3f02795b61e6b367489fca7b08..a02751a06f945f0a41acdee8f569be926dba9c21 100644 (file)
@@ -2157,7 +2157,7 @@ ghb_update_summary_info(signal_user_data_t *ud)
 }
 
 void
-set_title_settings(signal_user_data_t *ud, GhbValue *settings)
+ghb_set_title_settings(signal_user_data_t *ud, GhbValue *settings)
 {
     int title_id, titleindex;
     const hb_title_t * title;
@@ -2285,13 +2285,12 @@ set_title_settings(signal_user_data_t *ud, GhbValue *settings)
     g_free(dest);
 
     ghb_dict_set_int(settings, "preview_frame", 2);
-    ghb_update_summary_info(ud);
 }
 
 void
 ghb_set_current_title_settings(signal_user_data_t *ud)
 {
-    set_title_settings(ud, ud->settings);
+    ghb_set_title_settings(ud, ud->settings);
     ghb_update_summary_info(ud);
 }
 
@@ -2323,7 +2322,7 @@ load_all_titles(signal_user_data_t *ud, int titleindex)
 
         title = hb_list_item(list, ii);
         ghb_dict_set_int(settings, "title", title ? title->index : -1);
-        set_title_settings(ud, settings);
+        ghb_set_title_settings(ud, settings);
         ghb_array_append(settings_array, settings);
     }
     if (titleindex < 0 || titleindex >= count)
@@ -2350,6 +2349,17 @@ title_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
 
     count = ghb_array_len(ud->settings_array);
     int idx = (titleindex >= 0 && titleindex < count) ? titleindex : 0;
+    if (ghb_dict_get_bool(ud->prefs, "SyncTitleSettings"))
+    {
+        GhbValue * preset   = ghb_settings_to_preset(ud->settings);
+        GhbValue * settings = ghb_array_get(ud->settings_array, idx);
+        if (preset != NULL)
+        {
+            ghb_preset_to_settings(settings, preset);
+            ghb_set_title_settings(ud, settings);
+        }
+        ghb_value_free(&preset);
+    }
     ud->settings = ghb_array_get(ud->settings_array, idx);
     ghb_load_settings(ud);
 
@@ -2370,19 +2380,7 @@ title_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
 
         ghb_reset_preview_image(ud);
     }
-}
-
-G_MODULE_EXPORT void
-title_reset_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
-{
-    int title_id, titleindex;
-    const hb_title_t *title;
-
-    title_id = ghb_dict_get_int(ud->settings, "title");
-    title = ghb_lookup_title(title_id, &titleindex);
-    (void)title; // Silence "unused variable" warning
-    load_all_titles(ud, titleindex);
-    ghb_load_settings(ud);
+    ghb_update_summary_info(ud);
 }
 
 G_MODULE_EXPORT void
index 7e0b1b886b0b9d80baa817efcda308349eacbca4..e12c5231825d800d40e29f595242ae510f906d5a 100644 (file)
@@ -90,6 +90,7 @@ void ghb_scale_configure(signal_user_data_t *ud, char *name, double val,
                          double min, double max, double step, double page,
                          int digits, gboolean inverted);
 void ghb_update_summary_info(signal_user_data_t *ud);
+void ghb_set_title_settings(signal_user_data_t *ud, GhbValue *settings);
 
 #endif // _CALLBACKS_H_
 
index 8dd772da961ee8061054b429107bb41b0a5c7db7..f2b46bcf279913c0b2daf522874d37c9aa9c4b70 100644 (file)
@@ -1371,22 +1371,6 @@ This is often the feature title of a DVD.</property>
                         <property name="position">2</property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtkButton" id="title_reset">
-                        <property name="label" translatable="yes">Reset All Titles</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="tooltip_text" translatable="yes">Apply current settings to all titles</property>
-                        <property name="receives_default">True</property>
-                        <property name="halign">end</property>
-                        <signal name="clicked" handler="title_reset_clicked_cb" swapped="no"/>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">3</property>
-                      </packing>
-                    </child>
                   </object>
                   <packing>
                     <property name="top_attach">0</property>
@@ -8076,6 +8060,27 @@ Check this if you want the queue to clean itself up by deleting completed jobs.<
                             <property name="height">1</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkCheckButton" id="SyncTitleSettings">
+                            <property name="label" translatable="yes">Use the same settings for all titles in a batch</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="tooltip_text" translatable="yes">When checked, every title will use the same settings when adding a
+batch of titles to the queue.
+
+Uncheck this if you want to allow changing each title's settings independently.</property>
+                            <property name="halign">start</property>
+                            <property name="draw_indicator">True</property>
+                            <signal name="toggled" handler="pref_changed_cb" swapped="no"/>
+                          </object>
+                          <packing>
+                            <property name="top_attach">8</property>
+                            <property name="left_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
index 77a5df2c33c5d831c7af04e796047df4a51d046f..3f3f959912c2d3933a84376d6e5a1fa866fcf852 100644 (file)
@@ -73,6 +73,7 @@
         "DiskFreeCheck": true,
         "DiskFreeLimit": 10000,
         "RemoveFinishedJobs": false,
+        "SyncTitleSettings": true,
         "HideAdvancedVideoSettings": true,
         "AutoScan": false,
         "AddCC": false,
index 89e6cb8f26a6ab9c1de1f5043d67b7d770fd3750..9a650e3de956fa1c41dad783ffaf04dddb008758 100644 (file)
@@ -1612,6 +1612,7 @@ ghb_settings_to_preset(GhbValue *settings)
 
     gboolean autoscale, br, constant;
 
+    ghb_dict_remove(preset, "title");
     ghb_dict_set_bool(preset, "Default", 0);
     ghb_dict_set_int(preset, "Type", HB_PRESET_TYPE_CUSTOM);
     if (!ghb_dict_get_bool(preset, "PictureWidthEnable"))
index 09c6e74e40c32062448fa2b06d31add97e361ef2..5778ee48615f95cc3449af84a4359a1f023b0629 100644 (file)
@@ -1837,9 +1837,15 @@ queue_add_all_action_cb(GSimpleAction *action, GVariant *param,
     GtkWidget *row;
     gint count, ii;
     int max_title_len = 0;
+    GhbValue * preset = NULL;
 
     list = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "title_add_multiple_list"));
 
+    if (ghb_dict_get_bool(ud->prefs, "SyncTitleSettings"))
+    {
+        preset = ghb_settings_to_preset(ud->settings);
+    }
+
     // Set up the list of titles
     count = ghb_array_len(ud->settings_array);
     for (ii = 0; ii < count; ii++)
@@ -1859,6 +1865,11 @@ queue_add_all_action_cb(GSimpleAction *action, GVariant *param,
         chooser = GTK_FILE_CHOOSER(find_widget(row, "title_dir"));
 
         settings = ghb_array_get(ud->settings_array, ii);
+        if (preset != NULL)
+        {
+            ghb_preset_to_settings(settings, preset);
+            ghb_set_title_settings(ud, settings);
+        }
         title_id = ghb_dict_get_int(settings, "title");
         title = ghb_lookup_title(title_id, &titleindex);
         if (title != NULL)