From cdd156b029141196ce0b4b96a76c2c56e53f9e9e Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Sat, 20 Apr 2013 13:57:26 -0400 Subject: [PATCH] generalized RemoveTemplatesTransform --- openbr/plugins/misc.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openbr/plugins/misc.cpp b/openbr/plugins/misc.cpp index 765568d..35dd638 100644 --- a/openbr/plugins/misc.cpp +++ b/openbr/plugins/misc.cpp @@ -424,19 +424,21 @@ BR_REGISTER(Transform, SubjectTransform) /*! * \ingroup transforms - * \brief Remove templates with the specified file extension. + * \brief Remove templates with the specified file extension or metadata value. * \author Josh Klontz \cite jklontz */ class RemoveTemplatesTransform : public UntrainableMetaTransform { Q_OBJECT Q_PROPERTY(QString regexp READ get_regexp WRITE set_regexp RESET reset_regexp STORED false) + Q_PROPERTY(QString key READ get_key WRITE set_key RESET reset_key STORED false) BR_PROPERTY(QString, regexp, "") + BR_PROPERTY(QString, key, "") void project(const Template &src, Template &dst) const { const QRegularExpression re(regexp); - const QRegularExpressionMatch match = re.match(src.file.suffix()); + const QRegularExpressionMatch match = re.match(key.isEmpty() ? src.file.suffix() : src.file.get(key)); if (match.hasMatch()) dst = Template(); else dst = src; } -- libgit2 0.21.4