From fc399f2cd81772fed179d59a6f53abe69a81083a Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 16 Apr 2010 11:28:14 +1000 Subject: Correctly support translation in QDeclarativePixmapCache --- src/declarative/util/qdeclarativepixmapcache.cpp | 10 +++++----- src/declarative/util/qdeclarativepixmapcache_p.h | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index 893fbf3..dbca326 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -194,7 +194,7 @@ static bool readImage(const QUrl& url, QIODevice *dev, QImage *image, QString *e return true; } else { if (errorString) - *errorString = QDeclarativeImageRequestHandler::tr("Error decoding: %1: %2").arg(url.toString()) + *errorString = QDeclarativePixmapCache::tr("Error decoding: %1: %2").arg(url.toString()) .arg(imgio.errorString()); return false; } @@ -264,7 +264,7 @@ bool QDeclarativeImageRequestHandler::event(QEvent *event) QString errorStr; if (image.isNull()) { errorCode = QDeclarativeImageReaderEvent::Loading; - errorStr = QDeclarativeImageRequestHandler::tr("Failed to get image from provider: %1").arg(url.toString()); + errorStr = QDeclarativePixmapCache::tr("Failed to get image from provider: %1").arg(url.toString()); } QCoreApplication::postEvent(runningJob, new QDeclarativeImageReaderEvent(errorCode, errorStr, image)); } else { @@ -283,7 +283,7 @@ bool QDeclarativeImageRequestHandler::event(QEvent *event) errorCode = QDeclarativeImageReaderEvent::Loading; } } else { - errorStr = QDeclarativeImageRequestHandler::tr("Cannot open: %1").arg(url.toString()); + errorStr = QDeclarativePixmapCache::tr("Cannot open: %1").arg(url.toString()); errorCode = QDeclarativeImageReaderEvent::Loading; } QCoreApplication::postEvent(runningJob, new QDeclarativeImageReaderEvent(errorCode, errorStr, image)); @@ -625,7 +625,7 @@ QDeclarativePixmapReply::Status QDeclarativePixmapCache::get(const QUrl& url, QP } } else { if (errorString) - *errorString = QDeclarativeImageRequestHandler::tr("Cannot open: %1").arg(url.toString()); + *errorString = tr("Cannot open: %1").arg(url.toString()); *pixmap = QPixmap(); status = QDeclarativePixmapReply::Error; } @@ -662,7 +662,7 @@ QDeclarativePixmapReply::Status QDeclarativePixmapCache::get(const QUrl& url, QP } else if (pixmap->isNull()) { status = QDeclarativePixmapReply::Error; if (errorString) - *errorString = QDeclarativeImageRequestHandler::tr("Unknown Error loading %1").arg(url.toString()); + *errorString = tr("Unknown Error loading %1").arg(url.toString()); } else { status = QDeclarativePixmapReply::Ready; } diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h index 7b94728..33d9de1 100644 --- a/src/declarative/util/qdeclarativepixmapcache_p.h +++ b/src/declarative/util/qdeclarativepixmapcache_p.h @@ -45,6 +45,7 @@ #include #include #include +#include QT_BEGIN_HEADER @@ -95,6 +96,7 @@ private: class Q_DECLARATIVE_EXPORT QDeclarativePixmapCache { + Q_DECLARE_TR_FUNCTIONS(QDeclarativePixmapCache) public: static QDeclarativePixmapReply::Status get(const QUrl& url, QPixmap *pixmap, QString *errorString, QSize *impsize=0, bool async=false, int req_width=0, int req_height=0); static QDeclarativePixmapReply *request(QDeclarativeEngine *, const QUrl& url, int req_width=0, int req_height=0); -- cgit v0.12