diff --git a/openbr/plugins/validate.cpp b/openbr/plugins/validate.cpp index 8b3a174..f2f7b96 100644 --- a/openbr/plugins/validate.cpp +++ b/openbr/plugins/validate.cpp @@ -147,26 +147,29 @@ class MetadataDistance : public Distance float compare(const Template &a, const Template &b) const { foreach (const QString &key, filters) { + QString aValue = a.file.get(key, QString()); + QString bValue = b.file.get(key, QString()); - const QString aValue = a.file.get(key, ""); - const QString bValue = b.file.get(key, ""); + // The query value may be a range. Let's check. + if (bValue.isEmpty()) bValue = QtUtils::toString(b.file.get(key, QPointF())); if (aValue.isEmpty() || bValue.isEmpty()) continue; bool keep = false; + bool ok; - if (aValue[0] == '(') /* Range */ { - QStringList values = aValue.split(','); + QPointF range = QtUtils::toPoint(bValue,&ok); - int value = values[0].mid(1).toInt(); - values[1].chop(1); - int upperBound = values[1].toInt(); + if (ok) /* Range */ { + int value = range.x(); + int upperBound = range.y(); while (value <= upperBound) { - if (aValue == bValue) { + if (aValue == QString::number(value)) { keep = true; break; } + value++; } } else if (aValue == bValue) keep = true;