-// static
-int SlideshowClip::sequenceCount(KUrl file)
-{
- // find pattern
- QString filter = file.fileName();
- QString ext = filter.section('.', -1);
- filter = filter.section('.', 0, -2);
- bool hasDigit = false;
- while (filter.at(filter.size() - 1).isDigit()) {
- hasDigit = true;
- filter.remove(filter.size() - 1, 1);
- }
- if (!hasDigit) return 0;
-
- QString regexp = "^" + filter + "\\d+\\." + ext + "$";
- QRegExp rx(regexp);
-
- QDir dir(file.directory());
- QStringList result = dir.entryList(QDir::Files);
-
- int count = 0;
- foreach(const QString &path, result) {
- if (rx.exactMatch(path)) count ++;
- }
- return count;
-}
-