src/plugins/imageformats/svg/main.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    60     QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const;
    60     QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const;
    61 };
    61 };
    62 
    62 
    63 QStringList QSvgPlugin::keys() const
    63 QStringList QSvgPlugin::keys() const
    64 {
    64 {
    65     return QStringList() << QLatin1String("svg");
    65     return QStringList() << QLatin1String("svg") << QLatin1String("svgz");
    66 }
    66 }
    67 
    67 
    68 QImageIOPlugin::Capabilities QSvgPlugin::capabilities(QIODevice *device, const QByteArray &format) const
    68 QImageIOPlugin::Capabilities QSvgPlugin::capabilities(QIODevice *device, const QByteArray &format) const
    69 {
    69 {
    70     //### canRead disabled for now because it's hard to detect
    70     if (format == "svg" || format == "svgz")
    71     //    whether the file is actually svg without parsing it
       
    72     //if (device->isReadable() && QSvgIOHandler::canRead(device))
       
    73 
       
    74     if (format == "svg")
       
    75         return Capabilities(CanRead);
    71         return Capabilities(CanRead);
    76     else
    72     if (!format.isEmpty())
    77         return 0;
       
    78 
       
    79 
       
    80     if (!device->isOpen())
       
    81         return 0;
    73         return 0;
    82 
    74 
    83     Capabilities cap;
    75     Capabilities cap;
    84     if (device->isReadable())
    76     if (device->isReadable() && QSvgIOHandler::canRead(device))
    85         cap |= CanRead;
    77         cap |= CanRead;
    86     return cap;
    78     return cap;
    87 }
    79 }
    88 
    80 
    89 QImageIOHandler *QSvgPlugin::create(QIODevice *device, const QByteArray &format) const
    81 QImageIOHandler *QSvgPlugin::create(QIODevice *device, const QByteArray &format) const