Commit 7e158f3eb55e5a20021744e0fab70b0ab1dfbfcd
1 parent
edba8066
misc things
Showing
3 changed files
with
32 additions
and
7 deletions
sdk/openbr_plugin.cpp
| ... | ... | @@ -889,6 +889,8 @@ void br::Context::messageHandler(QtMsgType type, const char *msg) |
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | if (type == QtFatalMsg) { |
| 892 | + // Write debug output then close | |
| 893 | + qDebug("SDK Path: %s", qPrintable(Globals->sdkPath)); | |
| 892 | 894 | Globals->finalize(); |
| 893 | 895 | abort(); |
| 894 | 896 | } | ... | ... |
sdk/plugins/misc.cpp
| ... | ... | @@ -260,7 +260,7 @@ BR_REGISTER(Transform, RemoveTransform) |
| 260 | 260 | |
| 261 | 261 | /*! |
| 262 | 262 | * \ingroup transforms |
| 263 | - * \brief Rename metadata | |
| 263 | + * \brief Rename metadata key | |
| 264 | 264 | * \author Josh Klontz \cite jklontz |
| 265 | 265 | */ |
| 266 | 266 | class RenameTransform : public UntrainableMetaTransform |
| ... | ... | @@ -274,16 +274,39 @@ class RenameTransform : public UntrainableMetaTransform |
| 274 | 274 | void project(const Template &src, Template &dst) const |
| 275 | 275 | { |
| 276 | 276 | dst = src; |
| 277 | - foreach (const QString &key, dst.file.localKeys()) | |
| 278 | - if (key.contains(find)) { | |
| 279 | - QString newKey = QString(key).replace(find, replace); | |
| 280 | - dst.file.insert(newKey, dst.file.get(key)); | |
| 277 | + if (dst.file.localKeys().contains(find)) { | |
| 278 | + dst.file.insert(replace, dst.file.get(find)); | |
| 279 | + dst.file.remove(find); | |
| 280 | + } | |
| 281 | + } | |
| 282 | +}; | |
| 283 | + | |
| 284 | +/*! | |
| 285 | + * \ingroup transforms | |
| 286 | + * \brief Rename first found metadata key | |
| 287 | + * \author Josh Klontz \cite jklontz | |
| 288 | + */ | |
| 289 | +class RenameFirstTransform : public UntrainableMetaTransform | |
| 290 | +{ | |
| 291 | + Q_OBJECT | |
| 292 | + Q_PROPERTY(QStringList find READ get_find WRITE set_find RESET reset_find STORED false) | |
| 293 | + Q_PROPERTY(QString replace READ get_replace WRITE set_replace RESET reset_replace STORED false) | |
| 294 | + BR_PROPERTY(QStringList, find, QStringList()) | |
| 295 | + BR_PROPERTY(QString, replace, "") | |
| 296 | + | |
| 297 | + void project(const Template &src, Template &dst) const | |
| 298 | + { | |
| 299 | + dst = src; | |
| 300 | + foreach (const QString &key, find) | |
| 301 | + if (dst.file.localKeys().contains(key)) { | |
| 302 | + dst.file.insert(replace, dst.file.get(key)); | |
| 281 | 303 | dst.file.remove(key); |
| 304 | + break; | |
| 282 | 305 | } |
| 283 | 306 | } |
| 284 | 307 | }; |
| 285 | 308 | |
| 286 | -BR_REGISTER(Transform, RenameTransform) | |
| 309 | +BR_REGISTER(Transform, RenameFirstTransform) | |
| 287 | 310 | |
| 288 | 311 | } |
| 289 | 312 | ... | ... |
sdk/plugins/pp5.cmake