Move duplicates options
authorColin Clark <cclark@mcb.net>
Tue, 10 Jan 2017 11:39:44 +0000 (11:39 +0000)
committerColin Clark <cclark@mcb.net>
Tue, 10 Jan 2017 11:39:44 +0000 (11:39 +0000)
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.

doc/docbook/GuideImageSearchFindingDuplicates.xml
doc/docbook/GuideOptionsBehavior.xml
src/dupe.c
src/dupe.h
src/preferences.c

index 648f6a5..b963f33 100644 (file)
         </term>\r
         <listitem>\r
           <para>\r
-            Similar image content, the value to use to consider two images a match is configured in the\r
-            <link linkend="GuideOptionsBehavior">Behaviour tab</link>\r
-            of the preferences dialog by setting <emphasis>Custom similarity threshold</emphasis>.\r
+            The percentage value to used to consider two images a match is configured in the spin box at the bottom of the window.\r
           </para>\r
         </listitem>\r
       </varlistentry>\r
     <title>Thumbnails</title>\r
     <para>Thumbnails can be displayed beside each image in the result list by enabling the Thumbnails check box.</para>\r
   </section>\r
+  <section id="Rotation">\r
+    <title>Ignore Rotation</title>\r
+    <para>When checked, the rotational orientation of images will be ignored.</para>\r
+  </section>\r
   <section id="Comparetwofilesets">\r
     <title>Compare two file sets</title>\r
     <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>\r
index 7688e7d..36ad068 100644 (file)
       </varlistentry>\r
     </variablelist>\r
   </section>\r
-  <section id="Miscellaneous">\r
-    <title>Miscellaneous</title>\r
-    <variablelist>\r
-      <varlistentry>\r
-        <term>\r
-          <guilabel>Custom similarity threshold</guilabel>\r
-        </term>\r
-        <listitem>\r
-          <para>\r
-            This setting is used by the compare method\r
-            <emphasis>Similarity (custom)</emphasis>\r
-            , located in the\r
-            <link linkend="GuideImageSearchFindingDuplicates" endterm="titleGuideImageSearchFindingDuplicates" />\r
-            section.\r
-          </para>\r
-        </listitem>\r
-      </varlistentry>\r
-    </variablelist>\r
-  </section>\r
   <section id="Debugging">\r
     <title>Debugging</title>\r
     <variablelist>\r
index a780981..32d3570 100644 (file)
@@ -2874,6 +2874,41 @@ static void dupe_window_show_thumb_cb(GtkWidget *widget, gpointer data)
        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 @@ DupeWindow *dupe_window_new()
        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 @@ DupeWindow *dupe_window_new()
        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)
index 899f6f7..3e97055 100644 (file)
@@ -92,6 +92,8 @@ struct _DupeWindow
        GtkWidget *status_label;
        GtkWidget *extra_label;
        GtkWidget *button_thumbs;
+       GtkWidget *button_rotation_invariant;
+       GtkWidget *custom_threshold;
 
        gboolean show_thumbs;
 
index 7c6733b..4f66eaf 100644 (file)
@@ -2171,13 +2171,6 @@ static void config_tab_behavior(GtkWidget *notebook)
        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);