Skip to content

Commit

Permalink
fixup: previous commit f*** up the group=manual logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
ff2000 committed Oct 9, 2019
1 parent c441103 commit b2d338c
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/Launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,26 @@ struct CoutProgressIndicator : public ProgressIndicator {
std::list<LoadOptions> Launcher::getBracketedSets() const {
std::list<LoadOptions> result;
if (generalOptions.grouping == LoadOptions::Grouping::MANUAL) {
QStringList fileNames = generalOptions.fileNames;
while(!fileNames.empty()) {
LoadOptions opt = generalOptions;
auto oIt = opt.fileNames.begin();
auto goIt = fileNames.begin();
std::advance(oIt, generalOptions.imagesPerBracket);
std::advance(goIt, generalOptions.imagesPerBracket);
opt.fileNames.erase(oIt, opt.fileNames.end());
fileNames.erase(fileNames.begin(), goIt);
LoadOptions globalOptions = generalOptions;
while(!globalOptions.fileNames.empty()) {
LoadOptions opt = globalOptions;

// opt.fileNames and globalOptions.fileNames are equal
// *optIt == *globaloptIt
auto optIt = opt.fileNames.begin();
auto globaloptIt = globalOptions.fileNames.begin();

// move both iterators by the number of images per bracket
std::advance(optIt, globalOptions.imagesPerBracket);
std::advance(globaloptIt, globalOptions.imagesPerBracket);

// we want to keep only the first imagesPerBracket file names
// erase the tail
opt.fileNames.erase(optIt, opt.fileNames.end());

// the first imagesPerBracket file names found their new home in opt
// Erase them from globalOptions
globalOptions.fileNames.erase(globalOptions.fileNames.begin(), globaloptIt);
result.push_back(opt);
}
} else {
Expand Down

0 comments on commit b2d338c

Please sign in to comment.