Fixed i18n in QImageReader/QImageWriter.
Change-Id: I366831e23e4d29999696872d752b9487d1f22d44 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>bb10
parent
c3939826c4
commit
c281755480
|
|
@ -567,7 +567,7 @@ bool QImageReaderPrivate::initHandler()
|
|||
// check some preconditions
|
||||
if (!device || (!deleteDevice && !device->isOpen() && !device->open(QIODevice::ReadOnly))) {
|
||||
imageReaderError = QImageReader::DeviceError;
|
||||
errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Invalid device"));
|
||||
errorString = QImageReader::tr("Invalid device");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -594,7 +594,7 @@ bool QImageReaderPrivate::initHandler()
|
|||
|
||||
if (!device->isOpen()) {
|
||||
imageReaderError = QImageReader::FileNotFoundError;
|
||||
errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "File not found"));
|
||||
errorString = QImageReader::tr("File not found");
|
||||
file->setFileName(fileName); // restore the old file name
|
||||
return false;
|
||||
}
|
||||
|
|
@ -603,7 +603,7 @@ bool QImageReaderPrivate::initHandler()
|
|||
// assign a handler
|
||||
if (!handler && (handler = createReadHandlerHelper(device, format, autoDetectImageFormat, ignoresFormatAndExtension)) == 0) {
|
||||
imageReaderError = QImageReader::UnsupportedFormatError;
|
||||
errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Unsupported image format"));
|
||||
errorString = QImageReader::tr("Unsupported image format");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -1190,7 +1190,7 @@ bool QImageReader::read(QImage *image)
|
|||
// read the image
|
||||
if (!d->handler->read(image)) {
|
||||
d->imageReaderError = InvalidDataError;
|
||||
d->errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Unable to read image data"));
|
||||
d->errorString = QImageReader::tr("Unable to read image data");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1382,7 +1382,7 @@ QImageReader::ImageReaderError QImageReader::error() const
|
|||
QString QImageReader::errorString() const
|
||||
{
|
||||
if (d->errorString.isEmpty())
|
||||
return QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Unknown error"));
|
||||
return QImageReader::tr("Unknown error");
|
||||
return d->errorString;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#define QIMAGEREADER_H
|
||||
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
#include <QtGui/qimage.h>
|
||||
#include <QtGui/qimageiohandler.h>
|
||||
|
||||
|
|
@ -58,6 +59,7 @@ class QStringList;
|
|||
class QImageReaderPrivate;
|
||||
class Q_GUI_EXPORT QImageReader
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(QImageReader)
|
||||
public:
|
||||
enum ImageReaderError {
|
||||
UnknownError,
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ QImageWriterPrivate::QImageWriterPrivate(QImageWriter *qq)
|
|||
compression = 0;
|
||||
gamma = 0.0;
|
||||
imageWriterError = QImageWriter::UnknownError;
|
||||
errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageWriter, "Unknown error"));
|
||||
errorString = QImageWriter::tr("Unknown error");
|
||||
|
||||
q = qq;
|
||||
}
|
||||
|
|
@ -288,19 +288,19 @@ bool QImageWriterPrivate::canWriteHelper()
|
|||
{
|
||||
if (!device) {
|
||||
imageWriterError = QImageWriter::DeviceError;
|
||||
errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageWriter, "Device is not set"));
|
||||
errorString = QImageWriter::tr("Device is not set");
|
||||
return false;
|
||||
}
|
||||
if (!device->isOpen())
|
||||
device->open(QIODevice::WriteOnly);
|
||||
if (!device->isWritable()) {
|
||||
imageWriterError = QImageWriter::DeviceError;
|
||||
errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageWriter, "Device not writable"));
|
||||
errorString = QImageWriter::tr("Device not writable");
|
||||
return false;
|
||||
}
|
||||
if (!handler && (handler = createWriteHandlerHelper(device, format)) == 0) {
|
||||
imageWriterError = QImageWriter::UnsupportedFormatError;
|
||||
errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageWriter, "Unsupported image format"));
|
||||
errorString = QImageWriter::tr("Unsupported image format");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -667,7 +667,7 @@ bool QImageWriter::supportsOption(QImageIOHandler::ImageOption option) const
|
|||
{
|
||||
if (!d->handler && (d->handler = createWriteHandlerHelper(d->device, d->format)) == 0) {
|
||||
d->imageWriterError = QImageWriter::UnsupportedFormatError;
|
||||
d->errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageWriter, "Unsupported image format"));
|
||||
d->errorString = QImageWriter::tr("Unsupported image format");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#define QIMAGEWRITER_H
|
||||
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtGui/qimageiohandler.h>
|
||||
|
||||
|
|
@ -55,6 +56,7 @@ class QImage;
|
|||
class QImageWriterPrivate;
|
||||
class Q_GUI_EXPORT QImageWriter
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(QImageWriter)
|
||||
public:
|
||||
enum ImageWriterError {
|
||||
UnknownError,
|
||||
|
|
|
|||
Loading…
Reference in New Issue