- QDir dir(file.directory());
- QStringList result = dir.entryList(QDir::Files);
-
- int count = 0;
- foreach(const QString &path, result) {
- if (rx.exactMatch(path)) count ++;
+ // Find number of digits in sequence
+ int precision = fullSize - filter.size();
+ int firstFrame = file.fileName().section('.', 0, -2).right(precision).toInt();
+ QString folder = file.directory(KUrl::AppendTrailingSlash);
+ // Check how many files we have
+ QDir dir(folder);
+ QString path;
+ int gap = 0;
+ for (int i = firstFrame; gap < 100; i++) {
+ path = filter + QString::number(i).rightJustified(precision, '0', false) + ext;
+ if (dir.exists(path)) {
+ count ++;
+ gap = 0;
+ } else {
+ gap++;
+ }