Commit fc92ae96319099e903a3e2927c26547d4bd5cde3

Authored by Josh Klontz
1 parent a16a3c07

RelabelTransform now SubjectTransform

Showing 1 changed file with 6 additions and 5 deletions
openbr/plugins/misc.cpp
@@ -400,13 +400,14 @@ BR_REGISTER(Transform, AsTransform) @@ -400,13 +400,14 @@ BR_REGISTER(Transform, AsTransform)
400 400
401 /*! 401 /*!
402 * \ingroup transforms 402 * \ingroup transforms
403 - * \brief Change the template label using a regular expresion matched to the file's base name. 403 + * \brief Change the template subject using a regular expresion matched to the file's base name.
  404 + * \author Josh Klontz \cite jklontz
404 */ 405 */
405 -class RelabelTransform : public UntrainableMetaTransform 406 +class SubjectTransform : public UntrainableMetaTransform
406 { 407 {
407 Q_OBJECT 408 Q_OBJECT
408 Q_PROPERTY(QString regexp READ get_regexp WRITE set_regexp RESET reset_regexp STORED false) 409 Q_PROPERTY(QString regexp READ get_regexp WRITE set_regexp RESET reset_regexp STORED false)
409 - BR_PROPERTY(QString, regexp, "") 410 + BR_PROPERTY(QString, regexp, "(.*)")
410 411
411 void project(const Template &src, Template &dst) const 412 void project(const Template &src, Template &dst) const
412 { 413 {
@@ -415,11 +416,11 @@ class RelabelTransform : public UntrainableMetaTransform @@ -415,11 +416,11 @@ class RelabelTransform : public UntrainableMetaTransform
415 QRegularExpressionMatch match = re.match(dst.file.baseName()); 416 QRegularExpressionMatch match = re.match(dst.file.baseName());
416 if (!match.hasMatch()) 417 if (!match.hasMatch())
417 qFatal("Unable to match regular expression \"%s\" to base name \"%s\"!", qPrintable(regexp), qPrintable(dst.file.baseName())); 418 qFatal("Unable to match regular expression \"%s\" to base name \"%s\"!", qPrintable(regexp), qPrintable(dst.file.baseName()));
418 - dst.file.set("Label", match.captured(match.lastCapturedIndex())); 419 + dst.file.set("Subject", match.captured(match.lastCapturedIndex()));
419 } 420 }
420 }; 421 };
421 422
422 -BR_REGISTER(Transform, RelabelTransform) 423 +BR_REGISTER(Transform, SubjectTransform)
423 424
424 /*! 425 /*!
425 * \ingroup transforms 426 * \ingroup transforms