summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMark Brand <mabrand@mabrand.nl>2010-07-02 16:30:33 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-07-02 16:37:01 (GMT)
commit802dc404d1af9a08fdc23ef32e2fbc77f138f70a (patch)
treef980aa8560c2c64b89cfbed0e80db7d314c00866 /src
parent51ba8332385f3abceae88ec0a7ae29ac1e875a5c (diff)
downloadQt-802dc404d1af9a08fdc23ef32e2fbc77f138f70a.zip
Qt-802dc404d1af9a08fdc23ef32e2fbc77f138f70a.tar.gz
Qt-802dc404d1af9a08fdc23ef32e2fbc77f138f70a.tar.bz2
Fix incomplete support for built-in jpeg, mng, tiff and gif handlers
Previously, although the configure shell script could configure built-in support for these image formats, the .pr[io] files would nevertheless build them as plugins. Support was also missing from qimagereader and qimagewriter. This has now been added. Configure.exe, while clearly intended to support this too, needed a few minor fixes. For example, the usage of values "qt" and "yes" was inconsistent. For both configure tools, the explanation of the *non*-related options has been clarified, i.e: -no-libjpeg -qt-libjpeg -system-libjpeg These options have nothing to do with the plugin/built-in distinction. There are (still) no configure options for specifying "plugin" or "built-in" for these image formats. Quite reasonably, "plugin" is selected for shared Qt and "built-in" is selected for static Qt. Merge-request: 715 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qimagereader.cpp76
-rw-r--r--src/gui/image/qimagewriter.cpp40
-rw-r--r--src/plugins/imageformats/imageformats.pro8
-rw-r--r--src/winmain/winmain.pro1
4 files changed, 120 insertions, 5 deletions
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index af43e90..55c9341 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -141,6 +141,18 @@
#ifndef QT_NO_IMAGEFORMAT_PNG
#include <private/qpnghandler_p.h>
#endif
+#ifndef QT_NO_IMAGEFORMAT_JPEG
+#include <qjpeghandler.h>
+#endif
+#ifndef QT_NO_IMAGEFORMAT_MNG
+#include <qmnghandler.h>
+#endif
+#ifndef QT_NO_IMAGEFORMAT_TIFF
+#include <qtiffhandler.h>
+#endif
+#ifdef QT_BUILTIN_GIF_READER
+#include <qgifhandler.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -153,6 +165,18 @@ enum _qt_BuiltInFormatType {
#ifndef QT_NO_IMAGEFORMAT_PNG
_qt_PngFormat,
#endif
+#ifndef QT_NO_IMAGEFORMAT_JPEG
+ _qt_JpgFormat,
+#endif
+#ifndef QT_NO_IMAGEFORMAT_MNG
+ _qt_MngFormat,
+#endif
+#ifndef QT_NO_IMAGEFORMAT_TIFF
+ _qt_TifFormat,
+#endif
+#ifdef QT_BUILTIN_GIF_READER
+ _qt_GifFormat,
+#endif
_qt_BmpFormat,
#ifndef QT_NO_IMAGEFORMAT_PPM
_qt_PpmFormat,
@@ -179,6 +203,18 @@ static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = {
#ifndef QT_NO_IMAGEFORMAT_PNG
{_qt_PngFormat, "png"},
#endif
+#ifndef QT_NO_IMAGEFORMAT_JPEG
+ {_qt_JpgFormat, "jpg"},
+#endif
+#ifndef QT_NO_IMAGEFORMAT_MNG
+ {_qt_MngFormat, "mng"},
+#endif
+#ifndef QT_NO_IMAGEFORMAT_TIFF
+ {_qt_TifFormat, "tif"},
+#endif
+#ifdef QT_BUILTIN_GIF_READER
+ {_qt_GifFormat, "gif"},
+#endif
{_qt_BmpFormat, "bmp"},
#ifndef QT_NO_IMAGEFORMAT_PPM
{_qt_PpmFormat, "ppm"},
@@ -304,6 +340,22 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
} else if (testFormat == "png") {
handler = new QPngHandler;
#endif
+#ifndef QT_NO_IMAGEFORMAT_JPEG
+ } else if (testFormat == "jpg" || testFormat == "jpeg") {
+ handler = new QJpegHandler;
+#endif
+#ifndef QT_NO_IMAGEFORMAT_MNG
+ } else if (testFormat == "mng") {
+ handler = new QMngHandler;
+#endif
+#ifndef QT_NO_IMAGEFORMAT_TIFF
+ } else if (testFormat == "tif" || testFormat == "tiff") {
+ handler = new QTiffHandler;
+#endif
+#ifdef QT_BUILTIN_GIF_READER
+ } else if (testFormat == "gif") {
+ handler = new QGifHandler;
+#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
} else if (testFormat == "bmp") {
handler = new QBmpHandler;
@@ -380,6 +432,30 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
handler = new QPngHandler;
break;
#endif
+#ifndef QT_NO_IMAGEFORMAT_JPEG
+ case _qt_JpgFormat:
+ if (QJpegHandler::canRead(device))
+ handler = new QJpegHandler;
+ break;
+#endif
+#ifndef QT_NO_IMAGEFORMAT_MNG
+ case _qt_MngFormat:
+ if (QMngHandler::canRead(device))
+ handler = new QMngHandler;
+ break;
+#endif
+#ifndef QT_NO_IMAGEFORMAT_TIFF
+ case _qt_TifFormat:
+ if (QTiffHandler::canRead(device))
+ handler = new QTiffHandler;
+ break;
+#endif
+#ifdef QT_BUILTIN_GIF_READER
+ case _qt_GifFormat:
+ if (QGifHandler::canRead(device))
+ handler = new QGifHandler;
+ break;
+#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
case _qt_BmpFormat:
if (QBmpHandler::canRead(device))
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index 552729f..a46fc48 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -114,6 +114,18 @@
#ifndef QT_NO_IMAGEFORMAT_PNG
#include <private/qpnghandler_p.h>
#endif
+#ifndef QT_NO_IMAGEFORMAT_JPEG
+#include <qjpeghandler.h>
+#endif
+#ifndef QT_NO_IMAGEFORMAT_MNG
+#include <qmnghandler.h>
+#endif
+#ifndef QT_NO_IMAGEFORMAT_TIFF
+#include <qtiffhandler.h>
+#endif
+#ifdef QT_BUILTIN_GIF_READER
+#include <qgifhandler.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -170,6 +182,22 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
} else if (testFormat == "png") {
handler = new QPngHandler;
#endif
+#ifndef QT_NO_IMAGEFORMAT_JPEG
+ } else if (testFormat == "jpg" || testFormat == "jpeg") {
+ handler = new QJpegHandler;
+#endif
+#ifndef QT_NO_IMAGEFORMAT_MNG
+ } else if (testFormat == "mng") {
+ handler = new QMngHandler;
+#endif
+#ifndef QT_NO_IMAGEFORMAT_TIFF
+ } else if (testFormat == "tif" || testFormat == "tiff") {
+ handler = new QTiffHandler;
+#endif
+#ifdef QT_BUILTIN_GIF_READER
+ } else if (testFormat == "gif") {
+ handler = new QGifHandler;
+#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
} else if (testFormat == "bmp") {
handler = new QBmpHandler;
@@ -669,6 +697,18 @@ QList<QByteArray> QImageWriter::supportedImageFormats()
#ifndef QT_NO_IMAGEFORMAT_PNG
formats << "png";
#endif
+#ifndef QT_NO_IMAGEFORMAT_JPEG
+ formats << "jpg" << "jpeg";
+#endif
+#ifndef QT_NO_IMAGEFORMAT_MNG
+ formats << "mng";
+#endif
+#ifndef QT_NO_IMAGEFORMAT_TIFF
+ formats << "tif" << "tiff";
+#endif
+#ifdef QT_BUILTIN_GIF_READER
+ formats << "gif";
+#endif
#ifndef QT_NO_LIBRARY
QFactoryLoader *l = loader();
diff --git a/src/plugins/imageformats/imageformats.pro b/src/plugins/imageformats/imageformats.pro
index 2e4036b..5fff2de 100644
--- a/src/plugins/imageformats/imageformats.pro
+++ b/src/plugins/imageformats/imageformats.pro
@@ -1,8 +1,8 @@
TEMPLATE = subdirs
-!contains(QT_CONFIG, no-jpeg):SUBDIRS += jpeg
-!contains(QT_CONFIG, no-gif):SUBDIRS += gif
-!contains(QT_CONFIG, no-mng):SUBDIRS += mng
+!contains(QT_CONFIG, no-jpeg):!contains(QT_CONFIG, jpeg):SUBDIRS += jpeg
+!contains(QT_CONFIG, no-gif):!contains(QT_CONFIG, gif):SUBDIRS += gif
+!contains(QT_CONFIG, no-mng):!contains(QT_CONFIG, mng):SUBDIRS += mng
contains(QT_CONFIG, svg):SUBDIRS += svg
-!contains(QT_CONFIG, no-tiff):SUBDIRS += tiff
+!contains(QT_CONFIG, no-tiff):!contains(QT_CONFIG, tiff):SUBDIRS += tiff
!contains(QT_CONFIG, no-ico):SUBDIRS += ico
diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro
index 0c9b214..8c2710c 100644
--- a/src/winmain/winmain.pro
+++ b/src/winmain/winmain.pro
@@ -12,7 +12,6 @@ win32 {
win32-borland:DEFINES += QT_NEEDS_QMAIN
SOURCES = qtmain_win.cpp
CONFIG += png
- CONFIG -= jpeg
INCLUDEPATH += tmp $$QMAKE_INCDIR_QT/QtCore
}