Commit 04c9bf9c007a40a4474e6100723f5c1f5917ba3a
1 parent
01d165e1
implemented enroll append
Showing
3 changed files
with
20 additions
and
15 deletions
sdk/core/core.cpp
| @@ -112,7 +112,8 @@ struct AlgorithmCore | @@ -112,7 +112,8 @@ struct AlgorithmCore | ||
| 112 | QScopedPointer<Gallery> g(Gallery::make(gallery)); | 112 | QScopedPointer<Gallery> g(Gallery::make(gallery)); |
| 113 | if (g.isNull()) return FileList(); | 113 | if (g.isNull()) return FileList(); |
| 114 | FileList fileList = g->files(); | 114 | FileList fileList = g->files(); |
| 115 | - if (!fileList.isEmpty() && g->isUniversal()) return fileList; // Already enrolled | 115 | + if (!fileList.isEmpty() && g->isUniversal() && !gallery.contains("append")) |
| 116 | + return fileList; // Already enrolled | ||
| 116 | 117 | ||
| 117 | const TemplateList i(TemplateList::fromInput(input)); | 118 | const TemplateList i(TemplateList::fromInput(input)); |
| 118 | if (i.isEmpty()) return FileList(); // Nothing to enroll | 119 | if (i.isEmpty()) return FileList(); // Nothing to enroll |
| @@ -133,13 +134,12 @@ struct AlgorithmCore | @@ -133,13 +134,12 @@ struct AlgorithmCore | ||
| 133 | if (data.isEmpty()) break; | 134 | if (data.isEmpty()) break; |
| 134 | const int numFiles = data.size(); | 135 | const int numFiles = data.size(); |
| 135 | 136 | ||
| 136 | - if (!Globals->backProject){ | ||
| 137 | - data >> *transform; | 137 | + if (Globals->backProject) { |
| 138 | + TemplateList backProjectedData; | ||
| 139 | + transform->backProject(data, backProjectedData); | ||
| 140 | + data = backProjectedData; | ||
| 138 | } else { | 141 | } else { |
| 139 | - // I don't really know if this makes sense. | ||
| 140 | - //TemplateList dst; | ||
| 141 | - transform->backProject(data, data); | ||
| 142 | - //data = dst; | 142 | + data >> *transform; |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | g->writeBlock(data); | 145 | g->writeBlock(data); |
sdk/plugins/gallery.cpp
| @@ -60,15 +60,20 @@ class galGallery : public Gallery | @@ -60,15 +60,20 @@ class galGallery : public Gallery | ||
| 60 | void init() | 60 | void init() |
| 61 | { | 61 | { |
| 62 | gallery.setFileName(file); | 62 | gallery.setFileName(file); |
| 63 | - | ||
| 64 | - if (gallery.exists()) { | ||
| 65 | - if (!gallery.open(QFile::ReadOnly)) qFatal("Can't open [%s] for reading.", qPrintable(gallery.fileName())); | ||
| 66 | - stream.setDevice(&gallery); | 63 | + QtUtils::touchDir(gallery); |
| 64 | + | ||
| 65 | + if (file.contains("append")) { | ||
| 66 | + if (!gallery.open(QFile::Append)) | ||
| 67 | + qFatal("Can't open [%s] for appending.", qPrintable(gallery.fileName())); | ||
| 68 | + } else if (gallery.exists()) { | ||
| 69 | + if (!gallery.open(QFile::ReadOnly)) | ||
| 70 | + qFatal("Can't open [%s] for reading.", qPrintable(gallery.fileName())); | ||
| 67 | } else { | 71 | } else { |
| 68 | - QtUtils::touchDir(gallery); | ||
| 69 | - if (!gallery.open(QFile::WriteOnly)) qFatal("Can't open [%s] for writing.", qPrintable(gallery.fileName())); | ||
| 70 | - stream.setDevice(&gallery); | 72 | + if (!gallery.open(QFile::WriteOnly)) |
| 73 | + qFatal("Can't open [%s] for writing.", qPrintable(gallery.fileName())); | ||
| 71 | } | 74 | } |
| 75 | + | ||
| 76 | + stream.setDevice(&gallery); | ||
| 72 | } | 77 | } |
| 73 | 78 | ||
| 74 | bool isUniversal() const | 79 | bool isUniversal() const |