summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2010-03-08 02:26:16 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-03-08 02:37:23 (GMT)
commitd4073eadde0a9922d9247129d463d28182e32e76 (patch)
treeb93bb185514873e66dc5037201d6dcd6f587b3ff
parent987ffcbad3337fd343febb305911298a37ed9b7e (diff)
downloadQt-d4073eadde0a9922d9247129d463d28182e32e76.zip
Qt-d4073eadde0a9922d9247129d463d28182e32e76.tar.gz
Qt-d4073eadde0a9922d9247129d463d28182e32e76.tar.bz2
JPEG plugin: Use switch() instead of if()
Reviewed-by: Olivier Goffart
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 6eed824..0f0d6f6 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -793,15 +793,16 @@ bool QJpegHandler::supportsOption(ImageOption option) const
QVariant QJpegHandler::option(ImageOption option) const
{
- if (option == Quality) {
+ switch(option) {
+ case Quality:
return quality;
- } else if (option == ScaledSize) {
+ case ScaledSize:
return scaledSize;
- } else if (option == ScaledClipRect) {
+ case ScaledClipRect:
return scaledClipRect;
- } else if (option == ClipRect) {
+ case ClipRect:
return clipRect;
- } else if (option == Size) {
+ case Size:
if (canRead() && !device()->isSequential()) {
qint64 pos = device()->pos();
int width = 0;
@@ -810,7 +811,8 @@ QVariant QJpegHandler::option(ImageOption option) const
device()->seek(pos);
return QSize(width, height);
}
- } else if (option == ImageFormat) {
+ return QVariant();
+ case ImageFormat:
if (canRead() && !device()->isSequential()) {
qint64 pos = device()->pos();
QImage::Format format = QImage::Format_Invalid;
@@ -819,20 +821,29 @@ QVariant QJpegHandler::option(ImageOption option) const
return format;
}
return QImage::Format_Invalid;
+ default:
+ return QVariant();
}
- return QVariant();
}
void QJpegHandler::setOption(ImageOption option, const QVariant &value)
{
- if (option == Quality)
+ switch(option) {
+ case Quality:
quality = value.toInt();
- else if ( option == ScaledSize )
+ break;
+ case ScaledSize:
scaledSize = value.toSize();
- else if ( option == ScaledClipRect )
+ break;
+ case ScaledClipRect:
scaledClipRect = value.toRect();
- else if ( option == ClipRect )
+ break;
+ case ClipRect:
clipRect = value.toRect();
+ break;
+ default:
+ break;
+ }
}
QByteArray QJpegHandler::name() const