Make qtbase compile with QT_NO_IMAGEFORMATPLUGIN
authorTasuku Suzuki <stasuku@gmail.com>
Wed, 5 Dec 2012 01:11:54 +0000 (10:11 +0900)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 5 Dec 2012 14:30:07 +0000 (15:30 +0100)
Change-Id: I1fef96481fa902cfd9de63fa814f70412eee4d15
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: aavit <eirik.aavitsland@digia.com>
src/corelib/global/qfeatures.h
src/corelib/global/qfeatures.txt
src/gui/image/qimageiohandler.cpp
src/gui/image/qimageiohandler.h
src/gui/image/qimagereader.cpp
src/gui/image/qimagewriter.cpp
src/plugins/imageformats/gif/main.h

index d2c1095..a63d3a3 100644 (file)
@@ -91,9 +91,6 @@
 // QHostInfo
 //#define QT_NO_HOSTINFO
 
-// QImageIOPlugin
-//#define QT_NO_IMAGEFORMATPLUGIN
-
 // BMP Image Format
 //#define QT_NO_IMAGEFORMAT_BMP
 
index d627f38..ad1ca5a 100644 (file)
@@ -760,7 +760,7 @@ SeeAlso: ???
 Feature: IMAGEFORMATPLUGIN
 Description: Supports writing an image format plugin.
 Section: Images
-Requires:
+Requires: LIBRARY
 Name: QImageIOPlugin
 SeeAlso: ???
 
index 8ec2dea..36757a6 100644 (file)
@@ -514,6 +514,8 @@ int QImageIOHandler::nextImageDelay() const
     return 0;
 }
 
+#ifndef QT_NO_IMAGEFORMATPLUGIN
+
 /*!
     Constructs an image plugin with the given \a parent. This is
     invoked automatically by the moc generated code that exports the plugin.
@@ -554,4 +556,6 @@ QImageIOPlugin::~QImageIOPlugin()
     \sa keys()
 */
 
+#endif // QT_NO_IMAGEFORMATPLUGIN
+
 QT_END_NAMESPACE
index 62f7ba1..1f94099 100644 (file)
@@ -114,6 +114,8 @@ private:
     Q_DISABLE_COPY(QImageIOHandler)
 };
 
+#ifndef QT_NO_IMAGEFORMATPLUGIN
+
 #define QImageIOHandlerFactoryInterface_iid "org.qt-project.Qt.QImageIOHandlerFactoryInterface"
 
 class Q_GUI_EXPORT QImageIOPlugin : public QObject
@@ -136,6 +138,8 @@ public:
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(QImageIOPlugin::Capabilities)
 
+#endif // QT_NO_IMAGEFORMATPLUGIN
+
 QT_END_NAMESPACE
 
 QT_END_HEADER
index a8e8dc0..7e6d937 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
 Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
                           (QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats")))
 #endif
@@ -223,23 +223,23 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
 
     QByteArray form = format.toLower();
     QImageIOHandler *handler = 0;
+    QByteArray suffix;
 
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
     typedef QMultiMap<int, QString> PluginKeyMap;
 
     // check if we have plugins that support the image format
     QFactoryLoader *l = loader();
     const PluginKeyMap keyMap = l->keyMap();
-#endif
-    QByteArray suffix;
 
 #ifdef QIMAGEREADER_DEBUG
     qDebug() << "QImageReader::createReadHandler( device =" << (void *)device << ", format =" << format << "),"
              << keyMap.values().size() << "plugins available: " << keyMap.values();
 #endif
 
-#ifndef QT_NO_LIBRARY
     int suffixPluginIndex = -1;
+#endif // QT_NO_IMAGEFORMATPLUGIN
+
     if (device && format.isEmpty() && autoDetectImageFormat && !ignoresFormatAndExtension) {
         // if there's no format, see if \a device is a file, and if so, find
         // the file suffix and find support for that format among our plugins.
@@ -249,6 +249,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
             qDebug() << "QImageReader::createReadHandler: device is a file:" << file->fileName();
 #endif
             if (!(suffix = QFileInfo(file->fileName()).suffix().toLower().toLatin1()).isEmpty()) {
+#ifndef QT_NO_IMAGEFORMATPLUGIN
                 const int index = keyMap.key(QString::fromLatin1(suffix), -1);
                 if (index != -1) {
 #ifdef QIMAGEREADER_DEBUG
@@ -257,17 +258,17 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
 #endif
                     suffixPluginIndex = index;
                 }
+#endif // QT_NO_IMAGEFORMATPLUGIN
             }
         }
     }
-#endif // QT_NO_LIBRARY
 
     QByteArray testFormat = !form.isEmpty() ? form : suffix;
 
     if (ignoresFormatAndExtension)
         testFormat = QByteArray();
 
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
     if (suffixPluginIndex != -1) {
         // check if the plugin that claims support for this format can load
         // from this device with this format.
@@ -322,7 +323,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
             device->seek(pos);
     }
 
-#endif // QT_NO_LIBRARY
+#endif // QT_NO_IMAGEFORMATPLUGIN
 
     // if we don't have a handler yet, check if we have built-in support for
     // the format
@@ -369,7 +370,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
 #endif
     }
 
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
     if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) {
         // check if any of our plugins recognize the file from its contents.
         const qint64 pos = device ? device->pos() : 0;
@@ -389,7 +390,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
         if (device && !device->isSequential())
             device->seek(pos);
     }
-#endif // QT_NO_LIBRARY
+#endif // QT_NO_IMAGEFORMATPLUGIN
 
     if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) {
         // check if any of our built-in handlers recognize the file from its
@@ -1429,7 +1430,7 @@ QByteArray QImageReader::imageFormat(QIODevice *device)
     return format;
 }
 
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
 void supportedImageHandlerFormats(QFactoryLoader *loader,
                                   QImageIOPlugin::Capability cap,
                                   QSet<QByteArray> *result);
@@ -1471,9 +1472,9 @@ QList<QByteArray> QImageReader::supportedImageFormats()
     for (int i = 0; i < _qt_NumFormats; ++i)
         formats << _qt_BuiltInFormats[i].extension;
 
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
     supportedImageHandlerFormats(loader(), QImageIOPlugin::CanRead, &formats);
-#endif // QT_NO_LIBRARY
+#endif // QT_NO_IMAGEFORMATPLUGIN
 
     QList<QByteArray> sortedFormats;
     for (QSet<QByteArray>::ConstIterator it = formats.constBegin(); it != formats.constEnd(); ++it)
index 8e5fd5f..6085a0e 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
 Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
                           (QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats")))
 #endif
@@ -136,7 +136,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
     QByteArray suffix;
     QImageIOHandler *handler = 0;
 
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
     typedef QMultiMap<int, QString> PluginKeyMap;
 
     // check if any plugins can write the image
@@ -151,7 +151,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
         // this allows plugins to override our built-in handlers.
         if (QFile *file = qobject_cast<QFile *>(device)) {
             if (!(suffix = QFileInfo(file->fileName()).suffix().toLower().toLatin1()).isEmpty()) {
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
                 const int index = keyMap.key(QString::fromLatin1(suffix), -1);
                 if (index != -1)
                     suffixPluginIndex = index;
@@ -162,7 +162,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
 
     QByteArray testFormat = !form.isEmpty() ? form : suffix;
 
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
     if (suffixPluginIndex != -1) {
         // when format is missing, check if we can find a plugin for the
         // suffix.
@@ -173,7 +173,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
                 handler = plugin->create(device, suffix);
         }
     }
-#endif // QT_NO_LIBRARY
+#endif // QT_NO_IMAGEFORMATPLUGIN
 
     // check if any built-in handlers can write the image
     if (!handler && !testFormat.isEmpty()) {
@@ -214,7 +214,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
         }
     }
 
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
     if (!testFormat.isEmpty()) {
         const int keyCount = keyMap.keys().size();
         for (int i = 0; i < keyCount; ++i) {
@@ -226,7 +226,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
             }
         }
     }
-#endif // QT_NO_LIBRARY
+#endif // QT_NO_IMAGEFORMATPLUGIN
 
     if (!handler)
         return 0;
@@ -655,7 +655,7 @@ bool QImageWriter::supportsOption(QImageIOHandler::ImageOption option) const
 }
 
 
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
 void supportedImageHandlerFormats(QFactoryLoader *loader,
                                   QImageIOPlugin::Capability cap,
                                   QSet<QByteArray> *result)
@@ -677,7 +677,7 @@ void supportedImageHandlerFormats(QFactoryLoader *loader,
             result->insert(key);
     }
 }
-#endif // QT_NO_LIBRARY
+#endif // QT_NO_IMAGEFORMATPLUGIN
 
 /*!
     Returns the list of image formats supported by QImageWriter.
@@ -729,9 +729,9 @@ QList<QByteArray> QImageWriter::supportedImageFormats()
     formats << "gif";
 #endif
 
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
     supportedImageHandlerFormats(loader(), QImageIOPlugin::CanWrite, &formats);
-#endif // QT_NO_LIBRARY
+#endif // QT_NO_IMAGEFORMATPLUGIN
 
     QList<QByteArray> sortedFormats;
     for (QSet<QByteArray>::ConstIterator it = formats.constBegin(); it != formats.constEnd(); ++it)
index 46d669a..c7770ed 100644 (file)
@@ -42,6 +42,8 @@
 #include <qimageiohandler.h>
 #include <qstringlist.h>
 
+#ifndef QT_NO_IMAGEFORMATPLUGIN
+
 #ifdef QT_NO_IMAGEFORMAT_GIF
 #undef QT_NO_IMAGEFORMAT_GIF
 #endif
@@ -62,3 +64,5 @@ public:
 };
 
 QT_END_NAMESPACE
+
+#endif // QT_NO_IMAGEFORMATPLUGIN