Commit 99dd90008b9d07a9e90f101da10fbe58dcb48854
1 parent
e8c22427
cleaned up logic for retrieveOrEnroll
Showing
1 changed file
with
11 additions
and
4 deletions
sdk/core/core.cpp
| ... | ... | @@ -174,12 +174,19 @@ struct AlgorithmCore |
| 174 | 174 | |
| 175 | 175 | void retrieveOrEnroll(const File &file, QScopedPointer<Gallery> &gallery, FileList &galleryFiles) |
| 176 | 176 | { |
| 177 | - gallery.reset(Gallery::make(file)); | |
| 178 | - if ((file.suffix() != "gal") && (file.suffix() != "mem")) { | |
| 179 | - enroll(file); | |
| 180 | - gallery.reset(Gallery::make(getMemoryGallery(file))); | |
| 177 | + if ((file.suffix() == "gal") || (file.suffix() == "mem")) { | |
| 178 | + // Retrieve it | |
| 179 | + gallery.reset(Gallery::make(file)); | |
| 181 | 180 | galleryFiles = gallery->files(); |
| 182 | 181 | } else { |
| 182 | + // Was it already enrolled in memory? | |
| 183 | + gallery.reset(Gallery::make(getMemoryGallery(file))); | |
| 184 | + galleryFiles = gallery->files(); | |
| 185 | + if (!galleryFiles.isEmpty()) return; | |
| 186 | + | |
| 187 | + // Enroll it | |
| 188 | + enroll(file); | |
| 189 | + gallery.reset(Gallery::make(getMemoryGallery(file))); | |
| 183 | 190 | galleryFiles = gallery->files(); |
| 184 | 191 | } |
| 185 | 192 | } | ... | ... |