summaryrefslogtreecommitdiffstats
path: root/src/plugins/avfoundation
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-01-15 11:34:06 +0300
committerYoann Lopes <yoann.lopes@theqtcompany.com>2016-01-15 13:58:45 +0000
commit6b5f9bb6e855dddd041ec6d98bf48b5c622751bf (patch)
treeba9cb0adcb90df281ffaf02506f23aca45833ba9 /src/plugins/avfoundation
parentd12d14a905a52a76d3960f040bdd2d16234fb05c (diff)
AVFoundation: replace foreach with range-based for
Change-Id: I7a2f563f74fc67b55ea9b00f0e87d8ddaa2659c4 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Diffstat (limited to 'src/plugins/avfoundation')
-rw-r--r--src/plugins/avfoundation/camera/avfcameraserviceplugin.mm3
-rw-r--r--src/plugins/avfoundation/camera/avfcamerasession.mm2
-rw-r--r--src/plugins/avfoundation/camera/avfstoragelocation.mm5
3 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/avfoundation/camera/avfcameraserviceplugin.mm b/src/plugins/avfoundation/camera/avfcameraserviceplugin.mm
index bf2f4a24b..f450c35c7 100644
--- a/src/plugins/avfoundation/camera/avfcameraserviceplugin.mm
+++ b/src/plugins/avfoundation/camera/avfcameraserviceplugin.mm
@@ -78,7 +78,8 @@ QList<QByteArray> AVFServicePlugin::devices(const QByteArray &service) const
if (service == Q_MEDIASERVICE_CAMERA) {
const QList<AVFCameraInfo> &cameras = AVFCameraSession::availableCameraDevices();
- Q_FOREACH (const AVFCameraInfo &info, cameras)
+ devs.reserve(cameras.size());
+ for (const AVFCameraInfo &info : cameras)
devs.append(info.deviceId);
}
diff --git a/src/plugins/avfoundation/camera/avfcamerasession.mm b/src/plugins/avfoundation/camera/avfcamerasession.mm
index 66dc43d81..43ab1d149 100644
--- a/src/plugins/avfoundation/camera/avfcamerasession.mm
+++ b/src/plugins/avfoundation/camera/avfcamerasession.mm
@@ -179,7 +179,7 @@ AVFCameraInfo AVFCameraSession::cameraDeviceInfo(const QByteArray &device)
{
updateCameraDevices();
- Q_FOREACH (const AVFCameraInfo &info, m_cameraDevices) {
+ for (const AVFCameraInfo &info : qAsConst(m_cameraDevices)) {
if (info.deviceId == device)
return info;
}
diff --git a/src/plugins/avfoundation/camera/avfstoragelocation.mm b/src/plugins/avfoundation/camera/avfstoragelocation.mm
index 3bb62ed93..5f3aef490 100644
--- a/src/plugins/avfoundation/camera/avfstoragelocation.mm
+++ b/src/plugins/avfoundation/camera/avfstoragelocation.mm
@@ -81,7 +81,7 @@ QDir AVFStorageLocation::defaultDir(QCamera::CaptureMode mode) 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);
}
@@ -96,7 +96,8 @@ QString AVFStorageLocation::generateFileName(const QString &prefix, const QDir &
if (lastClip == 0) {
//first run, find the maximum clip number during the fist capture
- Q_FOREACH (const QString &fileName, dir.entryList(QStringList() << QString("%1*.%2").arg(prefix).arg(ext))) {
+ const auto list = dir.entryList(QStringList() << QString("%1*.%2").arg(prefix).arg(ext));
+ for (const QString &fileName : list) {
int imgNumber = fileName.midRef(prefix.length(), fileName.size()-prefix.length()-ext.length()-1).toInt();
lastClip = qMax(lastClip, imgNumber);
}