[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/digikam/utilities/fuzzysearch
From:       Andi Clemens <andi.clemens () gmx ! net>
Date:       2009-06-11 14:36:04
Message-ID: 1244730964.144835.731.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 980342 by aclemens:

Add a threshold spinbox to the find duplicates search.
The default threshold value is not enough sometimes, 87% might be too
high in some cases and duplicate (or very similar) images are not found.
With the spinbox, you can query with different thresholds.

Now that we can limit the search to specific folders, users might run
the find duplicates search more often then before, because it is way
faster now.
To test different values, it is important to have customization here.

The value will not be saved in the config (for now), because I don't
think it is necessary. But if we want to save it, it is easy to change
:-)

Andi

 M  +27 -5     findduplicatesview.cpp  


--- trunk/extragear/graphics/digikam/utilities/fuzzysearch/findduplicatesview.cpp #980341:980342
@@ -35,6 +35,7 @@
 #include <QPainter>
 #include <QPushButton>
 #include <QTreeWidget>
+#include <QSpinBox>
 
 // KDE includes
 
@@ -74,6 +75,8 @@
         progressBar             = 0;
         thumbLoadThread         = 0;
         includeAlbumsLabel      = 0;
+        thresholdLabel          = 0;
+        threshold               = 0;
         albumSelectCB           = 0;
         model                   = 0;
         cancelFindDuplicates    = false;
@@ -82,7 +85,10 @@
     bool                cancelFindDuplicates;
 
     QLabel              *includeAlbumsLabel;
+    QLabel              *thresholdLabel;
 
+    QSpinBox            *threshold;
+
     QPushButton         *scanDuplicatesBtn;
     QPushButton         *updateFingerPrtBtn;
 
@@ -146,13 +152,25 @@
 
     // ---------------------------------------------------------------
 
+    d->thresholdLabel = new QLabel(i18n("Threshold:"));
+    d->threshold      = new QSpinBox;
+    d->threshold->setRange(0, 100);
+    d->threshold->setValue(90);
+    d->threshold->setSingleStep(1);
+    d->threshold->setSuffix(QChar('%'));
+
+    // ---------------------------------------------------------------
+
     grid->addWidget(d->listView,           0, 0, 1,-1);
     grid->addWidget(d->includeAlbumsLabel, 1, 0, 1, 1);
-    grid->addWidget(d->albumSelectCB,      1, 1, 1, 1);
-    grid->addWidget(d->updateFingerPrtBtn, 2, 0, 1,-1);
-    grid->addWidget(d->scanDuplicatesBtn,  3, 0, 1,-1);
-    grid->addWidget(d->progressBar,        4, 0, 1,-1);
+    grid->addWidget(d->albumSelectCB,      1, 1, 1,-1);
+    grid->addWidget(d->thresholdLabel,     2, 0, 1, 1);
+    grid->addWidget(d->threshold,          2, 2, 1, 1);
+    grid->addWidget(d->updateFingerPrtBtn, 3, 0, 1,-1);
+    grid->addWidget(d->scanDuplicatesBtn,  4, 0, 1,-1);
+    grid->addWidget(d->progressBar,        5, 0, 1,-1);
     grid->setRowStretch(0, 10);
+    grid->setColumnStretch(1, 10);
     grid->setMargin(KDialog::spacingHint());
     grid->setSpacing(KDialog::spacingHint());
 
@@ -314,6 +332,8 @@
     d->updateFingerPrtBtn->setEnabled(val);
     d->includeAlbumsLabel->setEnabled(val);
     d->albumSelectCB->setEnabled(val);
+    d->thresholdLabel->setEnabled(val);
+    d->threshold->setEnabled(val);
 
     d->progressBar->progressBarMode(val ? StatusProgressBar::TextMode
                                         : StatusProgressBar::CancelProgressBarMode);
@@ -398,7 +418,9 @@
         job->addMetaData("duplicates", "normal");
 
     job->addMetaData("albumids", idsStringList.join(","));
-    job->addMetaData("threshold", QString::number(0.87));
+//    job->addMetaData("threshold", QString::number(0.87));
+    double thresh = d->threshold->value() / 100.0;
+    job->addMetaData("threshold", QString::number(thresh));
 
     connect(job, SIGNAL(result(KJob*)),
             this, SLOT(slotDuplicatesSearchResult(KJob*)));
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic