src/gui/image/qimagereader.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
   139 #include <private/qxbmhandler_p.h>
   139 #include <private/qxbmhandler_p.h>
   140 #include <private/qxpmhandler_p.h>
   140 #include <private/qxpmhandler_p.h>
   141 #ifndef QT_NO_IMAGEFORMAT_PNG
   141 #ifndef QT_NO_IMAGEFORMAT_PNG
   142 #include <private/qpnghandler_p.h>
   142 #include <private/qpnghandler_p.h>
   143 #endif
   143 #endif
       
   144 #ifndef QT_NO_IMAGEFORMAT_JPEG
       
   145 #include <private/qjpeghandler_p.h>
       
   146 #endif
       
   147 #ifndef QT_NO_IMAGEFORMAT_MNG
       
   148 #include <private/qmnghandler_p.h>
       
   149 #endif
       
   150 #ifndef QT_NO_IMAGEFORMAT_TIFF
       
   151 #include <private/qtiffhandler_p.h>
       
   152 #endif
       
   153 #ifdef QT_BUILTIN_GIF_READER
       
   154 #include <private/qgifhandler_p.h>
       
   155 #endif
   144 
   156 
   145 QT_BEGIN_NAMESPACE
   157 QT_BEGIN_NAMESPACE
   146 
   158 
   147 #ifndef QT_NO_LIBRARY
   159 #ifndef QT_NO_LIBRARY
   148 Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
   160 Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
   150 #endif
   162 #endif
   151 
   163 
   152 enum _qt_BuiltInFormatType {
   164 enum _qt_BuiltInFormatType {
   153 #ifndef QT_NO_IMAGEFORMAT_PNG
   165 #ifndef QT_NO_IMAGEFORMAT_PNG
   154     _qt_PngFormat,
   166     _qt_PngFormat,
       
   167 #endif
       
   168 #ifndef QT_NO_IMAGEFORMAT_JPEG
       
   169     _qt_JpgFormat,
       
   170 #endif
       
   171 #ifndef QT_NO_IMAGEFORMAT_MNG
       
   172     _qt_MngFormat,
       
   173 #endif
       
   174 #ifndef QT_NO_IMAGEFORMAT_TIFF
       
   175     _qt_TifFormat,
       
   176 #endif
       
   177 #ifdef QT_BUILTIN_GIF_READER
       
   178     _qt_GifFormat,
   155 #endif
   179 #endif
   156     _qt_BmpFormat,
   180     _qt_BmpFormat,
   157 #ifndef QT_NO_IMAGEFORMAT_PPM
   181 #ifndef QT_NO_IMAGEFORMAT_PPM
   158     _qt_PpmFormat,
   182     _qt_PpmFormat,
   159     _qt_PgmFormat,
   183     _qt_PgmFormat,
   176 };
   200 };
   177 
   201 
   178 static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = {
   202 static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = {
   179 #ifndef QT_NO_IMAGEFORMAT_PNG
   203 #ifndef QT_NO_IMAGEFORMAT_PNG
   180     {_qt_PngFormat, "png"},
   204     {_qt_PngFormat, "png"},
       
   205 #endif
       
   206 #ifndef QT_NO_IMAGEFORMAT_JPEG
       
   207     {_qt_JpgFormat, "jpg"},
       
   208 #endif
       
   209 #ifndef QT_NO_IMAGEFORMAT_MNG
       
   210     {_qt_MngFormat, "mng"},
       
   211 #endif
       
   212 #ifndef QT_NO_IMAGEFORMAT_TIFF
       
   213     {_qt_TifFormat, "tif"},
       
   214 #endif
       
   215 #ifdef QT_BUILTIN_GIF_READER
       
   216     {_qt_GifFormat, "gif"},
   181 #endif
   217 #endif
   182     {_qt_BmpFormat, "bmp"},
   218     {_qt_BmpFormat, "bmp"},
   183 #ifndef QT_NO_IMAGEFORMAT_PPM
   219 #ifndef QT_NO_IMAGEFORMAT_PPM
   184     {_qt_PpmFormat, "ppm"},
   220     {_qt_PpmFormat, "ppm"},
   185     {_qt_PgmFormat, "pgm"},
   221     {_qt_PgmFormat, "pgm"},
   299     // if we don't have a handler yet, check if we have built-in support for
   335     // if we don't have a handler yet, check if we have built-in support for
   300     // the format
   336     // the format
   301     if (!handler && !testFormat.isEmpty()) {
   337     if (!handler && !testFormat.isEmpty()) {
   302         if (false) {
   338         if (false) {
   303 #ifndef QT_NO_IMAGEFORMAT_PNG
   339 #ifndef QT_NO_IMAGEFORMAT_PNG
   304 	} else if (testFormat == "png") {
   340         } else if (testFormat == "png") {
   305             handler = new QPngHandler;
   341             handler = new QPngHandler;
       
   342 #endif
       
   343 #ifndef QT_NO_IMAGEFORMAT_JPEG
       
   344         } else if (testFormat == "jpg" || testFormat == "jpeg") {
       
   345             handler = new QJpegHandler;
       
   346 #endif
       
   347 #ifndef QT_NO_IMAGEFORMAT_MNG
       
   348         } else if (testFormat == "mng") {
       
   349             handler = new QMngHandler;
       
   350 #endif
       
   351 #ifndef QT_NO_IMAGEFORMAT_TIFF
       
   352         } else if (testFormat == "tif" || testFormat == "tiff") {
       
   353             handler = new QTiffHandler;
       
   354 #endif
       
   355 #ifdef QT_BUILTIN_GIF_READER
       
   356         } else if (testFormat == "gif") {
       
   357             handler = new QGifHandler;
   306 #endif
   358 #endif
   307 #ifndef QT_NO_IMAGEFORMAT_BMP
   359 #ifndef QT_NO_IMAGEFORMAT_BMP
   308         } else if (testFormat == "bmp") {
   360         } else if (testFormat == "bmp") {
   309             handler = new QBmpHandler;
   361             handler = new QBmpHandler;
   310 #endif
   362 #endif
   376             switch (formatStruct->type) {
   428             switch (formatStruct->type) {
   377 #ifndef QT_NO_IMAGEFORMAT_PNG
   429 #ifndef QT_NO_IMAGEFORMAT_PNG
   378             case _qt_PngFormat:
   430             case _qt_PngFormat:
   379                 if (QPngHandler::canRead(device))
   431                 if (QPngHandler::canRead(device))
   380                     handler = new QPngHandler;
   432                     handler = new QPngHandler;
       
   433                 break;
       
   434 #endif
       
   435 #ifndef QT_NO_IMAGEFORMAT_JPEG
       
   436             case _qt_JpgFormat:
       
   437                 if (QJpegHandler::canRead(device))
       
   438                     handler = new QJpegHandler;
       
   439                 break;
       
   440 #endif
       
   441 #ifndef QT_NO_IMAGEFORMAT_MNG
       
   442             case _qt_MngFormat:
       
   443                 if (QMngHandler::canRead(device))
       
   444                     handler = new QMngHandler;
       
   445                 break;
       
   446 #endif
       
   447 #ifndef QT_NO_IMAGEFORMAT_TIFF
       
   448             case _qt_TifFormat:
       
   449                 if (QTiffHandler::canRead(device))
       
   450                     handler = new QTiffHandler;
       
   451                 break;
       
   452 #endif
       
   453 #ifdef QT_BUILTIN_GIF_READER
       
   454             case _qt_GifFormat:
       
   455                 if (QGifHandler::canRead(device))
       
   456                     handler = new QGifHandler;
   381                 break;
   457                 break;
   382 #endif
   458 #endif
   383 #ifndef QT_NO_IMAGEFORMAT_BMP
   459 #ifndef QT_NO_IMAGEFORMAT_BMP
   384             case _qt_BmpFormat:
   460             case _qt_BmpFormat:
   385                 if (QBmpHandler::canRead(device))
   461                 if (QBmpHandler::canRead(device))