diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-01-15 11:57:59 +0300 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2016-01-15 13:56:07 +0000 |
commit | 50a8f44fa47ec00769b55058c66c94390735cf57 (patch) | |
tree | 2c12a6ddde1ab3ca4786af6c5e779505f82e697f | |
parent | 942ff8229151820eb2a9cb17d7c5ee237019a47d (diff) | |
download | qtmultimedia-50a8f44fa47ec00769b55058c66c94390735cf57.tar.gz |
WinRT, WindowsAudio plugins: replace foreach with range-based for
Change-Id: I37ab3239aeaa01ecd033bfe7d9c8885511844d4d
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
5 files changed, 11 insertions, 10 deletions
diff --git a/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp b/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp index 039bafead..4c77f5183 100644 --- a/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp +++ b/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp @@ -370,8 +370,8 @@ void QWindowsAudioDeviceInfo::updateLists() // Check more sample sizes testFormat = defaultTestFormat; - QList<int> testSampleSizes = QList<int>() << 24 << 32 << 48 << 64; - Q_FOREACH (int s, testSampleSizes) { + const QList<int> testSampleSizes = QList<int>() << 24 << 32 << 48 << 64; + for (int s : testSampleSizes) { testFormat.setSampleSize(s); if (testSettings(testFormat)) sizez.append(s); @@ -379,8 +379,8 @@ void QWindowsAudioDeviceInfo::updateLists() // Check more sample rates testFormat = defaultTestFormat; - QList<int> testSampleRates = QList<int>() << 8000 << 16000 << 32000 << 88200 << 192000; - Q_FOREACH (int r, testSampleRates) { + const QList<int> testSampleRates = QList<int>() << 8000 << 16000 << 32000 << 88200 << 192000; + for (int r : testSampleRates) { testFormat.setSampleRate(r); if (testSettings(testFormat)) sampleRatez.append(r); diff --git a/src/plugins/winrt/qwinrtcameracontrol.cpp b/src/plugins/winrt/qwinrtcameracontrol.cpp index 19b718cdd..d209d9394 100644 --- a/src/plugins/winrt/qwinrtcameracontrol.cpp +++ b/src/plugins/winrt/qwinrtcameracontrol.cpp @@ -936,7 +936,7 @@ HRESULT QWinRTCameraControl::initialize() // Set preview resolution. QVector<QSize> filtered; const float captureAspectRatio = float(captureResolution.width()) / captureResolution.height(); - foreach (const QSize &resolution, previewResolutions) { + for (const QSize &resolution : qAsConst(previewResolutions)) { const float aspectRatio = float(resolution.width()) / resolution.height(); if (qAbs(aspectRatio - captureAspectRatio) <= ASPECTRATIO_EPSILON) filtered.append(resolution); diff --git a/src/plugins/winrt/qwinrtimageencodercontrol.cpp b/src/plugins/winrt/qwinrtimageencodercontrol.cpp index 6260a1d66..fc28a8a18 100644 --- a/src/plugins/winrt/qwinrtimageencodercontrol.cpp +++ b/src/plugins/winrt/qwinrtimageencodercontrol.cpp @@ -109,7 +109,7 @@ void QWinRTImageEncoderControl::applySettings() // Find closest resolution from the list const int pixelCount = requestResolution.width() * requestResolution.height(); int minimumGap = std::numeric_limits<int>::max(); - foreach (const QSize &size, d->supportedResolutions) { + for (const QSize &size : qAsConst(d->supportedResolutions)) { int gap = qAbs(pixelCount - size.width() * size.height()); if (gap < minimumGap) { minimumGap = gap; diff --git a/src/plugins/winrt/qwinrtmediaplayercontrol.cpp b/src/plugins/winrt/qwinrtmediaplayercontrol.cpp index ed2dbb943..7bdb586c3 100644 --- a/src/plugins/winrt/qwinrtmediaplayercontrol.cpp +++ b/src/plugins/winrt/qwinrtmediaplayercontrol.cpp @@ -757,7 +757,8 @@ void QWinRTMediaPlayerControl::setMedia(const QMediaContent &media, QIODevice *s QString urlString = media.canonicalUrl().toString(); if (!d->stream) { // If we can read the file via Qt, use the byte stream approach - foreach (const QMediaResource &resource, media.resources()) { + const auto resources = media.resources(); + for (const QMediaResource &resource : resources) { const QUrl url = resource.url(); if (url.isLocalFile()) { urlString = url.toLocalFile(); diff --git a/src/plugins/winrt/qwinrtvideodeviceselectorcontrol.cpp b/src/plugins/winrt/qwinrtvideodeviceselectorcontrol.cpp index 9f5bb78f6..07b63be9a 100644 --- a/src/plugins/winrt/qwinrtvideodeviceselectorcontrol.cpp +++ b/src/plugins/winrt/qwinrtvideodeviceselectorcontrol.cpp @@ -158,7 +158,7 @@ private: if (isDefault) defaultDeviceIndex = index; - foreach (QWinRTVideoDeviceSelectorControl *watcher, watchers) + for (QWinRTVideoDeviceSelectorControl *watcher : qAsConst(watchers)) emit watcher->devicesChanged(); return S_OK; @@ -180,7 +180,7 @@ private: if (index >= 0) devices.remove(index); - foreach (QWinRTVideoDeviceSelectorControl *watcher, watchers) + for (QWinRTVideoDeviceSelectorControl *watcher : qAsConst(watchers)) emit watcher->devicesChanged(); return S_OK; @@ -189,7 +189,7 @@ private: HRESULT onDeviceUpdated(IDeviceWatcher *, IDeviceInformationUpdate *) { // A name or description may have changed, so emit devicesChanged - foreach (QWinRTVideoDeviceSelectorControl *watcher, watchers) + for (QWinRTVideoDeviceSelectorControl *watcher : qAsConst(watchers)) emit watcher->devicesChanged(); return S_OK; |