summaryrefslogtreecommitdiffstats
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
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>
-rwxr-xr-xconfigure16
-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
-rw-r--r--tools/configure/configureapp.cpp69
6 files changed, 155 insertions, 55 deletions
diff --git a/configure b/configure
index 7f998fc..f152dc0 100755
--- a/configure
+++ b/configure
@@ -1526,8 +1526,8 @@ while [ "$#" -gt 0 ]; do
fi
;;
gif)
- [ "$VAL" = "qt" ] && VAL=yes
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+ [ "$VAL" = "qt" ] && VAL=auto
+ if [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then
CFG_GIF="$VAL"
else
UNKNOWN_OPT=yes
@@ -3634,26 +3634,26 @@ Third Party Libraries:
+ -system-zlib ....... Use zlib from the operating system.
See http://www.gzip.org/zlib
- -no-gif ............ Do not compile the plugin for GIF reading support.
- * -qt-gif ............ Compile the plugin for GIF reading support.
+ -no-gif ............ Do not compile GIF reading support.
+ * -qt-gif ............ Compile GIF reading support.
See also src/gui/image/qgifhandler.h
- -no-libtiff ........ Do not compile the plugin for TIFF support.
+ -no-libtiff ........ Do not compile TIFF support.
-qt-libtiff ........ Use the libtiff bundled with Qt.
+ -system-libtiff .... Use libtiff from the operating system.
See http://www.libtiff.org
- -no-libpng ......... Do not compile in PNG support.
+ -no-libpng ......... Do not compile PNG support.
-qt-libpng ......... Use the libpng bundled with Qt.
+ -system-libpng ..... Use libpng from the operating system.
See http://www.libpng.org/pub/png
- -no-libmng ......... Do not compile the plugin for MNG support.
+ -no-libmng ......... Do not compile MNG support.
-qt-libmng ......... Use the libmng bundled with Qt.
+ -system-libmng ..... Use libmng from the operating system.
See http://www.libmng.com
- -no-libjpeg ........ Do not compile the plugin for JPEG support.
+ -no-libjpeg ........ Do not compile JPEG support.
-qt-libjpeg ........ Use the libjpeg bundled with Qt.
+ -system-libjpeg .... Use libjpeg from the operating system.
See http://www.ijg.org
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
}
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 70668c0..ae1af89 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -581,17 +581,13 @@ void Configure::parseCmdLine()
// Image formats --------------------------------------------
else if (configCmdLine.at(i) == "-no-gif")
dictionary[ "GIF" ] = "no";
- else if( configCmdLine.at(i) == "-qt-gif" )
- dictionary[ "GIF" ] = "auto";
else if (configCmdLine.at(i) == "-no-libtiff") {
dictionary[ "TIFF"] = "no";
dictionary[ "LIBTIFF" ] = "no";
} else if (configCmdLine.at(i) == "-qt-libtiff") {
- dictionary[ "TIFF" ] = "plugin";
dictionary[ "LIBTIFF" ] = "qt";
} else if (configCmdLine.at(i) == "-system-libtiff") {
- dictionary[ "TIFF" ] = "plugin";
dictionary[ "LIBTIFF" ] = "system";
}
@@ -599,10 +595,8 @@ void Configure::parseCmdLine()
dictionary[ "JPEG" ] = "no";
dictionary[ "LIBJPEG" ] = "no";
} else if (configCmdLine.at(i) == "-qt-libjpeg") {
- dictionary[ "JPEG" ] = "plugin";
dictionary[ "LIBJPEG" ] = "qt";
} else if (configCmdLine.at(i) == "-system-libjpeg") {
- dictionary[ "JPEG" ] = "plugin";
dictionary[ "LIBJPEG" ] = "system";
}
@@ -610,10 +604,8 @@ void Configure::parseCmdLine()
dictionary[ "PNG" ] = "no";
dictionary[ "LIBPNG" ] = "no";
} else if (configCmdLine.at(i) == "-qt-libpng") {
- dictionary[ "PNG" ] = "qt";
dictionary[ "LIBPNG" ] = "qt";
} else if (configCmdLine.at(i) == "-system-libpng") {
- dictionary[ "PNG" ] = "qt";
dictionary[ "LIBPNG" ] = "system";
}
@@ -621,10 +613,8 @@ void Configure::parseCmdLine()
dictionary[ "MNG" ] = "no";
dictionary[ "LIBMNG" ] = "no";
} else if (configCmdLine.at(i) == "-qt-libmng") {
- dictionary[ "MNG" ] = "qt";
dictionary[ "LIBMNG" ] = "qt";
} else if (configCmdLine.at(i) == "-system-libmng") {
- dictionary[ "MNG" ] = "qt";
dictionary[ "LIBMNG" ] = "system";
}
@@ -1750,22 +1740,22 @@ bool Configure::displayHelp()
desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt.");
desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n");
- desc("GIF", "no", "-no-gif", "Do not compile the plugin for GIF reading support.");
- desc("GIF", "auto", "-qt-gif", "Compile the plugin for GIF reading support.\nSee also src/gui/image/qgifhandler.h\n");
+ desc("GIF", "no", "-no-gif", "Do not compile GIF reading support.");
+ desc("GIF", "auto", "-qt-gif", "Compile GIF reading support.\nSee also src/gui/image/qgifhandler.h\n");
- desc("LIBPNG", "no", "-no-libpng", "Do not compile in PNG support.");
+ desc("LIBPNG", "no", "-no-libpng", "Do not compile PNG support.");
desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt.");
desc("LIBPNG", "system","-system-libpng", "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n");
- desc("LIBMNG", "no", "-no-libmng", "Do not compile in MNG support.");
+ desc("LIBMNG", "no", "-no-libmng", "Do not compile MNG support.");
desc("LIBMNG", "qt", "-qt-libmng", "Use the libmng bundled with Qt.");
desc("LIBMNG", "system","-system-libmng", "Use libmng from the operating system.\nSee See http://www.libmng.com\n");
- desc("LIBTIFF", "no", "-no-libtiff", "Do not compile the plugin for TIFF support.");
+ desc("LIBTIFF", "no", "-no-libtiff", "Do not compile TIFF support.");
desc("LIBTIFF", "qt", "-qt-libtiff", "Use the libtiff bundled with Qt.");
desc("LIBTIFF", "system","-system-libtiff", "Use libtiff from the operating system.\nSee http://www.libtiff.org\n");
- desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile the plugin for JPEG support.");
+ desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile JPEG support.");
desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt.");
desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n");
@@ -1957,21 +1947,28 @@ QString Configure::defaultTo(const QString &option)
|| option == "LIBTIFF")
return "system";
- // We want PNG built-in
+ // PNG is always built-in, never a plugin
if (option == "PNG")
- return "qt";
+ return "yes";
- // The JPEG image library can only be a plugin
- if (option == "JPEG"
- || option == "MNG" || option == "TIFF")
- return "plugin";
-
- // GIF off by default
- if (option == "GIF") {
- if (dictionary["SHARED"] == "yes")
+ // These database drivers and image formats can be built-in or plugins.
+ // Prefer plugins when Qt is shared.
+ if (dictionary[ "SHARED" ] == "yes") {
+ if (option == "SQL_MYSQL"
+ || option == "SQL_MYSQL"
+ || option == "SQL_ODBC"
+ || option == "SQL_OCI"
+ || option == "SQL_PSQL"
+ || option == "SQL_TDS"
+ || option == "SQL_DB2"
+ || option == "SQL_SQLITE"
+ || option == "SQL_SQLITE2"
+ || option == "SQL_IBASE"
+ || option == "JPEG"
+ || option == "MNG"
+ || option == "TIFF"
+ || option == "GIF")
return "plugin";
- else
- return "yes";
}
// By default we do not want to compile OCI driver when compiling with
@@ -1981,18 +1978,6 @@ QString Configure::defaultTo(const QString &option)
&& option == "SQL_OCI")
return "no";
- if (option == "SQL_MYSQL"
- || option == "SQL_MYSQL"
- || option == "SQL_ODBC"
- || option == "SQL_OCI"
- || option == "SQL_PSQL"
- || option == "SQL_TDS"
- || option == "SQL_DB2"
- || option == "SQL_SQLITE"
- || option == "SQL_SQLITE2"
- || option == "SQL_IBASE")
- return "plugin";
-
if (option == "SYNCQT"
&& (!QFile::exists(sourcePath + "/bin/syncqt") ||
!QFile::exists(sourcePath + "/bin/syncqt.bat")))
@@ -2469,14 +2454,14 @@ void Configure::generateOutputVars()
if (dictionary[ "PNG" ] == "no")
qtConfig += "no-png";
- else if( dictionary[ "PNG" ] == "qt" )
+ else if (dictionary[ "PNG" ] == "yes")
qtConfig += "png";
if (dictionary[ "LIBPNG" ] == "system")
qtConfig += "system-png";
if (dictionary[ "MNG" ] == "no")
qtConfig += "no-mng";
- else if( dictionary[ "MNG" ] == "qt" )
+ else if (dictionary[ "MNG" ] == "yes")
qtConfig += "mng";
if (dictionary[ "LIBMNG" ] == "system")
qtConfig += "system-mng";