QT_BEGIN_NAMESPACE
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats")))
#endif
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.
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
#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.
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
#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;
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
return format;
}
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
void supportedImageHandlerFormats(QFactoryLoader *loader,
QImageIOPlugin::Capability cap,
QSet<QByteArray> *result);
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)
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats")))
#endif
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
// 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;
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.
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()) {
}
}
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
if (!testFormat.isEmpty()) {
const int keyCount = keyMap.keys().size();
for (int i = 0; i < keyCount; ++i) {
}
}
}
-#endif // QT_NO_LIBRARY
+#endif // QT_NO_IMAGEFORMATPLUGIN
if (!handler)
return 0;
}
-#ifndef QT_NO_LIBRARY
+#ifndef QT_NO_IMAGEFORMATPLUGIN
void supportedImageHandlerFormats(QFactoryLoader *loader,
QImageIOPlugin::Capability cap,
QSet<QByteArray> *result)
result->insert(key);
}
}
-#endif // QT_NO_LIBRARY
+#endif // QT_NO_IMAGEFORMATPLUGIN
/*!
Returns the list of image formats supported by QImageWriter.
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)