Commit 45f83c56da45805c58d588a69d4d67629f8281ab

Authored by Jordan
1 parent bc729a67

Updated with Josh's suggestions

Showing 1 changed file with 10 additions and 12 deletions
openbr/plugins/misc.cpp
... ... @@ -35,19 +35,17 @@ class OpenTransform : public UntrainableMetaTransform
35 35  
36 36 void project(const Template &src, Template &dst) const
37 37 {
38   - if (!src.m().empty()) dst.append(src.clone());
39   - else {
40   - if (Globals->verbose) qDebug("Opening %s", qPrintable(src.file.flat()));
41   - dst.file = src.file;
42   - foreach (const File &file, src.file.split()) {
43   - QScopedPointer<Format> format(Factory<Format>::make(file));
44   - Template t = format->read();
45   - if (t.isEmpty()) qWarning("Can't open %s from %s", qPrintable(file.flat()), qPrintable(QDir::currentPath()));
46   - dst.append(t);
47   - dst.file.append(t.file.localMetadata());
48   - }
49   - dst.file.set("FTO", dst.isEmpty());
  38 + if (!src.isEmpty()) { dst = src; return; }
  39 + if (Globals->verbose) qDebug("Opening %s", qPrintable(src.file.flat()));
  40 + dst.file = src.file;
  41 + foreach (const File &file, src.file.split()) {
  42 + QScopedPointer<Format> format(Factory<Format>::make(file));
  43 + Template t = format->read();
  44 + if (t.isEmpty()) qWarning("Can't open %s from %s", qPrintable(file.flat()), qPrintable(QDir::currentPath()));
  45 + dst.append(t);
  46 + dst.file.append(t.file.localMetadata());
50 47 }
  48 + dst.file.set("FTO", dst.isEmpty());
51 49 }
52 50 };
53 51  
... ...