diff options
| author | Mikolaj Boc <mikolaj.boc@qt.io> | 2023-03-15 12:51:53 +0100 |
|---|---|---|
| committer | Mikolaj Boc <mikolaj.boc@qt.io> | 2023-03-17 12:12:05 +0100 |
| commit | 19f2e36eb83cbaebf82f9b74254da95cd7eeb34b (patch) | |
| tree | 20440342f8f6d64ed6dcbfe52a30f915aac4d3c7 /src/quick/util/qquickpixmapcache.cpp | |
| parent | a142f8357577deb064d3dbac4b5a3e9643687720 (diff) | |
Rename cancelled -> cancelledJobs in QQuickPixmapCache
Thus improving readability, as cancelled might be confused with a
cancellation flag.
Change-Id: Ib7b24e58458e138ca1f653d5342e3d00f01a0f96
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/util/qquickpixmapcache.cpp')
| -rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 92eba589b0..68db0be85d 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -179,7 +179,7 @@ private: void asyncResponseFinished(QQuickImageResponse *); QList<QQuickPixmapReply*> jobs; - QList<QQuickPixmapReply*> cancelled; + QList<QQuickPixmapReply *> cancelledJobs; QQmlEngine *engine; QObject *eventLoopQuitHack; @@ -530,7 +530,7 @@ QQuickPixmapReader::~QQuickPixmapReader() #if QT_CONFIG(qml_network) const auto cancelJob = [this](QQuickPixmapReply *reply) { if (reply->loading) { - cancelled.append(reply); + cancelledJobs.append(reply); reply->data = nullptr; } }; @@ -632,7 +632,7 @@ void QQuickPixmapReader::networkRequestDone(QNetworkReply *reply) factory = QQuickTextureFactory::textureFactoryForImage(image); QMutexLocker locker(&mutex); - if (!cancelled.contains(job)) + if (!cancelledJobs.contains(job)) job->postReply(error, errorString, readSize, factory); } reply->deleteLater(); @@ -658,7 +658,7 @@ void QQuickPixmapReader::asyncResponseFinished(QQuickImageResponse *response) } QMutexLocker locker(&mutex); - if (!cancelled.contains(job)) + if (!cancelledJobs.contains(job)) job->postReply(error, errorString, t ? t->textureSize() : QSize(), t); else delete t; @@ -713,13 +713,13 @@ void QQuickPixmapReader::processJobs() QMutexLocker locker(&mutex); while (true) { - if (cancelled.isEmpty() && jobs.isEmpty()) + if (cancelledJobs.isEmpty() && jobs.isEmpty()) return; // Nothing else to do // Clean cancelled jobs - if (!cancelled.isEmpty()) { - for (int i = 0; i < cancelled.size(); ++i) { - QQuickPixmapReply *job = cancelled.at(i); + if (!cancelledJobs.isEmpty()) { + for (int i = 0; i < cancelledJobs.size(); ++i) { + QQuickPixmapReply *job = cancelledJobs.at(i); #if QT_CONFIG(qml_network) QNetworkReply *reply = networkJobs.key(job, 0); if (reply) { @@ -740,7 +740,7 @@ void QQuickPixmapReader::processJobs() // deleteLater, since not owned by this thread job->deleteLater(); } - cancelled.clear(); + cancelledJobs.clear(); } if (!jobs.isEmpty()) { @@ -800,7 +800,7 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u if (imageType == QQuickImageProvider::Invalid) { QString errorStr = QQuickPixmap::tr("Invalid image provider: %1").arg(url.toString()); QMutexLocker locker(&mutex); - if (!cancelled.contains(runningJob)) + if (!cancelledJobs.contains(runningJob)) runningJob->postReply(QQuickPixmapReply::Loading, errorStr, readSize, nullptr); return; } @@ -830,7 +830,7 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u errorStr = QQuickPixmap::tr("Failed to get image from provider: %1").arg(url.toString()); } QMutexLocker locker(&mutex); - if (!cancelled.contains(runningJob)) { + if (!cancelledJobs.contains(runningJob)) { runningJob->postReply(errorCode, errorStr, readSize, QQuickTextureFactory::textureFactoryForImage(image)); } @@ -853,7 +853,7 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u } QMutexLocker locker(&mutex); - if (!cancelled.contains(runningJob)) { + if (!cancelledJobs.contains(runningJob)) { runningJob->postReply( errorCode, errorStr, readSize, QQuickTextureFactory::textureFactoryForImage(pixmap.toImage())); @@ -876,7 +876,7 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u errorStr = QQuickPixmap::tr("Failed to get texture from provider: %1").arg(url.toString()); } QMutexLocker locker(&mutex); - if (!cancelled.contains(runningJob)) + if (!cancelledJobs.contains(runningJob)) runningJob->postReply(errorCode, errorStr, readSize, t); else delete t; @@ -950,7 +950,7 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u errorCode = QQuickPixmapReply::Decoding; } QMutexLocker locker(&mutex); - if (!cancelled.contains(runningJob)) + if (!cancelledJobs.contains(runningJob)) runningJob->postReply(errorCode, errorStr, readSize, factory); return; } else { @@ -972,7 +972,7 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u } } QMutexLocker locker(&mutex); - if (!cancelled.contains(runningJob)) { + if (!cancelledJobs.contains(runningJob)) { runningJob->postReply(errorCode, errorStr, readSize, QQuickTextureFactory::textureFactoryForImage(image)); } @@ -1030,7 +1030,7 @@ void QQuickPixmapReader::cancel(QQuickPixmapReply *reply) { QMutexLocker locker(&mutex); if (reply->loading) { - cancelled.append(reply); + cancelledJobs.append(reply); reply->data = nullptr; // XXX if (threadObject()) |
