Commit 9240e10eca3b99e9383dfd3d4bc0ed6bc4a73829
1 parent
6fca8a7f
implemented -noDuplicates
Showing
2 changed files
with
12 additions
and
0 deletions
sdk/core/core.cpp
| ... | ... | @@ -124,6 +124,8 @@ struct AlgorithmCore |
| 124 | 124 | Globals->totalSteps = i.size(); |
| 125 | 125 | Globals->startTime.start(); |
| 126 | 126 | |
| 127 | + const bool noDuplicates = gallery.contains("noDuplicates"); | |
| 128 | + QStringList fileNames = noDuplicates ? fileList.names() : QStringList(); | |
| 127 | 129 | const int subBlockSize = 4*std::max(1, Globals->parallelism); |
| 128 | 130 | const int numSubBlocks = ceil(1.0*Globals->blockSize/subBlockSize); |
| 129 | 131 | int totalCount = 0, failureCount = 0; |
| ... | ... | @@ -132,6 +134,10 @@ struct AlgorithmCore |
| 132 | 134 | for (int subBlock = 0; subBlock<numSubBlocks; subBlock++) { |
| 133 | 135 | TemplateList data = i.mid(block*Globals->blockSize + subBlock*subBlockSize, subBlockSize); |
| 134 | 136 | if (data.isEmpty()) break; |
| 137 | + if (noDuplicates) | |
| 138 | + for (int i=data.size()-1; i>=0; i--) | |
| 139 | + if (fileNames.contains(data[i].file.name)) | |
| 140 | + data.removeAt(i); | |
| 135 | 141 | const int numFiles = data.size(); |
| 136 | 142 | |
| 137 | 143 | if (Globals->backProject) { | ... | ... |
sdk/openbr_plugin.h
| ... | ... | @@ -505,6 +505,12 @@ public: |
| 505 | 505 | Q_PROPERTY(float ageDelta READ get_ageDelta WRITE set_ageDelta RESET reset_ageDelta) |
| 506 | 506 | BR_PROPERTY(float, ageDelta, std::numeric_limits<float>::max()) |
| 507 | 507 | |
| 508 | + /*! | |
| 509 | + * \brief If \c true a template will be skipped over if its file name already exists in the gallery. | |
| 510 | + */ | |
| 511 | + Q_PROPERTY(bool noDuplicates READ get_noDuplicates WRITE set_noDuplicates RESET reset_noDuplicates) | |
| 512 | + BR_PROPERTY(bool, noDuplicates, false) | |
| 513 | + | |
| 508 | 514 | QHash<QString,QString> abbreviations; /*!< \brief Used by br::Transform::make() to expand abbreviated algorithms into their complete definitions. */ |
| 509 | 515 | QHash<QString,int> classes; /*!< \brief Used by classifiers to associate text class labels with unique integers IDs. */ |
| 510 | 516 | QTime startTime; /*!< \brief Used to estimate timeRemaining(). */ | ... | ... |