Commit 04c9bf9c007a40a4474e6100723f5c1f5917ba3a

Authored by Josh Klontz
1 parent 01d165e1

implemented enroll append

sdk/core/core.cpp
... ... @@ -112,7 +112,8 @@ struct AlgorithmCore
112 112 QScopedPointer<Gallery> g(Gallery::make(gallery));
113 113 if (g.isNull()) return FileList();
114 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 118 const TemplateList i(TemplateList::fromInput(input));
118 119 if (i.isEmpty()) return FileList(); // Nothing to enroll
... ... @@ -133,13 +134,12 @@ struct AlgorithmCore
133 134 if (data.isEmpty()) break;
134 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 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 145 g->writeBlock(data);
... ...
sdk/plugins/gallery.cpp
... ... @@ -60,15 +60,20 @@ class galGallery : public Gallery
60 60 void init()
61 61 {
62 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 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 79 bool isUniversal() const
... ...
1   -Subproject commit 1031e9e416427f5dd8e9f4e7ff4dd74632626c22
  1 +Subproject commit 504960df12db25e09c39ab098fb8614c1db51617
... ...