changeset 2429:3d6f45f1bdf4

Move duplicates options Move duplicates options Custom Similarity Threshold and Rotation Invariant Duplicate Check to the duplicates window. It makes more sense to place them where the user can easily access them.
author Colin Clark <cclark@mcb.net>
date Tue, 10 Jan 2017 11:39:44 +0000
parents 6f6becf288dc
children 843cff075959
files doc/docbook/GuideImageSearchFindingDuplicates.xml doc/docbook/GuideOptionsBehavior.xml src/dupe.c src/dupe.h src/preferences.c
diffstat 5 files changed, 61 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/doc/docbook/GuideImageSearchFindingDuplicates.xml	Sun Jan 08 18:10:03 2017 +0000
+++ b/doc/docbook/GuideImageSearchFindingDuplicates.xml	Tue Jan 10 11:39:44 2017 +0000
@@ -132,9 +132,7 @@
         </term>
         <listitem>
           <para>
-            Similar image content, the value to use to consider two images a match is configured in the
-            <link linkend="GuideOptionsBehavior">Behaviour tab</link>
-            of the preferences dialog by setting <emphasis>Custom similarity threshold</emphasis>.
+            The percentage value to used to consider two images a match is configured in the spin box at the bottom of the window.
           </para>
         </listitem>
       </varlistentry>
@@ -183,6 +181,10 @@
     <title>Thumbnails</title>
     <para>Thumbnails can be displayed beside each image in the result list by enabling the Thumbnails check box.</para>
   </section>
+  <section id="Rotation">
+    <title>Ignore Rotation</title>
+    <para>When checked, the rotational orientation of images will be ignored.</para>
+  </section>
   <section id="Comparetwofilesets">
     <title>Compare two file sets</title>
     <para>Sometimes it is useful to compare one group of files to another, different group of files. Enable this check box to compare two groups of files. When enabled, a second list will appear and files can be added to this list using the same methods for the main list.</para>
--- a/doc/docbook/GuideOptionsBehavior.xml	Sun Jan 08 18:10:03 2017 +0000
+++ b/doc/docbook/GuideOptionsBehavior.xml	Tue Jan 10 11:39:44 2017 +0000
@@ -161,25 +161,6 @@
       </varlistentry>
     </variablelist>
   </section>
-  <section id="Miscellaneous">
-    <title>Miscellaneous</title>
-    <variablelist>
-      <varlistentry>
-        <term>
-          <guilabel>Custom similarity threshold</guilabel>
-        </term>
-        <listitem>
-          <para>
-            This setting is used by the compare method
-            <emphasis>Similarity (custom)</emphasis>
-            , located in the
-            <link linkend="GuideImageSearchFindingDuplicates" endterm="titleGuideImageSearchFindingDuplicates" />
-            section.
-          </para>
-        </listitem>
-      </varlistentry>
-    </variablelist>
-  </section>
   <section id="Debugging">
     <title>Debugging</title>
     <variablelist>
--- a/src/dupe.c	Sun Jan 08 18:10:03 2017 +0000
+++ b/src/dupe.c	Tue Jan 10 11:39:44 2017 +0000
@@ -2874,6 +2874,41 @@
 	dupe_listview_set_height(dw->listview, dw->show_thumbs);
 }
 
+static void dupe_window_rotation_invariant_cb(GtkWidget *widget, gpointer data)
+{
+	DupeWindow *dw = data;
+
+	options->rot_invariant_sim = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+	dupe_window_recompare(dw);
+}
+
+static void dupe_window_custom_threshold_cb(GtkWidget *widget, gpointer data)
+{
+	DupeWindow *dw = data;
+	DupeMatchType match_type;
+	GtkListStore *store;
+	gboolean valid;
+	GtkTreeIter iter;
+
+	options->duplicates_similarity_threshold = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+	dw->match_mask = DUPE_MATCH_SIM_CUSTOM;
+
+	store = gtk_combo_box_get_model(GTK_COMBO_BOX(dw->combo));
+	valid = gtk_tree_model_get_iter_first(store, &iter);
+	while (valid)
+		{
+		gtk_tree_model_get(store, &iter, DUPE_MENU_COLUMN_MASK, &match_type, -1);
+		if (match_type == DUPE_MATCH_SIM_CUSTOM)
+			{
+			break;
+			}
+		valid = gtk_tree_model_iter_next(store, &iter);
+		}
+
+	gtk_combo_box_set_active_iter(GTK_COMBO_BOX(dw->combo), &iter);
+	dupe_window_recompare(dw);
+}
+
 static void dupe_popup_menu_pos_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data)
 {
 	GtkWidget *view = data;
@@ -3268,6 +3303,14 @@
 	gtk_box_pack_start(GTK_BOX(status_box), dw->button_thumbs, FALSE, FALSE, PREF_PAD_SPACE);
 	gtk_widget_show(dw->button_thumbs);
 
+	dw->button_rotation_invariant = gtk_check_button_new_with_label(_("Ignore Rotation"));
+	gtk_widget_set_tooltip_text(GTK_WIDGET(dw->button_rotation_invariant), "Ignore image orientation");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dw->button_rotation_invariant), options->rot_invariant_sim);
+	g_signal_connect(G_OBJECT(dw->button_rotation_invariant), "toggled",
+			 G_CALLBACK(dupe_window_rotation_invariant_cb), dw);
+	gtk_box_pack_start(GTK_BOX(status_box), dw->button_rotation_invariant, FALSE, FALSE, PREF_PAD_SPACE);
+	gtk_widget_show(dw->button_rotation_invariant);
+
 	button = gtk_check_button_new_with_label(_("Compare two file sets"));
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), dw->second_set);
 	g_signal_connect(G_OBJECT(button), "toggled",
@@ -3288,6 +3331,17 @@
 	gtk_container_add(GTK_CONTAINER(frame), dw->status_label);
 	gtk_widget_show(dw->status_label);
 
+	label = gtk_label_new(_("Custom Threshold"));
+	gtk_box_pack_start(GTK_BOX(status_box), label, FALSE, FALSE, PREF_PAD_SPACE);
+	gtk_widget_show(label);
+	dw->custom_threshold = gtk_spin_button_new_with_range(1, 100, 1);
+	gtk_widget_set_tooltip_text(GTK_WIDGET(dw->custom_threshold), "Custom similarity threshold");
+	gtk_spin_button_set_value(GTK_SPIN_BUTTON(dw->custom_threshold), options->duplicates_similarity_threshold);
+	g_signal_connect(G_OBJECT(dw->custom_threshold), "value_changed",
+													G_CALLBACK(dupe_window_custom_threshold_cb), dw);
+	gtk_box_pack_start(GTK_BOX(status_box), dw->custom_threshold, FALSE, FALSE, PREF_PAD_SPACE);
+	gtk_widget_show(dw->custom_threshold);
+
 	dw->extra_label = gtk_progress_bar_new();
 	gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(dw->extra_label), 0.0);
 #if GTK_CHECK_VERSION(3,0,0)
--- a/src/dupe.h	Sun Jan 08 18:10:03 2017 +0000
+++ b/src/dupe.h	Tue Jan 10 11:39:44 2017 +0000
@@ -92,6 +92,8 @@
 	GtkWidget *status_label;
 	GtkWidget *extra_label;
 	GtkWidget *button_thumbs;
+	GtkWidget *button_rotation_invariant;
+	GtkWidget *custom_threshold;
 
 	gboolean show_thumbs;
 
--- a/src/preferences.c	Sun Jan 08 18:10:03 2017 +0000
+++ b/src/preferences.c	Tue Jan 10 11:39:44 2017 +0000
@@ -2171,13 +2171,6 @@
 	pref_checkbox_new_int(group, _("Navigation by left or middle click on image"),
 			      options->image_lm_click_nav, &c_options->image_lm_click_nav);
 
-	group = pref_group_new(vbox, FALSE, _("Similarities"), GTK_ORIENTATION_VERTICAL);
-
-	pref_spin_new_int(group, _("Custom similarity threshold:"), NULL,
-			  0, 100, 1, options->duplicates_similarity_threshold, (int *)&c_options->duplicates_similarity_threshold);
-	pref_checkbox_new_int(group, _("Rotation invariant duplicate check"),
-			      options->rot_invariant_sim, &c_options->rot_invariant_sim);
-
 #ifdef DEBUG
 	group = pref_group_new(vbox, FALSE, _("Debugging"), GTK_ORIENTATION_VERTICAL);