summaryrefslogtreecommitdiffstats
path: root/src/multimedia/qmediastoragelocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/multimedia/qmediastoragelocation.cpp')
-rw-r--r--src/multimedia/qmediastoragelocation.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/multimedia/qmediastoragelocation.cpp b/src/multimedia/qmediastoragelocation.cpp
index 8a6baa1a2..85aa1ba63 100644
--- a/src/multimedia/qmediastoragelocation.cpp
+++ b/src/multimedia/qmediastoragelocation.cpp
@@ -69,7 +69,7 @@ QDir QMediaStorageLocation::defaultLocation(MediaType type) const
dirCandidates << QDir::currentPath();
dirCandidates << QDir::tempPath();
- Q_FOREACH (const QString &path, dirCandidates) {
+ for (const QString &path : qAsConst(dirCandidates)) {
if (QFileInfo(path).isWritable())
return QDir(path);
}
@@ -110,7 +110,8 @@ QString QMediaStorageLocation::generateFileName(const QString &prefix,
if (lastMediaIndex == 0) {
// first run, find the maximum media number during the fist capture
- Q_FOREACH (const QString &fileName, dir.entryList(QStringList() << QString(QLatin1String("%1*.%2")).arg(prefix).arg(extension))) {
+ const auto list = dir.entryList(QStringList() << QString(QLatin1String("%1*.%2")).arg(prefix).arg(extension));
+ for (const QString &fileName : list) {
const qint64 mediaIndex = fileName.midRef(prefix.length(), fileName.size() - prefix.length() - extension.length() - 1).toInt();
lastMediaIndex = qMax(lastMediaIndex, mediaIndex);
}