From bef2393f6edab638ca3df730be94426646cb2357 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 1 Jul 2016 11:38:31 +0000 Subject: [PATCH] get rid of QPictureIO Signed-off-by: Ivailo Monev --- README | 1 + src/core/global/qconfig.h.cmake | 1 + src/gui/CMakeLists.txt | 3 - src/gui/image/image.cmake | 2 - src/gui/image/qpicture.cpp | 1149 ++--------------- src/gui/image/qpicture.h | 71 +- src/gui/image/qpictureformatplugin.cpp | 142 -- src/gui/image/qpictureformatplugin.h | 93 -- src/shared/qclass_lib_map.h | 5 +- .../qgraphicslayout/tst_qgraphicslayout.cpp | 2 +- 10 files changed, 98 insertions(+), 1371 deletions(-) delete mode 100644 src/gui/image/qpictureformatplugin.cpp delete mode 100644 src/gui/image/qpictureformatplugin.h diff --git a/README b/README index 158165a7a..1d5a413df 100644 --- a/README +++ b/README @@ -24,6 +24,7 @@ There are several things you should be aware before considering Katie: - Symbian, QWS and QPA are no longer supported platforms - OpenVG is no longer supported graphics output - Blitter is no longer supported painting engine + - QPictureIO and plugins for it are no longer supported - QML debugger and inspector have been removed, potentially dangerous - removed non-open source DB2, OCI and TDS database drivers - removed 3rd party sources that are very common nowdays diff --git a/src/core/global/qconfig.h.cmake b/src/core/global/qconfig.h.cmake index 858a04362..9364ca3ed 100644 --- a/src/core/global/qconfig.h.cmake +++ b/src/core/global/qconfig.h.cmake @@ -52,6 +52,7 @@ #define QT_NO_DIRECTPAINTER #define QT_NO_COP #define QT_NO_BLITTABLE +#define QT_NO_PICTUREIO /* Qt build specs */ #ifndef QT_EDITION diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 57d6f1cc4..a4e62dfab 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -183,9 +183,6 @@ set(GUI_PUBLIC_HEADERS QPanGesture QPen QPicture - QPictureFormatInterface - QPictureFormatPlugin - QPictureIO QPixmap QPixmapCache QPlainTextDocumentLayout diff --git a/src/gui/image/image.cmake b/src/gui/image/image.cmake index 8f4d18531..5a723c10e 100644 --- a/src/gui/image/image.cmake +++ b/src/gui/image/image.cmake @@ -16,7 +16,6 @@ set(GUI_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/image/qpaintengine_pic_p.h ${CMAKE_CURRENT_SOURCE_DIR}/image/qpicture.h ${CMAKE_CURRENT_SOURCE_DIR}/image/qpicture_p.h - ${CMAKE_CURRENT_SOURCE_DIR}/image/qpictureformatplugin.h ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap.h ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap_raster_p.h ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmapcache.h @@ -46,7 +45,6 @@ set(GUI_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/image/qimagewriter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/image/qpaintengine_pic.cpp ${CMAKE_CURRENT_SOURCE_DIR}/image/qpicture.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/image/qpictureformatplugin.cpp ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap.cpp ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmapcache.cpp ${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmapdata.cpp diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index daeb58293..78f4054f4 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -109,40 +109,18 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, const char *qt_mfhdr_tag = "QPIC"; // header tag static const quint16 mfhdr_maj = 11; // major version # -static const quint16 mfhdr_min = 0; // minor version # /*! Constructs an empty picture. - - The \a formatVersion parameter may be used to \e create a QPicture - that can be read by applications that are compiled with earlier - versions of Qt. - - Note that the default formatVersion is -1 which signifies the - current release, i.e. for Qt 4.0 a formatVersion of 7 is the same - as the default formatVersion of -1. - - Reading pictures generated by earlier versions of Qt is not - supported in Qt 4.0. */ -QPicture::QPicture(int formatVersion) +QPicture::QPicture() : QPaintDevice(), d_ptr(new QPicturePrivate) { Q_D(QPicture); - if (formatVersion == 0) - qWarning("QPicture: invalid format version 0"); - - // still accept the 0 default from before Qt 3.0. - if (formatVersion > 0 && formatVersion != (int)mfhdr_maj) { - d->formatMajor = formatVersion; - d->formatMinor = 0; - d->formatOk = false; - } else { - d->resetFormat(); - } + d->formatOk = false; } /*! @@ -171,7 +149,7 @@ QPicture::~QPicture() } /*! - \internal + ### document what this is returning */ int QPicture::devType() const { @@ -240,7 +218,7 @@ void QPicture::setData(const char* data, uint size) { detach(); d_func()->pictb.setData(data, size); - d_func()->resetFormat(); // we'll have to check + d_func()->formatOk = false; // we'll have to check } @@ -248,18 +226,15 @@ void QPicture::setData(const char* data, uint size) Loads a picture from the file specified by \a fileName and returns true if successful; otherwise returns false. - Please note that the \a format parameter has been deprecated and - will have no effect. - \sa save() */ -bool QPicture::load(const QString &fileName, const char *format) +bool QPicture::load(const QString &fileName) { QFile f(fileName); if (!f.open(QIODevice::ReadOnly)) return false; - return load(&f, format); + return load(&f); } /*! @@ -268,25 +243,8 @@ bool QPicture::load(const QString &fileName, const char *format) \a dev is the device to use for loading. */ -bool QPicture::load(QIODevice *dev, const char *format) +bool QPicture::load(QIODevice *dev) { - if(format) { -#ifndef QT_NO_PICTUREIO - QPictureIO io(dev, format); - bool result = io.read(); - if (result) { - operator=(io.picture()); - - } else if (format) -#else - bool result = false; -#endif - { - qWarning("QPicture::load: No such picture format: %s", format); - } - return result; - } - detach(); QByteArray a = dev->readAll(); @@ -298,13 +256,10 @@ bool QPicture::load(QIODevice *dev, const char *format) Saves a picture to the file specified by \a fileName and returns true if successful; otherwise returns false. - Please note that the \a format parameter has been deprecated and - will have no effect. - \sa load() */ -bool QPicture::save(const QString &fileName, const char *format) +bool QPicture::save(const QString &fileName) { if (paintingActive()) { qWarning("QPicture::save: still being painted on. " @@ -312,27 +267,10 @@ bool QPicture::save(const QString &fileName, const char *format) return false; } - - if(format) { -#ifndef QT_NO_PICTUREIO - QPictureIO io(fileName, format); - bool result = io.write(); - if (result) { - operator=(io.picture()); - } else if (format) -#else - bool result = false; -#endif - { - qWarning("QPicture::save: No such picture format: %s", format); - } - return result; - } - QFile f(fileName); if (!f.open(QIODevice::WriteOnly)) return false; - return save(&f, format); + return save(&f); } /*! @@ -341,7 +279,7 @@ bool QPicture::save(const QString &fileName, const char *format) \a dev is the device to use for saving. */ -bool QPicture::save(QIODevice *dev, const char *format) +bool QPicture::save(QIODevice *dev) { if (paintingActive()) { qWarning("QPicture::save: still being painted on. " @@ -349,22 +287,6 @@ bool QPicture::save(QIODevice *dev, const char *format) return false; } - if(format) { -#ifndef QT_NO_PICTUREIO - QPictureIO io(dev, format); - bool result = io.write(); - if (result) { - operator=(io.picture()); - } else if (format) -#else - bool result = false; -#endif - { - qWarning("QPicture::save: No such picture format: %s", format); - } - return result; - } - dev->write(d_func()->pictb.buffer(), d_func()->pictb.buffer().size()); return true; } @@ -419,17 +341,15 @@ bool QPicture::play(QPainter *painter) QDataStream s; s.setDevice(&d->pictb); // attach data stream to buffer s.device()->seek(10); // go directly to the data - s.setVersion(d->formatMajor == 4 ? 3 : d->formatMajor); + s.setVersion(mfhdr_maj); quint8 c, clen; quint32 nrecords; s >> c >> clen; Q_ASSERT(c == QPicturePrivate::PdcBegin); // bounding rect was introduced in ver 4. Read in checkFormat(). - if (d->formatMajor >= 4) { - qint32 dummy; - s >> dummy >> dummy >> dummy >> dummy; - } + qint32 dummy; + s >> dummy >> dummy >> dummy >> dummy; s >> nrecords; if (!exec(painter, s, nrecords)) { qWarning("QPicture::play: Format error"); @@ -525,13 +445,8 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) case QPicturePrivate::PdcNOP: break; case QPicturePrivate::PdcDrawPoint: - if (d->formatMajor <= 5) { - s >> ip; - painter->drawPoint(ip); - } else { - s >> p; - painter->drawPoint(p); - } + s >> p; + painter->drawPoint(p); break; case QPicturePrivate::PdcDrawPoints: // ## implement me in the picture paint engine @@ -545,69 +460,31 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) break; } case QPicturePrivate::PdcDrawLine: - if (d->formatMajor <= 5) { - s >> ip1 >> ip2; - painter->drawLine(ip1, ip2); - } else { - s >> p1 >> p2; - painter->drawLine(p1, p2); - } + s >> p1 >> p2; + painter->drawLine(p1, p2); break; case QPicturePrivate::PdcDrawRect: - if (d->formatMajor <= 5) { - s >> ir; - painter->drawRect(ir); - } else { - s >> r; - painter->drawRect(r); - } + s >> r; + painter->drawRect(r); break; case QPicturePrivate::PdcDrawRoundRect: - if (d->formatMajor <= 5) { - s >> ir >> i1_16 >> i2_16; - painter->drawRoundedRect(ir, i1_16, i2_16, Qt::RelativeSize); - } else { - s >> r >> i1_16 >> i2_16; - painter->drawRoundedRect(r, i1_16, i2_16, Qt::RelativeSize); - } + s >> r >> i1_16 >> i2_16; + painter->drawRoundedRect(r, i1_16, i2_16, Qt::RelativeSize); break; case QPicturePrivate::PdcDrawEllipse: - if (d->formatMajor <= 5) { - s >> ir; - painter->drawEllipse(ir); - } else { - s >> r; - painter->drawEllipse(r); - } + s >> r; + painter->drawEllipse(r); break; case QPicturePrivate::PdcDrawArc: - if (d->formatMajor <= 5) { - s >> ir; - r = ir; - } else { - s >> r; - } - s >> i1_16 >> i2_16; + s >> r >> i1_16 >> i2_16; painter->drawArc(r, i1_16, i2_16); break; case QPicturePrivate::PdcDrawPie: - if (d->formatMajor <= 5) { - s >> ir; - r = ir; - } else { - s >> r; - } - s >> i1_16 >> i2_16; + s >> r >> i1_16 >> i2_16; painter->drawPie(r, i1_16, i2_16); break; case QPicturePrivate::PdcDrawChord: - if (d->formatMajor <= 5) { - s >> ir; - r = ir; - } else { - s >> r; - } - s >> i1_16 >> i2_16; + s >> r >> i1_16 >> i2_16; painter->drawChord(r, i1_16, i2_16); break; case QPicturePrivate::PdcDrawLineSegments: @@ -616,26 +493,14 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) ia.clear(); break; case QPicturePrivate::PdcDrawPolyline: - if (d->formatMajor <= 5) { - s >> ia; - painter->drawPolyline(ia); - ia.clear(); - } else { - s >> a; - painter->drawPolyline(a); - a.clear(); - } + s >> a; + painter->drawPolyline(a); + a.clear(); break; case QPicturePrivate::PdcDrawPolygon: - if (d->formatMajor <= 5) { - s >> ia >> i_8; - painter->drawPolygon(ia, i_8 ? Qt::WindingFill : Qt::OddEvenFill); - a.clear(); - } else { - s >> a >> i_8; - painter->drawPolygon(a, i_8 ? Qt::WindingFill : Qt::OddEvenFill); - a.clear(); - } + s >> a >> i_8; + painter->drawPolygon(a, i_8 ? Qt::WindingFill : Qt::OddEvenFill); + a.clear(); break; case QPicturePrivate::PdcDrawCubicBezier: { s >> ia; @@ -656,13 +521,8 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) painter->drawText(ir, i_16, QString::fromLatin1(str1)); break; case QPicturePrivate::PdcDrawText2: - if (d->formatMajor <= 5) { - s >> ip >> str; - painter->drawText(ip, str); - } else { - s >> p >> str; - painter->drawText(p, str); - } + s >> p >> str; + painter->drawText(p, str); break; case QPicturePrivate::PdcDrawText2Formatted: s >> ir; @@ -676,60 +536,46 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) // the text layout direction is not used here because it's already // aligned when QPicturePaintEngine::drawTextItem() serializes the // drawText() call, therefore ul is unsed in this context - - if (d->formatMajor >= 9) { - s >> dbl; - QFont fnt(font); - if (dbl != 1.0) { - QFakeDevice fake; - fake.setDpiX(qRound(dbl*qt_defaultDpiX())); - fake.setDpiY(qRound(dbl*qt_defaultDpiY())); - fnt = QFont(font, &fake); - } - - qreal justificationWidth; - s >> justificationWidth; - - int flags = Qt::TextSingleLine | Qt::TextDontClip | Qt::TextForceLeftToRight; - - QSizeF size(1, 1); - if (justificationWidth > 0) { - size.setWidth(justificationWidth); - flags |= Qt::TextJustificationForced; - flags |= Qt::AlignJustify; - } - - QFontMetrics fm(fnt); - QPointF pt(p.x(), p.y() - fm.ascent()); - qt_format_text(fnt, QRectF(pt, size), flags, /*opt*/0, - str, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter); - } else { - qt_format_text(font, QRectF(p, QSizeF(1, 1)), Qt::TextSingleLine | Qt::TextDontClip, /*opt*/0, - str, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter); + s >> dbl; + QFont fnt(font); + if (dbl != 1.0) { + QFakeDevice fake; + fake.setDpiX(qRound(dbl*qt_defaultDpiX())); + fake.setDpiY(qRound(dbl*qt_defaultDpiY())); + fnt = QFont(font, &fake); } + qreal justificationWidth; + s >> justificationWidth; + + int flags = Qt::TextSingleLine | Qt::TextDontClip | Qt::TextForceLeftToRight; + + QSizeF size(1, 1); + if (justificationWidth > 0) { + size.setWidth(justificationWidth); + flags |= Qt::TextJustificationForced; + flags |= Qt::AlignJustify; + } + + QFontMetrics fm(fnt); + QPointF pt(p.x(), p.y() - fm.ascent()); + qt_format_text(fnt, QRectF(pt, size), flags, /*opt*/0, + str, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter); + break; } case QPicturePrivate::PdcDrawPixmap: { QPixmap pixmap; - if (d->formatMajor < 4) { - s >> ip >> pixmap; - painter->drawPixmap(ip, pixmap); - } else if (d->formatMajor <= 5) { - s >> ir >> pixmap; - painter->drawPixmap(ir, pixmap); + QRectF sr; + if (d->in_memory_only) { + int index; + s >> r >> index >> sr; + Q_ASSERT(index < d->pixmap_list.size()); + pixmap = d->pixmap_list.at(index); } else { - QRectF sr; - if (d->in_memory_only) { - int index; - s >> r >> index >> sr; - Q_ASSERT(index < d->pixmap_list.size()); - pixmap = d->pixmap_list.at(index); - } else { - s >> r >> pixmap >> sr; - } - painter->drawPixmap(r, pixmap, sr); + s >> r >> pixmap >> sr; } + painter->drawPixmap(r, pixmap, sr); } break; case QPicturePrivate::PdcDrawTiledPixmap: { @@ -747,24 +593,16 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) break; case QPicturePrivate::PdcDrawImage: { QImage image; - if (d->formatMajor < 4) { - s >> p >> image; - painter->drawImage(p, image); - } else if (d->formatMajor <= 5){ - s >> ir >> image; - painter->drawImage(ir, image, QRect(0, 0, ir.width(), ir.height())); + QRectF sr; + if (d->in_memory_only) { + int index; + s >> r >> index >> sr >> ul; + Q_ASSERT(index < d->image_list.size()); + image = d->image_list.at(index); } else { - QRectF sr; - if (d->in_memory_only) { - int index; - s >> r >> index >> sr >> ul; - Q_ASSERT(index < d->image_list.size()); - image = d->image_list.at(index); - } else { - s >> r >> image >> sr >> ul; - } - painter->drawImage(r, image, sr, Qt::ImageConversionFlags(ul)); + s >> r >> image >> sr >> ul; } + painter->drawImage(r, image, sr, Qt::ImageConversionFlags(ul)); } break; case QPicturePrivate::PdcBegin: @@ -794,13 +632,8 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) s >> i_8; break; case QPicturePrivate::PdcSetBrushOrigin: - if (d->formatMajor <= 5) { - s >> ip; - painter->setBrushOrigin(ip); - } else { - s >> p; - painter->setBrushOrigin(p); - } + s >> p; + painter->setBrushOrigin(p); break; case QPicturePrivate::PdcSetFont: s >> font; @@ -833,34 +666,19 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) painter->setViewTransformEnabled(i_8); break; case QPicturePrivate::PdcSetWindow: - if (d->formatMajor <= 5) { - s >> ir; - painter->setWindow(ir); - } else { - s >> r; - painter->setWindow(r.toRect()); - } + s >> r; + painter->setWindow(r.toRect()); break; case QPicturePrivate::PdcSetViewport: - if (d->formatMajor <= 5) { - s >> ir; - painter->setViewport(ir); - } else { - s >> r; - painter->setViewport(r.toRect()); - } + s >> r; + painter->setViewport(r.toRect()); break; case QPicturePrivate::PdcSetWXform: s >> i_8; painter->setMatrixEnabled(i_8); break; case QPicturePrivate::PdcSetWMatrix: - if (d->formatMajor >= 8) { - s >> matrix >> i_8; - } else { - s >> wmatrix >> i_8; - matrix = QTransform(wmatrix); - } + s >> matrix >> i_8; // i_8 is always false due to updateXForm() in qpaintengine_pic.cpp painter->setTransform(matrix * worldMatrix, i_8); break; @@ -870,11 +688,7 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) break; case QPicturePrivate::PdcSetClipRegion: s >> rgn >> i_8; - if (d->formatMajor >= 9) { - painter->setClipRegion(rgn, Qt::ClipOperation(i_8)); - } else { - painter->setClipRegion(rgn); - } + painter->setClipRegion(rgn, Qt::ClipOperation(i_8)); break; case QPicturePrivate::PdcSetClipPath: { @@ -1016,7 +830,6 @@ QPicturePrivate::QPicturePrivate() QPicturePrivate::QPicturePrivate(const QPicturePrivate &other) : trecs(other.trecs), formatOk(other.formatOk), - formatMinor(other.formatMinor), brect(other.brect), override_rect(other.override_rect), in_memory_only(false) @@ -1028,20 +841,6 @@ QPicturePrivate::QPicturePrivate(const QPicturePrivate &other) } } -/*! - \internal - - Sets formatOk to false and resets the format version numbers to default -*/ - -void QPicturePrivate::resetFormat() -{ - formatOk = false; - formatMajor = mfhdr_maj; - formatMinor = mfhdr_min; -} - - /*! \internal @@ -1051,7 +850,7 @@ void QPicturePrivate::resetFormat() */ bool QPicturePrivate::checkFormat() { - resetFormat(); + formatOk = false; // can't check anything in an empty buffer if (pictb.size() == 0 || pictb.isOpen()) @@ -1091,16 +890,14 @@ bool QPicturePrivate::checkFormat() pictb.close(); return false; } - s.setVersion(major != 4 ? major : 3); + s.setVersion(major); quint8 c, clen; s >> c >> clen; if (c == QPicturePrivate::PdcBegin) { - if (!(major >= 1 && major <= 3)) { - qint32 l, t, w, h; - s >> l >> t >> w >> h; - brect = QRect(l, t, w, h); - } + qint32 l, t, w, h; + s >> l >> t >> w >> h; + brect = QRect(l, t, w, h); } else { qWarning("QPicturePaintEngine::checkFormat: Format error"); pictb.close(); @@ -1109,8 +906,6 @@ bool QPicturePrivate::checkFormat() pictb.close(); formatOk = true; // picture seems to be ok - formatMajor = major; - formatMinor = minor; return true; } @@ -1159,7 +954,7 @@ QDataStream &operator>>(QDataStream &s, QPicture &r) // "init"; this code is similar to the beginning of QPicture::cmd() sr.setDevice(&r.d_func()->pictb); - sr.setVersion(r.d_func()->formatMajor); + sr.setVersion(mfhdr_maj); quint32 len; s >> len; QByteArray data; @@ -1169,777 +964,11 @@ QDataStream &operator>>(QDataStream &s, QPicture &r) } r.d_func()->pictb.setData(data); - r.d_func()->resetFormat(); + r.d_func()->formatOk = false; return s; } #endif // QT_NO_DATASTREAM - -#ifndef QT_NO_PICTUREIO - -QT_BEGIN_INCLUDE_NAMESPACE -#include "qregexp.h" -#include "qapplication.h" -#include "qpictureformatplugin.h" -QT_END_INCLUDE_NAMESPACE - -/*! - \obsolete - - Returns a string that specifies the picture format of the file \a - fileName, or 0 if the file cannot be read or if the format is not - recognized. - - \sa load() save() -*/ - -const char* QPicture::pictureFormat(const QString &fileName) -{ - return QPictureIO::pictureFormat(fileName); -} - -/*! - \obsolete - - Returns a list of picture formats that are supported for picture - input. - - \sa outputFormats() inputFormatList() QPictureIO -*/ -QList QPicture::inputFormats() -{ - return QPictureIO::inputFormats(); -} - -static QStringList qToStringList(const QList arr) -{ - QStringList list; - for (int i = 0; i < arr.count(); ++i) - list.append(QString::fromLatin1(arr.at(i))); - return list; -} - -/*! - \obsolete - - Returns a list of picture formats that are supported for picture - input. - - Note that if you want to iterate over the list, you should iterate - over a copy, e.g. - \snippet doc/src/snippets/picture/picture.cpp 2 - - \sa outputFormatList() inputFormats() QPictureIO -*/ -QStringList QPicture::inputFormatList() -{ - return qToStringList(QPictureIO::inputFormats()); -} - - -/*! - \obsolete - - Returns a list of picture formats that are supported for picture - output. - - Note that if you want to iterate over the list, you should iterate - over a copy, e.g. - \snippet doc/src/snippets/picture/picture.cpp 3 - - \sa inputFormatList() outputFormats() QPictureIO -*/ -QStringList QPicture::outputFormatList() -{ - return qToStringList(QPictureIO::outputFormats()); -} - -/*! - \obsolete - - Returns a list of picture formats that are supported for picture - output. - - \sa inputFormats() outputFormatList() QPictureIO -*/ -QList QPicture::outputFormats() -{ - return QPictureIO::outputFormats(); -} - -/***************************************************************************** - QPictureIO member functions - *****************************************************************************/ - -/*! - \obsolete - - \class QPictureIO - - \brief The QPictureIO class contains parameters for loading and - saving pictures. - - \ingroup painting - \ingroup io - - QPictureIO contains a QIODevice object that is used for picture data - I/O. The programmer can install new picture file formats in addition - to those that Qt provides. - - You don't normally need to use this class; QPicture::load(), - QPicture::save(). - - \sa QPicture QPixmap QFile -*/ - -struct QPictureIOData -{ - QPicture pi; // picture - int iostat; // IO status - QByteArray frmt; // picture format - QIODevice *iodev; // IO device - QString fname; // file name - QString descr; // picture description - const char *parameters; - int quality; - float gamma; -}; - -/*! - Constructs a QPictureIO object with all parameters set to zero. -*/ - -QPictureIO::QPictureIO() -{ - init(); -} - -/*! - Constructs a QPictureIO object with the I/O device \a ioDevice and a - \a format tag. -*/ - -QPictureIO::QPictureIO(QIODevice *ioDevice, const char *format) -{ - init(); - d->iodev = ioDevice; - d->frmt = format; -} - -/*! - Constructs a QPictureIO object with the file name \a fileName and a - \a format tag. -*/ - -QPictureIO::QPictureIO(const QString &fileName, const char* format) -{ - init(); - d->frmt = format; - d->fname = fileName; -} - -/*! - Contains initialization common to all QPictureIO constructors. -*/ - -void QPictureIO::init() -{ - d = new QPictureIOData(); - d->parameters = 0; - d->quality = -1; // default quality of the current format - d->gamma=0.0f; - d->iostat = 0; - d->iodev = 0; -} - -/*! - Destroys the object and all related data. -*/ - -QPictureIO::~QPictureIO() -{ - if (d->parameters) - delete [] d->parameters; - delete d; -} - - -/***************************************************************************** - QPictureIO picture handler functions - *****************************************************************************/ - -class QPictureHandler -{ -public: - QPictureHandler(const char *f, const char *h, const QByteArray& fl, - picture_io_handler r, picture_io_handler w); - QByteArray format; // picture format - QRegExp header; // picture header pattern - enum TMode { Untranslated=0, TranslateIn, TranslateInOut } text_mode; - picture_io_handler read_picture; // picture read function - picture_io_handler write_picture; // picture write function - bool obsolete; // support not "published" -}; - -QPictureHandler::QPictureHandler(const char *f, const char *h, const QByteArray& fl, - picture_io_handler r, picture_io_handler w) - : format(f), header(QString::fromLatin1(h)) -{ - text_mode = Untranslated; - if (fl.contains('t')) - text_mode = TranslateIn; - else if (fl.contains('T')) - text_mode = TranslateInOut; - obsolete = fl.contains('O'); - read_picture = r; - write_picture = w; -} - -typedef QList QPHList; -Q_GLOBAL_STATIC(QPHList, pictureHandlers) - -#ifndef QT_NO_LIBRARY -Q_GLOBAL_STATIC(QMutex, mutex) -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, factoryLoader, - (QPictureFormatInterface_iid, - QLatin1String("/pictureformats"))) -#endif -void qt_init_picture_plugins() -{ -#ifndef QT_NO_LIBRARY - QMutexLocker locker(mutex()); - QFactoryLoader *loader = factoryLoader(); - QStringList keys = loader->keys(); - for (int i = 0; i < keys.count(); ++i) - if (QPictureFormatInterface *format = qobject_cast(loader->instance(keys.at(i)))) - format->installIOHandler(keys.at(i)); -#endif -} - -static void cleanup() -{ - // make sure that picture handlers are delete before plugin manager - if (QPHList *list = pictureHandlers()) { - qDeleteAll(*list); - list->clear(); - } -} - -void qt_init_picture_handlers() // initialize picture handlers -{ - static QBasicAtomicInt done = Q_BASIC_ATOMIC_INITIALIZER(0); - if (done.testAndSetRelaxed(0, 1)) { - qAddPostRoutine(cleanup); - } -} - -static QPictureHandler *get_picture_handler(const char *format) -{ // get pointer to handler - qt_init_picture_handlers(); - qt_init_picture_plugins(); - if (QPHList *list = pictureHandlers()) { - for (int i = 0; i < list->size(); ++i) { - if (list->at(i)->format == format) - return list->at(i); - } - } - return 0; // no such handler -} - - -/*! - Defines a picture I/O handler for the picture format called \a - format, which is recognized using the regular - expression defined in \a header, read using \a readPicture and - written using \a writePicture. - - \a flags is a string of single-character flags for this format. - The only flag defined currently is T (upper case), so the only - legal value for \a flags are "T" and the empty string. The "T" - flag means that the picture file is a text file, and Qt should treat - all newline conventions as equivalent. (XPM files and some PPM - files are text files for example.) - - \a format is used to select a handler to write a QPicture; \a header - is used to select a handler to read an picture file. - - If \a readPicture is a null pointer, the QPictureIO will not be able - to read pictures in \a format. If \a writePicture is a null pointer, - the QPictureIO will not be able to write pictures in \a format. If - both are null, the QPictureIO object is valid but useless. - - Example: - \snippet doc/src/snippets/picture/picture.cpp 6 - \codeline - \snippet doc/src/snippets/picture/picture.cpp 7 - \codeline - \snippet doc/src/snippets/picture/picture.cpp 8 - - Before the regular expression test, all the 0 bytes in the file header are - converted to 1 bytes. This is done because when Qt was ASCII-based, QRegExp - could not handle 0 bytes in strings. - - The regexp is only applied on the first 14 bytes of the file. - - (Note that if one handlerIO supports writing a format and another - supports reading it, Qt supports both reading and writing. If two - handlers support the same operation, Qt chooses one arbitrarily.) -*/ - -void QPictureIO::defineIOHandler(const char *format, - const char *header, - const char *flags, - picture_io_handler readPicture, - picture_io_handler writePicture) -{ - qt_init_picture_handlers(); - if (QPHList *list = pictureHandlers()) { - QPictureHandler *p; - p = new QPictureHandler(format, header, QByteArray(flags), readPicture, writePicture); - list->prepend(p); - } -} - - -/***************************************************************************** - QPictureIO normal member functions - *****************************************************************************/ - -/*! - Returns the picture currently set. - - \sa setPicture() -*/ -const QPicture &QPictureIO::picture() const { return d->pi; } - -/*! - Returns the picture's IO status. A non-zero value indicates an - error, whereas 0 means that the IO operation was successful. - - \sa setStatus() -*/ -int QPictureIO::status() const { return d->iostat; } - -/*! - Returns the picture format string or 0 if no format has been - explicitly set. -*/ -const char *QPictureIO::format() const { return d->frmt; } - -/*! - Returns the IO device currently set. - - \sa setIODevice() -*/ -QIODevice *QPictureIO::ioDevice() const { return d->iodev; } - -/*! - Returns the file name currently set. - - \sa setFileName() -*/ -QString QPictureIO::fileName() const { return d->fname; } - - -/*! - Returns the picture description string. - - \sa setDescription() -*/ -QString QPictureIO::description() const { return d->descr; } - -/*! - Sets the picture to \a picture. - - \sa picture() -*/ -void QPictureIO::setPicture(const QPicture &picture) -{ - d->pi = picture; -} - -/*! - Sets the picture IO status to \a status. A non-zero value indicates - an error, whereas 0 means that the IO operation was successful. - - \sa status() -*/ -void QPictureIO::setStatus(int status) -{ - d->iostat = status; -} - -/*! - Sets the picture format to \a format for the picture to be read or - written. - - It is necessary to specify a format before writing an picture, but - it is not necessary to specify a format before reading an picture. - - If no format has been set, Qt guesses the picture format before - reading it. If a format is set the picture will only be read if it - has that format. - - \sa read() write() format() -*/ -void QPictureIO::setFormat(const char *format) -{ - d->frmt = format; -} - -/*! - Sets the IO device to be used for reading or writing an picture. - - Setting the IO device allows pictures to be read/written to any - block-oriented QIODevice. - - If \a ioDevice is not null, this IO device will override file name - settings. - - \sa setFileName() -*/ -void QPictureIO::setIODevice(QIODevice *ioDevice) -{ - d->iodev = ioDevice; -} - -/*! - Sets the name of the file to read or write an picture from to \a - fileName. - - \sa setIODevice() -*/ -void QPictureIO::setFileName(const QString &fileName) -{ - d->fname = fileName; -} - -/*! - Returns the quality of the written picture, related to the - compression ratio. - - \sa setQuality() QPicture::save() -*/ -int QPictureIO::quality() const -{ - return d->quality; -} - -/*! - Sets the quality of the written picture to \a q, related to the - compression ratio. - - \a q must be in the range -1..100. Specify 0 to obtain small - compressed files, 100 for large uncompressed files. (-1 signifies - the default compression.) - - \sa quality() QPicture::save() -*/ - -void QPictureIO::setQuality(int q) -{ - d->quality = q; -} - -/*! - Returns the picture's parameters string. - - \sa setParameters() -*/ - -const char *QPictureIO::parameters() const -{ - return d->parameters; -} - -/*! - Sets the picture's parameter string to \a parameters. This is for - picture handlers that require special parameters. - - Although the current picture formats supported by Qt ignore the - parameters string, it may be used in future extensions or by - contributions (for example, JPEG). - - \sa parameters() -*/ - -void QPictureIO::setParameters(const char *parameters) -{ - if (d->parameters) - delete [] (char*)d->parameters; - d->parameters = qstrdup(parameters); -} - -/*! - Sets the gamma value at which the picture will be viewed to \a - gamma. If the picture format stores a gamma value for which the - picture is intended to be used, then this setting will be used to - modify the picture. Setting to 0.0 will disable gamma correction - (i.e. any specification in the file will be ignored). - - The default value is 0.0. - - \sa gamma() -*/ -void QPictureIO::setGamma(float gamma) -{ - d->gamma=gamma; -} - -/*! - Returns the gamma value at which the picture will be viewed. - - \sa setGamma() -*/ -float QPictureIO::gamma() const -{ - return d->gamma; -} - -/*! - Sets the picture description string for picture handlers that support - picture descriptions to \a description. - - Currently, no picture format supported by Qt uses the description - string. -*/ - -void QPictureIO::setDescription(const QString &description) -{ - d->descr = description; -} - - -/*! - Returns a string that specifies the picture format of the file \a - fileName, or null if the file cannot be read or if the format is - not recognized. -*/ - -QByteArray QPictureIO::pictureFormat(const QString &fileName) -{ - QFile file(fileName); - QByteArray format; - if (!file.open(QIODevice::ReadOnly)) - return format; - format = pictureFormat(&file); - file.close(); - return format; -} - -/*! - \overload - - Returns a string that specifies the picture format of the picture read - from IO device \a d, or 0 if the device cannot be read or if the - format is not recognized. - - Make sure that \a d is at the right position in the device (for - example, at the beginning of the file). - - \sa QIODevice::at() -*/ - -QByteArray QPictureIO::pictureFormat(QIODevice *d) -{ - // if you change this change the documentation for defineIOHandler() - const int buflen = 14; - - char buf[buflen]; - char buf2[buflen]; - qt_init_picture_handlers(); - qt_init_picture_plugins(); - int pos = d->pos(); // save position - int rdlen = d->read(buf, buflen); // read a few bytes - - QByteArray format; - if (rdlen != buflen) - return format; - - memcpy(buf2, buf, buflen); - - for (int n = 0; n < rdlen; n++) - if (buf[n] == '\0') - buf[n] = '\001'; - if (rdlen > 0) { - buf[rdlen - 1] = '\0'; - QString bufStr = QString::fromLatin1(buf); - if (QPHList *list = pictureHandlers()) { - for (int i = 0; i < list->size(); ++i) { - if (list->at(i)->header.indexIn(bufStr) != -1) { // try match with headers - format = list->at(i)->format; - break; - } - } - } - } - d->seek(pos); // restore position - return format; -} - -/*! - Returns a sorted list of picture formats that are supported for - picture input. -*/ -QList QPictureIO::inputFormats() -{ - QList result; - - qt_init_picture_handlers(); - qt_init_picture_plugins(); - - if (QPHList *list = pictureHandlers()) { - for (int i = 0; i < list->size(); ++i) { - QPictureHandler *p = list->at(i); - if (p->read_picture && !p->obsolete && !result.contains(p->format)) - result.append(p->format); - } - } - qSort(result); - - return result; -} - -/*! - Returns a sorted list of picture formats that are supported for - picture output. -*/ -QList QPictureIO::outputFormats() -{ - qt_init_picture_handlers(); - qt_init_picture_plugins(); - - QList result; - if (QPHList *list = pictureHandlers()) { - for (int i = 0; i < list->size(); ++i) { - QPictureHandler *p = list->at(i); - if (p->write_picture && !p->obsolete && !result.contains(p->format)) - result.append(p->format); - } - } - return result; -} - - - -/*! - Reads an picture into memory and returns true if the picture was - successfully read; otherwise returns false. - - Before reading an picture you must set an IO device or a file name. - If both an IO device and a file name have been set, the IO device - will be used. - - Setting the picture file format string is optional. - - Note that this function does \e not set the \link format() - format\endlink used to read the picture. If you need that - information, use the pictureFormat() static functions. - - Example: - - \snippet doc/src/snippets/picture/picture.cpp 4 - - \sa setIODevice() setFileName() setFormat() write() QPixmap::load() -*/ -bool QPictureIO::read() -{ - QFile file; - const char *picture_format; - QPictureHandler *h; - - if (d->iodev) { // read from io device - // ok, already open - } else if (!d->fname.isEmpty()) { // read from file - file.setFileName(d->fname); - if (!file.open(QIODevice::ReadOnly)) - return false; // cannot open file - d->iodev = &file; - } else { // no file name or io device - return false; - } - if (d->frmt.isEmpty()) { - // Try to guess format - picture_format = pictureFormat(d->iodev); // get picture format - if (!picture_format) { - if (file.isOpen()) { // unknown format - file.close(); - d->iodev = 0; - } - return false; - } - } else { - picture_format = d->frmt; - } - - h = get_picture_handler(picture_format); - if (file.isOpen()) { -#if !defined(Q_OS_UNIX) - if (h && h->text_mode) { // reopen in translated mode - file.close(); - file.open(QIODevice::ReadOnly | QIODevice::Text); - } - else -#endif - file.seek(0); // position to start - } - d->iostat = 1; // assume error - - if (h && h->read_picture) - (*h->read_picture)(this); - - if (file.isOpen()) { // picture was read using file - file.close(); - d->iodev = 0; - } - return d->iostat == 0; // picture successfully read? -} - - -/*! - Writes an picture to an IO device and returns true if the picture was - successfully written; otherwise returns false. - - Before writing an picture you must set an IO device or a file name. - If both an IO device and a file name have been set, the IO device - will be used. - - The picture will be written using the specified picture format. - - Example: - \snippet doc/src/snippets/picture/picture.cpp 5 - - \sa setIODevice() setFileName() setFormat() read() QPixmap::save() -*/ -bool QPictureIO::write() -{ - if (d->frmt.isEmpty()) - return false; - QPictureHandler *h = get_picture_handler(d->frmt); - if (!h || !h->write_picture) { - qWarning("QPictureIO::write: No such picture format handler: %s", - format()); - return false; - } - QFile file; - if (!d->iodev && !d->fname.isEmpty()) { - file.setFileName(d->fname); - bool translate = h->text_mode==QPictureHandler::TranslateInOut; - QIODevice::OpenMode fmode = translate ? QIODevice::WriteOnly | QIODevice::Text : QIODevice::OpenMode(QIODevice::WriteOnly); - if (!file.open(fmode)) // couldn't create file - return false; - d->iodev = &file; - } - d->iostat = 1; - (*h->write_picture)(this); - if (file.isOpen()) { // picture was written using file - file.close(); - d->iodev = 0; - } - return d->iostat == 0; // picture successfully written? -} -#endif //QT_NO_PICTUREIO - /*! \fn QPicture QPicture::copy() const diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h index dacac652c..59ad86781 100644 --- a/src/gui/image/qpicture.h +++ b/src/gui/image/qpicture.h @@ -58,7 +58,7 @@ class Q_GUI_EXPORT QPicture : public QPaintDevice { Q_DECLARE_PRIVATE(QPicture) public: - explicit QPicture(int formatVersion = -1); + explicit QPicture(); QPicture(const QPicture &); ~QPicture(); @@ -71,10 +71,10 @@ public: bool play(QPainter *p); - bool load(QIODevice *dev, const char *format = 0); - bool load(const QString &fileName, const char *format = 0); - bool save(QIODevice *dev, const char *format = 0); - bool save(const QString &fileName, const char *format = 0); + bool load(QIODevice *dev); + bool load(const QString &fileName); + bool save(QIODevice *dev); + bool save(const QString &fileName); QRect boundingRect() const; void setBoundingRect(const QRect &r); @@ -119,67 +119,6 @@ public: Q_DECLARE_SHARED(QPicture) - -#ifndef QT_NO_PICTUREIO -class QIODevice; -class QPictureIO; -typedef void (*picture_io_handler)(QPictureIO *); // picture IO handler - -struct QPictureIOData; - -class Q_GUI_EXPORT QPictureIO -{ -public: - QPictureIO(); - QPictureIO(QIODevice *ioDevice, const char *format); - QPictureIO(const QString &fileName, const char *format); - ~QPictureIO(); - - const QPicture &picture() const; - int status() const; - const char *format() const; - QIODevice *ioDevice() const; - QString fileName() const; - int quality() const; - QString description() const; - const char *parameters() const; - float gamma() const; - - void setPicture(const QPicture &); - void setStatus(int); - void setFormat(const char *); - void setIODevice(QIODevice *); - void setFileName(const QString &); - void setQuality(int); - void setDescription(const QString &); - void setParameters(const char *); - void setGamma(float); - - bool read(); - bool write(); - - static QByteArray pictureFormat(const QString &fileName); - static QByteArray pictureFormat(QIODevice *); - static QList inputFormats(); - static QList outputFormats(); - - static void defineIOHandler(const char *format, - const char *header, - const char *flags, - picture_io_handler read_picture, - picture_io_handler write_picture); - -private: - Q_DISABLE_COPY(QPictureIO) - - void init(); - - QPictureIOData *d; -}; - -#endif //QT_NO_PICTUREIO - - /***************************************************************************** QPicture stream functions *****************************************************************************/ diff --git a/src/gui/image/qpictureformatplugin.cpp b/src/gui/image/qpictureformatplugin.cpp deleted file mode 100644 index 161964b16..000000000 --- a/src/gui/image/qpictureformatplugin.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpictureformatplugin.h" -#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_PICTURE) -#include "qpicture.h" - -QT_BEGIN_NAMESPACE - -/*! - \obsolete - - \class QPictureFormatPlugin - \brief The QPictureFormatPlugin class provides an abstract base - for custom picture format plugins. - - \ingroup plugins - - The picture format plugin is a simple plugin interface that makes - it easy to create custom picture formats that can be used - transparently by applications. - - Writing an picture format plugin is achieved by subclassing this - base class, reimplementing the pure virtual functions keys(), - loadPicture(), savePicture(), and installIOHandler(), and - exporting the class with the Q_EXPORT_PLUGIN2() macro. - - \sa {How to Create Qt Plugins} -*/ - -/*! - \fn QStringList QPictureFormatPlugin::keys() const - - Returns the list of picture formats this plugin supports. - - \sa installIOHandler() -*/ - -/*! - \fn bool QPictureFormatPlugin::installIOHandler(const QString &format) - - Installs a QPictureIO picture I/O handler for the picture format \a - format. - - \sa keys() -*/ - - -/*! - Constructs an picture format plugin with the given \a parent. - This is invoked automatically by the Q_EXPORT_PLUGIN2() macro. -*/ -QPictureFormatPlugin::QPictureFormatPlugin(QObject *parent) - : QObject(parent) -{ -} - -/*! - Destroys the picture format plugin. - - You never have to call this explicitly. Qt destroys a plugin - automatically when it is no longer used. -*/ -QPictureFormatPlugin::~QPictureFormatPlugin() -{ -} - - -/*! - Loads the picture stored in the file called \a fileName, with the - given \a format, into *\a picture. Returns true on success; - otherwise returns false. - - \sa savePicture() -*/ -bool QPictureFormatPlugin::loadPicture(const QString &format, const QString &fileName, QPicture *picture) -{ - Q_UNUSED(format) - Q_UNUSED(fileName) - Q_UNUSED(picture) - return false; -} - -/*! - Saves the given \a picture into the file called \a fileName, - using the specified \a format. Returns true on success; otherwise - returns false. - - \sa loadPicture() -*/ -bool QPictureFormatPlugin::savePicture(const QString &format, const QString &fileName, const QPicture &picture) -{ - Q_UNUSED(format) - Q_UNUSED(fileName) - Q_UNUSED(picture) - return false; -} - -#endif // QT_NO_LIBRARY || QT_NO_PICTURE - -QT_END_NAMESPACE - - -#include "moc_qpictureformatplugin.h" diff --git a/src/gui/image/qpictureformatplugin.h b/src/gui/image/qpictureformatplugin.h deleted file mode 100644 index 8f0c52e31..000000000 --- a/src/gui/image/qpictureformatplugin.h +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPICTUREFORMATPLUGIN_H -#define QPICTUREFORMATPLUGIN_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - - -#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_PICTURE) - -class QPicture; -class QImage; -class QString; -class QStringList; - -struct Q_GUI_EXPORT QPictureFormatInterface : public QFactoryInterface -{ - virtual bool loadPicture(const QString &format, const QString &filename, QPicture *) = 0; - virtual bool savePicture(const QString &format, const QString &filename, const QPicture &) = 0; - - virtual bool installIOHandler(const QString &) = 0; -}; - -#define QPictureFormatInterface_iid "com.trolltech.Qt.QPictureFormatInterface" -Q_DECLARE_INTERFACE(QPictureFormatInterface, QPictureFormatInterface_iid) - - -class Q_GUI_EXPORT QPictureFormatPlugin : public QObject, public QPictureFormatInterface -{ - Q_OBJECT - Q_INTERFACES(QPictureFormatInterface:QFactoryInterface) -public: - explicit QPictureFormatPlugin(QObject *parent = 0); - ~QPictureFormatPlugin(); - - virtual QStringList keys() const = 0; - virtual bool loadPicture(const QString &format, const QString &filename, QPicture *pic); - virtual bool savePicture(const QString &format, const QString &filename, const QPicture &pic); - virtual bool installIOHandler(const QString &format) = 0; - -}; - -#endif // QT_NO_LIBRARY || QT_NO_PICTURE - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QPICTUREFORMATPLUGIN_H diff --git a/src/shared/qclass_lib_map.h b/src/shared/qclass_lib_map.h index fa4b26908..61a1a3c35 100644 --- a/src/shared/qclass_lib_map.h +++ b/src/shared/qclass_lib_map.h @@ -343,13 +343,10 @@ static const ClassInfoEntry qclass_lib_map[] = { { "QImage", "QtGui/qimage.h"}, { "QIconEngine", "QtGui/qiconengine.h"}, { "QPicture", "QtGui/qpicture.h"}, - { "QPictureIO", "QtGui/qpicture.h"}, { "QImageReader", "QtGui/qimagereader.h"}, { "QImageIOHandler", "QtGui/qimageiohandler.h"}, { "QImageIOHandlerFactoryInterface", "QtGui/qimageiohandler.h"}, { "QImageIOPlugin", "QtGui/qimageiohandler.h"}, - { "QPictureFormatInterface", "QtGui/qpictureformatplugin.h"}, - { "QPictureFormatPlugin", "QtGui/qpictureformatplugin.h"}, { "QBitmap", "QtGui/qbitmap.h"}, { "QPixmapCache", "QtGui/qpixmapcache.h"}, { "Key", "QtGui/qpixmapcache.h"}, @@ -787,6 +784,6 @@ static const ClassInfoEntry qclass_lib_map[] = { { "QSslError", "QtNetwork/qsslerror.h"}, { "QSslCertificate", "QtNetwork/qsslcertificate.h"}, }; -static const int qclass_lib_count = 781; +static const int qclass_lib_count = 778; #endif diff --git a/tests/benchmarks/gui/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/benchmarks/gui/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp index 37646f316..ef18e3761 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp @@ -103,7 +103,7 @@ void tst_QGraphicsLayout::invalidate() RectWidget *window = new RectWidget(0, Qt::Window); window->setGeometryCalls = &setGeometryCalls; - window->setData(0, QString(QChar('a'))); + window->setData(0, QString(QLatin1Char('a'))); scene.addItem(window); RectWidget *leaf = 0;