From 8577353b2a5155600e672955e7c6a61e9e9519ca Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Fri, 11 Jun 2010 12:53:07 +0200 Subject: Fixed size hint for combo box on windows When you use larger fonts or DPI on windows, the combobox can calculate a size hint that results of text eliding on items. This fix removes some duplicate code in Vista style and adds a dpi dependant size hint for XP style. Task-number: QTBUG-7552 Reviewed-by: richard --- src/gui/styles/qwindowsvistastyle.cpp | 25 +------------------------ src/gui/styles/qwindowsxpstyle.cpp | 4 +++- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index 67a7b85..8511592 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -1926,30 +1926,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption return QWindowsStyle::sizeFromContents(type, option, size, widget); QSize sz(size); - - QSize newSize = QWindowsXPStyle::sizeFromContents(type, option, size, widget); switch (type) { - case CT_LineEdit: - case CT_ComboBox: - { - HTHEME theme = pOpenThemeData(0, L"Button"); - MARGINS borderSize; - if (theme) { - int result = pGetThemeMargins(theme, - NULL, - BP_PUSHBUTTON, - PBS_NORMAL, - TMT_CONTENTMARGINS, - NULL, - &borderSize); - if (result == S_OK) { - sz += QSize(borderSize.cxLeftWidth + borderSize.cxRightWidth - 2, - borderSize.cyBottomHeight + borderSize.cyTopHeight - 2); - } - sz += QSize(23, 0); //arrow button - } - } - return sz; case CT_MenuItem: sz = QWindowsXPStyle::sizeFromContents(type, option, size, widget); int minimumHeight; @@ -1990,7 +1967,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption default: break; } - return newSize; + return QWindowsXPStyle::sizeFromContents(type, option, size, widget); } /*! diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index efb1224..8743807 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -3678,7 +3678,9 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt sz += QSize(borderSize.cxLeftWidth + borderSize.cxRightWidth - 2, borderSize.cyBottomHeight + borderSize.cyTopHeight - 2); } - sz += QSize(23, 0); //arrow button + const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1); + sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget) + + textMargins, 23), 0); //arrow button } } break; -- cgit v0.12 From 08e2216a5157c5de30a65674051b08df6f2a1bf6 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 22 Jun 2010 15:26:24 +0200 Subject: Fixed crash in the fast blend functions for raster The blend functions don't work when the scaling factor goes beyond 65536, so abort early. Strictly speaking the scale factor comes from targetWidth / sourceWidth, so this catches a bit more cases. Reviewed-by: Kim Task: http://bugreports.qt.nokia.com/browse/QTBUG-9437 --- src/gui/painting/qpaintengine_raster.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index a212718..94e5cbc 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2688,7 +2688,11 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe if (s->matrix.type() > QTransform::TxTranslate || stretch_sr) { - if (s->flags.fast_images) { + QRectF targetBounds = s->matrix.mapRect(r); + bool exceedsPrecision = targetBounds.width() > 0xffff + || targetBounds.height() > 0xffff; + + if (s->flags.fast_images && !exceedsPrecision) { if (s->matrix.type() > QTransform::TxScale) { SrcOverTransformFunc func = qTransformFunctions[d->rasterBuffer->format][img.format()]; if (func && (!clip || clip->hasRectClip)) { -- cgit v0.12 From fb76a872e20bd0df8e7bbe9c039b7f20423c6f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 22 Jun 2010 13:24:26 +0200 Subject: Optimized sub-rect copying / painting of QPixmaps. Prevented downloading of the whole XImage by introducing new QPixmapData::toImage() overload taking a sub-rect. Also avoid an additional copy by simply taking ownership of the XImage data when the XImage format matches the QImage format. Reviewed-by: Trond --- src/gui/image/qpixmap_raster.cpp | 14 +++ src/gui/image/qpixmap_raster_p.h | 1 + src/gui/image/qpixmap_x11.cpp | 172 ++++++++++++++++++++----------- src/gui/image/qpixmap_x11_p.h | 8 ++ src/gui/image/qpixmapdata.cpp | 10 +- src/gui/image/qpixmapdata_p.h | 1 + src/gui/painting/qpaintengine_raster.cpp | 8 +- 7 files changed, 152 insertions(+), 62 deletions(-) diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 13c03a1..13e95c7 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -289,6 +289,20 @@ QImage QRasterPixmapData::toImage() const return image; } +QImage QRasterPixmapData::toImage(const QRect &rect) const +{ + if (rect.isNull()) + return image; + + QRect clipped = rect.intersected(QRect(0, 0, w, h)); + if (d % 8 == 0) + return QImage(image.scanLine(clipped.y()) + clipped.x() * (d / 8), + clipped.width(), clipped.height(), + image.bytesPerLine(), image.format()); + else + return image.copy(clipped); +} + void QRasterPixmapData::setAlphaChannel(const QPixmap &alphaChannel) { image.setAlphaChannel(alphaChannel.toImage()); diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index d7e3f85..42ceeca 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -81,6 +81,7 @@ public: bool hasAlphaChannel() const; void setAlphaChannel(const QPixmap &alphaChannel); QImage toImage() const; + QImage toImage(const QRect &rect) const; QPaintEngine* paintEngine() const; QImage* buffer(); diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index e8dc5ae..604dbf5 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1458,6 +1458,95 @@ int QX11PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const } } +struct QXImageWrapper +{ + XImage *xi; +}; + +bool QX11PixmapData::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) const +{ + XImage *xi = xiWrapper.xi; + + // ARGB32_Premultiplied + if (picture && depth() == 32) + return true; + + Visual *visual = (Visual *)xinfo.visual(); + + // RGB32 + if (depth() == 24 && xi->bits_per_pixel == 32 && visual->red_mask == 0xff0000 + && visual->green_mask == 0xff00 && visual->blue_mask == 0xff) + return true; + + // RGB16 + if (depth() == 16 && xi->bits_per_pixel == 16 && visual->red_mask == 0xf800 + && visual->green_mask == 0x7e0 && visual->blue_mask == 0x1f) + return true; + + return false; +} + +QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) const +{ + XImage *xi = xiWrapper.xi; + + QImage::Format format = QImage::Format_ARGB32_Premultiplied; + if (depth() == 24) + format = QImage::Format_RGB32; + else if (depth() == 16) + format = QImage::Format_RGB16; + + QImage image((uchar *)xi->data, xi->width, xi->height, xi->bytes_per_line, format); + // take ownership + image.data_ptr()->own_data = true; + xi->data = 0; + + // we may have to swap the byte order + if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) + || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) + { + for (int i=0; i < image.height(); i++) { + if (depth() == 16) { + ushort *p = (ushort*)image.scanLine(i); + ushort *end = p + image.width(); + while (p < end) { + *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); + p++; + } + } else { + uint *p = (uint*)image.scanLine(i); + uint *end = p + image.width(); + while (p < end) { + *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) + | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); + p++; + } + } + } + } + + XDestroyImage(xi); + return image; +} + +QImage QX11PixmapData::toImage(const QRect &rect) const +{ + QXImageWrapper xiWrapper; + xiWrapper.xi = XGetImage(X11->display, hd, rect.x(), rect.y(), rect.width(), rect.height(), + AllPlanes, (depth() == 1) ? XYPixmap : ZPixmap); + + Q_CHECK_PTR(xiWrapper.xi); + if (!xiWrapper.xi) + return QImage(); + + if (canTakeQImageFromXImage(xiWrapper)) + return takeQImageFromXImage(xiWrapper); + + QImage image = toImage(xiWrapper, rect); + qSafeXDestroyImage(xiWrapper.xi); + return image; +} + /*! Converts the pixmap to a QImage. Returns a null image if the conversion fails. @@ -1475,6 +1564,13 @@ int QX11PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const QImage QX11PixmapData::toImage() const { + return toImage(QRect(0, 0, w, h)); +} + +QImage QX11PixmapData::toImage(const QXImageWrapper &xiWrapper, const QRect &rect) const +{ + XImage *xi = xiWrapper.xi; + int d = depth(); Visual *visual = (Visual *)xinfo.visual(); bool trucol = (visual->c_class >= TrueColor) && d > 1; @@ -1492,59 +1588,21 @@ QImage QX11PixmapData::toImage() const format = QImage::Format_RGB32; } - XImage *xi = XGetImage(X11->display, hd, 0, 0, w, h, AllPlanes, - (d == 1) ? XYPixmap : ZPixmap); - - Q_CHECK_PTR(xi); - if (!xi) - return QImage(); - - if (picture && depth() == 32) { - QImage image(w, h, QImage::Format_ARGB32_Premultiplied); - memcpy(image.bits(), xi->data, xi->bytes_per_line * xi->height); - - // we may have to swap the byte order - if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) - || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) - { - for (int i=0; i < image.height(); i++) { - uint *p = (uint*)image.scanLine(i); - uint *end = p + image.width(); - if ((xi->byte_order == LSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian) - || (xi->byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) { - while (p < end) { - *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) - | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); - p++; - } - } else if (xi->byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian) { - while (p < end) { - *p = ((*p << 16) & 0x00ff0000) | ((*p >> 16) & 0x000000ff) - | ((*p ) & 0xff00ff00); - p++; - } - } - } - } - - // throw away image data - qSafeXDestroyImage(xi); - - return image; - } - if (d == 1 && xi->bitmap_bit_order == LSBFirst) format = QImage::Format_MonoLSB; if (x11_mask && format == QImage::Format_RGB32) format = QImage::Format_ARGB32; - QImage image(w, h, format); + QImage image(xi->width, xi->height, format); if (image.isNull()) // could not create image return image; QImage alpha; if (x11_mask) { - alpha = mask().toImage(); + if (rect.contains(QRect(0, 0, w, h))) + alpha = mask().toImage(); + else + alpha = mask().toImage().copy(rect); } bool ale = alpha.format() == QImage::Format_MonoLSB; @@ -1587,11 +1645,11 @@ QImage QX11PixmapData::toImage() const if (bppc > 8 && xi->byte_order == LSBFirst) bppc++; - for (int y = 0; y < h; ++y) { + for (int y = 0; y < xi->height; ++y) { uchar* asrc = x11_mask ? alpha.scanLine(y) : 0; dst = (QRgb *)image.scanLine(y); src = (uchar *)xi->data + xi->bytes_per_line*y; - for (int x = 0; x < w; x++) { + for (int x = 0; x < xi->width; x++) { switch (bppc) { case 8: pixel = *src++; @@ -1621,8 +1679,8 @@ QImage QX11PixmapData::toImage() const src += 4; break; default: // should not really happen - x = w; // leave loop - y = h; + x = xi->width; // leave loop + y = xi->height; pixel = 0; // eliminate compiler warning qWarning("QPixmap::convertToImage: Invalid depth %d", bppc); } @@ -1660,7 +1718,7 @@ QImage QX11PixmapData::toImage() const } else if (xi->bits_per_pixel == d) { // compatible depth char *xidata = xi->data; // copy each scanline int bpl = qMin(image.bytesPerLine(),xi->bytes_per_line); - for (int y=0; yheight; y++) { memcpy(image.scanLine(y), xidata, bpl); xidata += xi->bytes_per_line; } @@ -1686,17 +1744,17 @@ QImage QX11PixmapData::toImage() const bpl = image.bytesPerLine(); if (x11_mask) { // which pixels are used? - for (int i = 0; i < h; i++) { + for (int i = 0; i < xi->height; i++) { uchar* asrc = alpha.scanLine(i); p = image.scanLine(i); if (ale) { - for (int x = 0; x < w; x++) { + for (int x = 0; x < xi->width; x++) { if (asrc[x >> 3] & (1 << (x & 7))) use[*p] = 1; ++p; } } else { - for (int x = 0; x < w; x++) { + for (int x = 0; x < xi->width; x++) { if (asrc[x >> 3] & (0x80 >> (x & 7))) use[*p] = 1; ++p; @@ -1704,7 +1762,7 @@ QImage QX11PixmapData::toImage() const } } } else { - for (int i = 0; i < h; i++) { + for (int i = 0; i < xi->height; i++) { p = image.scanLine(i); end = p + bpl; while (p < end) @@ -1716,7 +1774,7 @@ QImage QX11PixmapData::toImage() const if (use[i]) pix[i] = ncols++; } - for (int i = 0; i < h; i++) { // translate pixels + for (int i = 0; i < xi->height; i++) { // translate pixels p = image.scanLine(i); end = p + bpl; while (p < end) { @@ -1736,17 +1794,17 @@ QImage QX11PixmapData::toImage() const // use first pixel in image (as good as any). trans = image.scanLine(0)[0]; } - for (int i = 0; i < h; i++) { + for (int i = 0; i < xi->height; i++) { uchar* asrc = alpha.scanLine(i); p = image.scanLine(i); if (ale) { - for (int x = 0; x < w; x++) { + for (int x = 0; x < xi->width; x++) { if (!(asrc[x >> 3] & (1 << (x & 7)))) *p = trans; ++p; } } else { - for (int x = 0; x < w; x++) { + for (int x = 0; x < xi->width; x++) { if (!(asrc[x >> 3] & (1 << (7 -(x & 7))))) *p = trans; ++p; @@ -1764,8 +1822,6 @@ QImage QX11PixmapData::toImage() const } } - qSafeXDestroyImage(xi); - return image; } diff --git a/src/gui/image/qpixmap_x11_p.h b/src/gui/image/qpixmap_x11_p.h index 7575838..821fb69 100644 --- a/src/gui/image/qpixmap_x11_p.h +++ b/src/gui/image/qpixmap_x11_p.h @@ -62,6 +62,8 @@ QT_BEGIN_NAMESPACE class QX11PaintEngine; +struct QXImageWrapper; + class Q_GUI_EXPORT QX11PixmapData : public QPixmapData { public: @@ -87,6 +89,7 @@ public: QPixmap transformed(const QTransform &transform, Qt::TransformationMode mode) const; QImage toImage() const; + QImage toImage(const QRect &rect) const; QPaintEngine* paintEngine() const; Qt::HANDLE handle() const { return hd; } @@ -116,10 +119,15 @@ private: void release(); + QImage toImage(const QXImageWrapper &xi, const QRect &rect) const; + QBitmap mask_to_bitmap(int screen) const; static Qt::HANDLE bitmap_to_mask(const QBitmap &, int screen); void bitmapFromImage(const QImage &image); + bool canTakeQImageFromXImage(const QXImageWrapper &xi) const; + QImage takeQImageFromXImage(const QXImageWrapper &xi) const; + Qt::HANDLE hd; enum Flag { diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 31ca909..345e3cf 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -146,7 +146,7 @@ bool QPixmapData::fromData(const uchar *buf, uint len, const char *format, Qt::I void QPixmapData::copy(const QPixmapData *data, const QRect &rect) { - fromImage(data->toImage().copy(rect), Qt::NoOpaqueDetection); + fromImage(data->toImage(rect), Qt::NoOpaqueDetection); } bool QPixmapData::scroll(int dx, int dy, const QRect &rect) @@ -255,6 +255,14 @@ void QPixmapData::setSerialNumber(int serNo) ser_no = serNo; } +QImage QPixmapData::toImage(const QRect &rect) const +{ + if (rect.contains(QRect(0, 0, w, h))) + return toImage(); + else + return toImage().copy(rect); +} + QImage* QPixmapData::buffer() { return 0; diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 60ed26a..9a1505a 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -102,6 +102,7 @@ public: virtual void setAlphaChannel(const QPixmap &alphaChannel); virtual QPixmap alphaChannel() const; virtual QImage toImage() const = 0; + virtual QImage toImage(const QRect &rect) const; virtual QPaintEngine* paintEngine() const = 0; inline int serialNumber() const { return ser_no; } diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 94e5cbc..84b36c7 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2419,7 +2419,9 @@ void QRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, cons drawImage(r, image, sr); } } else { - const QImage image = pixmap.toImage(); + QRect clippedSource = sr.toAlignedRect().intersected(pixmap.rect()); + const QImage image = pd->toImage(clippedSource); + QRectF translatedSource = sr.translated(-clippedSource.topLeft()); if (image.depth() == 1) { Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); @@ -2430,10 +2432,10 @@ void QRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, cons drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); return; } else { - drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), sr); + drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), translatedSource); } } else { - drawImage(r, image, sr); + drawImage(r, image, translatedSource); } } } -- cgit v0.12 From 0c0eac000ecbe8c0bdcb8c6d914854b1a09a720b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 23 Jun 2010 13:33:20 +0200 Subject: Fixed QPixmap::toImage() bug introduced in fb76a872e20bd. The alpha channel we get from XGetImage might not be saturated for opaque pixmaps. Reviewed-by: Trond --- src/gui/image/qpixmap_x11.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 604dbf5..3d9c363 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1525,6 +1525,16 @@ QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) con } } + // fix-up alpha channel + if (format == QImage::Format_RGB32) { + QRgb *p = (QRgb *)image.bits(); + for (int y = 0; y < xi->height; ++y) { + for (int x = 0; x < xi->width; ++x) + p[x] |= 0xff000000; + p += xi->bytes_per_line / 4; + } + } + XDestroyImage(xi); return image; } -- cgit v0.12 From 5817f04060f5a545a71a1f9e9dfa167f92a4ab93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 23 Jun 2010 13:55:20 +0200 Subject: Fixed missing copy of raster pixmap data after change fb76a872e20bd. It's expected that copy actually does a deep copy of the image data. Because QRasterPixmapData::fromImage() will just use the source image as is in this case we need to do a deep copy of the QImage. Reviewed-by: Trond --- src/gui/image/qpixmap_raster.cpp | 5 +++++ src/gui/image/qpixmap_raster_p.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 13e95c7..e188745 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -155,6 +155,11 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage, // from qwindowsurface.cpp extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); +void QRasterPixmapData::copy(const QPixmapData *data, const QRect &rect) +{ + fromImage(data->toImage(rect).copy(), Qt::NoOpaqueDetection); +} + bool QRasterPixmapData::scroll(int dx, int dy, const QRect &rect) { if (!image.isNull()) diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index 42ceeca..a46e054 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -75,6 +75,7 @@ public: bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); + void copy(const QPixmapData *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); void fill(const QColor &color); void setMask(const QBitmap &mask); -- cgit v0.12 From 98d9083f87feb3d78af509db43685a148aa0766e Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 22 Jun 2010 18:18:45 +0200 Subject: Add a SSE2 version of comp_func_SourceOver() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement a version of comp_func_SourceOver() with SSE2. This gives a performance boost of 11% on some WebKit animations. Two new macros were added to simplify the implementation of the different blending primitives: BLEND_SOURCE_OVER_ARGB32_SSE2() and BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2() Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper.cpp | 7 +- src/gui/painting/qdrawhelper_sse2.cpp | 170 ++++++++++++++++++++++------------ 2 files changed, 116 insertions(+), 61 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index bfa1136..d088499 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7817,6 +7817,12 @@ void qInitDrawhelperAsm() #ifdef QT_HAVE_SSE2 if (features & SSE2) { + extern void comp_func_SourceOver_sse2(uint *destPixels, + const uint *srcPixels, + int length, + uint const_alpha); + functionForModeAsm[0] = comp_func_SourceOver_sse2; + extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, @@ -7826,7 +7832,6 @@ void qInitDrawhelperAsm() int w, int h, int const_alpha); - qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2; diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 6ac64d3..b650aac 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -126,6 +126,93 @@ QT_BEGIN_NAMESPACE result = _mm_or_si128(finalAG, finalRB); \ } +// Basically blend src over dst with the const alpha defined as constAlphaVector. +// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as: +//const __m128i nullVector = _mm_set1_epi32(0); +//const __m128i half = _mm_set1_epi16(0x80); +//const __m128i one = _mm_set1_epi16(0xff); +//const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); +//const __m128i alphaMask = _mm_set1_epi32(0xff000000); +// +// The computation being done is: +// result = s + d * (1-alpha) +// with shortcuts if fully opaque or fully transparent. +#define BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \ + int x = 0; \ + for (; x < length-3; x += 4) { \ + const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \ + const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ + if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \ + /* all opaque */ \ + _mm_storeu_si128((__m128i *)&dst[x], srcVector); \ + } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \ + /* not fully transparent */ \ + /* extract the alpha channel on 2 x 16 bits */ \ + /* so we have room for the multiplication */ \ + /* each 32 bits will be in the form 0x00AA00AA */ \ + /* with A being the 1 - alpha */ \ + __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); \ + alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); \ + alphaChannel = _mm_sub_epi16(one, alphaChannel); \ + \ + const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); \ + __m128i destMultipliedByOneMinusAlpha; \ + BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ + \ + /* result = s + d * (1-alpha) */\ + const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ + _mm_storeu_si128((__m128i *)&dst[x], result); \ + } \ + } \ + for (; x < length; ++x) { \ + uint s = src[x]; \ + if (s >= 0xff000000) \ + dst[x] = s; \ + else if (s != 0) \ + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \ + } \ +} + +// Basically blend src over dst with the const alpha defined as constAlphaVector. +// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as: +//const __m128i nullVector = _mm_set1_epi32(0); +//const __m128i half = _mm_set1_epi16(0x80); +//const __m128i one = _mm_set1_epi16(0xff); +//const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); +// +// The computation being done is: +// dest = (s + d * sia) * ca + d * cia +// = s * ca + d * (sia * ca + cia) +// = s * ca + d * (1 - sa*ca) +#define BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, length, nullVector, half, one, colorMask, constAlphaVector) \ +{ \ + int x = 0; \ + for (; x < length-3; x += 4) { \ + __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \ + if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { \ + BYTE_MUL_SSE2(srcVector, srcVector, constAlphaVector, colorMask, half); \ +\ + __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); \ + alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); \ + alphaChannel = _mm_sub_epi16(one, alphaChannel); \ + \ + const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); \ + __m128i destMultipliedByOneMinusAlpha; \ + BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ + \ + const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ + _mm_storeu_si128((__m128i *)&dst[x], result); \ + } \ + } \ + for (; x < length; ++x) { \ + quint32 s = src[x]; \ + if (s != 0) { \ + s = BYTE_MUL(s, const_alpha); \ + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \ + } \ + } \ +} + void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, @@ -140,41 +227,7 @@ void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, const __m128i one = _mm_set1_epi16(0xff); const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); for (int y = 0; y < h; ++y) { - int x = 0; - for (; x < w-3; x += 4) { - const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); - const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); - if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { - // all opaque - _mm_storeu_si128((__m128i *)&dst[x], srcVector); - } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { - // not fully transparent - // result = s + d * (1-alpha) - - // extract the alpha channel on 2 x 16 bits - // so we have room for the multiplication - // each 32 bits will be in the form 0x00AA00AA - // with A being the 1 - alpha - __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); - alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); - alphaChannel = _mm_sub_epi16(one, alphaChannel); - - const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); - __m128i destMultipliedByOneMinusAlpha; - BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); - - // result = s + d * (1-alpha) - const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); - _mm_storeu_si128((__m128i *)&dst[x], result); - } - } - for (; x= 0xff000000) - dst[x] = s; - else if (s != 0) - dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); - } + BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, w, nullVector, half, one, colorMask, alphaMask); dst = (quint32 *)(((uchar *) dst) + dbpl); src = (const quint32 *)(((const uchar *) src) + sbpl); } @@ -189,31 +242,7 @@ void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); for (int y = 0; y < h; ++y) { - int x = 0; - for (; x < w-3; x += 4) { - __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); - if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { - BYTE_MUL_SSE2(srcVector, srcVector, constAlphaVector, colorMask, half); - - __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); - alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); - alphaChannel = _mm_sub_epi16(one, alphaChannel); - - const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); - __m128i destMultipliedByOneMinusAlpha; - BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); - - const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); - _mm_storeu_si128((__m128i *)&dst[x], result); - } - } - for (; x 0); // if const_alpha == 0, this should never be called + Q_ASSERT(const_alpha < 256); + + const quint32 *src = (const quint32 *) srcPixels; + quint32 *dst = (uint *) destPixels; + + const __m128i nullVector = _mm_set1_epi32(0); + const __m128i half = _mm_set1_epi16(0x80); + const __m128i one = _mm_set1_epi16(0xff); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + if (const_alpha == 255) { + const __m128i alphaMask = _mm_set1_epi32(0xff000000); + BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, length, nullVector, half, one, colorMask, alphaMask); + } else { + const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); + BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, length, nullVector, half, one, colorMask, constAlphaVector); + } +} + void qt_memfill32_sse2(quint32 *dest, quint32 value, int count) { if (count < 7) { -- cgit v0.12 From a922a304ae9115d04f3bbcb3bd13c8e374bb16f1 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 22 Jun 2010 22:06:02 +0200 Subject: Add a SSE2 implementation of comp_func_solid_SourceOver() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function is used quite a lot by WebKit animations, the SSE2 implementation is twice as fast in those uses cases. Reviewed-by: Andreas Kling Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper.cpp | 5 ++++- src/gui/painting/qdrawhelper_sse2.cpp | 30 +++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index d088499..f08c090 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7817,11 +7817,14 @@ void qInitDrawhelperAsm() #ifdef QT_HAVE_SSE2 if (features & SSE2) { - extern void comp_func_SourceOver_sse2(uint *destPixels, + extern void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha); + extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha); + functionForModeAsm[0] = comp_func_SourceOver_sse2; + functionForModeSolidAsm[0] = comp_func_solid_SourceOver_sse2; extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index b650aac..7d542d6 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -297,7 +297,7 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, } } -void comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha) +void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha) { Q_ASSERT(const_alpha > 0); // if const_alpha == 0, this should never be called Q_ASSERT(const_alpha < 256); @@ -362,6 +362,34 @@ void qt_memfill32_sse2(quint32 *dest, quint32 value, int count) } } +void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha) +{ + if ((const_alpha & qAlpha(color)) == 255) { + qt_memfill32_sse2(destPixels, length, color); + } else { + if (const_alpha != 255) + color = BYTE_MUL(color, const_alpha); + + const quint32 minusAlphaOfColor = qAlpha(~color); + int x = 0; + + quint32 *dst = (uint *) destPixels; + const __m128i colorVector = _mm_set1_epi32(color); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + const __m128i half = _mm_set1_epi16(0x80); + const __m128i minusAlphaOfColorVector = _mm_set1_epi16(minusAlphaOfColor); + + for (; x < length-3; x += 4) { + __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); + BYTE_MUL_SSE2(dstVector, dstVector, minusAlphaOfColorVector, colorMask, half); + dstVector = _mm_add_epi8(colorVector, dstVector); + _mm_storeu_si128((__m128i *)&dst[x], dstVector); + } + for (;x < length; ++x) + destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor); + } +} + void qt_memfill16_sse2(quint16 *dest, quint16 value, int count) { if (count < 3) { -- cgit v0.12 From 86f375e91c2b1162a75f86c9b8f041ae1d4747de Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 22 Jun 2010 23:48:54 +0200 Subject: Fix the casts of qdrawhelper_sse2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I did erroneous cast by mistake, the code should ensure the pointer are on 32 bits integers. Reviewed-by: Andreas Kling Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper_sse2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 7d542d6..e2a69ec 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -219,7 +219,7 @@ void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, int const_alpha) { const quint32 *src = (const quint32 *) srcPixels; - quint32 *dst = (uint *) destPixels; + quint32 *dst = (quint32 *) destPixels; if (const_alpha == 256) { const __m128i alphaMask = _mm_set1_epi32(0xff000000); const __m128i nullVector = _mm_set1_epi32(0); @@ -261,7 +261,7 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, int const_alpha) { const quint32 *src = (const quint32 *) srcPixels; - quint32 *dst = (uint *) destPixels; + quint32 *dst = (quint32 *) destPixels; if (const_alpha != 256) { if (const_alpha != 0) { const __m128i nullVector = _mm_set1_epi32(0); @@ -303,7 +303,7 @@ void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixe Q_ASSERT(const_alpha < 256); const quint32 *src = (const quint32 *) srcPixels; - quint32 *dst = (uint *) destPixels; + quint32 *dst = (quint32 *) destPixels; const __m128i nullVector = _mm_set1_epi32(0); const __m128i half = _mm_set1_epi16(0x80); @@ -373,7 +373,7 @@ void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, u const quint32 minusAlphaOfColor = qAlpha(~color); int x = 0; - quint32 *dst = (uint *) destPixels; + quint32 *dst = (quint32 *) destPixels; const __m128i colorVector = _mm_set1_epi32(color); const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); const __m128i half = _mm_set1_epi16(0x80); -- cgit v0.12 From 5cfa764466be6ec2b987e0694b99f1d343d55048 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 23 Jun 2010 22:22:56 +0200 Subject: Add an implementation of comp_func_solid_SourceOver_neon() with Neon. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function comp_func_solid_SourceOver_neon() is use extensively by WebKit via the calls to fillRect() of QPainter(). Implementing the function with Neon provides some performance improvement (around 175% of the previous speed). Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper.cpp | 1 + src/gui/painting/qdrawhelper_neon.cpp | 43 +++++++++++++++++++++++++++++++++++ src/gui/painting/qdrawhelper_neon_p.h | 2 ++ 3 files changed, 46 insertions(+) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index f08c090..5727b3c 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7898,6 +7898,7 @@ void qInitDrawhelperAsm() qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; + functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; } diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index ee5f24a..3ce90d2 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -579,6 +579,49 @@ void QT_FASTCALL qt_destStoreRGB16_neon(QRasterBuffer *rasterBuffer, int x, int } } +void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, uint color, uint const_alpha) +{ + if ((const_alpha & qAlpha(color)) == 255) { + QT_MEMFILL_UINT(destPixels, length, color); + } else { + if (const_alpha != 255) + color = BYTE_MUL(color, const_alpha); + + const quint32 minusAlphaOfColor = qAlpha(~color); + int x = 0; + + uint32_t *dst = (uint32_t *) destPixels; + const uint32x4_t colorVector = vdupq_n_u32(color); + uint16x8_t half = vdupq_n_u16(0x80); + const uint16x8_t minusAlphaOfColorVector = vdupq_n_u16(minusAlphaOfColor); + + for (; x < length-3; x += 4) { + uint32x4_t dstVector = vld1q_u32(&dst[x]); + + const uint8x16_t dst8 = vreinterpretq_u8_u32(dstVector); + + const uint8x8_t dst8_low = vget_low_u8(dst8); + const uint8x8_t dst8_high = vget_high_u8(dst8); + + const uint16x8_t dst16_low = vmovl_u8(dst8_low); + const uint16x8_t dst16_high = vmovl_u8(dst8_high); + + const uint16x8_t result16_low = qvbyte_mul_u16(dst16_low, minusAlphaOfColorVector, half); + const uint16x8_t result16_high = qvbyte_mul_u16(dst16_high, minusAlphaOfColorVector, half); + + const uint32x2_t result32_low = vreinterpret_u32_u8(vmovn_u16(result16_low)); + const uint32x2_t result32_high = vreinterpret_u32_u8(vmovn_u16(result16_high)); + + uint32x4_t blendedPixels = vcombine_u32(result32_low, result32_high); + uint32x4_t colorPlusBlendedPixels = vaddq_u32(colorVector, blendedPixels); + vst1q_u32(&dst[x], colorPlusBlendedPixels); + } + + for (;x < length; ++x) + destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor); + } +} + QT_END_NAMESPACE #endif // QT_HAVE_NEON diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h index d6a4509..c054a1e 100644 --- a/src/gui/painting/qdrawhelper_neon_p.h +++ b/src/gui/painting/qdrawhelper_neon_p.h @@ -127,6 +127,8 @@ uint * QT_FASTCALL qt_destFetchRGB16_neon(uint *buffer, void QT_FASTCALL qt_destStoreRGB16_neon(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length); +void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, uint color, uint const_alpha); + #endif // QT_HAVE_NEON QT_END_NAMESPACE -- cgit v0.12 From 9de452bba5b592402ced6f20fbdc6d0b5c075416 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 24 Jun 2010 11:23:57 +1000 Subject: Normalize integers when calling glVertexAttribPointer() When QGLShaderProgram::setAttributeArray() is used with a type like GL_UNSIGNED_BYTE, it is normally going to be a value that should be normalized to the range 0..1. But the function wasn't normalizing, which led to errors in programs that used per-vertex colors with the 4ub representation. Reviewed-by: Sarah Smith --- src/opengl/qglshaderprogram.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 83b4b21..c7689b8 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -1490,7 +1490,7 @@ void QGLShaderProgram::setAttributeArray Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - glVertexAttribPointer(location, tupleSize, type, GL_FALSE, + glVertexAttribPointer(location, tupleSize, type, GL_TRUE, stride, values); } } @@ -1634,7 +1634,7 @@ void QGLShaderProgram::setAttributeBuffer Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - glVertexAttribPointer(location, tupleSize, type, GL_FALSE, stride, + glVertexAttribPointer(location, tupleSize, type, GL_TRUE, stride, reinterpret_cast(offset)); } } -- cgit v0.12 From a7d6605dd3e3419eb2c0ec96c3bb69b686c8ea42 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 24 Jun 2010 10:17:30 +0200 Subject: Added a note to desupport VC2010 64-bit VC2010 has a bug that makes optimized 64-bit code crash. Task-Number: QTBUG-11445 --- doc/src/platforms/compiler-notes.qdoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/src/platforms/compiler-notes.qdoc b/doc/src/platforms/compiler-notes.qdoc index 7eb92e0..c6ecd68 100644 --- a/doc/src/platforms/compiler-notes.qdoc +++ b/doc/src/platforms/compiler-notes.qdoc @@ -237,8 +237,6 @@ Qt works with the Standard Edition, the Professional Edition and Team System Edition of Visual Studio 2005. - We also test Qt 4 on Windows XP with Visual Studio .NET and Visual Studio 2003. - In order to use Qt with the Visual Studio 2005/2008 Express Edition you need to download and install the platform SDK. Due to limitations in the Express Edition it is not possible for us to install the Qt Visual @@ -266,6 +264,10 @@ from Microsoft. See this \l{http://qt.nokia.com/developer/faqs/faq.2006-12-18.3281869860}{Knowledge Base entry} for more information. + + There currently is a problem when compiling Qt with Visual Studio 2010 for 64-bit. + Its optimizer causes trouble and crashes for the release builds and it is not supported + in that configuration. See task http://bugreports.qt.nokia.com/browse/QTBUG-11445. \section1 IBM xlC (AIX) -- cgit v0.12 From e9a2f4d6d0186962b0833a53882e472bfe262bb9 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 24 Jun 2010 12:03:22 +0200 Subject: Adding a known issue for VC2010 64 bit Task-Number: QTBUG-11445 --- doc/src/getting-started/known-issues.qdoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/src/getting-started/known-issues.qdoc b/doc/src/getting-started/known-issues.qdoc index b2c39c4..0fa23f6 100644 --- a/doc/src/getting-started/known-issues.qdoc +++ b/doc/src/getting-started/known-issues.qdoc @@ -129,6 +129,14 @@ will not compile. See \l{http://bugreports.qt.nokia.com/browse/QTBUG-6297} for a workaround for QtScript. + + \o Compile errors with Microsoft Visual C++ compiler. \br + There seems to be a bug in the Microsoft compiler when compiling with O2 + optimization level in 64 bit. + This problem will result in crashes in QAbstractItemView::viewOptions(). + See \l{http://bugreports.qt.nokia.com/browse/QTBUG-11445} for updates on this + bug. + \endlist -- cgit v0.12 From 6f006b105978f53b7c5bd3d17637239f308ad20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 24 Jun 2010 12:41:26 +0200 Subject: Fixed autotest failure in fillRect_stretchToDeviceMode Swapping the length and color arguments to qt_memfill is a bad idea. Reviewed-by: Benjamin Poulain --- src/gui/painting/qdrawhelper_sse2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index e2a69ec..04fe825 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -365,7 +365,7 @@ void qt_memfill32_sse2(quint32 *dest, quint32 value, int count) void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha) { if ((const_alpha & qAlpha(color)) == 255) { - qt_memfill32_sse2(destPixels, length, color); + qt_memfill32_sse2(destPixels, color, length); } else { if (const_alpha != 255) color = BYTE_MUL(color, const_alpha); -- cgit v0.12 From 20a3d8c889df2338f6edd209ca4952b9045ffb00 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 24 Jun 2010 13:07:45 +0200 Subject: Fixed some potential index-out-of-bounds issues in QImage. Added color table bounds checks when converting a color indexed image to a different pixel format. Fixed an off-by-one error in the color table bounds check in QImage::setPixel(). Fixed an autotest that was setting pixel values out of bounds. Reviewed-by: Gunnar --- src/gui/image/qimage.cpp | 26 ++++++++++++++++++++++---- tests/auto/qimage/tst_qimage.cpp | 4 ++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index bb8a994..79f266d 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2338,6 +2338,12 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve const int width = data->width; const int src_pad = data->bytes_per_line - width; const int dest_pad = (dst_bytes_per_line >> 2) - width; + if (data->colortable.size() == 0) { + data->colortable.resize(256); + for (int i = 0; i < 256; ++i) + data->colortable[i] = qRgb(i, i, i); + } + const int tableSize = data->colortable.size() - 1; for (int i = 0; i < data->height; ++i) { src_data -= src_pad; @@ -2345,7 +2351,7 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve for (int pixI = 0; pixI < width; ++pixI) { --src_data; --dest_data; - const uint pixel = data->colortable[*src_data]; + const uint pixel = data->colortable[qMin(tableSize, *src_data)]; *dest_data = (quint32) PREMUL(pixel); } } @@ -2377,6 +2383,12 @@ static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversio const int width = data->width; const int src_pad = data->bytes_per_line - width; const int dest_pad = (dst_bytes_per_line >> 2) - width; + if (data->colortable.size() == 0) { + data->colortable.resize(256); + for (int i = 0; i < 256; ++i) + data->colortable[i] = qRgb(i, i, i); + } + const int tableSize = data->colortable.size() - 1; for (int i = 0; i < data->height; ++i) { src_data -= src_pad; @@ -2384,7 +2396,7 @@ static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversio for (int pixI = 0; pixI < width; ++pixI) { --src_data; --dest_data; - *dest_data = (quint32) data->colortable[*src_data]; + *dest_data = (quint32) data->colortable[qMin(tableSize, *src_data)]; } } @@ -2415,6 +2427,12 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers const int width = data->width; const int src_pad = data->bytes_per_line - width; const int dest_pad = (dst_bytes_per_line >> 1) - width; + if (data->colortable.size() == 0) { + data->colortable.resize(256); + for (int i = 0; i < 256; ++i) + data->colortable[i] = qRgb(i, i, i); + } + const int tableSize = data->colortable.size() - 1; for (int i = 0; i < data->height; ++i) { src_data -= src_pad; @@ -2422,7 +2440,7 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers for (int pixI = 0; pixI < width; ++pixI) { --src_data; --dest_data; - const uint pixel = data->colortable[*src_data]; + const uint pixel = data->colortable[qMin(tableSize, *src_data)]; *dest_data = qt_colorConvert(pixel, 0); } } @@ -4061,7 +4079,7 @@ void QImage::setPixel(int x, int y, uint index_or_rgb) } break; case Format_Indexed8: - if (index_or_rgb > (uint)d->colortable.size()) { + if (index_or_rgb >= (uint)d->colortable.size()) { qWarning("QImage::setPixel: Index %d out of range", index_or_rgb); return; } diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index 16deb03..5052114 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -945,11 +945,11 @@ void tst_QImage::rotate() const int n = original.colorTable().size(); for (int x = 0; x < w; ++x) { original.setPixel(x, 0, x % n); - original.setPixel(x,h - 1, n - (x % n)); + original.setPixel(x, h - 1, n - (x % n) - 1); } for (int y = 0; y < h; ++y) { original.setPixel(0, y, y % n); - original.setPixel(w - 1, y, n - (y % n)); + original.setPixel(w - 1, y, n - (y % n) - 1); } } -- cgit v0.12 From 7bc00632dde1b718cbe1412e988ad006dc3d125f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 24 Jun 2010 15:11:05 +0200 Subject: Add a new (internal) flag QGraphicsItem::ItemStopsClickFocusPropagation. This flag allows you to create a non-focusable item that can be clicked on without changing the focus. This is also possible to achieve by using focus scopes / panels, however the implementation is then way more complex. Thew new flag is tailored for simple uses cases where you simply want to stop the propagation and nothing more. Auto test included. Task-number: QT-3499 Reviewed-by: yoann --- src/gui/graphicsview/qgraphicsitem.cpp | 8 ++++ src/gui/graphicsview/qgraphicsitem.h | 3 +- src/gui/graphicsview/qgraphicsitem_p.h | 6 +-- src/gui/graphicsview/qgraphicsscene.cpp | 2 + tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 54 ++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 2de3638..61285d2 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -411,6 +411,11 @@ these notifications are disabled by default. You must enable this flag to receive notifications for scene position changes. This flag was introduced in Qt 4.6. + + \omitvalue ItemStopsClickFocusPropagation \omit The item stops propagating + click focus to items underneath when being clicked on. This flag + allows you create a non-focusable item that can be clicked on without + changing the focus. \endomit */ /*! @@ -11432,6 +11437,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemSendsScenePositionChanges: str = "ItemSendsScenePositionChanges"; break; + case QGraphicsItem::ItemStopsClickFocusPropagation: + str = "ItemStopsClickFocusPropagation"; + break; } debug << str; return debug; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index d7d5332..3c193cd 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -106,7 +106,8 @@ public: ItemNegativeZStacksBehindParent = 0x2000, ItemIsPanel = 0x4000, ItemIsFocusScope = 0x8000, // internal - ItemSendsScenePositionChanges = 0x10000 + ItemSendsScenePositionChanges = 0x10000, + ItemStopsClickFocusPropagation = 0x20000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index bde6e7d..f9f5d3d 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -556,7 +556,7 @@ public: quint32 dirtyChildrenBoundingRect : 1; // Packed 32 bits - quint32 flags : 17; + quint32 flags : 18; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; quint32 geometryChanged : 1; @@ -571,9 +571,9 @@ public: quint32 notifyBoundingRectChanged : 1; quint32 notifyInvalidated : 1; quint32 mouseSetsFocus : 1; - quint32 explicitActivate : 1; // New 32 bits + quint32 explicitActivate : 1; quint32 wantsActive : 1; quint32 holesInSiblingIndex : 1; quint32 sequentialOrdering : 1; @@ -582,7 +582,7 @@ public: quint32 pendingPolish : 1; quint32 mayHaveChildWithGraphicsEffect : 1; quint32 isDeclarativeItem : 1; - quint32 padding : 24; + quint32 padding : 23; // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index ca3b56f..d04074a 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1336,6 +1336,8 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou break; } } + if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) + break; if (item->isPanel()) break; } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index fe68c8e..31a6845 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -442,6 +442,7 @@ private slots: void updateMicroFocus(); void textItem_shortcuts(); void scroll(); + void stopClickFocusPropagation(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -10268,6 +10269,59 @@ void tst_QGraphicsItem::scroll() QCOMPARE(item2->lastExposedRect, expectedItem2Expose); } +void tst_QGraphicsItem::stopClickFocusPropagation() +{ + class MyItem : public QGraphicsRectItem + { + public: + MyItem() : QGraphicsRectItem(0, 0, 100, 100) {} + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) + { + painter->fillRect(boundingRect(), hasFocus() ? QBrush(Qt::red) : brush()); + } + }; + + QGraphicsScene scene(-50, -50, 400, 400); + scene.setStickyFocus(true); + + QGraphicsRectItem *noFocusOnTop = new MyItem; + noFocusOnTop->setBrush(Qt::yellow); + noFocusOnTop->setFlag(QGraphicsItem::ItemStopsClickFocusPropagation); + + QGraphicsRectItem *focusableUnder = new MyItem; + focusableUnder->setBrush(Qt::blue); + focusableUnder->setFlag(QGraphicsItem::ItemIsFocusable); + focusableUnder->setPos(50, 50); + + QGraphicsRectItem *itemWithFocus = new MyItem; + itemWithFocus->setBrush(Qt::black); + itemWithFocus->setFlag(QGraphicsItem::ItemIsFocusable); + itemWithFocus->setPos(250, 10); + + scene.addItem(noFocusOnTop); + scene.addItem(focusableUnder); + scene.addItem(itemWithFocus); + focusableUnder->stackBefore(noFocusOnTop); + itemWithFocus->setFocus(); + + QGraphicsView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + QApplication::setActiveWindow(&view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&view)); + QVERIFY(itemWithFocus->hasFocus()); + + QPointF mousePressPoint = noFocusOnTop->mapToScene(QPointF()); + mousePressPoint.rx() += 60; + mousePressPoint.ry() += 60; + const QList itemsAtMousePressPosition = scene.items(mousePressPoint); + QVERIFY(itemsAtMousePressPosition.contains(focusableUnder)); + + sendMousePress(&scene, mousePressPoint); + QVERIFY(itemWithFocus->hasFocus()); +} + void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor() { struct Item : public QGraphicsTextItem -- cgit v0.12 From 3b7ae67fe2715838c32ff28694761e57e4f79537 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 25 Jun 2010 09:36:50 +0200 Subject: Fix compilation when configured with -no-xrender Reviewed-by: Eskil --- src/gui/kernel/qapplication_x11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 3664743..e4d9848 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2155,7 +2155,7 @@ void qt_init(QApplicationPrivate *priv, int, X11->fc_scale = fc_scale; for (int s = 0; s < ScreenCount(X11->display); ++s) { int subpixel = FC_RGBA_UNKNOWN; -#if RENDER_MAJOR > 0 || RENDER_MINOR >= 6 +#if !defined(QT_NO_XRENDER) && (RENDER_MAJOR > 0 || RENDER_MINOR >= 6) if (X11->use_xrender) { int rsp = XRenderQuerySubpixelOrder(X11->display, s); switch (rsp) { -- cgit v0.12 From 1223f3f3d32bdc394a0fcd8d034fb3ad0afab0c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 24 Jun 2010 15:15:56 +0200 Subject: Fixed autotest failure in QPainter::setOpacity when NEON is used. Be more lenient in the comparison, rounding errors might lead to slightly different values. Reviewed-by: Trond --- tests/auto/qpainter/tst_qpainter.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 701dc2e..27ee6e7 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -2648,12 +2648,16 @@ void tst_QPainter::setOpacity() p.drawImage(imageRect, src, imageRect); p.end(); - QImage expected(imageSize, destFormat); - p.begin(&expected); - p.fillRect(imageRect, QColor(127, 127, 127)); - p.end(); - - QCOMPARE(dest, expected); + QImage actual = dest.convertToFormat(QImage::Format_RGB32); + + for (int y = 0; y < actual.height(); ++y) { + QRgb *p = (QRgb *)actual.scanLine(y); + for (int x = 0; x < actual.width(); ++x) { + QVERIFY(qAbs(qRed(p[x]) - 127) <= 0xf); + QVERIFY(qAbs(qGreen(p[x]) - 127) <= 0xf); + QVERIFY(qAbs(qBlue(p[x]) - 127) <= 0xf); + } + } } void tst_QPainter::drawhelper_blend_untransformed_data() -- cgit v0.12 From a179ae5dd94d0c51ebbf7d5c5b8eef5b3099c163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 25 Jun 2010 14:11:44 +0200 Subject: Fixed autotest failure in QPathClipper on N900. We need to use double precision for the angle computations, as they are crucial to build correct winged edge structures. Reviewed-by: Trond --- src/gui/painting/qpathclipper.cpp | 48 +++++++++++++-------------------------- src/gui/painting/qpathclipper_p.h | 4 ++-- 2 files changed, 18 insertions(+), 34 deletions(-) diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 78553c9..a17b7c1 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -86,9 +86,11 @@ static qreal dot(const QPointF &a, const QPointF &b) return a.x() * b.x() + a.y() * b.y(); } -static QPointF normalize(const QPointF &p) +static void normalize(double &x, double &y) { - return p / qSqrt(p.x() * p.x() + p.y() * p.y()); + double reciprocal = 1 / qSqrt(x * x + y * y); + x *= reciprocal; + y *= reciprocal; } struct QIntersection @@ -1017,8 +1019,8 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const const QPathEdge *ap = edge(a); const QPathEdge *bp = edge(b); - qreal a_angle = ap->angle; - qreal b_angle = bp->angle; + double a_angle = ap->angle; + double b_angle = bp->angle; if (vertex == ap->second) a_angle = ap->invAngle; @@ -1026,7 +1028,7 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const if (vertex == bp->second) b_angle = bp->invAngle; - qreal result = b_angle - a_angle; + double result = b_angle - a_angle; if (result >= 128.) return result - 128.; @@ -1036,26 +1038,6 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const return result; } -static inline QPointF tangentAt(const QWingedEdge &list, int vi, int ei) -{ - const QPathEdge *ep = list.edge(ei); - Q_ASSERT(ep); - - qreal sign; - - if (ep->first == vi) { - sign = 1; - } else { - sign = -1; - } - - const QPointF a = *list.vertex(ep->first); - const QPointF b = *list.vertex(ep->second); - QPointF normal = b - a; - - return normalize(sign * normal); -} - static inline QPointF midPoint(const QWingedEdge &list, int ei) { const QPathEdge *ep = list.edge(ei); @@ -1191,7 +1173,7 @@ static int commonEdge(const QWingedEdge &list, int a, int b) return -1; } -static qreal computeAngle(const QPointF &v) +static double computeAngle(const QPointF &v) { #if 1 if (v.x() == 0) { @@ -1200,15 +1182,17 @@ static qreal computeAngle(const QPointF &v) return v.x() <= 0 ? 32. : 96.; } - QPointF nv = normalize(v); - if (nv.y() < 0) { - if (nv.x() < 0) { // 0 - 32 - return -32. * nv.x(); + double vx = v.x(); + double vy = v.y(); + normalize(vx, vy); + if (vy < 0) { + if (vx < 0) { // 0 - 32 + return -32. * vx; } else { // 96 - 128 - return 128. - 32. * nv.x(); + return 128. - 32. * vx; } } else { // 32 - 96 - return 64. + 32 * nv.x(); + return 64. + 32. * vx; } #else // doesn't seem to be robust enough diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h index fab618d..bdad4e1 100644 --- a/src/gui/painting/qpathclipper_p.h +++ b/src/gui/painting/qpathclipper_p.h @@ -148,8 +148,8 @@ public: int first; int second; - qreal angle; - qreal invAngle; + double angle; + double invAngle; int next(Traversal traversal, Direction direction) const; -- cgit v0.12 From 02e44e7d93dd5336ab9415af98f2021e542eff31 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Fri, 25 Jun 2010 16:22:50 +0200 Subject: Export the QGLPixmapData so that we can override it in a custom graphics system. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2422 Reviewed-by: Samuel Rødal --- src/opengl/qpixmapdata_gl_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h index c239bcb..736a28e 100644 --- a/src/opengl/qpixmapdata_gl_p.h +++ b/src/opengl/qpixmapdata_gl_p.h @@ -96,7 +96,7 @@ private: }; -class QGLPixmapData : public QPixmapData +class Q_OPENGL_EXPORT QGLPixmapData : public QPixmapData { public: QGLPixmapData(PixelType type); -- cgit v0.12 From 535adbb4954caff9d88dc57bdb57bd09b872ddf1 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Fri, 25 Jun 2010 16:22:51 +0200 Subject: Export QGLWindowSurface too. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2422 Reviewed-by: Samuel Rødal --- src/opengl/qwindowsurface_gl_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index 8ea714c..624236c 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -77,7 +77,7 @@ public: QGLWindowSurfacePrivate* d; }; -class QGLWindowSurface : public QObject, public QWindowSurface // , public QPaintDevice +class Q_OPENGL_EXPORT QGLWindowSurface : public QObject, public QWindowSurface // , public QPaintDevice { Q_OBJECT public: -- cgit v0.12 From c5aa53243bca8261d55d81cfeb525739a68b7703 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Fri, 25 Jun 2010 16:22:52 +0200 Subject: Need to access extensionFuncs in subclasses too. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2422 Reviewed-by: Samuel Rødal --- src/opengl/qgl.cpp | 7 +++++++ src/opengl/qgl_p.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index b4c85ac..71db7a8 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2220,6 +2220,13 @@ static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum textu } } +#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) +QGLExtensionFuncs& QGLContextPrivate::extensionFuncs(const QGLContext *) +{ + return qt_extensionFuncs; +} +#endif + QImage QGLContextPrivate::convertToGLFormat(const QImage &image, bool force_premul, GLenum texture_format) { diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 1727a41..c7fd111 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -415,7 +415,7 @@ public: #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) static QGLExtensionFuncs qt_extensionFuncs; - static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *) { return qt_extensionFuncs; } + static QGLExtensionFuncs& extensionFuncs(const QGLContext *); #endif static void setCurrentContext(QGLContext *context); -- cgit v0.12 From cc75093e3b300a37d05a81921d7811caabbfb449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 25 Jun 2010 17:21:26 +0200 Subject: EGL plane levels are the same as all other GL backends. Qt has never used level 1 for the main plane, it's always been 0 and will always be 0. Reviewed-by: Harald Fernengel --- src/opengl/qgl_egl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 0a19531..58d3b0a 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -138,7 +138,7 @@ void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config) format.setDepthBufferSize(depthSize); format.setStencilBufferSize(stencilSize); format.setSamples(sampleCount); - format.setPlane(level + 1); // EGL calls level 0 "normal" whereas Qt calls 1 "normal" + format.setPlane(level); format.setDirectRendering(true); // All EGL contexts are direct-rendered format.setRgba(true); // EGL doesn't support colour index rendering format.setStereo(false); // EGL doesn't support stereo buffers -- cgit v0.12 From fd8e9eadd087d11b0a01d598132ccbb19667fa5a Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Mon, 28 Jun 2010 12:55:02 +0200 Subject: New variant of ::createPixmapData with origin for QGraphicsSystem. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 705 Reviewed-by: Samuel Rødal --- src/gui/painting/qgraphicssystem.cpp | 4 ++++ src/gui/painting/qgraphicssystem_p.h | 1 + src/gui/painting/qgraphicssystem_runtime.cpp | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index 2ea3d33..69ce47e 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -79,5 +79,9 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ return 0; } +QPixmapData *QGraphicsSystem::createPixmapData(QPixmapData *origin) +{ + return createPixmapData(origin->pixelType()); +} QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index ddca788..1211505 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -64,6 +64,7 @@ class Q_GUI_EXPORT QGraphicsSystem { public: virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; + virtual QPixmapData *createPixmapData(QPixmapData *origin); virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; virtual ~QGraphicsSystem() = 0; diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 32a8578..1c3ae10 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -416,7 +416,7 @@ void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name) for (int i = 0; i < m_pixmapDatas.size(); ++i) { QRuntimePixmapData *proxy = m_pixmapDatas.at(i); - QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data->pixelType()); + QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data); // ### TODO Optimize. Openvg and s60raster graphics systems could switch internal ARGB32_PRE QImage buffers. newData->fromImage(proxy->m_data->toImage(), Qt::AutoColor | Qt::OrderedAlphaDither); delete proxy->m_data; -- cgit v0.12 From 7d0f824e023e8b4b45d67c1d3556c73d296bb5bd Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 28 Jun 2010 14:31:57 +0200 Subject: Add a manual test for regular widget interaction with the table. The code paths are different if the tablet event is accepted or not. This manuel test show the events received from tablet and mouse to make sure we get the right events in the right order. --- tests/manual/qtabletevent/regular_widgets/main.cpp | 109 +++++++++++++++++++++ .../regular_widgets/regular_widgets.pro | 3 + 2 files changed, 112 insertions(+) create mode 100644 tests/manual/qtabletevent/regular_widgets/main.cpp create mode 100644 tests/manual/qtabletevent/regular_widgets/regular_widgets.pro diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp new file mode 100644 index 0000000..e0c53f5 --- /dev/null +++ b/tests/manual/qtabletevent/regular_widgets/main.cpp @@ -0,0 +1,109 @@ +#include +#include +#include +#include +#include + +class EventReportWidget : public QWidget +{ +public: + EventReportWidget(); +protected: + void mouseDoubleClickEvent(QMouseEvent *event) { outputMouseEvent(event); } + void mouseMoveEvent(QMouseEvent *event) { outputMouseEvent(event); } + void mousePressEvent(QMouseEvent *event) { outputMouseEvent(event); } + void mouseReleaseEvent(QMouseEvent *event) { outputMouseEvent(event); } + + void tabletEvent(QTabletEvent *); + +private: + void outputMouseEvent(QMouseEvent *event); + + bool m_lastIsMouseMove; + bool m_lastIsTabletMove; +}; + +EventReportWidget::EventReportWidget() + : m_lastIsMouseMove(false) + , m_lastIsTabletMove(false) +{ } + +void EventReportWidget::tabletEvent(QTabletEvent *event) +{ + QWidget::tabletEvent(event); + + QString type; + switch (event->type()) { + case QEvent::TabletEnterProximity: + m_lastIsTabletMove = false; + type = QString::fromLatin1("TabletEnterProximity"); + break; + case QEvent::TabletLeaveProximity: + m_lastIsTabletMove = false; + type = QString::fromLatin1("TabletLeaveProximity"); + break; + case QEvent::TabletMove: + if (m_lastIsTabletMove) + return; + + m_lastIsTabletMove = true; + type = QString::fromLatin1("TabletMove"); + break; + case QEvent::TabletPress: + m_lastIsTabletMove = false; + type = QString::fromLatin1("TabletPress"); + break; + case QEvent::TabletRelease: + m_lastIsTabletMove = false; + type = QString::fromLatin1("TabletRelease"); + break; + default: + Q_ASSERT(false); + break; + } + + qDebug() << "Tablet event, type = " << type + << " position = " << event->pos() + << " global position = " << event->globalPos(); +} + +void EventReportWidget::outputMouseEvent(QMouseEvent *event) +{ + QString type; + switch (event->type()) { + case QEvent::MouseButtonDblClick: + m_lastIsMouseMove = false; + type = QString::fromLatin1("MouseButtonDblClick"); + break; + case QEvent::MouseButtonPress: + m_lastIsMouseMove = false; + type = QString::fromLatin1("MouseButtonPress"); + break; + case QEvent::MouseButtonRelease: + m_lastIsMouseMove = false; + type = QString::fromLatin1("MouseButtonRelease"); + break; + case QEvent::MouseMove: + if (m_lastIsMouseMove) + return; // only show one move to keep things readable + + m_lastIsMouseMove = true; + type = QString::fromLatin1("MouseMove"); + break; + default: + Q_ASSERT(false); + break; + } + + qDebug() << "Mouse event, type = " << type + << " position = " << event->pos() + << " global position = " << event->globalPos(); +} + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + EventReportWidget widget; + widget.show(); + return app.exec(); +} diff --git a/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro b/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro new file mode 100644 index 0000000..9f0da76 --- /dev/null +++ b/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro @@ -0,0 +1,3 @@ +TEMPLATE = app + +SOURCES += main.cpp -- cgit v0.12 From b1b46a21ea4aae5711130850e1bb19b0728a22ec Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 28 Jun 2010 15:42:20 +0200 Subject: Fix an assertion in comp_func_SourceOver_sse2() if const_alpha == 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Const_alpha == 0 is a corner case that can happen if the painter draw with zero opacity or if the multiplication of alphas is below 1. The assertion was failing for one of the test of QPainter. Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper_sse2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 04fe825..6cd8688 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -299,7 +299,7 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha) { - Q_ASSERT(const_alpha > 0); // if const_alpha == 0, this should never be called + Q_ASSERT(const_alpha >= 0); Q_ASSERT(const_alpha < 256); const quint32 *src = (const quint32 *) srcPixels; -- cgit v0.12 From 1209a398c3b59b21b38036fffd4fb2442320e5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 29 Jun 2010 12:51:53 +0200 Subject: Made -graphicssystem trace work with Qt::TextBypassShaping flag. The QPaintBuffer gets the text from the text item in order to stream it. Reviewed-by: Jocelyn Turcotte --- src/gui/painting/qpainter.cpp | 2 +- src/gui/text/qtextengine.cpp | 4 ++-- src/gui/text/qtextengine_p.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 71bc990..2ea6673 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5958,7 +5958,7 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif Q_ASSERT_X(false, Q_FUNC_INFO, "stringToCMap shouldn't fail twice"); } - QTextItemInt gf(glyphs, &d->state->font, fontEngine); + QTextItemInt gf(glyphs, &d->state->font, str.data(), len, fontEngine); drawTextItem(p, gf); return; } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 60195a8..439f2a4 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2668,9 +2668,9 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo flags |= QTextItem::StrikeOut; } -QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, QFontEngine *fe) +QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe) : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), - num_chars(0), chars(0), logClusters(0), f(font), glyphs(g), fontEngine(fe) + num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe) { } diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 908a0ec..e623fa5 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -311,7 +311,7 @@ public: logClusters(0), f(0), fontEngine(0) {} QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFormat &format = QTextCharFormat()); - QTextItemInt(const QGlyphLayout &g, QFont *font, QFontEngine *fe); + QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars, int numChars, QFontEngine *fe); /// copy the structure items, adjusting the glyphs arrays to the right subarrays. /// the width of the returned QTextItemInt is not adjusted, for speed reasons -- cgit v0.12 From 497fd44414dea6314731b96869e2d49bb8b439b5 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Tue, 29 Jun 2010 15:10:39 +0200 Subject: Doc: QSettings::sync() imports changes made by other processes. Task-number: QTBUG-5949 Reviewed-by: Morten Engvoldsen --- src/corelib/io/qsettings.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 64015ce..f802412 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2274,9 +2274,9 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, be different instances of your application running at the same time or different applications altogether) to read and write to the same system locations. It uses advisory file locking and a - smart merging algorithm to ensure data integrity. Changes - performed by another process aren't visible in the current - process until sync() is called. + smart merging algorithm to ensure data integrity. Note that sync() + imports changes made by other processes (in addition to writing + the changes from this QSettings). \section1 Platform-Specific Notes -- cgit v0.12 From e47512726bc4dcf23db680f0516fc46a634fcef4 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 30 Jun 2010 16:15:04 +1000 Subject: Fixed ARM .def files. Update for commits fd8e9eadd087d11b0a01d598132ccbb19667fa5a and fb76a872e20bd0df8e7bbe9c039b7f20423c6f12, which add private exports. --- src/s60installs/eabi/QtGuiu.def | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index e7d865b..45be23e 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12020,4 +12020,9 @@ EXPORTS _ZN10QImageData14convertInPlaceEN6QImage6FormatE6QFlagsIN2Qt19ImageConversionFlagEE @ 12019 NONAME _ZN17QRasterPixmapData20createPixmapForImageER6QImage6QFlagsIN2Qt19ImageConversionFlagEEb @ 12020 NONAME _ZN17QRasterPixmapData8fromDataEPKhjPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 12021 NONAME + _ZN15QGraphicsSystem16createPixmapDataEP11QPixmapData @ 12022 NONAME + _ZN17QRasterPixmapData4copyEPK11QPixmapDataRK5QRect @ 12023 NONAME + _ZNK11QPixmapData7toImageERK5QRect @ 12024 NONAME + _ZNK17QRasterPixmapData7toImageERK5QRect @ 12025 NONAME + _ZTV15QGraphicsSystem @ 12026 NONAME -- cgit v0.12 From 30ef2af599f85fef56b975f45fd4edfe817a449a Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Wed, 30 Jun 2010 10:30:47 +0300 Subject: QFileDialog broken in landscape in N8 The screen estate runs out for nHD landscape. Due to this, all "system" dialogs (file, color, font dialogs and wizards) in Symbian are now shown in fullscreen mode, instead of being just maximized. Task-number: QTBUG-11668 Reviewed-by: Miikka Heikkinen --- src/gui/dialogs/qdialog.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index a6bd78a..c2184f2 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -527,14 +527,19 @@ int QDialog::exec() #endif //QT_NO_MENUBAR #endif //Q_WS_WINCE_WM + bool showSystemDialogFullScreen = false; #ifdef Q_OS_SYMBIAN if (qobject_cast(this) || qobject_cast(this) || - qobject_cast(this) || qobject_cast(this)) - showMaximized(); - else + qobject_cast(this) || qobject_cast(this)) { + showSystemDialogFullScreen = true; + } #endif // Q_OS_SYMBIAN - show(); + if (showSystemDialogFullScreen) { + setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint); + setWindowState(Qt::WindowFullScreen); + } + show(); #ifdef Q_WS_MAC d->mac_nativeDialogModalHelp(); @@ -892,8 +897,6 @@ void QDialog::adjustPosition(QWidget* w) bool QDialog::s60AdjustedPosition() { QPoint p; - const QSize mainAreaSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); - const int statusPaneHeight = (S60->screenHeightInPixels - mainAreaSize.height())>>1; const bool doS60Positioning = !(isFullScreen()||isMaximized()); if (doS60Positioning) { // naive way to deduce screen orientation -- cgit v0.12 From 8ea60a39a8c4661db505a6dc1342e524ec2e460c Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 30 Jun 2010 12:15:49 +0200 Subject: Fixed a crash in menubar with invisible actions That would happen because the loop to find the next action when navigating with the keyboard was not good enough. Task-number: QTBUG-11823 --- src/gui/widgets/qmenubar.cpp | 2 +- tests/auto/qmenubar/tst_qmenubar.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index aa4ffce..e8e80b7 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -768,7 +768,7 @@ QAction *QMenuBarPrivate::getNextAction(const int _start, const int increment) c const int start = (_start == -1 && increment == -1) ? actions.count() : _start; const int end = increment == -1 ? 0 : actions.count() - 1; - for (int i = start; start != end;) { + for (int i = start; i != end;) { i += increment; QAction *current = actions.at(i); if (!actionRects.at(i).isNull() && (allowActiveAndDisabled || current->isEnabled())) diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 4cb63a1..cc9fb0c 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -168,6 +168,7 @@ private slots: void task256322_highlight(); void menubarSizeHint(); void taskQTBUG4965_escapeEaten(); + void taskQTBUG11823_crashwithInvisibleActions(); #if defined(QT3_SUPPORT) void indexBasedInsertion_data(); @@ -1690,6 +1691,34 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten() QTRY_VERIFY(!menubar.isVisible()); } +void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions() +{ + QMenuBar menubar; + menubar.setNativeMenuBar(false); //we can't check the geometry of native menubars + + QAction * m = menubar.addAction( "&m" ); + QAction * a = menubar.addAction( "&a" ); + + menubar.show(); + QApplication::setActiveWindow(&menubar); + QTest::qWaitForWindowShown(&menubar); + menubar.setActiveAction(m); + QCOMPARE(menubar.activeAction(), m); + QTest::keyClick(0, Qt::Key_Right); + QCOMPARE(menubar.activeAction(), a); + QTest::keyClick(0, Qt::Key_Right); + QCOMPARE(menubar.activeAction(), m); + a->setVisible(false); + + menubar.setActiveAction(m); + QCOMPARE(menubar.activeAction(), m); //the active action shouldn't have changed + + //it used to crash here because the action is invisible + QTest::keyClick(0, Qt::Key_Right); + QCOMPARE(menubar.activeAction(), m); //the active action shouldn't have changed +} + + #if defined(QT3_SUPPORT) void tst_QMenuBar::indexBasedInsertion_data() { -- cgit v0.12 From 0ee2330ec237cf5baeabe4833fb8b6cad503fb7c Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 30 Jun 2010 12:43:52 +0200 Subject: Added textureUpload benchmark to the GL benchmarks --- tests/benchmarks/opengl/main.cpp | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tests/benchmarks/opengl/main.cpp b/tests/benchmarks/opengl/main.cpp index beb4d43..c042fce 100644 --- a/tests/benchmarks/opengl/main.cpp +++ b/tests/benchmarks/opengl/main.cpp @@ -75,6 +75,10 @@ private slots: void gradients_data(); void gradients(); + void textureUpload_data(); + void textureUpload(); + + private: QGLPixelBuffer *pb; }; @@ -374,6 +378,53 @@ void OpenGLBench::gradients() } } +void OpenGLBench::textureUpload_data() +{ + QTest::addColumn("size"); + QTest::addColumn("flags"); + QTest::addColumn("format"); + + int sizes[] = { 8, 10, 16, 20, 32, 50, 64, 100, 128, 200, 256, 500, 512, 1000, 1024, 2000, 2048, -1 }; + int flags[] = { QGLContext::InternalBindOption, + QGLContext::DefaultBindOption, + -1 }; + int formats[] = { GL_RGB, GL_RGBA, -1 }; + + for (int s = 0; sizes[s] != -1; ++s) { + for (int f = 0; flags[f] != -1; ++f) { + for (int a = 0; formats[a] != -1; ++a) { + QByteArray name; + name.append("size=").append(QByteArray::number(sizes[s])); + name.append(", flags=").append(f == 0 ? "internal" : "default"); + name.append(", format=").append(a == 0 ? "RGB" : "RGBA"); + QTest::newRow(name.constData()) << sizes[s] << flags[f] << formats[a]; + } + } + } +} + +void OpenGLBench::textureUpload() +{ + QFETCH(int, size); + QFETCH(int, flags); + QFETCH(int, format); + + QPixmap pixmap(size, size); + + if (format == GL_RGB) + pixmap.fill(Qt::red); + else + pixmap.fill(Qt::transparent); + + pb->makeCurrent(); + QGLContext *context = const_cast(QGLContext::currentContext()); + QTime time; + + time.start(); + context->bindTexture(pixmap, GL_TEXTURE_2D, format, (QGLContext::BindOptions) flags); + QTest::setBenchmarkResult(time.elapsed(), QTest::WalltimeMilliseconds); +} + QTEST_MAIN(OpenGLBench) #include "main.moc" -- cgit v0.12 From 6ea8ad02e1929f98744f7b18f20fa91223cb4398 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 30 Jun 2010 21:23:23 +1000 Subject: Add missing license header. --- tests/manual/qtabletevent/regular_widgets/main.cpp | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp index e0c53f5..a39e094 100644 --- a/tests/manual/qtabletevent/regular_widgets/main.cpp +++ b/tests/manual/qtabletevent/regular_widgets/main.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the FOO module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include #include #include -- cgit v0.12 From 922493a72c033a43f59caebcd8ce7fe060df0d4c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 30 Jun 2010 13:45:52 +0200 Subject: Stopped trying to output QML property list in 2 columns Task-number: QTBUG-11009, QTBUG-11096 --- tools/qdoc3/htmlgenerator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index b93db4f..044c458 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4413,6 +4413,7 @@ void HtmlGenerator::generateQmlSummary(const Section& section, bool twoColumn = false; if (section.members.first()->type() == Node::QmlProperty) { twoColumn = (count >= 5); + twoColumn = false; } if (twoColumn) out() << "\n"; -- cgit v0.12 From c16162214eb8757a62e221c34d38cefc402e5b05 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 29 Jun 2010 17:28:19 +0200 Subject: Add QPixmap::fromImageReader() to decode arbitrary images in place. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Decoding in-place with QPixmap::fromData() has limitations, it cannot be used with animated gif images, and the user has no control over the parameters of the image reader. Reader the image directly from the image reader allow us to do a better job when loading images. Reviewed-by: Simon Hausmann Reviewed-by: Samuel Rødal --- src/gui/image/qpixmap.cpp | 23 ++++++++++++++++++++++- src/gui/image/qpixmap.h | 2 ++ src/gui/image/qpixmapdata.cpp | 7 +++++++ src/gui/image/qpixmapdata_p.h | 4 ++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index fd2c139..ef9be8f 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -2018,7 +2018,7 @@ void QPixmap::detach() the color table. If this is too expensive an operation, you can use QBitmap::fromImage() instead. - \sa toImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} + \sa fromImageReader(), toImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} */ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) { @@ -2033,6 +2033,27 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) } /*! + \fn QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) + + Create a QPixmap from an image read directly from an \a imageReader. + The \a flags argument is a bitwise-OR of the \l{Qt::ImageConversionFlags}. + Passing 0 for \a flags sets all the default options. + + On some systems, reading an image directly to QPixmap can use less memory than + reading a QImage to convert it to QPixmap. + + \sa fromImage(), toImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} +*/ +QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) +{ + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + QScopedPointer data(gs ? gs->createPixmapData(QPixmapData::PixmapType) + : QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixmapType)); + data->fromImageReader(imageReader, flags); + return QPixmap(data.take()); +} + +/*! \fn QPixmap QPixmap::grabWindow(WId window, int x, int y, int width, int height) diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 82546da..64ca8a3 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -62,6 +62,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QImageWriter; +class QImageReader; class QColor; class QVariant; class QX11Info; @@ -134,6 +135,7 @@ public: QImage toImage() const; static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor); + static QPixmap fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags = Qt::AutoColor); bool load(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); bool loadFromData(const uchar *buf, uint len, const char* format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 345e3cf..ef1f6c4 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -124,6 +124,13 @@ static QImage makeBitmapCompliantIfNeeded(QPixmapData *d, const QImage &image, Q return image; } +void QPixmapData::fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags) +{ + const QImage image = imageReader->read(); + fromImage(image, flags); +} + bool QPixmapData::fromFile(const QString &fileName, const char *format, Qt::ImageConversionFlags flags) { diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 9a1505a..ec62b0b 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -58,6 +58,8 @@ QT_BEGIN_NAMESPACE +class QImageReader; + class Q_GUI_EXPORT QPixmapData { public: @@ -83,6 +85,8 @@ public: virtual void resize(int width, int height) = 0; virtual void fromImage(const QImage &image, Qt::ImageConversionFlags flags) = 0; + virtual void fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags); virtual bool fromFile(const QString &filename, const char *format, Qt::ImageConversionFlags flags); -- cgit v0.12 From 176024dfea7d354451a65b61fa2e82dd422b4dfb Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 29 Jun 2010 19:47:53 +0200 Subject: Add the conversion in-place for QPixmap::fromImageReader() on raster. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since raster uses QImage internal, QPixmap::fromImageReader() can use conversion in-place of the image. This avoid a memory peak during the conversion and is a bit faster. Reviewed-by: Samuel Rødal --- src/gui/image/qpixmap_raster.cpp | 11 ++++ src/gui/image/qpixmap_raster_p.h | 1 + .../designer_indexed8_with_alpha_animated.gif | Bin 0 -> 4138 bytes tests/auto/qpixmap/tst_qpixmap.cpp | 61 +++++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index e188745..53f3559 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -152,6 +152,17 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage, createPixmapForImage(image, flags, /* inplace = */false); } +void QRasterPixmapData::fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags) +{ + Q_UNUSED(flags); + QImage image = imageReader->read(); + if (image.isNull()) + return; + + createPixmapForImage(image, flags, /* inplace = */true); +} + // from qwindowsurface.cpp extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index a46e054..36a9b2f 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -74,6 +74,7 @@ public: void fromFile(const QString &filename, Qt::ImageConversionFlags flags); bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); + void fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags); void copy(const QPixmapData *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif new file mode 100644 index 0000000..f813c05 Binary files /dev/null and b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif differ diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 179f068..f22edf6 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -175,6 +176,11 @@ private slots: void loadFromDataImage_data(); void loadFromDataImage(); + void fromImageReader_data(); + void fromImageReader(); + + void fromImageReaderAnimatedGif(); + void preserveDepth(); void splash_crash(); @@ -1577,6 +1583,61 @@ void tst_QPixmap::loadFromDataImage() QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap)); } +void tst_QPixmap::fromImageReader_data() +{ + QTest::addColumn("imagePath"); +#ifdef Q_OS_SYMBIAN + const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; +#else + const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; +#endif + QTest::newRow("designer_argb32.png") << prefix + "/designer_argb32.png"; + QTest::newRow("designer_indexed8_no_alpha.png") << prefix + "/designer_indexed8_no_alpha.png"; + QTest::newRow("designer_indexed8_with_alpha.png") << prefix + "/designer_indexed8_with_alpha.png"; + QTest::newRow("designer_rgb32.png") << prefix + "/designer_rgb32.png"; + QTest::newRow("designer_indexed8_no_alpha.gif") << prefix + "/designer_indexed8_no_alpha.gif"; + QTest::newRow("designer_indexed8_with_alpha.gif") << prefix + "/designer_indexed8_with_alpha.gif"; + QTest::newRow("designer_rgb32.jpg") << prefix + "/designer_rgb32.jpg"; +} + +void tst_QPixmap::fromImageReader() +{ + QFETCH(QString, imagePath); + + QImage imageRef(imagePath); + QPixmap pixmapWithCopy = QPixmap::fromImage(imageRef); + + QImageReader imageReader(imagePath); + + QPixmap directLoadingPixmap = QPixmap::fromImageReader(&imageReader); + + QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap)); +} + +void tst_QPixmap::fromImageReaderAnimatedGif() +{ +#ifdef Q_OS_SYMBIAN + const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; +#else + const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; +#endif + const QString path = prefix + QString::fromLatin1("/designer_indexed8_with_alpha_animated.gif"); + + QImageReader referenceReader(path); + QImageReader pixmapReader(path); + + Q_ASSERT(referenceReader.canRead()); + Q_ASSERT(referenceReader.imageCount() > 1); + + for (int i = 0; i < referenceReader.imageCount(); ++i) { + QImage refImage = referenceReader.read(); + QPixmap refPixmap = QPixmap::fromImage(refImage); + + QPixmap directLoadingPixmap = QPixmap::fromImageReader(&pixmapReader); + QVERIFY(pixmapsAreEqual(&refPixmap, &directLoadingPixmap)); + } +} + void tst_QPixmap::task_246446() { // This crashed without the bugfix in 246446 -- cgit v0.12 From 15adb214c92d9e40697b01ab48111d8721b5ef08 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 30 Jun 2010 14:40:20 +0200 Subject: Doc: Fixed markup. Reviewed-by: Trust Me --- doc/src/index.qdoc | 6 +++--- tools/qdoc3/test/qt-html-templates.qdocconf | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index da50a6d..18a1746 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -70,15 +70,15 @@
  • Device UI's & Qt Quick
  • Desktop UI components
  • Platform-specific info
  • -
  • Graphics, Painting & Printing
  • -
  • Input/Output & networking
  • +
  • Graphics, Painting & Printing
  • +
  • Input/Output & networking
  • diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index b82e337..6b8e0a1 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -11,7 +11,7 @@ HTML.postheader = "
    \n" \ " Qt Reference Documentation\n" \ "
    \n" \ "
    \n" \ - " \n" \ + " \n" \ "
    \n" \ "
    \n" \ "
    \n" \ -- cgit v0.12 From f141de3daa267c266f67def765adb934138db080 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Wed, 30 Jun 2010 13:59:30 +0200 Subject: Adds slowdownFactor to UnifiedTimer in abstract animation The slowdown factor is useful for debugging complex animations. Setting it to 0 will stop all animations when slowMode is enabled. Submitted-by: Lasse Reviewed-by: Thierry --- src/corelib/animation/qabstractanimation.cpp | 11 ++++++++--- src/corelib/animation/qabstractanimation_p.h | 9 ++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 04342e7..7feb3f7 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -168,7 +168,7 @@ Q_GLOBAL_STATIC(QThreadStorage, unifiedTimer) QUnifiedTimer::QUnifiedTimer() : QObject(), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), currentAnimationIdx(0), consistentTiming(false), slowMode(false), - isPauseTimerActive(false), runningLeafAnimations(0) + slowdownFactor(5.0f), isPauseTimerActive(false), runningLeafAnimations(0) { time.invalidate(); } @@ -208,8 +208,13 @@ void QUnifiedTimer::updateAnimationsTime() // ignore consistentTiming in case the pause timer is active int delta = (consistentTiming && !isPauseTimerActive) ? timingInterval : time.elapsed() - lastTick; - if (slowMode) - delta /= 5; + if (slowMode) { + if (slowdownFactor > 0) + delta = qRound(delta / slowdownFactor); + else + delta = 0; + } + lastTick = time.elapsed(); //we make sure we only call update time if the time has actually changed diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index fcfe824..6ff18f5 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -145,8 +145,9 @@ public: */ void setConsistentTiming(bool consistent) { consistentTiming = consistent; } - //this facilitates fine-tuning of complex animations + //these facilitate fine-tuning of complex animations void setSlowModeEnabled(bool enabled) { slowMode = enabled; } + void setSlowdownFactor(qreal factor) { slowdownFactor = factor; } /* this is used for updating the currentTime of all animations in case the pause @@ -176,6 +177,12 @@ private: int currentAnimationIdx; bool consistentTiming; bool slowMode; + + // This factor will be used to divide the DEFAULT_TIMER_INTERVAL at each tick + // when slowMode is enabled. Setting it to 0 or higher than DEFAULT_TIMER_INTERVAL (16) + // stops all animations. + qreal slowdownFactor; + // bool to indicate that only pause animations are active bool isPauseTimerActive; -- cgit v0.12 From 38a04b3a8c7a33f1636008e04d58690febcc22f5 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Wed, 30 Jun 2010 14:48:11 +0200 Subject: Avoid calling time.elapsed() twice in abstract animation Reviewed-by: Thierry --- src/corelib/animation/qabstractanimation.cpp | 5 +++-- src/corelib/animation/qabstractanimation_p.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 7feb3f7..641b42b 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -205,9 +205,10 @@ void QUnifiedTimer::ensureTimerUpdate() void QUnifiedTimer::updateAnimationsTime() { + qint64 totalElapsed = time.elapsed(); // ignore consistentTiming in case the pause timer is active int delta = (consistentTiming && !isPauseTimerActive) ? - timingInterval : time.elapsed() - lastTick; + timingInterval : totalElapsed - lastTick; if (slowMode) { if (slowdownFactor > 0) delta = qRound(delta / slowdownFactor); @@ -215,7 +216,7 @@ void QUnifiedTimer::updateAnimationsTime() delta = 0; } - lastTick = time.elapsed(); + lastTick = totalElapsed; //we make sure we only call update time if the time has actually changed //it might happen in some cases that the time doesn't change because events are delayed diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 6ff18f5..d3d4098 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -172,7 +172,7 @@ private: ElapsedTimer time; - int lastTick; + qint64 lastTick; int timingInterval; int currentAnimationIdx; bool consistentTiming; -- cgit v0.12 From 3a2a6e8746b5076b5b7f496444479fa40067731c Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 30 Jun 2010 14:33:38 +0200 Subject: support BGRA textures on SGX Reviewed-by: Samuel --- src/opengl/qgl.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index b4c85ac..adc3aa3 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2331,9 +2331,6 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G && target == GL_TEXTURE_2D && (options & QGLContext::MipmapBindOption)) { -#ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - generating mipmaps (%d ms)\n", time.elapsed()); -#endif #if !defined(QT_OPENGL_ES_2) glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); #ifndef QT_OPENGL_ES @@ -2347,6 +2344,9 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #endif glTexParameterf(target, GL_TEXTURE_MIN_FILTER, options & QGLContext::LinearFilteringBindOption ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - generating mipmaps (%d ms)\n", time.elapsed()); +#endif } else { glTexParameterf(target, GL_TEXTURE_MIN_FILTER, filtering); } @@ -2371,7 +2371,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G if (premul) { img = img.convertToFormat(target_format = QImage::Format_ARGB32_Premultiplied); #ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - converting ARGB32 -> ARGB32_Premultiplied (%d ms) \n", time.elapsed()); + printf(" - converted ARGB32 -> ARGB32_Premultiplied (%d ms) \n", time.elapsed()); #endif } break; @@ -2379,7 +2379,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G if (!premul) { img = img.convertToFormat(target_format = QImage::Format_ARGB32); #ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - converting ARGB32_Premultiplied -> ARGB32 (%d ms)\n", time.elapsed()); + printf(" - converted ARGB32_Premultiplied -> ARGB32 (%d ms)\n", time.elapsed()); #endif } break; @@ -2396,20 +2396,17 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G ? QImage::Format_ARGB32_Premultiplied : QImage::Format_ARGB32); #ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - converting to 32-bit alpha format (%d ms)\n", time.elapsed()); + printf(" - converted to 32-bit alpha format (%d ms)\n", time.elapsed()); #endif } else { img = img.convertToFormat(QImage::Format_RGB32); #ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - converting to 32-bit (%d ms)\n", time.elapsed()); + printf(" - converted to 32-bit (%d ms)\n", time.elapsed()); #endif } } if (options & QGLContext::InvertedYBindOption) { -#ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - flipping bits over y (%d ms)\n", time.elapsed()); -#endif if (img.isDetached()) { int ipl = img.bytesPerLine() / 4; int h = img.height(); @@ -2426,17 +2423,20 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G // data twice. This version should only do it once. img = img.mirrored(); } +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - flipped bits over y (%d ms)\n", time.elapsed()); +#endif } if (externalFormat == GL_RGBA) { -#ifdef QGL_BIND_TEXTURE_DEBUG - printf(" - doing byte swapping (%d ms)\n", time.elapsed()); -#endif // The only case where we end up with a depth different from // 32 in the switch above is for the RGB16 case, where we set // the format to GL_RGB Q_ASSERT(img.depth() == 32); qgl_byteSwapImage(img, pixel_type); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - did byte swapping (%d ms)\n", time.elapsed()); +#endif } #ifdef QT_OPENGL_ES // OpenGL/ES requires that the internal and external formats be @@ -2465,7 +2465,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #ifdef QGL_BIND_TEXTURE_DEBUG static int totalUploadTime = 0; totalUploadTime += time.elapsed(); - printf(" - upload done in (%d ms) time=%d\n", time.elapsed(), totalUploadTime); + printf(" - upload done in %d ms, (accumulated: %d ms)\n", time.elapsed(), totalUploadTime); #endif @@ -5161,6 +5161,8 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= NVFloatBuffer; if (extensions.match("GL_ARB_pixel_buffer_object")) glExtensions |= PixelBufferObject; + if (extensions.match("GL_IMG_texture_format_BGRA8888")) + glExtensions |= BGRATextureFormat; #if defined(QT_OPENGL_ES_2) glExtensions |= FramebufferObject; glExtensions |= GenerateMipmap; -- cgit v0.12 From 7d80cd1f66fa6331c926674870d2a0dbe2921e77 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 30 Jun 2010 16:57:41 +0200 Subject: Fixes the documentation of QGraphicsEffect::update(). Reflects now the real behavior of this function. Related to a false bug report (QT-3481). Reviewed-by: sroedal --- src/gui/effects/qgraphicseffect.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 5e4e49e..0029017 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -488,13 +488,10 @@ void QGraphicsEffect::setEnabled(bool enable) */ /*! - Schedules a redraw of the source. Call this function whenever the source - needs to be redrawn. - - This convenience function is equivalent to calling - QGraphicsEffectSource::update(). + Schedules a redraw of the effect. Call this function whenever the effect + needs to be redrawn. This function does not trigger a redraw of the source. - \sa updateBoundingRect(), QGraphicsEffectSource::update() + \sa updateBoundingRect() */ void QGraphicsEffect::update() { -- cgit v0.12 From 38153cd6e94645ea21d037b2153d0b697c094949 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 1 Jul 2010 01:01:59 +1000 Subject: Minor Twitter demo enhancements First time I actually use it to tweet and I find two bugs... --- demos/declarative/twitter/TwitterCore/AuthView.qml | 1 + demos/declarative/twitter/TwitterCore/HomeTitleBar.qml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/demos/declarative/twitter/TwitterCore/AuthView.qml b/demos/declarative/twitter/TwitterCore/AuthView.qml index ef10258..4f75777 100644 --- a/demos/declarative/twitter/TwitterCore/AuthView.qml +++ b/demos/declarative/twitter/TwitterCore/AuthView.qml @@ -93,6 +93,7 @@ Item { color: "#151515"; selectionColor: "green" KeyNavigation.tab: login KeyNavigation.backtab: nameIn + onAccepted: login.doLogin(); } } } diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml index 52164ed..b26f7b3 100644 --- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml @@ -128,7 +128,7 @@ Item { cursorVisible: true; font.bold: true width: parent.width - 12 height: parent.height - 8 - font.pointSize: 10 + font.pixelSize: 12 wrapMode: TextEdit.Wrap color: "#151515"; selectionColor: "green" } -- cgit v0.12 From 01648005f1f546dc0281155fecd94b4f47a94584 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 30 Jun 2010 15:52:20 +0200 Subject: Moc: fix compilation when templated types with multiple arguments are used. Each template argument need to be normalized separately. Else, the const type of one argument may end up moved in the first argument. (And then the compilation of the generated moc file would fail as the types would not match) Reviewed-by: Kent Hansen Task-number: QTBUG-11647 --- src/corelib/kernel/qmetaobject_p.h | 11 +++++++---- tests/auto/moc/tst_moc.cpp | 19 +++++++++++++++++++ tests/auto/qmetaobject/tst_qmetaobject.cpp | 2 ++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index b538787..4a03874 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -276,12 +276,15 @@ static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixSc ++templdepth; if (c == '>') --templdepth; - if (templdepth == 0) { + if (templdepth == 0 || (templdepth == 1 && c == ',')) { result += normalizeTypeInternal(tt, t-1, fixScope, false); result += c; - if (*t == '>') - result += ' '; // avoid >> - break; + if (templdepth == 0) { + if (*t == '>') + result += ' '; // avoid >> + break; + } + tt = t; } } } diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index a56d842..19f3677 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -1322,6 +1322,25 @@ public slots: void foo(struct const_ *) {}; }; + +template +class TestTemplate2 +{ +}; + +class QTBUG11647_constInTemplateParameter : public QObject +{ Q_OBJECT +public slots: + void testSlot(TestTemplate2) {} + void testSlot2(TestTemplate2) {} + void testSlot3(TestTemplate2 const *, + TestTemplate2< TestTemplate2 < void, int > , unsigned char *> > ) {} + +signals: + void testSignal(TestTemplate2); +}; + + QTEST_APPLESS_MAIN(tst_Moc) #include "tst_moc.moc" diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index b6d4558..62416b1 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -740,6 +740,8 @@ void tst_QMetaObject::normalizedType_data() QTest::newRow("template5") << "QList< ::Foo::Bar>" << "QList< ::Foo::Bar>"; QTest::newRow("template6") << "QList<::Foo::Bar>" << "QList<::Foo::Bar>"; QTest::newRow("template7") << "QList >" << "QList >"; + QTest::newRow("template8") << "QMap" << "QMap"; + QTest::newRow("template9") << "QPair , QPair > >" << "QPair,QPair > >"; QTest::newRow("value1") << "const QString &" << "QString"; QTest::newRow("value2") << "QString const &" << "QString"; QTest::newRow("constInName1") << "constconst" << "constconst"; -- cgit v0.12 From 6a218a31de60ea6f3f75fb6df014ef7323a264d6 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 30 Jun 2010 18:59:14 +0200 Subject: Export various symbols needed to make a custom GL graphicssystem. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2422 Reviewed-by: Samuel Rødal --- src/gui/painting/qgraphicssystem_runtime_p.h | 2 +- src/opengl/qgl_p.h | 2 +- src/opengl/qglextensions_p.h | 2 +- src/opengl/qwindowsurface_gl_p.h | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h index 101a8e7..7aab89c 100644 --- a/src/gui/painting/qgraphicssystem_runtime_p.h +++ b/src/gui/painting/qgraphicssystem_runtime_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class QRuntimeGraphicsSystem; -class QRuntimePixmapData : public QPixmapData { +class Q_GUI_EXPORT QRuntimePixmapData : public QPixmapData { public: QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelType type); ~QRuntimePixmapData(); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index b57972c..34a6b7c 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -415,7 +415,7 @@ public: #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) static QGLExtensionFuncs qt_extensionFuncs; - static QGLExtensionFuncs& extensionFuncs(const QGLContext *); + static Q_OPENGL_EXPORT QGLExtensionFuncs& extensionFuncs(const QGLContext *); #endif static void setCurrentContext(QGLContext *context); diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h index 7597b33..6259cca 100644 --- a/src/opengl/qglextensions_p.h +++ b/src/opengl/qglextensions_p.h @@ -882,7 +882,7 @@ bool qt_resolve_frag_program_extensions(QGLContext *ctx); bool qt_resolve_glsl_extensions(QGLContext *ctx); #ifndef QT_NO_EGL -bool qt_resolve_eglimage_gl_extensions(QGLContext *ctx); +Q_OPENGL_EXPORT bool qt_resolve_eglimage_gl_extensions(QGLContext *ctx); #endif QT_END_NAMESPACE diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index 624236c..5e670fe 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -66,6 +66,8 @@ class QRegion; class QWidget; struct QGLWindowSurfacePrivate; +Q_OPENGL_EXPORT QGLWidget* qt_gl_share_widget(); + class QGLWindowSurfaceGLPaintDevice : public QGLPaintDevice { public: -- cgit v0.12 From 5eefab7dfaf11c2c53c1fa856b6ed94b39d5a688 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Tue, 22 Jun 2010 18:14:42 +0200 Subject: Use built-in iconv on Solaris if available Task-number: QTBUG-1853 Reviewed-by: Thiago --- config.tests/unix/sun-libiconv/sun-libiconv.pro | 2 ++ configure | 3 +++ src/corelib/codecs/codecs.pri | 4 ++++ 3 files changed, 9 insertions(+) create mode 100644 config.tests/unix/sun-libiconv/sun-libiconv.pro diff --git a/config.tests/unix/sun-libiconv/sun-libiconv.pro b/config.tests/unix/sun-libiconv/sun-libiconv.pro new file mode 100644 index 0000000..00df865 --- /dev/null +++ b/config.tests/unix/sun-libiconv/sun-libiconv.pro @@ -0,0 +1,2 @@ +SOURCES = ../gnu-libiconv/gnu-libiconv.cpp +CONFIG -= qt dylib app_bundle diff --git a/configure b/configure index 7f6d43b..4650229 100755 --- a/configure +++ b/configure @@ -5154,6 +5154,8 @@ if [ "$CFG_ICONV" != "no" ]; then CFG_ICONV=no elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then CFG_ICONV=yes + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/sun-libiconv" "SUN libiconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then + CFG_ICONV=sun elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/gnu-libiconv" "GNU libiconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then CFG_ICONV=gnu else @@ -6675,6 +6677,7 @@ fi [ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis" [ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups" [ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv" +[ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv" [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv" [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib" [ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer" diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri index c572e08..46d7dd4 100644 --- a/src/corelib/codecs/codecs.pri +++ b/src/corelib/codecs/codecs.pri @@ -31,6 +31,10 @@ unix { DEFINES += GNU_LIBICONV !mac:LIBS_PRIVATE *= -liconv + } else:contains(QT_CONFIG,sun-libiconv) { + HEADERS += codecs/qiconvcodec_p.h + SOURCES += codecs/qiconvcodec.cpp + DEFINES += GNU_LIBICONV } else:!symbian { # no iconv, so we put all plugins in the library HEADERS += \ -- cgit v0.12 From 91506374f23e3ba533396ec10aae285e4cd7caf4 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 1 Jul 2010 11:12:23 +1000 Subject: Don't export declarative private classes Those required by creator are still exported. Everything else is no longer exported. --- src/declarative/graphicsitems/qdeclarativeborderimage_p.h | 2 +- src/declarative/graphicsitems/qdeclarativeflickable_p.h | 2 +- src/declarative/graphicsitems/qdeclarativeflipable_p.h | 2 +- src/declarative/graphicsitems/qdeclarativefocuspanel_p.h | 2 +- src/declarative/graphicsitems/qdeclarativefocusscope_p.h | 2 +- src/declarative/graphicsitems/qdeclarativegridview_p.h | 2 +- src/declarative/graphicsitems/qdeclarativeimage_p.h | 2 +- src/declarative/graphicsitems/qdeclarativeimagebase_p.h | 2 +- src/declarative/graphicsitems/qdeclarativelistview_p.h | 4 ++-- src/declarative/graphicsitems/qdeclarativeloader_p.h | 2 +- src/declarative/graphicsitems/qdeclarativemousearea_p.h | 4 ++-- src/declarative/graphicsitems/qdeclarativepainteditem_p.h | 2 +- src/declarative/graphicsitems/qdeclarativepath_p.h | 14 +++++++------- src/declarative/graphicsitems/qdeclarativepathview_p.h | 2 +- src/declarative/graphicsitems/qdeclarativepositioners_p.h | 10 +++++----- src/declarative/graphicsitems/qdeclarativerectangle_p.h | 6 +++--- src/declarative/graphicsitems/qdeclarativerepeater_p.h | 2 +- src/declarative/graphicsitems/qdeclarativetextedit_p.h | 2 +- src/declarative/graphicsitems/qdeclarativetextinput_p.h | 2 +- src/declarative/graphicsitems/qdeclarativetranslate_p.h | 2 +- .../graphicsitems/qdeclarativevisualitemmodel_p.h | 6 +++--- src/declarative/qml/qdeclarativecompiler_p.h | 2 +- src/declarative/qml/qdeclarativeinstruction_p.h | 2 +- src/declarative/util/qdeclarativebind_p.h | 2 +- src/declarative/util/qdeclarativeconnections_p.h | 2 +- src/declarative/util/qdeclarativefontloader_p.h | 2 +- src/declarative/util/qdeclarativelistaccessor_p.h | 2 +- src/declarative/util/qdeclarativepropertychanges_p.h | 2 +- src/declarative/util/qdeclarativesmoothedanimation_p.h | 2 +- src/declarative/util/qdeclarativesmoothedfollow_p.h | 2 +- src/declarative/util/qdeclarativespringfollow_p.h | 2 +- src/declarative/util/qdeclarativestyledtext_p.h | 2 +- src/declarative/util/qdeclarativesystempalette_p.h | 2 +- src/declarative/util/qdeclarativetimer_p.h | 2 +- src/declarative/util/qdeclarativexmllistmodel_p.h | 4 ++-- 35 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h index 07f049e..9944cbe 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h @@ -54,7 +54,7 @@ QT_MODULE(Declarative) class QDeclarativeScaleGrid; class QDeclarativeGridScaledImage; class QDeclarativeBorderImagePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeBorderImage : public QDeclarativeImageBase +class Q_AUTOTEST_EXPORT QDeclarativeBorderImage : public QDeclarativeImageBase { Q_OBJECT Q_ENUMS(TileMode) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h index eb738d9..47746c6 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h @@ -52,7 +52,7 @@ QT_MODULE(Declarative) class QDeclarativeFlickablePrivate; class QDeclarativeFlickableVisibleArea; -class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeFlickable : public QDeclarativeItem { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativeflipable_p.h b/src/declarative/graphicsitems/qdeclarativeflipable_p.h index fd0119b..78eaf53 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflipable_p.h @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeFlipablePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeFlipable : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeFlipable : public QDeclarativeItem { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h b/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h index d9ca0b0..99bd540 100644 --- a/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h +++ b/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QDeclarativeFocusPanel : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeFocusPanel : public QDeclarativeItem { Q_OBJECT Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged) diff --git a/src/declarative/graphicsitems/qdeclarativefocusscope_p.h b/src/declarative/graphicsitems/qdeclarativefocusscope_p.h index c65a07c..363167e 100644 --- a/src/declarative/graphicsitems/qdeclarativefocusscope_p.h +++ b/src/declarative/graphicsitems/qdeclarativefocusscope_p.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) //### set component root as focusscope -class Q_DECLARATIVE_EXPORT QDeclarativeFocusScope : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeFocusScope : public QDeclarativeItem { Q_OBJECT Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeItem) diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index 64b91d8..d6bbaf3 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -52,7 +52,7 @@ QT_MODULE(Declarative) class QDeclarativeVisualModel; class QDeclarativeGridViewAttached; class QDeclarativeGridViewPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeGridView : public QDeclarativeFlickable +class Q_AUTOTEST_EXPORT QDeclarativeGridView : public QDeclarativeFlickable { Q_OBJECT Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeGridView) diff --git a/src/declarative/graphicsitems/qdeclarativeimage_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p.h index fa5b2a9..a4f4475 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimage_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeImagePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeImage : public QDeclarativeImageBase +class Q_AUTOTEST_EXPORT QDeclarativeImage : public QDeclarativeImageBase { Q_OBJECT Q_ENUMS(FillMode) diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h index 49b1c58..f5896b1 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h @@ -49,7 +49,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QDeclarativeImageBasePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeImageBase : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeItem { Q_OBJECT Q_ENUMS(Status) diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index f55db9b..9941040 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QDeclarativeViewSection : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeViewSection : public QObject { Q_OBJECT Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY changed) @@ -86,7 +86,7 @@ private: class QDeclarativeVisualModel; class QDeclarativeListViewAttached; class QDeclarativeListViewPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeListView : public QDeclarativeFlickable +class Q_AUTOTEST_EXPORT QDeclarativeListView : public QDeclarativeFlickable { Q_OBJECT Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeListView) diff --git a/src/declarative/graphicsitems/qdeclarativeloader_p.h b/src/declarative/graphicsitems/qdeclarativeloader_p.h index ec7ffe9..d63eaf7 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader_p.h +++ b/src/declarative/graphicsitems/qdeclarativeloader_p.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeLoaderPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeLoader : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeLoader : public QDeclarativeItem { Q_OBJECT Q_ENUMS(Status) diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h index df77ac6..4fe3fcb 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QDeclarativeDrag : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeDrag : public QObject { Q_OBJECT @@ -110,7 +110,7 @@ private: class QDeclarativeMouseEvent; class QDeclarativeMouseAreaPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeMouseArea : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeMouseArea : public QDeclarativeItem { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem_p.h b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h index 86f065a..8142986 100644 --- a/src/declarative/graphicsitems/qdeclarativepainteditem_p.h +++ b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativePaintedItemPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativePaintedItem : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativePaintedItem : public QDeclarativeItem { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativepath_p.h b/src/declarative/graphicsitems/qdeclarativepath_p.h index dad43e6..ef7600c 100644 --- a/src/declarative/graphicsitems/qdeclarativepath_p.h +++ b/src/declarative/graphicsitems/qdeclarativepath_p.h @@ -54,7 +54,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QDeclarativePathElement : public QObject +class Q_AUTOTEST_EXPORT QDeclarativePathElement : public QObject { Q_OBJECT public: @@ -87,7 +87,7 @@ private: qreal _value; }; -class Q_DECLARATIVE_EXPORT QDeclarativeCurve : public QDeclarativePathElement +class Q_AUTOTEST_EXPORT QDeclarativeCurve : public QDeclarativePathElement { Q_OBJECT @@ -109,7 +109,7 @@ private: qreal _y; }; -class Q_DECLARATIVE_EXPORT QDeclarativePathLine : public QDeclarativeCurve +class Q_AUTOTEST_EXPORT QDeclarativePathLine : public QDeclarativeCurve { Q_OBJECT public: @@ -118,7 +118,7 @@ public: void addToPath(QPainterPath &path); }; -class Q_DECLARATIVE_EXPORT QDeclarativePathQuad : public QDeclarativeCurve +class Q_AUTOTEST_EXPORT QDeclarativePathQuad : public QDeclarativeCurve { Q_OBJECT @@ -140,7 +140,7 @@ private: qreal _controlY; }; -class Q_DECLARATIVE_EXPORT QDeclarativePathCubic : public QDeclarativeCurve +class Q_AUTOTEST_EXPORT QDeclarativePathCubic : public QDeclarativeCurve { Q_OBJECT @@ -172,7 +172,7 @@ private: int _control2Y; }; -class Q_DECLARATIVE_EXPORT QDeclarativePathPercent : public QDeclarativePathElement +class Q_AUTOTEST_EXPORT QDeclarativePathPercent : public QDeclarativePathElement { Q_OBJECT Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed) @@ -187,7 +187,7 @@ private: }; class QDeclarativePathPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativePath : public QObject, public QDeclarativeParserStatus +class Q_AUTOTEST_EXPORT QDeclarativePath : public QObject, public QDeclarativeParserStatus { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h index 8a6f53f..d2980c6 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h @@ -53,7 +53,7 @@ QT_MODULE(Declarative) class QDeclarativePathViewPrivate; class QDeclarativePathViewAttached; -class Q_DECLARATIVE_EXPORT QDeclarativePathView : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativePathView : public QDeclarativeItem { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index 787dcd3..c03e518 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeBasePositionerPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeBasePositioner : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeBasePositioner : public QDeclarativeItem { Q_OBJECT @@ -112,7 +112,7 @@ private: Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeBasePositioner) }; -class Q_DECLARATIVE_EXPORT QDeclarativeColumn : public QDeclarativeBasePositioner +class Q_AUTOTEST_EXPORT QDeclarativeColumn : public QDeclarativeBasePositioner { Q_OBJECT public: @@ -124,7 +124,7 @@ private: Q_DISABLE_COPY(QDeclarativeColumn) }; -class Q_DECLARATIVE_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner +class Q_AUTOTEST_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner { Q_OBJECT public: @@ -136,7 +136,7 @@ private: Q_DISABLE_COPY(QDeclarativeRow) }; -class Q_DECLARATIVE_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner +class Q_AUTOTEST_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner { Q_OBJECT Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged) @@ -174,7 +174,7 @@ private: }; class QDeclarativeFlowPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner +class Q_AUTOTEST_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner { Q_OBJECT Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) diff --git a/src/declarative/graphicsitems/qdeclarativerectangle_p.h b/src/declarative/graphicsitems/qdeclarativerectangle_p.h index 7272962..ecc3fbf 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle_p.h +++ b/src/declarative/graphicsitems/qdeclarativerectangle_p.h @@ -68,7 +68,7 @@ public: QColor color() const { return _color; } void setColor(const QColor &c); - bool isValid() { return _valid; }; + bool isValid() { return _valid; } Q_SIGNALS: void penChanged(); @@ -79,7 +79,7 @@ private: bool _valid; }; -class Q_DECLARATIVE_EXPORT QDeclarativeGradientStop : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeGradientStop : public QObject { Q_OBJECT @@ -103,7 +103,7 @@ private: QColor m_color; }; -class Q_DECLARATIVE_EXPORT QDeclarativeGradient : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeGradient : public QObject { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativerepeater_p.h b/src/declarative/graphicsitems/qdeclarativerepeater_p.h index db46699..ff58fa0 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater_p.h +++ b/src/declarative/graphicsitems/qdeclarativerepeater_p.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeRepeaterPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeRepeater : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeRepeater : public QDeclarativeItem { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index a6dd4a4..279af78 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -58,7 +58,7 @@ QT_MODULE(Declarative) class QDeclarativeTextEditPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem +class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem { Q_OBJECT Q_ENUMS(VAlignment) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 52dd57d..bacd041 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -56,7 +56,7 @@ QT_MODULE(Declarative) class QDeclarativeTextInputPrivate; class QValidator; -class Q_DECLARATIVE_EXPORT QDeclarativeTextInput : public QDeclarativePaintedItem +class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativePaintedItem { Q_OBJECT Q_ENUMS(HAlignment) diff --git a/src/declarative/graphicsitems/qdeclarativetranslate_p.h b/src/declarative/graphicsitems/qdeclarativetranslate_p.h index 939692b..0207dce 100644 --- a/src/declarative/graphicsitems/qdeclarativetranslate_p.h +++ b/src/declarative/graphicsitems/qdeclarativetranslate_p.h @@ -52,7 +52,7 @@ QT_MODULE(Declarative) class QDeclarativeTranslatePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeTranslate : public QGraphicsTransform +class Q_AUTOTEST_EXPORT QDeclarativeTranslate : public QGraphicsTransform { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h index 079c9e6..d5c0de2 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h @@ -60,7 +60,7 @@ class QDeclarativeComponent; class QDeclarativePackage; class QDeclarativeVisualDataModelPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeVisualModel : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeVisualModel : public QObject { Q_OBJECT @@ -103,7 +103,7 @@ private: class QDeclarativeVisualItemModelAttached; class QDeclarativeVisualItemModelPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeVisualItemModel : public QDeclarativeVisualModel +class Q_AUTOTEST_EXPORT QDeclarativeVisualItemModel : public QDeclarativeVisualModel { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeVisualItemModel) @@ -138,7 +138,7 @@ private: }; -class Q_DECLARATIVE_EXPORT QDeclarativeVisualDataModel : public QDeclarativeVisualModel +class Q_AUTOTEST_EXPORT QDeclarativeVisualDataModel : public QDeclarativeVisualModel { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeVisualDataModel) diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index caad376..49dc53f 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -146,7 +146,7 @@ private: }; class QMetaObjectBuilder; -class Q_DECLARATIVE_EXPORT QDeclarativeCompiler +class Q_AUTOTEST_EXPORT QDeclarativeCompiler { Q_DECLARE_TR_FUNCTIONS(QDeclarativeCompiler) public: diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h index 4627eb3..d1a0a0a 100644 --- a/src/declarative/qml/qdeclarativeinstruction_p.h +++ b/src/declarative/qml/qdeclarativeinstruction_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE class QDeclarativeCompiledData; -class Q_DECLARATIVE_EXPORT QDeclarativeInstruction +class Q_AUTOTEST_EXPORT QDeclarativeInstruction { public: enum Type { diff --git a/src/declarative/util/qdeclarativebind_p.h b/src/declarative/util/qdeclarativebind_p.h index f89c2eb..3dc7dba 100644 --- a/src/declarative/util/qdeclarativebind_p.h +++ b/src/declarative/util/qdeclarativebind_p.h @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeBindPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeBind : public QObject, public QDeclarativeParserStatus +class Q_AUTOTEST_EXPORT QDeclarativeBind : public QObject, public QDeclarativeParserStatus { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeBind) diff --git a/src/declarative/util/qdeclarativeconnections_p.h b/src/declarative/util/qdeclarativeconnections_p.h index a914166..e8105b4 100644 --- a/src/declarative/util/qdeclarativeconnections_p.h +++ b/src/declarative/util/qdeclarativeconnections_p.h @@ -58,7 +58,7 @@ QT_MODULE(Declarative) class QDeclarativeBoundSignal; class QDeclarativeContext; class QDeclarativeConnectionsPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeConnections : public QObject, public QDeclarativeParserStatus +class Q_AUTOTEST_EXPORT QDeclarativeConnections : public QObject, public QDeclarativeParserStatus { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeConnections) diff --git a/src/declarative/util/qdeclarativefontloader_p.h b/src/declarative/util/qdeclarativefontloader_p.h index 14335ab..6947547 100644 --- a/src/declarative/util/qdeclarativefontloader_p.h +++ b/src/declarative/util/qdeclarativefontloader_p.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeFontLoaderPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeFontLoader : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeFontLoader : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeFontLoader) diff --git a/src/declarative/util/qdeclarativelistaccessor_p.h b/src/declarative/util/qdeclarativelistaccessor_p.h index d8bb8af..41aacb9 100644 --- a/src/declarative/util/qdeclarativelistaccessor_p.h +++ b/src/declarative/util/qdeclarativelistaccessor_p.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeEngine; -class Q_DECLARATIVE_EXPORT QDeclarativeListAccessor +class Q_AUTOTEST_EXPORT QDeclarativeListAccessor { public: QDeclarativeListAccessor(); diff --git a/src/declarative/util/qdeclarativepropertychanges_p.h b/src/declarative/util/qdeclarativepropertychanges_p.h index bb0f944..8578086 100644 --- a/src/declarative/util/qdeclarativepropertychanges_p.h +++ b/src/declarative/util/qdeclarativepropertychanges_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativePropertyChangesPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativePropertyChanges : public QDeclarativeStateOperation +class Q_AUTOTEST_EXPORT QDeclarativePropertyChanges : public QDeclarativeStateOperation { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativePropertyChanges) diff --git a/src/declarative/util/qdeclarativesmoothedanimation_p.h b/src/declarative/util/qdeclarativesmoothedanimation_p.h index f45d19f..8b51209 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation_p.h +++ b/src/declarative/util/qdeclarativesmoothedanimation_p.h @@ -55,7 +55,7 @@ QT_MODULE(Declarative) class QDeclarativeProperty; class QDeclarativeSmoothedAnimationPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeSmoothedAnimation : public QDeclarativeNumberAnimation +class Q_AUTOTEST_EXPORT QDeclarativeSmoothedAnimation : public QDeclarativeNumberAnimation { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeSmoothedAnimation) diff --git a/src/declarative/util/qdeclarativesmoothedfollow_p.h b/src/declarative/util/qdeclarativesmoothedfollow_p.h index 6319192..f852311 100644 --- a/src/declarative/util/qdeclarativesmoothedfollow_p.h +++ b/src/declarative/util/qdeclarativesmoothedfollow_p.h @@ -55,7 +55,7 @@ QT_MODULE(Declarative) class QDeclarativeProperty; class QDeclarativeSmoothedFollowPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeSmoothedFollow : public QObject, +class Q_AUTOTEST_EXPORT QDeclarativeSmoothedFollow : public QObject, public QDeclarativePropertyValueSource { Q_OBJECT diff --git a/src/declarative/util/qdeclarativespringfollow_p.h b/src/declarative/util/qdeclarativespringfollow_p.h index b829c57..b6277c3 100644 --- a/src/declarative/util/qdeclarativespringfollow_p.h +++ b/src/declarative/util/qdeclarativespringfollow_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeSpringFollowPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeSpringFollow : public QObject, +class Q_AUTOTEST_EXPORT QDeclarativeSpringFollow : public QObject, public QDeclarativePropertyValueSource { Q_OBJECT diff --git a/src/declarative/util/qdeclarativestyledtext_p.h b/src/declarative/util/qdeclarativestyledtext_p.h index 8d2c42d..d80ff9d 100644 --- a/src/declarative/util/qdeclarativestyledtext_p.h +++ b/src/declarative/util/qdeclarativestyledtext_p.h @@ -52,7 +52,7 @@ class QString; class QDeclarativeStyledTextPrivate; class QTextLayout; -class Q_DECLARATIVE_EXPORT QDeclarativeStyledText +class Q_AUTOTEST_EXPORT QDeclarativeStyledText { public: static void parse(const QString &string, QTextLayout &layout); diff --git a/src/declarative/util/qdeclarativesystempalette_p.h b/src/declarative/util/qdeclarativesystempalette_p.h index 9fa6b08..4dfbeff 100644 --- a/src/declarative/util/qdeclarativesystempalette_p.h +++ b/src/declarative/util/qdeclarativesystempalette_p.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeSystemPalettePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeSystemPalette : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeSystemPalette : public QObject { Q_OBJECT Q_ENUMS(ColorGroup) diff --git a/src/declarative/util/qdeclarativetimer_p.h b/src/declarative/util/qdeclarativetimer_p.h index 08c3d4e..93b0965 100644 --- a/src/declarative/util/qdeclarativetimer_p.h +++ b/src/declarative/util/qdeclarativetimer_p.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeTimerPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeTimer : public QObject, public QDeclarativeParserStatus +class Q_AUTOTEST_EXPORT QDeclarativeTimer : public QObject, public QDeclarativeParserStatus { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeTimer) diff --git a/src/declarative/util/qdeclarativexmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h index 8d848c8..832847e 100644 --- a/src/declarative/util/qdeclarativexmllistmodel_p.h +++ b/src/declarative/util/qdeclarativexmllistmodel_p.h @@ -70,7 +70,7 @@ struct QDeclarativeXmlQueryResult { QStringList keyRoleResultsCache; }; -class Q_DECLARATIVE_EXPORT QDeclarativeXmlListModel : public QListModelInterface, public QDeclarativeParserStatus +class Q_AUTOTEST_EXPORT QDeclarativeXmlListModel : public QListModelInterface, public QDeclarativeParserStatus { Q_OBJECT Q_INTERFACES(QDeclarativeParserStatus) @@ -149,7 +149,7 @@ private: Q_DISABLE_COPY(QDeclarativeXmlListModel) }; -class Q_DECLARATIVE_EXPORT QDeclarativeXmlListModelRole : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeXmlListModelRole : public QObject { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) -- cgit v0.12 From 84c47bbb133304d7ef35642fa1fbb17619d4a43d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 1 Jul 2010 11:30:13 +1000 Subject: Remove a few more unnecessary exports. --- src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h | 2 +- src/declarative/graphicsitems/qdeclarativepath_p.h | 2 +- src/declarative/qml/qdeclarativeworkerscript_p.h | 2 +- src/declarative/util/qdeclarativestateoperations_p.h | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h index 5981cd3..ec361ea 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h @@ -55,7 +55,7 @@ QT_MODULE(Declarative) class QMovie; class QDeclarativeAnimatedImagePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeAnimatedImage : public QDeclarativeImage +class Q_AUTOTEST_EXPORT QDeclarativeAnimatedImage : public QDeclarativeImage { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativepath_p.h b/src/declarative/graphicsitems/qdeclarativepath_p.h index ef7600c..001bcdf 100644 --- a/src/declarative/graphicsitems/qdeclarativepath_p.h +++ b/src/declarative/graphicsitems/qdeclarativepath_p.h @@ -63,7 +63,7 @@ Q_SIGNALS: void changed(); }; -class Q_DECLARATIVE_EXPORT QDeclarativePathAttribute : public QDeclarativePathElement +class Q_AUTOTEST_EXPORT QDeclarativePathAttribute : public QDeclarativePathElement { Q_OBJECT diff --git a/src/declarative/qml/qdeclarativeworkerscript_p.h b/src/declarative/qml/qdeclarativeworkerscript_p.h index dc73811..2b1f9f9 100644 --- a/src/declarative/qml/qdeclarativeworkerscript_p.h +++ b/src/declarative/qml/qdeclarativeworkerscript_p.h @@ -87,7 +87,7 @@ private: QDeclarativeWorkerScriptEnginePrivate *d; }; -class Q_DECLARATIVE_EXPORT QDeclarativeWorkerScript : public QObject, public QDeclarativeParserStatus +class Q_AUTOTEST_EXPORT QDeclarativeWorkerScript : public QObject, public QDeclarativeParserStatus { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) diff --git a/src/declarative/util/qdeclarativestateoperations_p.h b/src/declarative/util/qdeclarativestateoperations_p.h index 05ad052..4f905b6 100644 --- a/src/declarative/util/qdeclarativestateoperations_p.h +++ b/src/declarative/util/qdeclarativestateoperations_p.h @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeParentChangePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeParentChange : public QDeclarativeStateOperation, public QDeclarativeActionEvent +class Q_AUTOTEST_EXPORT QDeclarativeParentChange : public QDeclarativeStateOperation, public QDeclarativeActionEvent { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeParentChange) @@ -118,7 +118,7 @@ public: }; class QDeclarativeStateChangeScriptPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeStateChangeScript : public QDeclarativeStateOperation, public QDeclarativeActionEvent +class Q_AUTOTEST_EXPORT QDeclarativeStateChangeScript : public QDeclarativeStateOperation, public QDeclarativeActionEvent { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeStateChangeScript) @@ -251,7 +251,7 @@ private: }; class QDeclarativeAnchorChangesPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeAnchorChanges : public QDeclarativeStateOperation, public QDeclarativeActionEvent +class Q_AUTOTEST_EXPORT QDeclarativeAnchorChanges : public QDeclarativeStateOperation, public QDeclarativeActionEvent { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeAnchorChanges) -- cgit v0.12 From c73eedff2f7a4afdbfff319fd6c4bf0a4fce251b Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 1 Jul 2010 14:41:23 +1000 Subject: Remove qmlviewer dependency on QDeclarativeTimer --- tools/qml/qdeclarativetester.h | 3 +++ tools/qml/qmlruntime.cpp | 31 +++++++++++++++---------------- tools/qml/qmlruntime.h | 10 +++++----- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/tools/qml/qdeclarativetester.h b/tools/qml/qdeclarativetester.h index d49c9b8..021869d 100644 --- a/tools/qml/qdeclarativetester.h +++ b/tools/qml/qdeclarativetester.h @@ -48,6 +48,9 @@ #include #include #include +#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index ec748b4..94fcc82 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -59,8 +59,8 @@ #include #include #include "qdeclarative.h" -#include #include +#include #include #include @@ -603,15 +603,14 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) namFactory = new NetworkAccessManagerFactory; canvas->engine()->setNetworkAccessManagerFactory(namFactory); - connect(&autoStartTimer, SIGNAL(triggered()), this, SLOT(autoStartRecording())); - connect(&autoStopTimer, SIGNAL(triggered()), this, SLOT(autoStopRecording())); - connect(&recordTimer, SIGNAL(triggered()), this, SLOT(recordFrame())); + connect(&autoStartTimer, SIGNAL(timeout()), this, SLOT(autoStartRecording())); + connect(&autoStopTimer, SIGNAL(timeout()), this, SLOT(autoStopRecording())); + connect(&recordTimer, SIGNAL(timeout()), this, SLOT(recordFrame())); connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()), this, SLOT(orientationChanged()), Qt::QueuedConnection); - autoStartTimer.setRunning(false); - autoStopTimer.setRunning(false); - recordTimer.setRunning(false); - recordTimer.setRepeating(true); + autoStartTimer.setSingleShot(true); + autoStopTimer.setSingleShot(true); + recordTimer.setSingleShot(false); QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(appAboutToQuit())); } @@ -860,7 +859,7 @@ void QDeclarativeViewer::chooseRecordingOptions() void QDeclarativeViewer::toggleRecordingWithSelection() { - if (!recordTimer.isRunning()) { + if (!recordTimer.isActive()) { if (record_file.isEmpty()) { QString fileName = getVideoFileName(); if (fileName.isEmpty()) @@ -879,7 +878,7 @@ void QDeclarativeViewer::toggleRecording() toggleRecordingWithSelection(); return; } - bool recording = !recordTimer.isRunning(); + bool recording = !recordTimer.isActive(); recordAction->setText(recording ? tr("&Stop Recording Video\tF9") : tr("&Start Recording Video\tF9")); setRecording(recording); } @@ -1038,7 +1037,7 @@ void QDeclarativeViewer::setAutoRecord(int from, int to) if (from==0) from=1; // ensure resized record_autotime = to-from; autoStartTimer.setInterval(from); - autoStartTimer.setRunning(true); + autoStartTimer.start(); } void QDeclarativeViewer::setRecordArgs(const QStringList& a) @@ -1140,7 +1139,7 @@ void QDeclarativeViewer::senseFfmpeg() void QDeclarativeViewer::setRecording(bool on) { - if (on == recordTimer.isRunning()) + if (on == recordTimer.isActive()) return; int period = int(1000/record_rate+0.5); @@ -1149,7 +1148,7 @@ void QDeclarativeViewer::setRecording(bool on) if (on) { canvas->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); recordTimer.setInterval(period); - recordTimer.setRunning(true); + recordTimer.start(); frame_fmt = record_file.right(4).toLower(); frame = QImage(canvas->width(),canvas->height(),QImage::Format_RGB32); if (frame_fmt != ".png" && (!convertAvailable || frame_fmt != ".gif")) { @@ -1180,7 +1179,7 @@ void QDeclarativeViewer::setRecording(bool on) } } else { canvas->setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); - recordTimer.setRunning(false); + recordTimer.stop(); if (frame_stream) { qDebug() << "Saving video..."; frame_stream->close(); @@ -1260,7 +1259,7 @@ void QDeclarativeViewer::setRecording(bool on) frames.clear(); } } - qDebug() << "Recording: " << (recordTimer.isRunning()?"ON":"OFF"); + qDebug() << "Recording: " << (recordTimer.isActive()?"ON":"OFF"); } void QDeclarativeViewer::ffmpegFinished(int code) @@ -1282,7 +1281,7 @@ void QDeclarativeViewer::autoStartRecording() { setRecording(true); autoStopTimer.setInterval(record_autotime); - autoStopTimer.setRunning(true); + autoStopTimer.start(); } void QDeclarativeViewer::autoStopRecording() diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index a3a9fb3..e70e69f 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -43,7 +43,7 @@ #define QDECLARATIVEVIEWER_H #include -#include +#include #include #include @@ -93,7 +93,7 @@ public: void setRecordFile(const QString&); void setRecordArgs(const QStringList&); void setRecording(bool on); - bool isRecording() const { return recordTimer.isRunning(); } + bool isRecording() const { return recordTimer.isActive(); } void setAutoRecord(int from, int to); void setDeviceKeys(bool); void setNetworkCacheSize(int size); @@ -154,13 +154,13 @@ private: QDeclarativeView *canvas; QSize initialSize; QString currentFileOrUrl; - QDeclarativeTimer recordTimer; + QTimer recordTimer; QString frame_fmt; QImage frame; QList frames; QProcess* frame_stream; - QDeclarativeTimer autoStartTimer; - QDeclarativeTimer autoStopTimer; + QTimer autoStartTimer; + QTimer autoStopTimer; QString record_dither; QString record_file; QSize record_outsize; -- cgit v0.12 From 7cc5171a7d66390688444d57bb3f4550dbbd26ee Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 1 Jul 2010 15:52:45 +1000 Subject: Fix webkit import for webkit tests. --- tests/auto/declarative/qdeclarativewebview/data/basic.qml | 2 +- tests/auto/declarative/qdeclarativewebview/data/elements.qml | 2 +- tests/auto/declarative/qdeclarativewebview/data/javaScript.qml | 2 +- tests/auto/declarative/qdeclarativewebview/data/loadError.qml | 2 +- tests/auto/declarative/qdeclarativewebview/data/newwindows.qml | 2 +- tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml | 2 +- tests/auto/declarative/qdeclarativewebview/data/sethtml.qml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/auto/declarative/qdeclarativewebview/data/basic.qml b/tests/auto/declarative/qdeclarativewebview/data/basic.qml index a5a8d34..ff5d3fd 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/basic.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/basic.qml @@ -1,5 +1,5 @@ import Qt 4.7 -import org.webkit 1.0 +import QtWebKit 1.0 WebView { url: "basic.html" diff --git a/tests/auto/declarative/qdeclarativewebview/data/elements.qml b/tests/auto/declarative/qdeclarativewebview/data/elements.qml index 5af76ed..3adfff8 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/elements.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/elements.qml @@ -1,5 +1,5 @@ import Qt 4.7 -import org.webkit 1.0 +import QtWebKit 1.0 WebView { url: "elements.html" diff --git a/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml b/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml index 4141166..9f07a51 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml @@ -1,5 +1,5 @@ import Qt 4.7 -import org.webkit 1.0 +import QtWebKit 1.0 WebView { url: "javaScript.html" diff --git a/tests/auto/declarative/qdeclarativewebview/data/loadError.qml b/tests/auto/declarative/qdeclarativewebview/data/loadError.qml index 2061b5f..a0cc4c8 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/loadError.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/loadError.qml @@ -1,5 +1,5 @@ import Qt 4.7 -import org.webkit 1.0 +import QtWebKit 1.0 WebView { url: "does-not-exist.html" diff --git a/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml b/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml index d066c07..e5967b5 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml @@ -1,7 +1,7 @@ // Demonstrates opening new WebViews from HTML import Qt 4.7 -import org.webkit 1.0 +import QtWebKit 1.0 Grid { columns: 3 diff --git a/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml index 45684ff..569f4a5 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml @@ -1,5 +1,5 @@ import Qt 4.7 -import org.webkit 1.0 +import QtWebKit 1.0 Item { width: 240 diff --git a/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml b/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml index b14bcf9..1edd436 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml @@ -1,5 +1,5 @@ import Qt 4.7 -import org.webkit 1.0 +import QtWebKit 1.0 WebView { html: "

    This is a string set on the WebView" -- cgit v0.12 From 0e7f70bb44eae2798c7f2198b713dc1c6ab6f652 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 1 Jul 2010 12:11:15 +1000 Subject: docs - quote code with snippets, other improvements --- doc/src/declarative/qdeclarativemodels.qdoc | 163 ++++++++++----------- .../declarative/visualdatamodel_rootindex/view.qml | 2 +- .../modelviews/objectlistmodel/dataobject.h | 4 + .../modelviews/objectlistmodel/main.cpp | 9 +- .../modelviews/objectlistmodel/view.qml | 18 +-- .../modelviews/stringlistmodel/main.cpp | 5 +- .../modelviews/stringlistmodel/view.qml | 16 +- .../graphicsitems/qdeclarativelistview.cpp | 2 +- .../graphicsitems/qdeclarativevisualitemmodel.cpp | 6 + 9 files changed, 116 insertions(+), 109 deletions(-) diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 7671eb3..0d25da5 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -30,18 +30,46 @@ \target qmlmodels \title Data Models -Some QML Items use Data Models to provide the data to be displayed. +Some QML items use Data Models to provide the data to be displayed. These items typically require a \e delegate component that creates an instance for each item in the model. Models may be static, or have items modified, inserted, removed or moved dynamically. Data is provided to the delegate via named data roles which the -delegate may bind to. The roles are exposed as properties of the -\e model context property, though this property is set as a default property -of the delegate so, unless there is a naming clash with a -property in the delegate, the roles are usually accessed unqualified. The -example below would have a clash between the \e color role of the model and -the \e color property of the Rectangle. The clash is avoided by referencing +delegate may bind to. Here is a ListModel with two roles, \e type and \e age, +and a ListView with a delegate that binds to these roles to display their +values: + +\qml +import Qt 4.7 + +Item { + width: 200; height: 250 + + ListModel { + id: myModel + ListElement { type: "Dog"; age: 8 } + ListElement { type: "Cat"; age: 5 } + } + + Component { + id: myDelegate + Text { text: type + ", " + age } + } + + ListView { + anchors.fill: parent + model: myModel + delegate: myDelegate + } +} +\endqml + +If there is a naming clash between the model's properties and the delegate's +properties (e.g. if the \l Text delegate above had \e type or \e age properties) +the roles can be accessed with the qualified \e model name instead. +For example, the following model has a \e color role which clashes with the +delegate \l Rectangle's \e color property. The clash is avoided by referencing the \e color property of the model by its full name: \e model.color. \code @@ -61,7 +89,7 @@ Component { \endcode A special \e index role containing the index of the item in the model -is also available. +is also available to the delegate. \e Note: the index role will be set to -1 if the item is removed from the model. If you bind to the index role, be sure that the logic @@ -148,9 +176,9 @@ Item { } \endcode -When the MouseArea is clicked fruitModel will have two roles, "cost" and "name". +When the MouseArea is clicked, \c fruitModel will have two roles, "cost" and "name". Even if subsequent roles are added, only the first two will be handled by views -using the model. +using the model. To reset the roles available in the model, call ListModel::clear(). \section2 XmlListModel @@ -170,6 +198,9 @@ XmlListModel { } \endcode +The \l{declarative/demos/rssnews}{RSS News demo} shows how XmlListModel can +be used to display an RSS feed. + \section2 VisualItemModel @@ -230,9 +261,9 @@ ctxt->setContextProperty("myModel", model); or by registering the subclass as a new QML type in a \l{QDeclarativeExtensionPlugin}{QML C++ plugin}. -QAbstractItemModel presents a heirachy of tables, but views currently provided by QML +QAbstractItemModel presents a hierarchy of tables, but views currently provided by QML can only display list data. -In order to display child lists of a heirachical model +In order to display child lists of a hierarchical model the VisualDataModel element provides several properties and functions for use with models of type QAbstractItemModel: \list @@ -245,101 +276,60 @@ with models of type QAbstractItemModel: \section2 QStringList -A model may be a simple QStringList, which provides the contents of the list via the \e modelData role: +A model may be a simple QStringList, which provides the contents of the list via the \e modelData role. -\table -\row -\o -\code -// main.cpp -QStringList dataList; -dataList.append("Fred"); -dataList.append("Ginger"); -dataList.append("Skipper"); +Here is a ListView with a delegate that references its model item's +value using the \c modelData role: -QDeclarativeContext *ctxt = view.rootContext(); -ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); -\endcode +\snippet examples/declarative/modelviews/stringlistmodel/view.qml 0 -\o -\code -// main.qml -ListView { - width: 100 - height: 100 - anchors.fill: parent - model: myModel - delegate: Component { - Rectangle { - height: 25 - Text { text: modelData } - } - } -} -\endcode -\endtable +A Qt application can load this QML document and set the value of \c myModel +to a QStringList: + +\snippet examples/declarative/modelviews/stringlistmodel/main.cpp 0 -The complete example is available in \l {declarative/modelviews/stringlistmodel}. +The complete example is available in Qt's \l {declarative/modelviews/stringlistmodel}{examples/declarative/modelviews/stringlistmodel} directory. \note There is no way for the view to know that the contents of a QStringList -have changed. If the QStringList is changed, it will be necessary to reset +have changed. If the QStringList changes, it will be necessary to reset the model by calling QDeclarativeContext::setContextProperty() again. \section2 QList -QList provides the properties of the objects in the list as roles. - -\code -class DataObject : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QString color READ color WRITE setColor) -... -}; +A list of QObject* values can also be used as a model. A QList provides +the properties of the objects in the list as roles. -QList dataList; -dataList.append(new DataObject("Item 1", "red")); -dataList.append(new DataObject("Item 2", "green")); -dataList.append(new DataObject("Item 3", "blue")); -dataList.append(new DataObject("Item 4", "yellow")); +The following application creates a \c DataObject class that with +Q_PROPERTY values that will be accessible as named roles when a +QList is exposed to QML: -QDeclarativeContext *ctxt = view.rootContext(); -ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); -\endcode +\snippet examples/declarative/modelviews/objectlistmodel/dataobject.h 0 +\dots 4 +\snippet examples/declarative/modelviews/objectlistmodel/dataobject.h 1 +\codeline +\snippet examples/declarative/modelviews/objectlistmodel/main.cpp 0 +\dots 4 +\snippet examples/declarative/modelviews/objectlistmodel/main.cpp 1 +\dots 4 +\snippet examples/declarative/modelviews/objectlistmodel/main.cpp 2 The QObject* is available as the \c modelData property. As a convenience, the properties of the object are also made available directly in the -delegate's context: - -\code -ListView { - width: 100 - height: 100 - anchors.fill: parent - model: myModel - delegate: Component { - Rectangle { - height: 25 - width: 100 - color: model.modelData.color - Text { text: name } - } - } -} -\endcode +delegate's context. Here, \c view.qml references the \c DataModel properties in +the ListView delegate: -The complete example is available in \l {declarative/modelviews/objectlistmodel}. +\snippet examples/declarative/modelviews/objectlistmodel/view.qml 0 Note the use of the fully qualified access to the \c color property. The properties of the object are not replicated in the \c model object, since they are easily available via the modelData object. +The complete example is available in Qt's \l {declarative/modelviews/objectlistmodel}{examples/declarative/modelviews/objectlistmodel} directory. + Note: There is no way for the view to know that the contents of a QList -have changed. If the QList is changed, it will be necessary to reset +have changed. If the QList changes, it will be necessary to reset the model by calling QDeclarativeContext::setContextProperty() again. @@ -354,8 +344,7 @@ There are no data roles. The following example creates a ListView with five elements: \code Item { - width: 200 - height: 250 + width: 200; height: 250 Component { id: itemDelegate @@ -374,7 +363,7 @@ Item { \section2 An Object Instance -An Object Instance specifies a model with a single Object element. The +An Object instance specifies a model with a single Object element. The properties of the object are provided as roles. The example below creates a list with one item, showing the color of the @@ -383,6 +372,8 @@ to avoid clashing with \e color property of the Text element in the delegate. \code Rectangle { + width: 200; height: 250 + Text { id: myText text: "Hello" diff --git a/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml b/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml index 835ca32..9e759f9 100644 --- a/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml +++ b/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml @@ -55,7 +55,7 @@ ListView { MouseArea { anchors.fill: parent onClicked: { - if (hasModelChildren) + if (model.hasModelChildren) view.model.rootIndex = view.model.modelIndex(index) } } diff --git a/examples/declarative/modelviews/objectlistmodel/dataobject.h b/examples/declarative/modelviews/objectlistmodel/dataobject.h index c61e50c..17aa355 100644 --- a/examples/declarative/modelviews/objectlistmodel/dataobject.h +++ b/examples/declarative/modelviews/objectlistmodel/dataobject.h @@ -43,12 +43,14 @@ #include +//![0] class DataObject : public QObject { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged) +//![0] public: DataObject(QObject *parent=0); @@ -67,6 +69,8 @@ signals: private: QString m_name; QString m_color; +//![1] }; +//![1] #endif // DATAOBJECT_H diff --git a/examples/declarative/modelviews/objectlistmodel/main.cpp b/examples/declarative/modelviews/objectlistmodel/main.cpp index 25de8d1..8c921b7 100644 --- a/examples/declarative/modelviews/objectlistmodel/main.cpp +++ b/examples/declarative/modelviews/objectlistmodel/main.cpp @@ -53,24 +53,29 @@ model in QML */ +//![0] int main(int argc, char ** argv) { +//![0] QApplication app(argc, argv); - QDeclarativeView view; - +//![1] QList dataList; dataList.append(new DataObject("Item 1", "red")); dataList.append(new DataObject("Item 2", "green")); dataList.append(new DataObject("Item 3", "blue")); dataList.append(new DataObject("Item 4", "yellow")); + QDeclarativeView view; QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); view.setSource(QUrl("qrc:view.qml")); view.show(); +//![1] return app.exec(); +//![2] } +//![2] diff --git a/examples/declarative/modelviews/objectlistmodel/view.qml b/examples/declarative/modelviews/objectlistmodel/view.qml index 034121c..c3cccdd 100644 --- a/examples/declarative/modelviews/objectlistmodel/view.qml +++ b/examples/declarative/modelviews/objectlistmodel/view.qml @@ -40,17 +40,17 @@ import Qt 4.7 +//![0] ListView { - width: 100 - height: 100 + width: 100; height: 100 anchors.fill: parent + model: myModel - delegate: Component { - Rectangle { - height: 25 - width: 100 - color: model.modelData.color - Text { text: name } - } + delegate: Rectangle { + height: 25 + width: 100 + color: model.modelData.color + Text { text: name } } } +//![0] diff --git a/examples/declarative/modelviews/stringlistmodel/main.cpp b/examples/declarative/modelviews/stringlistmodel/main.cpp index b2ebd4b..ea73859 100644 --- a/examples/declarative/modelviews/stringlistmodel/main.cpp +++ b/examples/declarative/modelviews/stringlistmodel/main.cpp @@ -56,19 +56,20 @@ int main(int argc, char ** argv) { QApplication app(argc, argv); - QDeclarativeView view; - +//![0] QStringList dataList; dataList.append("Item 1"); dataList.append("Item 2"); dataList.append("Item 3"); dataList.append("Item 4"); + QDeclarativeView view; QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); view.setSource(QUrl("qrc:view.qml")); view.show(); +//![0] return app.exec(); } diff --git a/examples/declarative/modelviews/stringlistmodel/view.qml b/examples/declarative/modelviews/stringlistmodel/view.qml index ec5597d..3d789fd 100644 --- a/examples/declarative/modelviews/stringlistmodel/view.qml +++ b/examples/declarative/modelviews/stringlistmodel/view.qml @@ -39,17 +39,17 @@ ****************************************************************************/ import Qt 4.7 +//![0] ListView { - width: 100 - height: 100 + width: 100; height: 100 anchors.fill: parent + model: myModel - delegate: Component { - Rectangle { - height: 25 - width: 100 - Text { text: modelData } - } + delegate: Rectangle { + height: 25 + width: 100 + Text { text: modelData } } } +//![0] diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 4be8705..e519bd9 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1395,7 +1395,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m to set \e {clip: true} in order to have the out of view items clipped nicely. - \sa ListModel, GridView, {declarative/modelviews/listview}{ListView examples} + \sa {Data Models}, GridView, {declarative/modelviews/listview}{ListView examples} */ QDeclarativeListView::QDeclarativeListView(QDeclarativeItem *parent) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 8071d7a..786d6f9 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -818,6 +818,12 @@ void QDeclarativeVisualDataModel::setDelegate(QDeclarativeComponent *delegate) \c view.qml: \snippet doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml 0 + If the \l model is a QAbstractItemModel subclass, the delegate can also + reference a \c hasModelChildren property (optionally qualified by a + \e model. prefix) that indicates whether the delegate's model item has + any child nodes. + + \sa modelIndex(), parentModelIndex() */ QVariant QDeclarativeVisualDataModel::rootIndex() const -- cgit v0.12 From 3084b54e7a4f6163dadcf3e52143391b10b5352e Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 1 Jul 2010 16:32:30 +1000 Subject: Add abstractitemmodel example, and fix some model docs --- doc/src/declarative/examples.qdoc | 7 +- doc/src/declarative/qdeclarativemodels.qdoc | 264 ++++++++++++--------- doc/src/examples/qml-examples.qdoc | 15 +- doc/src/images/qml-abstractitemmodel-example.png | Bin 0 -> 4478 bytes .../abstractitemmodel/abstractitemmodel.pro | 8 + .../abstractitemmodel/abstractitemmodel.qrc | 6 + .../modelviews/abstractitemmodel/main.cpp | 66 ++++++ .../modelviews/abstractitemmodel/model.cpp | 88 +++++++ .../modelviews/abstractitemmodel/model.h | 83 +++++++ .../modelviews/abstractitemmodel/view.qml | 51 ++++ .../modelviews/objectlistmodel/main.cpp | 6 +- .../modelviews/stringlistmodel/main.cpp | 2 +- 12 files changed, 469 insertions(+), 127 deletions(-) create mode 100644 doc/src/images/qml-abstractitemmodel-example.png create mode 100644 examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro create mode 100644 examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.qrc create mode 100644 examples/declarative/modelviews/abstractitemmodel/main.cpp create mode 100644 examples/declarative/modelviews/abstractitemmodel/model.cpp create mode 100644 examples/declarative/modelviews/abstractitemmodel/model.h create mode 100644 examples/declarative/modelviews/abstractitemmodel/view.qml diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 7b02d33..587cdf2 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -168,11 +168,14 @@ The examples can be found in Qt's \c examples/declarative directory. \list \o \l{declarative/modelviews/gridview}{GridView} \o \l{declarative/modelviews/listview}{ListView} -\o \l{declarative/modelviews/objectlistmodel}{Object ListModel} \o \l{declarative/modelviews/package}{Package} \o \l{declarative/modelviews/parallax}{Parallax} -\o \l{declarative/modelviews/stringlistmodel}{String ListModel} \o \l{declarative/modelviews/visualitemmodel}{VisualItemModel} + +\o \l{declarative/modelviews/stringlistmodel}{String ListModel} +\o \l{declarative/modelviews/objectlistmodel}{Object ListModel} +\o \l{declarative/modelviews/abstractitemmodel}{AbstractItemModel} + \o \l{declarative/modelviews/webview}{WebView} \endlist diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 0d25da5..b44e6f2 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -30,7 +30,8 @@ \target qmlmodels \title Data Models -Some QML items use Data Models to provide the data to be displayed. +QML items such as ListView, GridView and \l Repeater require Data Models +that provide the data to be displayed. These items typically require a \e delegate component that creates an instance for each item in the model. Models may be static, or have items modified, inserted, removed or moved dynamically. @@ -66,55 +67,30 @@ Item { \endqml If there is a naming clash between the model's properties and the delegate's -properties (e.g. if the \l Text delegate above had \e type or \e age properties) -the roles can be accessed with the qualified \e model name instead. -For example, the following model has a \e color role which clashes with the -delegate \l Rectangle's \e color property. The clash is avoided by referencing -the \e color property of the model by its full name: \e model.color. - -\code -ListModel { - id: myModel - ListElement { color: "red" } - ListElement { color: "green" } -} - -Component { - id: myDelegate - Rectangle { - width: 20; height: 20 - color: model.color - } -} -\endcode +properties, the roles can be accessed with the qualified \e model name instead. +For example, if a \l Text element had \e type or \e age properties, the text in the +above example would display those property values instead of the \e type and \e age values +from the model item. In this case, the properties could have been referenced as +\c model.type and \c model.age instead to ensure the delegate displays the +property values from the model item. A special \e index role containing the index of the item in the model -is also available to the delegate. - -\e Note: the index role will be set to -1 if the item is removed from +is also available to the delegate. Note this index is set to -1 if the item is removed from the model. If you bind to the index role, be sure that the logic accounts for the possibility of index being -1, i.e. that the item -is no longer valid. Usually the item will shortly be destroyed, but -it is possible to delay delegate destruction in some views via a delayRemove -attached property. +is no longer valid. (Usually the item will shortly be destroyed, but +it is possible to delay delegate destruction in some views via a \c delayRemove +attached property.) -Models that do not have named roles will have the data provided via -the \e modelData role. The \e modelData role is also provided for -Models that have only one role. In this case the \e modelData role +Models that do not have named roles (such as the QStringList model shown below) +will have the data provided via the \e modelData role. The \e modelData role is also provided for +models that have only one role. In this case the \e modelData role contains the same data as the named role. -There are a number of QML elements that operate using data models: - -\list -\o ListView -\o GridView -\o PathView -\o \l Repeater -\endlist +QML provides several types of data models among the built-in set of +QML elements. In addition, models can be created with C++ and then +made available to QML components. -QML supports several types of data model, which may be provided by QML -or C++ (via QDeclarativeContext::setContextProperty() or as plugin types, -for example). \section1 QML Data Models @@ -126,6 +102,7 @@ available roles are specified by the \l ListElement properties. \code ListModel { id: fruitModel + ListElement { name: "Apple" cost: 2.45 @@ -145,30 +122,26 @@ The above model has two roles, \e name and \e cost. These can be bound to by a ListView delegate, for example: \code -Component { - id: fruitDelegate - Row { +ListView { + width: 200; height: 250 + model: fruitModel + delegate: Row { Text { text: "Fruit: " + name } Text { text: "Cost: $" + cost } } } -ListView { - model: fruitModel - delegate: fruitDelegate -} \endcode -It is also possible to manipulate the ListModel directly via JavaScript. -In this case, the first item inserted will determine the roles available -to any views using the model. For example, if an empty ListModel is -created and populated via JavaScript the roles provided by the first +ListModel provides methods to manipulate the ListModel directly via JavaScript. +In this case, the first item inserted determines the roles available +to any views that are using the model. For example, if an empty ListModel is +created and populated via JavaScript, the roles provided by the first insertion are the only roles that will be shown in the view: \code Item { - ListModel { - id: fruitModel - } + ListModel { id: fruitModel } + MouseArea { anchors.fill: parent onClicked: fruitModel.append({"cost": 5.95, "name":"Pizza"}) @@ -176,7 +149,7 @@ Item { } \endcode -When the MouseArea is clicked, \c fruitModel will have two roles, "cost" and "name". +When the MouseArea is clicked, \c fruitModel will have two roles, \e cost and \e name. Even if subsequent roles are added, only the first two will be handled by views using the model. To reset the roles available in the model, call ListModel::clear(). @@ -198,14 +171,17 @@ XmlListModel { } \endcode -The \l{declarative/demos/rssnews}{RSS News demo} shows how XmlListModel can +The \l{demos/declarative/rssnews}{RSS News demo} shows how XmlListModel can be used to display an RSS feed. \section2 VisualItemModel -VisualItemModel allows QML items to be provided as a model. This model contains -both the data and delegate (its child items). This model does not provide any roles. +VisualItemModel allows QML items to be provided as a model. + +This model contains both the data and delegate; the child items of a +VisualItemModel provide the contents of the delegate. The model +does not provide any roles. \code VisualItemModel { @@ -228,51 +204,11 @@ will be positioned by the view. \section1 C++ Data Models -Models defined in C++ can be made available to QML either from a C++ application or from a -\l{QDeclarativeExtensionPlugin}{QML C++ plugin}. - -\section2 QAbstractItemModel - -A model can be defined by subclassing QAbstractItemModel. - -QAbstractItemModel provides the roles set via the QAbstractItemModel::setRoleNames() method. -The default role names set by Qt are: - -\table -\header -\o Qt Role -\o QML Role Name -\row -\o Qt::DisplayRole -\o display -\row -\o Qt::DecorationRole -\o decoration -\endtable - -The model could be made available to QML either directly: - -\code -QDeclarativeContext *ctxt = view.rootContext(); -MyModel *model = new MyModel; // subclass of QAbstractItemModel -ctxt->setContextProperty("myModel", model); -\endcode - -or by registering the subclass as a new QML type in -a \l{QDeclarativeExtensionPlugin}{QML C++ plugin}. - -QAbstractItemModel presents a hierarchy of tables, but views currently provided by QML -can only display list data. -In order to display child lists of a hierarchical model -the VisualDataModel element provides several properties and functions for use -with models of type QAbstractItemModel: -\list -\o \e hasModelChildren role property to determine whether a node has child nodes. -\o \l VisualDataModel::rootIndex allows the root node to be specifed -\o \l VisualDataModel::modelIndex() returns a QModelIndex which can be assigned to VisualDataModel::rootIndex -\o \l VisualDataModel::parentModelIndex() returns a QModelIndex which can be assigned to VisualDataModel::rootIndex -\endlist +Models can be defined in C++ and then made available to QML. This is useful +for exposing existing C++ data models or otherwise complex datasets to QML. +A C++ model class can be defined as a QStringList, a QList or a +QAbstractItemModel. \section2 QStringList @@ -309,10 +245,7 @@ QList is exposed to QML: \snippet examples/declarative/modelviews/objectlistmodel/dataobject.h 1 \codeline \snippet examples/declarative/modelviews/objectlistmodel/main.cpp 0 -\dots 4 -\snippet examples/declarative/modelviews/objectlistmodel/main.cpp 1 -\dots 4 -\snippet examples/declarative/modelviews/objectlistmodel/main.cpp 2 +\dots The QObject* is available as the \c modelData property. As a convenience, the properties of the object are also made available directly in the @@ -323,7 +256,7 @@ the ListView delegate: Note the use of the fully qualified access to the \c color property. The properties of the object are not replicated in the \c model -object, since they are easily available via the modelData +object, since they are easily available via the \c modelData object. The complete example is available in Qt's \l {declarative/modelviews/objectlistmodel}{examples/declarative/modelviews/objectlistmodel} directory. @@ -333,13 +266,115 @@ have changed. If the QList changes, it will be necessary to reset the model by calling QDeclarativeContext::setContextProperty() again. +\section2 QAbstractItemModel + +A model can be defined by subclassing QAbstractItemModel. + +The roles of a QAbstractItemModel subclass can be exposed to QML by calling +QAbstractItemModel::setRoleNames(). The default role names set by Qt are: + +\table +\header +\o Qt Role +\o QML Role Name +\row +\o Qt::DisplayRole +\o display +\row +\o Qt::DecorationRole +\o decoration +\endtable + +Here is an application with a QAbstractListModel subclass named \c AnimalModel +that has \e type and \e size roles. It calls QAbstractItemModel::setRoleNames() to set the +role names for accessing the properties via QML: + +\snippet examples/declarative/modelviews/abstractitemmodel/model.h 0 +\dots +\snippet examples/declarative/modelviews/abstractitemmodel/model.h 1 +\dots +\snippet examples/declarative/modelviews/abstractitemmodel/model.h 2 +\codeline +\snippet examples/declarative/modelviews/abstractitemmodel/model.cpp 0 +\codeline +\snippet examples/declarative/modelviews/abstractitemmodel/main.cpp 0 +\dots + +This model is displayed by a ListView delegate that accesses the \e type and \e size +roles: + +\snippet examples/declarative/modelviews/abstractitemmodel/view.qml 0 + +The complete example is available in Qt's \l {declarative/modelviews/abstractitemmodel}{examples/declarative/modelviews/abstractitemmodel} directory. + +QAbstractItemModel presents a hierarchy of tables, but the views currently provided by QML +can only display list data. +In order to display child lists of a hierarchical model +the VisualDataModel element provides several properties and functions for use +with models of type QAbstractItemModel: + +\list +\o \e hasModelChildren role property to determine whether a node has child nodes. +\o \l VisualDataModel::rootIndex allows the root node to be specifed +\o \l VisualDataModel::modelIndex() returns a QModelIndex which can be assigned to VisualDataModel::rootIndex +\o \l VisualDataModel::parentModelIndex() returns a QModelIndex which can be assigned to VisualDataModel::rootIndex +\endlist + + +\section2 Exposing C++ data models to QML + +The above examples use QDeclarativeContext::setContextProperty() to set +model values directly in QML components. An alternative to this is to +register the C++ model class as a QML type from a QML C++ plugin using +QDeclarativeExtensionPlugin. This would allow the model classes to be +created directly as elements within QML: + +\table +\row + +\o +\code +class MyModelPlugin : public QDeclarativeExtensionPlugin +{ +public: + void registerTypes(const char *uri) + { + qmlRegisterType(uri, 1, 0, + "MyModel"); + } +} + +Q_EXPORT_PLUGIN2(mymodelplugin, MyModelPlugin); +\endcode + +\o +\qml +MyModel { + id: myModel + ListElement { someProperty: "some value" } +} + +ListView { + width: 200; height: 250 + model: myModel + delegate: Text { text: someProperty } +} +\endqml + +\endtable + +See \l {Tutorial: Writing QML extensions with C++} for details on writing QML C++ +plugins. + + + \section1 Other Data Models \section2 An Integer -An Integer specifies a model containing the integer number of elements. -There are no data roles. +An integer can be used to specify a model that contains a certain number +of elements. In this case, the model does not have any data roles. The following example creates a ListView with five elements: \code @@ -363,7 +398,7 @@ Item { \section2 An Object Instance -An Object instance specifies a model with a single Object element. The +An object instance can be used to specify a model with a single object element. The properties of the object are provided as roles. The example below creates a list with one item, showing the color of the @@ -382,10 +417,9 @@ Rectangle { Component { id: myDelegate - Text { - text: model.color - } + Text { text: model.color } } + ListView { anchors.fill: parent anchors.topMargin: 30 diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 211ee4b..c8a7403 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -252,6 +252,15 @@ */ /*! + \title Models and Views: AbstractItemModel + \example declarative/modelviews/abstractitemmodel + + This example shows how to use a QAbstractItemModel subclass as a model in QML. + + \image qml-abstractitemmodel-example.png +*/ + +/*! \title Models and Views: GridView \example declarative/modelviews/gridview @@ -306,8 +315,7 @@ \title Models and Views: Object ListModel \example declarative/modelviews/objectlistmodel - This example shows how to create a C++ extension that exposes a - QList as a model in QML. + This example shows how to use a QList as a model in QML. \image qml-objectlistmodel-example.png */ @@ -334,8 +342,7 @@ \title Models and Views: String ListModel \example declarative/modelviews/stringlistmodel - This example shows how to create a C++ extension that exposes a - QStringList as a model in QML. + This example shows how to use a QStringList as a model in QML. \image qml-stringlistmodel-example.png */ diff --git a/doc/src/images/qml-abstractitemmodel-example.png b/doc/src/images/qml-abstractitemmodel-example.png new file mode 100644 index 0000000..1d7ff19 Binary files /dev/null and b/doc/src/images/qml-abstractitemmodel-example.png differ diff --git a/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro b/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro new file mode 100644 index 0000000..55e67f3 --- /dev/null +++ b/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro @@ -0,0 +1,8 @@ +TEMPLATE = app + +QT += declarative + +RESOURCES += abstractitemmodel.qrc + +HEADERS = model.h +SOURCES = main.cpp model.cpp diff --git a/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.qrc b/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.qrc new file mode 100644 index 0000000..4ae861c --- /dev/null +++ b/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.qrc @@ -0,0 +1,6 @@ + + + view.qml + + + diff --git a/examples/declarative/modelviews/abstractitemmodel/main.cpp b/examples/declarative/modelviews/abstractitemmodel/main.cpp new file mode 100644 index 0000000..e869aba --- /dev/null +++ b/examples/declarative/modelviews/abstractitemmodel/main.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "model.h" +#include +#include + +#include + +//![0] +int main(int argc, char ** argv) +{ + QApplication app(argc, argv); + + AnimalModel model; + model.addAnimal(Animal("Wolf", "Medium")); + model.addAnimal(Animal("Polar bear", "Large")); + model.addAnimal(Animal("Quoll", "Small")); + + QDeclarativeView view; + QDeclarativeContext *ctxt = view.rootContext(); + ctxt->setContextProperty("myModel", &model); +//![0] + + view.setSource(QUrl("qrc:view.qml")); + view.show(); + + return app.exec(); +} + diff --git a/examples/declarative/modelviews/abstractitemmodel/model.cpp b/examples/declarative/modelviews/abstractitemmodel/model.cpp new file mode 100644 index 0000000..d0e0971 --- /dev/null +++ b/examples/declarative/modelviews/abstractitemmodel/model.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "model.h" + +Animal::Animal(const QString &type, const QString &size) + : m_type(type), m_size(size) +{ +} + +QString Animal::type() const +{ + return m_type; +} + +QString Animal::size() const +{ + return m_size; +} + +//![0] +AnimalModel::AnimalModel(QObject *parent) + : QAbstractListModel(parent) +{ + QHash roles; + roles[TypeRole] = "type"; + roles[SizeRole] = "size"; + setRoleNames(roles); +} +//![0] + +void AnimalModel::addAnimal(const Animal &animal) +{ + m_animals << animal; +} + +int AnimalModel::rowCount(const QModelIndex & parent) const { + return m_animals.count(); +} + +QVariant AnimalModel::data(const QModelIndex & index, int role) const { + if (index.row() < 0 || index.row() > m_animals.count()) + return QVariant(); + + const Animal &animal = m_animals[index.row()]; + if (role == TypeRole) + return animal.type(); + else if (role == SizeRole) + return animal.size(); + return QVariant(); +} + diff --git a/examples/declarative/modelviews/abstractitemmodel/model.h b/examples/declarative/modelviews/abstractitemmodel/model.h new file mode 100644 index 0000000..1119837 --- /dev/null +++ b/examples/declarative/modelviews/abstractitemmodel/model.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +//![0] +class Animal +{ +public: + Animal(const QString &type, const QString &size); +//![0] + + QString type() const; + QString size() const; + +private: + QString m_type; + QString m_size; +//![1] +}; + +class AnimalModel : public QAbstractListModel +{ + Q_OBJECT +public: + enum AnimalRoles { + TypeRole = Qt::UserRole + 1, + SizeRole + }; + + AnimalModel(QObject *parent = 0); +//![1] + + void addAnimal(const Animal &animal); + + int rowCount(const QModelIndex & parent = QModelIndex()) const; + + QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; + +private: + QList m_animals; +//![2] +}; +//![2] + + diff --git a/examples/declarative/modelviews/abstractitemmodel/view.qml b/examples/declarative/modelviews/abstractitemmodel/view.qml new file mode 100644 index 0000000..591d89a --- /dev/null +++ b/examples/declarative/modelviews/abstractitemmodel/view.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 + +//![0] +ListView { + width: 200; height: 250 + anchors.fill: parent + + model: myModel + delegate: Text { text: "Animal: " + type + ", " + size } +} +//![0] + diff --git a/examples/declarative/modelviews/objectlistmodel/main.cpp b/examples/declarative/modelviews/objectlistmodel/main.cpp index 8c921b7..89c22a1 100644 --- a/examples/declarative/modelviews/objectlistmodel/main.cpp +++ b/examples/declarative/modelviews/objectlistmodel/main.cpp @@ -56,10 +56,8 @@ //![0] int main(int argc, char ** argv) { -//![0] QApplication app(argc, argv); -//![1] QList dataList; dataList.append(new DataObject("Item 1", "red")); dataList.append(new DataObject("Item 2", "green")); @@ -69,13 +67,11 @@ int main(int argc, char ** argv) QDeclarativeView view; QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); +//![0] view.setSource(QUrl("qrc:view.qml")); view.show(); -//![1] return app.exec(); -//![2] } -//![2] diff --git a/examples/declarative/modelviews/stringlistmodel/main.cpp b/examples/declarative/modelviews/stringlistmodel/main.cpp index ea73859..bf46c63 100644 --- a/examples/declarative/modelviews/stringlistmodel/main.cpp +++ b/examples/declarative/modelviews/stringlistmodel/main.cpp @@ -66,10 +66,10 @@ int main(int argc, char ** argv) QDeclarativeView view; QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); +//![0] view.setSource(QUrl("qrc:view.qml")); view.show(); -//![0] return app.exec(); } -- cgit v0.12 From c24f25fa537486c8c5e38ecfde490b7422a28f81 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 1 Jul 2010 16:55:17 +1000 Subject: doc fix --- doc/src/declarative/globalobject.qdoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 40fc3eb..36d91ec 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -114,7 +114,8 @@ browser. The following objects and properties are supported by the QML implemen \endtable -\sa {declarative/xml/xmlhttprequest}{XMLHttpRequest example} +The \l{declarative/xml/xmlhttprequest}{XMLHttpRequest example} demonstrates how to +use the XMLHttpRequest object to make a request and read the response headers. \section1 Offline Storage API @@ -134,7 +135,8 @@ The API can be used from JavaScript functions in your QML: The API conforms to the Synchronous API of the HTML5 Web Database API, \link http://www.w3.org/TR/2009/WD-webdatabase-20091029/ W3C Working Draft 29 October 2009\endlink. -\sa {declarative/sqllocalstorage}{SQL Local Storage example} +The \l{declarative/sqllocalstorage}{SQL Local Storage example} demonstrates the basics of +using the Offline Storage API. \section3 db = openDatabaseSync(identifier, version, description, estimated_size, callback(db)) -- cgit v0.12 From a12cd98dda74b9ffa8729a58959bc7ab41118cf0 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 1 Jul 2010 17:50:45 +1000 Subject: Fix bug in SameGame's dialog component Was emitting closed after already being closed. Task-number: QTBUG-11812 --- demos/declarative/samegame/SamegameCore/Dialog.qml | 2 ++ demos/declarative/samegame/samegame.qml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/demos/declarative/samegame/SamegameCore/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml index c71a4b3..7e64bd6 100644 --- a/demos/declarative/samegame/SamegameCore/Dialog.qml +++ b/demos/declarative/samegame/SamegameCore/Dialog.qml @@ -49,6 +49,8 @@ Rectangle { signal closed signal opened function forceClose() { + if(page.opacity == 0) + return; //already closed page.closed(); page.opacity = 0; } diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 10bf79f..9504fb6 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -88,7 +88,7 @@ Rectangle { Behavior on width { NumberAnimation {} - enabled: initialWidth != 0 + enabled: nameInputDialog.initialWidth != 0 } onOpened: nameInputText.focus = true; -- cgit v0.12 From 7bb2eb806a6d8bcead12c199ae8614af250f6a6c Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Wed, 30 Jun 2010 14:44:29 +0200 Subject: Removed compilation warning for systems with no OpenGL support Reviewed-by: Aaron Kennedy --- tools/qml/qmlruntime.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 94fcc82..debc902 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -1364,6 +1364,8 @@ void QDeclarativeViewer::setUseGL(bool useGL) canvas->setViewport(glWidget); } +#else + Q_UNUSED(useGL) #endif } -- cgit v0.12 From fabf804b147892abb0e8aeb49d1753359ea5e56e Mon Sep 17 00:00:00 2001 From: mread Date: Wed, 30 Jun 2010 15:00:11 +0100 Subject: Avkon removal configured with -no-s60 Avkon dependencies can be configured out with the -no-s60 configure flag, conversely Qt on Symbian will use Avkon if -s60 is configured. These changes are intended to keep or introduce binary compatibility between the s60 and no-s60 configurations. To do this, it has been necessary to introduce stub equivalents of the CAknAppUi related classes into the no-s60 configuration, and override all Avkon framework virtual functions in the QS60Main... classes. Other than that, these changes are mostly just correcting the use of the Q_WS_S60 flag so that it only refers to Avkon dependencies. Reviewed-by: Sami Merila --- mkspecs/common/symbian/symbian.conf | 4 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 2 +- src/corelib/global/qglobal.cpp | 14 +-- src/corelib/io/io.pri | 2 +- src/corelib/io/qfsfileengine_unix.cpp | 10 -- src/corelib/kernel/qcore_symbian_p.cpp | 2 +- src/gui/dialogs/qdialog.cpp | 21 ++-- src/gui/dialogs/qdialog.h | 6 +- src/gui/image/qpixmapdatafactory.cpp | 4 +- src/gui/kernel/kernel.pri | 11 ++- src/gui/kernel/qapplication.cpp | 4 +- src/gui/kernel/qapplication.h | 8 +- src/gui/kernel/qapplication_s60.cpp | 15 +-- src/gui/kernel/qt_s60_p.h | 10 +- src/gui/kernel/qwidget.cpp | 2 +- src/gui/kernel/qwidget_s60.cpp | 3 + src/gui/painting/qgraphicssystem.cpp | 4 +- src/gui/s60framework/qs60mainapplication.cpp | 23 ++++- src/gui/s60framework/qs60mainapplication.h | 20 +++- src/gui/s60framework/qs60mainappui.cpp | 131 ++++++++++++++++++++++--- src/gui/s60framework/qs60mainappui.h | 75 +++++++++++++- src/gui/s60framework/qs60maindocument.cpp | 22 +++-- src/gui/s60framework/qs60maindocument.h | 20 +++- src/gui/s60framework/s60framework.pri | 22 +++-- src/gui/util/qdesktopservices_s60.cpp | 19 ++-- src/gui/util/util.pri | 3 +- src/gui/widgets/qmenubar_p.h | 2 +- 27 files changed, 338 insertions(+), 121 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index baa519f..c1b31e5 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -67,7 +67,7 @@ QMAKE_LINK_OBJECT_SCRIPT= QMAKE_LIBS = -llibc -llibm -leuser -llibdl QMAKE_LIBS_CORE = $$QMAKE_LIBS -lefsrv -lhal -lbafl -QMAKE_LIBS_GUI = $$QMAKE_LIBS_CORE -lfbscli -lbitgdi -lgdi -lws32 -lapgrfx -lcone -leikcore -lmediaclientaudio -leikcoctl -leiksrv -lapparc -lcentralrepository +QMAKE_LIBS_GUI = $$QMAKE_LIBS_CORE -lfbscli -lbitgdi -lgdi -lws32 -lapgrfx -lcone -leikcore -lmediaclientaudio -lapparc -lcentralrepository QMAKE_LIBS_NETWORK = QMAKE_LIBS_EGL = -llibEGL QMAKE_LIBS_OPENGL = @@ -75,7 +75,7 @@ QMAKE_LIBS_OPENVG = -llibOpenVG -lfbscli -lbitgdi -lgdi QMAKE_LIBS_THREAD = -llibpthread QMAKE_LIBS_COMPAT = QMAKE_LIBS_QT_ENTRY = -llibcrt0.lib -QMAKE_LIBS_S60 = -lavkon +QMAKE_LIBS_S60 = -lavkon -leikcoctl exists($${EPOCROOT}epoc32/include/platform/sgresource/sgimage.h) { QMAKE_LIBS_OPENVG += -lsgresource diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 9a4e9b2..dc12881 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -3614,7 +3614,7 @@ QString QWebPage::userAgentForUrl(const QUrl&) const firstPartTemp += QString::fromLatin1("Sun Solaris"); #elif defined Q_OS_ULTRIX firstPartTemp += QString::fromLatin1("DEC Ultrix"); -#elif defined Q_WS_S60 +#elif defined Q_OS_SYMBIAN firstPartTemp += QLatin1Char(' '); QSysInfo::S60Version s60Version = QSysInfo::s60Version(); switch (s60Version) { diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b31c83b..75a51ec 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1622,7 +1622,7 @@ bool qSharedBuild() \macro Q_WS_S60 \relates - Defined on S60. + Defined on S60 with the Avkon UI framework. \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_QWS */ @@ -1813,7 +1813,6 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() #endif #ifdef Q_OS_SYMBIAN -# ifdef Q_WS_S60 static QSysInfo::S60Version cachedS60Version = QSysInfo::S60Version(-1); QSysInfo::S60Version QSysInfo::s60Version() @@ -1885,17 +1884,6 @@ QSysInfo::SymbianVersion QSysInfo::symbianVersion() return SV_Unknown; } } -#else -QSysInfo::S60Version QSysInfo::s60Version() -{ - return SV_S60_None; -} - -QSysInfo::SymbianVersion QSysInfo::symbianVersion() -{ - return SV_Unknown; -} -# endif // ifdef Q_WS_S60 #endif // ifdef Q_OS_SYMBIAN /*! diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index ef448b1..3d964c6 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -93,6 +93,6 @@ win32 { SOURCES += io/qfilesystemwatcher_symbian.cpp HEADERS += io/qfilesystemwatcher_symbian_p.h INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - contains(QT_CONFIG, s60): LIBS += -lplatformenv + LIBS += -lplatformenv } } diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 5762d94..9464a97 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -634,13 +634,8 @@ QString QFSFileEngine::homePath() QString QFSFileEngine::rootPath() { #if defined(Q_OS_SYMBIAN) -# ifdef Q_WS_S60 TFileName symbianPath = PathInfo::PhoneMemoryRootPath(); return QDir::cleanPath(QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath))); -# else -# warning No fallback implementation of QFSFileEngine::rootPath() - return QString(); -# endif #else return QLatin1String("/"); #endif @@ -649,17 +644,12 @@ QString QFSFileEngine::rootPath() QString QFSFileEngine::tempPath() { #if defined(Q_OS_SYMBIAN) -# ifdef Q_WS_S60 TFileName symbianPath = PathInfo::PhoneMemoryRootPath(); QString temp = QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath)); temp += QLatin1String( "temp/"); // Just to verify that folder really exist on hardware QT_MKDIR(QFile::encodeName(temp), 0777); -# else -# warning No fallback implementation of QFSFileEngine::tempPath() - QString temp; -# endif #else QString temp = QFile::decodeName(qgetenv("TMPDIR")); if (temp.isEmpty()) diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index 402eccf..5afde9a 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -131,7 +131,7 @@ public: private: void init() { -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN _LIT(KLibName_3_1, "qts60plugin_3_1" QT_LIBINFIX_UNICODE L".dll"); _LIT(KLibName_3_2, "qts60plugin_3_2" QT_LIBINFIX_UNICODE L".dll"); _LIT(KLibName_5_0, "qts60plugin_5_0" QT_LIBINFIX_UNICODE L".dll"); diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index c2184f2..a2adb05 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -71,8 +71,9 @@ extern bool qt_wince_is_smartphone(); //is defined in qguifunctions_wce.cpp # include "qwizard.h" #endif -#if defined(Q_WS_S60) #include "private/qt_s60_p.h" +#if defined(Q_WS_S60) +#include // AknLayoutUtils #endif #ifndef SPI_GETSNAPTODEFBUTTON @@ -393,7 +394,7 @@ void QDialogPrivate::resetModalitySetByOpen() resetModalityTo = -1; } -#if defined(Q_WS_WINCE) || defined(Q_WS_S60) +#if defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN) #ifdef Q_WS_WINCE_WM void QDialogPrivate::_q_doneAction() { @@ -413,7 +414,7 @@ bool QDialog::event(QEvent *e) accept(); result = true; } -#else +#elif defined(Q_WS_S60) if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) { if (!testAttribute(Qt::WA_Moved)) { Qt::WindowStates state = windowState(); @@ -423,6 +424,7 @@ bool QDialog::event(QEvent *e) setWindowState(state); } } + // TODO is Symbian, non-S60 behaviour required? #endif return result; } @@ -823,8 +825,8 @@ void QDialog::adjustPosition(QWidget* w) return; #endif -#ifdef Q_WS_S60 - if (s60AdjustedPosition()) +#ifdef Q_OS_SYMBIAN + if (symbianAdjustedPosition()) //dialog has already been positioned return; #endif @@ -892,10 +894,11 @@ void QDialog::adjustPosition(QWidget* w) move(p); } -#if defined(Q_WS_S60) +#if defined(Q_OS_SYMBIAN) /*! \internal */ -bool QDialog::s60AdjustedPosition() +bool QDialog::symbianAdjustedPosition() { +#if defined(Q_WS_S60) QPoint p; const bool doS60Positioning = !(isFullScreen()||isMaximized()); if (doS60Positioning) { @@ -940,6 +943,10 @@ bool QDialog::s60AdjustedPosition() move(p); } return doS60Positioning; +#else + // TODO - check positioning requirement for Symbian, non-s60 + return false; +#endif } #endif diff --git a/src/gui/dialogs/qdialog.h b/src/gui/dialogs/qdialog.h index 777256a..b2ba93c 100644 --- a/src/gui/dialogs/qdialog.h +++ b/src/gui/dialogs/qdialog.h @@ -107,7 +107,7 @@ public Q_SLOTS: protected: QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = 0); -#if defined(Q_WS_WINCE) || defined(Q_WS_S60) +#if defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN) bool event(QEvent *e); #endif void keyPressEvent(QKeyEvent *); @@ -123,8 +123,8 @@ private: Q_DECLARE_PRIVATE(QDialog) Q_DISABLE_COPY(QDialog) -#if defined(Q_WS_S60) - bool s60AdjustedPosition(); +#if defined(Q_OS_SYMBIAN) + bool symbianAdjustedPosition(); #endif diff --git a/src/gui/image/qpixmapdatafactory.cpp b/src/gui/image/qpixmapdatafactory.cpp index 8014660..7498a7c 100644 --- a/src/gui/image/qpixmapdatafactory.cpp +++ b/src/gui/image/qpixmapdatafactory.cpp @@ -53,7 +53,7 @@ #ifdef Q_WS_MAC # include #endif -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN # include #endif @@ -82,7 +82,7 @@ QPixmapData* QSimplePixmapDataFactory::create(QPixmapData::PixelType type) return new QRasterPixmapData(type); #elif defined(Q_WS_MAC) return new QMacPixmapData(type); -#elif defined(Q_WS_S60) +#elif defined(Q_OS_SYMBIAN) return new QS60PixmapData(type); #else #error QSimplePixmapDataFactory::create() not implemented diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 6fd45ad..f9c84c1 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -120,18 +120,21 @@ symbian { kernel/qkeymapper_s60.cpp\ kernel/qclipboard_s60.cpp\ kernel/qdnd_s60.cpp \ - kernel/qsound_s60.cpp \ - kernel/qsoftkeymanager_s60.cpp + kernel/qsound_s60.cpp HEADERS += \ kernel/qt_s60_p.h \ - kernel/qeventdispatcher_s60_p.h \ - kernel/qsoftkeymanager_s60_p.h + kernel/qeventdispatcher_s60_p.h LIBS += -lbafl -lestor INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE INCLUDEPATH += ../3rdparty/s60 + + contains(QT_CONFIG, s60) { + SOURCES += kernel/qsoftkeymanager_s60.cpp + HEADERS += kernel/qsoftkeymanager_s60_p.h + } } diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 1680ef4..893de03 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2771,7 +2771,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { qt_win_set_cursor(cursorWidget, true); #elif defined(Q_WS_X11) qt_x11_enforce_cursor(cursorWidget, true); -#elif defined(Q_WS_S60) +#elif defined(Q_OS_SYMBIAN) qt_symbian_set_cursor(cursorWidget, true); #endif } @@ -5338,7 +5338,7 @@ QInputContext *QApplication::inputContext() const qic = QInputContextFactory::create(QLatin1String("xim"), that); that->d_func()->inputContext = qic; } -#elif defined(Q_OS_SYMBIAN) +#elif defined(Q_WS_SYMBIAN) if (!d->inputContext) { QApplication *that = const_cast(this); const QStringList keys = QInputContextFactory::keys(); diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index cb1d063..d31d9e5 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -61,7 +61,7 @@ QT_BEGIN_HEADER -#if defined(Q_WS_S60) +#if defined(Q_OS_SYMBIAN) class CApaApplication; #endif @@ -118,7 +118,7 @@ class Q_GUI_EXPORT QApplication : public QCoreApplication public: enum Type { Tty, GuiClient, GuiServer }; -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN typedef CApaApplication * (*QS60MainApplicationFactory)(); #endif @@ -130,7 +130,7 @@ public: QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0, int = QT_VERSION); QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0, int = QT_VERSION); #endif -#if defined(Q_WS_S60) +#if defined(Q_OS_SYMBIAN) QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int = QT_VERSION); #endif #endif @@ -366,7 +366,7 @@ public: QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0); QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0); #endif -#if defined(Q_WS_S60) || defined(qdoc) +#if defined(Q_OS_SYMBIAN) || defined(qdoc) QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv); #endif #endif diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index a7c7310..0d65811 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -69,14 +69,17 @@ #include "apgwgnam.h" // For CApaWindowGroupName #include // For CMdaAudioToneUtility +#if defined(Q_OS_SYMBIAN) +# include +# include +# include "qs60mainappui.h" +# include "qinputcontext.h" +#endif + #if defined(Q_WS_S60) # if !defined(QT_NO_IM) -# include "qinputcontext.h" # include # endif -# include -# include -# include "qs60mainappui.h" #endif #include "private/qstylesheetstyle_p.h" @@ -894,7 +897,7 @@ TKeyResponse QSymbianControl::sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent) if (qic && qic->filterEvent(keyEvent)) return EKeyWasConsumed; } -#endif // !defined(QT_NO_IM) && defined(Q_WS_S60) +#endif // !defined(QT_NO_IM) && defined(Q_OS_SYMBIAN) if (widget && qt_sendSpontaneousEvent(widget, keyEvent)) if (keyEvent->isAccepted()) @@ -1974,10 +1977,10 @@ int QApplicationPrivate::symbianHandleCommand(const QSymbianEvent *symbianEvent) ret = 1; break; default: +#ifdef Q_WS_S60 bool handled = QSoftKeyManager::handleCommand(command); if (handled) ret = 1; -#ifdef Q_WS_S60 else ret = QMenuBarPrivate::symbianCommands(command); #endif diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 204e38c..d8ef67d 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -155,7 +155,9 @@ public: static inline CAknTitlePane* titlePane(); static inline CAknContextPane* contextPane(); static inline CEikButtonGroupContainer* buttonGroupContainer(); +#endif +#ifdef Q_OS_SYMBIAN TTrapHandler *s60InstalledTrapHandler; #endif }; @@ -208,7 +210,7 @@ protected: // from MAknFadedComponent TInt CountFadedComponents() {return 1;} CCoeControl* FadedComponent(TInt /*aIndex*/) {return this;} #else - #warning No fallback implementation for QSymbianControl::FadeBehindPopup + // #warning No fallback implementation for QSymbianControl::FadeBehindPopup void FadeBehindPopup(bool /*fade*/){ } #endif @@ -277,9 +279,9 @@ inline QS60Data::QS60Data() avkonComponentsSupportTransparency(0), menuBeingConstructed(0), memoryLimitForHwRendering(0), - s60ApplicationFactory(0), -#ifdef Q_WS_S60 - s60InstalledTrapHandler(0) + s60ApplicationFactory(0) +#ifdef Q_OS_SYMBIAN + ,s60InstalledTrapHandler(0) #endif { } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index dd568cd..233df15 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -10695,7 +10695,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) break; case Qt::WA_AcceptTouchEvents: -#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_WS_S60) +#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN) if (on) d->registerTouchWindow(); #endif diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 3f351d9..2818d88 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -54,6 +54,7 @@ #ifdef Q_WS_S60 #include +#include #endif // This is necessary in order to be able to perform delayed invokation on slots @@ -1082,12 +1083,14 @@ void QWidget::setWindowState(Qt::WindowStates newstate) Qt::WindowStates oldstate = windowState(); const TBool isFullscreen = newstate & Qt::WindowFullScreen; +#ifdef Q_WS_S60 const TBool cbaRequested = windowFlags() & Qt::WindowSoftkeysVisibleHint; const TBool cbaVisible = CEikButtonGroupContainer::Current() ? true : false; const TBool softkeyVisibilityChange = isFullscreen && (cbaRequested != cbaVisible); if (oldstate == newstate && !softkeyVisibilityChange) return; +#endif // Q_WS_S60 if (isWindow()) { createWinId(); diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index 2ea3d33..bd9e7fc 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -50,7 +50,7 @@ #ifdef Q_WS_MAC # include #endif -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN # include #endif @@ -71,7 +71,7 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ return new QRasterPixmapData(type); #elif defined(Q_WS_MAC) return new QMacPixmapData(type); -#elif defined(Q_WS_S60) +#elif defined(Q_OS_SYMBIAN) return new QS60PixmapData(type); #elif !defined(Q_WS_QWS) #error QGraphicsSystem::createDefaultPixmapData() not implemented diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp index 41ac1a8..0f9367e 100644 --- a/src/gui/s60framework/qs60mainapplication.cpp +++ b/src/gui/s60framework/qs60mainapplication.cpp @@ -71,17 +71,17 @@ _LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main" QT_LIBINFIX_UNICODE L". The QS60MainApplication provides a helper class for use in migrating from existing S60 based applications to Qt based applications. It is - used in the exact same way as the \c CAknApplication class from + used in the exact same way as the \c CEikApplication class from Symbian, but internally provides extensions used by Qt. When modifying old S60 applications that rely on implementing - functions in \c CAknApplication, the class should be modified to - inherit from this class instead of \c CAknApplication. Then the + functions in \c CEikApplication, the class should be modified to + inherit from this class instead of \c CEikApplication. Then the application can choose to override only certain functions. To make Qt use the custom application objects, pass a factory function to \c{QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **)}. - For more information on \c CAknApplication, please see the S60 documentation. + For more information on \c CEikApplication, please see the S60 documentation. Unlike other Qt classes, QS60MainApplication behaves like an S60 class, and can throw Symbian leaves. @@ -136,4 +136,19 @@ TFileName QS60MainApplication::ResourceFileName() const return KNullDesC(); } +void QS60MainApplication::PreDocConstructL() +{ + QS60MainApplicationBase::PreDocConstructL(); +} + +CDictionaryStore *QS60MainApplication::OpenIniFileLC(RFs &aFs) const +{ + return QS60MainApplicationBase::OpenIniFileLC(aFs); +} + +void QS60MainApplication::NewAppServerL(CApaAppServer *&aAppServer) +{ + QS60MainApplicationBase::NewAppServerL(aAppServer); +} + QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60mainapplication.h b/src/gui/s60framework/qs60mainapplication.h index 997f30f..cb22e68 100644 --- a/src/gui/s60framework/qs60mainapplication.h +++ b/src/gui/s60framework/qs60mainapplication.h @@ -44,9 +44,15 @@ #include -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN +#ifdef Q_WS_S60 #include +typedef CAknApplication QS60MainApplicationBase; +#else +#include +typedef CEikApplication QS60MainApplicationBase; +#endif QT_BEGIN_HEADER @@ -54,7 +60,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QS60MainApplication : public CAknApplication +class Q_GUI_EXPORT QS60MainApplication : public QS60MainApplicationBase { public: QS60MainApplication(); @@ -65,6 +71,14 @@ public: virtual TFileName ResourceFileName() const; +public: + + virtual void PreDocConstructL(); + + virtual CDictionaryStore *OpenIniFileLC(RFs &aFs) const; + + virtual void NewAppServerL(CApaAppServer *&aAppServer); + protected: virtual CApaDocument *CreateDocumentL(); @@ -74,6 +88,6 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // Q_WS_S60 +#endif // Q_OS_SYMBIAN #endif // QS60MAINAPPLICATION_H diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index ce13de8..40c2d03 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -41,20 +41,25 @@ // INCLUDE FILES #include +#include +#ifdef Q_WS_S60 #include #include #include +#include +#endif #include #include -#if defined(QT_LIBINFIX_UNQUOTED) +#ifdef Q_WS_S60 +# if defined(QT_LIBINFIX_UNQUOTED) // Two level macro needed for proper expansion of libinfix -# define QT_S60MAIN_RSG_2(x) -# define QT_S60MAIN_RSG(x) QT_S60MAIN_RSG_2(x) -# include QT_S60MAIN_RSG(QT_LIBINFIX_UNQUOTED) -#else -# include +# define QT_S60MAIN_RSG_2(x) +# define QT_S60MAIN_RSG(x) QT_S60MAIN_RSG_2(x) +# include QT_S60MAIN_RSG(QT_LIBINFIX_UNQUOTED) +# else +# include +# endif #endif -#include #include "qs60mainappui.h" #include @@ -115,14 +120,16 @@ void QS60MainAppUi::ConstructL() // ENoAppResourceFile and ENonStandardResourceFile makes UI to work without // resource files in most SDKs. S60 3rd FP1 public seems to require resource file // even these flags are defined - TInt flags = CAknAppUi::EAknEnableSkin - | CAknAppUi::ENoScreenFurniture - | CAknAppUi::ENonStandardResourceFile; + TInt flags = CEikAppUi::ENoScreenFurniture + | CEikAppUi::ENonStandardResourceFile; +#ifdef Q_WS_S60 + flags |= CAknAppUi::EAknEnableSkin; // After 5th Edition S60, native side supports animated wallpapers. // However, there is no support for that feature on Qt side, so indicate to // native UI framework that this application will not support background animations. if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) flags |= KAknDisableAnimationBackground; +#endif BaseConstructL(flags); } @@ -168,7 +175,7 @@ void QS60MainAppUi::HandleCommandL(TInt command) */ void QS60MainAppUi::HandleResourceChangeL(TInt type) { - CAknAppUi::HandleResourceChangeL(type); + QS60MainAppUiBase::HandleResourceChangeL(type); if (qApp) { QSymbianEvent event(QSymbianEvent::ResourceChangeEvent, type); @@ -185,7 +192,7 @@ void QS60MainAppUi::HandleResourceChangeL(TInt type) * If you override this function, you should call the base class implementation if you do not * handle the event. */ -void QS60MainAppUi::HandleWsEventL(const TWsEvent& wsEvent, CCoeControl *destination) +void QS60MainAppUi::HandleWsEventL(const TWsEvent &wsEvent, CCoeControl *destination) { int result = 0; if (qApp) { @@ -196,7 +203,7 @@ void QS60MainAppUi::HandleWsEventL(const TWsEvent& wsEvent, CCoeControl *destina } if (result <= 0) - CAknAppUi::HandleWsEventL(wsEvent, destination); + QS60MainAppUiBase::HandleWsEventL(wsEvent, destination); } @@ -236,6 +243,7 @@ void QS60MainAppUi::DynInitMenuBarL(TInt /* resourceId */, CEikMenuBar * /* menu */ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) { +#ifdef Q_WS_S60 if (resourceId == R_QT_WRAPPERAPP_MENU) { if (menuPane->NumberOfItemsInPane() <= 1) QT_TRYCATCH_LEAVING(qt_symbian_show_toplevel(menuPane)); @@ -245,6 +253,9 @@ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) && resourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT) { QT_TRYCATCH_LEAVING(qt_symbian_show_submenu(menuPane, resourceId)); } +#else + QS60MainAppUiBase::DynInitMenuPaneL(resourceId, menuPane); +#endif } /*! @@ -255,16 +266,104 @@ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) * * If you override this function, you should call the base class implementation as well. */ -void QS60MainAppUi::RestoreMenuL(CCoeControl* menuWindow, TInt resourceId, TMenuType menuType) +void QS60MainAppUi::RestoreMenuL(CCoeControl *menuWindow, TInt resourceId, TMenuType menuType) { +#ifdef Q_WS_S60 if (resourceId >= QT_SYMBIAN_FIRST_MENU_ITEM && resourceId <= QT_SYMBIAN_LAST_MENU_ITEM) { if (menuType == EMenuPane) DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow); else DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow); - } else { - CAknAppUi::RestoreMenuL(menuWindow, resourceId, menuType); + } else +#endif + { + QS60MainAppUiBase::RestoreMenuL(menuWindow, resourceId, menuType); } } +void QS60MainAppUi::Exit() +{ + QS60MainAppUiBase::Exit(); +} + +void QS60MainAppUi::SetFadedL(TBool aFaded) +{ + QS60MainAppUiBase::SetFadedL(aFaded); +} + +TRect QS60MainAppUi::ApplicationRect() const +{ + return QS60MainAppUiBase::ApplicationRect(); +} + +void QS60MainAppUi::HandleScreenDeviceChangedL() +{ + QS60MainAppUiBase::HandleScreenDeviceChangedL(); +} + +void QS60MainAppUi::HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent) +{ + QS60MainAppUiBase::HandleApplicationSpecificEventL(aType, aEvent); +} + +TTypeUid::Ptr QS60MainAppUi::MopSupplyObject(TTypeUid aId) +{ + return QS60MainAppUiBase::MopSupplyObject(aId); +} + +void QS60MainAppUi::ProcessCommandL(TInt aCommand) +{ + QS60MainAppUiBase::ProcessCommandL(aCommand); +} + +TErrorHandlerResponse QS60MainAppUi::HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText) +{ + return QS60MainAppUiBase::HandleError(aError, aExtErr, aErrorText, aContextText); +} + +void QS60MainAppUi::HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId) +{ + QS60MainAppUiBase::HandleViewDeactivation(aViewIdToBeDeactivated, aNewlyActivatedViewId); +} + +void QS60MainAppUi::PrepareToExit() +{ + QS60MainAppUiBase::PrepareToExit(); +} + +void QS60MainAppUi::HandleTouchPaneSizeChange() +{ + QS60MainAppUiBase::HandleTouchPaneSizeChange(); +} + +void QS60MainAppUi::HandleSystemEventL(const TWsEvent &aEvent) +{ + QS60MainAppUiBase::HandleSystemEventL(aEvent); +} + +void QS60MainAppUi::Reserved_MtsmPosition() +{ + QS60MainAppUiBase::Reserved_MtsmPosition(); +} + +void QS60MainAppUi::Reserved_MtsmObject() +{ + QS60MainAppUiBase::Reserved_MtsmObject(); +} + +void QS60MainAppUi::HandleForegroundEventL(TBool aForeground) +{ + QS60MainAppUiBase::HandleForegroundEventL(aForeground); +} + +#ifndef Q_WS_S60 + +void QS60StubAknAppUi::HandleViewDeactivation(const TVwsViewId &, const TVwsViewId &) {} +void QS60StubAknAppUi::HandleTouchPaneSizeChange() {} +void QS60StubAknAppUi::HandleStatusPaneSizeChange() {} +void QS60StubAknAppUi::Reserved_MtsmPosition() {} +void QS60StubAknAppUi::Reserved_MtsmObject() {} + +#endif + QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60mainappui.h b/src/gui/s60framework/qs60mainappui.h index dcc72d1..796059f 100644 --- a/src/gui/s60framework/qs60mainappui.h +++ b/src/gui/s60framework/qs60mainappui.h @@ -44,9 +44,55 @@ #include -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN +#ifdef Q_WS_S60 #include +typedef CAknAppUi QS60MainAppUiBase; +#else +#include +// these stub classes simulate the structure of CAknAppUi, to help binary compatibility between Qt configured with and without S60/Avkon +class QS60StubAknAppUiBase : public CEikAppUi +{ +private: + int qS60StubAknAppUiBaseSpace[4]; +}; + +class QS60StubMEikStatusPaneObserver +{ +public: + virtual void HandleStatusPaneSizeChange() = 0; +}; + +class QS60StubMAknTouchPaneObserver +{ +public: + virtual void HandleTouchPaneSizeChange() = 0; +}; + +class QS60StubAknAppUi : public QS60StubAknAppUiBase, QS60StubMEikStatusPaneObserver, + public MCoeViewDeactivationObserver, + public QS60StubMAknTouchPaneObserver +{ +public: // MCoeViewDeactivationObserver + virtual void HandleViewDeactivation(const TVwsViewId&, const TVwsViewId &); + +public: // from MAknTouchPaneObserver + virtual void HandleTouchPaneSizeChange(); + +protected: // from MEikStatusPaneObserver + virtual void HandleStatusPaneSizeChange(); + +protected: // from CAknAppUi + virtual void Reserved_MtsmPosition(); + virtual void Reserved_MtsmObject(); + +private: + int qS60StubAknAppUiSpace[4]; +}; + +typedef QS60StubAknAppUi QS60MainAppUiBase; +#endif QT_BEGIN_HEADER @@ -54,7 +100,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QS60MainAppUi : public CAknAppUi +class Q_GUI_EXPORT QS60MainAppUi : public QS60MainAppUiBase { public: QS60MainAppUi(); @@ -63,7 +109,7 @@ public: virtual void ConstructL(); - virtual void RestoreMenuL(CCoeControl* menuWindow,TInt resourceId,TMenuType menuType); + virtual void RestoreMenuL(CCoeControl *menuWindow,TInt resourceId,TMenuType menuType); virtual void DynInitMenuBarL(TInt resourceId, CEikMenuBar *menuBar); virtual void DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane); @@ -74,13 +120,32 @@ public: virtual void HandleStatusPaneSizeChange(); protected: - virtual void HandleWsEventL(const TWsEvent& event, CCoeControl* destination); + virtual void HandleWsEventL(const TWsEvent &event, CCoeControl *destination); + +public: + virtual void Exit(); + virtual void SetFadedL(TBool aFaded); + virtual TRect ApplicationRect() const; + virtual void ProcessCommandL(TInt aCommand); + virtual TErrorHandlerResponse HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText); + virtual void HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId); + virtual void PrepareToExit(); + virtual void HandleTouchPaneSizeChange(); + +protected: + virtual void HandleScreenDeviceChangedL(); + virtual void HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent); + virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId); + virtual void HandleSystemEventL(const TWsEvent &aEvent); + virtual void Reserved_MtsmPosition(); + virtual void Reserved_MtsmObject(); + virtual void HandleForegroundEventL(TBool aForeground); }; QT_END_NAMESPACE QT_END_HEADER -#endif // Q_WS_S60 +#endif // Q_OS_SYMBIAN #endif // QS60MAINAPPUI_H diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp index 487e067..ed33a41 100644 --- a/src/gui/s60framework/qs60maindocument.cpp +++ b/src/gui/s60framework/qs60maindocument.cpp @@ -57,15 +57,15 @@ QT_BEGIN_NAMESPACE The QS60MainDocument provides a helper class for use in migrating from existing S60 based applications to Qt based applications. It is - used in the exact same way as the \c CAknDocument class from + used in the exact same way as the \c CEikDocument class from Symbian, but internally provides extensions used by Qt. When modifying old S60 applications that rely on implementing - functions in \c CAknDocument, the class should be modified to - inherit from this class instead of \c CAknDocument. Then the + functions in \c CEikDocument, the class should be modified to + inherit from this class instead of \c CEikDocument. Then the application can choose to override only certain functions. - For more information on \c CAknDocument, please see the S60 + For more information on \c CEikDocument, please see the S60 documentation. Unlike other Qt classes, QS60MainDocument behaves like an S60 class, @@ -79,8 +79,8 @@ QT_BEGIN_NAMESPACE * * \a mainApplication should contain a pointer to a QS60MainApplication instance. */ -QS60MainDocument::QS60MainDocument(CEikApplication& mainApplication) - : CAknDocument(mainApplication) +QS60MainDocument::QS60MainDocument(CEikApplication &mainApplication) + : QS60MainDocumentBase(mainApplication) { // No implementation required } @@ -105,4 +105,14 @@ CEikAppUi *QS60MainDocument::CreateAppUiL() return (static_cast (new(ELeave)QS60MainAppUi)); } +CFileStore *QS60MainDocument::OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &aFs) +{ + return QS60MainDocumentBase::OpenFileL(aDoOpen, aFilename, aFs); +} + +void QS60MainDocument::OpenFileL(CFileStore *&aFileStore, RFile &aFile) +{ + QS60MainDocumentBase::OpenFileL(aFileStore, aFile); +} + QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60maindocument.h b/src/gui/s60framework/qs60maindocument.h index 553675f..2f0564f 100644 --- a/src/gui/s60framework/qs60maindocument.h +++ b/src/gui/s60framework/qs60maindocument.h @@ -44,9 +44,15 @@ #include -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN -#include +#ifdef Q_WS_S60 +#include +typedef CAknDocument QS60MainDocumentBase; +#else +#include +typedef CEikDocument QS60MainDocumentBase; +#endif class CEikApplication; @@ -58,7 +64,7 @@ QT_MODULE(Gui) class QS60MainAppUi; -class Q_GUI_EXPORT QS60MainDocument : public CAknDocument +class Q_GUI_EXPORT QS60MainDocument : public QS60MainDocumentBase { public: @@ -69,12 +75,18 @@ public: public: virtual CEikAppUi *CreateAppUiL(); + +public: + + virtual CFileStore *OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &aFs); + + virtual void OpenFileL(CFileStore *&aFileStore, RFile &aFile); }; QT_END_NAMESPACE QT_END_HEADER -#endif // Q_WS_S60 +#endif // Q_OS_SYMBIAN #endif // QS60MAINDOCUMENT_H diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index f9d89dc..edbacc0 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -1,16 +1,20 @@ +contains(QT_CONFIG, s60) { # This block serves the minimalistic resource file for S60 3.1 platforms. # Note there is no way to ifdef S60 version in mmp file, that is why the resource # file is always compiled for WINSCW -minimalAppResource31 = \ - "SOURCEPATH s60framework" \ - "START RESOURCE s60main.rss" \ - "TARGET s60main$${QT_LIBINFIX}" \ - "HEADER" \ - "TARGETPATH /resource/apps" \ - "END" -MMP_RULES += minimalAppResource31 -SYMBIAN_RESOURCES += s60framework/s60main.rss + minimalAppResource31 = \ + "SOURCEPATH s60framework" \ + "START RESOURCE s60main.rss" \ + "TARGET s60main$${QT_LIBINFIX}" \ + "HEADER" \ + "TARGETPATH /resource/apps" \ + "END" + + MMP_RULES += minimalAppResource31 + + SYMBIAN_RESOURCES += s60framework/s60main.rss +} SOURCES += s60framework/qs60mainapplication.cpp \ s60framework/qs60mainappui.cpp \ diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index a415180..24f6ccf 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -39,9 +39,6 @@ ** ****************************************************************************/ -// This flag changes the implementation to use S60 CDcoumentHandler -// instead of apparch when opening the files -#define USE_DOCUMENTHANDLER #include #include @@ -56,10 +53,16 @@ #include // RSendAs #include // RSendAsMessage +#ifdef Q_WS_S60 +// This flag changes the implementation to use S60 CDcoumentHandler +// instead of apparch when opening the files +#define USE_DOCUMENTHANDLER +#endif + // copied from miutset.h, so we don't get a dependency into the app layer const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN # include // PathInfo # ifdef USE_DOCUMENTHANDLER # include // CDocumentHandler @@ -264,7 +267,7 @@ static TDriveUnit writableExeDrive() static TPtrC writableDataRoot() { TDriveUnit drive = exeDrive(); -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN switch(drive.operator TInt()){ case EDriveC: return PathInfo::PhoneMemoryRootPath(); @@ -391,19 +394,19 @@ QString QDesktopServices::storageLocation(StandardLocation type) break; case MusicLocation: path.Append(writableDataRoot()); -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN path.Append(PathInfo::SoundsPath()); #endif break; case MoviesLocation: path.Append(writableDataRoot()); -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN path.Append(PathInfo::VideosPath()); #endif break; case PicturesLocation: path.Append(writableDataRoot()); -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN path.Append(PathInfo::ImagesPath()); #endif break; diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index be8db93..bea520e 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -43,9 +43,8 @@ embedded { } symbian { - LIBS += -lsendas2 -letext -lapmime + LIBS += -lsendas2 -letext -lapmime -lplatformenv contains(QT_CONFIG, s60) { - LIBS += -lplatformenv contains(CONFIG, is_using_gnupoc) { LIBS += -lcommonui } else { diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h index 82070fe..fc6701c 100644 --- a/src/gui/widgets/qmenubar_p.h +++ b/src/gui/widgets/qmenubar_p.h @@ -269,10 +269,10 @@ public: } *symbian_menubar; static int symbianCommands(int command); +#endif #ifdef QT_SOFTKEYS_ENABLED QAction *menuBarAction; #endif -#endif }; #endif -- cgit v0.12 From 8c14529abdbbaa32c7d4f9d84b97515ab759223e Mon Sep 17 00:00:00 2001 From: mread Date: Wed, 30 Jun 2010 17:21:05 +0100 Subject: Stub version of QS60Style Added a stub version of QS60Style so that DEF files can be compatible between Qt configured with and without style-s60. Reviewed-by: Shane Kearns --- src/gui/styles/qs60style.h | 8 +-- src/gui/styles/qs60style_stub.cpp | 131 ++++++++++++++++++++++++++++++++++++++ src/gui/styles/styles.pri | 4 ++ 3 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 src/gui/styles/qs60style_stub.cpp diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index c878538..f588d9f 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -50,8 +50,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#if !defined(QT_NO_STYLE_S60) - //Public custom pixel metrics values. //These can be used to fetch custom pixel metric value from outside QS60Style. enum { @@ -91,14 +89,14 @@ public: #endif bool event(QEvent *e); -#ifndef Q_WS_S60 +#ifndef Q_OS_SYMBIAN static QStringList partKeys(); static QStringList colorListKeys(); void setS60Theme(const QHash &parts, const QHash, QColor> &colors); bool loadS60ThemeFromBlob(const QString &blobFile); bool saveS60ThemeToBlob(const QString &blobFile) const; -#endif // !Q_WS_S60 +#endif // !Q_OS_SYMBIAN protected Q_SLOTS: QIcon standardIconImplementation( @@ -113,8 +111,6 @@ private: friend class QApplicationPrivate; }; -#endif // QT_NO_STYLE_S60 - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/styles/qs60style_stub.cpp b/src/gui/styles/qs60style_stub.cpp new file mode 100644 index 0000000..a3a5b9d --- /dev/null +++ b/src/gui/styles/qs60style_stub.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qs60style.h" +#include "qdebug.h" + +#if defined(QT_NO_STYLE_S60) +QT_BEGIN_NAMESPACE + +QS60Style::QS60Style() +{ + qWarning() << "QS60Style stub created"; +} + +QS60Style::~QS60Style() +{ +} + +void QS60Style::drawComplexControl(ComplexControl , const QStyleOptionComplex *, QPainter *, const QWidget *) const +{ +} + +void QS60Style::drawControl(ControlElement , const QStyleOption *, QPainter *, const QWidget *) const +{ +} + +void QS60Style::drawPrimitive(PrimitiveElement , const QStyleOption *, QPainter *, const QWidget *) const +{ +} + +int QS60Style::pixelMetric(PixelMetric , const QStyleOption *, const QWidget *) const +{ + return 0; +} + +QSize QS60Style::sizeFromContents(ContentsType , const QStyleOption *, const QSize &, const QWidget *) const +{ + return QSize(); +} + +int QS60Style::styleHint(StyleHint , const QStyleOption *, const QWidget *, QStyleHintReturn *) const +{ + return 0; +} + +QRect QS60Style::subControlRect(ComplexControl , const QStyleOptionComplex *, SubControl , const QWidget *) const +{ + return QRect(); +} + +QRect QS60Style::subElementRect(SubElement , const QStyleOption *, const QWidget *) const +{ + return QRect(); +} + +void QS60Style::polish(QWidget *) +{ +} + +void QS60Style::unpolish(QWidget *) +{ +} + +void QS60Style::polish(QApplication *) +{ +} + +void QS60Style::unpolish(QApplication *) +{ +} + +bool QS60Style::event(QEvent *) +{ + return false; +} + +QIcon QS60Style::standardIconImplementation(StandardPixmap , const QStyleOption *, const QWidget *) const +{ + return QIcon(); +} + +void QS60Style::timerEvent(QTimerEvent *) +{ +} + +bool QS60Style::eventFilter(QObject *, QEvent *) +{ + return false; +} + +QT_END_NAMESPACE + +#endif // QT_NO_STYLE_S60 diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 0a96272..b22a908 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -182,5 +182,9 @@ contains( styles, s60 ):contains(QT_CONFIG, s60) { RESOURCES += styles/qstyle_s60_simulated.qrc } } else { + symbian { + HEADERS += styles/qs60style.h + SOURCES += styles/qs60style_stub.cpp + } DEFINES += QT_NO_STYLE_S60 } -- cgit v0.12 From e302b2b1e65c616d7ed6adfcf4b252a6741f3053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 30 Jun 2010 10:32:01 +0200 Subject: Improved performance of 16 bit memrotates using NEON instructions. Make the memrotate functions a function pointer table so that we can replace it with optimized versions, and implement an optimized NEON version for the 90 and 270 rotations. Measured performance improvement for a 400x400 16-bit pixmap was 17 % for 270 degree rotation and 11 % for 90 degree rotation. Reviewed-by: Trond --- src/gui/painting/qdrawhelper.cpp | 3 + src/gui/painting/qdrawhelper_neon.cpp | 144 +++++++++++++++++++++++++++++++ src/gui/painting/qdrawhelper_neon_asm.S | 105 ++++++++++++++++++++++ src/gui/painting/qdrawhelper_neon_p.h | 3 + src/gui/painting/qdrawhelper_p.h | 2 + src/gui/painting/qmemrotate.cpp | 51 +++++++++++ src/gui/painting/qpaintengine_raster.cpp | 24 +----- 7 files changed, 310 insertions(+), 22 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 5727b3c..d7f7dc3 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7901,6 +7901,9 @@ void qInitDrawhelperAsm() functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; + + qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; + qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; } #endif diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index 3ce90d2..03fe075 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -622,6 +622,150 @@ void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, u } } +static const int tileSize = 32; + +extern "C" void qt_rotate90_16_neon(quint16 *dst, const quint16 *src, int sstride, int dstride, int count); + +void qt_memrotate90_16_neon(const uchar *srcPixels, int w, int h, int sstride, uchar *destPixels, int dstride) +{ + const ushort *src = (const ushort *)srcPixels; + ushort *dest = (ushort *)destPixels; + + sstride /= sizeof(ushort); + dstride /= sizeof(ushort); + + const int pack = sizeof(quint32) / sizeof(ushort); + const int unaligned = + qMin(uint((quintptr(dest) & (sizeof(quint32)-1)) / sizeof(ushort)), uint(h)); + const int restX = w % tileSize; + const int restY = (h - unaligned) % tileSize; + const int unoptimizedY = restY % pack; + const int numTilesX = w / tileSize + (restX > 0); + const int numTilesY = (h - unaligned) / tileSize + (restY >= pack); + + for (int tx = 0; tx < numTilesX; ++tx) { + const int startx = w - tx * tileSize - 1; + const int stopx = qMax(startx - tileSize, 0); + + if (unaligned) { + for (int x = startx; x >= stopx; --x) { + ushort *d = dest + (w - x - 1) * dstride; + for (int y = 0; y < unaligned; ++y) { + *d++ = src[y * sstride + x]; + } + } + } + + for (int ty = 0; ty < numTilesY; ++ty) { + const int starty = ty * tileSize + unaligned; + const int stopy = qMin(starty + tileSize, h - unoptimizedY); + + int x = startx; + // qt_rotate90_16_neon writes to eight rows, four pixels at a time + for (; x >= stopx + 7; x -= 8) { + ushort *d = dest + (w - x - 1) * dstride + starty; + const ushort *s = &src[starty * sstride + x - 7]; + qt_rotate90_16_neon(d, s, sstride * 2, dstride * 2, stopy - starty); + } + + for (; x >= stopx; --x) { + quint32 *d = reinterpret_cast(dest + (w - x - 1) * dstride + starty); + for (int y = starty; y < stopy; y += pack) { + quint32 c = src[y * sstride + x]; + for (int i = 1; i < pack; ++i) { + const int shift = (sizeof(int) * 8 / pack * i); + const ushort color = src[(y + i) * sstride + x]; + c |= color << shift; + } + *d++ = c; + } + } + } + + if (unoptimizedY) { + const int starty = h - unoptimizedY; + for (int x = startx; x >= stopx; --x) { + ushort *d = dest + (w - x - 1) * dstride + starty; + for (int y = starty; y < h; ++y) { + *d++ = src[y * sstride + x]; + } + } + } + } +} + +extern "C" void qt_rotate270_16_neon(quint16 *dst, const quint16 *src, int sstride, int dstride, int count); + +void qt_memrotate270_16_neon(const uchar *srcPixels, int w, int h, + int sstride, + uchar *destPixels, int dstride) +{ + const ushort *src = (const ushort *)srcPixels; + ushort *dest = (ushort *)destPixels; + + sstride /= sizeof(ushort); + dstride /= sizeof(ushort); + + const int pack = sizeof(quint32) / sizeof(ushort); + const int unaligned = + qMin(uint((long(dest) & (sizeof(quint32)-1)) / sizeof(ushort)), uint(h)); + const int restX = w % tileSize; + const int restY = (h - unaligned) % tileSize; + const int unoptimizedY = restY % pack; + const int numTilesX = w / tileSize + (restX > 0); + const int numTilesY = (h - unaligned) / tileSize + (restY >= pack); + + for (int tx = 0; tx < numTilesX; ++tx) { + const int startx = tx * tileSize; + const int stopx = qMin(startx + tileSize, w); + + if (unaligned) { + for (int x = startx; x < stopx; ++x) { + ushort *d = dest + x * dstride; + for (int y = h - 1; y >= h - unaligned; --y) { + *d++ = src[y * sstride + x]; + } + } + } + + for (int ty = 0; ty < numTilesY; ++ty) { + const int starty = h - 1 - unaligned - ty * tileSize; + const int stopy = qMax(starty - tileSize, unoptimizedY); + + int x = startx; + // qt_rotate90_16_neon writes to eight rows, four pixels at a time + for (; x < stopx - 7; x += 8) { + ushort *d = dest + x * dstride + h - 1 - starty; + const ushort *s = &src[starty * sstride + x]; + qt_rotate90_16_neon(d + 7 * dstride, s, -sstride * 2, -dstride * 2, starty - stopy); + } + + for (; x < stopx; ++x) { + quint32 *d = reinterpret_cast(dest + x * dstride + + h - 1 - starty); + for (int y = starty; y > stopy; y -= pack) { + quint32 c = src[y * sstride + x]; + for (int i = 1; i < pack; ++i) { + const int shift = (sizeof(int) * 8 / pack * i); + const ushort color = src[(y - i) * sstride + x]; + c |= color << shift; + } + *d++ = c; + } + } + } + if (unoptimizedY) { + const int starty = unoptimizedY - 1; + for (int x = startx; x < stopx; ++x) { + ushort *d = dest + x * dstride + h - 1 - starty; + for (int y = starty; y >= 0; --y) { + *d++ = src[y * sstride + x]; + } + } + } + } +} + QT_END_NAMESPACE #endif // QT_HAVE_NEON diff --git a/src/gui/painting/qdrawhelper_neon_asm.S b/src/gui/painting/qdrawhelper_neon_asm.S index 9992817..d9cdc36 100644 --- a/src/gui/painting/qdrawhelper_neon_asm.S +++ b/src/gui/painting/qdrawhelper_neon_asm.S @@ -190,3 +190,108 @@ blend_8_pixels_rgb16_on_rgb16_neon: bx lr .endfunc + +/* void qt_rotate90_16_neon(quint16 *dst, const quint16 *src, int sstride, int dstride, int count) */ + .func qt_rotate90_16_neon + .global qt_rotate90_16_neon + /* For ELF format also set function visibility to hidden */ +#ifdef __ELF__ + .hidden qt_rotate90_16_neon + .type qt_rotate90_16_neon, %function +#endif +qt_rotate90_16_neon: + push { r4-r11, lr } + ldr r5, [sp, #(9*4)] + + /* The preloads are the key to getting good performance */ + pld [r1] + + mov r4, r5, asr #2 + add r6, r0, r3 + add r7, r6, r3 + + add r8, r7, r3 + add r9, r8, r3 + + pld [r1, r2] + + add r10, r9, r3 + add r11, r10, r3 + + add r3, r3, r11 + and r5, r5, #3 + + pld [r1, r2, lsl #1] + + cmp r4, #0 + beq .rotate90_16_tail + +.rotate90_16_loop: + vld1.16 { q8 }, [r1], r2 + + pld [r1, r2, lsl #1] + + vld1.16 { q9 }, [r1], r2 + vld1.16 { q10 }, [r1], r2 + vld1.16 { q11 }, [r1], r2 + + pld [r1] + + /* Could have used four quad-word zips instead, + but those take three cycles as opposed to one. */ + vzip.16 d16, d20 + vzip.16 d17, d21 + + vzip.16 d18, d22 + + pld [r1, r2] + + vzip.16 d19, d23 + + vzip.16 d16, d18 + vzip.16 d17, d19 + + pld [r1, r2, lsl #1] + + vzip.16 d20, d22 + vzip.16 d21, d23 + + vst1.16 { d23 }, [r0]! + vst1.16 { d21 }, [r6]! + vst1.16 { d19 }, [r7]! + vst1.16 { d17 }, [r8]! + vst1.16 { d22 }, [r9]! + vst1.16 { d20 }, [r10]! + vst1.16 { d18 }, [r11]! + vst1.16 { d16 }, [r3]! + + sub r4, r4, #1 + cmp r4, #0 + bne .rotate90_16_loop + b .rotate90_16_tail + +.rotate90_16_tail_loop: + sub r5, r5, #2 + + vld1.16 { q8 }, [r1], r2 + vld1.16 { q9 }, [r1], r2 + + vzip.16 d16, d18 + vzip.16 d17, d19 + + vst1.32 { d19[1] }, [r0]! + vst1.32 { d19[0] }, [r6]! + vst1.32 { d17[1] }, [r7]! + vst1.32 { d17[0] }, [r8]! + vst1.32 { d18[1] }, [r9]! + vst1.32 { d18[0] }, [r10]! + vst1.32 { d16[1] }, [r11]! + vst1.32 { d16[0] }, [r3]! + +.rotate90_16_tail: + cmp r5, #0 + bgt .rotate90_16_tail_loop + + pop { r4-r11, pc } + + .endfunc diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h index c054a1e..cd2dbfc 100644 --- a/src/gui/painting/qdrawhelper_neon_p.h +++ b/src/gui/painting/qdrawhelper_neon_p.h @@ -120,6 +120,9 @@ void qt_transform_image_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl, const QTransform &targetRectTransform, int const_alpha); +void qt_memrotate90_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl); +void qt_memrotate270_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl); + uint * QT_FASTCALL qt_destFetchRGB16_neon(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length); diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index acf765c..97c78bb 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -152,6 +152,7 @@ typedef void (*SrcOverTransformFunc)(uchar *destPixels, int dbpl, const QTransform &targetRectTransform, int const_alpha); +typedef void (*MemRotateFunc)(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl); struct DrawHelper { ProcessSpans blendColor; @@ -165,6 +166,7 @@ struct DrawHelper { extern SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats]; extern SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats]; extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats]; +extern MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3]; extern DrawHelper qDrawHelper[QImage::NImageFormats]; diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp index c37aa51..6888bb0 100644 --- a/src/gui/painting/qmemrotate.cpp +++ b/src/gui/painting/qmemrotate.cpp @@ -594,4 +594,55 @@ void Q_GUI_EXPORT qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHei qt_memrotate90_template(src, srcWidth, srcHeight, srcStride, reinterpret_cast(dest), dstStride); } +void qt_memrotate90_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate90((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl); +} + +void qt_memrotate180_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate180((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl); +} + +void qt_memrotate270_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate270((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl); +} + +void qt_memrotate90_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate90((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl); +} + +void qt_memrotate180_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate180((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl); +} + +void qt_memrotate270_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate270((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl); +} + +MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3] = +// 90, 180, 270 +{ + { 0, 0, 0 }, // Format_Invalid, + { 0, 0, 0 }, // Format_Mono, + { 0, 0, 0 }, // Format_MonoLSB, + { 0, 0, 0 }, // Format_Indexed8, + { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_RGB32, + { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_ARGB32, + { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_ARGB32_Premultiplied, + { qt_memrotate90_16, qt_memrotate180_16, qt_memrotate270_16 }, // Format_RGB16, + { 0, 0, 0 }, // Format_ARGB8565_Premultiplied, + { 0, 0, 0 }, // Format_RGB666, + { 0, 0, 0 }, // Format_ARGB6666_Premultiplied, + { 0, 0, 0 }, // Format_RGB555, + { 0, 0, 0 }, // Format_ARGB8555_Premultiplied, + { 0, 0, 0 }, // Format_RGB888, + { 0, 0, 0 }, // Format_RGB444, + { 0, 0, 0 } // Format_ARGB4444_Premultiplied, +}; + QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 84b36c7..09a87aa 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2553,23 +2553,6 @@ namespace { return NoRotation; } - template void memRotate(RotationType type, const T *srcBase, int w, int h, int sbpl, T *dstBase, int dbpl) - { - switch (type) { - case Rotation90: - qt_memrotate90(srcBase, w, h, sbpl, dstBase, dbpl); - break; - case Rotation180: - qt_memrotate180(srcBase, w, h, sbpl, dstBase, dbpl); - break; - case Rotation270: - qt_memrotate270(srcBase, w, h, sbpl, dstBase, dbpl); - break; - case NoRotation: - break; - } - } - inline bool isPixelAligned(const QRectF &rect) { return QRectF(rect.toRect()) == rect; } @@ -2650,7 +2633,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe { RotationType rotationType = qRotationType(s->matrix); - if (rotationType != NoRotation && img.rect().contains(sr.toAlignedRect())) { + if (rotationType != NoRotation && qMemRotateFunctions[d->rasterBuffer->format][rotationType] && img.rect().contains(sr.toAlignedRect())) { QRectF transformedTargetRect = s->matrix.mapRect(r); if ((!(s->renderHints & QPainter::SmoothPixmapTransform) && !(s->renderHints & QPainter::Antialiasing)) @@ -2678,10 +2661,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe uint cw = clippedSourceRect.width(); uint ch = clippedSourceRect.height(); - if (d->rasterBuffer->format == QImage::Format_RGB16) - memRotate(rotationType, (quint16 *)srcBase, cw, ch, sbpl, (quint16 *)dstBase, dbpl); - else - memRotate(rotationType, (quint32 *)srcBase, cw, ch, sbpl, (quint32 *)dstBase, dbpl); + qMemRotateFunctions[d->rasterBuffer->format][rotationType](srcBase, cw, ch, sbpl, dstBase, dbpl); return; } -- cgit v0.12 From fa0ef7a2c36afffb45a7954eb8a230953578f55e Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 1 Jul 2010 18:39:34 +1000 Subject: Remove arbitrary width checks Width is not an arbitrary value, it is the size of the rendered page (which is whatever webkit says it is). Width should be tested to be correct, but this change should be done by the maintainers (who should also take the autotest out of declarative). Task-number: QTBUG-11855 --- tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index f33e5a4..2a220c4 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -156,7 +156,6 @@ void tst_qdeclarativewebview::basicProperties() QCOMPARE(qvariant_cast(wv->property("icon")),QPixmap(SRCDIR "/data/basic.png")); QCOMPARE(wv->property("statusText").toString(),QString("status here")); QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString())); - QCOMPARE(wv->property("width").toDouble(), 123.0); QCOMPARE(wv->property("preferredWidth").toInt(), 0); QCOMPARE(wv->property("preferredHeight").toInt(), 0); QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0); @@ -258,7 +257,6 @@ void tst_qdeclarativewebview::historyNav() QCOMPARE(qvariant_cast(wv->property("icon")),QPixmap(SRCDIR "/data/basic.png")); QCOMPARE(wv->property("statusText").toString(),QString("status here")); QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString())); - QCOMPARE(wv->property("width").toDouble(), 123.0); QCOMPARE(wv->property("preferredWidth").toDouble(), 0.0); QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0); QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); -- cgit v0.12 From 07e755128c3bf4073820ecfc0ea11959b20bbd5a Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 1 Jul 2010 18:47:37 +1000 Subject: Get WebView tests passing again zoomFactor was removed in the new version. --- tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index 2a220c4..2bded6b 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -158,7 +158,6 @@ void tst_qdeclarativewebview::basicProperties() QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString())); QCOMPARE(wv->property("preferredWidth").toInt(), 0); QCOMPARE(wv->property("preferredHeight").toInt(), 0); - QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0); QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/); QVERIFY(qvariant_cast(wv->property("reload"))); @@ -258,7 +257,6 @@ void tst_qdeclarativewebview::historyNav() QCOMPARE(wv->property("statusText").toString(),QString("status here")); QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString())); QCOMPARE(wv->property("preferredWidth").toDouble(), 0.0); - QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0); QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/); QVERIFY(qvariant_cast(wv->property("reload"))); -- cgit v0.12 From 9e2a179cb3384391a8d7ad4be2deea8f3390a37f Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 1 Jul 2010 10:14:47 +0100 Subject: Avkon Removal DEF file updates This adds the s60framework exports to the Symbian DEF files. These new exports remove the need for apps using s60framework classes to link to Avkon. --- src/s60installs/bwins/QtGuiu.def | 22 +++++++++++++++++++++- src/s60installs/eabi/QtGuiu.def | 26 +++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 6e20131..de8e052 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -8181,7 +8181,7 @@ EXPORTS ?rowsInserted@QTreeView@@MAEXABVQModelIndex@@HH@Z @ 8180 NONAME ; void QTreeView::rowsInserted(class QModelIndex const &, int, int) ?rowsRemoved@QTreeView@@IAEXABVQModelIndex@@HH@Z @ 8181 NONAME ; void QTreeView::rowsRemoved(class QModelIndex const &, int, int) ?rubberBandSelectionMode@QGraphicsView@@QBE?AW4ItemSelectionMode@Qt@@XZ @ 8182 NONAME ; enum Qt::ItemSelectionMode QGraphicsView::rubberBandSelectionMode(void) const - ?s60AdjustedPosition@QDialog@@AAE_NXZ @ 8183 NONAME ; bool QDialog::s60AdjustedPosition(void) + ?symbianAdjustedPosition@QDialog@@AAE_NXZ @ 8183 NONAME ; bool QDialog::symbianAdjustedPosition(void) ?s60UpdateIsOpaque@QWidgetPrivate@@QAEXXZ @ 8184 NONAME ; void QWidgetPrivate::s60UpdateIsOpaque(void) ?saturation@QColor@@QBEHXZ @ 8185 NONAME ; int QColor::saturation(void) const ?saturationF@QColor@@QBEMXZ @ 8186 NONAME ; float QColor::saturationF(void) const @@ -12824,4 +12824,24 @@ EXPORTS ?createPixmapForImage@QRasterPixmapData@@IAEXAAVQImage@@V?$QFlags@W4ImageConversionFlag@Qt@@@@_N@Z @ 12823 NONAME ; void QRasterPixmapData::createPixmapForImage(class QImage &, class QFlags, bool) ??0Tab@QTextOption@@QAE@MW4TabType@1@VQChar@@@Z @ 12824 NONAME ; QTextOption::Tab::Tab(float, enum QTextOption::TabType, class QChar) ?fromData@QRasterPixmapData@@UAE_NPBEIPBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12825 NONAME ; bool QRasterPixmapData::fromData(unsigned char const *, unsigned int, char const *, class QFlags) + ?OpenIniFileLC@QS60MainApplication@@UBEPAVCDictionaryStore@@AAVRFs@@@Z @ 12826 NONAME ; class CDictionaryStore * QS60MainApplication::OpenIniFileLC(class RFs &) const + ?Reserved_MtsmObject@QS60MainAppUi@@MAEXXZ @ 12827 NONAME ; void QS60MainAppUi::Reserved_MtsmObject(void) + ?HandleForegroundEventL@QS60MainAppUi@@MAEXH@Z @ 12828 NONAME ; void QS60MainAppUi::HandleForegroundEventL(int) + ?OpenFileL@QS60MainDocument@@UAEPAVCFileStore@@HABVTDesC16@@AAVRFs@@@Z @ 12829 NONAME ; class CFileStore * QS60MainDocument::OpenFileL(int, class TDesC16 const &, class RFs &) + ?HandleTouchPaneSizeChange@QS60MainAppUi@@UAEXXZ @ 12830 NONAME ; void QS60MainAppUi::HandleTouchPaneSizeChange(void) + ?Reserved_MtsmPosition@QS60MainAppUi@@MAEXXZ @ 12831 NONAME ; void QS60MainAppUi::Reserved_MtsmPosition(void) + ?ApplicationRect@QS60MainAppUi@@UBE?AVTRect@@XZ @ 12832 NONAME ; class TRect QS60MainAppUi::ApplicationRect(void) const + ?HandleSystemEventL@QS60MainAppUi@@MAEXABVTWsEvent@@@Z @ 12833 NONAME ; void QS60MainAppUi::HandleSystemEventL(class TWsEvent const &) + ?HandleApplicationSpecificEventL@QS60MainAppUi@@MAEXHABVTWsEvent@@@Z @ 12834 NONAME ; void QS60MainAppUi::HandleApplicationSpecificEventL(int, class TWsEvent const &) + ?HandleError@QS60MainAppUi@@UAE?AW4TErrorHandlerResponse@@HABUSExtendedError@@AAVTDes16@@1@Z @ 12835 NONAME ; enum TErrorHandlerResponse QS60MainAppUi::HandleError(int, struct SExtendedError const &, class TDes16 &, class TDes16 &) + ?PrepareToExit@QS60MainAppUi@@UAEXXZ @ 12836 NONAME ; void QS60MainAppUi::PrepareToExit(void) + ?MopSupplyObject@QS60MainAppUi@@MAE?AVPtr@TTypeUid@@V3@@Z @ 12837 NONAME ; class TTypeUid::Ptr QS60MainAppUi::MopSupplyObject(class TTypeUid) + ?SetFadedL@QS60MainAppUi@@UAEXH@Z @ 12838 NONAME ; void QS60MainAppUi::SetFadedL(int) + ?Exit@QS60MainAppUi@@UAEXXZ @ 12839 NONAME ; void QS60MainAppUi::Exit(void) + ?ProcessCommandL@QS60MainAppUi@@UAEXH@Z @ 12840 NONAME ; void QS60MainAppUi::ProcessCommandL(int) + ?OpenFileL@QS60MainDocument@@UAEXAAPAVCFileStore@@AAVRFile@@@Z @ 12841 NONAME ; void QS60MainDocument::OpenFileL(class CFileStore * &, class RFile &) + ?HandleScreenDeviceChangedL@QS60MainAppUi@@MAEXXZ @ 12842 NONAME ; void QS60MainAppUi::HandleScreenDeviceChangedL(void) + ?PreDocConstructL@QS60MainApplication@@UAEXXZ @ 12843 NONAME ; void QS60MainApplication::PreDocConstructL(void) + ?NewAppServerL@QS60MainApplication@@UAEXAAPAVCApaAppServer@@@Z @ 12844 NONAME ; void QS60MainApplication::NewAppServerL(class CApaAppServer * &) + ?HandleViewDeactivation@QS60MainAppUi@@UAEXABVTVwsViewId@@0@Z @ 12845 NONAME ; void QS60MainAppUi::HandleViewDeactivation(class TVwsViewId const &, class TVwsViewId const &) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index e7d865b..5e46a25 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -5957,7 +5957,7 @@ EXPORTS _ZN7QDialog16staticMetaObjectE @ 5956 NONAME DATA 16 _ZN7QDialog18setSizeGripEnabledEb @ 5957 NONAME _ZN7QDialog19getStaticMetaObjectEv @ 5958 NONAME - _ZN7QDialog19s60AdjustedPositionEv @ 5959 NONAME + _ZN7QDialog23symbianAdjustedPositionEv @ 5959 NONAME _ZN7QDialog4doneEi @ 5960 NONAME _ZN7QDialog4execEv @ 5961 NONAME _ZN7QDialog4openEv @ 5962 NONAME @@ -12020,4 +12020,28 @@ EXPORTS _ZN10QImageData14convertInPlaceEN6QImage6FormatE6QFlagsIN2Qt19ImageConversionFlagEE @ 12019 NONAME _ZN17QRasterPixmapData20createPixmapForImageER6QImage6QFlagsIN2Qt19ImageConversionFlagEEb @ 12020 NONAME _ZN17QRasterPixmapData8fromDataEPKhjPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 12021 NONAME + _ZN13QS60MainAppUi11HandleErrorEiRK14SExtendedErrorR6TDes16S4_ @ 12022 NONAME + _ZN13QS60MainAppUi13PrepareToExitEv @ 12023 NONAME + _ZN13QS60MainAppUi15MopSupplyObjectE8TTypeUid @ 12024 NONAME + _ZN13QS60MainAppUi15ProcessCommandLEi @ 12025 NONAME + _ZN13QS60MainAppUi18HandleSystemEventLERK8TWsEvent @ 12026 NONAME + _ZN13QS60MainAppUi19Reserved_MtsmObjectEv @ 12027 NONAME + _ZN13QS60MainAppUi21Reserved_MtsmPositionEv @ 12028 NONAME + _ZN13QS60MainAppUi22HandleForegroundEventLEi @ 12029 NONAME + _ZN13QS60MainAppUi22HandleViewDeactivationERK10TVwsViewIdS2_ @ 12030 NONAME + _ZN13QS60MainAppUi25HandleTouchPaneSizeChangeEv @ 12031 NONAME + _ZN13QS60MainAppUi26HandleScreenDeviceChangedLEv @ 12032 NONAME + _ZN13QS60MainAppUi31HandleApplicationSpecificEventLEiRK8TWsEvent @ 12033 NONAME + _ZN13QS60MainAppUi4ExitEv @ 12034 NONAME + _ZN13QS60MainAppUi9SetFadedLEi @ 12035 NONAME + _ZN16QS60MainDocument9OpenFileLERP10CFileStoreR5RFile @ 12036 NONAME + _ZN16QS60MainDocument9OpenFileLEiRK7TDesC16R3RFs @ 12037 NONAME + _ZN19QS60MainApplication13NewAppServerLERP13CApaAppServer @ 12038 NONAME + _ZN19QS60MainApplication16PreDocConstructLEv @ 12039 NONAME + _ZNK13QS60MainAppUi15ApplicationRectEv @ 12040 NONAME + _ZNK19QS60MainApplication13OpenIniFileLCER3RFs @ 12041 NONAME + _ZThn100_N13QS60MainAppUi25HandleTouchPaneSizeChangeEv @ 12042 NONAME + _ZThn24_N13QS60MainAppUi15ProcessCommandLEi @ 12043 NONAME + _ZThn40_N13QS60MainAppUi15MopSupplyObjectE8TTypeUid @ 12044 NONAME + _ZThn92_N13QS60MainAppUi22HandleViewDeactivationERK10TVwsViewIdS2_ @ 12045 NONAME -- cgit v0.12 From ace4710951ca5be3cb10bb631d8082e12e0b0b1c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 1 Jul 2010 11:22:23 +0200 Subject: Updated WebKit to 0eee8df53d1873669a9dda8f9c0340543258a316 Integrated changes: || || [Qt] QtTestBrowser does not have a "Load" button ; therefore, unable to load pages on touch only symbian devices (portrait mode). || || || [Qt] GraphicsLayerQt delay seems unnecessary. || || || Spatial Navigation: make elements in inner frames nested more than 1 level deep focusable || || || [Qt] Combobox doesn't close when scrolling in graphicsbased mode || || || [Qt] QtWebKit crashes if 's render changes in its onchange event + https://bugs.webkit.org/show_bug.cgi?id=41164 + + QtWebKit crashes if \n" \ + " \n" \ " \n" \ "

    \n" \ "
    \n" \ -- cgit v0.12 From 30fbf43186521c10b9cd36577da57688be7f600d Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 1 Jul 2010 14:43:18 +0300 Subject: QProgressDialog text is too close to dialog border This is due to that in Symbian, dialog border is not definitive. The actual border might be few pixels inside the dialog area to support partial transparency of dialog corners. Therefore laying out labels to near border (to y coordinate 0) makes the label cross the dialog border area for some themes. Fixed, by moving the dialog content down PM_DefaultTopLevelMargin pixels. Task-number: QT-3511 Reviewed-by: Alessandro Portale --- src/gui/dialogs/qprogressdialog.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp index a2d7b23..d64c847 100644 --- a/src/gui/dialogs/qprogressdialog.cpp +++ b/src/gui/dialogs/qprogressdialog.cpp @@ -153,6 +153,13 @@ void QProgressDialogPrivate::layout() const bool centered = bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, 0, q)); + int additionalSpacing = 0; +#ifdef Q_OS_SYMBIAN + //In Symbian, we need to have wider margins for dialog borders, as the actual border is some pixels + //inside the dialog area (to enable transparent borders) + additionalSpacing = mlr; +#endif + QSize cs = cancel ? cancel->sizeHint() : QSize(0,0); QSize bh = bar->sizeHint(); int cspc; @@ -185,8 +192,8 @@ void QProgressDialogPrivate::layout() } if (label) - label->setGeometry(mlr, 0, q->width()-mlr*2, lh); - bar->setGeometry(mlr, lh+sp, q->width()-mlr*2, bh.height()); + label->setGeometry(mlr, additionalSpacing, q->width() - mlr * 2, lh); + bar->setGeometry(mlr, lh + sp + additionalSpacing, q->width() - mlr * 2, bh.height()); } void QProgressDialogPrivate::retranslateStrings() -- cgit v0.12 From 6c47c8466a894020e9a6113a778a11b04dcd14af Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 1 Jul 2010 14:02:42 +0200 Subject: Update def files for symbian --- src/s60installs/bwins/QtGuiu.def | 33 +++++++++++++++++++++++++++++++++ src/s60installs/bwins/QtScriptu.def | 2 ++ src/s60installs/eabi/QtGuiu.def | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 6e20131..165a8e8 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12824,4 +12824,37 @@ EXPORTS ?createPixmapForImage@QRasterPixmapData@@IAEXAAVQImage@@V?$QFlags@W4ImageConversionFlag@Qt@@@@_N@Z @ 12823 NONAME ; void QRasterPixmapData::createPixmapForImage(class QImage &, class QFlags, bool) ??0Tab@QTextOption@@QAE@MW4TabType@1@VQChar@@@Z @ 12824 NONAME ; QTextOption::Tab::Tab(float, enum QTextOption::TabType, class QChar) ?fromData@QRasterPixmapData@@UAE_NPBEIPBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12825 NONAME ; bool QRasterPixmapData::fromData(unsigned char const *, unsigned int, char const *, class QFlags) + ?transformed@QRuntimePixmapData@@UBE?AVQPixmap@@ABVQTransform@@W4TransformationMode@Qt@@@Z @ 12826 NONAME ; class QPixmap QRuntimePixmapData::transformed(class QTransform const &, enum Qt::TransformationMode) const + ?scroll@QRuntimePixmapData@@UAE_NHHABVQRect@@@Z @ 12827 NONAME ; bool QRuntimePixmapData::scroll(int, int, class QRect const &) + ?buffer@QRuntimePixmapData@@UAEPAVQImage@@XZ @ 12828 NONAME ; class QImage * QRuntimePixmapData::buffer(void) + ?copy@QRuntimePixmapData@@UAEXPBVQPixmapData@@ABVQRect@@@Z @ 12829 NONAME ; void QRuntimePixmapData::copy(class QPixmapData const *, class QRect const &) + ?fromData@QRuntimePixmapData@@UAE_NPBEIPBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12830 NONAME ; bool QRuntimePixmapData::fromData(unsigned char const *, unsigned int, char const *, class QFlags) + ?readBackInfo@QRuntimePixmapData@@QAEXXZ @ 12831 NONAME ; void QRuntimePixmapData::readBackInfo(void) + ??_EQRuntimePixmapData@@UAE@I@Z @ 12832 NONAME ; QRuntimePixmapData::~QRuntimePixmapData(unsigned int) + ?paintEngine@QRuntimePixmapData@@UBEPAVQPaintEngine@@XZ @ 12833 NONAME ; class QPaintEngine * QRuntimePixmapData::paintEngine(void) const + ?memoryUsage@QRuntimePixmapData@@UBEIXZ @ 12834 NONAME ; unsigned int QRuntimePixmapData::memoryUsage(void) const + ?toImage@QRasterPixmapData@@UBE?AVQImage@@ABVQRect@@@Z @ 12835 NONAME ; class QImage QRasterPixmapData::toImage(class QRect const &) const + ?fromImageReader@QRasterPixmapData@@UAEXPAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12836 NONAME ; void QRasterPixmapData::fromImageReader(class QImageReader *, class QFlags) + ?fill@QRuntimePixmapData@@UAEXABVQColor@@@Z @ 12837 NONAME ; void QRuntimePixmapData::fill(class QColor const &) + ?alphaChannel@QRuntimePixmapData@@UBE?AVQPixmap@@XZ @ 12838 NONAME ; class QPixmap QRuntimePixmapData::alphaChannel(void) const + ?createCompatiblePixmapData@QRuntimePixmapData@@UBEPAVQPixmapData@@XZ @ 12839 NONAME ; class QPixmapData * QRuntimePixmapData::createCompatiblePixmapData(void) const + ?toImage@QRuntimePixmapData@@UBE?AVQImage@@XZ @ 12840 NONAME ; class QImage QRuntimePixmapData::toImage(void) const + ?resize@QRuntimePixmapData@@UAEXHH@Z @ 12841 NONAME ; void QRuntimePixmapData::resize(int, int) + ?fromNativeType@QRuntimePixmapData@@UAEXPAXW4NativeType@QPixmapData@@@Z @ 12842 NONAME ; void QRuntimePixmapData::fromNativeType(void *, enum QPixmapData::NativeType) + ?fromFile@QRuntimePixmapData@@UAE_NABVQString@@PBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12843 NONAME ; bool QRuntimePixmapData::fromFile(class QString const &, char const *, class QFlags) + ?setAlphaChannel@QRuntimePixmapData@@UAEXABVQPixmap@@@Z @ 12844 NONAME ; void QRuntimePixmapData::setAlphaChannel(class QPixmap const &) + ?fromImageReader@QPixmapData@@UAEXPAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12845 NONAME ; void QPixmapData::fromImageReader(class QImageReader *, class QFlags) + ?toImage@QPixmapData@@UBE?AVQImage@@ABVQRect@@@Z @ 12846 NONAME ; class QImage QPixmapData::toImage(class QRect const &) const + ?fromImageReader@QPixmap@@SA?AV1@PAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12847 NONAME ; class QPixmap QPixmap::fromImageReader(class QImageReader *, class QFlags) + ?fromImage@QRuntimePixmapData@@UAEXABVQImage@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12848 NONAME ; void QRuntimePixmapData::fromImage(class QImage const &, class QFlags) + ?setMask@QRuntimePixmapData@@UAEXABVQBitmap@@@Z @ 12849 NONAME ; void QRuntimePixmapData::setMask(class QBitmap const &) + ?mask@QRuntimePixmapData@@UBE?AVQBitmap@@XZ @ 12850 NONAME ; class QBitmap QRuntimePixmapData::mask(void) const + ?createPixmapData@QGraphicsSystem@@UAEPAVQPixmapData@@PAV2@@Z @ 12851 NONAME ; class QPixmapData * QGraphicsSystem::createPixmapData(class QPixmapData *) + ?metric@QRuntimePixmapData@@UBEHW4PaintDeviceMetric@QPaintDevice@@@Z @ 12852 NONAME ; int QRuntimePixmapData::metric(enum QPaintDevice::PaintDeviceMetric) const + ??1QRuntimePixmapData@@UAE@XZ @ 12853 NONAME ; QRuntimePixmapData::~QRuntimePixmapData(void) + ??0QRuntimePixmapData@@QAE@PBVQRuntimeGraphicsSystem@@W4PixelType@QPixmapData@@@Z @ 12854 NONAME ; QRuntimePixmapData::QRuntimePixmapData(class QRuntimeGraphicsSystem const *, enum QPixmapData::PixelType) + ?hasAlphaChannel@QRuntimePixmapData@@UBE_NXZ @ 12855 NONAME ; bool QRuntimePixmapData::hasAlphaChannel(void) const + ?runtimeData@QRuntimePixmapData@@UBEPAVQPixmapData@@XZ @ 12856 NONAME ; class QPixmapData * QRuntimePixmapData::runtimeData(void) const + ?toNativeType@QRuntimePixmapData@@UAEPAXW4NativeType@QPixmapData@@@Z @ 12857 NONAME ; void * QRuntimePixmapData::toNativeType(enum QPixmapData::NativeType) + ?copy@QRasterPixmapData@@UAEXPBVQPixmapData@@ABVQRect@@@Z @ 12858 NONAME ; void QRasterPixmapData::copy(class QPixmapData const *, class QRect const &) diff --git a/src/s60installs/bwins/QtScriptu.def b/src/s60installs/bwins/QtScriptu.def index 7769443..fbf0d3b 100644 --- a/src/s60installs/bwins/QtScriptu.def +++ b/src/s60installs/bwins/QtScriptu.def @@ -401,4 +401,6 @@ EXPORTS ?didReachBreakpoint@QScriptEngineAgentPrivate@@UAEXABVDebuggerCallFrame@QTJSC@@HH@Z @ 400 NONAME ; void QScriptEngineAgentPrivate::didReachBreakpoint(class QTJSC::DebuggerCallFrame const &, int, int) ?exception@QScriptEngineAgentPrivate@@UAEXABVDebuggerCallFrame@QTJSC@@HH_N@Z @ 401 NONAME ; void QScriptEngineAgentPrivate::exception(class QTJSC::DebuggerCallFrame const &, int, int, bool) ?reportAdditionalMemoryCost@QScriptEngine@@QAEXH@Z @ 402 NONAME ; void QScriptEngine::reportAdditionalMemoryCost(int) + ?newStaticScopeObject@QScriptDeclarativeClass@@SA?AVQScriptValue@@PAVQScriptEngine@@@Z @ 403 NONAME ; class QScriptValue QScriptDeclarativeClass::newStaticScopeObject(class QScriptEngine *) + ?newStaticScopeObject@QScriptDeclarativeClass@@SA?AVQScriptValue@@PAVQScriptEngine@@HPBVQString@@PBV2@PBV?$QFlags@W4PropertyFlag@QScriptValue@@@@@Z @ 404 NONAME ; class QScriptValue QScriptDeclarativeClass::newStaticScopeObject(class QScriptEngine *, int, class QString const *, class QScriptValue const *, class QFlags const *) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 45be23e..b672b65 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12025,4 +12025,37 @@ EXPORTS _ZNK11QPixmapData7toImageERK5QRect @ 12024 NONAME _ZNK17QRasterPixmapData7toImageERK5QRect @ 12025 NONAME _ZTV15QGraphicsSystem @ 12026 NONAME + _ZN11QPixmapData15fromImageReaderEP12QImageReader6QFlagsIN2Qt19ImageConversionFlagEE @ 12027 NONAME + _ZN17QRasterPixmapData15fromImageReaderEP12QImageReader6QFlagsIN2Qt19ImageConversionFlagEE @ 12028 NONAME + _ZN18QRuntimePixmapData12readBackInfoEv @ 12029 NONAME + _ZN18QRuntimePixmapData12toNativeTypeEN11QPixmapData10NativeTypeE @ 12030 NONAME + _ZN18QRuntimePixmapData14fromNativeTypeEPvN11QPixmapData10NativeTypeE @ 12031 NONAME + _ZN18QRuntimePixmapData15setAlphaChannelERK7QPixmap @ 12032 NONAME + _ZN18QRuntimePixmapData4copyEPK11QPixmapDataRK5QRect @ 12033 NONAME + _ZN18QRuntimePixmapData4fillERK6QColor @ 12034 NONAME + _ZN18QRuntimePixmapData6bufferEv @ 12035 NONAME + _ZN18QRuntimePixmapData6resizeEii @ 12036 NONAME + _ZN18QRuntimePixmapData6scrollEiiRK5QRect @ 12037 NONAME + _ZN18QRuntimePixmapData7setMaskERK7QBitmap @ 12038 NONAME + _ZN18QRuntimePixmapData8fromDataEPKhjPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 12039 NONAME + _ZN18QRuntimePixmapData8fromFileERK7QStringPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 12040 NONAME + _ZN18QRuntimePixmapData9fromImageERK6QImage6QFlagsIN2Qt19ImageConversionFlagEE @ 12041 NONAME + _ZN18QRuntimePixmapDataC1EPK22QRuntimeGraphicsSystemN11QPixmapData9PixelTypeE @ 12042 NONAME + _ZN18QRuntimePixmapDataC2EPK22QRuntimeGraphicsSystemN11QPixmapData9PixelTypeE @ 12043 NONAME + _ZN18QRuntimePixmapDataD0Ev @ 12044 NONAME + _ZN18QRuntimePixmapDataD1Ev @ 12045 NONAME + _ZN18QRuntimePixmapDataD2Ev @ 12046 NONAME + _ZN7QPixmap15fromImageReaderEP12QImageReader6QFlagsIN2Qt19ImageConversionFlagEE @ 12047 NONAME + _ZNK18QRuntimePixmapData11memoryUsageEv @ 12048 NONAME + _ZNK18QRuntimePixmapData11paintEngineEv @ 12049 NONAME + _ZNK18QRuntimePixmapData11runtimeDataEv @ 12050 NONAME + _ZNK18QRuntimePixmapData11transformedERK10QTransformN2Qt18TransformationModeE @ 12051 NONAME + _ZNK18QRuntimePixmapData12alphaChannelEv @ 12052 NONAME + _ZNK18QRuntimePixmapData15hasAlphaChannelEv @ 12053 NONAME + _ZNK18QRuntimePixmapData26createCompatiblePixmapDataEv @ 12054 NONAME + _ZNK18QRuntimePixmapData4maskEv @ 12055 NONAME + _ZNK18QRuntimePixmapData6metricEN12QPaintDevice17PaintDeviceMetricE @ 12056 NONAME + _ZNK18QRuntimePixmapData7toImageEv @ 12057 NONAME + _ZTI18QRuntimePixmapData @ 12058 NONAME + _ZTV18QRuntimePixmapData @ 12059 NONAME -- cgit v0.12 From 2471a5f348084ded48fd738683dde0137528c30d Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 30 Jun 2010 12:45:42 +0200 Subject: Improved a bit detection of a touch screen on Windows. Use the bitfield description from MSDN instead of just checking if there is any kind of digitizer. Reviewed-by: Prasanth --- src/gui/kernel/qapplication_win.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index ef719ca..9e8a128 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -4086,7 +4086,12 @@ void QApplicationPrivate::initializeMultitouch_sys() { if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) { static const int QT_SM_DIGITIZER = 94; - QApplicationPrivate::HasTouchSupport = GetSystemMetrics(QT_SM_DIGITIZER); + int value = GetSystemMetrics(QT_SM_DIGITIZER); + static const int QT_NID_INTEGRATED_TOUCH = 0x01; + static const int QT_NID_EXTERNAL_TOUCH = 0x02; + static const int QT_NID_MULTI_INPUT = 0x40; + QApplicationPrivate::HasTouchSupport = + value & (QT_NID_INTEGRATED_TOUCH | QT_NID_EXTERNAL_TOUCH | QT_NID_MULTI_INPUT); } QLibrary library(QLatin1String("user32")); -- cgit v0.12 From 9a1b0695277a3864b42d082095962f8742cdcf04 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 1 Jul 2010 12:00:05 +0200 Subject: Fixed QX11EmbedContainer. Enforce the creation of the native window id for the focusproxy widget inside the container to make sure we won't get a CreateNotify event to try to embed the focusproxy itself. Task-number: QTBUG-10809 Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qx11embed_x11.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index b527e72..9f1b1f8 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -1070,6 +1070,7 @@ QX11EmbedContainer::QX11EmbedContainer(QWidget *parent) d->focusProxy = new QWidget(this); d->focusProxy->setAttribute(Qt::WA_NativeWindow); d->focusProxy->setAttribute(Qt::WA_DontCreateNativeAncestors); + d->focusProxy->createWinId(); d->focusProxy->setGeometry(-1, -1, 1, 1); // We need events from the window (activation status) and -- cgit v0.12 From 4cd1d5ce5fed9519a8c093424ca1ed9beb38dd5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 1 Jul 2010 14:31:34 +0200 Subject: Fixed bug in drawTiledPixmap when width of pixmap matches target rect. qt_memconvert's duff's device implementation assumes that count is > 0, if count is 0 it will still blit eight pixels. Reviewed-by: Trond --- src/gui/painting/qdrawhelper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index d7f7dc3..ca9556b 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5014,7 +5014,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void * length -= copy_image_width; copy_image_width *= 2; } - qt_memconvert(dest, src, length); + if (length > 0) + qt_memconvert(dest, src, length); } else { while (length) { int l = qMin(image_width - sx, length); -- cgit v0.12 From fb00d5003ac5d91953a95d8164180f8f56a2b0f2 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Thu, 1 Jul 2010 10:14:09 +0200 Subject: Check for EGLSurface leak only when paint device is a QGLWidget. (not QGLWindowSurface for example). Merge-request: 722 Reviewed-by: Trond --- src/opengl/qgl_egl.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 58d3b0a..eafa181 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -232,17 +232,20 @@ void QGLContextPrivate::destroyEglSurfaceForDevice() if (eglSurface != EGL_NO_SURFACE) { #ifdef Q_WS_X11 // Make sure we don't call eglDestroySurface on a surface which - // was created for a different winId: + // was created for a different winId. This applies only to QGLWidget + // paint device, so make sure this is the one we're operating on + // (as opposed to a QGLWindowSurface use case). if (paintDevice && paintDevice->devType() == QInternal::Widget) { - QGLWidget* w = static_cast(paintDevice); - - if (w->d_func()->eglSurfaceWindowId == w->winId()) - eglDestroySurface(eglContext->display(), eglSurface); - else - qWarning("WARNING: Potential EGL surface leak!"); - } else + QWidget *w = static_cast(paintDevice); + if (QGLWidget *wgl = qobject_cast(w)) { + if (wgl->d_func()->eglSurfaceWindowId != wgl->winId()) { + qWarning("WARNING: Potential EGL surface leak! Not destroying surface."); + return; + } + } + } #endif - eglDestroySurface(eglContext->display(), eglSurface); + eglDestroySurface(eglContext->display(), eglSurface); eglSurface = EGL_NO_SURFACE; } } -- cgit v0.12 From 7727c6b2aa577f87e3d30adcf3fd96be5f62ded9 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Thu, 1 Jul 2010 15:19:51 +0200 Subject: Adding func prototypes for EGL_NOK_swap_region2 extension. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 712 Reviewed-by: Samuel Rødal --- src/gui/egl/qegl.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/gui/egl/qegl_p.h | 1 + src/gui/egl/qeglcontext_p.h | 1 + 3 files changed, 46 insertions(+) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index e6ea198..3e2049c 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -515,6 +515,31 @@ bool QEglContext::swapBuffers(EGLSurface surface) return ok; } +bool QEglContext::swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region) { + QVector qrects = region->rects(); + GLint *gl_rects; + uint count; + uint i; + + count = qrects.size(); + QVarLengthArray arr(4 * count); + gl_rects = arr.data(); + for (i = 0; i < count; i++) { + QRect qrect = qrects[i]; + + gl_rects[4 * i + 0] = qrect.x(); + gl_rects[4 * i + 1] = qrect.y(); + gl_rects[4 * i + 2] = qrect.width(); + gl_rects[4 * i + 3] = qrect.height(); + } + + bool ok = QEgl::eglSwapBuffersRegion2NOK(QEgl::display(), surface, count, gl_rects); + + if (!ok) + qWarning() << "QEglContext::swapBuffersRegion2NOK():" << QEgl::errorString(); + return ok; +} + int QEglContext::configAttrib(int name) const { EGLint value; @@ -532,6 +557,9 @@ typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR); static _eglCreateImageKHR qt_eglCreateImageKHR = 0; static _eglDestroyImageKHR qt_eglDestroyImageKHR = 0; +typedef EGLBoolean (EGLAPIENTRY *_eglSwapBuffersRegion2NOK)(EGLDisplay, EGLSurface, EGLint, const EGLint*); + +static _eglSwapBuffersRegion2NOK qt_eglSwapBuffersRegion2NOK = 0; EGLDisplay QEgl::display() { @@ -560,6 +588,10 @@ EGLDisplay QEgl::display() qt_eglDestroyImageKHR = (_eglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); } #endif + + if (QEgl::hasExtension("EGL_NOK_swap_region2")) { + qt_eglSwapBuffersRegion2NOK = (_eglSwapBuffersRegion2NOK) eglGetProcAddress("eglSwapBuffersRegion2NOK"); + } } return dpy; @@ -591,6 +623,18 @@ EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img) return 0; } +EGLBoolean QEgl::eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects) +{ + if (qt_eglSwapBuffersRegion2NOK) + return qt_eglSwapBuffersRegion2NOK(dpy, surface, count, rects); + + QEgl::display(); // Initialises function pointers + if (qt_eglSwapBuffersRegion2NOK) + return qt_eglSwapBuffersRegion2NOK(dpy, surface, count, rects); + + qWarning("QEgl::eglSwapBuffersRegion2NOK() called but EGL_NOK_swap_region2 extension not present"); + return 0; +} #ifndef Q_WS_X11 EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index 4fc1338..c214e88 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -224,6 +224,7 @@ namespace QEgl { // Extension functions Q_GUI_EXPORT EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); Q_GUI_EXPORT EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img); + Q_GUI_EXPORT EGLBoolean eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects); #ifdef Q_WS_X11 Q_GUI_EXPORT VisualID getCompatibleVisualId(EGLConfig config); diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h index ccde00d..cae8164 100644 --- a/src/gui/egl/qeglcontext_p.h +++ b/src/gui/egl/qeglcontext_p.h @@ -84,6 +84,7 @@ public: bool doneCurrent(); bool lazyDoneCurrent(); bool swapBuffers(EGLSurface surface); + bool swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region); int configAttrib(int name) const; -- cgit v0.12 From 7394aadc24bc5318fdd9498931a882f8b8533365 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Thu, 1 Jul 2010 15:19:51 +0200 Subject: QGLWindowSurface support for partial updates via EGL_NOK_swap_region2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (if extension available). Merge-request: 712 Reviewed-by: Samuel Rødal --- src/opengl/qgl.cpp | 10 ++++++++++ src/opengl/qgl_egl.cpp | 8 ++++++++ src/opengl/qgl_p.h | 1 + src/opengl/qwindowsurface_gl.cpp | 24 ++++++++++++++++++++++-- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e05db96..72ed0c6 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2092,6 +2092,16 @@ void QGLContextPrivate::syncGlState() } #undef ctx +#ifdef QT_NO_EGL +void QGLContextPrivate::swapRegion(const QRegion *region) +{ + static bool firstWarning = true; + if (firstWarning) { + qWarning() << "::swapRegion called but not supported!"; + firstWarning = false; + } +} +#endif /*! \overload diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index eafa181..3763926 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -274,6 +274,14 @@ EGLSurface QGLContextPrivate::eglSurfaceForDevice() const return eglSurface; } +void QGLContextPrivate::swapRegion(const QRegion *region) +{ + if (!valid || !eglContext) + return; + + eglContext->swapBuffersRegion2NOK(eglSurfaceForDevice(), region); +} + void QGLWidget::setMouseTracking(bool enable) { QWidget::setMouseTracking(enable); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 34a6b7c..32feacd 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -334,6 +334,7 @@ public: void setVertexAttribArrayEnabled(int arrayIndex, bool enabled = true); void syncGlState(); // Makes sure the GL context's state is what we think it is + void swapRegion(const QRegion *region); #if defined(Q_WS_WIN) void updateFormatVersion(); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 7efa9bc..e9da452 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -354,8 +354,22 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) ctx->create(qt_gl_share_widget()->context()); #ifndef QT_NO_EGL - if (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED) + static bool checkedForNOKSwapRegion = false; + static bool haveNOKSwapRegion = false; + + if (!checkedForNOKSwapRegion) { + haveNOKSwapRegion = QEgl::hasExtension("EGL_NOK_swap_region2"); + checkedForNOKSwapRegion = true; + + if (haveNOKSwapRegion) + qDebug() << "Found EGL_NOK_swap_region2 extension. Using partial updates."; + } + + if (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED && + ! haveNOKSwapRegion) setPartialUpdateSupport(false); // Force full-screen updates + else + setPartialUpdateSupport(true); #endif widgetPrivate->extraData()->glContext = ctx; @@ -480,8 +494,14 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & } } #endif + if (d_ptr->paintedRegion.boundingRect() != geometry()) { + // Emits warning if not supported. Should never happen unless + // setPartialUpdateSupport(true) has been called. + context()->d_func()->swapRegion(&d_ptr->paintedRegion); + } else + context()->swapBuffers(); + d_ptr->paintedRegion = QRegion(); - context()->swapBuffers(); } else { glFlush(); } -- cgit v0.12 From 844472273a17c74494d1d98a4f4110c21fb79a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 1 Jul 2010 15:19:52 +0200 Subject: Got rid of unused variable compiler warning. --- src/opengl/qgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 72ed0c6..fc28a73 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2093,7 +2093,7 @@ void QGLContextPrivate::syncGlState() #undef ctx #ifdef QT_NO_EGL -void QGLContextPrivate::swapRegion(const QRegion *region) +void QGLContextPrivate::swapRegion(const QRegion *) { static bool firstWarning = true; if (firstWarning) { -- cgit v0.12 From 08df5e30508d89c4a8785d3fff7391fe10b2220b Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 1 Jul 2010 15:32:20 +0200 Subject: Using the remaining valid data to construct the QTime object when msec parsing failed. It's relevant with QTBUG-11623, but not a fix for it. Reviewed-by: Aleksandar Sasha Babic --- src/corelib/tools/qdatetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index ae8aad6..5edb364 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -1843,7 +1843,7 @@ QTime QTime::fromString(const QString& s, Qt::DateFormat f) const QString msec_s(QLatin1String("0.") + s.mid(9, 4)); const float msec(msec_s.toFloat(&ok)); if (!ok) - return QTime(); + return QTime(hour, minute, second, 0); return QTime(hour, minute, second, qMin(qRound(msec * 1000.0), 999)); } } -- cgit v0.12 From 2113140dc2a6a2e5b4f5ce62a678192907adcca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 1 Jul 2010 16:14:52 +0200 Subject: Added missing EGL stub function. Reviewed-by: Shane Kearns --- src/gui/egl/qegl_stub.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/egl/qegl_stub.cpp b/src/gui/egl/qegl_stub.cpp index 86a7aab..e7bb748 100644 --- a/src/gui/egl/qegl_stub.cpp +++ b/src/gui/egl/qegl_stub.cpp @@ -208,6 +208,15 @@ EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img) return 0; } +EGLBoolean QEgl::eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects) +{ + Q_UNUSED(dpy); + Q_UNUSED(surface); + Q_UNUSED(count); + Q_UNUSED(rects); + NOEGL + return 0; +} #ifndef Q_WS_X11 EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) -- cgit v0.12 From 401bfd7dd1f2fd4fbcea49206b3f8c6febc545ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 1 Jul 2010 16:22:59 +0200 Subject: Fixed compilation on Symbian. Use EGLint, not GLint here, as GLint might not be defined. Reviewed-by: Shane Kearns --- src/gui/egl/qegl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 3e2049c..605b1e6 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -517,12 +517,12 @@ bool QEglContext::swapBuffers(EGLSurface surface) bool QEglContext::swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region) { QVector qrects = region->rects(); - GLint *gl_rects; + EGLint *gl_rects; uint count; uint i; count = qrects.size(); - QVarLengthArray arr(4 * count); + QVarLengthArray arr(4 * count); gl_rects = arr.data(); for (i = 0; i < count; i++) { QRect qrect = qrects[i]; -- cgit v0.12 From 357be9c19457adc7d48c16898985d0b7ddf0aeee Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 1 Jul 2010 15:26:04 +0100 Subject: Making orbit input methods work with Qt apps with -no-s60 This change allows Qt to load the Orbit input methods in Symbian builds when Qt is configured with -no-s60 Reviewed-by: Sami Merila --- src/gui/kernel/qapplication.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 365c2c8..ccfe88c 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -81,7 +81,7 @@ #include #endif -#if defined(Q_WS_X11) || defined(Q_WS_S60) +#if defined(Q_WS_X11) || defined(Q_OS_SYMBIAN) #include "qinputcontextfactory.h" #endif @@ -5338,7 +5338,7 @@ QInputContext *QApplication::inputContext() const qic = QInputContextFactory::create(QLatin1String("xim"), that); that->d_func()->inputContext = qic; } -#elif defined(Q_WS_S60) +#elif defined(Q_OS_SYMBIAN) if (!d->inputContext) { QApplication *that = const_cast(this); const QStringList keys = QInputContextFactory::keys(); -- cgit v0.12 From 7631458b5b1c265c77dc9310463734960a3ff364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 1 Jul 2010 16:30:09 +0200 Subject: Added another missing EGL stub. Reviewed-by: Shane Kearns --- src/gui/egl/qegl_stub.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/egl/qegl_stub.cpp b/src/gui/egl/qegl_stub.cpp index e7bb748..1adb56c 100644 --- a/src/gui/egl/qegl_stub.cpp +++ b/src/gui/egl/qegl_stub.cpp @@ -176,6 +176,14 @@ bool QEglContext::swapBuffers(EGLSurface surface) return false; } +bool QEglContext::swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region) +{ + Q_UNUSED(surface) + Q_UNUSED(region) + NOEGL + return false; +} + int QEglContext::configAttrib(int name) const { Q_UNUSED(name) -- cgit v0.12 From 80c2fbd7bb49483daf0a038a5e2ff85472a88ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 1 Jul 2010 16:36:28 +0200 Subject: Updated Symbian def files with new EGL exports. Reviewed-by: Shane Kearns --- src/s60installs/bwins/QtGuiu.def | 2 ++ src/s60installs/eabi/QtGuiu.def | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 165a8e8..8dc97f5 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12857,4 +12857,6 @@ EXPORTS ?runtimeData@QRuntimePixmapData@@UBEPAVQPixmapData@@XZ @ 12856 NONAME ; class QPixmapData * QRuntimePixmapData::runtimeData(void) const ?toNativeType@QRuntimePixmapData@@UAEPAXW4NativeType@QPixmapData@@@Z @ 12857 NONAME ; void * QRuntimePixmapData::toNativeType(enum QPixmapData::NativeType) ?copy@QRasterPixmapData@@UAEXPBVQPixmapData@@ABVQRect@@@Z @ 12858 NONAME ; void QRasterPixmapData::copy(class QPixmapData const *, class QRect const &) + ?eglSwapBuffersRegion2NOK@QEgl@@YAHHHHPBH@Z @ 12859 NONAME ; int QEgl::eglSwapBuffersRegion2NOK(int, int, int, int const *) + ?swapBuffersRegion2NOK@QEglContext@@QAE_NHPBVQRegion@@@Z @ 12860 NONAME ; bool QEglContext::swapBuffersRegion2NOK(int, class QRegion const *) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index b672b65..5b21b97 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12058,4 +12058,6 @@ EXPORTS _ZNK18QRuntimePixmapData7toImageEv @ 12057 NONAME _ZTI18QRuntimePixmapData @ 12058 NONAME _ZTV18QRuntimePixmapData @ 12059 NONAME + _ZN11QEglContext21swapBuffersRegion2NOKEiPK7QRegion @ 12060 NONAME + _ZN4QEgl24eglSwapBuffersRegion2NOKEiiiPKi @ 12061 NONAME -- cgit v0.12 From a69176304478ee070f8f5cfdf10b897ea4442759 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Thu, 1 Jul 2010 16:23:25 +0200 Subject: QSslSocket::systemCaCertificates(): have one common case for all Unices Reviewed-by: Simon Hausmann --- src/network/ssl/qsslsocket_openssl.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 30428ff..54a580d 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -615,13 +615,10 @@ QList QSslSocketPrivate::systemCaCertificates() ptrCertCloseStore(hSystemStore, 0); } } -#elif defined(Q_OS_AIX) - systemCerts.append(QSslCertificate::fromPath(QLatin1String("/var/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); -#elif defined(Q_OS_SOLARIS) - systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); -#elif defined(Q_OS_HPUX) - systemCerts.append(QSslCertificate::fromPath(QLatin1String("/opt/openssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); -#elif defined(Q_OS_LINUX) +#elif defined(Q_OS_UNIX) + systemCerts.append(QSslCertificate::fromPath(QLatin1String("/var/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // AIX + systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // Solaris + systemCerts.append(QSslCertificate::fromPath(QLatin1String("/opt/openssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // HP-UX systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // (K)ubuntu, OpenSUSE, Mandriva, ... systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/pki/tls/certs/ca-bundle.crt"), QSsl::Pem)); // Fedora systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/lib/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // Gentoo, Mandrake -- cgit v0.12 From 71547238ea4391636e37f5cf89905433faeb32d1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 1 Jul 2010 16:23:00 +0200 Subject: Symbian on Linux: $QTDIR/bin is not necessarily in the path. So it would not find elf2e32_qtwrapper use the qtPrepareTool macro that does the right thing. But this macro need QT_BUILD_TREE to be defined, which is not defined yet early in the test process. So change the tests accordingly Reviewed-by: ossi --- config.tests/mac/crc.test | 2 +- config.tests/symbian/compile.test | 2 +- config.tests/unix/compile.test | 2 +- config.tests/unix/doubleformat.test | 2 +- config.tests/unix/endian.test | 2 +- config.tests/unix/ptrsize.test | 2 +- config.tests/x11/notype.test | 2 +- mkspecs/features/symbian/symbian_building.prf | 6 ++++-- 8 files changed, 11 insertions(+), 9 deletions(-) diff --git a/config.tests/mac/crc.test b/config.tests/mac/crc.test index 644ff75..9cbe7ba 100755 --- a/config.tests/mac/crc.test +++ b/config.tests/mac/crc.test @@ -53,7 +53,7 @@ test -d "$OUTDIR/$TEST" || mkdir -p "$OUTDIR/$TEST" cd "$OUTDIR/$TEST" $MAKE distclean >/dev/null 2>&1 -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" if [ "$VERBOSE" = "yes" ]; then $MAKE diff --git a/config.tests/symbian/compile.test b/config.tests/symbian/compile.test index 20a3039..ab85819 100755 --- a/config.tests/symbian/compile.test +++ b/config.tests/symbian/compile.test @@ -26,7 +26,7 @@ cd "$OUTDIR/$TEST" test -r Makefile && $MAKE distclean >/dev/null 2>&1 -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" if [ "$VERBOSE" = "yes" ]; then $MAKE diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test index 99ebfd2..29ddea7 100755 --- a/config.tests/unix/compile.test +++ b/config.tests/unix/compile.test @@ -68,7 +68,7 @@ test -r Makefile && $MAKE distclean >/dev/null 2>&1 # Make sure output from possible previous tests is gone rm -f "$EXE" "${EXE}.exe" -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" if [ "$VERBOSE" = "yes" ]; then $MAKE diff --git a/config.tests/unix/doubleformat.test b/config.tests/unix/doubleformat.test index 953efd8..9968553 100755 --- a/config.tests/unix/doubleformat.test +++ b/config.tests/unix/doubleformat.test @@ -10,7 +10,7 @@ OUTDIR=$4 # build and run a test program test -d "$OUTDIR/config.tests/unix/doubleformat" || mkdir -p "$OUTDIR/config.tests/unix/doubleformat" -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/doubleformat/doubleformattest.pro" -o "$OUTDIR/config.tests/unix/doubleformat/Makefile" >/dev/null 2>&1 +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/config.tests/unix/doubleformat/doubleformattest.pro" -o "$OUTDIR/config.tests/unix/doubleformat/Makefile" >/dev/null 2>&1 cd "$OUTDIR/config.tests/unix/doubleformat" DOUBLEFORMAT="UNKNOWN" diff --git a/config.tests/unix/endian.test b/config.tests/unix/endian.test index 4755b1f..d0fb6ce 100755 --- a/config.tests/unix/endian.test +++ b/config.tests/unix/endian.test @@ -10,7 +10,7 @@ OUTDIR=$4 # build and run a test program test -d "$OUTDIR/config.tests/unix/endian" || mkdir -p "$OUTDIR/config.tests/unix/endian" -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/endian/endiantest.pro" -o "$OUTDIR/config.tests/unix/endian/Makefile" >/dev/null 2>&1 +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/config.tests/unix/endian/endiantest.pro" -o "$OUTDIR/config.tests/unix/endian/Makefile" >/dev/null 2>&1 cd "$OUTDIR/config.tests/unix/endian" diff --git a/config.tests/unix/ptrsize.test b/config.tests/unix/ptrsize.test index c1d80ee..c78c73f 100755 --- a/config.tests/unix/ptrsize.test +++ b/config.tests/unix/ptrsize.test @@ -10,7 +10,7 @@ OUTDIR=$4 # build and run a test program test -d "$OUTDIR/config.tests/unix/ptrsize" || mkdir -p "$OUTDIR/config.tests/unix/ptrsize" -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/ptrsize/ptrsizetest.pro" -o "$OUTDIR/config.tests/unix/ptrsize/Makefile" >/dev/null 2>&1 +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/config.tests/unix/ptrsize/ptrsizetest.pro" -o "$OUTDIR/config.tests/unix/ptrsize/Makefile" >/dev/null 2>&1 cd "$OUTDIR/config.tests/unix/ptrsize" if [ "$VERBOSE" = "yes" ]; then diff --git a/config.tests/x11/notype.test b/config.tests/x11/notype.test index 3a01d8f..1b534c8 100755 --- a/config.tests/x11/notype.test +++ b/config.tests/x11/notype.test @@ -27,7 +27,7 @@ if [ $XPLATFORM = "solaris-g++" -o $XPLATFORM = "hpux-g++" -o $XPLATFORM = "aix- NOTYPE=yes test -d "$OUTDIR/config.tests/x11/notype" || mkdir -p "$OUTDIR/config.tests/x11/notype" - "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/x11/notype/notypetest.pro" -o "$OUTDIR/config.tests/x11/notype/Makefile" >/dev/null 2>&1 + "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/config.tests/x11/notype/notypetest.pro" -o "$OUTDIR/config.tests/x11/notype/Makefile" >/dev/null 2>&1 cd "$OUTDIR/config.tests/x11/notype" if [ "$VERBOSE" = "yes" ]; then diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index fbaefca..c4088ca 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -8,6 +8,8 @@ QMAKE_LFLAGS += -Ttext 0x80000 -Tdata 0x400000 } +qtPrepareTool(QMAKE_ELF2E32_WRAPPER, elf2e32_qtwrapper) + isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x14000 isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x020000 0x800000 epoc_heap_size = $$split(TARGET.EPOCHEAPSIZE, " ") @@ -107,7 +109,7 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { contains(CONFIG, plugin):QMAKE_ELF2E32_FLAGS += --definput=plugin_commonu.def QMAKE_POST_LINK = $$QMAKE_MOVE $$symbianDestdir/$${baseTarget}.dll $$symbianDestdir/$${baseTarget}.sym \ - && elf2e32_qtwrapper --version=$$decVersion \ + && $$QMAKE_ELF2E32_WRAPPER --version=$$decVersion \ --sid=$$TARGET.SID \ --uid1=0x10000079 \ --uid2=$$TARGET.UID2 \ @@ -155,7 +157,7 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@.*") { QMAKE_POST_LINK = && $$QMAKE_POST_LINK } QMAKE_POST_LINK = $$QMAKE_MOVE $$symbianDestdir/$${baseTarget} $$symbianDestdir/$${baseTarget}.sym \ - && elf2e32_qtwrapper --version $$decVersion \ + && $$QMAKE_ELF2E32_WRAPPER --version $$decVersion \ --sid=$$TARGET.SID \ --uid1=0x1000007a \ --uid2=$$TARGET.UID2 \ -- cgit v0.12 From b61a5e36daf73c467638220ecd495ff95dcf6fe0 Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 1 Jul 2010 16:59:47 +0100 Subject: Fix for include "private/qt_s60_p.h" in non-symbian builds Reviewed-by: Shane Kearns --- src/gui/dialogs/qdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index a2adb05..ce84aa6 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -69,9 +69,9 @@ extern bool qt_wince_is_smartphone(); //is defined in qguifunctions_wce.cpp # include "qfontdialog.h" # include "qcolordialog.h" # include "qwizard.h" +# include "private/qt_s60_p.h" #endif -#include "private/qt_s60_p.h" #if defined(Q_WS_S60) #include // AknLayoutUtils #endif -- cgit v0.12 From b223a6ae4b1c3e7ddf91bc6158757ba8ea09980c Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 1 Jul 2010 21:23:11 +0200 Subject: Doc: Adding navigation and style fixes. Also rearranging qml elements --- doc/src/declarative/elements.qdoc | 264 +++++++++++----------------- doc/src/template/images/bullet_up.png | Bin 253 -> 210 bytes doc/src/template/style/style.css | 23 ++- tools/qdoc3/htmlgenerator.cpp | 49 +++--- tools/qdoc3/test/qt-html-templates.qdocconf | 2 +- 5 files changed, 147 insertions(+), 191 deletions(-) diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 2c36d12..48eb09f 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -32,169 +32,107 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt Declarative} module. -\table 80% -\header -\o \bold {States} -\o \bold {Animation and Transitions} -\o \bold {Working with Data} -\o \bold {Utility} -\row - -\o -\list -\o \l State -\o \l PropertyChanges -\o \l StateGroup -\o \l StateChangeScript -\o \l ParentChange (Item-specific) -\o \l AnchorChanges (Item-specific) -\endlist - -\o -\list -\o \l PropertyAnimation -\o \l NumberAnimation -\o \l ColorAnimation -\o \l RotationAnimation -\o \l SequentialAnimation -\o \l ParallelAnimation -\o \l PauseAnimation -\o \l ParentAnimation -\o \l AnchorAnimation -\o \l SmoothedAnimation -\o \l Vector3dAnimation -\o \l PropertyAction -\o \l ScriptAction -\o \l Transition -\o \l SmoothedFollow -\o \l SpringFollow -\o \l Behavior -\endlist - -\o -\list -\o \l Binding -\o \l ListModel -\list -\o \l ListElement -\endlist -\o \l VisualItemModel -\o \l VisualDataModel -\o \l Package -\o \l XmlListModel -\list -\o \l XmlRole -\endlist -\endlist - -\o -\list -\o \l Connections -\o \l Component -\o \l Timer -\o \l QtObject -\o \l WorkerScript -\endlist - -\header -\o \bold {Basic Visual Items} -\o \bold {Basic Interaction Items} -\o \bold {Utility} -\o \bold {Transforms} - -\row -\o -\list -\o \l Item -\o \l Rectangle - \list - \o \l Gradient - \list - \o \l GradientStop - \endlist - \endlist -\o \l Image -\o \l BorderImage -\o \l AnimatedImage -\o \l Text -\o \l TextInput - \list - \o \l IntValidator - \o \l DoubleValidator - \o \l RegExpValidator - \endlist -\o \l TextEdit -\endlist - -\o -\list -\o \l MouseArea -\o \l FocusScope -\o \l Flickable -\o \l Flipable -\o \l GestureArea (experimental) -\endlist - -\o -\list -\o \l Loader -\o \l Repeater -\o \l SystemPalette -\o \l FontLoader -\o \l LayoutItem -\endlist - -\o -\list -\o \l Scale -\o \l Rotation -\o \l Translate -\endlist - -\header -\o \bold {Views} -\o \bold {Positioners} -\o \bold {Effects} -\o - -\row -\o - -\target xmlViews -\list -\o \l ListView -\o \l GridView -\o \l PathView - \list - \o \l Path - \list - \o \l PathLine - \o \l PathQuad - \o \l PathCubic - \o \l PathAttribute - \o \l PathPercent - \endlist - \endlist -\o \l WebView -\endlist - -\o -\list -\o \l Column -\o \l Row -\o \l Grid -\o \l Flow -\endlist - -\o -\list -\o \l Particles (experimental) - \list - \o \l ParticleMotionLinear - \o \l ParticleMotionGravity - \o \l ParticleMotionWander - \endlist -\endlist +\table +\header \o {2,1} \bold {Basic Visual Items} +\row \o \l {Item} \o Basic item element inherited by all visual items in QML +\row \o \l {Rectangle} \o Basic visual rectangle element +\row \o \l {Gradient} \o Defines a gradient between two or more colors +\row \o \l {GradientStop} \o Defines a color used in a \l {Gradient} +\row \o \l {Image} \o Allows the use of bitmaps to a scene +\row \o \l {BorderImage} (Item-specific) \o Defines an image as a border +\row \o \l {AnimatedImage} \o For playing animations stored as a series of frames +\row \o \l {Text} \o Allows the use of formatted text in a scene +\row \o \l {TextInput} \o Displays an editable line of text +\row \o \l {IntValidator} \o Validator for integer values +\row \o \l {DoubleValidator} \o Validator for non-integer values +\row \o \l {RegExpValidator} \o Validator for string regular expressions +\row \o \l {TextEdit} \o Displays multiple lines of editable formatted text + +\header \o {2,1} \bold {Basic Interaction Items} +\row \o \l {MouseArea} \o Handles mouse interactions +\row \o \l {FocusScope} \o For keyboard focus handling +\row \o \l {Flickable} \o Provides a surface that can be "flicked" +\row \o \l {Flipable} \o Provides a surface that produces flipping effects +\row \o \l {GestureArea} (experimental) \o Enables simple gesture handling + +\header \o {2,1} \bold {States} +\row \o \l {State} \o Defines sets of configurations of objects and properties +\row \o \l {PropertyChanges} \o Describes property changes within a state +\row \o \l {StateGroup} \o Contains a set of states and state transitions +\row \o \l {StateChangeScript} \o Allows script binding in a state +\row \o \l {ParentChange} (Item-specific) \o Re-parent an Item in a state change +\row \o \l {AnchorChanges} \o Change the anchors of an item in a state + +\header \o {2,1} \bold {Animation and Transitions} +\row \o \l {Behavior} \o Specifies a default animation for property changes +\row \o \l {SequentialAnimation} \o Runs animations sequentially +\row \o \l {ParallelAnimation} \o Runs animations in parallel +\row \o \l {PropertyAnimation} \o Animates property changes +\row \o \l {NumberAnimation} \o Animates properties of type qreal +\row \o \l {Vector3dAnimation} \o Animates properties of type QVector3d +\row \o \l {ColorAnimation} \o Animates color changes +\row \o \l {RotationAnimation} \o Animates rotations +\row \o \l {ParentAnimation} \o Animates parent changes +\row \o \l {AnchorAnimation} \o Animates anchor changes +\row \o \l {PauseAnimation} \o Pauses an animation +\row \o \l {SmoothedAnimation} \o Allows a property to smoothly track a value +\row \o \l {PropertyAction} \o Sets immediate property changes during animation +\row \o \l {ScriptAction} \o Runs scripts during an animation +\row \o \l {Transition} \o Animates transitions during state changes +\row \o \l {SpringFollow} \o Allows a property to follow value changes +\row \o \l {SmoothedFollow} \o Allows animation to smoothly follow value changes + +\header \o {2,1} \bold {Working with Data} +\row \o \l {Binding} \o Binds any value to any property +\row \o \l {ListModel} \o Defines a list of data +\row \o \l {ListElement} \o Defines a data item in a \l {ListModel} +\row \o \l {VisualItemModel} \o Contains items that already defines its own visual delegate +\row \o \l {VisualDataModel} \o Encapsulates a model and a delegate +\row \o \l {Package} \o Collection that enables sharing of items within different views +\row \o \l {XmlListModel} \o Specifies a model using XPath expressions +\row \o \l {XmlRole} \o Specifies a role for an \l {XmlListModel} + +\header \o {2,1} \bold {Views} +\row \o \l {ListView} \o Provides a list visualization of a model +\row \o \l {GridView} \o Provides a grid visualization of a model +\row \o \l {PathView} \o Visualizes a model's contents along a path +\row \o \l {Path} \o Defines a path used by \l {PathView} +\row \o \l {PathLine} \o Defines a line in \l {Path} +\row \o \l {PathQuad} \o Defines a quadratic Bezier curve in a \l {Path} +\row \o \l {PathCubic} \o Defines a cubic Bezier curve in a \l {Path} +\row \o \l {PathAttribute} \o Allows the setting of attributes along a \l {Path} +\row \o \l {PathPercent} \o Modifies the item distribution along a \l {Path} +\row \o \l {WebView} \o Allows the addition of web content to a canvas + +\header \o {2,1} \bold {Positioners} +\row \o \l {Column} \o Arranges its children vertically +\row \o \l {Row} \o Arranges its children horizontally +\row \o \l {Grid} \o Positions its children in a grid +\row \o \l {Flow} \o Positions its children with wrapping support + +\header \o {2,1} \bold {Utility} +\row \o \l {Connections} \o Explicitly connects signals and signal handlers +\row \o \l {Component} \o Encapsulate QML items as a component +\row \o \l {Timer} \o Provides timed triggers +\row \o \l {QtObject} \o Basic element containing only the objectName property +\row \o \l {WorkerScript} \o Enables the use of threads in QML +\row \o \l {Loader} \o Controls the loading of items or components +\row \o \l {Repeater} \o Uses a model to create multiples of components +\row \o \l {SystemPalette} \o Provides access to the Qt palettes +\row \o \l {FontLoader} \o Loads fonts by name or URL +\row \o \l {LayoutItem} \o Allows declarative UI elements inside Qt's Graphics View layouts + +\header \o {2,1} \bold {Transforms} +\row \o \l {Scale} \o Assigns item scaling behaviors +\row \o \l {Rotation} \o Assigns item rotation behaviors +\row \o \l {Translate} \o Assigns item translation behaviors + +\header \o {2,1} \bold {Effects} +\row \o \l {Particles} (experimental) \o Generates and animates particles +\row \o \l {ParticleMotionLinear} \o Adds linear motion behavior to \l {Particles} +\row \o \l {ParticleMotionGravity} \o Adds gravitational motion to \l {Particles} +\row \o \l {ParticleMotionWander} \o Adds varied motions to \l {Particles} \endtable + */ diff --git a/doc/src/template/images/bullet_up.png b/doc/src/template/images/bullet_up.png index 285e741..7de2f06 100644 Binary files a/doc/src/template/images/bullet_up.png and b/doc/src/template/images/bullet_up.png differ diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 78a21f6..f1a63a9 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -490,11 +490,20 @@ } .wrap .content h2 { - font: 600 16px/1.2 Arial; + + border-bottom:1px solid #DDDDDD; + font:600 16px/1.2 Arial; + margin-top:15px; + width:100%; + } .wrap .content h3 { font: 600 14px/1.2 Arial; + /*border-bottom:1px solid #DDDDDD;*/ + font:600 16px/1.2 Arial; + margin-top:15px; + width:100%; } .wrap .content p { @@ -755,7 +764,7 @@ font-size: 11px; /*min-width: 395px;*/ margin-bottom: 25px; - display: inline-block; + /* display: inline-block;*/ } thead { @@ -1219,7 +1228,15 @@ pre.highlightedCode { list-style-type:decimal; } - + .navTop{ + float:right; + padding-right:5px; + padding-top:15px; + } + + .wrap .content .toc h3{ + border-bottom:none; + } /* end of screen media */ /* start of print media */ diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 044c458..9f745c5 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -443,7 +443,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, { int skipAhead = 0; static bool in_para = false; - + switch (atom->type()) { case Atom::AbstractLeft: break; @@ -1066,11 +1066,11 @@ int HtmlGenerator::generateAtom(const Atom *atom, } sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); } - out() << "\n"; + out() << "
    \n"; } #else out() << "\n"; + << "\">
    \n"; #endif break; case Atom::SectionRight: @@ -1339,19 +1339,19 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, } else { if (!s->members.isEmpty()) { - out() << "
    \n"; + // out() << "
    \n"; out() << "\n"; + << "\">
    \n"; out() << "

    " << protectEnc((*s).name) << "

    \n"; generateSection(s->members, inner, marker, CodeMarker::Summary); } if (!s->reimpMembers.isEmpty()) { QString name = QString("Reimplemented ") + (*s).name; - out() << "
    \n"; + // out() << "
    \n"; out() << "\n"; + << "\">
    \n"; out() << "

    " << protectEnc(name) << "

    \n"; generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); } @@ -1378,11 +1378,11 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, out() << "\n"; } - out() << "\n"; + out() << "
    \n"; if (!inner->doc().isEmpty()) { - out() << "
    \n" - << "
    \n" // QTBUG-9504 + //out() << "
    \n" + out() << "
    \n" // QTBUG-9504 << "

    " << "Detailed Description" << "

    \n"; generateBody(inner, marker); out() << "
    \n"; // QTBUG-9504 @@ -1392,7 +1392,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { - out() << "
    \n"; + //out() << "
    \n"; if (!(*s).divClass.isEmpty()) out() << "
    \n"; // QTBUG-9504 out() << "

    " << protectEnc((*s).name) << "

    \n"; @@ -1518,12 +1518,12 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateStatus(fake, marker); if (moduleNamespaceMap.contains(fake->name())) { - out() << "\n"; + out() << "
    \n"; out() << "

    Namespaces

    \n"; generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); } if (moduleClassMap.contains(fake->name())) { - out() << "\n"; + out() << "
    \n"; out() << "

    Classes

    \n"; generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); } @@ -1586,19 +1586,19 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) sections = marker->qmlSections(qml_cn,CodeMarker::Summary); s = sections.begin(); while (s != sections.end()) { - out() << "\n"; + out() << "
    \n"; out() << "

    " << protectEnc((*s).name) << "

    \n"; generateQmlSummary(*s,fake,marker); ++s; } - out() << "\n"; + out() << "
    \n"; out() << "

    " << "Detailed Description" << "

    \n"; generateBody(fake, marker); if (cn) generateQmlText(cn->doc().body(), cn, marker, fake->name()); generateAlsoList(fake, marker); - out() << "
    \n"; + //out() << "
    \n"; sections = marker->qmlSections(qml_cn,CodeMarker::Detailed); s = sections.begin(); @@ -1622,7 +1622,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { - out() << "\n"; + out() << "
    \n"; out() << "

    " << protectEnc((*s).name) << "

    \n"; generateSectionList(*s, fake, marker, CodeMarker::Summary); ++s; @@ -1630,7 +1630,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) Text brief = fake->doc().briefText(); if (fake->subType() == Node::Module && !brief.isEmpty()) { - out() << "\n"; + out() << "
    \n"; out() << "
    \n"; // QTBUG-9504 out() << "

    " << "Detailed Description" << "

    \n"; } @@ -1655,7 +1655,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { - out() << "
    \n"; + //out() << "
    \n"; out() << "

    " << protectEnc((*s).name) << "

    \n"; NodeList::ConstIterator m = (*s).members.begin(); @@ -1801,9 +1801,10 @@ void HtmlGenerator::generateHeader(const QString& title, if (offlineDocs) { - out() << " "; + out() << " "; out() << "\n"; out() << "\n"; // narrow mainly for Creator + out() << " \n"; } else { @@ -2039,7 +2040,7 @@ void HtmlGenerator::generateTableOfContents(const Node *node, inLink = true; out() << "
    \n"; - out() << "

    Contents

    \n"; + out() << "

    Contents

    \n"; sectionNumber.append("1"); out() << "
      \n"; @@ -2252,7 +2253,7 @@ QString HtmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, sections = marker->sections(inner, CodeMarker::Detailed, status); for (i = 0; i < sections.size(); ++i) { - out() << "
      \n"; + //out() << "
      \n"; out() << "

      " << protectEnc(sections.at(i).name) << "

      \n"; NodeList::ConstIterator m = sections.at(i).members.begin(); @@ -2621,7 +2622,7 @@ void HtmlGenerator::generateLegaleseList(const Node *relative, QMap::ConstIterator it = legaleseTexts.begin(); while (it != legaleseTexts.end()) { Text text = it.key(); - out() << "
      \n"; + //out() << "
      \n"; generateText(text, relative, marker); out() << "
        \n"; do { @@ -3828,7 +3829,7 @@ void HtmlGenerator::generateDetailedMember(const Node *node, out() << "

        "; out() << ""; generateSynopsis(node, relative, marker, CodeMarker::Detailed); - out() << "

        \n"; + out() << "
        \n"; } generateStatus(node, marker); diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 7ad78bd..e888bc4 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -49,6 +49,7 @@ HTML.postheader = "
      \n" \ " \n" \ "
    • Examples \n" \ @@ -57,7 +58,6 @@ HTML.postheader = "
      \n" \ "
    • Tutorials
    • \n" \ "
    • Demos
    • \n" \ "
    • QML Examples
    • \n" \ - "
    • QML Demos
    • \n" \ "
    \n" \ " \n" \ " \n" \ -- cgit v0.12 From 51f5fdb75017edd4a66999be07d8e26240a5a091 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 1 Jul 2010 22:07:38 +0200 Subject: Updated WebKit to cd3aee284bddf4ff9d26f3bcaa7c33d478e81e10 Integrated changes: || || [Qt] Crash when destroying a QWebView with a QComboBox as its child. || || || Spatial Navigation: refactor spatial-navigation-utils.js to support testing nested frames deeper than one level || --- src/3rdparty/webkit/.tag | 2 +- src/3rdparty/webkit/ChangeLog | 8 ++++ src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebKit.pri | 2 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 38 +++++++++++++++++++ .../qt/WebCoreSupport/QtFallbackWebPopup.cpp | 43 ++++++++++++---------- .../WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h | 3 +- 7 files changed, 74 insertions(+), 24 deletions(-) diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 8be0498..c44a95b 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -0eee8df53d1873669a9dda8f9c0340543258a316 +cd3aee284bddf4ff9d26f3bcaa7c33d478e81e10 diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 1f067bf..14d6da3 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,11 @@ +2010-07-01 Simon Hausmann + + Rubber-stamped by Laszlo Gombos. + + [Qt][Symbian] Bumped up the maximum heap size to 96MB + + * WebKit.pri: + 2010-06-17 Alexis Menard Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 56e2c01..aa574b4 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 0eee8df53d1873669a9dda8f9c0340543258a316 + cd3aee284bddf4ff9d26f3bcaa7c33d478e81e10 diff --git a/src/3rdparty/webkit/WebKit.pri b/src/3rdparty/webkit/WebKit.pri index fcd2891..a080c43 100644 --- a/src/3rdparty/webkit/WebKit.pri +++ b/src/3rdparty/webkit/WebKit.pri @@ -30,7 +30,7 @@ building-libs { LIBS += -lQtWebKit symbian { TARGET.EPOCSTACKSIZE = 0x14000 // 80 kB - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 // Min 128kB, Max 32MB + TARGET.EPOCHEAPSIZE = 0x20000 0x6000000 // Min 128kB, Max 32MB } } } diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index acf1695..1eb7b11 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,41 @@ +2010-07-01 Bea Lam + + Reviewed by Simon Hausmann. + + [Qt] Doc improvements for QDeclarativeWebView + + * declarative/qdeclarativewebview.cpp: + +2010-07-01 Jocelyn Turcotte + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Create QComboBoxes when clicked and destroy on hide. + https://bugs.webkit.org/show_bug.cgi?id=41451 + + Currently a QComboBox is created for each RenderMenuList and + it gets destroyed either when the RenderMenuList or the + QWebView (its Qt parent) is destroyed. This cause a crash + when the QWebView is destroyed before the render tree (which + is kept in cache). + + This patch aim to destroy the QComboBox as soon as its popup + gets hidden, and likewise, create it only when the popup is + requested to be shown. + It also removes the unneeded reference to the QGraphicsProxyWidget, + destroying the QComboBox automatically destroys its bound + proxywidget. + + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopupCombo::hidePopup): + (WebCore::QtFallbackWebPopup::QtFallbackWebPopup): + (WebCore::QtFallbackWebPopup::~QtFallbackWebPopup): + (WebCore::QtFallbackWebPopup::show): + (WebCore::QtFallbackWebPopup::hide): + (WebCore::QtFallbackWebPopup::destroyPopup): + (WebCore::QtFallbackWebPopup::populate): + * WebCoreSupport/QtFallbackWebPopup.h: + 2010-06-30 Jocelyn Turcotte Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp index 1a87463..59ac87b 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp @@ -75,14 +75,12 @@ void QtFallbackWebPopupCombo::hidePopup() QComboBox::hidePopup(); - if (QGraphicsProxyWidget* proxy = graphicsProxyWidget()) - proxy->setVisible(false); - if (!m_ownerPopup.m_popupVisible) return; m_ownerPopup.m_popupVisible = false; m_ownerPopup.popupDidHide(); + m_ownerPopup.destroyPopup(); } bool QtFallbackWebPopupCombo::eventFilter(QObject* watched, QEvent* event) @@ -102,19 +100,13 @@ bool QtFallbackWebPopupCombo::eventFilter(QObject* watched, QEvent* event) QtFallbackWebPopup::QtFallbackWebPopup() : QtAbstractWebPopup() , m_popupVisible(false) - , m_combo(new QtFallbackWebPopupCombo(*this)) - , m_proxy(0) + , m_combo(0) { - connect(m_combo, SIGNAL(activated(int)), - SLOT(activeChanged(int)), Qt::QueuedConnection); } QtFallbackWebPopup::~QtFallbackWebPopup() { - // If we create a proxy, then the deletion of the proxy and the - // combo will be done by the proxy's parent (QGraphicsWebView) - if (!m_proxy && m_combo) - m_combo->deleteLater(); + destroyPopup(); } void QtFallbackWebPopup::show() @@ -125,17 +117,20 @@ void QtFallbackWebPopup::show() #if ENABLE(SYMBIAN_DIALOG_PROVIDERS) TRAP_IGNORE(showS60BrowserDialog()); #else + + destroyPopup(); + m_combo = new QtFallbackWebPopupCombo(*this); + connect(m_combo, SIGNAL(activated(int)), + SLOT(activeChanged(int)), Qt::QueuedConnection); + populate(); m_combo->setCurrentIndex(currentIndex()); QRect rect = geometry(); if (QGraphicsWebView *webView = qobject_cast(pageClient()->pluginParent())) { - if (!m_proxy) { - m_proxy = new QGraphicsProxyWidget(webView); - m_proxy->setWidget(m_combo); - } else - m_proxy->setVisible(true); - m_proxy->setGeometry(rect); + QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget(webView); + proxy->setWidget(m_combo); + proxy->setGeometry(rect); } else { m_combo->setParent(pageClient()->ownerWidget()); m_combo->setGeometry(QRect(rect.left(), rect.top(), @@ -204,13 +199,21 @@ void QtFallbackWebPopup::showS60BrowserDialog() void QtFallbackWebPopup::hide() { - m_combo->hidePopup(); + // Destroying the QComboBox here cause problems if the popup is in the + // middle of its show animation. Instead we rely on the fact that the + // Qt::Popup window will hide itself on mouse events outside its window. } -void QtFallbackWebPopup::populate() +void QtFallbackWebPopup::destroyPopup() { - m_combo->clear(); + if (m_combo) { + m_combo->deleteLater(); + m_combo = 0; + } +} +void QtFallbackWebPopup::populate() +{ QStandardItemModel* model = qobject_cast(m_combo->model()); Q_ASSERT(model); diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h index 860e9fa..e6c371f 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h @@ -42,6 +42,8 @@ public: virtual void show(); virtual void hide(); + void destroyPopup(); + private slots: void activeChanged(int); @@ -49,7 +51,6 @@ private: friend class QtFallbackWebPopupCombo; bool m_popupVisible; QtFallbackWebPopupCombo* m_combo; - QGraphicsProxyWidget* m_proxy; void populate(); #if ENABLE(SYMBIAN_DIALOG_PROVIDERS) -- cgit v0.12 From 00dedffa8ad1fdec14e9e0a9184f49343c42c846 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 2 Jul 2010 11:57:58 +1000 Subject: Don't accept *files* that exist when *directory* is required. --- src/declarative/qml/qdeclarativeimport.cpp | 6 ++++-- .../declarative/qdeclarativelanguage/data/importFile.errors.txt | 1 + tests/auto/declarative/qdeclarativelanguage/data/importFile.qml | 3 +++ .../declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/importFile.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/importFile.qml diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index a2e3831..fe05d20 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -409,7 +409,8 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp QString localFileOrQrc = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(importUrl); if (!localFileOrQrc.isEmpty()) { QString dir = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(base.resolved(QUrl(uri))); - if (dir.isEmpty() || !QDir().exists(dir)) { + QFileInfo dirinfo(dir); + if (dir.isEmpty() || !dirinfo.exists() || !dirinfo.isDir()) { if (errorString) *errorString = QDeclarativeImportDatabase::tr("\"%1\": no such directory").arg(uri_arg); return false; // local import dirs must exist @@ -425,7 +426,8 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp if (prefix.isEmpty()) { // directory must at least exist for valid import QString localFileOrQrc = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(base.resolved(QUrl(uri))); - if (localFileOrQrc.isEmpty() || !QDir().exists(localFileOrQrc)) { + QFileInfo dirinfo(localFileOrQrc); + if (localFileOrQrc.isEmpty() || !dirinfo.exists() || !dirinfo.isDir()) { if (errorString) { if (localFileOrQrc.isEmpty()) *errorString = QDeclarativeImportDatabase::tr("import \"%1\" has no qmldir and no namespace").arg(uri); diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importFile.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importFile.errors.txt new file mode 100644 index 0000000..3fdac09 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importFile.errors.txt @@ -0,0 +1 @@ +1:1:"MyComponent.qml": no such directory diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importFile.qml b/tests/auto/declarative/qdeclarativelanguage/data/importFile.qml new file mode 100644 index 0000000..a0d8410 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importFile.qml @@ -0,0 +1,3 @@ +import "MyComponent.qml" 1.0 + +MyComponent { text: "Hello" } diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 3ce356e..cde25d7 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -289,6 +289,7 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("importNonExistOlder (installed)") << "importNonExistOlder.qml" << "importNonExistOlder.errors.txt" << false; QTest::newRow("importNewerVersion (installed)") << "importNewerVersion.qml" << "importNewerVersion.errors.txt" << false; QTest::newRow("invalidImportID") << "invalidImportID.qml" << "invalidImportID.errors.txt" << false; + QTest::newRow("importFile") << "importFile.qml" << "importFile.errors.txt" << false; QTest::newRow("signal.1") << "signal.1.qml" << "signal.1.errors.txt" << false; QTest::newRow("signal.2") << "signal.2.qml" << "signal.2.errors.txt" << false; -- cgit v0.12 From 7db513d4bbc55cc398e1434b5121e2f1408f9baa Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 2 Jul 2010 13:15:54 +1000 Subject: Abort if connection to DBus cannot be established. Fixes network access issue when running Qt applications in scratchbox environment. Task-number: QT-3528 --- src/plugins/bearer/icd/qicdengine.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index 9d1bfab..0638a36 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -251,6 +251,11 @@ void QIcdEngine::initialize() ICD_DBUS_API_INTERFACE, QDBusConnection::systemBus(), this); + + // abort if cannot connect to DBus. + if (!m_dbusInterface->isValid()) + return; + connect(&m_scanTimer, SIGNAL(timeout()), this, SLOT(finishAsyncConfigurationUpdate())); m_scanTimer.setSingleShot(true); -- cgit v0.12 From 29e6a5c1b1a17b8080c2dcae92dcea11b591907d Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 2 Jul 2010 13:18:42 +1000 Subject: Fix compiler warning. --- src/plugins/bearer/icd/qicdengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index 0638a36..3033140 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE IcdNetworkConfigurationPrivate::IcdNetworkConfigurationPrivate() -: network_attrs(0), service_attrs(0) +: service_attrs(0), network_attrs(0) { } -- cgit v0.12 From 953142469cd49fd2f5180a60dcaa7d2029457401 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 2 Jul 2010 13:39:23 +1000 Subject: qmlviewer: Update the proxy factory when the user changes the proxy. Task-number: QTBUG-11856 --- tools/qml/qmlruntime.cpp | 104 ++++++++++++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 42 deletions(-) diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 94fcc82..3d7d298 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -431,65 +431,82 @@ private: mutable QMutex mutex; }; -class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory +class SystemProxyFactory : public QNetworkProxyFactory { public: - NetworkAccessManagerFactory() : cacheSize(0) {} - ~NetworkAccessManagerFactory() {} - - QNetworkAccessManager *create(QObject *parent); + SystemProxyFactory() : proxyDirty(true), httpProxyInUse(false) { + } - void setupProxy(QNetworkAccessManager *nam) + virtual QList queryProxy(const QNetworkProxyQuery &query) { - class SystemProxyFactory : public QNetworkProxyFactory - { - public: - virtual QList queryProxy(const QNetworkProxyQuery &query) - { - QString protocolTag = query.protocolTag(); - if (httpProxyInUse && (protocolTag == "http" || protocolTag == "https")) { - QList ret; - ret << httpProxy; - return ret; - } + if (proxyDirty) + setupProxy(); + QString protocolTag = query.protocolTag(); + if (httpProxyInUse && (protocolTag == "http" || protocolTag == "https")) { + QList ret; + ret << httpProxy; + return ret; + } #ifdef Q_OS_WIN - // systemProxyForQuery can take insanely long on Windows (QTBUG-10106) - return QNetworkProxyFactory::proxyForQuery(query); + // systemProxyForQuery can take insanely long on Windows (QTBUG-10106) + return QNetworkProxyFactory::proxyForQuery(query); #else - return QNetworkProxyFactory::systemProxyForQuery(query); + return QNetworkProxyFactory::systemProxyForQuery(query); #endif - } - void setHttpProxy (QNetworkProxy proxy) - { - httpProxy = proxy; - httpProxyInUse = true; - } - void unsetHttpProxy () - { - httpProxyInUse = false; - } - private: - bool httpProxyInUse; - QNetworkProxy httpProxy; - }; - - SystemProxyFactory *proxyFactory = new SystemProxyFactory; - if (ProxySettings::httpProxyInUse()) - proxyFactory->setHttpProxy(ProxySettings::httpProxy()); - else - proxyFactory->unsetHttpProxy(); - nam->setProxyFactory(proxyFactory); } + void setupProxy() { + // Don't bother locking because we know that the proxy only + // changes in response to the settings dialog and that + // the view will be reloaded. + proxyDirty = false; + httpProxyInUse = ProxySettings::httpProxyInUse(); + if (httpProxyInUse) + httpProxy = ProxySettings::httpProxy(); + } + + void proxyChanged() { + proxyDirty = true; + } + +private: + volatile bool proxyDirty; + bool httpProxyInUse; + QNetworkProxy httpProxy; +}; + +class NetworkAccessManagerFactory : public QObject, public QDeclarativeNetworkAccessManagerFactory +{ + Q_OBJECT +public: + NetworkAccessManagerFactory() : cacheSize(0) {} + ~NetworkAccessManagerFactory() {} + + QNetworkAccessManager *create(QObject *parent); + void setCacheSize(int size) { if (size != cacheSize) { cacheSize = size; } } + void proxyChanged() { + foreach (QNetworkAccessManager *nam, namList) { + static_cast(nam->proxyFactory())->proxyChanged(); + } + } + static PersistentCookieJar *cookieJar; + +private slots: + void managerDestroyed(QObject *obj) { + namList.removeOne(static_cast(obj)); + } + +private: QMutex mutex; int cacheSize; + QList namList; }; PersistentCookieJar *NetworkAccessManagerFactory::cookieJar = 0; @@ -510,7 +527,7 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) } manager->setCookieJar(cookieJar); cookieJar->setParent(0); - setupProxy(manager); + manager->setProxyFactory(new SystemProxyFactory); if (cacheSize > 0) { QNetworkDiskCache *cache = new QNetworkDiskCache; cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-viewer-network-cache")); @@ -519,6 +536,8 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) } else { manager->setCache(0); } + connect(manager, SIGNAL(destroyed(QObject*)), this, SLOT(managerDestroyed(QObject*))); + namList.append(manager); qDebug() << "created new network access manager for" << parent; return manager; } @@ -777,6 +796,7 @@ void QDeclarativeViewer::showProxySettings() void QDeclarativeViewer::proxySettingsChanged() { + namFactory->proxyChanged(); reload (); } -- cgit v0.12 From a02de048753aeb9e4c6811bf7689801c59d3c236 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 2 Jul 2010 11:21:55 +1000 Subject: Fix docs to link to the new QML Viewer page instead of the Runtime page where applicable, and remove or rename references to 'qml' tool. Also improve QML Viewer docs. --- doc/src/declarative/examples.qdoc | 13 ++++++++++--- doc/src/declarative/extending-tutorial.qdoc | 14 ++++++++------ doc/src/declarative/focus.qdoc | 2 +- doc/src/declarative/modules.qdoc | 4 ++-- doc/src/declarative/network.qdoc | 4 ++-- doc/src/declarative/qdeclarativedebugging.qdoc | 8 ++++---- doc/src/declarative/qdeclarativei18n.qdoc | 8 ++++---- doc/src/declarative/qml-intro.qdoc | 10 +++++++++- doc/src/declarative/qmlviewer.qdoc | 4 ++-- doc/src/declarative/tutorial.qdoc | 4 ++-- src/declarative/qml/qdeclarativeengine.cpp | 3 +-- 11 files changed, 45 insertions(+), 29 deletions(-) diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 587cdf2..8a24228 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -36,11 +36,18 @@ Qt includes a set of examples and demos that show how to use various aspects of QML. The examples are small demonstrations of particular QML components, while the demos contain more complete and functional applications. -To run the examples and demos, you can use Qt Creator or the included \l {Qt Declarative UI Runtime}{qmlviewer} -command-line application. For example, from your build directory, run: +To run the examples and demos, open them in Qt Creator or use the included +\l {QML Viewer} tool. The \l {QML Viewer} can be run from the command line: \code - bin/qmlviewer $QTDIR/demos/declarative/samegame/samegame.qml + qmlviewer $QTDIR/demos/declarative/samegame/samegame.qml +\endcode + +On Mac OS X, you can run the included "QMLViewer" application from the +Finder, or use the command line: + +\code + QMLViewer.app/Contents/MacOS/QMLViewer $QTDIR/demos/declarative/samegame/samegame.qml \endcode diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc index 0cb3a7d..2cf00b9 100644 --- a/doc/src/declarative/extending-tutorial.qdoc +++ b/doc/src/declarative/extending-tutorial.qdoc @@ -116,9 +116,9 @@ Now we can build and run the application. Try it yourself with the code in Qt's \example declarative/tutorials/extending/chapter1-basics At the moment, the \c app.qml is run from within a C++ application. -This may seem odd if you're used to running QML files with the standard \c qml tool. +This may seem odd if you're used to running QML files with the \l {QML Viewer}. Later on, we'll show how to create a plugin so that you can run \c app.qml using the -\c qml tool instead. +\l {QML Viewer} instead. */ @@ -301,8 +301,8 @@ Try it out with the code in Qt's \c examples/tutorials/extending/chapter4-custom Currently the \c Musician and \c Instrument types are used by \c app.qml, which is displayed using a QDeclarativeView in a C++ application. An alternative way to use our QML extension is to create a plugin library to make it available -to the QML engine. This means we could load \c app.qml using the standard \c qml tool -(or some other QML runtime application) instead of writing a \c main.cpp file and +to the QML engine. This means we could load \c app.qml using the \l {QML Viewer} +(or some other QML \l{Qt Declarative UI Runtime}{runtime} application) instead of writing a \c main.cpp file and loading our own C++ application. To create a plugin library, we need: @@ -337,12 +337,14 @@ of the example project) can be found in the "lib" subdirectory: \quotefile declarative/tutorials/extending/chapter5-plugins/qmldir Now we have a plugin, and instead of having a main.cpp and an executable, we can build -the project and then run the QML file directly using the \c qml tool: +the project and then load the QML file in the \l {QML Viewer}: \code - qml app.qml + qmlviewer app.qml \endcode +(On Mac OS X, you can launch the "QMLViewer" application instead.) + Notice the "import Music 1.0" statement has disappeared from \c app.qml. This is because the \c qmldir file is in the same directory as \c app.qml: this is equivalent to having Musician.qml and Instrument.qml files inside the project directory, which could both diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc index cc546c0..0dd5eb3 100644 --- a/doc/src/declarative/focus.qdoc +++ b/doc/src/declarative/focus.qdoc @@ -87,7 +87,7 @@ Text { An \l Item requests focus by setting the \c {Item::focus} property to true. For very simple cases simply setting the \c {Item::focus} property is sometimes -sufficient. If we run the following example with the \l {Qt Declarative UI Runtime}{qml} tool, we see that +sufficient. If we run the following example with the \l {QML Viewer}, we see that the \c {keyHandler} element has \e {active focus} and pressing the 'A', 'B' or 'C' keys modifies the text appropriately. diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index 02a2f5f..a77c64e 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -72,7 +72,7 @@ The second exception is explained in more detail in the section below on Namespa \section2 The Import Path Installed modules are searched for on the import path. -The \c -I option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the import path. +The \c -I option to the \l {QML Viewer} adds paths to the import path. From C++, the path is available via \l QDeclarativeEngine::importPathList() and can be prepended to using \l QDeclarativeEngine::addImportPath(). @@ -122,7 +122,7 @@ to the module. of the plugin binary, which is platform dependent; e.g. the library MyAppTypes would produce a libMyAppTypes.so on Linux and MyAppTypes.dll on Windows. By default the engine searches for the plugin library in the directory containing the \c qmldir -file. The \c -P option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the +file. The \c -P option to the \l {QML Viewer} adds paths to the plugin search path. From C++, the path is available via \l QDeclarativeEngine::pluginPathList() and can be prepended to using \l QDeclarativeEngine::addPluginPath(). diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc index b0d19e2..60359de 100644 --- a/doc/src/declarative/network.qdoc +++ b/doc/src/declarative/network.qdoc @@ -54,7 +54,7 @@ Network transparency is supported throughout QML, for example: \o WebViews - the \c url property of WebView (obviously!) \endlist -Even QML types themselves can be on the network - if the \l {Qt Declarative UI Runtime}{qml} tool is used to load +Even QML types themselves can be on the network - if the \l {QML Viewer} is used to load \tt http://example.com/mystuff/Hello.qml and that content refers to a type "World", the engine will load \tt http://example.com/mystuff/qmldir and resolve the type just as it would for a local file. For example if the qmldir file contains the line "World World.qml", it will load @@ -119,7 +119,7 @@ All network access from QML is managed by a QNetworkAccessManager set on the QDe By default, this is an unmodified Qt QNetworkAccessManager. You may set a different manager by providing a QDeclarativeNetworkAccessManagerFactory and setting it via QDeclarativeEngine::setNetworkAccessManagerFactory(). -For example, the \l {Qt Declarative UI Runtime}{qml} tool sets a QDeclarativeNetworkAccessManagerFactory which +For example, the \l {QML Viewer} sets a QDeclarativeNetworkAccessManagerFactory which creates QNetworkAccessManager that trusts HTTP Expiry headers to avoid network cache checks, allows HTTP Pipelining, adds a persistent HTTP CookieJar, a simple disk cache, and supports proxy settings. diff --git a/doc/src/declarative/qdeclarativedebugging.qdoc b/doc/src/declarative/qdeclarativedebugging.qdoc index da6e407..ea21852 100644 --- a/doc/src/declarative/qdeclarativedebugging.qdoc +++ b/doc/src/declarative/qdeclarativedebugging.qdoc @@ -47,7 +47,7 @@ Rectangle { When a transition doesn't look quite right, it can be helpful to view it in slow motion to see what is happening more clearly. This functionality is supported -in the \l {Qt Declarative UI Runtime}{qmlviewer} tool: to enable this, +in the \l {QML Viewer} tool: to enable this, click on the "Debugging" menu, then "Slow Down Animations". @@ -64,7 +64,7 @@ import Qt 4.7 Rectangle { width: 100; height: 100 } \endqml -If you set \c {QML_IMPORT_TRACE=1} before running the \l {Qt Declarative UI Runtime}{qmlviewer} +If you set \c {QML_IMPORT_TRACE=1} before running the \l {QML Viewer} (or your QML C++ application), you will see output similar to this: \code @@ -85,11 +85,11 @@ show QML debugging information and options for your application, including object inspection, property monitoring and application frame-rate analysis. Creator can be used to debug both local and remote QML applications. To -enable remote debugging, start the \l {Qt Declarative UI Runtime}{qml} tool +enable remote debugging, start the \l {QML Viewer} on the remote device with a debugging port defined, like this: \code - QML_DEBUG_SERVER_PORT=3768 qml myqmlfile.qml + QML_DEBUG_SERVER_PORT=3768 qmlviewer myqmlfile.qml \endcode In Creator, open the project settings pane and set the server and port diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc index 40f7919..b6e6c6e 100644 --- a/doc/src/declarative/qdeclarativei18n.qdoc +++ b/doc/src/declarative/qdeclarativei18n.qdoc @@ -49,7 +49,7 @@ capabilities are described more fully in: \o \l {Qt Linguist Manual} \endlist -You can test a translation with the \l {Qt Declarative UI Runtime}{qml} tool using the -translation option. +You can test a translation with the \l {QML Viewer} using the -translation option. \section1 Example @@ -61,8 +61,8 @@ hello.qml: import Qt 4.7 Rectangle { - width: 200; height: 200 - Text { text: qsTr("Hello"); anchors.centerIn: parent } + width: 200; height: 200 + Text { text: qsTr("Hello"); anchors.centerIn: parent } } \endqml @@ -76,7 +76,7 @@ a translation and create the release file \c hello.qm. Finally, we can test the translation: \code -qml -translation hello.qm hello.qml +qmlviewer -translation hello.qm hello.qml \endcode diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc index ac79496..21ce2dd 100644 --- a/doc/src/declarative/qml-intro.qdoc +++ b/doc/src/declarative/qml-intro.qdoc @@ -105,9 +105,17 @@ This is a valid QML script. To run it, copy it and save it to a file, say myexample.qml, and on the command line run the command \code - qml myexample.qml + qmlviewer myexample.qml \endcode +On Mac OS X, open the "QMLViewer" application instead and open the +\c myexample.qml file, or run it from the command line: + + \code + QMLViewer.app/Contents/MacOS/QMLViewer myexample.qml + \endcode + + It will create a very boring rectangle in its own window. diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc index efff9cc..5efc0ce 100644 --- a/doc/src/declarative/qmlviewer.qdoc +++ b/doc/src/declarative/qmlviewer.qdoc @@ -42,7 +42,7 @@ deployment of QML applications. In those cases, the QML runtime should be invoke from a Qt application instead; see \l {Qt Declarative UI Runtime} for more information. -The viewer is located at QTDIR/bin/qmlviewer. To load a \c .qml file +The viewer is located at \c QTDIR/bin/qmlviewer. To load a \c .qml file with the viewer, run the viewer and select the file to be opened, or provide the file path on the command line: @@ -50,7 +50,7 @@ file path on the command line: qmlviewer myqmlfile.qml \endcode -On Mac OS X, the QML Viewer application is named \c QMLViewer.app instead. You +On Mac OS X, the QML Viewer application is named "QMLViewer" instead. You can launch the viewer by opening the QMLViewer application from the Finder, or from the command line: diff --git a/doc/src/declarative/tutorial.qdoc b/doc/src/declarative/tutorial.qdoc index c884486..7a97eb1 100644 --- a/doc/src/declarative/tutorial.qdoc +++ b/doc/src/declarative/tutorial.qdoc @@ -101,11 +101,11 @@ The \c font.pointSize and \c font.bold properties are related to fonts and use t \section2 Viewing the example -To view what you have created, run the \l{Qt Declarative UI Runtime}{qml} tool (located in the \c bin directory) with your filename as the first argument. +To view what you have created, run the \l{QML Viewer} tool (located in the \c bin directory) with your filename as the first argument. For example, to run the provided completed Tutorial 1 example from the install location, you would type: \code -bin/qml $QTDIR/examples/declarative/tutorials/helloworld/tutorial1.qml +bin/qmlviewer $QTDIR/examples/declarative/tutorials/helloworld/tutorial1.qml \endcode */ diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 8b15ae9..aa3c8d9 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1728,8 +1728,7 @@ void QDeclarativeEnginePrivate::warning(QDeclarativeEnginePrivate *engine, const /*! \qmlmethod Qt::quit() This function causes the QDeclarativeEngine::quit() signal to be emitted. -Within the \l {Qt Declarative UI Runtime}{qml} application this causes the -launcher application to exit. +Within the \l {QML Viewer}, this causes the launcher application to exit. */ QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptEngine *e) -- cgit v0.12 From 2497d922f06404f6fd1c65c6c685fbce173303ae Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 2 Jul 2010 13:42:56 +1000 Subject: fix doc links --- doc/src/declarative/advtutorial.qdoc | 2 +- doc/src/declarative/globalobject.qdoc | 2 +- doc/src/examples/qml-webbrowser.qdoc | 2 +- src/declarative/graphicsitems/qdeclarativeitem.cpp | 2 +- src/declarative/graphicsitems/qdeclarativeloader.cpp | 2 +- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 2 +- src/declarative/qml/qdeclarativeengine.cpp | 5 +++-- src/declarative/util/qdeclarativeview.cpp | 2 +- src/declarative/util/qdeclarativexmllistmodel.cpp | 2 +- src/imports/gestures/qdeclarativegesturearea.cpp | 2 +- 10 files changed, 12 insertions(+), 11 deletions(-) diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 9c72e95..2c3610c 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -164,7 +164,7 @@ The \c createBlock() function creates a block from the \c Block.qml file and moves the new block to its position on the game canvas. This involves several steps: \list -\o \l {Qt::createComponent()}{Qt.createComponent()} is called to generate an element from \c Block.qml. +\o \l {QML:Qt::createComponent()}{Qt.createComponent()} is called to generate an element from \c Block.qml. If the component is ready, we can call \c createObject() to create an instance of the \c Block item. \o If \c createObject() returned null (i.e. if there was an error while loading the object), print the error information. diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 36d91ec..a9aee2f 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -35,7 +35,7 @@ Contains all the properties of the JavaScript global object, plus: \section1 Qt Object -The \l{Qt}{Qt object} provides useful enums and functions from Qt, for use in all QML +The \l{QmlGlobalQtObject}{Qt object} provides useful enums and functions from Qt, for use in all QML files. \section1 XMLHttpRequest diff --git a/doc/src/examples/qml-webbrowser.qdoc b/doc/src/examples/qml-webbrowser.qdoc index da6f600..d322b02 100644 --- a/doc/src/examples/qml-webbrowser.qdoc +++ b/doc/src/examples/qml-webbrowser.qdoc @@ -40,7 +40,7 @@ ****************************************************************************/ /*! - \title Web Browser + \title QML Web Browser \example demos/declarative/webbrowser This demo shows how to write a simple web browser in QML by combining the diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 9a17d78..352c3df 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -2144,7 +2144,7 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const \property QDeclarativeItem::baselineOffset \brief The position of the item's baseline in local coordinates. - The baseline of a Text item is the imaginary line on which the text + The baseline of a \l Text item is the imaginary line on which the text sits. Controls containing text usually set their baseline to the baseline of their text. diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index c8c9e44..e745ca6 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -119,7 +119,7 @@ void QDeclarativeLoaderPrivate::initResize() property, or loaded from a URL via the \l source property. Loader can be used to delay the creation of a component until it is required. - For example, this loads "Page1.qml" as a component into the \l Loader element + For example, this loads "Page1.qml" as a component into the Loader element when the \l MouseArea is clicked: \code diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index c6566ff..c066f11 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -203,7 +203,7 @@ QString QDeclarativeTextEdit::text() const Sets the font size in pixels. Using this function makes the font device dependent. - Use \l pointSize to set the size of the font in a device independent manner. + Use \l font.pointSize to set the size of the font in a device independent manner. */ /*! diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index aa3c8d9..8bf7450 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -151,6 +151,7 @@ void QDeclarativeEnginePrivate::defineModule() } /*! +\keyword QmlGlobalQtObject \qmlclass Qt QDeclarativeEnginePrivate \brief The QML global Qt object provides useful enums and functions from Qt. @@ -1077,7 +1078,7 @@ If you are certain the files will be local, you could simplify to: \snippet doc/src/snippets/declarative/componentCreation.js 2 To create a QML object from an arbitrary string of QML (instead of a file), -use \l{Qt::createQmlObject()}{Qt.createQmlObject()}. +use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}. */ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QScriptEngine *engine) @@ -1124,7 +1125,7 @@ Each object in this array has the members \c lineNumber, \c columnNumber, \c fil Note that this function returns immediately, and therefore may not work if the \a qml string loads new components (that is, external QML files that have not yet been loaded). -If this is the case, consider using \l{Qt::createComponent()}{Qt.createComponent()} instead. +If this is the case, consider using \l{QML:Qt::createComponent()}{Qt.createComponent()} instead. */ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine) diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 0414e65..12a8d3a 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -611,7 +611,7 @@ void QDeclarativeView::timerEvent(QTimerEvent* e) } } -/*! \reimp */ +/*! \internal */ bool QDeclarativeView::eventFilter(QObject *watched, QEvent *e) { Q_D(QDeclarativeView); diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 0692aaa..5583007 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -589,7 +589,7 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty Date: Wed, 30 Jun 2010 17:10:33 +1000 Subject: Fix TextInput text getting improperly clipped Task-number: QTBUG-11790 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativetextinput.cpp | 46 ++++++++++-------- .../graphicsitems/qdeclarativetextinput_p_p.h | 1 + .../qdeclarativetext/tst_qdeclarativetext.cpp | 5 +- .../tst_qdeclarativetextedit.cpp | 5 +- .../qdeclarativetextinput/data/halign_center.png | Bin 0 -> 293 bytes .../qdeclarativetextinput/data/halign_left.png | Bin 0 -> 291 bytes .../qdeclarativetextinput/data/halign_right.png | Bin 0 -> 292 bytes .../data/horizontalAlignment.qml | 22 +++++++++ .../tst_qdeclarativetextinput.cpp | 53 ++++++++++++++++++++- 9 files changed, 110 insertions(+), 22 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativetextinput/data/halign_center.png create mode 100644 tests/auto/declarative/qdeclarativetextinput/data/halign_left.png create mode 100644 tests/auto/declarative/qdeclarativetextinput/data/halign_right.png create mode 100644 tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index ed999a2..374f371 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -100,8 +100,6 @@ void QDeclarativeTextInput::setText(const QString &s) if(s == text()) return; d->control->setText(s); - d->updateHorizontalScroll(); - //emit textChanged(); } /*! @@ -550,9 +548,9 @@ void QDeclarativeTextInput::setAutoScroll(bool b) return; d->autoScroll = b; - d->updateHorizontalScroll(); //We need to repaint so that the scrolling is taking into account. updateSize(true); + d->updateHorizontalScroll(); emit autoScrollChanged(d->autoScroll); } @@ -1020,27 +1018,43 @@ bool QDeclarativeTextInput::event(QEvent* ev) void QDeclarativeTextInput::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { - if (newGeometry.width() != oldGeometry.width()) + Q_D(QDeclarativeTextInput); + if (newGeometry.width() != oldGeometry.width()) { updateSize(); + d->updateHorizontalScroll(); + } QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry); } +int QDeclarativeTextInputPrivate::calculateTextWidth() +{ + int cursorWidth = control->cursorWidth(); + if(cursorItem) + cursorWidth = cursorItem->width(); + + QFontMetrics fm = QFontMetrics(font); + int leftBearing = 0; + int rightBearing = 0; + if (!control->text().isEmpty()) { + leftBearing = qMax(0, -fm.leftBearing(control->text().at(0))); + rightBearing = qMax(0, -fm.rightBearing(control->text().at(control->text().count()-1))); + } + + return qRound(control->naturalTextWidth()) + qMax(cursorWidth, leftBearing) + rightBearing; +} + void QDeclarativeTextInputPrivate::updateHorizontalScroll() { Q_Q(QDeclarativeTextInput); - QFontMetrics fm = QFontMetrics(font); int cix = qRound(control->cursorToX()); QRect br(q->boundingRect().toRect()); - //###Is this using bearing appropriately? - int minLB = qMax(0, -fm.minLeftBearing()); - int minRB = qMax(0, -fm.minRightBearing()); - int widthUsed = qRound(control->naturalTextWidth()) + 1 + minRB; + int widthUsed = calculateTextWidth(); if (autoScroll) { - if ((minLB + widthUsed) <= br.width()) { + if (widthUsed <= br.width()) { // text fits in br; use hscroll for alignment switch (hAlign & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) { case Qt::AlignRight: - hscroll = widthUsed - br.width() + 1; + hscroll = widthUsed - br.width() - 1; break; case Qt::AlignHCenter: hscroll = (widthUsed - br.width()) / 2; @@ -1050,7 +1064,6 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll() hscroll = 0; break; } - hscroll -= minLB; } else if (cix - hscroll >= br.width()) { // text doesn't fit, cursor is to the right of br (scroll right) hscroll = cix - br.width() + 1; @@ -1070,7 +1083,6 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll() } else { hscroll = 0; } - hscroll -= minLB; } } @@ -1095,7 +1107,6 @@ void QDeclarativeTextInput::drawContents(QPainter *p, const QRect &r) offset = QPoint(d->hscroll, 0); } d->control->draw(p, offset, r, flags); - p->restore(); } @@ -1448,8 +1459,8 @@ void QDeclarativeTextInput::selectionChanged() void QDeclarativeTextInput::q_textChanged() { Q_D(QDeclarativeTextInput); - d->updateHorizontalScroll(); updateSize(); + d->updateHorizontalScroll(); updateMicroFocus(); emit textChanged(); emit displayTextChanged(); @@ -1475,10 +1486,7 @@ void QDeclarativeTextInput::updateSize(bool needsRedraw) int w = width(); int h = height(); setImplicitHeight(d->control->height()); - int cursorWidth = d->control->cursorWidth(); - if(d->cursorItem) - cursorWidth = d->cursorItem->width(); - setImplicitWidth(d->control->naturalTextWidth() + cursorWidth); + setImplicitWidth(d->calculateTextWidth()); setContentsSize(QSize(width(), height()));//Repaints if changed if(w==width() && h==height() && needsRedraw){ clearCache(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h index 8b74bcc..4ac5134 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h @@ -100,6 +100,7 @@ public: void startCreatingCursor(); void focusChanged(bool hasFocus); void updateHorizontalScroll(); + int calculateTextWidth(); QLineControl* control; diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 8a4f152..80198eb 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include "../../../shared/util.h" #include "testhttpserver.h" @@ -452,7 +453,9 @@ void tst_qdeclarativetext::alignments() #ifdef Q_WS_X11 // Font-specific, but not likely platform-specific, so only test on one platform - QCOMPARE(actual,expect); + if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") { + QCOMPARE(actual,expect); + } #endif } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index f1a367f..fc329c8 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -353,7 +354,9 @@ void tst_qdeclarativetextedit::alignments() #ifdef Q_WS_X11 // Font-specific, but not likely platform-specific, so only test on one platform - QCOMPARE(actual,expect); + if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") { + QCOMPARE(actual,expect); + } #endif } diff --git a/tests/auto/declarative/qdeclarativetextinput/data/halign_center.png b/tests/auto/declarative/qdeclarativetextinput/data/halign_center.png new file mode 100644 index 0000000..53e09a8 Binary files /dev/null and b/tests/auto/declarative/qdeclarativetextinput/data/halign_center.png differ diff --git a/tests/auto/declarative/qdeclarativetextinput/data/halign_left.png b/tests/auto/declarative/qdeclarativetextinput/data/halign_left.png new file mode 100644 index 0000000..247acbc Binary files /dev/null and b/tests/auto/declarative/qdeclarativetextinput/data/halign_left.png differ diff --git a/tests/auto/declarative/qdeclarativetextinput/data/halign_right.png b/tests/auto/declarative/qdeclarativetextinput/data/halign_right.png new file mode 100644 index 0000000..691bc75 Binary files /dev/null and b/tests/auto/declarative/qdeclarativetextinput/data/halign_right.png differ diff --git a/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml new file mode 100644 index 0000000..b97f18e --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml @@ -0,0 +1,22 @@ +import Qt 4.7 + +Rectangle { + id: top + width: 70; height: 70; + + property alias horizontalAlignment: text.horizontalAlignment + property string text: "Test" + + Rectangle { + anchors.centerIn: parent + width: 60 + height: 20 + color: "green" + + TextInput { + id: text + anchors.fill: parent + text: top.text + } + } +} diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index a55b42e..a21630b 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -63,12 +64,16 @@ public: tst_qdeclarativetextinput(); private slots: + void text(); void width(); void font(); void color(); void selection(); + void horizontalAlignment_data(); + void horizontalAlignment(); + void positionAt(); void maxLength(); @@ -153,7 +158,7 @@ void tst_qdeclarativetextinput::width() QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->width(), 1.);//1 for the cursor + QCOMPARE(textinputObject->width(), 1.); // 1 for the cursor delete textinputObject; } @@ -370,6 +375,52 @@ void tst_qdeclarativetextinput::selection() delete textinputObject; } +void tst_qdeclarativetextinput::horizontalAlignment_data() +{ + QTest::addColumn("hAlign"); + QTest::addColumn("expectfile"); + + QTest::newRow("L") << int(Qt::AlignLeft) << SRCDIR "/data/halign_left.png"; + QTest::newRow("R") << int(Qt::AlignRight) << SRCDIR "/data/halign_right.png"; + QTest::newRow("C") << int(Qt::AlignHCenter) << SRCDIR "/data/halign_center.png"; +} + +void tst_qdeclarativetextinput::horizontalAlignment() +{ + QFETCH(int, hAlign); + QFETCH(QString, expectfile); + +#ifdef Q_WS_X11 + // Font-specific, but not likely platform-specific, so only test on one platform + QFont fn; + fn.setRawName("-misc-fixed-medium-r-*-*-8-*-*-*-*-*-*-*"); + QApplication::setFont(fn); +#endif + + QDeclarativeView *canvas = createView(SRCDIR "/data/horizontalAlignment.qml"); + + canvas->show(); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(canvas)); + QObject *ob = canvas->rootObject(); + QVERIFY(ob != 0); + ob->setProperty("horizontalAlignment",hAlign); + QImage actual(canvas->width(), canvas->height(), QImage::Format_RGB32); + actual.fill(qRgb(255,255,255)); + QPainter p(&actual); + canvas->render(&p); + + QImage expect(expectfile); + +#ifdef Q_WS_X11 + // Font-specific, but not likely platform-specific, so only test on one platform + if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") { + QCOMPARE(actual,expect); + } +#endif +} + void tst_qdeclarativetextinput::positionAt() { QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml"); -- cgit v0.12 From e4e6b49f555eae41fac024c1b733736a28812e2e Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 2 Jul 2010 14:21:38 +1000 Subject: Make autotests work with qreal == float (in addition to double). Task-number: QTBUG-11853 --- src/declarative/qml/qdeclarativecompiler.cpp | 4 +- src/declarative/qml/qdeclarativedom.cpp | 2 +- src/declarative/qml/qdeclarativemetatype.cpp | 2 +- .../tst_qdeclarativeanimations.cpp | 2 +- .../data/assignBasicTypes.2.qml | 2 +- .../data/assignBasicTypes.qml | 2 +- .../declarative/qdeclarativeecmascript/testtypes.h | 2 +- .../tst_qdeclarativeecmascript.cpp | 46 ++++++++++----------- .../qdeclarativeimage/data/heart-float.png | Bin 0 -> 12621 bytes .../qdeclarativeimage/data/heart200-float.png | Bin 0 -> 8063 bytes .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 22 ++++++---- .../data/nestedErrors.errors.txt | 2 +- .../data/wrongType.6.errors.txt | 2 +- .../tst_qdeclarativemetatype.cpp | 3 +- .../tst_qdeclarativevaluetypes.cpp | 16 +++---- .../tst_qdeclarativeworkerscript.cpp | 2 +- 16 files changed, 58 insertions(+), 51 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeimage/data/heart-float.png create mode 100644 tests/auto/declarative/qdeclarativeimage/data/heart200-float.png diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 623e3df..e3ce70e 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -228,10 +228,10 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop, } break; case QMetaType::Float: - if (!v->value.isNumber()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: float expected")); + if (!v->value.isNumber()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: number expected")); break; case QVariant::Double: - if (!v->value.isNumber()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: double expected")); + if (!v->value.isNumber()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: number expected")); break; case QVariant::Color: { diff --git a/src/declarative/qml/qdeclarativedom.cpp b/src/declarative/qml/qdeclarativedom.cpp index a3cddb5..5b30bde 100644 --- a/src/declarative/qml/qdeclarativedom.cpp +++ b/src/declarative/qml/qdeclarativedom.cpp @@ -493,7 +493,7 @@ int QDeclarativeDomDynamicProperty::propertyType() const return QMetaType::type("int"); case QDeclarativeParser::Object::DynamicProperty::Real: - return QMetaType::type("double"); + return sizeof(qreal) == sizeof(double) ? QMetaType::type("double") : QMetaType::type("float"); case QDeclarativeParser::Object::DynamicProperty::String: return QMetaType::type("QString"); diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index c32cab6..153e2be 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -1152,7 +1152,7 @@ bool QDeclarativeMetaType::copy(int type, void *data, const void *copy) *static_cast(data) = float(0); return true; case QMetaType::Double: - *static_cast(data) = double(); + *static_cast(data) = double(0); return true; case QMetaType::QChar: *static_cast(data) = NS(QChar)(); diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index a965ef3..3e80c2c 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -310,7 +310,7 @@ void tst_qdeclarativeanimations::badTypes() c.create(); QVERIFY(c.errors().count() == 1); - QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: double expected")); + QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: number expected")); } //make sure we get a compiler error diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml index db7f2b5..2c79729 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml @@ -7,7 +7,7 @@ MyTypeObject { uintProperty: if(1) 10 intProperty: if(1) -19 realProperty: if(1) 23.2 - doubleProperty: if(1) -19.7 + doubleProperty: if(1) -19.75 floatProperty: if(1) 8.5 colorProperty: if(1) "red" dateProperty: if(1) "1982-11-25" diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml index 72ae865..1cd78a5 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml @@ -9,7 +9,7 @@ MyTypeObject { uintProperty = 10 intProperty = -19 realProperty = 23.2 - doubleProperty = -19.7 + doubleProperty = -19.75 floatProperty = 8.5 colorProperty = "red" dateProperty = "1982-11-25" diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 849879e..19bfd37 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -572,7 +572,7 @@ public: Q_INVOKABLE void method_NoArgs() { invoke(0); } Q_INVOKABLE int method_NoArgs_int() { invoke(1); return 6; } - Q_INVOKABLE qreal method_NoArgs_real() { invoke(2); return 19.7; } + Q_INVOKABLE qreal method_NoArgs_real() { invoke(2); return 19.75; } Q_INVOKABLE QPointF method_NoArgs_QPointF() { invoke(3); return QPointF(123, 4.5); } Q_INVOKABLE QObject *method_NoArgs_QObject() { invoke(4); return this; } Q_INVOKABLE MyInvokableObject *method_NoArgs_unknown() { invoke(5); return this; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 43900ae..a6d2dac 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -179,7 +179,7 @@ void tst_qdeclarativeecmascript::assignBasicTypes() QCOMPARE(object->uintProperty(), uint(10)); QCOMPARE(object->intProperty(), -19); QCOMPARE((float)object->realProperty(), float(23.2)); - QCOMPARE((float)object->doubleProperty(), float(-19.7)); + QCOMPARE((float)object->doubleProperty(), float(-19.75)); QCOMPARE((float)object->floatProperty(), float(8.5)); QCOMPARE(object->colorProperty(), QColor("red")); QCOMPARE(object->dateProperty(), QDate(1982, 11, 25)); @@ -207,7 +207,7 @@ void tst_qdeclarativeecmascript::assignBasicTypes() QCOMPARE(object->uintProperty(), uint(10)); QCOMPARE(object->intProperty(), -19); QCOMPARE((float)object->realProperty(), float(23.2)); - QCOMPARE((float)object->doubleProperty(), float(-19.7)); + QCOMPARE((float)object->doubleProperty(), float(-19.75)); QCOMPARE((float)object->floatProperty(), float(8.5)); QCOMPARE(object->colorProperty(), QColor("red")); QCOMPARE(object->dateProperty(), QDate(1982, 11, 25)); @@ -280,8 +280,8 @@ void tst_qdeclarativeecmascript::signalAssignment() MyQmlObject *object = qobject_cast(component.create()); QVERIFY(object != 0); QCOMPARE(object->string(), QString()); - emit object->argumentSignal(19, "Hello world!", 10.3); - QCOMPARE(object->string(), QString("pass 19 Hello world! 10.3")); + emit object->argumentSignal(19, "Hello world!", 10.25); + QCOMPARE(object->string(), QString("pass 19 Hello world! 10.25")); } } @@ -1387,7 +1387,7 @@ void tst_qdeclarativeecmascript::callQtInvokables() QCOMPARE(o.actuals().count(), 0); o.reset(); - QVERIFY(engine->evaluate("object.method_NoArgs_real()").strictlyEquals(QScriptValue(engine, 19.7))); + QVERIFY(engine->evaluate("object.method_NoArgs_real()").strictlyEquals(QScriptValue(engine, 19.75))); QCOMPARE(o.error(), false); QCOMPARE(o.invoked(), 2); QCOMPARE(o.actuals().count(), 0); @@ -1818,7 +1818,7 @@ void tst_qdeclarativeecmascript::scriptConnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toBool(), false); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toBool(), true); delete object; @@ -1831,7 +1831,7 @@ void tst_qdeclarativeecmascript::scriptConnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toBool(), false); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toBool(), true); delete object; @@ -1844,7 +1844,7 @@ void tst_qdeclarativeecmascript::scriptConnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toBool(), false); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toBool(), true); delete object; @@ -1857,7 +1857,7 @@ void tst_qdeclarativeecmascript::scriptConnect() QVERIFY(object != 0); QCOMPARE(object->methodCalled(), false); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->methodCalled(), true); delete object; @@ -1870,7 +1870,7 @@ void tst_qdeclarativeecmascript::scriptConnect() QVERIFY(object != 0); QCOMPARE(object->methodCalled(), false); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->methodCalled(), true); delete object; @@ -1883,7 +1883,7 @@ void tst_qdeclarativeecmascript::scriptConnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toInt(), 0); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); delete object; @@ -1899,13 +1899,13 @@ void tst_qdeclarativeecmascript::scriptDisconnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toInt(), 0); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 1); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); emit object->basicSignal(); QCOMPARE(object->property("test").toInt(), 2); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); delete object; @@ -1918,13 +1918,13 @@ void tst_qdeclarativeecmascript::scriptDisconnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toInt(), 0); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 1); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); emit object->basicSignal(); QCOMPARE(object->property("test").toInt(), 2); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); delete object; @@ -1937,13 +1937,13 @@ void tst_qdeclarativeecmascript::scriptDisconnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toInt(), 0); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 1); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); emit object->basicSignal(); QCOMPARE(object->property("test").toInt(), 2); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 3); delete object; @@ -1955,13 +1955,13 @@ void tst_qdeclarativeecmascript::scriptDisconnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toInt(), 0); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 1); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); emit object->basicSignal(); QCOMPARE(object->property("test").toInt(), 2); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 3); delete object; diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart-float.png b/tests/auto/declarative/qdeclarativeimage/data/heart-float.png new file mode 100644 index 0000000..65bd89f Binary files /dev/null and b/tests/auto/declarative/qdeclarativeimage/data/heart-float.png differ diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200-float.png b/tests/auto/declarative/qdeclarativeimage/data/heart200-float.png new file mode 100644 index 0000000..786e75d Binary files /dev/null and b/tests/auto/declarative/qdeclarativeimage/data/heart200-float.png differ diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index c09f7fc..ace6712 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -124,8 +124,8 @@ void tst_qdeclarativeimage::noSource() void tst_qdeclarativeimage::imageSource_data() { QTest::addColumn("source"); - QTest::addColumn("width"); - QTest::addColumn("height"); + QTest::addColumn("width"); + QTest::addColumn("height"); QTest::addColumn("remote"); QTest::addColumn("async"); QTest::addColumn("error"); @@ -146,8 +146,8 @@ void tst_qdeclarativeimage::imageSource_data() void tst_qdeclarativeimage::imageSource() { QFETCH(QString, source); - QFETCH(qreal, width); - QFETCH(qreal, height); + QFETCH(double, width); + QFETCH(double, height); QFETCH(bool, remote); QFETCH(bool, async); QFETCH(QString, error); @@ -178,8 +178,8 @@ void tst_qdeclarativeimage::imageSource() if (error.isEmpty()) { TRY_WAIT(obj->status() == QDeclarativeImage::Ready); - QCOMPARE(obj->width(), width); - QCOMPARE(obj->height(), height); + QCOMPARE(obj->width(), qreal(width)); + QCOMPARE(obj->height(), qreal(height)); QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); QCOMPARE(obj->progress(), 1.0); } else { @@ -308,7 +308,10 @@ void tst_qdeclarativeimage::svg() #elif defined(Q_OS_WIN32) QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-win32.png")); #else - QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png")); + if (sizeof(qreal) == sizeof(double)) + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png")); + else + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-float.png")); #endif obj->setSourceSize(QSize(200,200)); @@ -322,7 +325,10 @@ void tst_qdeclarativeimage::svg() #elif defined(Q_OS_WIN32) QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-win32.png")); #else - QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png")); + if (sizeof(qreal) == sizeof(double)) + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png")); + else + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-float.png")); #endif delete obj; } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt index 886da55..6e11786 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt @@ -1,2 +1,2 @@ 4:5:Unable to create type NestedErrorsType -4:8:Invalid property assignment: double expected +4:8:Invalid property assignment: number expected diff --git a/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt index d0a0b00..d2b8c54 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt @@ -1 +1 @@ -3:19:Invalid property assignment: double expected +3:19:Invalid property assignment: number expected diff --git a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp index 8964f8a..b06ad7c 100644 --- a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp +++ b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp @@ -124,6 +124,7 @@ QML_DECLARE_TYPE(ValueInterceptorTestType); { \ cpptype v = (value); cpptype v2 = (value); \ QVERIFY(QDeclarativeMetaType::copy(QMetaType:: metatype, &v, 0)); \ + QCOMPARE((cpptype)(v),(cpptype)(defaultvalue)); \ QVERIFY(v == (defaultvalue)); \ QVERIFY(QDeclarativeMetaType::copy(QMetaType:: metatype, &v, &v2)); \ QVERIFY(v == (value)); \ @@ -273,7 +274,7 @@ void tst_qdeclarativemetatype::copy() QWidget widgetValue; COPY_TEST(QObject *, QObjectStar, &objectValue, 0); COPY_TEST(QWidget *, QWidgetStar, &widgetValue, 0); - COPY_TEST(qreal, QReal, 10.2, 0); + COPY_TEST(qreal, QReal, 10.5, 0); { QVariant tv = QVariant::fromValue(QVariant(10)); diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index 81334f2..a4819f3 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -141,8 +141,8 @@ void tst_qdeclarativevaluetypes::pointf() MyTypeObject *object = qobject_cast(component.create()); QVERIFY(object != 0); - QCOMPARE(object->property("p_x").toDouble(), 11.3); - QCOMPARE(object->property("p_y").toDouble(), -10.9); + QCOMPARE(float(object->property("p_x").toDouble()), float(11.3)); + QCOMPARE(float(object->property("p_y").toDouble()), float(-10.9)); QCOMPARE(object->property("copy"), QVariant(QPointF(11.3, -10.9))); delete object; @@ -191,8 +191,8 @@ void tst_qdeclarativevaluetypes::sizef() MyTypeObject *object = qobject_cast(component.create()); QVERIFY(object != 0); - QCOMPARE(object->property("s_width").toDouble(), 0.1); - QCOMPARE(object->property("s_height").toDouble(), 100923.2); + QCOMPARE(float(object->property("s_width").toDouble()), float(0.1)); + QCOMPARE(float(object->property("s_height").toDouble()), float(100923.2)); QCOMPARE(object->property("copy"), QVariant(QSizeF(0.1, 100923.2))); delete object; @@ -287,10 +287,10 @@ void tst_qdeclarativevaluetypes::rectf() MyTypeObject *object = qobject_cast(component.create()); QVERIFY(object != 0); - QCOMPARE(object->property("r_x").toDouble(), 103.8); - QCOMPARE(object->property("r_y").toDouble(), 99.2); - QCOMPARE(object->property("r_width").toDouble(), 88.1); - QCOMPARE(object->property("r_height").toDouble(), 77.6); + QCOMPARE(float(object->property("r_x").toDouble()), float(103.8)); + QCOMPARE(float(object->property("r_y").toDouble()), float(99.2)); + QCOMPARE(float(object->property("r_width").toDouble()), float(88.1)); + QCOMPARE(float(object->property("r_height").toDouble()), float(77.6)); QCOMPARE(object->property("copy"), QVariant(QRectF(103.8, 99.2, 88.1, 77.6))); delete object; diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 8e98874..3140265 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -134,7 +134,7 @@ void tst_QDeclarativeWorkerScript::messaging_data() QTest::newRow("invalid") << QVariant(); QTest::newRow("bool") << qVariantFromValue(true); QTest::newRow("int") << qVariantFromValue(1001); - QTest::newRow("real") << qVariantFromValue(10334.323); + QTest::newRow("real") << qVariantFromValue(10334.375); QTest::newRow("string") << qVariantFromValue(QString("More cheeeese, Gromit!")); QTest::newRow("variant list") << qVariantFromValue((QVariantList() << "a" << "b" << "c")); } -- cgit v0.12 From 67536369d13be7be270b903f1d4e46e3193b542b Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 2 Jul 2010 14:31:45 +1000 Subject: Fix TextEdit bitmap tests testing the wrong element Task-number: Reviewed-by: Martin Jones --- tests/auto/declarative/qdeclarativetext/data/alignments.qml | 6 +++--- tests/auto/declarative/qdeclarativetextedit/data/alignments.qml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments.qml b/tests/auto/declarative/qdeclarativetext/data/alignments.qml index b1f701b..762e2b6 100644 --- a/tests/auto/declarative/qdeclarativetext/data/alignments.qml +++ b/tests/auto/declarative/qdeclarativetext/data/alignments.qml @@ -20,9 +20,9 @@ Rectangle { id: t anchors.fill: parent - horizontalAlignment: TextEdit.AlignRight - verticalAlignment: TextEdit.AlignBottom - wrapMode: TextEdit.WordWrap + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignBottom + wrapMode: Text.WordWrap text: top.txt } Timer { diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml b/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml index b1f701b..9281a06 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml @@ -16,7 +16,7 @@ Rectangle { height: 40 color: "green" - Text { + TextEdit { id: t anchors.fill: parent -- cgit v0.12 From 6b2ec2ab8df94233d6ba7960d5bfb3c7461b76ec Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 2 Jul 2010 16:44:28 +1000 Subject: docs - fix doc links, minor improvements --- .../graphicsitems/qdeclarativerepeater.cpp | 38 ++++++++++++++-------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 87da904..3be4014 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -85,6 +85,19 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() The \l model of a Repeater can be any of the supported \l {qmlmodels}{Data Models}. + Items instantiated by the Repeater are inserted, in order, as + children of the Repeater's parent. The insertion starts immediately after + the repeater's position in its parent stacking list. This allows + a Repeater to be used inside a layout. For example, the following Repeater's + items are stacked between a red rectangle and a blue rectangle: + + \snippet doc/src/snippets/declarative/repeater.qml layout + + \image repeater.png + + + \section2 The \c index and \c modelData properties + The index of a delegate is exposed as an accessible \c index property in the delegate. Properties of the model are also available depending upon the type of \l {qmlmodels}{Data Model}. @@ -105,25 +118,22 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \o \image repeater-modeldata.png \endtable - Items instantiated by the Repeater are inserted, in order, as - children of the Repeater's parent. The insertion starts immediately after - the repeater's position in its parent stacking list. This allows - a Repeater to be used inside a layout. For example, the following Repeater's - items are stacked between a red rectangle and a blue rectangle: - - \snippet doc/src/snippets/declarative/repeater.qml layout - - \image repeater.png A Repeater item owns all items it instantiates. Removing or dynamically destroying an item created by a Repeater results in unpredictable behavior. - Note that if a repeater is - required to instantiate a large number of items, it may be more efficient to - use other view elements such as ListView. - \note Repeater is \l {Item}-based, and can only repeat \l {Item}-derived objects. - For example, it cannot be used to repeat QtObjects. + \section2 Considerations when using Repeater + + The Repeater element creates all of its delegate items when the repeater is first + created. This can be inefficient if there are a large number of delegate items and + not all of the items are required to be visible at the same time. If this is the case, + consider using other view elements like ListView (which only creates delegate items + when they are scrolled into view) or use the \l {Dynamic Object Creation} methods to + create items as they are required. + + Also, note that Repeater is \l {Item}-based, and can only repeat \l {Item}-derived objects. + For example, it cannot be used to repeat QtObjects: \badcode Item { //XXX does not work! Can't repeat QtObject as it doesn't derive from Item. -- cgit v0.12 From 16cf85e926baf627d5e10e05affa05f3e9755e9c Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 2 Jul 2010 16:58:32 +1000 Subject: Fix test for N900 (ARM-specific SVG results). --- .../declarative/qdeclarativeimage/data/heart-arm.png | Bin 0 -> 12596 bytes .../declarative/qdeclarativeimage/data/heart-float.png | Bin 12621 -> 0 bytes .../declarative/qdeclarativeimage/data/heart200-arm.png | Bin 0 -> 8063 bytes .../qdeclarativeimage/data/heart200-float.png | Bin 8063 -> 0 bytes .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 14 ++++++-------- 5 files changed, 6 insertions(+), 8 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeimage/data/heart-arm.png delete mode 100644 tests/auto/declarative/qdeclarativeimage/data/heart-float.png create mode 100644 tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png delete mode 100644 tests/auto/declarative/qdeclarativeimage/data/heart200-float.png diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png b/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png new file mode 100644 index 0000000..3245027 Binary files /dev/null and b/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png differ diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart-float.png b/tests/auto/declarative/qdeclarativeimage/data/heart-float.png deleted file mode 100644 index 65bd89f..0000000 Binary files a/tests/auto/declarative/qdeclarativeimage/data/heart-float.png and /dev/null differ diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png b/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png new file mode 100644 index 0000000..b16db76 Binary files /dev/null and b/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png differ diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200-float.png b/tests/auto/declarative/qdeclarativeimage/data/heart200-float.png deleted file mode 100644 index 786e75d..0000000 Binary files a/tests/auto/declarative/qdeclarativeimage/data/heart200-float.png and /dev/null differ diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index ace6712..df029f5 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -307,11 +307,10 @@ void tst_qdeclarativeimage::svg() QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-mac.png")); #elif defined(Q_OS_WIN32) QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-win32.png")); +#elif defined(QT_ARCH_ARM) + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-arm.png")); #else - if (sizeof(qreal) == sizeof(double)) - QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png")); - else - QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-float.png")); + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png")); #endif obj->setSourceSize(QSize(200,200)); @@ -324,11 +323,10 @@ void tst_qdeclarativeimage::svg() QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-mac.png")); #elif defined(Q_OS_WIN32) QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-win32.png")); +#elif defined(QT_ARCH_ARM) + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-arm.png")); #else - if (sizeof(qreal) == sizeof(double)) - QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png")); - else - QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-float.png")); + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png")); #endif delete obj; } -- cgit v0.12 From 36f4d17a139c58cf00d3d9222dd2d35603ac09e8 Mon Sep 17 00:00:00 2001 From: mread Date: Fri, 2 Jul 2010 09:36:58 +0100 Subject: qtguiu.def merge conflict fix This takes the new exports added in qt/4.7, leaves them in place and moves the Avkon Removal exports, which conflicted, to the end of the DEF file. Reviewed-by: Sami Merila --- src/s60installs/bwins/QtGuiu.def | 75 +++++++++++++++++++++++++--------- src/s60installs/eabi/QtGuiu.def | 88 +++++++++++++++++++++++++++++----------- 2 files changed, 119 insertions(+), 44 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index de8e052..296901d 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12824,24 +12824,59 @@ EXPORTS ?createPixmapForImage@QRasterPixmapData@@IAEXAAVQImage@@V?$QFlags@W4ImageConversionFlag@Qt@@@@_N@Z @ 12823 NONAME ; void QRasterPixmapData::createPixmapForImage(class QImage &, class QFlags, bool) ??0Tab@QTextOption@@QAE@MW4TabType@1@VQChar@@@Z @ 12824 NONAME ; QTextOption::Tab::Tab(float, enum QTextOption::TabType, class QChar) ?fromData@QRasterPixmapData@@UAE_NPBEIPBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12825 NONAME ; bool QRasterPixmapData::fromData(unsigned char const *, unsigned int, char const *, class QFlags) - ?OpenIniFileLC@QS60MainApplication@@UBEPAVCDictionaryStore@@AAVRFs@@@Z @ 12826 NONAME ; class CDictionaryStore * QS60MainApplication::OpenIniFileLC(class RFs &) const - ?Reserved_MtsmObject@QS60MainAppUi@@MAEXXZ @ 12827 NONAME ; void QS60MainAppUi::Reserved_MtsmObject(void) - ?HandleForegroundEventL@QS60MainAppUi@@MAEXH@Z @ 12828 NONAME ; void QS60MainAppUi::HandleForegroundEventL(int) - ?OpenFileL@QS60MainDocument@@UAEPAVCFileStore@@HABVTDesC16@@AAVRFs@@@Z @ 12829 NONAME ; class CFileStore * QS60MainDocument::OpenFileL(int, class TDesC16 const &, class RFs &) - ?HandleTouchPaneSizeChange@QS60MainAppUi@@UAEXXZ @ 12830 NONAME ; void QS60MainAppUi::HandleTouchPaneSizeChange(void) - ?Reserved_MtsmPosition@QS60MainAppUi@@MAEXXZ @ 12831 NONAME ; void QS60MainAppUi::Reserved_MtsmPosition(void) - ?ApplicationRect@QS60MainAppUi@@UBE?AVTRect@@XZ @ 12832 NONAME ; class TRect QS60MainAppUi::ApplicationRect(void) const - ?HandleSystemEventL@QS60MainAppUi@@MAEXABVTWsEvent@@@Z @ 12833 NONAME ; void QS60MainAppUi::HandleSystemEventL(class TWsEvent const &) - ?HandleApplicationSpecificEventL@QS60MainAppUi@@MAEXHABVTWsEvent@@@Z @ 12834 NONAME ; void QS60MainAppUi::HandleApplicationSpecificEventL(int, class TWsEvent const &) - ?HandleError@QS60MainAppUi@@UAE?AW4TErrorHandlerResponse@@HABUSExtendedError@@AAVTDes16@@1@Z @ 12835 NONAME ; enum TErrorHandlerResponse QS60MainAppUi::HandleError(int, struct SExtendedError const &, class TDes16 &, class TDes16 &) - ?PrepareToExit@QS60MainAppUi@@UAEXXZ @ 12836 NONAME ; void QS60MainAppUi::PrepareToExit(void) - ?MopSupplyObject@QS60MainAppUi@@MAE?AVPtr@TTypeUid@@V3@@Z @ 12837 NONAME ; class TTypeUid::Ptr QS60MainAppUi::MopSupplyObject(class TTypeUid) - ?SetFadedL@QS60MainAppUi@@UAEXH@Z @ 12838 NONAME ; void QS60MainAppUi::SetFadedL(int) - ?Exit@QS60MainAppUi@@UAEXXZ @ 12839 NONAME ; void QS60MainAppUi::Exit(void) - ?ProcessCommandL@QS60MainAppUi@@UAEXH@Z @ 12840 NONAME ; void QS60MainAppUi::ProcessCommandL(int) - ?OpenFileL@QS60MainDocument@@UAEXAAPAVCFileStore@@AAVRFile@@@Z @ 12841 NONAME ; void QS60MainDocument::OpenFileL(class CFileStore * &, class RFile &) - ?HandleScreenDeviceChangedL@QS60MainAppUi@@MAEXXZ @ 12842 NONAME ; void QS60MainAppUi::HandleScreenDeviceChangedL(void) - ?PreDocConstructL@QS60MainApplication@@UAEXXZ @ 12843 NONAME ; void QS60MainApplication::PreDocConstructL(void) - ?NewAppServerL@QS60MainApplication@@UAEXAAPAVCApaAppServer@@@Z @ 12844 NONAME ; void QS60MainApplication::NewAppServerL(class CApaAppServer * &) - ?HandleViewDeactivation@QS60MainAppUi@@UAEXABVTVwsViewId@@0@Z @ 12845 NONAME ; void QS60MainAppUi::HandleViewDeactivation(class TVwsViewId const &, class TVwsViewId const &) + ?transformed@QRuntimePixmapData@@UBE?AVQPixmap@@ABVQTransform@@W4TransformationMode@Qt@@@Z @ 12826 NONAME ; class QPixmap QRuntimePixmapData::transformed(class QTransform const &, enum Qt::TransformationMode) const + ?scroll@QRuntimePixmapData@@UAE_NHHABVQRect@@@Z @ 12827 NONAME ; bool QRuntimePixmapData::scroll(int, int, class QRect const &) + ?buffer@QRuntimePixmapData@@UAEPAVQImage@@XZ @ 12828 NONAME ; class QImage * QRuntimePixmapData::buffer(void) + ?copy@QRuntimePixmapData@@UAEXPBVQPixmapData@@ABVQRect@@@Z @ 12829 NONAME ; void QRuntimePixmapData::copy(class QPixmapData const *, class QRect const &) + ?fromData@QRuntimePixmapData@@UAE_NPBEIPBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12830 NONAME ; bool QRuntimePixmapData::fromData(unsigned char const *, unsigned int, char const *, class QFlags) + ?readBackInfo@QRuntimePixmapData@@QAEXXZ @ 12831 NONAME ; void QRuntimePixmapData::readBackInfo(void) + ??_EQRuntimePixmapData@@UAE@I@Z @ 12832 NONAME ; QRuntimePixmapData::~QRuntimePixmapData(unsigned int) + ?paintEngine@QRuntimePixmapData@@UBEPAVQPaintEngine@@XZ @ 12833 NONAME ; class QPaintEngine * QRuntimePixmapData::paintEngine(void) const + ?memoryUsage@QRuntimePixmapData@@UBEIXZ @ 12834 NONAME ; unsigned int QRuntimePixmapData::memoryUsage(void) const + ?toImage@QRasterPixmapData@@UBE?AVQImage@@ABVQRect@@@Z @ 12835 NONAME ; class QImage QRasterPixmapData::toImage(class QRect const &) const + ?fromImageReader@QRasterPixmapData@@UAEXPAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12836 NONAME ; void QRasterPixmapData::fromImageReader(class QImageReader *, class QFlags) + ?fill@QRuntimePixmapData@@UAEXABVQColor@@@Z @ 12837 NONAME ; void QRuntimePixmapData::fill(class QColor const &) + ?alphaChannel@QRuntimePixmapData@@UBE?AVQPixmap@@XZ @ 12838 NONAME ; class QPixmap QRuntimePixmapData::alphaChannel(void) const + ?createCompatiblePixmapData@QRuntimePixmapData@@UBEPAVQPixmapData@@XZ @ 12839 NONAME ; class QPixmapData * QRuntimePixmapData::createCompatiblePixmapData(void) const + ?toImage@QRuntimePixmapData@@UBE?AVQImage@@XZ @ 12840 NONAME ; class QImage QRuntimePixmapData::toImage(void) const + ?resize@QRuntimePixmapData@@UAEXHH@Z @ 12841 NONAME ; void QRuntimePixmapData::resize(int, int) + ?fromNativeType@QRuntimePixmapData@@UAEXPAXW4NativeType@QPixmapData@@@Z @ 12842 NONAME ; void QRuntimePixmapData::fromNativeType(void *, enum QPixmapData::NativeType) + ?fromFile@QRuntimePixmapData@@UAE_NABVQString@@PBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12843 NONAME ; bool QRuntimePixmapData::fromFile(class QString const &, char const *, class QFlags) + ?setAlphaChannel@QRuntimePixmapData@@UAEXABVQPixmap@@@Z @ 12844 NONAME ; void QRuntimePixmapData::setAlphaChannel(class QPixmap const &) + ?fromImageReader@QPixmapData@@UAEXPAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12845 NONAME ; void QPixmapData::fromImageReader(class QImageReader *, class QFlags) + ?toImage@QPixmapData@@UBE?AVQImage@@ABVQRect@@@Z @ 12846 NONAME ; class QImage QPixmapData::toImage(class QRect const &) const + ?fromImageReader@QPixmap@@SA?AV1@PAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12847 NONAME ; class QPixmap QPixmap::fromImageReader(class QImageReader *, class QFlags) + ?fromImage@QRuntimePixmapData@@UAEXABVQImage@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12848 NONAME ; void QRuntimePixmapData::fromImage(class QImage const &, class QFlags) + ?setMask@QRuntimePixmapData@@UAEXABVQBitmap@@@Z @ 12849 NONAME ; void QRuntimePixmapData::setMask(class QBitmap const &) + ?mask@QRuntimePixmapData@@UBE?AVQBitmap@@XZ @ 12850 NONAME ; class QBitmap QRuntimePixmapData::mask(void) const + ?createPixmapData@QGraphicsSystem@@UAEPAVQPixmapData@@PAV2@@Z @ 12851 NONAME ; class QPixmapData * QGraphicsSystem::createPixmapData(class QPixmapData *) + ?metric@QRuntimePixmapData@@UBEHW4PaintDeviceMetric@QPaintDevice@@@Z @ 12852 NONAME ; int QRuntimePixmapData::metric(enum QPaintDevice::PaintDeviceMetric) const + ??1QRuntimePixmapData@@UAE@XZ @ 12853 NONAME ; QRuntimePixmapData::~QRuntimePixmapData(void) + ??0QRuntimePixmapData@@QAE@PBVQRuntimeGraphicsSystem@@W4PixelType@QPixmapData@@@Z @ 12854 NONAME ; QRuntimePixmapData::QRuntimePixmapData(class QRuntimeGraphicsSystem const *, enum QPixmapData::PixelType) + ?hasAlphaChannel@QRuntimePixmapData@@UBE_NXZ @ 12855 NONAME ; bool QRuntimePixmapData::hasAlphaChannel(void) const + ?runtimeData@QRuntimePixmapData@@UBEPAVQPixmapData@@XZ @ 12856 NONAME ; class QPixmapData * QRuntimePixmapData::runtimeData(void) const + ?toNativeType@QRuntimePixmapData@@UAEPAXW4NativeType@QPixmapData@@@Z @ 12857 NONAME ; void * QRuntimePixmapData::toNativeType(enum QPixmapData::NativeType) + ?copy@QRasterPixmapData@@UAEXPBVQPixmapData@@ABVQRect@@@Z @ 12858 NONAME ; void QRasterPixmapData::copy(class QPixmapData const *, class QRect const &) + ?eglSwapBuffersRegion2NOK@QEgl@@YAHHHHPBH@Z @ 12859 NONAME ; int QEgl::eglSwapBuffersRegion2NOK(int, int, int, int const *) + ?swapBuffersRegion2NOK@QEglContext@@QAE_NHPBVQRegion@@@Z @ 12860 NONAME ; bool QEglContext::swapBuffersRegion2NOK(int, class QRegion const *) + ?OpenIniFileLC@QS60MainApplication@@UBEPAVCDictionaryStore@@AAVRFs@@@Z @ 12861 NONAME ; class CDictionaryStore * QS60MainApplication::OpenIniFileLC(class RFs &) const + ?Reserved_MtsmObject@QS60MainAppUi@@MAEXXZ @ 12862 NONAME ; void QS60MainAppUi::Reserved_MtsmObject(void) + ?HandleForegroundEventL@QS60MainAppUi@@MAEXH@Z @ 12863 NONAME ; void QS60MainAppUi::HandleForegroundEventL(int) + ?OpenFileL@QS60MainDocument@@UAEPAVCFileStore@@HABVTDesC16@@AAVRFs@@@Z @ 12864 NONAME ; class CFileStore * QS60MainDocument::OpenFileL(int, class TDesC16 const &, class RFs &) + ?HandleTouchPaneSizeChange@QS60MainAppUi@@UAEXXZ @ 12865 NONAME ; void QS60MainAppUi::HandleTouchPaneSizeChange(void) + ?Reserved_MtsmPosition@QS60MainAppUi@@MAEXXZ @ 12866 NONAME ; void QS60MainAppUi::Reserved_MtsmPosition(void) + ?ApplicationRect@QS60MainAppUi@@UBE?AVTRect@@XZ @ 12867 NONAME ; class TRect QS60MainAppUi::ApplicationRect(void) const + ?HandleSystemEventL@QS60MainAppUi@@MAEXABVTWsEvent@@@Z @ 12868 NONAME ; void QS60MainAppUi::HandleSystemEventL(class TWsEvent const &) + ?HandleApplicationSpecificEventL@QS60MainAppUi@@MAEXHABVTWsEvent@@@Z @ 12869 NONAME ; void QS60MainAppUi::HandleApplicationSpecificEventL(int, class TWsEvent const &) + ?HandleError@QS60MainAppUi@@UAE?AW4TErrorHandlerResponse@@HABUSExtendedError@@AAVTDes16@@1@Z @ 12870 NONAME ; enum TErrorHandlerResponse QS60MainAppUi::HandleError(int, struct SExtendedError const &, class TDes16 &, class TDes16 &) + ?PrepareToExit@QS60MainAppUi@@UAEXXZ @ 12871 NONAME ; void QS60MainAppUi::PrepareToExit(void) + ?MopSupplyObject@QS60MainAppUi@@MAE?AVPtr@TTypeUid@@V3@@Z @ 12872 NONAME ; class TTypeUid::Ptr QS60MainAppUi::MopSupplyObject(class TTypeUid) + ?SetFadedL@QS60MainAppUi@@UAEXH@Z @ 12873 NONAME ; void QS60MainAppUi::SetFadedL(int) + ?Exit@QS60MainAppUi@@UAEXXZ @ 12874 NONAME ; void QS60MainAppUi::Exit(void) + ?ProcessCommandL@QS60MainAppUi@@UAEXH@Z @ 12875 NONAME ; void QS60MainAppUi::ProcessCommandL(int) + ?OpenFileL@QS60MainDocument@@UAEXAAPAVCFileStore@@AAVRFile@@@Z @ 12876 NONAME ; void QS60MainDocument::OpenFileL(class CFileStore * &, class RFile &) + ?HandleScreenDeviceChangedL@QS60MainAppUi@@MAEXXZ @ 12877 NONAME ; void QS60MainAppUi::HandleScreenDeviceChangedL(void) + ?PreDocConstructL@QS60MainApplication@@UAEXXZ @ 12878 NONAME ; void QS60MainApplication::PreDocConstructL(void) + ?NewAppServerL@QS60MainApplication@@UAEXAAPAVCApaAppServer@@@Z @ 12879 NONAME ; void QS60MainApplication::NewAppServerL(class CApaAppServer * &) + ?HandleViewDeactivation@QS60MainAppUi@@UAEXABVTVwsViewId@@0@Z @ 12880 NONAME ; void QS60MainAppUi::HandleViewDeactivation(class TVwsViewId const &, class TVwsViewId const &) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 5e46a25..018cba2 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12020,28 +12020,68 @@ EXPORTS _ZN10QImageData14convertInPlaceEN6QImage6FormatE6QFlagsIN2Qt19ImageConversionFlagEE @ 12019 NONAME _ZN17QRasterPixmapData20createPixmapForImageER6QImage6QFlagsIN2Qt19ImageConversionFlagEEb @ 12020 NONAME _ZN17QRasterPixmapData8fromDataEPKhjPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 12021 NONAME - _ZN13QS60MainAppUi11HandleErrorEiRK14SExtendedErrorR6TDes16S4_ @ 12022 NONAME - _ZN13QS60MainAppUi13PrepareToExitEv @ 12023 NONAME - _ZN13QS60MainAppUi15MopSupplyObjectE8TTypeUid @ 12024 NONAME - _ZN13QS60MainAppUi15ProcessCommandLEi @ 12025 NONAME - _ZN13QS60MainAppUi18HandleSystemEventLERK8TWsEvent @ 12026 NONAME - _ZN13QS60MainAppUi19Reserved_MtsmObjectEv @ 12027 NONAME - _ZN13QS60MainAppUi21Reserved_MtsmPositionEv @ 12028 NONAME - _ZN13QS60MainAppUi22HandleForegroundEventLEi @ 12029 NONAME - _ZN13QS60MainAppUi22HandleViewDeactivationERK10TVwsViewIdS2_ @ 12030 NONAME - _ZN13QS60MainAppUi25HandleTouchPaneSizeChangeEv @ 12031 NONAME - _ZN13QS60MainAppUi26HandleScreenDeviceChangedLEv @ 12032 NONAME - _ZN13QS60MainAppUi31HandleApplicationSpecificEventLEiRK8TWsEvent @ 12033 NONAME - _ZN13QS60MainAppUi4ExitEv @ 12034 NONAME - _ZN13QS60MainAppUi9SetFadedLEi @ 12035 NONAME - _ZN16QS60MainDocument9OpenFileLERP10CFileStoreR5RFile @ 12036 NONAME - _ZN16QS60MainDocument9OpenFileLEiRK7TDesC16R3RFs @ 12037 NONAME - _ZN19QS60MainApplication13NewAppServerLERP13CApaAppServer @ 12038 NONAME - _ZN19QS60MainApplication16PreDocConstructLEv @ 12039 NONAME - _ZNK13QS60MainAppUi15ApplicationRectEv @ 12040 NONAME - _ZNK19QS60MainApplication13OpenIniFileLCER3RFs @ 12041 NONAME - _ZThn100_N13QS60MainAppUi25HandleTouchPaneSizeChangeEv @ 12042 NONAME - _ZThn24_N13QS60MainAppUi15ProcessCommandLEi @ 12043 NONAME - _ZThn40_N13QS60MainAppUi15MopSupplyObjectE8TTypeUid @ 12044 NONAME - _ZThn92_N13QS60MainAppUi22HandleViewDeactivationERK10TVwsViewIdS2_ @ 12045 NONAME + _ZN15QGraphicsSystem16createPixmapDataEP11QPixmapData @ 12022 NONAME + _ZN17QRasterPixmapData4copyEPK11QPixmapDataRK5QRect @ 12023 NONAME + _ZNK11QPixmapData7toImageERK5QRect @ 12024 NONAME + _ZNK17QRasterPixmapData7toImageERK5QRect @ 12025 NONAME + _ZTV15QGraphicsSystem @ 12026 NONAME + _ZN11QPixmapData15fromImageReaderEP12QImageReader6QFlagsIN2Qt19ImageConversionFlagEE @ 12027 NONAME + _ZN17QRasterPixmapData15fromImageReaderEP12QImageReader6QFlagsIN2Qt19ImageConversionFlagEE @ 12028 NONAME + _ZN18QRuntimePixmapData12readBackInfoEv @ 12029 NONAME + _ZN18QRuntimePixmapData12toNativeTypeEN11QPixmapData10NativeTypeE @ 12030 NONAME + _ZN18QRuntimePixmapData14fromNativeTypeEPvN11QPixmapData10NativeTypeE @ 12031 NONAME + _ZN18QRuntimePixmapData15setAlphaChannelERK7QPixmap @ 12032 NONAME + _ZN18QRuntimePixmapData4copyEPK11QPixmapDataRK5QRect @ 12033 NONAME + _ZN18QRuntimePixmapData4fillERK6QColor @ 12034 NONAME + _ZN18QRuntimePixmapData6bufferEv @ 12035 NONAME + _ZN18QRuntimePixmapData6resizeEii @ 12036 NONAME + _ZN18QRuntimePixmapData6scrollEiiRK5QRect @ 12037 NONAME + _ZN18QRuntimePixmapData7setMaskERK7QBitmap @ 12038 NONAME + _ZN18QRuntimePixmapData8fromDataEPKhjPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 12039 NONAME + _ZN18QRuntimePixmapData8fromFileERK7QStringPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 12040 NONAME + _ZN18QRuntimePixmapData9fromImageERK6QImage6QFlagsIN2Qt19ImageConversionFlagEE @ 12041 NONAME + _ZN18QRuntimePixmapDataC1EPK22QRuntimeGraphicsSystemN11QPixmapData9PixelTypeE @ 12042 NONAME + _ZN18QRuntimePixmapDataC2EPK22QRuntimeGraphicsSystemN11QPixmapData9PixelTypeE @ 12043 NONAME + _ZN18QRuntimePixmapDataD0Ev @ 12044 NONAME + _ZN18QRuntimePixmapDataD1Ev @ 12045 NONAME + _ZN18QRuntimePixmapDataD2Ev @ 12046 NONAME + _ZN7QPixmap15fromImageReaderEP12QImageReader6QFlagsIN2Qt19ImageConversionFlagEE @ 12047 NONAME + _ZNK18QRuntimePixmapData11memoryUsageEv @ 12048 NONAME + _ZNK18QRuntimePixmapData11paintEngineEv @ 12049 NONAME + _ZNK18QRuntimePixmapData11runtimeDataEv @ 12050 NONAME + _ZNK18QRuntimePixmapData11transformedERK10QTransformN2Qt18TransformationModeE @ 12051 NONAME + _ZNK18QRuntimePixmapData12alphaChannelEv @ 12052 NONAME + _ZNK18QRuntimePixmapData15hasAlphaChannelEv @ 12053 NONAME + _ZNK18QRuntimePixmapData26createCompatiblePixmapDataEv @ 12054 NONAME + _ZNK18QRuntimePixmapData4maskEv @ 12055 NONAME + _ZNK18QRuntimePixmapData6metricEN12QPaintDevice17PaintDeviceMetricE @ 12056 NONAME + _ZNK18QRuntimePixmapData7toImageEv @ 12057 NONAME + _ZTI18QRuntimePixmapData @ 12058 NONAME + _ZTV18QRuntimePixmapData @ 12059 NONAME + _ZN11QEglContext21swapBuffersRegion2NOKEiPK7QRegion @ 12060 NONAME + _ZN4QEgl24eglSwapBuffersRegion2NOKEiiiPKi @ 12061 NONAME + _ZN13QS60MainAppUi11HandleErrorEiRK14SExtendedErrorR6TDes16S4_ @ 12062 NONAME + _ZN13QS60MainAppUi13PrepareToExitEv @ 12063 NONAME + _ZN13QS60MainAppUi15MopSupplyObjectE8TTypeUid @ 12064 NONAME + _ZN13QS60MainAppUi15ProcessCommandLEi @ 12065 NONAME + _ZN13QS60MainAppUi18HandleSystemEventLERK8TWsEvent @ 12066 NONAME + _ZN13QS60MainAppUi19Reserved_MtsmObjectEv @ 12067 NONAME + _ZN13QS60MainAppUi21Reserved_MtsmPositionEv @ 12068 NONAME + _ZN13QS60MainAppUi22HandleForegroundEventLEi @ 12069 NONAME + _ZN13QS60MainAppUi22HandleViewDeactivationERK10TVwsViewIdS2_ @ 12070 NONAME + _ZN13QS60MainAppUi25HandleTouchPaneSizeChangeEv @ 12071 NONAME + _ZN13QS60MainAppUi26HandleScreenDeviceChangedLEv @ 12072 NONAME + _ZN13QS60MainAppUi31HandleApplicationSpecificEventLEiRK8TWsEvent @ 12073 NONAME + _ZN13QS60MainAppUi4ExitEv @ 12074 NONAME + _ZN13QS60MainAppUi9SetFadedLEi @ 12075 NONAME + _ZN16QS60MainDocument9OpenFileLERP10CFileStoreR5RFile @ 12076 NONAME + _ZN16QS60MainDocument9OpenFileLEiRK7TDesC16R3RFs @ 12077 NONAME + _ZN19QS60MainApplication13NewAppServerLERP13CApaAppServer @ 12078 NONAME + _ZN19QS60MainApplication16PreDocConstructLEv @ 12079 NONAME + _ZNK13QS60MainAppUi15ApplicationRectEv @ 12080 NONAME + _ZNK19QS60MainApplication13OpenIniFileLCER3RFs @ 12081 NONAME + _ZThn100_N13QS60MainAppUi25HandleTouchPaneSizeChangeEv @ 12082 NONAME + _ZThn24_N13QS60MainAppUi15ProcessCommandLEi @ 12083 NONAME + _ZThn40_N13QS60MainAppUi15MopSupplyObjectE8TTypeUid @ 12084 NONAME + _ZThn92_N13QS60MainAppUi22HandleViewDeactivationERK10TVwsViewIdS2_ @ 12085 NONAME -- cgit v0.12 From 906b3bfd27ba87b5b09899345e7484ecab7ab022 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 2 Jul 2010 10:51:51 +0200 Subject: Designer: Fix compiler warnings. Warnings introduced by 312c028d44a80f5d6029eb166a0de731f8452525 and gcc 4.5. Reviewed-by: Christian Kandeler --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 1 + tools/designer/src/components/buddyeditor/buddyeditor.cpp | 1 + tools/designer/src/components/formeditor/qmdiarea_container.cpp | 1 + tools/designer/src/lib/shared/qdesigner_menu.cpp | 8 +++++--- tools/designer/src/lib/shared/qdesigner_toolbar.cpp | 1 + 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 9a17d78..4abffc6 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -347,6 +347,7 @@ void QDeclarativeContents::complete() void QDeclarativeContents::itemGeometryChanged(QDeclarativeItem *changed, const QRectF &newGeometry, const QRectF &oldGeometry) { + Q_UNUSED(changed) //### we can only pass changed if the left edge has moved left, or the right edge has moved right if (newGeometry.width() != oldGeometry.width() || newGeometry.x() != oldGeometry.x()) calcWidth(/*changed*/); diff --git a/tools/designer/src/components/buddyeditor/buddyeditor.cpp b/tools/designer/src/components/buddyeditor/buddyeditor.cpp index 9da257e..e367f9a 100644 --- a/tools/designer/src/components/buddyeditor/buddyeditor.cpp +++ b/tools/designer/src/components/buddyeditor/buddyeditor.cpp @@ -405,6 +405,7 @@ QWidget *BuddyEditor::findBuddy(QLabel *l, const QWidgetList &existingBuddies) c const int y = geom.center().y(); QWidget *neighbour = 0; switch (l->layoutDirection()) { + case Qt::LayoutDirectionAuto: case Qt::LeftToRight: { // Walk right to find next managed neighbour const int xEnd = parent->size().width(); for (int x = geom.right() + 1; x < xEnd; x += DeltaX) diff --git a/tools/designer/src/components/formeditor/qmdiarea_container.cpp b/tools/designer/src/components/formeditor/qmdiarea_container.cpp index 5971094..5e266f4 100644 --- a/tools/designer/src/components/formeditor/qmdiarea_container.cpp +++ b/tools/designer/src/components/formeditor/qmdiarea_container.cpp @@ -105,6 +105,7 @@ void QMdiAreaContainer::positionNewMdiChild(const QWidget *area, QWidget *mdiChi const QPoint pos = mdiChild->pos(); const QSize areaSize = area->size(); switch (QApplication::layoutDirection()) { + case Qt::LayoutDirectionAuto: case Qt::LeftToRight: { const QSize fullSize = QSize(areaSize.width() - pos.x(), areaSize.height() - pos.y()); if (fullSize.width() > MinSize && fullSize.height() > MinSize) diff --git a/tools/designer/src/lib/shared/qdesigner_menu.cpp b/tools/designer/src/lib/shared/qdesigner_menu.cpp index ba512e4..31a226a 100644 --- a/tools/designer/src/lib/shared/qdesigner_menu.cpp +++ b/tools/designer/src/lib/shared/qdesigner_menu.cpp @@ -77,6 +77,7 @@ using namespace qdesigner_internal; static inline void extendClickableArea(QRect *subMenuRect, Qt::LayoutDirection dir) { switch (dir) { + case Qt::LayoutDirectionAuto: // Should never happen case Qt::LeftToRight: subMenuRect->setLeft(subMenuRect->left() - 20); break; @@ -931,8 +932,8 @@ void QDesignerMenu::moveUp(bool ctrl) if (ctrl) (void) swap(m_currentIndex, m_currentIndex - 1); - - m_currentIndex = qMax(0, --m_currentIndex); + --m_currentIndex; + m_currentIndex = qMax(0, m_currentIndex); // Always re-select, swapping destroys order update(); selectCurrentAction(); @@ -947,7 +948,8 @@ void QDesignerMenu::moveDown(bool ctrl) if (ctrl) (void) swap(m_currentIndex + 1, m_currentIndex); - m_currentIndex = qMin(actions().count() - 1, ++m_currentIndex); + ++m_currentIndex; + m_currentIndex = qMin(actions().count() - 1, m_currentIndex); update(); if (!ctrl) selectCurrentAction(); diff --git a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp index 02a2f6d..e3bc64c 100644 --- a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp +++ b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp @@ -467,6 +467,7 @@ QRect ToolBarEventFilter::freeArea(const QToolBar *tb) switch (tb->orientation()) { case Qt::Horizontal: switch (tb->layoutDirection()) { + case Qt::LayoutDirectionAuto: // Should never happen case Qt::LeftToRight: rc.setX(exclusionRectangle.right() + 1); break; -- cgit v0.12 From 6b63f3e6b3b38822115a06b5229f4b006c9eb290 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 2 Jul 2010 11:25:46 +0200 Subject: qdoc: Fixed spacing before "default" and "read-only". Task-number: QTBUG-11346 --- doc/src/template/style/style.css | 2 ++ tools/qdoc3/htmlgenerator.cpp | 13 ++++++------- tools/qdoc3/test/style/style.css | 2 ++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index f1a63a9..b174622 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -829,12 +829,14 @@ } .qmlreadonly { + padding-left: 5px; float: right; color: #254117; } .qmldefault { + padding-left: 5px; float: right; color: red; } diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 9f745c5..e1916b4 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4464,14 +4464,13 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, while (p != qpgn->childNodes().end()) { if ((*p)->type() == Node::QmlProperty) { qpn = static_cast(*p); - - if (++numTableRows % 2 == 1) - out() << "
    "; - else - out() << ""; + if (++numTableRows % 2 == 1) + out() << ""; + else + out() << ""; - out() << "

    "; - //out() << "

    "; // old + out() << "

    "; + out() << ""; if (!qpn->isWritable()) out() << "read-only"; diff --git a/tools/qdoc3/test/style/style.css b/tools/qdoc3/test/style/style.css index 9c290f5..dff0772 100644 --- a/tools/qdoc3/test/style/style.css +++ b/tools/qdoc3/test/style/style.css @@ -776,12 +776,14 @@ } .qmlreadonly { + padding-left: 3px; float: right; color: #254117; } .qmldefault { + padding-left: 3px; float: right; color: red; } -- cgit v0.12 From 62db6c18c7f1f60819783ed5e1340e9fc09e072e Mon Sep 17 00:00:00 2001 From: mae Date: Fri, 2 Jul 2010 13:07:36 +0200 Subject: Fix exponential behavior of QTextCursor::removeSelectedText removeSelectedText adjusts all other cursors for every fragment and block which gets removed. This becomes (for reasons yet to be understood) exponential with loads of cursors (something creator has for the semantic highlighting). Done-with: Roberto Raggi Reviewed-by: Simon Hausmann --- src/gui/text/qtextdocument_p.cpp | 7 +++++++ src/gui/text/qtextdocument_p.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index f3cd481..a55e5f3 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -205,6 +205,7 @@ QTextDocumentPrivate::QTextDocumentPrivate() undoEnabled = true; inContentsChange = false; + inRemove = false; defaultTextOption.setTabStop(80); // same as in qtextengine.cpp defaultTextOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); @@ -669,7 +670,10 @@ void QTextDocumentPrivate::remove(int pos, int length, QTextUndoCommand::Operati { if (length == 0) return; + inRemove = true; move(pos, -1, length, op); + inRemove = false; + adjustDocumentChangesAndCursors(pos, -length, op); } void QTextDocumentPrivate::setCharFormat(int pos, int length, const QTextCharFormat &newFormat, FormatChangeMode mode) @@ -1263,6 +1267,9 @@ void QTextDocumentPrivate::documentChange(int from, int length) */ void QTextDocumentPrivate::adjustDocumentChangesAndCursors(int from, int addedOrRemoved, QTextUndoCommand::Operation op) { + if (inRemove) // postpone, will be called again from QTextDocumentPrivate::remove() + return; + if (!editBlock) ++revision; diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index d1bd698..06e0753 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -346,6 +346,7 @@ public: int maximumBlockCount; uint needsEnsureMaximumBlockCount : 1; uint inContentsChange : 1; + uint inRemove : 1; QSizeF pageSize; QString title; QString url; -- cgit v0.12 From 6fd1da7a672532c53eb55b3e2467332d28df5943 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 2 Jul 2010 14:20:09 +0300 Subject: Support for "deploy" make target in Symbian Executing "make deploy" will recreate project sis file and deploy it into a device. Task-number: QTBUG-5155 Reviewed-by: axis --- doc/src/platforms/symbian-introduction.qdoc | 11 ++++++----- doc/src/snippets/code/doc_src_symbian-introduction.qdoc | 3 +-- mkspecs/features/sis_targets.prf | 10 ++++++++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 1b3641d..22d858f 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -112,6 +112,7 @@ \row \o \c release-armv5 \o Build release binaries for hardware using RVCT. \row \o \c run \o Run the application on the emulator. \row \o \c runonphone \o Run the application on a device. + \row \o \c deploy \o Deploys the project into a device. \row \o \c sis \o Create signed \c .sis file for project. \row \o \c unsigned_sis \o Create unsigned \c .sis file for project. \row \o \c installer_sis \o Create signed \l{Smart Installer}{smart installer} @@ -172,7 +173,7 @@ By default empty. \endtable - The suppported options for \c QT_SIS_OPTIONS: + The supported options for \c QT_SIS_OPTIONS: \target Supported options for QT_SIS_OPTIONS \table @@ -186,7 +187,7 @@ \endtable Execute the \c{createpackage.pl} script without any - parameters for detailed information about options. By default no otions are given. + parameters for detailed information about options. By default no options are given. For example: @@ -196,9 +197,9 @@ \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 3 - If you want to install the program immediately, make sure that the device - is connected to the computer in "PC Suite" mode, and run \c sis target - with the \c QT_SIS_OPTIONS=-i, like this: + If you want to install the program immediately after creating \c .sis file, + make sure that the device is connected to the computer in "PC Suite" mode, + and use \c deploy target instead of \c sis target: \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 5 diff --git a/doc/src/snippets/code/doc_src_symbian-introduction.qdoc b/doc/src/snippets/code/doc_src_symbian-introduction.qdoc index 60c69c0..a2ea686 100644 --- a/doc/src/snippets/code/doc_src_symbian-introduction.qdoc +++ b/doc/src/snippets/code/doc_src_symbian-introduction.qdoc @@ -63,6 +63,5 @@ //! [4] //! [5] - set QT_SIS_OPTIONS=-i - make sis + make deploy //! [5] diff --git a/mkspecs/features/sis_targets.prf b/mkspecs/features/sis_targets.prf index c31e38f..19972d7 100644 --- a/mkspecs/features/sis_targets.prf +++ b/mkspecs/features/sis_targets.prf @@ -159,6 +159,16 @@ equals(GENERATE_SIS_TARGETS, true) { QMAKE_DISTCLEAN += $${sis_destdir}/$${baseTarget}.sis } + + deploy_target.target = deploy + contains(QMAKE_HOST.os, "Windows") { + deploy_target.depends = sis + deploy_target.commands = call $$target_sis_target.target + } else { + deploy_target.commands = @echo Deployment not supported in this environment + } + QMAKE_EXTRA_TARGETS += deploy_target + } else { contains(TEMPLATE, subdirs) { # Enable recursive sis target. -- cgit v0.12 From e5bd34ac642bf7665f618e5e2ce5f62cfb29fb73 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 2 Jul 2010 15:30:41 +0300 Subject: ColorDialog is incorrectly positioned Due to somewhat special nature of colorDialog, it makes no sense to make it fullscreen, as it is not totally stretchable in height. Making it fullscreen only makes it appear higher on the screen and there is an ugly gap between the dialog and softkeys. Therefore, as a fix, colorDialog is shown in its "natural" window state. Task-number: QTBUG-11668 Reviewed-by: Miikka Heikkinen --- src/gui/dialogs/qdialog.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index ce84aa6..9e0437c 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -67,7 +67,6 @@ extern bool qt_wince_is_smartphone(); //is defined in qguifunctions_wce.cpp #elif defined(Q_OS_SYMBIAN) # include "qfiledialog.h" # include "qfontdialog.h" -# include "qcolordialog.h" # include "qwizard.h" # include "private/qt_s60_p.h" #endif @@ -532,7 +531,7 @@ int QDialog::exec() bool showSystemDialogFullScreen = false; #ifdef Q_OS_SYMBIAN if (qobject_cast(this) || qobject_cast(this) || - qobject_cast(this) || qobject_cast(this)) { + qobject_cast(this)) { showSystemDialogFullScreen = true; } #endif // Q_OS_SYMBIAN -- cgit v0.12 From e9a314d6734972254f52b64da77d4c5d8762517a Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Fri, 2 Jul 2010 14:37:18 +0200 Subject: Don't do alpha/opaque check which might cause a conversion and later pointer not-matching. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 724 Reviewed-by: Samuel Rødal --- src/gui/painting/qgraphicssystem_runtime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 1c3ae10..3438137 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -418,7 +418,7 @@ void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name) QRuntimePixmapData *proxy = m_pixmapDatas.at(i); QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data); // ### TODO Optimize. Openvg and s60raster graphics systems could switch internal ARGB32_PRE QImage buffers. - newData->fromImage(proxy->m_data->toImage(), Qt::AutoColor | Qt::OrderedAlphaDither); + newData->fromImage(proxy->m_data->toImage(), Qt::NoOpaqueDetection); delete proxy->m_data; proxy->m_data = newData; proxy->readBackInfo(); -- cgit v0.12 From 844832295daa5e515298142892ed9957ce7659a3 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 2 Jul 2010 15:40:06 +0300 Subject: QS60Style: Remove gap from QProgressDialog When showing a progressDialog with QS60Style, there is a strange empty area after the QProgressbar. This is reserved for label even if it is not showing one. Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 45bcc00..7af0224 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -3116,6 +3116,11 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con case SE_CheckBoxFocusRect: ret = opt->rect; break; + case SE_ProgressBarLabel: + case SE_ProgressBarContents: + case SE_ProgressBarGroove: + ret = opt->rect; + break; default: ret = QCommonStyle::subElementRect(element, opt, widget); } -- cgit v0.12 From 6a405778ca053d05d32ea8e0949bee917c0316e2 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 2 Jul 2010 14:38:33 +0200 Subject: Crash when dragging with mingw The problem was that there was a misalignment coming from the d&d code. That called in the end our SSE optimized functions. This code turns out to be calling QApplication::processEvents which in the the calls the Qt event dispatcher for windows' processEvents function. This function will now also always align the stack to 16 bytes and be SSE ready. Task-number: QTBUG-11880 Reviewed-by: Zeno Albisser --- src/corelib/global/qglobal.h | 5 +++-- src/corelib/kernel/qeventdispatcher_win_p.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 76f35ac..8a3166d 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1066,10 +1066,11 @@ redefine to built-in booleans to make autotests work properly */ //the alignment needs to be forced for sse2 to not crash with mingw #if defined(Q_WS_WIN) # if defined(Q_CC_MINGW) -# define QT_WIN_CALLBACK CALLBACK __attribute__ ((force_align_arg_pointer)) +# define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer)) # else -# define QT_WIN_CALLBACK CALLBACK +# define QT_ENSURE_STACK_ALIGNED_FOR_SSE # endif +# define QT_WIN_CALLBACK CALLBACK QT_ENSURE_STACK_ALIGNED_FOR_SSE #endif typedef int QNoImplicitBoolCast; diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index 788cc44..b219841 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -76,7 +76,7 @@ public: explicit QEventDispatcherWin32(QObject *parent = 0); ~QEventDispatcherWin32(); - bool processEvents(QEventLoop::ProcessEventsFlags flags); + bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags); bool hasPendingEvents(); void registerSocketNotifier(QSocketNotifier *notifier); -- cgit v0.12 From a4afd05595ee15e128a8c4fdb96713bb9aa16d81 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 2 Jul 2010 15:49:02 +0300 Subject: QS60Style: Simplify QMenu drawing This cleans up implementation of menu item drawing and "fixes" it, by moving the rect calculations to occur in subElementRect() method, instead of in the drawing code itself. Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 67 +++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 7af0224..e28403b 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1765,52 +1765,31 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); - //todo: move the vertical spacing stuff into subElementRect - const int vSpacing = QS60StylePrivate::pixelMetric(PM_LayoutVerticalSpacing); QStyleOptionMenuItem optionCheckBox; //Regardless of checkbox visibility, make room for it, this mirrors native implementation, //where text and icon placement is static regardless of content of menu item. - const int hSpacing = QS60StylePrivate::pixelMetric(PM_LayoutHorizontalSpacing); optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem); optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth)); optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight)); + + const int vSpacing = QS60StylePrivate::pixelMetric(PM_LayoutVerticalSpacing); + //The vertical spacing is doubled; it needs one spacing to separate checkbox from + //highlight and then it needs one to separate it whatever is shown after it (text/icon/both). + const int moveByX = optionCheckBox.rect.width() + 2 * vSpacing; optionCheckBox.rect.moveCenter(QPoint( - optionCheckBox.rect.center().x(), + optionCheckBox.rect.center().x() + moveByX >> 1, menuItem->rect.center().y())); - const int moveByX = optionCheckBox.rect.width() + vSpacing + - pixelMetric(PM_DefaultFrameWidth); - if (optionMenuItem.direction == Qt::LeftToRight) { - if (iconRect.isValid()) { - iconRect.translate(moveByX, 0); - iconRect.setWidth(iconRect.width() + vSpacing); - } - if (textRect.isValid()) { - textRect.translate(moveByX, 0); - textRect.setWidth(textRect.width() - moveByX - vSpacing); - } - optionCheckBox.rect.translate(vSpacing + pixelMetric(PM_DefaultFrameWidth), hSpacing >> 1); - } else { - if (textRect.isValid()) - textRect.setWidth(textRect.width() - moveByX); - if (iconRect.isValid()) { - iconRect.setWidth(iconRect.width() + vSpacing); - iconRect.translate(-optionCheckBox.rect.width() - vSpacing, 0); - } + + if (optionMenuItem.direction != Qt::LeftToRight) optionCheckBox.rect.translate(textRect.width() + iconRect.width(), 0); - } + const bool selected = (option->state & State_Selected) && (option->state & State_Enabled); if (selected) { - const int spacing = pixelMetric(PM_DefaultFrameWidth) * 2; - int start; int end; - if (QApplication::layoutDirection() == Qt::LeftToRight) { - start = optionMenuItem.rect.left() + spacing; - end = qMax(textRect.right(), iconRect.right() + spacing); - } else { - start = qMax(spacing, qMin(textRect.left(), iconRect.left() - spacing)); - end = optionMenuItem.rect.right() - spacing; - } + const int spacing = ignoreCheckMark ? (vSpacing + QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth)) : 0; + const int start = optionMenuItem.rect.left() + spacing; + const int end = optionMenuItem.rect.right() - spacing; //-1 adjustment to avoid highlight being on top of possible separator item const QRect highlightRect = QRect( QPoint(start, option->rect.top()), @@ -3025,20 +3004,38 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con pixelMetric(PM_SmallIconSize, opt, widget); ret = menuItem->rect; + QRect checkBoxRect = checkable ? menuItem->rect : QRect(); + if (checkable) { + checkBoxRect.setWidth(pixelMetric(PM_IndicatorWidth)); + checkBoxRect.setHeight(pixelMetric(PM_IndicatorHeight)); + } + + const int vSpacing = QS60StylePrivate::pixelMetric(PM_LayoutVerticalSpacing); + //The vertical spacing is doubled; it needs one spacing to separate checkbox from + //highlight and then it needs one to separate it whatever is shown after it (text/icon/both). + const int moveByX = checkBoxRect.width() + 2 * vSpacing; + if (element == SE_ItemViewItemDecoration) { if (menuItem->icon.isNull()) { ret = QRect(); } else { if (menuItem->direction == Qt::RightToLeft) - ret.translate(ret.width() - indicatorWidth, 0); + ret.translate(ret.width() - indicatorWidth - moveByX, 0); + else + ret.translate(moveByX, 0); ret.setWidth(indicatorWidth); } } else { - if (!menuItem->icon.isNull()) + if (!menuItem->icon.isNull()) { if (menuItem->direction == Qt::LeftToRight) ret.adjust(indicatorWidth, 0, 0, 0); else ret.adjust(0, 0, -indicatorWidth, 0); + } + if (menuItem->direction == Qt::LeftToRight) + ret.adjust(moveByX, 0, 0, 0); + else + ret.adjust(0, 0, -moveByX, 0); // Make room for submenu indicator if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu){ -- cgit v0.12 From f9dfd989197826c88f4d40e232fbbb040250f56f Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 1 Jul 2010 16:37:58 +0200 Subject: Added a top-level runonphone target for Qt and QtWebKit. RevBy: Trust me --- src/src.pro | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/src.pro b/src/src.pro index 0573c2d..9704716 100644 --- a/src/src.pro +++ b/src/src.pro @@ -187,4 +187,15 @@ debug.depends = $$EXTRA_DEBUG_TARGETS release.depends = $$EXTRA_RELEASE_TARGETS QMAKE_EXTRA_TARGETS += debug release +# This gives us a top-level runonphone target, which installs Qt and optionally QtWebKit. +contains(CONFIG, run_on_phone) { + src_runonphone_target.target = runonphone + src_runonphone_target.commands = $(MAKE) -C $$QT_BUILD_TREE/src/s60installs runonphone + src_runonphone_target.depends = first + contains(QT_CONFIG, webkit) { + src_runonphone_target.commands += && $(MAKE) -C $$QT_BUILD_TREE/src/3rdparty/webkit/WebCore runonphone + } + QMAKE_EXTRA_TARGETS += src_runonphone_target +} + SUBDIRS += $$SRC_SUBDIRS -- cgit v0.12 From e4616afabbdccdbd6f53e5c96086bd4065af9227 Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 1 Jul 2010 16:40:11 +0200 Subject: Fixed deployment locations for various profiles. RevBy: Trust me --- demos/declarative/minehunt/minehunt.pro | 2 +- demos/spectrum/app/app.pro | 2 +- src/imports/folderlistmodel/folderlistmodel.pro | 3 ++- src/imports/gestures/gestures.pro | 3 ++- src/imports/particles/particles.pro | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro index aac91f6..f85afeb 100644 --- a/demos/declarative/minehunt/minehunt.pro +++ b/demos/declarative/minehunt/minehunt.pro @@ -27,7 +27,7 @@ symbian:{ TARGET.EPOCALLOWDLLDATA = 1 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) TARGET.CAPABILITY = NetworkServices ReadUserData - importFiles.sources = qmlminehuntplugin.dll \ + importFiles.sources = MinehuntCore/qmlminehuntplugin.dll \ MinehuntCore/Explosion.qml \ MinehuntCore/pics \ MinehuntCore/qmldir diff --git a/demos/spectrum/app/app.pro b/demos/spectrum/app/app.pro index c15edf9..ebeef87 100644 --- a/demos/spectrum/app/app.pro +++ b/demos/spectrum/app/app.pro @@ -86,7 +86,7 @@ symbian { !contains(DEFINES, DISABLE_FFT) { # Include FFTReal DLL in the SIS file - fftreal.sources = $${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/fftreal.dll + fftreal.sources = ../3rdparty/fftreal/fftreal.dll fftreal.path = !:/sys/bin DEPLOYMENT += fftreal } diff --git a/src/imports/folderlistmodel/folderlistmodel.pro b/src/imports/folderlistmodel/folderlistmodel.pro index 49a6baa..c306037 100644 --- a/src/imports/folderlistmodel/folderlistmodel.pro +++ b/src/imports/folderlistmodel/folderlistmodel.pro @@ -8,6 +8,7 @@ SOURCES += qdeclarativefolderlistmodel.cpp plugin.cpp HEADERS += qdeclarativefolderlistmodel.h QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH +else:DESTDIR = . target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH qmldir.files += $$PWD/qmldir @@ -17,7 +18,7 @@ symbian:{ TARGET.UID3 = 0x20021320 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = qmlfolderlistmodelplugin.dll qmldir + importFiles.sources = $$DESTDIR/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/gestures/gestures.pro b/src/imports/gestures/gestures.pro index 265bbca..8a772da 100644 --- a/src/imports/gestures/gestures.pro +++ b/src/imports/gestures/gestures.pro @@ -8,6 +8,7 @@ SOURCES += qdeclarativegesturearea.cpp plugin.cpp HEADERS += qdeclarativegesturearea_p.h QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH +else:DESTDIR = . target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH qmldir.files += $$PWD/qmldir @@ -17,7 +18,7 @@ symbian:{ TARGET.UID3 = 0x2002131F include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = qmlgesturesplugin.dll qmldir + importFiles.sources = $$DESTDIR/qmlgesturesplugin$${QT_LIBINFIX}.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro index 91c1b9f..68462e7 100644 --- a/src/imports/particles/particles.pro +++ b/src/imports/particles/particles.pro @@ -12,6 +12,7 @@ HEADERS += \ qdeclarativeparticles_p.h QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH +else:DESTDIR = . target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH qmldir.files += $$PWD/qmldir @@ -21,7 +22,7 @@ symbian:{ TARGET.UID3 = 0x2002131E include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = qmlparticlesplugin.dll qmldir + importFiles.sources = $$DESTDIR/qmlparticlesplugin$${QT_LIBINFIX}.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles -- cgit v0.12 From ad82e439c735912d069a2cf456b04e3d10016e84 Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 1 Jul 2010 17:09:43 +0200 Subject: Fixed symbian/linux-armcc mkspec when configured with -qtlibinfix. Task: QTBUG-11396 RevBy: Miikka Heikkinen --- configure | 7 +++++++ mkspecs/features/symbian/def_files.prf | 18 +++++++++++------- mkspecs/features/symbian/symbian_building.prf | 8 ++++++-- src/corelib/corelib.pro | 2 +- src/gui/gui.pro | 2 +- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 4650229..01040e3 100755 --- a/configure +++ b/configure @@ -7627,6 +7627,13 @@ cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF EOF fi +if [ -n "$QT_LIBINFIX" ]; then +cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF +#define QT_LIBINFIX "$QT_LIBINFIX" + +EOF +fi + # avoid unecessary rebuilds by copying only if qconfig.h has changed if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then rm -f "$outpath/src/corelib/global/qconfig.h.new" diff --git a/mkspecs/features/symbian/def_files.prf b/mkspecs/features/symbian/def_files.prf index bae9d2d..f243878 100644 --- a/mkspecs/features/symbian/def_files.prf +++ b/mkspecs/features/symbian/def_files.prf @@ -3,6 +3,10 @@ CONFIG -= def_files_disabled +# We need a target name without the INFIX'ed part, since DEF files are not infixed. +equals(QMAKE_TARGET_PRODUCT, Qt4):clean_TARGET = $$replace(TARGET, "$${QT_LIBINFIX}$", "") +else:clean_TARGET = $$TARGET + symbian-abld|symbian-sbsv2 { # Firstly, if the MMP_RULES already contain a defBlock variable, don't generate another one # (this bit is slightly magic, because it depends upon everyone creating their DEFFILE statements @@ -17,25 +21,25 @@ symbian-abld|symbian-sbsv2 { !isEmpty(DEF_FILE) { defBlock = \ "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE $$DEF_FILE/bwins/$${TARGET}.def" \ + "DEFFILE $$DEF_FILE/bwins/$${clean_TARGET}.def" \ "$${LITERAL_HASH}elif defined EABI" \ - "DEFFILE $$DEF_FILE/eabi/$${TARGET}.def" \ + "DEFFILE $$DEF_FILE/eabi/$${clean_TARGET}.def" \ "$${LITERAL_HASH}endif" } else:!isEmpty(defFilePath) { defBlock = \ "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE $$defFilePath/bwins/$${TARGET}.def" \ + "DEFFILE $$defFilePath/bwins/$${clean_TARGET}.def" \ "$${LITERAL_HASH}elif defined EABI" \ - "DEFFILE $$defFilePath/eabi/$${TARGET}.def" \ + "DEFFILE $$defFilePath/eabi/$${clean_TARGET}.def" \ "$${LITERAL_HASH}endif" } else { # If defFilePath is not defined, then put the folders containing the DEF files at the # same level as the .pro (and generated MMP) file(s) defBlock = \ "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE ./bwins/$${TARGET}.def" \ + "DEFFILE ./bwins/$${clean_TARGET}.def" \ "$${LITERAL_HASH}elif defined EABI" \ - "DEFFILE ./eabi/$${TARGET}.def" \ + "DEFFILE ./eabi/$${clean_TARGET}.def" \ "$${LITERAL_HASH}endif" } MMP_RULES += defBlock @@ -52,7 +56,7 @@ symbian-abld|symbian-sbsv2 { !exists("$$_PRO_FILE_PWD_/$$defFile/eabi") { system("$$QMAKE_MKDIR $$_PRO_FILE_PWD_/$$defFile/eabi") } - elf2e32FileToAdd = $$_PRO_FILE_PWD_/$$defFile/eabi/$$basename(TARGET)u.def + elf2e32FileToAdd = $$_PRO_FILE_PWD_/$$defFile/eabi/$$basename(clean_TARGET)u.def } else { elf2e32FileToAdd = $$_PRO_FILE_PWD_/$$defFile } diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index c4088ca..ce124ec 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -1,7 +1,11 @@ +# We need a target name without the INFIX'ed part, since flags are not infixed. +equals(QMAKE_TARGET_PRODUCT, Qt4):clean_TARGET = $$replace(TARGET, "$${QT_LIBINFIX}$", "") +else:clean_TARGET = $$TARGET + # we have some module specific options (defined in qt.prf) lets add them -!contains(TARGET, ".*[ -/].*"):eval(TMPVAR = \$\$QMAKE_$${TARGET}_CXXFLAGS) +!contains(clean_TARGET, ".*[ -/].*"):eval(TMPVAR = \$\$QMAKE_$${clean_TARGET}_CXXFLAGS) !isEmpty(TMPVAR):QMAKE_CXXFLAGS += $$TMPVAR -!contains(TARGET, ".*[ -/].*"):eval(TMPVAR = \$\$QMAKE_$${TARGET}_LFLAGS) +!contains(clean_TARGET, ".*[ -/].*"):eval(TMPVAR = \$\$QMAKE_$${clean_TARGET}_LFLAGS) !isEmpty(TMPVAR) { QMAKE_LFLAGS += $$TMPVAR } else :linux-gcce { # lets provide a simple default. Without elf2e32 complains diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index e39d326..dba2a42 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -48,7 +48,7 @@ symbian: { pu_header = "; Partial upgrade package for testing QtCore changes without reinstalling everything" \ "$${LITERAL_HASH}{\"Qt corelib\"}, (0x2001E61C), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU" partial_upgrade.pkg_prerules = pu_header vendorinfo - partial_upgrade.sources = $$QMAKE_LIBDIR_QT/QtCore.dll + partial_upgrade.sources = $$QMAKE_LIBDIR_QT/QtCore$${QT_LIBINFIX}.dll partial_upgrade.path = c:/sys/bin DEPLOYMENT = partial_upgrade $$DEPLOYMENT } diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 7f1cb78..dede9d0 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -72,7 +72,7 @@ symbian { pu_header = "; Partial upgrade package for testing QtGui changes without reinstalling everything" \ "$${LITERAL_HASH}{\"Qt gui\"}, (0x2001E61C), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU" partial_upgrade.pkg_prerules = pu_header vendorinfo - partial_upgrade.sources = $$QMAKE_LIBDIR_QT/QtGui.dll + partial_upgrade.sources = $$QMAKE_LIBDIR_QT/QtGui$${QT_LIBINFIX}.dll partial_upgrade.path = c:/sys/bin DEPLOYMENT = partial_upgrade $$DEPLOYMENT } -- cgit v0.12 From 01da612438d988108acfb3aa688226ee56a9bd22 Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 1 Jul 2010 17:10:50 +0200 Subject: Fixed Qt symbian/linux-armcc mkspec when configured with -qtlibinfix. Task: QTBUG-11396 RevBy: Simon Hausmann --- src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro b/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro index 75268f3..526cf06 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro +++ b/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro @@ -30,6 +30,7 @@ symbian: { TARGET.EPOCALLOWDLLDATA=1 TARGET.CAPABILITY = All -Tcb load(armcc_warnings) + TARGET = $$TARGET$${QT_LIBINFIX} } include(../../../WebKit.pri) -- cgit v0.12 From e943add9960ca5708a46938d0dc9fc7cc67bf008 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 2 Jul 2010 10:49:05 +0200 Subject: Hide some more files from git-status. --- demos/.gitignore | 2 ++ demos/spectrum/app/.gitignore | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 demos/.gitignore create mode 100644 demos/spectrum/app/.gitignore diff --git a/demos/.gitignore b/demos/.gitignore new file mode 100644 index 0000000..bc54bd5 --- /dev/null +++ b/demos/.gitignore @@ -0,0 +1,2 @@ +*.dll +*.dso diff --git a/demos/spectrum/app/.gitignore b/demos/spectrum/app/.gitignore new file mode 100644 index 0000000..82cf2a2 --- /dev/null +++ b/demos/spectrum/app/.gitignore @@ -0,0 +1,2 @@ +spectrum +spectrum.exe -- cgit v0.12 From 9951dd835e8c0ccad1a0c92eb2af96f778242fc3 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 2 Jul 2010 16:07:20 +0200 Subject: Updated WebKit to d59845f6fec84f15da116f50a1a0e52ce26116e9 Integrated: || || [Qt] LayoutTests/http/tests/appcache/fallback.html crashes || || || [Qt] TiledBackingStore updates broken when not using resizesToContents mode || --- src/3rdparty/webkit/.tag | 2 +- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 13 +++++++++++++ .../WebCore/platform/network/qt/ResourceHandleQt.cpp | 4 +++- .../webkit/WebCore/platform/qt/QWebPageClient.h | 2 ++ src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp | 2 ++ src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 2 ++ src/3rdparty/webkit/WebKit/qt/ChangeLog | 17 +++++++++++++++++ .../webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 6 +++++- 9 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index c44a95b..0b824b7 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -cd3aee284bddf4ff9d26f3bcaa7c33d478e81e10 +d59845f6fec84f15da116f50a1a0e52ce26116e9 diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index aa574b4..c970745 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - cd3aee284bddf4ff9d26f3bcaa7c33d478e81e10 + d59845f6fec84f15da116f50a1a0e52ce26116e9 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 5ba94de..a4ae758 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2010-03-26 Shu Chang + + Reviewed by Eric Seidel. + + [Qt] Prevent referring d->m_job in the future because calling abort() + deletes the instance itself. + https://bugs.webkit.org/show_bug.cgi?id=36618 + + Test: http/tests/appcache/fallback.html + + * platform/network/qt/ResourceHandleQt.cpp: + (WebCore::ResourceHandle::cancel): + 2010-06-28 Sam Magnuson Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceHandleQt.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceHandleQt.cpp index f006c08..aaa306a 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceHandleQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceHandleQt.cpp @@ -144,8 +144,10 @@ bool ResourceHandle::start(Frame* frame) void ResourceHandle::cancel() { - if (d->m_job) + if (d->m_job) { d->m_job->abort(); + d->m_job = 0; + } } bool ResourceHandle::loadsBlocked() diff --git a/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h b/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h index 8e48d1f..d3978b8 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h @@ -90,6 +90,8 @@ public: virtual QStyle* style() const = 0; virtual QRectF graphicsItemVisibleRect() const { return QRectF(); } + + virtual bool viewResizesToContentsEnabled() const = 0; protected: #ifndef QT_NO_CURSOR diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index c4d240c..b63921b 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -117,6 +117,8 @@ public: virtual QStyle* style() const; + virtual bool viewResizesToContentsEnabled() const { return resizesToContents; } + #if USE(ACCELERATED_COMPOSITING) virtual void setRootGraphicsLayer(QGraphicsItem* layer); virtual void markForSync(bool scheduleSync); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 9a4e9b2..ddfb649 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -233,6 +233,8 @@ public: virtual QStyle* style() const; + virtual bool viewResizesToContentsEnabled() const { return false; } + QWidget* view; }; diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 1eb7b11..9dd129e 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,20 @@ +2010-05-19 Antti Koivisto + + Rubber-stamped by Kenneth Rohde Christiansen. + + [Qt] TiledBackingStore updates broken when not using resizesToContents mode + https://bugs.webkit.org/show_bug.cgi?id=39359 + + Put the back logic that was lost in refactoring. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::visibleRectForTiledBackingStore): + * WebCoreSupport/PageClientQt.cpp: + (WebCore::PageClientQGraphicsWidget::graphicsItemVisibleRect): + * WebCoreSupport/PageClientQt.h: + (WebCore::PageClientQWidget::viewResizesToContentsEnabled): + (WebCore::PageClientQGraphicsWidget::viewResizesToContentsEnabled): + 2010-07-01 Bea Lam Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index e253161..4d4e70e 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -563,8 +563,12 @@ bool ChromeClientQt::allowsAcceleratedCompositing() const #if ENABLE(TILED_BACKING_STORE) IntRect ChromeClientQt::visibleRectForTiledBackingStore() const { - if (!platformPageClient()) + if (!platformPageClient() || !m_webPage) return IntRect(); + + if (!platformPageClient()->viewResizesToContentsEnabled()) + return QRect(m_webPage->mainFrame()->scrollPosition(), m_webPage->mainFrame()->geometry().size()); + return enclosingIntRect(FloatRect(platformPageClient()->graphicsItemVisibleRect())); } #endif -- cgit v0.12 From ac52dee57e4417ebd6f6049cfb7998fe9d62e8db Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Fri, 2 Jul 2010 18:19:34 +0200 Subject: Don't write to the logger widget while the application is closing down. Reviewed-by: TrustMe --- tools/qml/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 900a464..d0817bc 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -91,7 +91,7 @@ void showWarnings() void myMessageOutput(QtMsgType type, const char *msg) { - if (!logger.isNull()) { + if (!logger.isNull() && !QCoreApplication::closingDown()) { QString strMsg = QString::fromAscii(msg); QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg)); } else { -- cgit v0.12 From 12f64cce218a5bf76372dd48d54f9fa761fe2955 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 2 Jul 2010 18:21:25 +0200 Subject: qdoc: Added a solution for creating tables of contents for manuals. Reviewed-by: Trust Me --- tools/qdoc3/doc/qdoc-manual.qdoc | 21 +++++++ tools/qdoc3/helpprojectwriter.cpp | 124 +++++++++++++++++++++++++++----------- tools/qdoc3/helpprojectwriter.h | 1 + 3 files changed, 112 insertions(+), 34 deletions(-) diff --git a/tools/qdoc3/doc/qdoc-manual.qdoc b/tools/qdoc3/doc/qdoc-manual.qdoc index 57c17ba..c3ab731 100644 --- a/tools/qdoc3/doc/qdoc-manual.qdoc +++ b/tools/qdoc3/doc/qdoc-manual.qdoc @@ -8075,6 +8075,27 @@ qhp.Qt.subprojects.examples.indexTitle = Qt Examples qhp.Qt.subprojects.examples.selectors = fake:example \endcode + + To create a table of contents for a manual, create a subproject with + a \c{type} property and set it to \c{manual}. The page in the documentation + referred to by the \c{indexTitle} property must contain a list of links + that acts as a table of contents for the whole manual. QDoc will take the + information in this list and create a table of contents for the subproject. + + For example, the configuration file for Qt Creator defines only one + subproject for its documentation, including all the documentation in a + single manual: + + \code + qhp.QtCreator.subprojects = manual + qhp.QtCreator.subprojects.manual.title = Qt Creator Manual + qhp.QtCreator.subprojects.manual.indexTitle = Qt Creator Manual + qhp.QtCreator.subprojects.manual.type = manual + \endcode + + In this example, the page entitled "Qt Creator Manual" contains a nested + list of links to pages in the documentation which is duplicated in + Qt Assistant's Contents tab. */ /*! diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp index edba097..98246c4 100644 --- a/tools/qdoc3/helpprojectwriter.cpp +++ b/tools/qdoc3/helpprojectwriter.cpp @@ -41,7 +41,7 @@ #include #include -#include +//#include #include "atom.h" #include "helpprojectwriter.h" @@ -91,6 +91,7 @@ HelpProjectWriter::HelpProjectWriter(const Config &config, const QString &defaul subproject.title = config.getString(subprefix + "title"); subproject.indexTitle = config.getString(subprefix + "indexTitle"); subproject.sortPages = config.getBool(subprefix + "sortPages"); + subproject.type = config.getString(subprefix + "type"); readSelectors(subproject, config.getStringList(subprefix + "selectors")); project.subprojects[name] = subproject; } @@ -625,44 +626,99 @@ void HelpProjectWriter::generateProject(HelpProject &project) foreach (const QString &name, project.subprojects.keys()) { SubProject subproject = project.subprojects[name]; - if (!name.isEmpty()) { - writer.writeStartElement("section"); - QString indexPath = tree->fullDocumentLocation(tree->findFakeNodeByTitle(subproject.indexTitle)); - writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath)); - writer.writeAttribute("title", subproject.title); - project.files.insert(indexPath); - } - if (subproject.sortPages) { - QStringList titles = subproject.nodes.keys(); - titles.sort(); - foreach (const QString &title, titles) - writeNode(project, writer, subproject.nodes[title]); + if (subproject.type == QLatin1String("manual")) { + + const FakeNode *indexPage = tree->findFakeNodeByTitle(subproject.indexTitle); + if (indexPage) { + Text indexBody = indexPage->doc().body(); + const Atom *atom = indexBody.firstAtom(); + QStack sectionStack; + bool inItem = false; + + while (atom) { + switch (atom->type()) { + case Atom::ListLeft: + sectionStack.push(0); + break; + case Atom::ListRight: + if (sectionStack.pop() > 0) + writer.writeEndElement(); // section + break; + case Atom::ListItemLeft: + inItem = true; + break; + case Atom::ListItemRight: + inItem = false; + break; + case Atom::Link: + if (inItem) { + if (sectionStack.top() > 0) + writer.writeEndElement(); // section + + const FakeNode *page = tree->findFakeNodeByTitle(atom->string()); + writer.writeStartElement("section"); + QString indexPath = tree->fullDocumentLocation(page); + writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath)); + writer.writeAttribute("title", atom->string()); + project.files.insert(indexPath); + + sectionStack.top() += 1; + } + break; + default: + ; + } + + if (atom == indexBody.lastAtom()) + break; + atom = atom->next(); + } + } else + rootNode->doc().location().warning( + tr("Failed to find index: %1").arg(subproject.indexTitle) + ); + } else { - // Find a contents node and navigate from there, using the NextLink values. - foreach (const Node *node, subproject.nodes) { - QString nextTitle = node->links().value(Node::NextLink).first; - if (!nextTitle.isEmpty() && - node->links().value(Node::ContentsLink).first.isEmpty()) { - - FakeNode *nextPage = const_cast(tree->findFakeNodeByTitle(nextTitle)); - - // Write the contents node. - writeNode(project, writer, node); - - while (nextPage) { - writeNode(project, writer, nextPage); - nextTitle = nextPage->links().value(Node::NextLink).first; - if(nextTitle.isEmpty()) - break; - nextPage = const_cast(tree->findFakeNodeByTitle(nextTitle)); + + if (!name.isEmpty()) { + writer.writeStartElement("section"); + QString indexPath = tree->fullDocumentLocation(tree->findFakeNodeByTitle(subproject.indexTitle)); + writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath)); + writer.writeAttribute("title", subproject.title); + project.files.insert(indexPath); + } + if (subproject.sortPages) { + QStringList titles = subproject.nodes.keys(); + titles.sort(); + foreach (const QString &title, titles) + writeNode(project, writer, subproject.nodes[title]); + } else { + // Find a contents node and navigate from there, using the NextLink values. + foreach (const Node *node, subproject.nodes) { + QString nextTitle = node->links().value(Node::NextLink).first; + if (!nextTitle.isEmpty() && + node->links().value(Node::ContentsLink).first.isEmpty()) { + + FakeNode *nextPage = const_cast(tree->findFakeNodeByTitle(nextTitle)); + + // Write the contents node. + writeNode(project, writer, node); + + while (nextPage) { + writeNode(project, writer, nextPage); + nextTitle = nextPage->links().value(Node::NextLink).first; + if(nextTitle.isEmpty()) + break; + nextPage = const_cast(tree->findFakeNodeByTitle(nextTitle)); + } + break; } - break; } } - } - if (!name.isEmpty()) - writer.writeEndElement(); // section + if (!name.isEmpty()) + writer.writeEndElement(); // section + } } writer.writeEndElement(); // section diff --git a/tools/qdoc3/helpprojectwriter.h b/tools/qdoc3/helpprojectwriter.h index 511a9dd..7a67dff 100644 --- a/tools/qdoc3/helpprojectwriter.h +++ b/tools/qdoc3/helpprojectwriter.h @@ -60,6 +60,7 @@ struct SubProject QString indexTitle; QHash > selectors; bool sortPages; + QString type; QHash nodes; }; -- cgit v0.12 From cb66473779ac2e7e763afc0e45b27f7fe265b926 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Fri, 2 Jul 2010 18:30:27 +0200 Subject: Long live else! Merge-request: 715 Reviewed-by: Oswald Buddenhagen --- src/gui/image/image.pri | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index f5f1bc0..337a19b 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -58,18 +58,18 @@ SOURCES += \ win32 { SOURCES += image/qpixmap_win.cpp } -embedded { +else:embedded { SOURCES += image/qpixmap_qws.cpp } -x11 { +else:x11 { HEADERS += image/qpixmap_x11_p.h SOURCES += image/qpixmap_x11.cpp } -mac { +else:mac { HEADERS += image/qpixmap_mac_p.h SOURCES += image/qpixmap_mac.cpp } -symbian { +else:symbian { HEADERS += image/qpixmap_s60_p.h SOURCES += image/qpixmap_s60.cpp } -- cgit v0.12 From ce545fb8ab5e3bdff8e8481567d931cb7cfb4e5a Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Fri, 2 Jul 2010 18:30:28 +0200 Subject: Removed stray line continuations Merge-request: 715 Reviewed-by: Oswald Buddenhagen --- src/gui/image/image.pri | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 337a19b..f1b02b0 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -28,8 +28,7 @@ HEADERS += \ image/qpixmapdata_p.h \ image/qpixmapdatafactory_p.h \ image/qpixmapfilter_p.h \ - image/qimagepixmapcleanuphooks_p.h \ - + image/qimagepixmapcleanuphooks_p.h SOURCES += \ image/qbitmap.cpp \ @@ -52,8 +51,7 @@ SOURCES += \ image/qmovie.cpp \ image/qpixmap_raster.cpp \ image/qnativeimage.cpp \ - image/qimagepixmapcleanuphooks.cpp \ - + image/qimagepixmapcleanuphooks.cpp win32 { SOURCES += image/qpixmap_win.cpp -- cgit v0.12 From d20dcfd98602a4505624e48a64aa58c54ef65852 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Fri, 2 Jul 2010 18:30:30 +0200 Subject: No explicit link to zlib/jpeg for system mng/tiff For "system" mng or tiff, the shared library mechanism takes care of loading zlib. For exotic cases like static system mng/tiff/zlib, one should use configure's -l option. Trying to cover such cases in project files leads to clutter which is at best harmless for other cases. Png already had this arrangement. The same principle applies to jpeg which is a potential dependency of tiff and mng. However, bundled tiff and mng are built without jpeg. Shared system jpeg is loaded automatically if needed. Static system jpeg can be handled with configure's -l option. Merge-request: 715 Reviewed-by: Oswald Buddenhagen --- src/plugins/imageformats/mng/mng.pro | 14 +++++++------- src/plugins/imageformats/tiff/tiff.pro | 19 +++++++------------ 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/plugins/imageformats/mng/mng.pro b/src/plugins/imageformats/mng/mng.pro index 158f41a..1f3ad53 100644 --- a/src/plugins/imageformats/mng/mng.pro +++ b/src/plugins/imageformats/mng/mng.pro @@ -40,14 +40,14 @@ contains(QT_CONFIG, system-mng) { ../../../3rdparty/libmng/libmng_trace.c \ ../../../3rdparty/libmng/libmng_write.c \ ../../../3rdparty/libmng/libmng_zlib.c -} -contains(QT_CONFIG, system-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} else { - INCLUDEPATH += ../../../3rdparty/zlib + contains(QT_CONFIG, system-zlib) { + symbian:LIBS_PRIVATE += -llibz + else:if(unix|win32-g++*):LIBS_PRIVATE += -lz + else:LIBS += zdll.lib + } else { + INCLUDEPATH += ../../../3rdparty/zlib + } } QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats diff --git a/src/plugins/imageformats/tiff/tiff.pro b/src/plugins/imageformats/tiff/tiff.pro index 08e471c..49d635e 100644 --- a/src/plugins/imageformats/tiff/tiff.pro +++ b/src/plugins/imageformats/tiff/tiff.pro @@ -10,11 +10,6 @@ SOURCES += main.cpp \ contains(QT_CONFIG, system-tiff) { unix|win32-g++*:LIBS += -ltiff win32:!win32-g++*:LIBS += libtiff.lib - - contains(QT_CONFIG, system-jpeg) { - unix|win32-g++*:LIBS += -ljpeg - win32:!win32-g++*:LIBS += libjpeg.lib - } } else { INCLUDEPATH += ../../../3rdparty/libtiff/libtiff SOURCES += \ @@ -65,14 +60,14 @@ contains(QT_CONFIG, system-tiff) { symbian: { SOURCES += ../../../3rdparty/libtiff/port/lfind.c } -} -contains(QT_CONFIG, system-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} else { - INCLUDEPATH += ../../../3rdparty/zlib + contains(QT_CONFIG, system-zlib) { + symbian:LIBS_PRIVATE += -llibz + else:if(unix|win32-g++*):LIBS_PRIVATE += -lz + else:LIBS += zdll.lib + } else { + INCLUDEPATH += ../../../3rdparty/zlib + } } QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats -- cgit v0.12 From 51ba8332385f3abceae88ec0a7ae29ac1e875a5c Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Fri, 2 Jul 2010 18:30:31 +0200 Subject: Split image handler plugin project files One pri for each handler, e.g. src/gui/image/qjpeghandler.pri. One pri for each 3rd party package, e.g src/3rdparty/libjpeg.pri. One shared pri for zlib dependency of 3rd party packages. This was really about image handler plugins, but PNG got the same treatment for consistency's sake. Also, moved image handler source files from plugins to src/gui/image so they are with the other image handlers. Merge-request: 715 Reviewed-by: Oswald Buddenhagen --- configure | 2 +- src/3rdparty/libjpeg.pri | 48 + src/3rdparty/libmng.pri | 25 + src/3rdparty/libpng.pri | 20 + src/3rdparty/libtiff.pri | 43 + src/3rdparty/zlib_dependency.pri | 8 + src/gui/image/image.pri | 44 +- src/gui/image/qgifhandler.cpp | 1199 ++++++++++++++++++++++++ src/gui/image/qgifhandler.h | 96 ++ src/gui/image/qgifhandler.pri | 4 + src/gui/image/qjpeghandler.cpp | 901 ++++++++++++++++++ src/gui/image/qjpeghandler.h | 76 ++ src/gui/image/qjpeghandler.pri | 10 + src/gui/image/qmnghandler.cpp | 497 ++++++++++ src/gui/image/qmnghandler.h | 83 ++ src/gui/image/qmnghandler.pri | 10 + src/gui/image/qpnghandler.pri | 10 + src/gui/image/qtiffhandler.cpp | 661 +++++++++++++ src/gui/image/qtiffhandler.h | 78 ++ src/gui/image/qtiffhandler.pri | 10 + src/plugins/imageformats/gif/gif.pro | 5 +- src/plugins/imageformats/gif/qgifhandler.cpp | 1199 ------------------------ src/plugins/imageformats/gif/qgifhandler.h | 96 -- src/plugins/imageformats/jpeg/jpeg.pro | 60 +- src/plugins/imageformats/jpeg/qjpeghandler.cpp | 901 ------------------ src/plugins/imageformats/jpeg/qjpeghandler.h | 76 -- src/plugins/imageformats/mng/mng.pro | 43 +- src/plugins/imageformats/mng/qmnghandler.cpp | 497 ---------- src/plugins/imageformats/mng/qmnghandler.h | 83 -- src/plugins/imageformats/tiff/qtiffhandler.cpp | 661 ------------- src/plugins/imageformats/tiff/qtiffhandler.h | 78 -- src/plugins/imageformats/tiff/tiff.pro | 68 +- tools/configure/configureapp.cpp | 2 +- 33 files changed, 3795 insertions(+), 3799 deletions(-) create mode 100644 src/3rdparty/libjpeg.pri create mode 100644 src/3rdparty/libmng.pri create mode 100644 src/3rdparty/libpng.pri create mode 100644 src/3rdparty/libtiff.pri create mode 100644 src/3rdparty/zlib_dependency.pri create mode 100644 src/gui/image/qgifhandler.cpp create mode 100644 src/gui/image/qgifhandler.h create mode 100644 src/gui/image/qgifhandler.pri create mode 100644 src/gui/image/qjpeghandler.cpp create mode 100644 src/gui/image/qjpeghandler.h create mode 100644 src/gui/image/qjpeghandler.pri create mode 100644 src/gui/image/qmnghandler.cpp create mode 100644 src/gui/image/qmnghandler.h create mode 100644 src/gui/image/qmnghandler.pri create mode 100644 src/gui/image/qpnghandler.pri create mode 100644 src/gui/image/qtiffhandler.cpp create mode 100644 src/gui/image/qtiffhandler.h create mode 100644 src/gui/image/qtiffhandler.pri delete mode 100644 src/plugins/imageformats/gif/qgifhandler.cpp delete mode 100644 src/plugins/imageformats/gif/qgifhandler.h delete mode 100644 src/plugins/imageformats/jpeg/qjpeghandler.cpp delete mode 100644 src/plugins/imageformats/jpeg/qjpeghandler.h delete mode 100644 src/plugins/imageformats/mng/qmnghandler.cpp delete mode 100644 src/plugins/imageformats/mng/qmnghandler.h delete mode 100644 src/plugins/imageformats/tiff/qtiffhandler.cpp delete mode 100644 src/plugins/imageformats/tiff/qtiffhandler.h diff --git a/configure b/configure index 4650229..7f998fc 100755 --- a/configure +++ b/configure @@ -3636,7 +3636,7 @@ Third Party Libraries: -no-gif ............ Do not compile the plugin for GIF reading support. * -qt-gif ............ Compile the plugin for GIF reading support. - See also src/plugins/imageformats/gif/qgifhandler.h + See also src/gui/image/qgifhandler.h -no-libtiff ........ Do not compile the plugin for TIFF support. -qt-libtiff ........ Use the libtiff bundled with Qt. diff --git a/src/3rdparty/libjpeg.pri b/src/3rdparty/libjpeg.pri new file mode 100644 index 0000000..4551d7b --- /dev/null +++ b/src/3rdparty/libjpeg.pri @@ -0,0 +1,48 @@ +INCLUDEPATH += $$PWD/libjpeg +SOURCES += \ + $$PWD/libjpeg/jaricom.c \ + $$PWD/libjpeg/jcapimin.c \ + $$PWD/libjpeg/jcapistd.c \ + $$PWD/libjpeg/jcarith.c \ + $$PWD/libjpeg/jccoefct.c \ + $$PWD/libjpeg/jccolor.c \ + $$PWD/libjpeg/jcdctmgr.c \ + $$PWD/libjpeg/jchuff.c \ + $$PWD/libjpeg/jcinit.c \ + $$PWD/libjpeg/jcmainct.c \ + $$PWD/libjpeg/jcmarker.c \ + $$PWD/libjpeg/jcmaster.c \ + $$PWD/libjpeg/jcomapi.c \ + $$PWD/libjpeg/jcparam.c \ + $$PWD/libjpeg/jcprepct.c \ + $$PWD/libjpeg/jcsample.c \ + $$PWD/libjpeg/jctrans.c \ + $$PWD/libjpeg/jdapimin.c \ + $$PWD/libjpeg/jdapistd.c \ + $$PWD/libjpeg/jdarith.c \ + $$PWD/libjpeg/jdatadst.c \ + $$PWD/libjpeg/jdatasrc.c \ + $$PWD/libjpeg/jdcoefct.c \ + $$PWD/libjpeg/jdcolor.c \ + $$PWD/libjpeg/jddctmgr.c \ + $$PWD/libjpeg/jdhuff.c \ + $$PWD/libjpeg/jdinput.c \ + $$PWD/libjpeg/jdmainct.c \ + $$PWD/libjpeg/jdmarker.c \ + $$PWD/libjpeg/jdmaster.c \ + $$PWD/libjpeg/jdmerge.c \ + $$PWD/libjpeg/jdpostct.c \ + $$PWD/libjpeg/jdsample.c \ + $$PWD/libjpeg/jdtrans.c \ + $$PWD/libjpeg/jerror.c \ + $$PWD/libjpeg/jfdctflt.c \ + $$PWD/libjpeg/jfdctfst.c \ + $$PWD/libjpeg/jfdctint.c \ + $$PWD/libjpeg/jidctflt.c \ + $$PWD/libjpeg/jidctfst.c \ + $$PWD/libjpeg/jidctint.c \ + $$PWD/libjpeg/jquant1.c \ + $$PWD/libjpeg/jquant2.c \ + $$PWD/libjpeg/jutils.c \ + $$PWD/libjpeg/jmemmgr.c \ + $$PWD/libjpeg/jmemnobs.c diff --git a/src/3rdparty/libmng.pri b/src/3rdparty/libmng.pri new file mode 100644 index 0000000..7b68210 --- /dev/null +++ b/src/3rdparty/libmng.pri @@ -0,0 +1,25 @@ +DEFINES += MNG_BUILD_SO +DEFINES += MNG_NO_INCLUDE_JNG +INCLUDEPATH += $$PWD/libmng +SOURCES += \ + $$PWD/libmng/libmng_callback_xs.c \ + $$PWD/libmng/libmng_chunk_io.c \ + $$PWD/libmng/libmng_chunk_descr.c \ + $$PWD/libmng/libmng_chunk_prc.c \ + $$PWD/libmng/libmng_chunk_xs.c \ + $$PWD/libmng/libmng_cms.c \ + $$PWD/libmng/libmng_display.c \ + $$PWD/libmng/libmng_dither.c \ + $$PWD/libmng/libmng_error.c \ + $$PWD/libmng/libmng_filter.c \ + $$PWD/libmng/libmng_hlapi.c \ + $$PWD/libmng/libmng_jpeg.c \ + $$PWD/libmng/libmng_object_prc.c \ + $$PWD/libmng/libmng_pixels.c \ + $$PWD/libmng/libmng_prop_xs.c \ + $$PWD/libmng/libmng_read.c \ + $$PWD/libmng/libmng_trace.c \ + $$PWD/libmng/libmng_write.c \ + $$PWD/libmng/libmng_zlib.c + +include($$PWD/zlib_dependency.pri) diff --git a/src/3rdparty/libpng.pri b/src/3rdparty/libpng.pri new file mode 100644 index 0000000..7ac1910 --- /dev/null +++ b/src/3rdparty/libpng.pri @@ -0,0 +1,20 @@ +DEFINES *= QT_USE_BUNDLED_LIBPNG +!isEqual(QT_ARCH, i386):!isEqual(QT_ARCH, x86_64):DEFINES += PNG_NO_ASSEMBLER_CODE +INCLUDEPATH += $$PWD/libpng +SOURCES += $$PWD/libpng/png.c \ + $$PWD/libpng/pngerror.c \ + $$PWD/libpng/pngget.c \ + $$PWD/libpng/pngmem.c \ + $$PWD/libpng/pngpread.c \ + $$PWD/libpng/pngread.c \ + $$PWD/libpng/pngrio.c \ + $$PWD/libpng/pngrtran.c \ + $$PWD/libpng/pngrutil.c \ + $$PWD/libpng/pngset.c \ + $$PWD/libpng/pngtrans.c \ + $$PWD/libpng/pngwio.c \ + $$PWD/libpng/pngwrite.c \ + $$PWD/libpng/pngwtran.c \ + $$PWD/libpng/pngwutil.c + +include($$PWD/zlib_dependency.pri) diff --git a/src/3rdparty/libtiff.pri b/src/3rdparty/libtiff.pri new file mode 100644 index 0000000..5a522be --- /dev/null +++ b/src/3rdparty/libtiff.pri @@ -0,0 +1,43 @@ +INCLUDEPATH += $$PWD/libtiff/libtiff +SOURCES += \ + $$PWD/libtiff/libtiff/tif_aux.c \ + $$PWD/libtiff/libtiff/tif_close.c \ + $$PWD/libtiff/libtiff/tif_codec.c \ + $$PWD/libtiff/libtiff/tif_color.c \ + $$PWD/libtiff/libtiff/tif_compress.c \ + $$PWD/libtiff/libtiff/tif_dir.c \ + $$PWD/libtiff/libtiff/tif_dirinfo.c \ + $$PWD/libtiff/libtiff/tif_dirread.c \ + $$PWD/libtiff/libtiff/tif_dirwrite.c \ + $$PWD/libtiff/libtiff/tif_dumpmode.c \ + $$PWD/libtiff/libtiff/tif_error.c \ + $$PWD/libtiff/libtiff/tif_extension.c \ + $$PWD/libtiff/libtiff/tif_fax3.c \ + $$PWD/libtiff/libtiff/tif_fax3sm.c \ + $$PWD/libtiff/libtiff/tif_flush.c \ + $$PWD/libtiff/libtiff/tif_getimage.c \ + $$PWD/libtiff/libtiff/tif_luv.c \ + $$PWD/libtiff/libtiff/tif_lzw.c \ + $$PWD/libtiff/libtiff/tif_next.c \ + $$PWD/libtiff/libtiff/tif_open.c \ + $$PWD/libtiff/libtiff/tif_packbits.c \ + $$PWD/libtiff/libtiff/tif_pixarlog.c \ + $$PWD/libtiff/libtiff/tif_predict.c \ + $$PWD/libtiff/libtiff/tif_print.c \ + $$PWD/libtiff/libtiff/tif_read.c \ + $$PWD/libtiff/libtiff/tif_strip.c \ + $$PWD/libtiff/libtiff/tif_swab.c \ + $$PWD/libtiff/libtiff/tif_thunder.c \ + $$PWD/libtiff/libtiff/tif_tile.c \ + $$PWD/libtiff/libtiff/tif_version.c \ + $$PWD/libtiff/libtiff/tif_warning.c \ + $$PWD/libtiff/libtiff/tif_write.c \ + $$PWD/libtiff/libtiff/tif_zip.c + +wince*: SOURCES += $$PWD/../corelib/kernel/qfunctions_wince.cpp \ + $$PWD/libtiff/libtiff/tif_wince.c +win32: SOURCES += $$PWD/libtiff/libtiff/tif_win32.c +else:unix: SOURCES += $$PWD/libtiff/libtiff/tif_unix.c +else:symbian: SOURCES += $$PWD/libtiff/port/lfind.c + +include($$PWD/zlib_dependency.pri) diff --git a/src/3rdparty/zlib_dependency.pri b/src/3rdparty/zlib_dependency.pri new file mode 100644 index 0000000..042eb13 --- /dev/null +++ b/src/3rdparty/zlib_dependency.pri @@ -0,0 +1,8 @@ +# zlib dependency satisfied by bundled 3rd party zlib or system zlib +contains(QT_CONFIG, system-zlib) { + symbian: LIBS_PRIVATE += -llibz + else:if(unix|win32-g++*):LIBS_PRIVATE += -lz + else: LIBS += zdll.lib +} else { + INCLUDEPATH += $$PWD/zlib +} diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index f1b02b0..9f0c87e 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -85,42 +85,10 @@ SOURCES += \ image/qxbmhandler.cpp \ image/qxpmhandler.cpp -# 3rd party / system PNG support -!contains(QT_CONFIG, no-png) { - HEADERS += image/qpnghandler_p.h - SOURCES += image/qpnghandler.cpp +!contains(QT_CONFIG, no-png):include($$PWD/qpnghandler.pri) +else:DEFINES *= QT_NO_IMAGEFORMAT_PNG - contains(QT_CONFIG, system-png) { - unix|win32-g++*:LIBS_PRIVATE += -lpng - win32:!win32-g++*:LIBS += libpng.lib - } else { - DEFINES *= QT_USE_BUNDLED_LIBPNG - !isEqual(QT_ARCH, i386):!isEqual(QT_ARCH, x86_64):DEFINES += PNG_NO_ASSEMBLER_CODE - INCLUDEPATH += ../3rdparty/libpng - SOURCES += ../3rdparty/libpng/png.c \ - ../3rdparty/libpng/pngerror.c \ - ../3rdparty/libpng/pngget.c \ - ../3rdparty/libpng/pngmem.c \ - ../3rdparty/libpng/pngpread.c \ - ../3rdparty/libpng/pngread.c \ - ../3rdparty/libpng/pngrio.c \ - ../3rdparty/libpng/pngrtran.c \ - ../3rdparty/libpng/pngrutil.c \ - ../3rdparty/libpng/pngset.c \ - ../3rdparty/libpng/pngtrans.c \ - ../3rdparty/libpng/pngwio.c \ - ../3rdparty/libpng/pngwrite.c \ - ../3rdparty/libpng/pngwtran.c \ - ../3rdparty/libpng/pngwutil.c - - contains(QT_CONFIG, system-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib - } else { - INCLUDEPATH += ../3rdparty/zlib - } - } -} else { - DEFINES *= QT_NO_IMAGEFORMAT_PNG -} +contains(QT_CONFIG, jpeg):include($$PWD/qjpeghandler.pri) +contains(QT_CONFIG, mng):include($$PWD/qmnghandler.pri) +contains(QT_CONFIG, tiff):include($$PWD/qtiffhandler.pri) +contains(QT_CONFIG, gif):include($$PWD/qgifhandler.pri) diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp new file mode 100644 index 0000000..129a11b --- /dev/null +++ b/src/gui/image/qgifhandler.cpp @@ -0,0 +1,1199 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +** WARNING: +** A separate license from Unisys may be required to use the gif +** reader. See http://www.unisys.com/about__unisys/lzw/ +** for information from Unisys +** +****************************************************************************/ + +#include "qgifhandler.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#define Q_TRANSPARENT 0x00ffffff + +// avoid going through QImage::scanLine() which calls detach +#define FAST_SCAN_LINE(bits, bpl, y) (bits + (y) * bpl) + + +/* + Incremental image decoder for GIF image format. + + This subclass of QImageFormat decodes GIF format images, + including animated GIFs. Internally in +*/ + +class QGIFFormat { +public: + QGIFFormat(); + ~QGIFFormat(); + + int decode(QImage *image, const uchar* buffer, int length, + int *nextFrameDelay, int *loopCount); + static void scan(QIODevice *device, QVector *imageSizes, int *loopCount); + + bool newFrame; + bool partialNewFrame; + +private: + void fillRect(QImage *image, int x, int y, int w, int h, QRgb col); + inline QRgb color(uchar index) const; + + // GIF specific stuff + QRgb* globalcmap; + QRgb* localcmap; + QImage backingstore; + unsigned char hold[16]; + bool gif89; + int count; + int ccount; + int expectcount; + enum State { + Header, + LogicalScreenDescriptor, + GlobalColorMap, + LocalColorMap, + Introducer, + ImageDescriptor, + TableImageLZWSize, + ImageDataBlockSize, + ImageDataBlock, + ExtensionLabel, + GraphicControlExtension, + ApplicationExtension, + NetscapeExtensionBlockSize, + NetscapeExtensionBlock, + SkipBlockSize, + SkipBlock, + Done, + Error + } state; + int gncols; + int lncols; + int ncols; + int lzwsize; + bool lcmap; + int swidth, sheight; + int width, height; + int left, top, right, bottom; + enum Disposal { NoDisposal, DoNotChange, RestoreBackground, RestoreImage }; + Disposal disposal; + bool disposed; + int trans_index; + bool gcmap; + int bgcol; + int interlace; + int accum; + int bitcount; + + enum { max_lzw_bits=12 }; // (poor-compiler's static const int) + + int code_size, clear_code, end_code, max_code_size, max_code; + int firstcode, oldcode, incode; + short* table[2]; + short* stack; + short *sp; + bool needfirst; + int x, y; + int frame; + bool out_of_bounds; + bool digress; + void nextY(unsigned char *bits, int bpl); + void disposePrevious(QImage *image); +}; + +/*! + Constructs a QGIFFormat. +*/ +QGIFFormat::QGIFFormat() +{ + globalcmap = 0; + localcmap = 0; + lncols = 0; + gncols = 0; + disposal = NoDisposal; + out_of_bounds = false; + disposed = true; + frame = -1; + state = Header; + count = 0; + lcmap = false; + newFrame = false; + partialNewFrame = false; + table[0] = 0; + table[1] = 0; + stack = 0; +} + +/*! + Destroys a QGIFFormat. +*/ +QGIFFormat::~QGIFFormat() +{ + if (globalcmap) delete[] globalcmap; + if (localcmap) delete[] localcmap; + delete [] stack; +} + +void QGIFFormat::disposePrevious(QImage *image) +{ + if (out_of_bounds) { + // flush anything that survived + // ### Changed: QRect(0, 0, swidth, sheight) + } + + // Handle disposal of previous image before processing next one + + if (disposed) return; + + int l = qMin(swidth-1,left); + int r = qMin(swidth-1,right); + int t = qMin(sheight-1,top); + int b = qMin(sheight-1,bottom); + + switch (disposal) { + case NoDisposal: + break; + case DoNotChange: + break; + case RestoreBackground: + if (trans_index>=0) { + // Easy: we use the transparent color + fillRect(image, l, t, r-l+1, b-t+1, Q_TRANSPARENT); + } else if (bgcol>=0) { + // Easy: we use the bgcol given + fillRect(image, l, t, r-l+1, b-t+1, color(bgcol)); + } else { + // Impossible: We don't know of a bgcol - use pixel 0 + QRgb *bits = (QRgb*)image->bits(); + fillRect(image, l, t, r-l+1, b-t+1, bits[0]); + } + // ### Changed: QRect(l, t, r-l+1, b-t+1) + break; + case RestoreImage: { + if (frame >= 0) { + for (int ln=t; ln<=b; ln++) { + memcpy(image->scanLine(ln)+l, + backingstore.scanLine(ln-t), + (r-l+1)*sizeof(QRgb)); + } + // ### Changed: QRect(l, t, r-l+1, b-t+1) + } + } + } + disposal = NoDisposal; // Until an extension says otherwise. + + disposed = true; +} + +/*! + This function decodes some data into image changes. + + Returns the number of bytes consumed. +*/ +int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, + int *nextFrameDelay, int *loopCount) +{ + // We are required to state that + // "The Graphics Interchange Format(c) is the Copyright property of + // CompuServe Incorporated. GIF(sm) is a Service Mark property of + // CompuServe Incorporated." + + if (!stack) { + stack = new short[(1 << max_lzw_bits) * 4]; + table[0] = &stack[(1 << max_lzw_bits) * 2]; + table[1] = &stack[(1 << max_lzw_bits) * 3]; + } + + image->detach(); + int bpl = image->bytesPerLine(); + unsigned char *bits = image->bits(); + +#define LM(l, m) (((m)<<8)|l) + digress = false; + const int initial = length; + while (!digress && length) { + length--; + unsigned char ch=*buffer++; + switch (state) { + case Header: + hold[count++]=ch; + if (count==6) { + // Header + gif89=(hold[3]!='8' || hold[4]!='7'); + state=LogicalScreenDescriptor; + count=0; + } + break; + case LogicalScreenDescriptor: + hold[count++]=ch; + if (count==7) { + // Logical Screen Descriptor + swidth=LM(hold[0], hold[1]); + sheight=LM(hold[2], hold[3]); + gcmap=!!(hold[4]&0x80); + //UNUSED: bpchan=(((hold[4]&0x70)>>3)+1); + //UNUSED: gcmsortflag=!!(hold[4]&0x08); + gncols=2<<(hold[4]&0x7); + bgcol=(gcmap) ? hold[5] : -1; + //aspect=hold[6] ? double(hold[6]+15)/64.0 : 1.0; + + trans_index = -1; + count=0; + ncols=gncols; + if (gcmap) { + ccount=0; + state=GlobalColorMap; + globalcmap = new QRgb[gncols+1]; // +1 for trans_index + globalcmap[gncols] = Q_TRANSPARENT; + } else { + state=Introducer; + } + } + break; + case GlobalColorMap: case LocalColorMap: + hold[count++]=ch; + if (count==3) { + QRgb rgb = qRgb(hold[0], hold[1], hold[2]); + if (state == LocalColorMap) { + if (ccount < lncols) + localcmap[ccount] = rgb; + } else { + globalcmap[ccount] = rgb; + } + if (++ccount >= ncols) { + if (state == LocalColorMap) + state=TableImageLZWSize; + else + state=Introducer; + } + count=0; + } + break; + case Introducer: + hold[count++]=ch; + switch (ch) { + case ',': + state=ImageDescriptor; + break; + case '!': + state=ExtensionLabel; + break; + case ';': + // ### Changed: QRect(0, 0, swidth, sheight) + state=Done; + break; + default: + digress=true; + // Unexpected Introducer - ignore block + state=Error; + } + break; + case ImageDescriptor: + hold[count++]=ch; + if (count==10) { + int newleft=LM(hold[1], hold[2]); + int newtop=LM(hold[3], hold[4]); + int newwidth=LM(hold[5], hold[6]); + int newheight=LM(hold[7], hold[8]); + + // disbelieve ridiculous logical screen sizes, + // unless the image frames are also large. + if (swidth/10 > qMax(newwidth,200)) + swidth = -1; + if (sheight/10 > qMax(newheight,200)) + sheight = -1; + + if (swidth <= 0) + swidth = newleft + newwidth; + if (sheight <= 0) + sheight = newtop + newheight; + + QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32; + if (image->isNull()) { + (*image) = QImage(swidth, sheight, format); + bpl = image->bytesPerLine(); + bits = image->bits(); + memset(bits, 0, image->byteCount()); + } + + disposePrevious(image); + disposed = false; + + left = newleft; + top = newtop; + width = newwidth; + height = newheight; + + right=qMax(0, qMin(left+width, swidth)-1); + bottom=qMax(0, qMin(top+height, sheight)-1); + lcmap=!!(hold[9]&0x80); + interlace=!!(hold[9]&0x40); + //bool lcmsortflag=!!(hold[9]&0x20); + lncols=lcmap ? (2<<(hold[9]&0x7)) : 0; + if (lncols) { + if (localcmap) + delete [] localcmap; + localcmap = new QRgb[lncols+1]; + localcmap[lncols] = Q_TRANSPARENT; + ncols = lncols; + } else { + ncols = gncols; + } + frame++; + if (frame == 0) { + if (left || top || width= 0) { + fillRect(image, 0, 0, swidth, sheight, color(trans_index)); + // ### Changed: QRect(0, 0, swidth, sheight) + } else if (bgcol>=0) { + fillRect(image, 0, 0, swidth, sheight, color(bgcol)); + // ### Changed: QRect(0, 0, swidth, sheight) + } + } + } + + if (disposal == RestoreImage) { + int l = qMin(swidth-1,left); + int r = qMin(swidth-1,right); + int t = qMin(sheight-1,top); + int b = qMin(sheight-1,bottom); + int w = r-l+1; + int h = b-t+1; + + if (backingstore.width() < w + || backingstore.height() < h) { + // We just use the backing store as a byte array + backingstore = QImage(qMax(backingstore.width(), w), + qMax(backingstore.height(), h), + QImage::Format_RGB32); + memset(bits, 0, image->byteCount()); + } + const int dest_bpl = backingstore.bytesPerLine(); + unsigned char *dest_data = backingstore.bits(); + for (int ln=0; ln=swidth || y>=sheight; + } + break; + case TableImageLZWSize: { + lzwsize=ch; + if (lzwsize > max_lzw_bits) { + state=Error; + } else { + code_size=lzwsize+1; + clear_code=1<=code_size && state==ImageDataBlock) { + int code=accum&((1<>=code_size; + + if (code==clear_code) { + if (!needfirst) { + code_size=lzwsize+1; + max_code_size=2*clear_code; + max_code=clear_code+2; + } + needfirst=true; + } else if (code==end_code) { + bitcount = -32768; + // Left the block end arrive + } else { + if (needfirst) { + firstcode=oldcode=code; + if (!out_of_bounds && image->height() > y && firstcode!=trans_index) + ((QRgb*)FAST_SCAN_LINE(bits, bpl, y))[x] = color(firstcode); + x++; + if (x>=swidth) out_of_bounds = true; + needfirst=false; + if (x>=left+width) { + x=left; + out_of_bounds = left>=swidth || y>=sheight; + nextY(bits, bpl); + } + } else { + incode=code; + if (code>=max_code) { + *sp++=firstcode; + code=oldcode; + } + while (code>=clear_code+2) { + *sp++=table[1][code]; + if (code==table[0][code]) { + state=Error; + break; + } + if (sp-stack>=(1<<(max_lzw_bits))*2) { + state=Error; + break; + } + code=table[0][code]; + } + *sp++=firstcode=table[1][code]; + code=max_code; + if (code<(1<=max_code_size) + && (max_code_size<(1<height(); + const QRgb *map = lcmap ? localcmap : globalcmap; + QRgb *line = 0; + if (!out_of_bounds && h > y) + line = (QRgb*)FAST_SCAN_LINE(bits, bpl, y); + while (sp>stack) { + const uchar index = *(--sp); + if (!out_of_bounds && h > y && index!=trans_index) { + if (index > ncols) + line[x] = Q_TRANSPARENT; + else + line[x] = map ? map[index] : 0; + } + x++; + if (x>=swidth) out_of_bounds = true; + if (x>=left+width) { + x=left; + out_of_bounds = left>=swidth || y>=sheight; + nextY(bits, bpl); + if (!out_of_bounds && h > y) + line = (QRgb*)FAST_SCAN_LINE(bits, bpl, y); + } + } + } + } + } + partialNewFrame = true; + if (count==expectcount) { + count=0; + state=ImageDataBlockSize; + } + break; + case ExtensionLabel: + switch (ch) { + case 0xf9: + state=GraphicControlExtension; + break; + case 0xff: + state=ApplicationExtension; + break; +#if 0 + case 0xfe: + state=CommentExtension; + break; + case 0x01: + break; +#endif + default: + state=SkipBlockSize; + } + count=0; + break; + case ApplicationExtension: + if (count<11) hold[count]=ch; + count++; + if (count==hold[0]+1) { + if (qstrncmp((char*)(hold+1), "NETSCAPE", 8)==0) { + // Looping extension + state=NetscapeExtensionBlockSize; + } else { + state=SkipBlockSize; + } + count=0; + } + break; + case NetscapeExtensionBlockSize: + expectcount=ch; + count=0; + if (expectcount) state=NetscapeExtensionBlock; + else state=Introducer; + break; + case NetscapeExtensionBlock: + if (count<3) hold[count]=ch; + count++; + if (count==expectcount) { + *loopCount = hold[1]+hold[2]*256; + state=SkipBlockSize; // Ignore further blocks + } + break; + case GraphicControlExtension: + if (count<5) hold[count]=ch; + count++; + if (count==hold[0]+1) { + disposePrevious(image); + disposal=Disposal((hold[1]>>2)&0x7); + //UNUSED: waitforuser=!!((hold[1]>>1)&0x1); + int delay=count>3 ? LM(hold[2], hold[3]) : 1; + // IE and mozilla use a minimum delay of 10. With the minimum delay of 10 + // we are compatible to them and avoid huge loads on the app and xserver. + *nextFrameDelay = (delay < 2 ? 10 : delay) * 10; + + bool havetrans=hold[1]&0x1; + trans_index = havetrans ? hold[4] : -1; + + count=0; + state=SkipBlockSize; + } + break; + case SkipBlockSize: + expectcount=ch; + count=0; + if (expectcount) state=SkipBlock; + else state=Introducer; + break; + case SkipBlock: + count++; + if (count==expectcount) state=SkipBlockSize; + break; + case Done: + digress=true; + /* Netscape ignores the junk, so we do too. + length++; // Unget + state=Error; // More calls to this is an error + */ + break; + case Error: + return -1; // Called again after done. + } + } + return initial-length; +} + +/*! + Scans through the data stream defined by \a device and returns the image + sizes found in the stream in the \a imageSizes vector. +*/ +void QGIFFormat::scan(QIODevice *device, QVector *imageSizes, int *loopCount) +{ + if (!device) + return; + + qint64 oldPos = device->pos(); + if (!device->seek(0)) + return; + + int colorCount = 0; + int localColorCount = 0; + int globalColorCount = 0; + int colorReadCount = 0; + bool localColormap = false; + bool globalColormap = false; + int count = 0; + int blockSize = 0; + int imageWidth = 0; + int imageHeight = 0; + bool done = false; + uchar hold[16]; + State state = Header; + + const int readBufferSize = 40960; // 40k read buffer + QByteArray readBuffer(device->read(readBufferSize)); + + if (readBuffer.isEmpty()) { + device->seek(oldPos); + return; + } + + // This is a specialized version of the state machine from decode(), + // which doesn't do any image decoding or mallocing, and has an + // optimized way of skipping SkipBlocks, ImageDataBlocks and + // Global/LocalColorMaps. + + while (!readBuffer.isEmpty()) { + int length = readBuffer.size(); + const uchar *buffer = (const uchar *) readBuffer.constData(); + while (!done && length) { + length--; + uchar ch = *buffer++; + switch (state) { + case Header: + hold[count++] = ch; + if (count == 6) { + state = LogicalScreenDescriptor; + count = 0; + } + break; + case LogicalScreenDescriptor: + hold[count++] = ch; + if (count == 7) { + imageWidth = LM(hold[0], hold[1]); + imageHeight = LM(hold[2], hold[3]); + globalColormap = !!(hold[4] & 0x80); + globalColorCount = 2 << (hold[4] & 0x7); + count = 0; + colorCount = globalColorCount; + if (globalColormap) { + int colorTableSize = 3 * globalColorCount; + if (length >= colorTableSize) { + // skip the global color table in one go + length -= colorTableSize; + buffer += colorTableSize; + state = Introducer; + } else { + colorReadCount = 0; + state = GlobalColorMap; + } + } else { + state=Introducer; + } + } + break; + case GlobalColorMap: + case LocalColorMap: + hold[count++] = ch; + if (count == 3) { + if (++colorReadCount >= colorCount) { + if (state == LocalColorMap) + state = TableImageLZWSize; + else + state = Introducer; + } + count = 0; + } + break; + case Introducer: + hold[count++] = ch; + switch (ch) { + case 0x2c: + state = ImageDescriptor; + break; + case 0x21: + state = ExtensionLabel; + break; + case 0x3b: + state = Done; + break; + default: + done = true; + state = Error; + } + break; + case ImageDescriptor: + hold[count++] = ch; + if (count == 10) { + int newLeft = LM(hold[1], hold[2]); + int newTop = LM(hold[3], hold[4]); + int newWidth = LM(hold[5], hold[6]); + int newHeight = LM(hold[7], hold[8]); + + if (imageWidth/10 > qMax(newWidth,200)) + imageWidth = -1; + if (imageHeight/10 > qMax(newHeight,200)) + imageHeight = -1; + + if (imageWidth <= 0) + imageWidth = newLeft + newWidth; + if (imageHeight <= 0) + imageHeight = newTop + newHeight; + + *imageSizes << QSize(imageWidth, imageHeight); + + localColormap = !!(hold[9] & 0x80); + localColorCount = localColormap ? (2 << (hold[9] & 0x7)) : 0; + if (localColorCount) + colorCount = localColorCount; + else + colorCount = globalColorCount; + + count = 0; + if (localColormap) { + int colorTableSize = 3 * localColorCount; + if (length >= colorTableSize) { + // skip the local color table in one go + length -= colorTableSize; + buffer += colorTableSize; + state = TableImageLZWSize; + } else { + colorReadCount = 0; + state = LocalColorMap; + } + } else { + state = TableImageLZWSize; + } + } + break; + case TableImageLZWSize: + if (ch > max_lzw_bits) + state = Error; + else + state = ImageDataBlockSize; + count = 0; + break; + case ImageDataBlockSize: + blockSize = ch; + if (blockSize) { + if (length >= blockSize) { + // we can skip the block in one go + length -= blockSize; + buffer += blockSize; + count = 0; + } else { + state = ImageDataBlock; + } + } else { + state = Introducer; + } + break; + case ImageDataBlock: + ++count; + if (count == blockSize) { + count = 0; + state = ImageDataBlockSize; + } + break; + case ExtensionLabel: + switch (ch) { + case 0xf9: + state = GraphicControlExtension; + break; + case 0xff: + state = ApplicationExtension; + break; + default: + state = SkipBlockSize; + } + count = 0; + break; + case ApplicationExtension: + if (count < 11) + hold[count] = ch; + ++count; + if (count == hold[0] + 1) { + if (qstrncmp((char*)(hold+1), "NETSCAPE", 8) == 0) + state=NetscapeExtensionBlockSize; + else + state=SkipBlockSize; + count = 0; + } + break; + case GraphicControlExtension: + if (count < 5) + hold[count] = ch; + ++count; + if (count == hold[0] + 1) { + count = 0; + state = SkipBlockSize; + } + break; + case NetscapeExtensionBlockSize: + blockSize = ch; + count = 0; + if (blockSize) + state = NetscapeExtensionBlock; + else + state = Introducer; + break; + case NetscapeExtensionBlock: + if (count < 3) + hold[count] = ch; + count++; + if (count == blockSize) { + *loopCount = LM(hold[1], hold[2]); + state = SkipBlockSize; + } + break; + case SkipBlockSize: + blockSize = ch; + count = 0; + if (blockSize) { + if (length >= blockSize) { + // we can skip the block in one go + length -= blockSize; + buffer += blockSize; + } else { + state = SkipBlock; + } + } else { + state = Introducer; + } + break; + case SkipBlock: + ++count; + if (count == blockSize) + state = SkipBlockSize; + break; + case Done: + done = true; + break; + case Error: + device->seek(oldPos); + return; + } + } + readBuffer = device->read(readBufferSize); + } + device->seek(oldPos); + return; +} + +void QGIFFormat::fillRect(QImage *image, int col, int row, int w, int h, QRgb color) +{ + if (w>0) { + for (int j=0; jscanLine(j+row); + for (int i=0; ichanged(QRect(%d, %d, %d, %d))", left, y, right-left+1, my+1); + y+=8; + if (y>bottom) { + interlace++; y=top+4; + if (y > bottom) { // for really broken GIFs with bottom < 5 + interlace=2; + y = top + 2; + if (y > bottom) { // for really broken GIF with bottom < 3 + interlace = 0; + y = top + 1; + } + } + } + } break; + case 2: { + int i; + my = qMin(3, bottom-y); + // Don't dup with transparency + if (trans_index < 0) { + for (i=1; i<=my; i++) { + memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb), + (right-left+1)*sizeof(QRgb)); + } + } + + // if (!out_of_bounds) { + // ### Changed: QRect(left, y, right - left + 1, my + 1); + // } + y+=8; + if (y>bottom) { + interlace++; y=top+2; + // handle broken GIF with bottom < 3 + if (y > bottom) { + interlace = 3; + y = top + 1; + } + } + } break; + case 3: { + int i; + my = qMin(1, bottom-y); + // Don't dup with transparency + if (trans_index < 0) { + for (i=1; i<=my; i++) { + memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb), + (right-left+1)*sizeof(QRgb)); + } + } + // if (!out_of_bounds) { + // ### Changed: QRect(left, y, right - left + 1, my + 1); + // } + y+=4; + if (y>bottom) { interlace++; y=top+1; } + } break; + case 4: + // if (!out_of_bounds) { + // ### Changed: QRect(left, y, right - left + 1, 1); + // } + y+=2; + } + + // Consume bogus extra lines + if (y >= sheight) out_of_bounds=true; //y=bottom; +} + +inline QRgb QGIFFormat::color(uchar index) const +{ + if (index == trans_index || index > ncols) + return Q_TRANSPARENT; + + QRgb *map = lcmap ? localcmap : globalcmap; + return map ? map[index] : 0; +} + +//------------------------------------------------------------------------- +//------------------------------------------------------------------------- +//------------------------------------------------------------------------- + +QGifHandler::QGifHandler() +{ + gifFormat = new QGIFFormat; + nextDelay = 100; + loopCnt = 1; + frameNumber = -1; + scanIsCached = false; +} + +QGifHandler::~QGifHandler() +{ + delete gifFormat; +} + +// Does partial decode if necessary, just to see if an image is coming + +bool QGifHandler::imageIsComing() const +{ + const int GifChunkSize = 4096; + + while (!gifFormat->partialNewFrame) { + if (buffer.isEmpty()) { + buffer += device()->read(GifChunkSize); + if (buffer.isEmpty()) + break; + } + + int decoded = gifFormat->decode(&lastImage, (const uchar *)buffer.constData(), buffer.size(), + &nextDelay, &loopCnt); + if (decoded == -1) + break; + buffer.remove(0, decoded); + } + return gifFormat->partialNewFrame; +} + +bool QGifHandler::canRead() const +{ + if (canRead(device()) || imageIsComing()) { + setFormat("gif"); + return true; + } + + return false; +} + +bool QGifHandler::canRead(QIODevice *device) +{ + if (!device) { + qWarning("QGifHandler::canRead() called with no device"); + return false; + } + + char head[6]; + if (device->peek(head, sizeof(head)) == sizeof(head)) + return qstrncmp(head, "GIF87a", 6) == 0 + || qstrncmp(head, "GIF89a", 6) == 0; + return false; +} + +bool QGifHandler::read(QImage *image) +{ + const int GifChunkSize = 4096; + + while (!gifFormat->newFrame) { + if (buffer.isEmpty()) { + buffer += device()->read(GifChunkSize); + if (buffer.isEmpty()) + break; + } + + int decoded = gifFormat->decode(&lastImage, (const uchar *)buffer.constData(), buffer.size(), + &nextDelay, &loopCnt); + if (decoded == -1) + break; + buffer.remove(0, decoded); + } + if (gifFormat->newFrame || (gifFormat->partialNewFrame && device()->atEnd())) { + *image = lastImage; + ++frameNumber; + gifFormat->newFrame = false; + gifFormat->partialNewFrame = false; + return true; + } + + return false; +} + +bool QGifHandler::write(const QImage &image) +{ + Q_UNUSED(image); + return false; +} + +bool QGifHandler::supportsOption(ImageOption option) const +{ + if (!device() || device()->isSequential()) + return option == Animation; + else + return option == Size + || option == Animation; +} + +QVariant QGifHandler::option(ImageOption option) const +{ + if (option == Size) { + if (!scanIsCached) { + QGIFFormat::scan(device(), &imageSizes, &loopCnt); + scanIsCached = true; + } + // before the first frame is read, or we have an empty data stream + if (frameNumber == -1) + return (imageSizes.count() > 0) ? QVariant(imageSizes.at(0)) : QVariant(); + // after the last frame has been read, the next size is undefined + if (frameNumber >= imageSizes.count() - 1) + return QVariant(); + // and the last case: the size of the next frame + return imageSizes.at(frameNumber + 1); + } else if (option == Animation) { + return true; + } + return QVariant(); +} + +void QGifHandler::setOption(ImageOption option, const QVariant &value) +{ + Q_UNUSED(option); + Q_UNUSED(value); +} + +int QGifHandler::nextImageDelay() const +{ + return nextDelay; +} + +int QGifHandler::imageCount() const +{ + if (!scanIsCached) { + QGIFFormat::scan(device(), &imageSizes, &loopCnt); + scanIsCached = true; + } + return imageSizes.count(); +} + +int QGifHandler::loopCount() const +{ + if (!scanIsCached) { + QGIFFormat::scan(device(), &imageSizes, &loopCnt); + scanIsCached = true; + } + return loopCnt-1; // In GIF, loop count is iteration count, so subtract one +} + +int QGifHandler::currentImageNumber() const +{ + return frameNumber; +} + +QByteArray QGifHandler::name() const +{ + return "gif"; +} + +QT_END_NAMESPACE diff --git a/src/gui/image/qgifhandler.h b/src/gui/image/qgifhandler.h new file mode 100644 index 0000000..8e07aff --- /dev/null +++ b/src/gui/image/qgifhandler.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +** WARNING: +** A separate license from Unisys may be required to use the gif +** reader. See http://www.unisys.com/about__unisys/lzw/ +** for information from Unisys +** +****************************************************************************/ + +#ifndef QGIFHANDLER_H +#define QGIFHANDLER_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QGIFFormat; +class QGifHandler : public QImageIOHandler +{ +public: + QGifHandler(); + ~QGifHandler(); + + bool canRead() const; + bool read(QImage *image); + bool write(const QImage &image); + + QByteArray name() const; + + static bool canRead(QIODevice *device); + + QVariant option(ImageOption option) const; + void setOption(ImageOption option, const QVariant &value); + bool supportsOption(ImageOption option) const; + + int imageCount() const; + int loopCount() const; + int nextImageDelay() const; + int currentImageNumber() const; + +private: + bool imageIsComing() const; + QGIFFormat *gifFormat; + QString fileName; + mutable QByteArray buffer; + mutable QImage lastImage; + + mutable int nextDelay; + mutable int loopCnt; + int frameNumber; + mutable QVector imageSizes; + mutable bool scanIsCached; +}; + +QT_END_NAMESPACE + +#endif // QGIFHANDLER_H diff --git a/src/gui/image/qgifhandler.pri b/src/gui/image/qgifhandler.pri new file mode 100644 index 0000000..003476a --- /dev/null +++ b/src/gui/image/qgifhandler.pri @@ -0,0 +1,4 @@ +# common to plugin and built-in forms +INCLUDEPATH *= $$PWD +HEADERS += $$PWD/qgifhandler.h +SOURCES += $$PWD/qgifhandler.cpp diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp new file mode 100644 index 0000000..60e7cce --- /dev/null +++ b/src/gui/image/qjpeghandler.cpp @@ -0,0 +1,901 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qjpeghandler.h" + +#include +#include +#include +#include + +#include // jpeglib needs this to be pre-included +#include + +#ifdef FAR +#undef FAR +#endif + +// including jpeglib.h seems to be a little messy +extern "C" { +// mingw includes rpcndr.h but does not define boolean +#if defined(Q_OS_WIN) && defined(Q_CC_GNU) +# if defined(__RPCNDR_H__) && !defined(boolean) + typedef unsigned char boolean; +# define HAVE_BOOLEAN +# endif +#endif + +#define XMD_H // shut JPEGlib up +#if defined(Q_OS_UNIXWARE) +# define HAVE_BOOLEAN // libjpeg under Unixware seems to need this +#endif +#include +#ifdef const +# undef const // remove crazy C hackery in jconfig.h +#endif +} + +QT_BEGIN_NAMESPACE + +struct my_error_mgr : public jpeg_error_mgr { + jmp_buf setjmp_buffer; +}; + +#if defined(Q_C_CALLBACKS) +extern "C" { +#endif + +static void my_error_exit (j_common_ptr cinfo) +{ + my_error_mgr* myerr = (my_error_mgr*) cinfo->err; + char buffer[JMSG_LENGTH_MAX]; + (*cinfo->err->format_message)(cinfo, buffer); + qWarning("%s", buffer); + longjmp(myerr->setjmp_buffer, 1); +} + +#if defined(Q_C_CALLBACKS) +} +#endif + + +static const int max_buf = 4096; + +struct my_jpeg_source_mgr : public jpeg_source_mgr { + // Nothing dynamic - cannot rely on destruction over longjump + QIODevice *device; + JOCTET buffer[max_buf]; + const QBuffer *memDevice; + +public: + my_jpeg_source_mgr(QIODevice *device); +}; + +#if defined(Q_C_CALLBACKS) +extern "C" { +#endif + +static void qt_init_source(j_decompress_ptr) +{ +} + +static boolean qt_fill_input_buffer(j_decompress_ptr cinfo) +{ + my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src; + if (src->memDevice) { + src->next_input_byte = (const JOCTET *)(src->memDevice->data().constData() + src->memDevice->pos()); + src->bytes_in_buffer = (size_t)(src->memDevice->data().size() - src->memDevice->pos()); + return true; + } + src->next_input_byte = src->buffer; + int num_read = src->device->read((char*)src->buffer, max_buf); + if (num_read <= 0) { + // Insert a fake EOI marker - as per jpeglib recommendation + src->buffer[0] = (JOCTET) 0xFF; + src->buffer[1] = (JOCTET) JPEG_EOI; + src->bytes_in_buffer = 2; + } else { + src->bytes_in_buffer = num_read; + } +#if defined(Q_OS_UNIXWARE) + return B_TRUE; +#else + return true; +#endif +} + +static void qt_skip_input_data(j_decompress_ptr cinfo, long num_bytes) +{ + my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src; + + // `dumb' implementation from jpeglib + + /* Just a dumb implementation for now. Could use fseek() except + * it doesn't work on pipes. Not clear that being smart is worth + * any trouble anyway --- large skips are infrequent. + */ + if (num_bytes > 0) { + while (num_bytes > (long) src->bytes_in_buffer) { // Should not happen in case of memDevice + num_bytes -= (long) src->bytes_in_buffer; + (void) qt_fill_input_buffer(cinfo); + /* note we assume that qt_fill_input_buffer will never return false, + * so suspension need not be handled. + */ + } + src->next_input_byte += (size_t) num_bytes; + src->bytes_in_buffer -= (size_t) num_bytes; + } +} + +static void qt_term_source(j_decompress_ptr cinfo) +{ + my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src; + if (!src->device->isSequential()) + { + // read() isn't used for memDevice, so seek past everything that was used + if (src->memDevice) + src->device->seek(src->device->pos() + (src->memDevice->data().size() - src->memDevice->pos() - src->bytes_in_buffer)); + else + src->device->seek(src->device->pos() - src->bytes_in_buffer); + } +} + +#if defined(Q_C_CALLBACKS) +} +#endif + +inline my_jpeg_source_mgr::my_jpeg_source_mgr(QIODevice *device) +{ + jpeg_source_mgr::init_source = qt_init_source; + jpeg_source_mgr::fill_input_buffer = qt_fill_input_buffer; + jpeg_source_mgr::skip_input_data = qt_skip_input_data; + jpeg_source_mgr::resync_to_restart = jpeg_resync_to_restart; + jpeg_source_mgr::term_source = qt_term_source; + this->device = device; + memDevice = qobject_cast(device); + bytes_in_buffer = 0; + next_input_byte = buffer; +} + + +inline static bool read_jpeg_size(int &w, int &h, j_decompress_ptr cinfo) +{ + (void) jpeg_calc_output_dimensions(cinfo); + + w = cinfo->output_width; + h = cinfo->output_height; + return true; +} + +#define HIGH_QUALITY_THRESHOLD 50 + +inline static bool read_jpeg_format(QImage::Format &format, j_decompress_ptr cinfo) +{ + + bool result = true; + switch (cinfo->output_components) { + case 1: + format = QImage::Format_Indexed8; + break; + case 3: + case 4: + format = QImage::Format_RGB32; + break; + default: + result = false; + break; + } + cinfo->output_scanline = cinfo->output_height; + return result; +} + +static bool ensureValidImage(QImage *dest, struct jpeg_decompress_struct *info, + const QSize& size) +{ + QImage::Format format; + switch (info->output_components) { + case 1: + format = QImage::Format_Indexed8; + break; + case 3: + case 4: + format = QImage::Format_RGB32; + break; + default: + return false; // unsupported format + } + + if (dest->size() != size || dest->format() != format) { + *dest = QImage(size, format); + + if (format == QImage::Format_Indexed8) { + dest->setColorCount(256); + for (int i = 0; i < 256; i++) + dest->setColor(i, qRgb(i,i,i)); + } + } + + return !dest->isNull(); +} + +static bool read_jpeg_image(QImage *outImage, + QSize scaledSize, QRect scaledClipRect, + QRect clipRect, int inQuality, j_decompress_ptr info, struct my_error_mgr* err ) +{ + if (!setjmp(err->setjmp_buffer)) { + // -1 means default quality. + int quality = inQuality; + if (quality < 0) + quality = 75; + + // If possible, merge the scaledClipRect into either scaledSize + // or clipRect to avoid doing a separate scaled clipping pass. + // Best results are achieved by clipping before scaling, not after. + if (!scaledClipRect.isEmpty()) { + if (scaledSize.isEmpty() && clipRect.isEmpty()) { + // No clipping or scaling before final clip. + clipRect = scaledClipRect; + scaledClipRect = QRect(); + } else if (scaledSize.isEmpty()) { + // Clipping, but no scaling: combine the clip regions. + scaledClipRect.translate(clipRect.topLeft()); + clipRect = scaledClipRect.intersected(clipRect); + scaledClipRect = QRect(); + } else if (clipRect.isEmpty()) { + // No clipping, but scaling: if we can map back to an + // integer pixel boundary, then clip before scaling. + if ((info->image_width % scaledSize.width()) == 0 && + (info->image_height % scaledSize.height()) == 0) { + int x = scaledClipRect.x() * info->image_width / + scaledSize.width(); + int y = scaledClipRect.y() * info->image_height / + scaledSize.height(); + int width = (scaledClipRect.right() + 1) * + info->image_width / scaledSize.width() - x; + int height = (scaledClipRect.bottom() + 1) * + info->image_height / scaledSize.height() - y; + clipRect = QRect(x, y, width, height); + scaledSize = scaledClipRect.size(); + scaledClipRect = QRect(); + } + } else { + // Clipping and scaling: too difficult to figure out, + // and not a likely use case, so do it the long way. + } + } + + // Determine the scale factor to pass to libjpeg for quick downscaling. + if (!scaledSize.isEmpty()) { + if (clipRect.isEmpty()) { + info->scale_denom = + qMin(info->image_width / scaledSize.width(), + info->image_height / scaledSize.height()); + } else { + info->scale_denom = + qMin(clipRect.width() / scaledSize.width(), + clipRect.height() / scaledSize.height()); + } + if (info->scale_denom < 2) { + info->scale_denom = 1; + } else if (info->scale_denom < 4) { + info->scale_denom = 2; + } else if (info->scale_denom < 8) { + info->scale_denom = 4; + } else { + info->scale_denom = 8; + } + info->scale_num = 1; + if (!clipRect.isEmpty()) { + // Correct the scale factor so that we clip accurately. + // It is recommended that the clip rectangle be aligned + // on an 8-pixel boundary for best performance. + while (info->scale_denom > 1 && + ((clipRect.x() % info->scale_denom) != 0 || + (clipRect.y() % info->scale_denom) != 0 || + (clipRect.width() % info->scale_denom) != 0 || + (clipRect.height() % info->scale_denom) != 0)) { + info->scale_denom /= 2; + } + } + } + + // If high quality not required, use fast decompression + if( quality < HIGH_QUALITY_THRESHOLD ) { + info->dct_method = JDCT_IFAST; + info->do_fancy_upsampling = FALSE; + } + + (void) jpeg_calc_output_dimensions(info); + + // Determine the clip region to extract. + QRect imageRect(0, 0, info->output_width, info->output_height); + QRect clip; + if (clipRect.isEmpty()) { + clip = imageRect; + } else if (info->scale_denom == info->scale_num) { + clip = clipRect.intersected(imageRect); + } else { + // The scale factor was corrected above to ensure that + // we don't miss pixels when we scale the clip rectangle. + clip = QRect(clipRect.x() / int(info->scale_denom), + clipRect.y() / int(info->scale_denom), + clipRect.width() / int(info->scale_denom), + clipRect.height() / int(info->scale_denom)); + clip = clip.intersected(imageRect); + } + + // Allocate memory for the clipped QImage. + if (!ensureValidImage(outImage, info, clip.size())) + longjmp(err->setjmp_buffer, 1); + + // Avoid memcpy() overhead if grayscale with no clipping. + bool quickGray = (info->output_components == 1 && + clip == imageRect); + if (!quickGray) { + // Ask the jpeg library to allocate a temporary row. + // The library will automatically delete it for us later. + // The libjpeg docs say we should do this before calling + // jpeg_start_decompress(). We can't use "new" here + // because we are inside the setjmp() block and an error + // in the jpeg input stream would cause a memory leak. + JSAMPARRAY rows = (info->mem->alloc_sarray) + ((j_common_ptr)info, JPOOL_IMAGE, + info->output_width * info->output_components, 1); + + (void) jpeg_start_decompress(info); + + while (info->output_scanline < info->output_height) { + int y = int(info->output_scanline) - clip.y(); + if (y >= clip.height()) + break; // We've read the entire clip region, so abort. + + (void) jpeg_read_scanlines(info, rows, 1); + + if (y < 0) + continue; // Haven't reached the starting line yet. + + if (info->output_components == 3) { + // Expand 24->32 bpp. + uchar *in = rows[0] + clip.x() * 3; + QRgb *out = (QRgb*)outImage->scanLine(y); + for (int i = 0; i < clip.width(); ++i) { + *out++ = qRgb(in[0], in[1], in[2]); + in += 3; + } + } else if (info->out_color_space == JCS_CMYK) { + // Convert CMYK->RGB. + uchar *in = rows[0] + clip.x() * 4; + QRgb *out = (QRgb*)outImage->scanLine(y); + for (int i = 0; i < clip.width(); ++i) { + int k = in[3]; + *out++ = qRgb(k * in[0] / 255, k * in[1] / 255, + k * in[2] / 255); + in += 4; + } + } else if (info->output_components == 1) { + // Grayscale. + memcpy(outImage->scanLine(y), + rows[0] + clip.x(), clip.width()); + } + } + } else { + // Load unclipped grayscale data directly into the QImage. + (void) jpeg_start_decompress(info); + while (info->output_scanline < info->output_height) { + uchar *row = outImage->scanLine(info->output_scanline); + (void) jpeg_read_scanlines(info, &row, 1); + } + } + + if (info->output_scanline == info->output_height) + (void) jpeg_finish_decompress(info); + + if (info->density_unit == 1) { + outImage->setDotsPerMeterX(int(100. * info->X_density / 2.54)); + outImage->setDotsPerMeterY(int(100. * info->Y_density / 2.54)); + } else if (info->density_unit == 2) { + outImage->setDotsPerMeterX(int(100. * info->X_density)); + outImage->setDotsPerMeterY(int(100. * info->Y_density)); + } + + if (scaledSize.isValid() && scaledSize != clip.size()) { + *outImage = outImage->scaled(scaledSize, Qt::IgnoreAspectRatio, quality >= HIGH_QUALITY_THRESHOLD ? Qt::SmoothTransformation : Qt::FastTransformation); + } + + if (!scaledClipRect.isEmpty()) + *outImage = outImage->copy(scaledClipRect); + return !outImage->isNull(); + } + else + return false; +} + +struct my_jpeg_destination_mgr : public jpeg_destination_mgr { + // Nothing dynamic - cannot rely on destruction over longjump + QIODevice *device; + JOCTET buffer[max_buf]; + +public: + my_jpeg_destination_mgr(QIODevice *); +}; + + +#if defined(Q_C_CALLBACKS) +extern "C" { +#endif + +static void qt_init_destination(j_compress_ptr) +{ +} + +static boolean qt_empty_output_buffer(j_compress_ptr cinfo) +{ + my_jpeg_destination_mgr* dest = (my_jpeg_destination_mgr*)cinfo->dest; + + int written = dest->device->write((char*)dest->buffer, max_buf); + if (written == -1) + (*cinfo->err->error_exit)((j_common_ptr)cinfo); + + dest->next_output_byte = dest->buffer; + dest->free_in_buffer = max_buf; + +#if defined(Q_OS_UNIXWARE) + return B_TRUE; +#else + return true; +#endif +} + +static void qt_term_destination(j_compress_ptr cinfo) +{ + my_jpeg_destination_mgr* dest = (my_jpeg_destination_mgr*)cinfo->dest; + qint64 n = max_buf - dest->free_in_buffer; + + qint64 written = dest->device->write((char*)dest->buffer, n); + if (written == -1) + (*cinfo->err->error_exit)((j_common_ptr)cinfo); +} + +#if defined(Q_C_CALLBACKS) +} +#endif + +inline my_jpeg_destination_mgr::my_jpeg_destination_mgr(QIODevice *device) +{ + jpeg_destination_mgr::init_destination = qt_init_destination; + jpeg_destination_mgr::empty_output_buffer = qt_empty_output_buffer; + jpeg_destination_mgr::term_destination = qt_term_destination; + this->device = device; + next_output_byte = buffer; + free_in_buffer = max_buf; +} + +static bool can_write_format(QImage::Format fmt) +{ + switch (fmt) { + case QImage::Format_Mono: + case QImage::Format_MonoLSB: + case QImage::Format_Indexed8: + case QImage::Format_RGB888: + case QImage::Format_RGB32: + case QImage::Format_ARGB32: + case QImage::Format_ARGB32_Premultiplied: + return true; + break; + default: + break; + } + return false; +} + +static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int sourceQuality) +{ + bool success = false; + const QImage image = can_write_format(sourceImage.format()) ? + sourceImage : sourceImage.convertToFormat(QImage::Format_RGB888); + const QVector cmap = image.colorTable(); + + struct jpeg_compress_struct cinfo; + JSAMPROW row_pointer[1]; + row_pointer[0] = 0; + + struct my_jpeg_destination_mgr *iod_dest = new my_jpeg_destination_mgr(device); + struct my_error_mgr jerr; + + cinfo.err = jpeg_std_error(&jerr); + jerr.error_exit = my_error_exit; + + if (!setjmp(jerr.setjmp_buffer)) { + // WARNING: + // this if loop is inside a setjmp/longjmp branch + // do not create C++ temporaries here because the destructor may never be called + // if you allocate memory, make sure that you can free it (row_pointer[0]) + jpeg_create_compress(&cinfo); + + cinfo.dest = iod_dest; + + cinfo.image_width = image.width(); + cinfo.image_height = image.height(); + + bool gray=false; + switch (image.format()) { + case QImage::Format_Mono: + case QImage::Format_MonoLSB: + case QImage::Format_Indexed8: + gray = true; + for (int i = image.colorCount(); gray && i--;) { + gray = gray & (qRed(cmap[i]) == qGreen(cmap[i]) && + qRed(cmap[i]) == qBlue(cmap[i])); + } + cinfo.input_components = gray ? 1 : 3; + cinfo.in_color_space = gray ? JCS_GRAYSCALE : JCS_RGB; + break; + default: + cinfo.input_components = 3; + cinfo.in_color_space = JCS_RGB; + } + + jpeg_set_defaults(&cinfo); + + qreal diffInch = qAbs(image.dotsPerMeterX()*2.54/100. - qRound(image.dotsPerMeterX()*2.54/100.)) + + qAbs(image.dotsPerMeterY()*2.54/100. - qRound(image.dotsPerMeterY()*2.54/100.)); + qreal diffCm = (qAbs(image.dotsPerMeterX()/100. - qRound(image.dotsPerMeterX()/100.)) + + qAbs(image.dotsPerMeterY()/100. - qRound(image.dotsPerMeterY()/100.)))*2.54; + if (diffInch < diffCm) { + cinfo.density_unit = 1; // dots/inch + cinfo.X_density = qRound(image.dotsPerMeterX()*2.54/100.); + cinfo.Y_density = qRound(image.dotsPerMeterY()*2.54/100.); + } else { + cinfo.density_unit = 2; // dots/cm + cinfo.X_density = (image.dotsPerMeterX()+50) / 100; + cinfo.Y_density = (image.dotsPerMeterY()+50) / 100; + } + + + int quality = sourceQuality >= 0 ? qMin(sourceQuality,100) : 75; +#if defined(Q_OS_UNIXWARE) + jpeg_set_quality(&cinfo, quality, B_TRUE /* limit to baseline-JPEG values */); + jpeg_start_compress(&cinfo, B_TRUE); +#else + jpeg_set_quality(&cinfo, quality, true /* limit to baseline-JPEG values */); + jpeg_start_compress(&cinfo, true); +#endif + + row_pointer[0] = new uchar[cinfo.image_width*cinfo.input_components]; + int w = cinfo.image_width; + while (cinfo.next_scanline < cinfo.image_height) { + uchar *row = row_pointer[0]; + switch (image.format()) { + case QImage::Format_Mono: + case QImage::Format_MonoLSB: + if (gray) { + const uchar* data = image.scanLine(cinfo.next_scanline); + if (image.format() == QImage::Format_MonoLSB) { + for (int i=0; i> 3)) & (1 << (i & 7))); + row[i] = qRed(cmap[bit]); + } + } else { + for (int i=0; i> 3)) & (1 << (7 -(i & 7)))); + row[i] = qRed(cmap[bit]); + } + } + } else { + const uchar* data = image.scanLine(cinfo.next_scanline); + if (image.format() == QImage::Format_MonoLSB) { + for (int i=0; i> 3)) & (1 << (i & 7))); + *row++ = qRed(cmap[bit]); + *row++ = qGreen(cmap[bit]); + *row++ = qBlue(cmap[bit]); + } + } else { + for (int i=0; i> 3)) & (1 << (7 -(i & 7)))); + *row++ = qRed(cmap[bit]); + *row++ = qGreen(cmap[bit]); + *row++ = qBlue(cmap[bit]); + } + } + } + break; + case QImage::Format_Indexed8: + if (gray) { + const uchar* pix = image.scanLine(cinfo.next_scanline); + for (int i=0; idevice()); + + if(state == ReadHeader) + { + bool success = read_jpeg_image(image, scaledSize, scaledClipRect, clipRect, quality, &info, &err); + state = success ? Ready : Error; + return success; + } + + return false; + +} + +QJpegHandler::QJpegHandler() + : d(new QJpegHandlerPrivate(this)) +{ +} + +QJpegHandler::~QJpegHandler() +{ + delete d; +} + +bool QJpegHandler::canRead() const +{ + if(d->state == QJpegHandlerPrivate::Ready && !canRead(device())) + return false; + + if (d->state != QJpegHandlerPrivate::Error) { + setFormat("jpeg"); + return true; + } + + return false; +} + +bool QJpegHandler::canRead(QIODevice *device) +{ + if (!device) { + qWarning("QJpegHandler::canRead() called with no device"); + return false; + } + + char buffer[2]; + if (device->peek(buffer, 2) != 2) + return false; + return uchar(buffer[0]) == 0xff && uchar(buffer[1]) == 0xd8; +} + +bool QJpegHandler::read(QImage *image) +{ + if (!canRead()) + return false; + return d->read(image); +} + +bool QJpegHandler::write(const QImage &image) +{ + return write_jpeg_image(image, device(), d->quality); +} + +bool QJpegHandler::supportsOption(ImageOption option) const +{ + return option == Quality + || option == ScaledSize + || option == ScaledClipRect + || option == ClipRect + || option == Size + || option == ImageFormat; +} + +QVariant QJpegHandler::option(ImageOption option) const +{ + switch(option) { + case Quality: + return d->quality; + case ScaledSize: + return d->scaledSize; + case ScaledClipRect: + return d->scaledClipRect; + case ClipRect: + return d->clipRect; + case Size: + d->readJpegHeader(device()); + return d->size; + case ImageFormat: + d->readJpegHeader(device()); + return d->format; + default: + return QVariant(); + } +} + +void QJpegHandler::setOption(ImageOption option, const QVariant &value) +{ + switch(option) { + case Quality: + d->quality = value.toInt(); + break; + case ScaledSize: + d->scaledSize = value.toSize(); + break; + case ScaledClipRect: + d->scaledClipRect = value.toRect(); + break; + case ClipRect: + d->clipRect = value.toRect(); + break; + default: + break; + } +} + +QByteArray QJpegHandler::name() const +{ + return "jpeg"; +} + + + + +QT_END_NAMESPACE diff --git a/src/gui/image/qjpeghandler.h b/src/gui/image/qjpeghandler.h new file mode 100644 index 0000000..c879f21 --- /dev/null +++ b/src/gui/image/qjpeghandler.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QJPEGHANDLER_H +#define QJPEGHANDLER_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QJpegHandlerPrivate; +class QJpegHandler : public QImageIOHandler +{ +public: + QJpegHandler(); + ~QJpegHandler(); + + bool canRead() const; + bool read(QImage *image); + bool write(const QImage &image); + + QByteArray name() const; + + static bool canRead(QIODevice *device); + + QVariant option(ImageOption option) const; + void setOption(ImageOption option, const QVariant &value); + bool supportsOption(ImageOption option) const; + +private: + QJpegHandlerPrivate *d; +}; + +QT_END_NAMESPACE + +#endif // QJPEGHANDLER_H diff --git a/src/gui/image/qjpeghandler.pri b/src/gui/image/qjpeghandler.pri new file mode 100644 index 0000000..28ec7dc --- /dev/null +++ b/src/gui/image/qjpeghandler.pri @@ -0,0 +1,10 @@ +# common to plugin and built-in forms +INCLUDEPATH *= $$PWD +HEADERS += $$PWD/qjpeghandler.h +SOURCES += $$PWD/qjpeghandler.cpp +contains(QT_CONFIG, system-jpeg) { + if(unix|win32-g++*): LIBS += -ljpeg + else:win32: LIBS += libjpeg.lib +} else { + include($$PWD/../../3rdparty/libjpeg.pri) +} diff --git a/src/gui/image/qmnghandler.cpp b/src/gui/image/qmnghandler.cpp new file mode 100644 index 0000000..ec442a1 --- /dev/null +++ b/src/gui/image/qmnghandler.cpp @@ -0,0 +1,497 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmnghandler.h" + +#include "qimage.h" +#include "qvariant.h" +#include "qcolor.h" + +#define MNG_USE_SO +#include + +QT_BEGIN_NAMESPACE + +class QMngHandlerPrivate +{ + Q_DECLARE_PUBLIC(QMngHandler) + public: + bool haveReadNone; + bool haveReadAll; + mng_handle hMNG; + QImage image; + int elapsed; + int nextDelay; + int iterCount; + int frameIndex; + int nextIndex; + int frameCount; + mng_uint32 iStyle; + mng_bool readData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pRead); + mng_bool writeData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pWritten); + mng_bool processHeader(mng_uint32 iWidth, mng_uint32 iHeight); + QMngHandlerPrivate(QMngHandler *q_ptr); + ~QMngHandlerPrivate(); + bool getNextImage(QImage *result); + bool writeImage(const QImage &image); + int currentImageNumber() const; + int imageCount() const; + bool jumpToImage(int imageNumber); + bool jumpToNextImage(); + int nextImageDelay() const; + bool setBackgroundColor(const QColor &color); + QColor backgroundColor() const; + QMngHandler *q_ptr; +}; + +static mng_bool myerror(mng_handle /*hMNG*/, + mng_int32 iErrorcode, + mng_int8 /*iSeverity*/, + mng_chunkid iChunkname, + mng_uint32 /*iChunkseq*/, + mng_int32 iExtra1, + mng_int32 iExtra2, + mng_pchar zErrortext) +{ + qWarning("MNG error %d: %s; chunk %c%c%c%c; subcode %d:%d", + iErrorcode,zErrortext, + (iChunkname>>24)&0xff, + (iChunkname>>16)&0xff, + (iChunkname>>8)&0xff, + (iChunkname>>0)&0xff, + iExtra1,iExtra2); + return TRUE; +} + +static mng_ptr myalloc(mng_size_t iSize) +{ +#if defined(Q_OS_WINCE) + mng_ptr ptr = malloc(iSize); + memset(ptr, 0, iSize); + return ptr; +#else + return (mng_ptr)calloc(1, iSize); +#endif +} + +static void myfree(mng_ptr pPtr, mng_size_t /*iSize*/) +{ + free(pPtr); +} + +static mng_bool myopenstream(mng_handle) +{ + return MNG_TRUE; +} + +static mng_bool myclosestream(mng_handle hMNG) +{ + QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); + pMydata->haveReadAll = true; + return MNG_TRUE; +} + +static mng_bool myreaddata(mng_handle hMNG, + mng_ptr pBuf, + mng_uint32 iSize, + mng_uint32p pRead) +{ + QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); + return pMydata->readData(pBuf, iSize, pRead); +} + +static mng_bool mywritedata(mng_handle hMNG, + mng_ptr pBuf, + mng_uint32 iSize, + mng_uint32p pWritten) +{ + QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); + return pMydata->writeData(pBuf, iSize, pWritten); +} + +static mng_bool myprocessheader(mng_handle hMNG, + mng_uint32 iWidth, + mng_uint32 iHeight) +{ + QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); + return pMydata->processHeader(iWidth, iHeight); +} + +static mng_ptr mygetcanvasline(mng_handle hMNG, + mng_uint32 iLinenr) +{ + QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); + return (mng_ptr)pMydata->image.scanLine(iLinenr); +} + +static mng_bool myrefresh(mng_handle /*hMNG*/, + mng_uint32 /*iX*/, + mng_uint32 /*iY*/, + mng_uint32 /*iWidth*/, + mng_uint32 /*iHeight*/) +{ + return MNG_TRUE; +} + +static mng_uint32 mygettickcount(mng_handle hMNG) +{ + QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); + return pMydata->elapsed++; +} + +static mng_bool mysettimer(mng_handle hMNG, + mng_uint32 iMsecs) +{ + QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); + pMydata->elapsed += iMsecs; + pMydata->nextDelay = iMsecs; + return MNG_TRUE; +} + +static mng_bool myprocessterm(mng_handle hMNG, + mng_uint8 iTermaction, + mng_uint8 /*iIteraction*/, + mng_uint32 /*iDelay*/, + mng_uint32 iItermax) +{ + QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); + if (iTermaction == 3) + pMydata->iterCount = iItermax; + return MNG_TRUE; +} + +static mng_bool mytrace(mng_handle, + mng_int32 iFuncnr, + mng_int32 iFuncseq, + mng_pchar zFuncname) +{ + qDebug("mng trace: iFuncnr: %d iFuncseq: %d zFuncname: %s", iFuncnr, iFuncseq, zFuncname); + return MNG_TRUE; +} + +QMngHandlerPrivate::QMngHandlerPrivate(QMngHandler *q_ptr) + : haveReadNone(true), haveReadAll(false), elapsed(0), nextDelay(0), iterCount(1), + frameIndex(-1), nextIndex(0), frameCount(0), q_ptr(q_ptr) +{ + iStyle = (QSysInfo::ByteOrder == QSysInfo::LittleEndian) ? MNG_CANVAS_BGRA8 : MNG_CANVAS_ARGB8; + // Initialize libmng + hMNG = mng_initialize((mng_ptr)this, myalloc, myfree, mytrace); + if (hMNG) { + // Set callback functions + mng_setcb_errorproc(hMNG, myerror); + mng_setcb_openstream(hMNG, myopenstream); + mng_setcb_closestream(hMNG, myclosestream); + mng_setcb_readdata(hMNG, myreaddata); + mng_setcb_writedata(hMNG, mywritedata); + mng_setcb_processheader(hMNG, myprocessheader); + mng_setcb_getcanvasline(hMNG, mygetcanvasline); + mng_setcb_refresh(hMNG, myrefresh); + mng_setcb_gettickcount(hMNG, mygettickcount); + mng_setcb_settimer(hMNG, mysettimer); + mng_setcb_processterm(hMNG, myprocessterm); + mng_set_doprogressive(hMNG, MNG_FALSE); + mng_set_suspensionmode(hMNG, MNG_TRUE); + } +} + +QMngHandlerPrivate::~QMngHandlerPrivate() +{ + mng_cleanup(&hMNG); +} + +mng_bool QMngHandlerPrivate::readData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pRead) +{ + Q_Q(QMngHandler); + *pRead = q->device()->read((char *)pBuf, iSize); + return (*pRead > 0) ? MNG_TRUE : MNG_FALSE; +} + +mng_bool QMngHandlerPrivate::writeData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pWritten) +{ + Q_Q(QMngHandler); + *pWritten = q->device()->write((char *)pBuf, iSize); + return MNG_TRUE; +} + +mng_bool QMngHandlerPrivate::processHeader(mng_uint32 iWidth, mng_uint32 iHeight) +{ + if (mng_set_canvasstyle(hMNG, iStyle) != MNG_NOERROR) + return MNG_FALSE; + image = QImage(iWidth, iHeight, QImage::Format_ARGB32); + image.fill(0); + return MNG_TRUE; +} + +bool QMngHandlerPrivate::getNextImage(QImage *result) +{ + mng_retcode ret; + if (haveReadNone) { + haveReadNone = false; + ret = mng_readdisplay(hMNG); + } else { + ret = mng_display_resume(hMNG); + } + if ((MNG_NOERROR == ret) || (MNG_NEEDTIMERWAIT == ret)) { + *result = image; + frameIndex = nextIndex++; + if (haveReadAll && (frameCount == 0)) + frameCount = nextIndex; + return true; + } + return false; +} + +bool QMngHandlerPrivate::writeImage(const QImage &image) +{ + mng_reset(hMNG); + if (mng_create(hMNG) != MNG_NOERROR) + return false; + + this->image = image.convertToFormat(QImage::Format_ARGB32); + int w = image.width(); + int h = image.height(); + + if ( + // width, height, ticks, layercount, framecount, playtime, simplicity + (mng_putchunk_mhdr(hMNG, w, h, 1000, 0, 0, 0, 7) == MNG_NOERROR) && + // termination_action, action_after_iterations, delay, iteration_max + (mng_putchunk_term(hMNG, 3, 0, 1, 0x7FFFFFFF) == MNG_NOERROR) && + // width, height, bitdepth, colortype, compression, filter, interlace + (mng_putchunk_ihdr(hMNG, w, h, 8, 6, 0, 0, 0) == MNG_NOERROR) && + // width, height, colortype, bitdepth, compression, filter, interlace, canvasstyle, getcanvasline + (mng_putimgdata_ihdr(hMNG, w, h, 6, 8, 0, 0, 0, iStyle, mygetcanvasline) == MNG_NOERROR) && + (mng_putchunk_iend(hMNG) == MNG_NOERROR) && + (mng_putchunk_mend(hMNG) == MNG_NOERROR) && + (mng_write(hMNG) == MNG_NOERROR) + ) + return true; + return false; +} + +int QMngHandlerPrivate::currentImageNumber() const +{ +// return mng_get_currentframe(hMNG) % imageCount(); not implemented, apparently + return frameIndex; +} + +int QMngHandlerPrivate::imageCount() const +{ +// return mng_get_totalframes(hMNG); not implemented, apparently + if (haveReadAll) + return frameCount; + return 0; // Don't know +} + +bool QMngHandlerPrivate::jumpToImage(int imageNumber) +{ + if (imageNumber == nextIndex) + return true; + + if ((imageNumber == 0) && haveReadAll && (nextIndex == frameCount)) { + // Loop! + nextIndex = 0; + return true; + } + if (mng_display_freeze(hMNG) == MNG_NOERROR) { + if (mng_display_goframe(hMNG, imageNumber) == MNG_NOERROR) { + nextIndex = imageNumber; + return true; + } + } + return false; +} + +bool QMngHandlerPrivate::jumpToNextImage() +{ + return jumpToImage((currentImageNumber()+1) % imageCount()); +} + +int QMngHandlerPrivate::nextImageDelay() const +{ + return nextDelay; +} + +bool QMngHandlerPrivate::setBackgroundColor(const QColor &color) +{ + mng_uint16 iRed = (mng_uint16)(color.red() << 8); + mng_uint16 iBlue = (mng_uint16)(color.blue() << 8); + mng_uint16 iGreen = (mng_uint16)(color.green() << 8); + return (mng_set_bgcolor(hMNG, iRed, iBlue, iGreen) == MNG_NOERROR); +} + +QColor QMngHandlerPrivate::backgroundColor() const +{ + mng_uint16 iRed; + mng_uint16 iBlue; + mng_uint16 iGreen; + if (mng_get_bgcolor(hMNG, &iRed, &iBlue, &iGreen) == MNG_NOERROR) + return QColor((iRed >> 8) & 0xFF, (iGreen >> 8) & 0xFF, (iBlue >> 8) & 0xFF); + return QColor(); +} + +QMngHandler::QMngHandler() + : d_ptr(new QMngHandlerPrivate(this)) +{ +} + +QMngHandler::~QMngHandler() +{ +} + +/*! \reimp */ +bool QMngHandler::canRead() const +{ + Q_D(const QMngHandler); + if ((!d->haveReadNone + && (!d->haveReadAll || (d->haveReadAll && (d->nextIndex < d->frameCount)))) + || canRead(device())) + { + setFormat("mng"); + return true; + } + return false; +} + +/*! \internal */ +bool QMngHandler::canRead(QIODevice *device) +{ + if (!device) { + qWarning("QMngHandler::canRead() called with no device"); + return false; + } + + return device->peek(8) == "\x8A\x4D\x4E\x47\x0D\x0A\x1A\x0A"; +} + +/*! \reimp */ +QByteArray QMngHandler::name() const +{ + return "mng"; +} + +/*! \reimp */ +bool QMngHandler::read(QImage *image) +{ + Q_D(QMngHandler); + return canRead() ? d->getNextImage(image) : false; +} + +/*! \reimp */ +bool QMngHandler::write(const QImage &image) +{ + Q_D(QMngHandler); + return d->writeImage(image); +} + +/*! \reimp */ +int QMngHandler::currentImageNumber() const +{ + Q_D(const QMngHandler); + return d->currentImageNumber(); +} + +/*! \reimp */ +int QMngHandler::imageCount() const +{ + Q_D(const QMngHandler); + return d->imageCount(); +} + +/*! \reimp */ +bool QMngHandler::jumpToImage(int imageNumber) +{ + Q_D(QMngHandler); + return d->jumpToImage(imageNumber); +} + +/*! \reimp */ +bool QMngHandler::jumpToNextImage() +{ + Q_D(QMngHandler); + return d->jumpToNextImage(); +} + +/*! \reimp */ +int QMngHandler::loopCount() const +{ + Q_D(const QMngHandler); + if (d->iterCount == 0x7FFFFFFF) + return -1; // infinite loop + return d->iterCount-1; +} + +/*! \reimp */ +int QMngHandler::nextImageDelay() const +{ + Q_D(const QMngHandler); + return d->nextImageDelay(); +} + +/*! \reimp */ +QVariant QMngHandler::option(ImageOption option) const +{ + Q_D(const QMngHandler); + if (option == QImageIOHandler::Animation) + return true; + else if (option == QImageIOHandler::BackgroundColor) + return d->backgroundColor(); + return QVariant(); +} + +/*! \reimp */ +void QMngHandler::setOption(ImageOption option, const QVariant & value) +{ + Q_D(QMngHandler); + if (option == QImageIOHandler::BackgroundColor) + d->setBackgroundColor(qVariantValue(value)); +} + +/*! \reimp */ +bool QMngHandler::supportsOption(ImageOption option) const +{ + if (option == QImageIOHandler::Animation) + return true; + else if (option == QImageIOHandler::BackgroundColor) + return true; + return false; +} + +QT_END_NAMESPACE diff --git a/src/gui/image/qmnghandler.h b/src/gui/image/qmnghandler.h new file mode 100644 index 0000000..65243be --- /dev/null +++ b/src/gui/image/qmnghandler.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMNGHANDLER_H +#define QMNGHANDLER_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QImage; +class QByteArray; +class QIODevice; +class QVariant; +class QMngHandlerPrivate; + +class QMngHandler : public QImageIOHandler +{ + public: + QMngHandler(); + ~QMngHandler(); + virtual bool canRead() const; + virtual QByteArray name() const; + virtual bool read(QImage *image); + virtual bool write(const QImage &image); + virtual int currentImageNumber() const; + virtual int imageCount() const; + virtual bool jumpToImage(int imageNumber); + virtual bool jumpToNextImage(); + virtual int loopCount() const; + virtual int nextImageDelay() const; + static bool canRead(QIODevice *device); + virtual QVariant option(ImageOption option) const; + virtual void setOption(ImageOption option, const QVariant & value); + virtual bool supportsOption(ImageOption option) const; + + private: + Q_DECLARE_PRIVATE(QMngHandler) + QScopedPointer d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QMNGHANDLER_H diff --git a/src/gui/image/qmnghandler.pri b/src/gui/image/qmnghandler.pri new file mode 100644 index 0000000..ec1c19e --- /dev/null +++ b/src/gui/image/qmnghandler.pri @@ -0,0 +1,10 @@ +# common to plugin and built-in forms +INCLUDEPATH *= $$PWD +HEADERS += $$PWD/qmnghandler.h +SOURCES += $$PWD/qmnghandler.cpp +contains(QT_CONFIG, system-mng) { + if(unix|win32-g++*):LIBS += -lmng + else:win32: LIBS += libmng.lib +} else { + include($$PWD/../../3rdparty/libmng.pri) +} diff --git a/src/gui/image/qpnghandler.pri b/src/gui/image/qpnghandler.pri new file mode 100644 index 0000000..bedf23f --- /dev/null +++ b/src/gui/image/qpnghandler.pri @@ -0,0 +1,10 @@ +INCLUDEPATH *= $$PWD +HEADERS += $$PWD/qpnghandler_p.h +SOURCES += $$PWD/qpnghandler.cpp +contains(QT_CONFIG, system-png) { + if(unix|win32-g++*): LIBS_PRIVATE += -lpng + else:win32: LIBS += libpng.lib + +} else { + include($$PWD/../../3rdparty/libpng.pri) +} diff --git a/src/gui/image/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp new file mode 100644 index 0000000..619aa4e --- /dev/null +++ b/src/gui/image/qtiffhandler.cpp @@ -0,0 +1,661 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtiffhandler.h" +#include +#include +#include +#include +extern "C" { +#include "tiffio.h" +} + +QT_BEGIN_NAMESPACE + +tsize_t qtiffReadProc(thandle_t fd, tdata_t buf, tsize_t size) +{ + QIODevice* device = static_cast(fd)->device(); + return device->isReadable() ? device->read(static_cast(buf), size) : -1; +} + +tsize_t qtiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size) +{ + return static_cast(fd)->device()->write(static_cast(buf), size); +} + +toff_t qtiffSeekProc(thandle_t fd, toff_t off, int whence) +{ + QIODevice *device = static_cast(fd)->device(); + switch (whence) { + case SEEK_SET: + device->seek(off); + break; + case SEEK_CUR: + device->seek(device->pos() + off); + break; + case SEEK_END: + device->seek(device->size() + off); + break; + } + + return device->pos(); +} + +int qtiffCloseProc(thandle_t /*fd*/) +{ + return 0; +} + +toff_t qtiffSizeProc(thandle_t fd) +{ + return static_cast(fd)->device()->size(); +} + +int qtiffMapProc(thandle_t /*fd*/, tdata_t* /*pbase*/, toff_t* /*psize*/) +{ + return 0; +} + +void qtiffUnmapProc(thandle_t /*fd*/, tdata_t /*base*/, toff_t /*size*/) +{ +} + +// for 32 bits images +inline void rotate_right_mirror_horizontal(QImage *const image)// rotate right->mirrored horizontal +{ + const int height = image->height(); + const int width = image->width(); + QImage generated(/* width = */ height, /* height = */ width, image->format()); + const uint32 *originalPixel = reinterpret_cast(image->bits()); + uint32 *const generatedPixels = reinterpret_cast(generated.bits()); + for (int row=0; row < height; ++row) { + for (int col=0; col < width; ++col) { + int idx = col * height + row; + generatedPixels[idx] = *originalPixel; + ++originalPixel; + } + } + *image = generated; +} + +inline void rotate_right_mirror_vertical(QImage *const image) // rotate right->mirrored vertical +{ + const int height = image->height(); + const int width = image->width(); + QImage generated(/* width = */ height, /* height = */ width, image->format()); + const int lastCol = width - 1; + const int lastRow = height - 1; + const uint32 *pixel = reinterpret_cast(image->bits()); + uint32 *const generatedBits = reinterpret_cast(generated.bits()); + for (int row=0; row < height; ++row) { + for (int col=0; col < width; ++col) { + int idx = (lastCol - col) * height + (lastRow - row); + generatedBits[idx] = *pixel; + ++pixel; + } + } + *image = generated; +} + +QTiffHandler::QTiffHandler() : QImageIOHandler() +{ + compression = NoCompression; +} + +bool QTiffHandler::canRead() const +{ + if (canRead(device())) { + setFormat("tiff"); + return true; + } + return false; +} + +bool QTiffHandler::canRead(QIODevice *device) +{ + if (!device) { + qWarning("QTiffHandler::canRead() called with no device"); + return false; + } + + // current implementation uses TIFFClientOpen which needs to be + // able to seek, so sequential devices are not supported + QByteArray header = device->peek(4); + return header == QByteArray::fromRawData("\x49\x49\x2A\x00", 4) + || header == QByteArray::fromRawData("\x4D\x4D\x00\x2A", 4); +} + +bool QTiffHandler::read(QImage *image) +{ + if (!canRead()) + return false; + + TIFF *const tiff = TIFFClientOpen("foo", + "r", + this, + qtiffReadProc, + qtiffWriteProc, + qtiffSeekProc, + qtiffCloseProc, + qtiffSizeProc, + qtiffMapProc, + qtiffUnmapProc); + + if (!tiff) { + return false; + } + uint32 width; + uint32 height; + uint16 photometric; + if (!TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width) + || !TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height) + || !TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric)) { + TIFFClose(tiff); + return false; + } + + // BitsPerSample defaults to 1 according to the TIFF spec. + uint16 bitPerSample; + if (!TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitPerSample)) + bitPerSample = 1; + + bool grayscale = photometric == PHOTOMETRIC_MINISBLACK || photometric == PHOTOMETRIC_MINISWHITE; + if (grayscale && bitPerSample == 1) { + if (image->size() != QSize(width, height) || image->format() != QImage::Format_Mono) + *image = QImage(width, height, QImage::Format_Mono); + QVector colortable(2); + if (photometric == PHOTOMETRIC_MINISBLACK) { + colortable[0] = 0xff000000; + colortable[1] = 0xffffffff; + } else { + colortable[0] = 0xffffffff; + colortable[1] = 0xff000000; + } + image->setColorTable(colortable); + + if (!image->isNull()) { + for (uint32 y=0; yscanLine(y), y, 0) < 0) { + TIFFClose(tiff); + return false; + } + } + } + } else { + if ((grayscale || photometric == PHOTOMETRIC_PALETTE) && bitPerSample == 8) { + if (image->size() != QSize(width, height) || image->format() != QImage::Format_Indexed8) + *image = QImage(width, height, QImage::Format_Indexed8); + if (!image->isNull()) { + const uint16 tableSize = 256; + QVector qtColorTable(tableSize); + if (grayscale) { + for (int i = 0; i(qMalloc(tableSize * sizeof(uint16))); + uint16 *greenTable = static_cast(qMalloc(tableSize * sizeof(uint16))); + uint16 *blueTable = static_cast(qMalloc(tableSize * sizeof(uint16))); + if (!redTable || !greenTable || !blueTable) { + TIFFClose(tiff); + return false; + } + if (!TIFFGetField(tiff, TIFFTAG_COLORMAP, &redTable, &greenTable, &blueTable)) { + TIFFClose(tiff); + return false; + } + + for (int i = 0; isetColorTable(qtColorTable); + for (uint32 y=0; yscanLine(y), y, 0) < 0) { + TIFFClose(tiff); + return false; + } + } + + // free redTable, greenTable and greenTable done by libtiff + } + } else { + if (image->size() != QSize(width, height) || image->format() != QImage::Format_ARGB32) + *image = QImage(width, height, QImage::Format_ARGB32); + if (!image->isNull()) { + const int stopOnError = 1; + if (TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast(image->bits()), ORIENTATION_TOPLEFT, stopOnError)) { + for (uint32 y=0; yscanLine(y), width); + } else { + TIFFClose(tiff); + return false; + } + } + } + } + + if (image->isNull()) { + TIFFClose(tiff); + return false; + } + + float resX = 0; + float resY = 0; + uint16 resUnit = RESUNIT_NONE; + if (TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit) + && TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &resX) + && TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &resY)) { + + switch(resUnit) { + case RESUNIT_CENTIMETER: + image->setDotsPerMeterX(qRound(resX * 100)); + image->setDotsPerMeterY(qRound(resY * 100)); + break; + case RESUNIT_INCH: + image->setDotsPerMeterX(qRound(resX * (100 / 2.54))); + image->setDotsPerMeterY(qRound(resY * (100 / 2.54))); + break; + default: + // do nothing as defaults have already + // been set within the QImage class + break; + } + } + + // rotate the image if the orientation is defined in the file + uint16 orientationTag; + if (TIFFGetField(tiff, TIFFTAG_ORIENTATION, &orientationTag)) { + if (image->format() == QImage::Format_ARGB32) { + // TIFFReadRGBAImageOriented() flip the image but does not rotate them + switch (orientationTag) { + case 5: + rotate_right_mirror_horizontal(image); + break; + case 6: + rotate_right_mirror_vertical(image); + break; + case 7: + rotate_right_mirror_horizontal(image); + break; + case 8: + rotate_right_mirror_vertical(image); + break; + } + } else { + switch (orientationTag) { + case 1: // default orientation + break; + case 2: // mirror horizontal + *image = image->mirrored(true, false); + break; + case 3: // mirror both + *image = image->mirrored(true, true); + break; + case 4: // mirror vertical + *image = image->mirrored(false, true); + break; + case 5: // rotate right mirror horizontal + { + QMatrix transformation; + transformation.rotate(90); + *image = image->transformed(transformation); + *image = image->mirrored(true, false); + break; + } + case 6: // rotate right + { + QMatrix transformation; + transformation.rotate(90); + *image = image->transformed(transformation); + break; + } + case 7: // rotate right, mirror vertical + { + QMatrix transformation; + transformation.rotate(90); + *image = image->transformed(transformation); + *image = image->mirrored(false, true); + break; + } + case 8: // rotate left + { + QMatrix transformation; + transformation.rotate(270); + *image = image->transformed(transformation); + break; + } + } + } + } + + + TIFFClose(tiff); + return true; +} + +static bool checkGrayscale(const QVector &colorTable) +{ + if (colorTable.size() != 256) + return false; + + const bool increasing = (colorTable.at(0) == 0xff000000); + for (int i = 0; i < 256; ++i) { + if ((increasing && colorTable.at(i) != qRgb(i, i, i)) + || (!increasing && colorTable.at(i) != qRgb(255 - i, 255 - i, 255 - i))) + return false; + } + return true; +} + +bool QTiffHandler::write(const QImage &image) +{ + if (!device()->isWritable()) + return false; + + TIFF *const tiff = TIFFClientOpen("foo", + "w", + this, + qtiffReadProc, + qtiffWriteProc, + qtiffSeekProc, + qtiffCloseProc, + qtiffSizeProc, + qtiffMapProc, + qtiffUnmapProc); + if (!tiff) + return false; + + const int width = image.width(); + const int height = image.height(); + + if (!TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, width) + || !TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, height) + || !TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)) { + TIFFClose(tiff); + return false; + } + + // set the resolution + bool resolutionSet = false; + const int dotPerMeterX = image.dotsPerMeterX(); + const int dotPerMeterY = image.dotsPerMeterY(); + if ((dotPerMeterX % 100) == 0 + && (dotPerMeterY % 100) == 0) { + resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_CENTIMETER) + && TIFFSetField(tiff, TIFFTAG_XRESOLUTION, dotPerMeterX/100.0) + && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, dotPerMeterY/100.0); + } else { + resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH) + && TIFFSetField(tiff, TIFFTAG_XRESOLUTION, static_cast(image.logicalDpiX())) + && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, static_cast(image.logicalDpiY())); + } + if (!resolutionSet) { + TIFFClose(tiff); + return false; + } + + // configure image depth + const QImage::Format format = image.format(); + if (format == QImage::Format_Mono || format == QImage::Format_MonoLSB) { + uint16 photometric = PHOTOMETRIC_MINISBLACK; + if (image.colorTable().at(0) == 0xffffffff) + photometric = PHOTOMETRIC_MINISWHITE; + if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric) + || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_CCITTRLE) + || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 1)) { + TIFFClose(tiff); + return false; + } + + // try to do the conversion in chunks no greater than 16 MB + int chunks = (width * height / (1024 * 1024 * 16)) + 1; + int chunkHeight = qMax(height / chunks, 1); + + int y = 0; + while (y < height) { + QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y)).convertToFormat(QImage::Format_Mono); + + int chunkStart = y; + int chunkEnd = y + chunk.height(); + while (y < chunkEnd) { + if (TIFFWriteScanline(tiff, reinterpret_cast(chunk.scanLine(y - chunkStart)), y) != 1) { + TIFFClose(tiff); + return false; + } + ++y; + } + } + TIFFClose(tiff); + } else if (format == QImage::Format_Indexed8) { + const QVector colorTable = image.colorTable(); + bool isGrayscale = checkGrayscale(colorTable); + if (isGrayscale) { + uint16 photometric = PHOTOMETRIC_MINISBLACK; + if (image.colorTable().at(0) == 0xffffffff) + photometric = PHOTOMETRIC_MINISWHITE; + if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric) + || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_PACKBITS) + || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) { + TIFFClose(tiff); + return false; + } + } else { + if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE) + || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_PACKBITS) + || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) { + TIFFClose(tiff); + return false; + } + //// write the color table + // allocate the color tables + uint16 *redTable = static_cast(qMalloc(256 * sizeof(uint16))); + uint16 *greenTable = static_cast(qMalloc(256 * sizeof(uint16))); + uint16 *blueTable = static_cast(qMalloc(256 * sizeof(uint16))); + if (!redTable || !greenTable || !blueTable) { + TIFFClose(tiff); + return false; + } + + // set the color table + const int tableSize = colorTable.size(); + Q_ASSERT(tableSize <= 256); + for (int i = 0; i(chunk.scanLine(y - chunkStart)), y) != 1) { + TIFFClose(tiff); + return false; + } + ++y; + } + } + TIFFClose(tiff); + + } else { + if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB) + || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW) + || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 4) + || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) { + TIFFClose(tiff); + return false; + } + // try to do the ARGB32 conversion in chunks no greater than 16 MB + int chunks = (width * height * 4 / (1024 * 1024 * 16)) + 1; + int chunkHeight = qMax(height / chunks, 1); + + int y = 0; + while (y < height) { + QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y)).convertToFormat(QImage::Format_ARGB32); + + int chunkStart = y; + int chunkEnd = y + chunk.height(); + while (y < chunkEnd) { + if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) + convert32BitOrder(chunk.scanLine(y - chunkStart), width); + else + convert32BitOrderBigEndian(chunk.scanLine(y - chunkStart), width); + + if (TIFFWriteScanline(tiff, reinterpret_cast(chunk.scanLine(y - chunkStart)), y) != 1) { + TIFFClose(tiff); + return false; + } + ++y; + } + } + TIFFClose(tiff); + } + + return true; +} + +QByteArray QTiffHandler::name() const +{ + return "tiff"; +} + +QVariant QTiffHandler::option(ImageOption option) const +{ + if (option == Size && canRead()) { + QSize imageSize; + qint64 pos = device()->pos(); + TIFF *tiff = TIFFClientOpen("foo", + "r", + const_cast(this), + qtiffReadProc, + qtiffWriteProc, + qtiffSeekProc, + qtiffCloseProc, + qtiffSizeProc, + qtiffMapProc, + qtiffUnmapProc); + + if (tiff) { + uint32 width = 0; + uint32 height = 0; + TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width); + TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height); + imageSize = QSize(width, height); + } + device()->seek(pos); + if (imageSize.isValid()) + return imageSize; + } else if (option == CompressionRatio) { + return compression; + } else if (option == ImageFormat) { + return QImage::Format_ARGB32; + } + return QVariant(); +} + +void QTiffHandler::setOption(ImageOption option, const QVariant &value) +{ + if (option == CompressionRatio && value.type() == QVariant::Int) + compression = value.toInt(); +} + +bool QTiffHandler::supportsOption(ImageOption option) const +{ + return option == CompressionRatio + || option == Size + || option == ImageFormat; +} + +void QTiffHandler::convert32BitOrder(void *buffer, int width) +{ + uint32 *target = reinterpret_cast(buffer); + for (int32 x=0; x> 16) + | (p & 0x0000ff00) + | ((p & 0x000000ff) << 16); + } +} + +void QTiffHandler::convert32BitOrderBigEndian(void *buffer, int width) +{ + uint32 *target = reinterpret_cast(buffer); + for (int32 x=0; x> 24 + | (p & 0x00ff0000) << 8 + | (p & 0x0000ff00) << 8 + | (p & 0x000000ff) << 8; + } +} + +QT_END_NAMESPACE diff --git a/src/gui/image/qtiffhandler.h b/src/gui/image/qtiffhandler.h new file mode 100644 index 0000000..4534ed5 --- /dev/null +++ b/src/gui/image/qtiffhandler.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTIFFHANDLER_H +#define QTIFFHANDLER_H + +#include + +QT_BEGIN_NAMESPACE + +class QTiffHandler : public QImageIOHandler +{ +public: + QTiffHandler(); + + bool canRead() const; + bool read(QImage *image); + bool write(const QImage &image); + + QByteArray name() const; + + static bool canRead(QIODevice *device); + + QVariant option(ImageOption option) const; + void setOption(ImageOption option, const QVariant &value); + bool supportsOption(ImageOption option) const; + + enum Compression { + NoCompression = 0, + LzwCompression = 1 + }; +private: + void convert32BitOrder(void *buffer, int width); + void convert32BitOrderBigEndian(void *buffer, int width); + int compression; +}; + +QT_END_NAMESPACE + +#endif // QTIFFHANDLER_H diff --git a/src/gui/image/qtiffhandler.pri b/src/gui/image/qtiffhandler.pri new file mode 100644 index 0000000..8ac70d9 --- /dev/null +++ b/src/gui/image/qtiffhandler.pri @@ -0,0 +1,10 @@ +# common to plugin and built-in forms +INCLUDEPATH *= $$PWD +HEADERS += $$PWD/qtiffhandler.h +SOURCES += $$PWD/qtiffhandler.cpp +contains(QT_CONFIG, system-tiff) { + if(unix|win32-g++*):LIBS += -ltiff + else:win32: LIBS += libtiff.lib +} else { + include($$PWD/../../3rdparty/libtiff.pri) +} diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro index 8a5c51a..439b431 100644 --- a/src/plugins/imageformats/gif/gif.pro +++ b/src/plugins/imageformats/gif/gif.pro @@ -1,9 +1,8 @@ TARGET = qgif include(../../qpluginbase.pri) -HEADERS += qgifhandler.h -SOURCES += main.cpp \ - qgifhandler.cpp +include(../../../gui/image/qgifhandler.pri) +SOURCES += $$PWD/main.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats target.path += $$[QT_INSTALL_PLUGINS]/imageformats diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp deleted file mode 100644 index 129a11b..0000000 --- a/src/plugins/imageformats/gif/qgifhandler.cpp +++ /dev/null @@ -1,1199 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -** WARNING: -** A separate license from Unisys may be required to use the gif -** reader. See http://www.unisys.com/about__unisys/lzw/ -** for information from Unisys -** -****************************************************************************/ - -#include "qgifhandler.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#define Q_TRANSPARENT 0x00ffffff - -// avoid going through QImage::scanLine() which calls detach -#define FAST_SCAN_LINE(bits, bpl, y) (bits + (y) * bpl) - - -/* - Incremental image decoder for GIF image format. - - This subclass of QImageFormat decodes GIF format images, - including animated GIFs. Internally in -*/ - -class QGIFFormat { -public: - QGIFFormat(); - ~QGIFFormat(); - - int decode(QImage *image, const uchar* buffer, int length, - int *nextFrameDelay, int *loopCount); - static void scan(QIODevice *device, QVector *imageSizes, int *loopCount); - - bool newFrame; - bool partialNewFrame; - -private: - void fillRect(QImage *image, int x, int y, int w, int h, QRgb col); - inline QRgb color(uchar index) const; - - // GIF specific stuff - QRgb* globalcmap; - QRgb* localcmap; - QImage backingstore; - unsigned char hold[16]; - bool gif89; - int count; - int ccount; - int expectcount; - enum State { - Header, - LogicalScreenDescriptor, - GlobalColorMap, - LocalColorMap, - Introducer, - ImageDescriptor, - TableImageLZWSize, - ImageDataBlockSize, - ImageDataBlock, - ExtensionLabel, - GraphicControlExtension, - ApplicationExtension, - NetscapeExtensionBlockSize, - NetscapeExtensionBlock, - SkipBlockSize, - SkipBlock, - Done, - Error - } state; - int gncols; - int lncols; - int ncols; - int lzwsize; - bool lcmap; - int swidth, sheight; - int width, height; - int left, top, right, bottom; - enum Disposal { NoDisposal, DoNotChange, RestoreBackground, RestoreImage }; - Disposal disposal; - bool disposed; - int trans_index; - bool gcmap; - int bgcol; - int interlace; - int accum; - int bitcount; - - enum { max_lzw_bits=12 }; // (poor-compiler's static const int) - - int code_size, clear_code, end_code, max_code_size, max_code; - int firstcode, oldcode, incode; - short* table[2]; - short* stack; - short *sp; - bool needfirst; - int x, y; - int frame; - bool out_of_bounds; - bool digress; - void nextY(unsigned char *bits, int bpl); - void disposePrevious(QImage *image); -}; - -/*! - Constructs a QGIFFormat. -*/ -QGIFFormat::QGIFFormat() -{ - globalcmap = 0; - localcmap = 0; - lncols = 0; - gncols = 0; - disposal = NoDisposal; - out_of_bounds = false; - disposed = true; - frame = -1; - state = Header; - count = 0; - lcmap = false; - newFrame = false; - partialNewFrame = false; - table[0] = 0; - table[1] = 0; - stack = 0; -} - -/*! - Destroys a QGIFFormat. -*/ -QGIFFormat::~QGIFFormat() -{ - if (globalcmap) delete[] globalcmap; - if (localcmap) delete[] localcmap; - delete [] stack; -} - -void QGIFFormat::disposePrevious(QImage *image) -{ - if (out_of_bounds) { - // flush anything that survived - // ### Changed: QRect(0, 0, swidth, sheight) - } - - // Handle disposal of previous image before processing next one - - if (disposed) return; - - int l = qMin(swidth-1,left); - int r = qMin(swidth-1,right); - int t = qMin(sheight-1,top); - int b = qMin(sheight-1,bottom); - - switch (disposal) { - case NoDisposal: - break; - case DoNotChange: - break; - case RestoreBackground: - if (trans_index>=0) { - // Easy: we use the transparent color - fillRect(image, l, t, r-l+1, b-t+1, Q_TRANSPARENT); - } else if (bgcol>=0) { - // Easy: we use the bgcol given - fillRect(image, l, t, r-l+1, b-t+1, color(bgcol)); - } else { - // Impossible: We don't know of a bgcol - use pixel 0 - QRgb *bits = (QRgb*)image->bits(); - fillRect(image, l, t, r-l+1, b-t+1, bits[0]); - } - // ### Changed: QRect(l, t, r-l+1, b-t+1) - break; - case RestoreImage: { - if (frame >= 0) { - for (int ln=t; ln<=b; ln++) { - memcpy(image->scanLine(ln)+l, - backingstore.scanLine(ln-t), - (r-l+1)*sizeof(QRgb)); - } - // ### Changed: QRect(l, t, r-l+1, b-t+1) - } - } - } - disposal = NoDisposal; // Until an extension says otherwise. - - disposed = true; -} - -/*! - This function decodes some data into image changes. - - Returns the number of bytes consumed. -*/ -int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, - int *nextFrameDelay, int *loopCount) -{ - // We are required to state that - // "The Graphics Interchange Format(c) is the Copyright property of - // CompuServe Incorporated. GIF(sm) is a Service Mark property of - // CompuServe Incorporated." - - if (!stack) { - stack = new short[(1 << max_lzw_bits) * 4]; - table[0] = &stack[(1 << max_lzw_bits) * 2]; - table[1] = &stack[(1 << max_lzw_bits) * 3]; - } - - image->detach(); - int bpl = image->bytesPerLine(); - unsigned char *bits = image->bits(); - -#define LM(l, m) (((m)<<8)|l) - digress = false; - const int initial = length; - while (!digress && length) { - length--; - unsigned char ch=*buffer++; - switch (state) { - case Header: - hold[count++]=ch; - if (count==6) { - // Header - gif89=(hold[3]!='8' || hold[4]!='7'); - state=LogicalScreenDescriptor; - count=0; - } - break; - case LogicalScreenDescriptor: - hold[count++]=ch; - if (count==7) { - // Logical Screen Descriptor - swidth=LM(hold[0], hold[1]); - sheight=LM(hold[2], hold[3]); - gcmap=!!(hold[4]&0x80); - //UNUSED: bpchan=(((hold[4]&0x70)>>3)+1); - //UNUSED: gcmsortflag=!!(hold[4]&0x08); - gncols=2<<(hold[4]&0x7); - bgcol=(gcmap) ? hold[5] : -1; - //aspect=hold[6] ? double(hold[6]+15)/64.0 : 1.0; - - trans_index = -1; - count=0; - ncols=gncols; - if (gcmap) { - ccount=0; - state=GlobalColorMap; - globalcmap = new QRgb[gncols+1]; // +1 for trans_index - globalcmap[gncols] = Q_TRANSPARENT; - } else { - state=Introducer; - } - } - break; - case GlobalColorMap: case LocalColorMap: - hold[count++]=ch; - if (count==3) { - QRgb rgb = qRgb(hold[0], hold[1], hold[2]); - if (state == LocalColorMap) { - if (ccount < lncols) - localcmap[ccount] = rgb; - } else { - globalcmap[ccount] = rgb; - } - if (++ccount >= ncols) { - if (state == LocalColorMap) - state=TableImageLZWSize; - else - state=Introducer; - } - count=0; - } - break; - case Introducer: - hold[count++]=ch; - switch (ch) { - case ',': - state=ImageDescriptor; - break; - case '!': - state=ExtensionLabel; - break; - case ';': - // ### Changed: QRect(0, 0, swidth, sheight) - state=Done; - break; - default: - digress=true; - // Unexpected Introducer - ignore block - state=Error; - } - break; - case ImageDescriptor: - hold[count++]=ch; - if (count==10) { - int newleft=LM(hold[1], hold[2]); - int newtop=LM(hold[3], hold[4]); - int newwidth=LM(hold[5], hold[6]); - int newheight=LM(hold[7], hold[8]); - - // disbelieve ridiculous logical screen sizes, - // unless the image frames are also large. - if (swidth/10 > qMax(newwidth,200)) - swidth = -1; - if (sheight/10 > qMax(newheight,200)) - sheight = -1; - - if (swidth <= 0) - swidth = newleft + newwidth; - if (sheight <= 0) - sheight = newtop + newheight; - - QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32; - if (image->isNull()) { - (*image) = QImage(swidth, sheight, format); - bpl = image->bytesPerLine(); - bits = image->bits(); - memset(bits, 0, image->byteCount()); - } - - disposePrevious(image); - disposed = false; - - left = newleft; - top = newtop; - width = newwidth; - height = newheight; - - right=qMax(0, qMin(left+width, swidth)-1); - bottom=qMax(0, qMin(top+height, sheight)-1); - lcmap=!!(hold[9]&0x80); - interlace=!!(hold[9]&0x40); - //bool lcmsortflag=!!(hold[9]&0x20); - lncols=lcmap ? (2<<(hold[9]&0x7)) : 0; - if (lncols) { - if (localcmap) - delete [] localcmap; - localcmap = new QRgb[lncols+1]; - localcmap[lncols] = Q_TRANSPARENT; - ncols = lncols; - } else { - ncols = gncols; - } - frame++; - if (frame == 0) { - if (left || top || width= 0) { - fillRect(image, 0, 0, swidth, sheight, color(trans_index)); - // ### Changed: QRect(0, 0, swidth, sheight) - } else if (bgcol>=0) { - fillRect(image, 0, 0, swidth, sheight, color(bgcol)); - // ### Changed: QRect(0, 0, swidth, sheight) - } - } - } - - if (disposal == RestoreImage) { - int l = qMin(swidth-1,left); - int r = qMin(swidth-1,right); - int t = qMin(sheight-1,top); - int b = qMin(sheight-1,bottom); - int w = r-l+1; - int h = b-t+1; - - if (backingstore.width() < w - || backingstore.height() < h) { - // We just use the backing store as a byte array - backingstore = QImage(qMax(backingstore.width(), w), - qMax(backingstore.height(), h), - QImage::Format_RGB32); - memset(bits, 0, image->byteCount()); - } - const int dest_bpl = backingstore.bytesPerLine(); - unsigned char *dest_data = backingstore.bits(); - for (int ln=0; ln=swidth || y>=sheight; - } - break; - case TableImageLZWSize: { - lzwsize=ch; - if (lzwsize > max_lzw_bits) { - state=Error; - } else { - code_size=lzwsize+1; - clear_code=1<=code_size && state==ImageDataBlock) { - int code=accum&((1<>=code_size; - - if (code==clear_code) { - if (!needfirst) { - code_size=lzwsize+1; - max_code_size=2*clear_code; - max_code=clear_code+2; - } - needfirst=true; - } else if (code==end_code) { - bitcount = -32768; - // Left the block end arrive - } else { - if (needfirst) { - firstcode=oldcode=code; - if (!out_of_bounds && image->height() > y && firstcode!=trans_index) - ((QRgb*)FAST_SCAN_LINE(bits, bpl, y))[x] = color(firstcode); - x++; - if (x>=swidth) out_of_bounds = true; - needfirst=false; - if (x>=left+width) { - x=left; - out_of_bounds = left>=swidth || y>=sheight; - nextY(bits, bpl); - } - } else { - incode=code; - if (code>=max_code) { - *sp++=firstcode; - code=oldcode; - } - while (code>=clear_code+2) { - *sp++=table[1][code]; - if (code==table[0][code]) { - state=Error; - break; - } - if (sp-stack>=(1<<(max_lzw_bits))*2) { - state=Error; - break; - } - code=table[0][code]; - } - *sp++=firstcode=table[1][code]; - code=max_code; - if (code<(1<=max_code_size) - && (max_code_size<(1<height(); - const QRgb *map = lcmap ? localcmap : globalcmap; - QRgb *line = 0; - if (!out_of_bounds && h > y) - line = (QRgb*)FAST_SCAN_LINE(bits, bpl, y); - while (sp>stack) { - const uchar index = *(--sp); - if (!out_of_bounds && h > y && index!=trans_index) { - if (index > ncols) - line[x] = Q_TRANSPARENT; - else - line[x] = map ? map[index] : 0; - } - x++; - if (x>=swidth) out_of_bounds = true; - if (x>=left+width) { - x=left; - out_of_bounds = left>=swidth || y>=sheight; - nextY(bits, bpl); - if (!out_of_bounds && h > y) - line = (QRgb*)FAST_SCAN_LINE(bits, bpl, y); - } - } - } - } - } - partialNewFrame = true; - if (count==expectcount) { - count=0; - state=ImageDataBlockSize; - } - break; - case ExtensionLabel: - switch (ch) { - case 0xf9: - state=GraphicControlExtension; - break; - case 0xff: - state=ApplicationExtension; - break; -#if 0 - case 0xfe: - state=CommentExtension; - break; - case 0x01: - break; -#endif - default: - state=SkipBlockSize; - } - count=0; - break; - case ApplicationExtension: - if (count<11) hold[count]=ch; - count++; - if (count==hold[0]+1) { - if (qstrncmp((char*)(hold+1), "NETSCAPE", 8)==0) { - // Looping extension - state=NetscapeExtensionBlockSize; - } else { - state=SkipBlockSize; - } - count=0; - } - break; - case NetscapeExtensionBlockSize: - expectcount=ch; - count=0; - if (expectcount) state=NetscapeExtensionBlock; - else state=Introducer; - break; - case NetscapeExtensionBlock: - if (count<3) hold[count]=ch; - count++; - if (count==expectcount) { - *loopCount = hold[1]+hold[2]*256; - state=SkipBlockSize; // Ignore further blocks - } - break; - case GraphicControlExtension: - if (count<5) hold[count]=ch; - count++; - if (count==hold[0]+1) { - disposePrevious(image); - disposal=Disposal((hold[1]>>2)&0x7); - //UNUSED: waitforuser=!!((hold[1]>>1)&0x1); - int delay=count>3 ? LM(hold[2], hold[3]) : 1; - // IE and mozilla use a minimum delay of 10. With the minimum delay of 10 - // we are compatible to them and avoid huge loads on the app and xserver. - *nextFrameDelay = (delay < 2 ? 10 : delay) * 10; - - bool havetrans=hold[1]&0x1; - trans_index = havetrans ? hold[4] : -1; - - count=0; - state=SkipBlockSize; - } - break; - case SkipBlockSize: - expectcount=ch; - count=0; - if (expectcount) state=SkipBlock; - else state=Introducer; - break; - case SkipBlock: - count++; - if (count==expectcount) state=SkipBlockSize; - break; - case Done: - digress=true; - /* Netscape ignores the junk, so we do too. - length++; // Unget - state=Error; // More calls to this is an error - */ - break; - case Error: - return -1; // Called again after done. - } - } - return initial-length; -} - -/*! - Scans through the data stream defined by \a device and returns the image - sizes found in the stream in the \a imageSizes vector. -*/ -void QGIFFormat::scan(QIODevice *device, QVector *imageSizes, int *loopCount) -{ - if (!device) - return; - - qint64 oldPos = device->pos(); - if (!device->seek(0)) - return; - - int colorCount = 0; - int localColorCount = 0; - int globalColorCount = 0; - int colorReadCount = 0; - bool localColormap = false; - bool globalColormap = false; - int count = 0; - int blockSize = 0; - int imageWidth = 0; - int imageHeight = 0; - bool done = false; - uchar hold[16]; - State state = Header; - - const int readBufferSize = 40960; // 40k read buffer - QByteArray readBuffer(device->read(readBufferSize)); - - if (readBuffer.isEmpty()) { - device->seek(oldPos); - return; - } - - // This is a specialized version of the state machine from decode(), - // which doesn't do any image decoding or mallocing, and has an - // optimized way of skipping SkipBlocks, ImageDataBlocks and - // Global/LocalColorMaps. - - while (!readBuffer.isEmpty()) { - int length = readBuffer.size(); - const uchar *buffer = (const uchar *) readBuffer.constData(); - while (!done && length) { - length--; - uchar ch = *buffer++; - switch (state) { - case Header: - hold[count++] = ch; - if (count == 6) { - state = LogicalScreenDescriptor; - count = 0; - } - break; - case LogicalScreenDescriptor: - hold[count++] = ch; - if (count == 7) { - imageWidth = LM(hold[0], hold[1]); - imageHeight = LM(hold[2], hold[3]); - globalColormap = !!(hold[4] & 0x80); - globalColorCount = 2 << (hold[4] & 0x7); - count = 0; - colorCount = globalColorCount; - if (globalColormap) { - int colorTableSize = 3 * globalColorCount; - if (length >= colorTableSize) { - // skip the global color table in one go - length -= colorTableSize; - buffer += colorTableSize; - state = Introducer; - } else { - colorReadCount = 0; - state = GlobalColorMap; - } - } else { - state=Introducer; - } - } - break; - case GlobalColorMap: - case LocalColorMap: - hold[count++] = ch; - if (count == 3) { - if (++colorReadCount >= colorCount) { - if (state == LocalColorMap) - state = TableImageLZWSize; - else - state = Introducer; - } - count = 0; - } - break; - case Introducer: - hold[count++] = ch; - switch (ch) { - case 0x2c: - state = ImageDescriptor; - break; - case 0x21: - state = ExtensionLabel; - break; - case 0x3b: - state = Done; - break; - default: - done = true; - state = Error; - } - break; - case ImageDescriptor: - hold[count++] = ch; - if (count == 10) { - int newLeft = LM(hold[1], hold[2]); - int newTop = LM(hold[3], hold[4]); - int newWidth = LM(hold[5], hold[6]); - int newHeight = LM(hold[7], hold[8]); - - if (imageWidth/10 > qMax(newWidth,200)) - imageWidth = -1; - if (imageHeight/10 > qMax(newHeight,200)) - imageHeight = -1; - - if (imageWidth <= 0) - imageWidth = newLeft + newWidth; - if (imageHeight <= 0) - imageHeight = newTop + newHeight; - - *imageSizes << QSize(imageWidth, imageHeight); - - localColormap = !!(hold[9] & 0x80); - localColorCount = localColormap ? (2 << (hold[9] & 0x7)) : 0; - if (localColorCount) - colorCount = localColorCount; - else - colorCount = globalColorCount; - - count = 0; - if (localColormap) { - int colorTableSize = 3 * localColorCount; - if (length >= colorTableSize) { - // skip the local color table in one go - length -= colorTableSize; - buffer += colorTableSize; - state = TableImageLZWSize; - } else { - colorReadCount = 0; - state = LocalColorMap; - } - } else { - state = TableImageLZWSize; - } - } - break; - case TableImageLZWSize: - if (ch > max_lzw_bits) - state = Error; - else - state = ImageDataBlockSize; - count = 0; - break; - case ImageDataBlockSize: - blockSize = ch; - if (blockSize) { - if (length >= blockSize) { - // we can skip the block in one go - length -= blockSize; - buffer += blockSize; - count = 0; - } else { - state = ImageDataBlock; - } - } else { - state = Introducer; - } - break; - case ImageDataBlock: - ++count; - if (count == blockSize) { - count = 0; - state = ImageDataBlockSize; - } - break; - case ExtensionLabel: - switch (ch) { - case 0xf9: - state = GraphicControlExtension; - break; - case 0xff: - state = ApplicationExtension; - break; - default: - state = SkipBlockSize; - } - count = 0; - break; - case ApplicationExtension: - if (count < 11) - hold[count] = ch; - ++count; - if (count == hold[0] + 1) { - if (qstrncmp((char*)(hold+1), "NETSCAPE", 8) == 0) - state=NetscapeExtensionBlockSize; - else - state=SkipBlockSize; - count = 0; - } - break; - case GraphicControlExtension: - if (count < 5) - hold[count] = ch; - ++count; - if (count == hold[0] + 1) { - count = 0; - state = SkipBlockSize; - } - break; - case NetscapeExtensionBlockSize: - blockSize = ch; - count = 0; - if (blockSize) - state = NetscapeExtensionBlock; - else - state = Introducer; - break; - case NetscapeExtensionBlock: - if (count < 3) - hold[count] = ch; - count++; - if (count == blockSize) { - *loopCount = LM(hold[1], hold[2]); - state = SkipBlockSize; - } - break; - case SkipBlockSize: - blockSize = ch; - count = 0; - if (blockSize) { - if (length >= blockSize) { - // we can skip the block in one go - length -= blockSize; - buffer += blockSize; - } else { - state = SkipBlock; - } - } else { - state = Introducer; - } - break; - case SkipBlock: - ++count; - if (count == blockSize) - state = SkipBlockSize; - break; - case Done: - done = true; - break; - case Error: - device->seek(oldPos); - return; - } - } - readBuffer = device->read(readBufferSize); - } - device->seek(oldPos); - return; -} - -void QGIFFormat::fillRect(QImage *image, int col, int row, int w, int h, QRgb color) -{ - if (w>0) { - for (int j=0; jscanLine(j+row); - for (int i=0; ichanged(QRect(%d, %d, %d, %d))", left, y, right-left+1, my+1); - y+=8; - if (y>bottom) { - interlace++; y=top+4; - if (y > bottom) { // for really broken GIFs with bottom < 5 - interlace=2; - y = top + 2; - if (y > bottom) { // for really broken GIF with bottom < 3 - interlace = 0; - y = top + 1; - } - } - } - } break; - case 2: { - int i; - my = qMin(3, bottom-y); - // Don't dup with transparency - if (trans_index < 0) { - for (i=1; i<=my; i++) { - memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb), - (right-left+1)*sizeof(QRgb)); - } - } - - // if (!out_of_bounds) { - // ### Changed: QRect(left, y, right - left + 1, my + 1); - // } - y+=8; - if (y>bottom) { - interlace++; y=top+2; - // handle broken GIF with bottom < 3 - if (y > bottom) { - interlace = 3; - y = top + 1; - } - } - } break; - case 3: { - int i; - my = qMin(1, bottom-y); - // Don't dup with transparency - if (trans_index < 0) { - for (i=1; i<=my; i++) { - memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb), - (right-left+1)*sizeof(QRgb)); - } - } - // if (!out_of_bounds) { - // ### Changed: QRect(left, y, right - left + 1, my + 1); - // } - y+=4; - if (y>bottom) { interlace++; y=top+1; } - } break; - case 4: - // if (!out_of_bounds) { - // ### Changed: QRect(left, y, right - left + 1, 1); - // } - y+=2; - } - - // Consume bogus extra lines - if (y >= sheight) out_of_bounds=true; //y=bottom; -} - -inline QRgb QGIFFormat::color(uchar index) const -{ - if (index == trans_index || index > ncols) - return Q_TRANSPARENT; - - QRgb *map = lcmap ? localcmap : globalcmap; - return map ? map[index] : 0; -} - -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- - -QGifHandler::QGifHandler() -{ - gifFormat = new QGIFFormat; - nextDelay = 100; - loopCnt = 1; - frameNumber = -1; - scanIsCached = false; -} - -QGifHandler::~QGifHandler() -{ - delete gifFormat; -} - -// Does partial decode if necessary, just to see if an image is coming - -bool QGifHandler::imageIsComing() const -{ - const int GifChunkSize = 4096; - - while (!gifFormat->partialNewFrame) { - if (buffer.isEmpty()) { - buffer += device()->read(GifChunkSize); - if (buffer.isEmpty()) - break; - } - - int decoded = gifFormat->decode(&lastImage, (const uchar *)buffer.constData(), buffer.size(), - &nextDelay, &loopCnt); - if (decoded == -1) - break; - buffer.remove(0, decoded); - } - return gifFormat->partialNewFrame; -} - -bool QGifHandler::canRead() const -{ - if (canRead(device()) || imageIsComing()) { - setFormat("gif"); - return true; - } - - return false; -} - -bool QGifHandler::canRead(QIODevice *device) -{ - if (!device) { - qWarning("QGifHandler::canRead() called with no device"); - return false; - } - - char head[6]; - if (device->peek(head, sizeof(head)) == sizeof(head)) - return qstrncmp(head, "GIF87a", 6) == 0 - || qstrncmp(head, "GIF89a", 6) == 0; - return false; -} - -bool QGifHandler::read(QImage *image) -{ - const int GifChunkSize = 4096; - - while (!gifFormat->newFrame) { - if (buffer.isEmpty()) { - buffer += device()->read(GifChunkSize); - if (buffer.isEmpty()) - break; - } - - int decoded = gifFormat->decode(&lastImage, (const uchar *)buffer.constData(), buffer.size(), - &nextDelay, &loopCnt); - if (decoded == -1) - break; - buffer.remove(0, decoded); - } - if (gifFormat->newFrame || (gifFormat->partialNewFrame && device()->atEnd())) { - *image = lastImage; - ++frameNumber; - gifFormat->newFrame = false; - gifFormat->partialNewFrame = false; - return true; - } - - return false; -} - -bool QGifHandler::write(const QImage &image) -{ - Q_UNUSED(image); - return false; -} - -bool QGifHandler::supportsOption(ImageOption option) const -{ - if (!device() || device()->isSequential()) - return option == Animation; - else - return option == Size - || option == Animation; -} - -QVariant QGifHandler::option(ImageOption option) const -{ - if (option == Size) { - if (!scanIsCached) { - QGIFFormat::scan(device(), &imageSizes, &loopCnt); - scanIsCached = true; - } - // before the first frame is read, or we have an empty data stream - if (frameNumber == -1) - return (imageSizes.count() > 0) ? QVariant(imageSizes.at(0)) : QVariant(); - // after the last frame has been read, the next size is undefined - if (frameNumber >= imageSizes.count() - 1) - return QVariant(); - // and the last case: the size of the next frame - return imageSizes.at(frameNumber + 1); - } else if (option == Animation) { - return true; - } - return QVariant(); -} - -void QGifHandler::setOption(ImageOption option, const QVariant &value) -{ - Q_UNUSED(option); - Q_UNUSED(value); -} - -int QGifHandler::nextImageDelay() const -{ - return nextDelay; -} - -int QGifHandler::imageCount() const -{ - if (!scanIsCached) { - QGIFFormat::scan(device(), &imageSizes, &loopCnt); - scanIsCached = true; - } - return imageSizes.count(); -} - -int QGifHandler::loopCount() const -{ - if (!scanIsCached) { - QGIFFormat::scan(device(), &imageSizes, &loopCnt); - scanIsCached = true; - } - return loopCnt-1; // In GIF, loop count is iteration count, so subtract one -} - -int QGifHandler::currentImageNumber() const -{ - return frameNumber; -} - -QByteArray QGifHandler::name() const -{ - return "gif"; -} - -QT_END_NAMESPACE diff --git a/src/plugins/imageformats/gif/qgifhandler.h b/src/plugins/imageformats/gif/qgifhandler.h deleted file mode 100644 index 8e07aff..0000000 --- a/src/plugins/imageformats/gif/qgifhandler.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -** WARNING: -** A separate license from Unisys may be required to use the gif -** reader. See http://www.unisys.com/about__unisys/lzw/ -** for information from Unisys -** -****************************************************************************/ - -#ifndef QGIFHANDLER_H -#define QGIFHANDLER_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QGIFFormat; -class QGifHandler : public QImageIOHandler -{ -public: - QGifHandler(); - ~QGifHandler(); - - bool canRead() const; - bool read(QImage *image); - bool write(const QImage &image); - - QByteArray name() const; - - static bool canRead(QIODevice *device); - - QVariant option(ImageOption option) const; - void setOption(ImageOption option, const QVariant &value); - bool supportsOption(ImageOption option) const; - - int imageCount() const; - int loopCount() const; - int nextImageDelay() const; - int currentImageNumber() const; - -private: - bool imageIsComing() const; - QGIFFormat *gifFormat; - QString fileName; - mutable QByteArray buffer; - mutable QImage lastImage; - - mutable int nextDelay; - mutable int loopCnt; - int frameNumber; - mutable QVector imageSizes; - mutable bool scanIsCached; -}; - -QT_END_NAMESPACE - -#endif // QGIFHANDLER_H diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro index d4b0fef..c5671c3 100644 --- a/src/plugins/imageformats/jpeg/jpeg.pro +++ b/src/plugins/imageformats/jpeg/jpeg.pro @@ -3,10 +3,6 @@ include(../../qpluginbase.pri) QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-jpeg)" -HEADERS += qjpeghandler.h -SOURCES += main.cpp \ - qjpeghandler.cpp - wince*: { DEFINES += NO_GETENV contains(CE_ARCH,x86):CONFIG -= stl exceptions @@ -21,61 +17,9 @@ symbian: { QMAKE_CFLAGS_WARN_ON += -Wno-unused-parameter -Wno-main } -contains(QT_CONFIG, system-jpeg) { - unix|win32-g++*:LIBS += -ljpeg - win32:!win32-g++*:LIBS += libjpeg.lib -} else { - INCLUDEPATH += ../../../3rdparty/libjpeg - SOURCES += \ - ../../../3rdparty/libjpeg/jaricom.c \ - ../../../3rdparty/libjpeg/jcapimin.c \ - ../../../3rdparty/libjpeg/jcapistd.c \ - ../../../3rdparty/libjpeg/jcarith.c \ - ../../../3rdparty/libjpeg/jccoefct.c \ - ../../../3rdparty/libjpeg/jccolor.c \ - ../../../3rdparty/libjpeg/jcdctmgr.c \ - ../../../3rdparty/libjpeg/jchuff.c \ - ../../../3rdparty/libjpeg/jcinit.c \ - ../../../3rdparty/libjpeg/jcmainct.c \ - ../../../3rdparty/libjpeg/jcmarker.c \ - ../../../3rdparty/libjpeg/jcmaster.c \ - ../../../3rdparty/libjpeg/jcomapi.c \ - ../../../3rdparty/libjpeg/jcparam.c \ - ../../../3rdparty/libjpeg/jcprepct.c \ - ../../../3rdparty/libjpeg/jcsample.c \ - ../../../3rdparty/libjpeg/jctrans.c \ - ../../../3rdparty/libjpeg/jdapimin.c \ - ../../../3rdparty/libjpeg/jdapistd.c \ - ../../../3rdparty/libjpeg/jdarith.c \ - ../../../3rdparty/libjpeg/jdatadst.c \ - ../../../3rdparty/libjpeg/jdatasrc.c \ - ../../../3rdparty/libjpeg/jdcoefct.c \ - ../../../3rdparty/libjpeg/jdcolor.c \ - ../../../3rdparty/libjpeg/jddctmgr.c \ - ../../../3rdparty/libjpeg/jdhuff.c \ - ../../../3rdparty/libjpeg/jdinput.c \ - ../../../3rdparty/libjpeg/jdmainct.c \ - ../../../3rdparty/libjpeg/jdmarker.c \ - ../../../3rdparty/libjpeg/jdmaster.c \ - ../../../3rdparty/libjpeg/jdmerge.c \ - ../../../3rdparty/libjpeg/jdpostct.c \ - ../../../3rdparty/libjpeg/jdsample.c \ - ../../../3rdparty/libjpeg/jdtrans.c \ - ../../../3rdparty/libjpeg/jerror.c \ - ../../../3rdparty/libjpeg/jfdctflt.c \ - ../../../3rdparty/libjpeg/jfdctfst.c \ - ../../../3rdparty/libjpeg/jfdctint.c \ - ../../../3rdparty/libjpeg/jidctflt.c \ - ../../../3rdparty/libjpeg/jidctfst.c \ - ../../../3rdparty/libjpeg/jidctint.c \ - ../../../3rdparty/libjpeg/jquant1.c \ - ../../../3rdparty/libjpeg/jquant2.c \ - ../../../3rdparty/libjpeg/jutils.c \ - ../../../3rdparty/libjpeg/jmemmgr.c \ - ../../../3rdparty/libjpeg/jmemnobs.c -} +include(../../../gui/image/qjpeghandler.pri) +SOURCES += main.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats target.path += $$[QT_INSTALL_PLUGINS]/imageformats INSTALLS += target - diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp deleted file mode 100644 index 60e7cce..0000000 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ /dev/null @@ -1,901 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qjpeghandler.h" - -#include -#include -#include -#include - -#include // jpeglib needs this to be pre-included -#include - -#ifdef FAR -#undef FAR -#endif - -// including jpeglib.h seems to be a little messy -extern "C" { -// mingw includes rpcndr.h but does not define boolean -#if defined(Q_OS_WIN) && defined(Q_CC_GNU) -# if defined(__RPCNDR_H__) && !defined(boolean) - typedef unsigned char boolean; -# define HAVE_BOOLEAN -# endif -#endif - -#define XMD_H // shut JPEGlib up -#if defined(Q_OS_UNIXWARE) -# define HAVE_BOOLEAN // libjpeg under Unixware seems to need this -#endif -#include -#ifdef const -# undef const // remove crazy C hackery in jconfig.h -#endif -} - -QT_BEGIN_NAMESPACE - -struct my_error_mgr : public jpeg_error_mgr { - jmp_buf setjmp_buffer; -}; - -#if defined(Q_C_CALLBACKS) -extern "C" { -#endif - -static void my_error_exit (j_common_ptr cinfo) -{ - my_error_mgr* myerr = (my_error_mgr*) cinfo->err; - char buffer[JMSG_LENGTH_MAX]; - (*cinfo->err->format_message)(cinfo, buffer); - qWarning("%s", buffer); - longjmp(myerr->setjmp_buffer, 1); -} - -#if defined(Q_C_CALLBACKS) -} -#endif - - -static const int max_buf = 4096; - -struct my_jpeg_source_mgr : public jpeg_source_mgr { - // Nothing dynamic - cannot rely on destruction over longjump - QIODevice *device; - JOCTET buffer[max_buf]; - const QBuffer *memDevice; - -public: - my_jpeg_source_mgr(QIODevice *device); -}; - -#if defined(Q_C_CALLBACKS) -extern "C" { -#endif - -static void qt_init_source(j_decompress_ptr) -{ -} - -static boolean qt_fill_input_buffer(j_decompress_ptr cinfo) -{ - my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src; - if (src->memDevice) { - src->next_input_byte = (const JOCTET *)(src->memDevice->data().constData() + src->memDevice->pos()); - src->bytes_in_buffer = (size_t)(src->memDevice->data().size() - src->memDevice->pos()); - return true; - } - src->next_input_byte = src->buffer; - int num_read = src->device->read((char*)src->buffer, max_buf); - if (num_read <= 0) { - // Insert a fake EOI marker - as per jpeglib recommendation - src->buffer[0] = (JOCTET) 0xFF; - src->buffer[1] = (JOCTET) JPEG_EOI; - src->bytes_in_buffer = 2; - } else { - src->bytes_in_buffer = num_read; - } -#if defined(Q_OS_UNIXWARE) - return B_TRUE; -#else - return true; -#endif -} - -static void qt_skip_input_data(j_decompress_ptr cinfo, long num_bytes) -{ - my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src; - - // `dumb' implementation from jpeglib - - /* Just a dumb implementation for now. Could use fseek() except - * it doesn't work on pipes. Not clear that being smart is worth - * any trouble anyway --- large skips are infrequent. - */ - if (num_bytes > 0) { - while (num_bytes > (long) src->bytes_in_buffer) { // Should not happen in case of memDevice - num_bytes -= (long) src->bytes_in_buffer; - (void) qt_fill_input_buffer(cinfo); - /* note we assume that qt_fill_input_buffer will never return false, - * so suspension need not be handled. - */ - } - src->next_input_byte += (size_t) num_bytes; - src->bytes_in_buffer -= (size_t) num_bytes; - } -} - -static void qt_term_source(j_decompress_ptr cinfo) -{ - my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src; - if (!src->device->isSequential()) - { - // read() isn't used for memDevice, so seek past everything that was used - if (src->memDevice) - src->device->seek(src->device->pos() + (src->memDevice->data().size() - src->memDevice->pos() - src->bytes_in_buffer)); - else - src->device->seek(src->device->pos() - src->bytes_in_buffer); - } -} - -#if defined(Q_C_CALLBACKS) -} -#endif - -inline my_jpeg_source_mgr::my_jpeg_source_mgr(QIODevice *device) -{ - jpeg_source_mgr::init_source = qt_init_source; - jpeg_source_mgr::fill_input_buffer = qt_fill_input_buffer; - jpeg_source_mgr::skip_input_data = qt_skip_input_data; - jpeg_source_mgr::resync_to_restart = jpeg_resync_to_restart; - jpeg_source_mgr::term_source = qt_term_source; - this->device = device; - memDevice = qobject_cast(device); - bytes_in_buffer = 0; - next_input_byte = buffer; -} - - -inline static bool read_jpeg_size(int &w, int &h, j_decompress_ptr cinfo) -{ - (void) jpeg_calc_output_dimensions(cinfo); - - w = cinfo->output_width; - h = cinfo->output_height; - return true; -} - -#define HIGH_QUALITY_THRESHOLD 50 - -inline static bool read_jpeg_format(QImage::Format &format, j_decompress_ptr cinfo) -{ - - bool result = true; - switch (cinfo->output_components) { - case 1: - format = QImage::Format_Indexed8; - break; - case 3: - case 4: - format = QImage::Format_RGB32; - break; - default: - result = false; - break; - } - cinfo->output_scanline = cinfo->output_height; - return result; -} - -static bool ensureValidImage(QImage *dest, struct jpeg_decompress_struct *info, - const QSize& size) -{ - QImage::Format format; - switch (info->output_components) { - case 1: - format = QImage::Format_Indexed8; - break; - case 3: - case 4: - format = QImage::Format_RGB32; - break; - default: - return false; // unsupported format - } - - if (dest->size() != size || dest->format() != format) { - *dest = QImage(size, format); - - if (format == QImage::Format_Indexed8) { - dest->setColorCount(256); - for (int i = 0; i < 256; i++) - dest->setColor(i, qRgb(i,i,i)); - } - } - - return !dest->isNull(); -} - -static bool read_jpeg_image(QImage *outImage, - QSize scaledSize, QRect scaledClipRect, - QRect clipRect, int inQuality, j_decompress_ptr info, struct my_error_mgr* err ) -{ - if (!setjmp(err->setjmp_buffer)) { - // -1 means default quality. - int quality = inQuality; - if (quality < 0) - quality = 75; - - // If possible, merge the scaledClipRect into either scaledSize - // or clipRect to avoid doing a separate scaled clipping pass. - // Best results are achieved by clipping before scaling, not after. - if (!scaledClipRect.isEmpty()) { - if (scaledSize.isEmpty() && clipRect.isEmpty()) { - // No clipping or scaling before final clip. - clipRect = scaledClipRect; - scaledClipRect = QRect(); - } else if (scaledSize.isEmpty()) { - // Clipping, but no scaling: combine the clip regions. - scaledClipRect.translate(clipRect.topLeft()); - clipRect = scaledClipRect.intersected(clipRect); - scaledClipRect = QRect(); - } else if (clipRect.isEmpty()) { - // No clipping, but scaling: if we can map back to an - // integer pixel boundary, then clip before scaling. - if ((info->image_width % scaledSize.width()) == 0 && - (info->image_height % scaledSize.height()) == 0) { - int x = scaledClipRect.x() * info->image_width / - scaledSize.width(); - int y = scaledClipRect.y() * info->image_height / - scaledSize.height(); - int width = (scaledClipRect.right() + 1) * - info->image_width / scaledSize.width() - x; - int height = (scaledClipRect.bottom() + 1) * - info->image_height / scaledSize.height() - y; - clipRect = QRect(x, y, width, height); - scaledSize = scaledClipRect.size(); - scaledClipRect = QRect(); - } - } else { - // Clipping and scaling: too difficult to figure out, - // and not a likely use case, so do it the long way. - } - } - - // Determine the scale factor to pass to libjpeg for quick downscaling. - if (!scaledSize.isEmpty()) { - if (clipRect.isEmpty()) { - info->scale_denom = - qMin(info->image_width / scaledSize.width(), - info->image_height / scaledSize.height()); - } else { - info->scale_denom = - qMin(clipRect.width() / scaledSize.width(), - clipRect.height() / scaledSize.height()); - } - if (info->scale_denom < 2) { - info->scale_denom = 1; - } else if (info->scale_denom < 4) { - info->scale_denom = 2; - } else if (info->scale_denom < 8) { - info->scale_denom = 4; - } else { - info->scale_denom = 8; - } - info->scale_num = 1; - if (!clipRect.isEmpty()) { - // Correct the scale factor so that we clip accurately. - // It is recommended that the clip rectangle be aligned - // on an 8-pixel boundary for best performance. - while (info->scale_denom > 1 && - ((clipRect.x() % info->scale_denom) != 0 || - (clipRect.y() % info->scale_denom) != 0 || - (clipRect.width() % info->scale_denom) != 0 || - (clipRect.height() % info->scale_denom) != 0)) { - info->scale_denom /= 2; - } - } - } - - // If high quality not required, use fast decompression - if( quality < HIGH_QUALITY_THRESHOLD ) { - info->dct_method = JDCT_IFAST; - info->do_fancy_upsampling = FALSE; - } - - (void) jpeg_calc_output_dimensions(info); - - // Determine the clip region to extract. - QRect imageRect(0, 0, info->output_width, info->output_height); - QRect clip; - if (clipRect.isEmpty()) { - clip = imageRect; - } else if (info->scale_denom == info->scale_num) { - clip = clipRect.intersected(imageRect); - } else { - // The scale factor was corrected above to ensure that - // we don't miss pixels when we scale the clip rectangle. - clip = QRect(clipRect.x() / int(info->scale_denom), - clipRect.y() / int(info->scale_denom), - clipRect.width() / int(info->scale_denom), - clipRect.height() / int(info->scale_denom)); - clip = clip.intersected(imageRect); - } - - // Allocate memory for the clipped QImage. - if (!ensureValidImage(outImage, info, clip.size())) - longjmp(err->setjmp_buffer, 1); - - // Avoid memcpy() overhead if grayscale with no clipping. - bool quickGray = (info->output_components == 1 && - clip == imageRect); - if (!quickGray) { - // Ask the jpeg library to allocate a temporary row. - // The library will automatically delete it for us later. - // The libjpeg docs say we should do this before calling - // jpeg_start_decompress(). We can't use "new" here - // because we are inside the setjmp() block and an error - // in the jpeg input stream would cause a memory leak. - JSAMPARRAY rows = (info->mem->alloc_sarray) - ((j_common_ptr)info, JPOOL_IMAGE, - info->output_width * info->output_components, 1); - - (void) jpeg_start_decompress(info); - - while (info->output_scanline < info->output_height) { - int y = int(info->output_scanline) - clip.y(); - if (y >= clip.height()) - break; // We've read the entire clip region, so abort. - - (void) jpeg_read_scanlines(info, rows, 1); - - if (y < 0) - continue; // Haven't reached the starting line yet. - - if (info->output_components == 3) { - // Expand 24->32 bpp. - uchar *in = rows[0] + clip.x() * 3; - QRgb *out = (QRgb*)outImage->scanLine(y); - for (int i = 0; i < clip.width(); ++i) { - *out++ = qRgb(in[0], in[1], in[2]); - in += 3; - } - } else if (info->out_color_space == JCS_CMYK) { - // Convert CMYK->RGB. - uchar *in = rows[0] + clip.x() * 4; - QRgb *out = (QRgb*)outImage->scanLine(y); - for (int i = 0; i < clip.width(); ++i) { - int k = in[3]; - *out++ = qRgb(k * in[0] / 255, k * in[1] / 255, - k * in[2] / 255); - in += 4; - } - } else if (info->output_components == 1) { - // Grayscale. - memcpy(outImage->scanLine(y), - rows[0] + clip.x(), clip.width()); - } - } - } else { - // Load unclipped grayscale data directly into the QImage. - (void) jpeg_start_decompress(info); - while (info->output_scanline < info->output_height) { - uchar *row = outImage->scanLine(info->output_scanline); - (void) jpeg_read_scanlines(info, &row, 1); - } - } - - if (info->output_scanline == info->output_height) - (void) jpeg_finish_decompress(info); - - if (info->density_unit == 1) { - outImage->setDotsPerMeterX(int(100. * info->X_density / 2.54)); - outImage->setDotsPerMeterY(int(100. * info->Y_density / 2.54)); - } else if (info->density_unit == 2) { - outImage->setDotsPerMeterX(int(100. * info->X_density)); - outImage->setDotsPerMeterY(int(100. * info->Y_density)); - } - - if (scaledSize.isValid() && scaledSize != clip.size()) { - *outImage = outImage->scaled(scaledSize, Qt::IgnoreAspectRatio, quality >= HIGH_QUALITY_THRESHOLD ? Qt::SmoothTransformation : Qt::FastTransformation); - } - - if (!scaledClipRect.isEmpty()) - *outImage = outImage->copy(scaledClipRect); - return !outImage->isNull(); - } - else - return false; -} - -struct my_jpeg_destination_mgr : public jpeg_destination_mgr { - // Nothing dynamic - cannot rely on destruction over longjump - QIODevice *device; - JOCTET buffer[max_buf]; - -public: - my_jpeg_destination_mgr(QIODevice *); -}; - - -#if defined(Q_C_CALLBACKS) -extern "C" { -#endif - -static void qt_init_destination(j_compress_ptr) -{ -} - -static boolean qt_empty_output_buffer(j_compress_ptr cinfo) -{ - my_jpeg_destination_mgr* dest = (my_jpeg_destination_mgr*)cinfo->dest; - - int written = dest->device->write((char*)dest->buffer, max_buf); - if (written == -1) - (*cinfo->err->error_exit)((j_common_ptr)cinfo); - - dest->next_output_byte = dest->buffer; - dest->free_in_buffer = max_buf; - -#if defined(Q_OS_UNIXWARE) - return B_TRUE; -#else - return true; -#endif -} - -static void qt_term_destination(j_compress_ptr cinfo) -{ - my_jpeg_destination_mgr* dest = (my_jpeg_destination_mgr*)cinfo->dest; - qint64 n = max_buf - dest->free_in_buffer; - - qint64 written = dest->device->write((char*)dest->buffer, n); - if (written == -1) - (*cinfo->err->error_exit)((j_common_ptr)cinfo); -} - -#if defined(Q_C_CALLBACKS) -} -#endif - -inline my_jpeg_destination_mgr::my_jpeg_destination_mgr(QIODevice *device) -{ - jpeg_destination_mgr::init_destination = qt_init_destination; - jpeg_destination_mgr::empty_output_buffer = qt_empty_output_buffer; - jpeg_destination_mgr::term_destination = qt_term_destination; - this->device = device; - next_output_byte = buffer; - free_in_buffer = max_buf; -} - -static bool can_write_format(QImage::Format fmt) -{ - switch (fmt) { - case QImage::Format_Mono: - case QImage::Format_MonoLSB: - case QImage::Format_Indexed8: - case QImage::Format_RGB888: - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - return true; - break; - default: - break; - } - return false; -} - -static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int sourceQuality) -{ - bool success = false; - const QImage image = can_write_format(sourceImage.format()) ? - sourceImage : sourceImage.convertToFormat(QImage::Format_RGB888); - const QVector cmap = image.colorTable(); - - struct jpeg_compress_struct cinfo; - JSAMPROW row_pointer[1]; - row_pointer[0] = 0; - - struct my_jpeg_destination_mgr *iod_dest = new my_jpeg_destination_mgr(device); - struct my_error_mgr jerr; - - cinfo.err = jpeg_std_error(&jerr); - jerr.error_exit = my_error_exit; - - if (!setjmp(jerr.setjmp_buffer)) { - // WARNING: - // this if loop is inside a setjmp/longjmp branch - // do not create C++ temporaries here because the destructor may never be called - // if you allocate memory, make sure that you can free it (row_pointer[0]) - jpeg_create_compress(&cinfo); - - cinfo.dest = iod_dest; - - cinfo.image_width = image.width(); - cinfo.image_height = image.height(); - - bool gray=false; - switch (image.format()) { - case QImage::Format_Mono: - case QImage::Format_MonoLSB: - case QImage::Format_Indexed8: - gray = true; - for (int i = image.colorCount(); gray && i--;) { - gray = gray & (qRed(cmap[i]) == qGreen(cmap[i]) && - qRed(cmap[i]) == qBlue(cmap[i])); - } - cinfo.input_components = gray ? 1 : 3; - cinfo.in_color_space = gray ? JCS_GRAYSCALE : JCS_RGB; - break; - default: - cinfo.input_components = 3; - cinfo.in_color_space = JCS_RGB; - } - - jpeg_set_defaults(&cinfo); - - qreal diffInch = qAbs(image.dotsPerMeterX()*2.54/100. - qRound(image.dotsPerMeterX()*2.54/100.)) - + qAbs(image.dotsPerMeterY()*2.54/100. - qRound(image.dotsPerMeterY()*2.54/100.)); - qreal diffCm = (qAbs(image.dotsPerMeterX()/100. - qRound(image.dotsPerMeterX()/100.)) - + qAbs(image.dotsPerMeterY()/100. - qRound(image.dotsPerMeterY()/100.)))*2.54; - if (diffInch < diffCm) { - cinfo.density_unit = 1; // dots/inch - cinfo.X_density = qRound(image.dotsPerMeterX()*2.54/100.); - cinfo.Y_density = qRound(image.dotsPerMeterY()*2.54/100.); - } else { - cinfo.density_unit = 2; // dots/cm - cinfo.X_density = (image.dotsPerMeterX()+50) / 100; - cinfo.Y_density = (image.dotsPerMeterY()+50) / 100; - } - - - int quality = sourceQuality >= 0 ? qMin(sourceQuality,100) : 75; -#if defined(Q_OS_UNIXWARE) - jpeg_set_quality(&cinfo, quality, B_TRUE /* limit to baseline-JPEG values */); - jpeg_start_compress(&cinfo, B_TRUE); -#else - jpeg_set_quality(&cinfo, quality, true /* limit to baseline-JPEG values */); - jpeg_start_compress(&cinfo, true); -#endif - - row_pointer[0] = new uchar[cinfo.image_width*cinfo.input_components]; - int w = cinfo.image_width; - while (cinfo.next_scanline < cinfo.image_height) { - uchar *row = row_pointer[0]; - switch (image.format()) { - case QImage::Format_Mono: - case QImage::Format_MonoLSB: - if (gray) { - const uchar* data = image.scanLine(cinfo.next_scanline); - if (image.format() == QImage::Format_MonoLSB) { - for (int i=0; i> 3)) & (1 << (i & 7))); - row[i] = qRed(cmap[bit]); - } - } else { - for (int i=0; i> 3)) & (1 << (7 -(i & 7)))); - row[i] = qRed(cmap[bit]); - } - } - } else { - const uchar* data = image.scanLine(cinfo.next_scanline); - if (image.format() == QImage::Format_MonoLSB) { - for (int i=0; i> 3)) & (1 << (i & 7))); - *row++ = qRed(cmap[bit]); - *row++ = qGreen(cmap[bit]); - *row++ = qBlue(cmap[bit]); - } - } else { - for (int i=0; i> 3)) & (1 << (7 -(i & 7)))); - *row++ = qRed(cmap[bit]); - *row++ = qGreen(cmap[bit]); - *row++ = qBlue(cmap[bit]); - } - } - } - break; - case QImage::Format_Indexed8: - if (gray) { - const uchar* pix = image.scanLine(cinfo.next_scanline); - for (int i=0; idevice()); - - if(state == ReadHeader) - { - bool success = read_jpeg_image(image, scaledSize, scaledClipRect, clipRect, quality, &info, &err); - state = success ? Ready : Error; - return success; - } - - return false; - -} - -QJpegHandler::QJpegHandler() - : d(new QJpegHandlerPrivate(this)) -{ -} - -QJpegHandler::~QJpegHandler() -{ - delete d; -} - -bool QJpegHandler::canRead() const -{ - if(d->state == QJpegHandlerPrivate::Ready && !canRead(device())) - return false; - - if (d->state != QJpegHandlerPrivate::Error) { - setFormat("jpeg"); - return true; - } - - return false; -} - -bool QJpegHandler::canRead(QIODevice *device) -{ - if (!device) { - qWarning("QJpegHandler::canRead() called with no device"); - return false; - } - - char buffer[2]; - if (device->peek(buffer, 2) != 2) - return false; - return uchar(buffer[0]) == 0xff && uchar(buffer[1]) == 0xd8; -} - -bool QJpegHandler::read(QImage *image) -{ - if (!canRead()) - return false; - return d->read(image); -} - -bool QJpegHandler::write(const QImage &image) -{ - return write_jpeg_image(image, device(), d->quality); -} - -bool QJpegHandler::supportsOption(ImageOption option) const -{ - return option == Quality - || option == ScaledSize - || option == ScaledClipRect - || option == ClipRect - || option == Size - || option == ImageFormat; -} - -QVariant QJpegHandler::option(ImageOption option) const -{ - switch(option) { - case Quality: - return d->quality; - case ScaledSize: - return d->scaledSize; - case ScaledClipRect: - return d->scaledClipRect; - case ClipRect: - return d->clipRect; - case Size: - d->readJpegHeader(device()); - return d->size; - case ImageFormat: - d->readJpegHeader(device()); - return d->format; - default: - return QVariant(); - } -} - -void QJpegHandler::setOption(ImageOption option, const QVariant &value) -{ - switch(option) { - case Quality: - d->quality = value.toInt(); - break; - case ScaledSize: - d->scaledSize = value.toSize(); - break; - case ScaledClipRect: - d->scaledClipRect = value.toRect(); - break; - case ClipRect: - d->clipRect = value.toRect(); - break; - default: - break; - } -} - -QByteArray QJpegHandler::name() const -{ - return "jpeg"; -} - - - - -QT_END_NAMESPACE diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.h b/src/plugins/imageformats/jpeg/qjpeghandler.h deleted file mode 100644 index c879f21..0000000 --- a/src/plugins/imageformats/jpeg/qjpeghandler.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QJPEGHANDLER_H -#define QJPEGHANDLER_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QJpegHandlerPrivate; -class QJpegHandler : public QImageIOHandler -{ -public: - QJpegHandler(); - ~QJpegHandler(); - - bool canRead() const; - bool read(QImage *image); - bool write(const QImage &image); - - QByteArray name() const; - - static bool canRead(QIODevice *device); - - QVariant option(ImageOption option) const; - void setOption(ImageOption option, const QVariant &value); - bool supportsOption(ImageOption option) const; - -private: - QJpegHandlerPrivate *d; -}; - -QT_END_NAMESPACE - -#endif // QJPEGHANDLER_H diff --git a/src/plugins/imageformats/mng/mng.pro b/src/plugins/imageformats/mng/mng.pro index 1f3ad53..88085f3 100644 --- a/src/plugins/imageformats/mng/mng.pro +++ b/src/plugins/imageformats/mng/mng.pro @@ -3,54 +3,15 @@ include(../../qpluginbase.pri) QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-mng)" -HEADERS += qmnghandler.h -SOURCES += main.cpp \ - qmnghandler.cpp - symbian: { #Disable warnings in 3rdparty code due to unused variables and arguments QMAKE_CXXFLAGS.CW += -W nounused TARGET.UID3=0x2001E619 } -contains(QT_CONFIG, system-mng) { - unix|win32-g++*:LIBS += -lmng - win32:!win32-g++*:LIBS += libmng.lib -} else { - DEFINES += MNG_BUILD_SO - DEFINES += MNG_NO_INCLUDE_JNG - INCLUDEPATH += ../../../3rdparty/libmng - SOURCES += \ - ../../../3rdparty/libmng/libmng_callback_xs.c \ - ../../../3rdparty/libmng/libmng_chunk_io.c \ - ../../../3rdparty/libmng/libmng_chunk_descr.c \ - ../../../3rdparty/libmng/libmng_chunk_prc.c \ - ../../../3rdparty/libmng/libmng_chunk_xs.c \ - ../../../3rdparty/libmng/libmng_cms.c \ - ../../../3rdparty/libmng/libmng_display.c \ - ../../../3rdparty/libmng/libmng_dither.c \ - ../../../3rdparty/libmng/libmng_error.c \ - ../../../3rdparty/libmng/libmng_filter.c \ - ../../../3rdparty/libmng/libmng_hlapi.c \ - ../../../3rdparty/libmng/libmng_jpeg.c \ - ../../../3rdparty/libmng/libmng_object_prc.c \ - ../../../3rdparty/libmng/libmng_pixels.c \ - ../../../3rdparty/libmng/libmng_prop_xs.c \ - ../../../3rdparty/libmng/libmng_read.c \ - ../../../3rdparty/libmng/libmng_trace.c \ - ../../../3rdparty/libmng/libmng_write.c \ - ../../../3rdparty/libmng/libmng_zlib.c - - contains(QT_CONFIG, system-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib - } else { - INCLUDEPATH += ../../../3rdparty/zlib - } -} +include(../../../gui/image/qmnghandler.pri) +SOURCES += main.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats target.path += $$[QT_INSTALL_PLUGINS]/imageformats INSTALLS += target - diff --git a/src/plugins/imageformats/mng/qmnghandler.cpp b/src/plugins/imageformats/mng/qmnghandler.cpp deleted file mode 100644 index ec442a1..0000000 --- a/src/plugins/imageformats/mng/qmnghandler.cpp +++ /dev/null @@ -1,497 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmnghandler.h" - -#include "qimage.h" -#include "qvariant.h" -#include "qcolor.h" - -#define MNG_USE_SO -#include - -QT_BEGIN_NAMESPACE - -class QMngHandlerPrivate -{ - Q_DECLARE_PUBLIC(QMngHandler) - public: - bool haveReadNone; - bool haveReadAll; - mng_handle hMNG; - QImage image; - int elapsed; - int nextDelay; - int iterCount; - int frameIndex; - int nextIndex; - int frameCount; - mng_uint32 iStyle; - mng_bool readData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pRead); - mng_bool writeData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pWritten); - mng_bool processHeader(mng_uint32 iWidth, mng_uint32 iHeight); - QMngHandlerPrivate(QMngHandler *q_ptr); - ~QMngHandlerPrivate(); - bool getNextImage(QImage *result); - bool writeImage(const QImage &image); - int currentImageNumber() const; - int imageCount() const; - bool jumpToImage(int imageNumber); - bool jumpToNextImage(); - int nextImageDelay() const; - bool setBackgroundColor(const QColor &color); - QColor backgroundColor() const; - QMngHandler *q_ptr; -}; - -static mng_bool myerror(mng_handle /*hMNG*/, - mng_int32 iErrorcode, - mng_int8 /*iSeverity*/, - mng_chunkid iChunkname, - mng_uint32 /*iChunkseq*/, - mng_int32 iExtra1, - mng_int32 iExtra2, - mng_pchar zErrortext) -{ - qWarning("MNG error %d: %s; chunk %c%c%c%c; subcode %d:%d", - iErrorcode,zErrortext, - (iChunkname>>24)&0xff, - (iChunkname>>16)&0xff, - (iChunkname>>8)&0xff, - (iChunkname>>0)&0xff, - iExtra1,iExtra2); - return TRUE; -} - -static mng_ptr myalloc(mng_size_t iSize) -{ -#if defined(Q_OS_WINCE) - mng_ptr ptr = malloc(iSize); - memset(ptr, 0, iSize); - return ptr; -#else - return (mng_ptr)calloc(1, iSize); -#endif -} - -static void myfree(mng_ptr pPtr, mng_size_t /*iSize*/) -{ - free(pPtr); -} - -static mng_bool myopenstream(mng_handle) -{ - return MNG_TRUE; -} - -static mng_bool myclosestream(mng_handle hMNG) -{ - QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); - pMydata->haveReadAll = true; - return MNG_TRUE; -} - -static mng_bool myreaddata(mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32p pRead) -{ - QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); - return pMydata->readData(pBuf, iSize, pRead); -} - -static mng_bool mywritedata(mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32p pWritten) -{ - QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); - return pMydata->writeData(pBuf, iSize, pWritten); -} - -static mng_bool myprocessheader(mng_handle hMNG, - mng_uint32 iWidth, - mng_uint32 iHeight) -{ - QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); - return pMydata->processHeader(iWidth, iHeight); -} - -static mng_ptr mygetcanvasline(mng_handle hMNG, - mng_uint32 iLinenr) -{ - QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); - return (mng_ptr)pMydata->image.scanLine(iLinenr); -} - -static mng_bool myrefresh(mng_handle /*hMNG*/, - mng_uint32 /*iX*/, - mng_uint32 /*iY*/, - mng_uint32 /*iWidth*/, - mng_uint32 /*iHeight*/) -{ - return MNG_TRUE; -} - -static mng_uint32 mygettickcount(mng_handle hMNG) -{ - QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); - return pMydata->elapsed++; -} - -static mng_bool mysettimer(mng_handle hMNG, - mng_uint32 iMsecs) -{ - QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); - pMydata->elapsed += iMsecs; - pMydata->nextDelay = iMsecs; - return MNG_TRUE; -} - -static mng_bool myprocessterm(mng_handle hMNG, - mng_uint8 iTermaction, - mng_uint8 /*iIteraction*/, - mng_uint32 /*iDelay*/, - mng_uint32 iItermax) -{ - QMngHandlerPrivate *pMydata = reinterpret_cast(mng_get_userdata(hMNG)); - if (iTermaction == 3) - pMydata->iterCount = iItermax; - return MNG_TRUE; -} - -static mng_bool mytrace(mng_handle, - mng_int32 iFuncnr, - mng_int32 iFuncseq, - mng_pchar zFuncname) -{ - qDebug("mng trace: iFuncnr: %d iFuncseq: %d zFuncname: %s", iFuncnr, iFuncseq, zFuncname); - return MNG_TRUE; -} - -QMngHandlerPrivate::QMngHandlerPrivate(QMngHandler *q_ptr) - : haveReadNone(true), haveReadAll(false), elapsed(0), nextDelay(0), iterCount(1), - frameIndex(-1), nextIndex(0), frameCount(0), q_ptr(q_ptr) -{ - iStyle = (QSysInfo::ByteOrder == QSysInfo::LittleEndian) ? MNG_CANVAS_BGRA8 : MNG_CANVAS_ARGB8; - // Initialize libmng - hMNG = mng_initialize((mng_ptr)this, myalloc, myfree, mytrace); - if (hMNG) { - // Set callback functions - mng_setcb_errorproc(hMNG, myerror); - mng_setcb_openstream(hMNG, myopenstream); - mng_setcb_closestream(hMNG, myclosestream); - mng_setcb_readdata(hMNG, myreaddata); - mng_setcb_writedata(hMNG, mywritedata); - mng_setcb_processheader(hMNG, myprocessheader); - mng_setcb_getcanvasline(hMNG, mygetcanvasline); - mng_setcb_refresh(hMNG, myrefresh); - mng_setcb_gettickcount(hMNG, mygettickcount); - mng_setcb_settimer(hMNG, mysettimer); - mng_setcb_processterm(hMNG, myprocessterm); - mng_set_doprogressive(hMNG, MNG_FALSE); - mng_set_suspensionmode(hMNG, MNG_TRUE); - } -} - -QMngHandlerPrivate::~QMngHandlerPrivate() -{ - mng_cleanup(&hMNG); -} - -mng_bool QMngHandlerPrivate::readData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pRead) -{ - Q_Q(QMngHandler); - *pRead = q->device()->read((char *)pBuf, iSize); - return (*pRead > 0) ? MNG_TRUE : MNG_FALSE; -} - -mng_bool QMngHandlerPrivate::writeData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pWritten) -{ - Q_Q(QMngHandler); - *pWritten = q->device()->write((char *)pBuf, iSize); - return MNG_TRUE; -} - -mng_bool QMngHandlerPrivate::processHeader(mng_uint32 iWidth, mng_uint32 iHeight) -{ - if (mng_set_canvasstyle(hMNG, iStyle) != MNG_NOERROR) - return MNG_FALSE; - image = QImage(iWidth, iHeight, QImage::Format_ARGB32); - image.fill(0); - return MNG_TRUE; -} - -bool QMngHandlerPrivate::getNextImage(QImage *result) -{ - mng_retcode ret; - if (haveReadNone) { - haveReadNone = false; - ret = mng_readdisplay(hMNG); - } else { - ret = mng_display_resume(hMNG); - } - if ((MNG_NOERROR == ret) || (MNG_NEEDTIMERWAIT == ret)) { - *result = image; - frameIndex = nextIndex++; - if (haveReadAll && (frameCount == 0)) - frameCount = nextIndex; - return true; - } - return false; -} - -bool QMngHandlerPrivate::writeImage(const QImage &image) -{ - mng_reset(hMNG); - if (mng_create(hMNG) != MNG_NOERROR) - return false; - - this->image = image.convertToFormat(QImage::Format_ARGB32); - int w = image.width(); - int h = image.height(); - - if ( - // width, height, ticks, layercount, framecount, playtime, simplicity - (mng_putchunk_mhdr(hMNG, w, h, 1000, 0, 0, 0, 7) == MNG_NOERROR) && - // termination_action, action_after_iterations, delay, iteration_max - (mng_putchunk_term(hMNG, 3, 0, 1, 0x7FFFFFFF) == MNG_NOERROR) && - // width, height, bitdepth, colortype, compression, filter, interlace - (mng_putchunk_ihdr(hMNG, w, h, 8, 6, 0, 0, 0) == MNG_NOERROR) && - // width, height, colortype, bitdepth, compression, filter, interlace, canvasstyle, getcanvasline - (mng_putimgdata_ihdr(hMNG, w, h, 6, 8, 0, 0, 0, iStyle, mygetcanvasline) == MNG_NOERROR) && - (mng_putchunk_iend(hMNG) == MNG_NOERROR) && - (mng_putchunk_mend(hMNG) == MNG_NOERROR) && - (mng_write(hMNG) == MNG_NOERROR) - ) - return true; - return false; -} - -int QMngHandlerPrivate::currentImageNumber() const -{ -// return mng_get_currentframe(hMNG) % imageCount(); not implemented, apparently - return frameIndex; -} - -int QMngHandlerPrivate::imageCount() const -{ -// return mng_get_totalframes(hMNG); not implemented, apparently - if (haveReadAll) - return frameCount; - return 0; // Don't know -} - -bool QMngHandlerPrivate::jumpToImage(int imageNumber) -{ - if (imageNumber == nextIndex) - return true; - - if ((imageNumber == 0) && haveReadAll && (nextIndex == frameCount)) { - // Loop! - nextIndex = 0; - return true; - } - if (mng_display_freeze(hMNG) == MNG_NOERROR) { - if (mng_display_goframe(hMNG, imageNumber) == MNG_NOERROR) { - nextIndex = imageNumber; - return true; - } - } - return false; -} - -bool QMngHandlerPrivate::jumpToNextImage() -{ - return jumpToImage((currentImageNumber()+1) % imageCount()); -} - -int QMngHandlerPrivate::nextImageDelay() const -{ - return nextDelay; -} - -bool QMngHandlerPrivate::setBackgroundColor(const QColor &color) -{ - mng_uint16 iRed = (mng_uint16)(color.red() << 8); - mng_uint16 iBlue = (mng_uint16)(color.blue() << 8); - mng_uint16 iGreen = (mng_uint16)(color.green() << 8); - return (mng_set_bgcolor(hMNG, iRed, iBlue, iGreen) == MNG_NOERROR); -} - -QColor QMngHandlerPrivate::backgroundColor() const -{ - mng_uint16 iRed; - mng_uint16 iBlue; - mng_uint16 iGreen; - if (mng_get_bgcolor(hMNG, &iRed, &iBlue, &iGreen) == MNG_NOERROR) - return QColor((iRed >> 8) & 0xFF, (iGreen >> 8) & 0xFF, (iBlue >> 8) & 0xFF); - return QColor(); -} - -QMngHandler::QMngHandler() - : d_ptr(new QMngHandlerPrivate(this)) -{ -} - -QMngHandler::~QMngHandler() -{ -} - -/*! \reimp */ -bool QMngHandler::canRead() const -{ - Q_D(const QMngHandler); - if ((!d->haveReadNone - && (!d->haveReadAll || (d->haveReadAll && (d->nextIndex < d->frameCount)))) - || canRead(device())) - { - setFormat("mng"); - return true; - } - return false; -} - -/*! \internal */ -bool QMngHandler::canRead(QIODevice *device) -{ - if (!device) { - qWarning("QMngHandler::canRead() called with no device"); - return false; - } - - return device->peek(8) == "\x8A\x4D\x4E\x47\x0D\x0A\x1A\x0A"; -} - -/*! \reimp */ -QByteArray QMngHandler::name() const -{ - return "mng"; -} - -/*! \reimp */ -bool QMngHandler::read(QImage *image) -{ - Q_D(QMngHandler); - return canRead() ? d->getNextImage(image) : false; -} - -/*! \reimp */ -bool QMngHandler::write(const QImage &image) -{ - Q_D(QMngHandler); - return d->writeImage(image); -} - -/*! \reimp */ -int QMngHandler::currentImageNumber() const -{ - Q_D(const QMngHandler); - return d->currentImageNumber(); -} - -/*! \reimp */ -int QMngHandler::imageCount() const -{ - Q_D(const QMngHandler); - return d->imageCount(); -} - -/*! \reimp */ -bool QMngHandler::jumpToImage(int imageNumber) -{ - Q_D(QMngHandler); - return d->jumpToImage(imageNumber); -} - -/*! \reimp */ -bool QMngHandler::jumpToNextImage() -{ - Q_D(QMngHandler); - return d->jumpToNextImage(); -} - -/*! \reimp */ -int QMngHandler::loopCount() const -{ - Q_D(const QMngHandler); - if (d->iterCount == 0x7FFFFFFF) - return -1; // infinite loop - return d->iterCount-1; -} - -/*! \reimp */ -int QMngHandler::nextImageDelay() const -{ - Q_D(const QMngHandler); - return d->nextImageDelay(); -} - -/*! \reimp */ -QVariant QMngHandler::option(ImageOption option) const -{ - Q_D(const QMngHandler); - if (option == QImageIOHandler::Animation) - return true; - else if (option == QImageIOHandler::BackgroundColor) - return d->backgroundColor(); - return QVariant(); -} - -/*! \reimp */ -void QMngHandler::setOption(ImageOption option, const QVariant & value) -{ - Q_D(QMngHandler); - if (option == QImageIOHandler::BackgroundColor) - d->setBackgroundColor(qVariantValue(value)); -} - -/*! \reimp */ -bool QMngHandler::supportsOption(ImageOption option) const -{ - if (option == QImageIOHandler::Animation) - return true; - else if (option == QImageIOHandler::BackgroundColor) - return true; - return false; -} - -QT_END_NAMESPACE diff --git a/src/plugins/imageformats/mng/qmnghandler.h b/src/plugins/imageformats/mng/qmnghandler.h deleted file mode 100644 index 65243be..0000000 --- a/src/plugins/imageformats/mng/qmnghandler.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMNGHANDLER_H -#define QMNGHANDLER_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QImage; -class QByteArray; -class QIODevice; -class QVariant; -class QMngHandlerPrivate; - -class QMngHandler : public QImageIOHandler -{ - public: - QMngHandler(); - ~QMngHandler(); - virtual bool canRead() const; - virtual QByteArray name() const; - virtual bool read(QImage *image); - virtual bool write(const QImage &image); - virtual int currentImageNumber() const; - virtual int imageCount() const; - virtual bool jumpToImage(int imageNumber); - virtual bool jumpToNextImage(); - virtual int loopCount() const; - virtual int nextImageDelay() const; - static bool canRead(QIODevice *device); - virtual QVariant option(ImageOption option) const; - virtual void setOption(ImageOption option, const QVariant & value); - virtual bool supportsOption(ImageOption option) const; - - private: - Q_DECLARE_PRIVATE(QMngHandler) - QScopedPointer d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QMNGHANDLER_H diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp deleted file mode 100644 index 619aa4e..0000000 --- a/src/plugins/imageformats/tiff/qtiffhandler.cpp +++ /dev/null @@ -1,661 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtiffhandler.h" -#include -#include -#include -#include -extern "C" { -#include "tiffio.h" -} - -QT_BEGIN_NAMESPACE - -tsize_t qtiffReadProc(thandle_t fd, tdata_t buf, tsize_t size) -{ - QIODevice* device = static_cast(fd)->device(); - return device->isReadable() ? device->read(static_cast(buf), size) : -1; -} - -tsize_t qtiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size) -{ - return static_cast(fd)->device()->write(static_cast(buf), size); -} - -toff_t qtiffSeekProc(thandle_t fd, toff_t off, int whence) -{ - QIODevice *device = static_cast(fd)->device(); - switch (whence) { - case SEEK_SET: - device->seek(off); - break; - case SEEK_CUR: - device->seek(device->pos() + off); - break; - case SEEK_END: - device->seek(device->size() + off); - break; - } - - return device->pos(); -} - -int qtiffCloseProc(thandle_t /*fd*/) -{ - return 0; -} - -toff_t qtiffSizeProc(thandle_t fd) -{ - return static_cast(fd)->device()->size(); -} - -int qtiffMapProc(thandle_t /*fd*/, tdata_t* /*pbase*/, toff_t* /*psize*/) -{ - return 0; -} - -void qtiffUnmapProc(thandle_t /*fd*/, tdata_t /*base*/, toff_t /*size*/) -{ -} - -// for 32 bits images -inline void rotate_right_mirror_horizontal(QImage *const image)// rotate right->mirrored horizontal -{ - const int height = image->height(); - const int width = image->width(); - QImage generated(/* width = */ height, /* height = */ width, image->format()); - const uint32 *originalPixel = reinterpret_cast(image->bits()); - uint32 *const generatedPixels = reinterpret_cast(generated.bits()); - for (int row=0; row < height; ++row) { - for (int col=0; col < width; ++col) { - int idx = col * height + row; - generatedPixels[idx] = *originalPixel; - ++originalPixel; - } - } - *image = generated; -} - -inline void rotate_right_mirror_vertical(QImage *const image) // rotate right->mirrored vertical -{ - const int height = image->height(); - const int width = image->width(); - QImage generated(/* width = */ height, /* height = */ width, image->format()); - const int lastCol = width - 1; - const int lastRow = height - 1; - const uint32 *pixel = reinterpret_cast(image->bits()); - uint32 *const generatedBits = reinterpret_cast(generated.bits()); - for (int row=0; row < height; ++row) { - for (int col=0; col < width; ++col) { - int idx = (lastCol - col) * height + (lastRow - row); - generatedBits[idx] = *pixel; - ++pixel; - } - } - *image = generated; -} - -QTiffHandler::QTiffHandler() : QImageIOHandler() -{ - compression = NoCompression; -} - -bool QTiffHandler::canRead() const -{ - if (canRead(device())) { - setFormat("tiff"); - return true; - } - return false; -} - -bool QTiffHandler::canRead(QIODevice *device) -{ - if (!device) { - qWarning("QTiffHandler::canRead() called with no device"); - return false; - } - - // current implementation uses TIFFClientOpen which needs to be - // able to seek, so sequential devices are not supported - QByteArray header = device->peek(4); - return header == QByteArray::fromRawData("\x49\x49\x2A\x00", 4) - || header == QByteArray::fromRawData("\x4D\x4D\x00\x2A", 4); -} - -bool QTiffHandler::read(QImage *image) -{ - if (!canRead()) - return false; - - TIFF *const tiff = TIFFClientOpen("foo", - "r", - this, - qtiffReadProc, - qtiffWriteProc, - qtiffSeekProc, - qtiffCloseProc, - qtiffSizeProc, - qtiffMapProc, - qtiffUnmapProc); - - if (!tiff) { - return false; - } - uint32 width; - uint32 height; - uint16 photometric; - if (!TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width) - || !TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height) - || !TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric)) { - TIFFClose(tiff); - return false; - } - - // BitsPerSample defaults to 1 according to the TIFF spec. - uint16 bitPerSample; - if (!TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitPerSample)) - bitPerSample = 1; - - bool grayscale = photometric == PHOTOMETRIC_MINISBLACK || photometric == PHOTOMETRIC_MINISWHITE; - if (grayscale && bitPerSample == 1) { - if (image->size() != QSize(width, height) || image->format() != QImage::Format_Mono) - *image = QImage(width, height, QImage::Format_Mono); - QVector colortable(2); - if (photometric == PHOTOMETRIC_MINISBLACK) { - colortable[0] = 0xff000000; - colortable[1] = 0xffffffff; - } else { - colortable[0] = 0xffffffff; - colortable[1] = 0xff000000; - } - image->setColorTable(colortable); - - if (!image->isNull()) { - for (uint32 y=0; yscanLine(y), y, 0) < 0) { - TIFFClose(tiff); - return false; - } - } - } - } else { - if ((grayscale || photometric == PHOTOMETRIC_PALETTE) && bitPerSample == 8) { - if (image->size() != QSize(width, height) || image->format() != QImage::Format_Indexed8) - *image = QImage(width, height, QImage::Format_Indexed8); - if (!image->isNull()) { - const uint16 tableSize = 256; - QVector qtColorTable(tableSize); - if (grayscale) { - for (int i = 0; i(qMalloc(tableSize * sizeof(uint16))); - uint16 *greenTable = static_cast(qMalloc(tableSize * sizeof(uint16))); - uint16 *blueTable = static_cast(qMalloc(tableSize * sizeof(uint16))); - if (!redTable || !greenTable || !blueTable) { - TIFFClose(tiff); - return false; - } - if (!TIFFGetField(tiff, TIFFTAG_COLORMAP, &redTable, &greenTable, &blueTable)) { - TIFFClose(tiff); - return false; - } - - for (int i = 0; isetColorTable(qtColorTable); - for (uint32 y=0; yscanLine(y), y, 0) < 0) { - TIFFClose(tiff); - return false; - } - } - - // free redTable, greenTable and greenTable done by libtiff - } - } else { - if (image->size() != QSize(width, height) || image->format() != QImage::Format_ARGB32) - *image = QImage(width, height, QImage::Format_ARGB32); - if (!image->isNull()) { - const int stopOnError = 1; - if (TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast(image->bits()), ORIENTATION_TOPLEFT, stopOnError)) { - for (uint32 y=0; yscanLine(y), width); - } else { - TIFFClose(tiff); - return false; - } - } - } - } - - if (image->isNull()) { - TIFFClose(tiff); - return false; - } - - float resX = 0; - float resY = 0; - uint16 resUnit = RESUNIT_NONE; - if (TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit) - && TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &resX) - && TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &resY)) { - - switch(resUnit) { - case RESUNIT_CENTIMETER: - image->setDotsPerMeterX(qRound(resX * 100)); - image->setDotsPerMeterY(qRound(resY * 100)); - break; - case RESUNIT_INCH: - image->setDotsPerMeterX(qRound(resX * (100 / 2.54))); - image->setDotsPerMeterY(qRound(resY * (100 / 2.54))); - break; - default: - // do nothing as defaults have already - // been set within the QImage class - break; - } - } - - // rotate the image if the orientation is defined in the file - uint16 orientationTag; - if (TIFFGetField(tiff, TIFFTAG_ORIENTATION, &orientationTag)) { - if (image->format() == QImage::Format_ARGB32) { - // TIFFReadRGBAImageOriented() flip the image but does not rotate them - switch (orientationTag) { - case 5: - rotate_right_mirror_horizontal(image); - break; - case 6: - rotate_right_mirror_vertical(image); - break; - case 7: - rotate_right_mirror_horizontal(image); - break; - case 8: - rotate_right_mirror_vertical(image); - break; - } - } else { - switch (orientationTag) { - case 1: // default orientation - break; - case 2: // mirror horizontal - *image = image->mirrored(true, false); - break; - case 3: // mirror both - *image = image->mirrored(true, true); - break; - case 4: // mirror vertical - *image = image->mirrored(false, true); - break; - case 5: // rotate right mirror horizontal - { - QMatrix transformation; - transformation.rotate(90); - *image = image->transformed(transformation); - *image = image->mirrored(true, false); - break; - } - case 6: // rotate right - { - QMatrix transformation; - transformation.rotate(90); - *image = image->transformed(transformation); - break; - } - case 7: // rotate right, mirror vertical - { - QMatrix transformation; - transformation.rotate(90); - *image = image->transformed(transformation); - *image = image->mirrored(false, true); - break; - } - case 8: // rotate left - { - QMatrix transformation; - transformation.rotate(270); - *image = image->transformed(transformation); - break; - } - } - } - } - - - TIFFClose(tiff); - return true; -} - -static bool checkGrayscale(const QVector &colorTable) -{ - if (colorTable.size() != 256) - return false; - - const bool increasing = (colorTable.at(0) == 0xff000000); - for (int i = 0; i < 256; ++i) { - if ((increasing && colorTable.at(i) != qRgb(i, i, i)) - || (!increasing && colorTable.at(i) != qRgb(255 - i, 255 - i, 255 - i))) - return false; - } - return true; -} - -bool QTiffHandler::write(const QImage &image) -{ - if (!device()->isWritable()) - return false; - - TIFF *const tiff = TIFFClientOpen("foo", - "w", - this, - qtiffReadProc, - qtiffWriteProc, - qtiffSeekProc, - qtiffCloseProc, - qtiffSizeProc, - qtiffMapProc, - qtiffUnmapProc); - if (!tiff) - return false; - - const int width = image.width(); - const int height = image.height(); - - if (!TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, width) - || !TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, height) - || !TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)) { - TIFFClose(tiff); - return false; - } - - // set the resolution - bool resolutionSet = false; - const int dotPerMeterX = image.dotsPerMeterX(); - const int dotPerMeterY = image.dotsPerMeterY(); - if ((dotPerMeterX % 100) == 0 - && (dotPerMeterY % 100) == 0) { - resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_CENTIMETER) - && TIFFSetField(tiff, TIFFTAG_XRESOLUTION, dotPerMeterX/100.0) - && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, dotPerMeterY/100.0); - } else { - resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH) - && TIFFSetField(tiff, TIFFTAG_XRESOLUTION, static_cast(image.logicalDpiX())) - && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, static_cast(image.logicalDpiY())); - } - if (!resolutionSet) { - TIFFClose(tiff); - return false; - } - - // configure image depth - const QImage::Format format = image.format(); - if (format == QImage::Format_Mono || format == QImage::Format_MonoLSB) { - uint16 photometric = PHOTOMETRIC_MINISBLACK; - if (image.colorTable().at(0) == 0xffffffff) - photometric = PHOTOMETRIC_MINISWHITE; - if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric) - || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_CCITTRLE) - || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 1)) { - TIFFClose(tiff); - return false; - } - - // try to do the conversion in chunks no greater than 16 MB - int chunks = (width * height / (1024 * 1024 * 16)) + 1; - int chunkHeight = qMax(height / chunks, 1); - - int y = 0; - while (y < height) { - QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y)).convertToFormat(QImage::Format_Mono); - - int chunkStart = y; - int chunkEnd = y + chunk.height(); - while (y < chunkEnd) { - if (TIFFWriteScanline(tiff, reinterpret_cast(chunk.scanLine(y - chunkStart)), y) != 1) { - TIFFClose(tiff); - return false; - } - ++y; - } - } - TIFFClose(tiff); - } else if (format == QImage::Format_Indexed8) { - const QVector colorTable = image.colorTable(); - bool isGrayscale = checkGrayscale(colorTable); - if (isGrayscale) { - uint16 photometric = PHOTOMETRIC_MINISBLACK; - if (image.colorTable().at(0) == 0xffffffff) - photometric = PHOTOMETRIC_MINISWHITE; - if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric) - || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_PACKBITS) - || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) { - TIFFClose(tiff); - return false; - } - } else { - if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE) - || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_PACKBITS) - || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) { - TIFFClose(tiff); - return false; - } - //// write the color table - // allocate the color tables - uint16 *redTable = static_cast(qMalloc(256 * sizeof(uint16))); - uint16 *greenTable = static_cast(qMalloc(256 * sizeof(uint16))); - uint16 *blueTable = static_cast(qMalloc(256 * sizeof(uint16))); - if (!redTable || !greenTable || !blueTable) { - TIFFClose(tiff); - return false; - } - - // set the color table - const int tableSize = colorTable.size(); - Q_ASSERT(tableSize <= 256); - for (int i = 0; i(chunk.scanLine(y - chunkStart)), y) != 1) { - TIFFClose(tiff); - return false; - } - ++y; - } - } - TIFFClose(tiff); - - } else { - if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB) - || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW) - || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 4) - || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) { - TIFFClose(tiff); - return false; - } - // try to do the ARGB32 conversion in chunks no greater than 16 MB - int chunks = (width * height * 4 / (1024 * 1024 * 16)) + 1; - int chunkHeight = qMax(height / chunks, 1); - - int y = 0; - while (y < height) { - QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y)).convertToFormat(QImage::Format_ARGB32); - - int chunkStart = y; - int chunkEnd = y + chunk.height(); - while (y < chunkEnd) { - if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) - convert32BitOrder(chunk.scanLine(y - chunkStart), width); - else - convert32BitOrderBigEndian(chunk.scanLine(y - chunkStart), width); - - if (TIFFWriteScanline(tiff, reinterpret_cast(chunk.scanLine(y - chunkStart)), y) != 1) { - TIFFClose(tiff); - return false; - } - ++y; - } - } - TIFFClose(tiff); - } - - return true; -} - -QByteArray QTiffHandler::name() const -{ - return "tiff"; -} - -QVariant QTiffHandler::option(ImageOption option) const -{ - if (option == Size && canRead()) { - QSize imageSize; - qint64 pos = device()->pos(); - TIFF *tiff = TIFFClientOpen("foo", - "r", - const_cast(this), - qtiffReadProc, - qtiffWriteProc, - qtiffSeekProc, - qtiffCloseProc, - qtiffSizeProc, - qtiffMapProc, - qtiffUnmapProc); - - if (tiff) { - uint32 width = 0; - uint32 height = 0; - TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width); - TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height); - imageSize = QSize(width, height); - } - device()->seek(pos); - if (imageSize.isValid()) - return imageSize; - } else if (option == CompressionRatio) { - return compression; - } else if (option == ImageFormat) { - return QImage::Format_ARGB32; - } - return QVariant(); -} - -void QTiffHandler::setOption(ImageOption option, const QVariant &value) -{ - if (option == CompressionRatio && value.type() == QVariant::Int) - compression = value.toInt(); -} - -bool QTiffHandler::supportsOption(ImageOption option) const -{ - return option == CompressionRatio - || option == Size - || option == ImageFormat; -} - -void QTiffHandler::convert32BitOrder(void *buffer, int width) -{ - uint32 *target = reinterpret_cast(buffer); - for (int32 x=0; x> 16) - | (p & 0x0000ff00) - | ((p & 0x000000ff) << 16); - } -} - -void QTiffHandler::convert32BitOrderBigEndian(void *buffer, int width) -{ - uint32 *target = reinterpret_cast(buffer); - for (int32 x=0; x> 24 - | (p & 0x00ff0000) << 8 - | (p & 0x0000ff00) << 8 - | (p & 0x000000ff) << 8; - } -} - -QT_END_NAMESPACE diff --git a/src/plugins/imageformats/tiff/qtiffhandler.h b/src/plugins/imageformats/tiff/qtiffhandler.h deleted file mode 100644 index 4534ed5..0000000 --- a/src/plugins/imageformats/tiff/qtiffhandler.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTIFFHANDLER_H -#define QTIFFHANDLER_H - -#include - -QT_BEGIN_NAMESPACE - -class QTiffHandler : public QImageIOHandler -{ -public: - QTiffHandler(); - - bool canRead() const; - bool read(QImage *image); - bool write(const QImage &image); - - QByteArray name() const; - - static bool canRead(QIODevice *device); - - QVariant option(ImageOption option) const; - void setOption(ImageOption option, const QVariant &value); - bool supportsOption(ImageOption option) const; - - enum Compression { - NoCompression = 0, - LzwCompression = 1 - }; -private: - void convert32BitOrder(void *buffer, int width); - void convert32BitOrderBigEndian(void *buffer, int width); - int compression; -}; - -QT_END_NAMESPACE - -#endif // QTIFFHANDLER_H diff --git a/src/plugins/imageformats/tiff/tiff.pro b/src/plugins/imageformats/tiff/tiff.pro index 49d635e..e781526 100644 --- a/src/plugins/imageformats/tiff/tiff.pro +++ b/src/plugins/imageformats/tiff/tiff.pro @@ -3,72 +3,8 @@ include(../../qpluginbase.pri) QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-tiff)" -HEADERS += qtiffhandler.h -SOURCES += main.cpp \ - qtiffhandler.cpp - -contains(QT_CONFIG, system-tiff) { - unix|win32-g++*:LIBS += -ltiff - win32:!win32-g++*:LIBS += libtiff.lib -} else { - INCLUDEPATH += ../../../3rdparty/libtiff/libtiff - SOURCES += \ - ../../../3rdparty/libtiff/libtiff/tif_aux.c \ - ../../../3rdparty/libtiff/libtiff/tif_close.c \ - ../../../3rdparty/libtiff/libtiff/tif_codec.c \ - ../../../3rdparty/libtiff/libtiff/tif_color.c \ - ../../../3rdparty/libtiff/libtiff/tif_compress.c \ - ../../../3rdparty/libtiff/libtiff/tif_dir.c \ - ../../../3rdparty/libtiff/libtiff/tif_dirinfo.c \ - ../../../3rdparty/libtiff/libtiff/tif_dirread.c \ - ../../../3rdparty/libtiff/libtiff/tif_dirwrite.c \ - ../../../3rdparty/libtiff/libtiff/tif_dumpmode.c \ - ../../../3rdparty/libtiff/libtiff/tif_error.c \ - ../../../3rdparty/libtiff/libtiff/tif_extension.c \ - ../../../3rdparty/libtiff/libtiff/tif_fax3.c \ - ../../../3rdparty/libtiff/libtiff/tif_fax3sm.c \ - ../../../3rdparty/libtiff/libtiff/tif_flush.c \ - ../../../3rdparty/libtiff/libtiff/tif_getimage.c \ - ../../../3rdparty/libtiff/libtiff/tif_luv.c \ - ../../../3rdparty/libtiff/libtiff/tif_lzw.c \ - ../../../3rdparty/libtiff/libtiff/tif_next.c \ - ../../../3rdparty/libtiff/libtiff/tif_open.c \ - ../../../3rdparty/libtiff/libtiff/tif_packbits.c \ - ../../../3rdparty/libtiff/libtiff/tif_pixarlog.c \ - ../../../3rdparty/libtiff/libtiff/tif_predict.c \ - ../../../3rdparty/libtiff/libtiff/tif_print.c \ - ../../../3rdparty/libtiff/libtiff/tif_read.c \ - ../../../3rdparty/libtiff/libtiff/tif_strip.c \ - ../../../3rdparty/libtiff/libtiff/tif_swab.c \ - ../../../3rdparty/libtiff/libtiff/tif_thunder.c \ - ../../../3rdparty/libtiff/libtiff/tif_tile.c \ - ../../../3rdparty/libtiff/libtiff/tif_version.c \ - ../../../3rdparty/libtiff/libtiff/tif_warning.c \ - ../../../3rdparty/libtiff/libtiff/tif_write.c \ - ../../../3rdparty/libtiff/libtiff/tif_zip.c - win32:!wince*: { - SOURCES += ../../../3rdparty/libtiff/libtiff/tif_win32.c - } - unix: { - SOURCES += ../../../3rdparty/libtiff/libtiff/tif_unix.c - } - wince*: { - SOURCES += ../../../corelib/kernel/qfunctions_wince.cpp \ - ../../../3rdparty/libtiff/libtiff/tif_wince.c \ - ../../../3rdparty/libtiff/libtiff/tif_win32.c - } - symbian: { - SOURCES += ../../../3rdparty/libtiff/port/lfind.c - } - - contains(QT_CONFIG, system-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib - } else { - INCLUDEPATH += ../../../3rdparty/zlib - } -} +include(../../../gui/image/qtiffhandler.pri) +SOURCES += main.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats target.path += $$[QT_INSTALL_PLUGINS]/imageformats diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index c3de09e..70668c0 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1751,7 +1751,7 @@ bool Configure::displayHelp() desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n"); desc("GIF", "no", "-no-gif", "Do not compile the plugin for GIF reading support."); - desc("GIF", "auto", "-qt-gif", "Compile the plugin for GIF reading support.\nSee also src/plugins/imageformats/gif/qgifhandler.h\n"); + desc("GIF", "auto", "-qt-gif", "Compile the plugin for GIF reading support.\nSee also src/gui/image/qgifhandler.h\n"); desc("LIBPNG", "no", "-no-libpng", "Do not compile in PNG support."); desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt."); -- cgit v0.12 From 802dc404d1af9a08fdc23ef32e2fbc77f138f70a Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Fri, 2 Jul 2010 18:30:33 +0200 Subject: Fix incomplete support for built-in jpeg, mng, tiff and gif handlers Previously, although the configure shell script could configure built-in support for these image formats, the .pr[io] files would nevertheless build them as plugins. Support was also missing from qimagereader and qimagewriter. This has now been added. Configure.exe, while clearly intended to support this too, needed a few minor fixes. For example, the usage of values "qt" and "yes" was inconsistent. For both configure tools, the explanation of the *non*-related options has been clarified, i.e: -no-libjpeg -qt-libjpeg -system-libjpeg These options have nothing to do with the plugin/built-in distinction. There are (still) no configure options for specifying "plugin" or "built-in" for these image formats. Quite reasonably, "plugin" is selected for shared Qt and "built-in" is selected for static Qt. Merge-request: 715 Reviewed-by: Oswald Buddenhagen --- configure | 16 +++---- src/gui/image/qimagereader.cpp | 76 +++++++++++++++++++++++++++++++ src/gui/image/qimagewriter.cpp | 40 ++++++++++++++++ src/plugins/imageformats/imageformats.pro | 8 ++-- src/winmain/winmain.pro | 1 - tools/configure/configureapp.cpp | 69 +++++++++++----------------- 6 files changed, 155 insertions(+), 55 deletions(-) diff --git a/configure b/configure index 7f998fc..f152dc0 100755 --- a/configure +++ b/configure @@ -1526,8 +1526,8 @@ while [ "$#" -gt 0 ]; do fi ;; gif) - [ "$VAL" = "qt" ] && VAL=yes - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + [ "$VAL" = "qt" ] && VAL=auto + if [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then CFG_GIF="$VAL" else UNKNOWN_OPT=yes @@ -3634,26 +3634,26 @@ Third Party Libraries: + -system-zlib ....... Use zlib from the operating system. See http://www.gzip.org/zlib - -no-gif ............ Do not compile the plugin for GIF reading support. - * -qt-gif ............ Compile the plugin for GIF reading support. + -no-gif ............ Do not compile GIF reading support. + * -qt-gif ............ Compile GIF reading support. See also src/gui/image/qgifhandler.h - -no-libtiff ........ Do not compile the plugin for TIFF support. + -no-libtiff ........ Do not compile TIFF support. -qt-libtiff ........ Use the libtiff bundled with Qt. + -system-libtiff .... Use libtiff from the operating system. See http://www.libtiff.org - -no-libpng ......... Do not compile in PNG support. + -no-libpng ......... Do not compile PNG support. -qt-libpng ......... Use the libpng bundled with Qt. + -system-libpng ..... Use libpng from the operating system. See http://www.libpng.org/pub/png - -no-libmng ......... Do not compile the plugin for MNG support. + -no-libmng ......... Do not compile MNG support. -qt-libmng ......... Use the libmng bundled with Qt. + -system-libmng ..... Use libmng from the operating system. See http://www.libmng.com - -no-libjpeg ........ Do not compile the plugin for JPEG support. + -no-libjpeg ........ Do not compile JPEG support. -qt-libjpeg ........ Use the libjpeg bundled with Qt. + -system-libjpeg .... Use libjpeg from the operating system. See http://www.ijg.org diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index af43e90..55c9341 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -141,6 +141,18 @@ #ifndef QT_NO_IMAGEFORMAT_PNG #include #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG +#include +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG +#include +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF +#include +#endif +#ifdef QT_BUILTIN_GIF_READER +#include +#endif QT_BEGIN_NAMESPACE @@ -153,6 +165,18 @@ enum _qt_BuiltInFormatType { #ifndef QT_NO_IMAGEFORMAT_PNG _qt_PngFormat, #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG + _qt_JpgFormat, +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG + _qt_MngFormat, +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF + _qt_TifFormat, +#endif +#ifdef QT_BUILTIN_GIF_READER + _qt_GifFormat, +#endif _qt_BmpFormat, #ifndef QT_NO_IMAGEFORMAT_PPM _qt_PpmFormat, @@ -179,6 +203,18 @@ static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = { #ifndef QT_NO_IMAGEFORMAT_PNG {_qt_PngFormat, "png"}, #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG + {_qt_JpgFormat, "jpg"}, +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG + {_qt_MngFormat, "mng"}, +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF + {_qt_TifFormat, "tif"}, +#endif +#ifdef QT_BUILTIN_GIF_READER + {_qt_GifFormat, "gif"}, +#endif {_qt_BmpFormat, "bmp"}, #ifndef QT_NO_IMAGEFORMAT_PPM {_qt_PpmFormat, "ppm"}, @@ -304,6 +340,22 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, } else if (testFormat == "png") { handler = new QPngHandler; #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG + } else if (testFormat == "jpg" || testFormat == "jpeg") { + handler = new QJpegHandler; +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG + } else if (testFormat == "mng") { + handler = new QMngHandler; +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF + } else if (testFormat == "tif" || testFormat == "tiff") { + handler = new QTiffHandler; +#endif +#ifdef QT_BUILTIN_GIF_READER + } else if (testFormat == "gif") { + handler = new QGifHandler; +#endif #ifndef QT_NO_IMAGEFORMAT_BMP } else if (testFormat == "bmp") { handler = new QBmpHandler; @@ -380,6 +432,30 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, handler = new QPngHandler; break; #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG + case _qt_JpgFormat: + if (QJpegHandler::canRead(device)) + handler = new QJpegHandler; + break; +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG + case _qt_MngFormat: + if (QMngHandler::canRead(device)) + handler = new QMngHandler; + break; +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF + case _qt_TifFormat: + if (QTiffHandler::canRead(device)) + handler = new QTiffHandler; + break; +#endif +#ifdef QT_BUILTIN_GIF_READER + case _qt_GifFormat: + if (QGifHandler::canRead(device)) + handler = new QGifHandler; + break; +#endif #ifndef QT_NO_IMAGEFORMAT_BMP case _qt_BmpFormat: if (QBmpHandler::canRead(device)) diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index 552729f..a46fc48 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -114,6 +114,18 @@ #ifndef QT_NO_IMAGEFORMAT_PNG #include #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG +#include +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG +#include +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF +#include +#endif +#ifdef QT_BUILTIN_GIF_READER +#include +#endif QT_BEGIN_NAMESPACE @@ -170,6 +182,22 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, } else if (testFormat == "png") { handler = new QPngHandler; #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG + } else if (testFormat == "jpg" || testFormat == "jpeg") { + handler = new QJpegHandler; +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG + } else if (testFormat == "mng") { + handler = new QMngHandler; +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF + } else if (testFormat == "tif" || testFormat == "tiff") { + handler = new QTiffHandler; +#endif +#ifdef QT_BUILTIN_GIF_READER + } else if (testFormat == "gif") { + handler = new QGifHandler; +#endif #ifndef QT_NO_IMAGEFORMAT_BMP } else if (testFormat == "bmp") { handler = new QBmpHandler; @@ -669,6 +697,18 @@ QList QImageWriter::supportedImageFormats() #ifndef QT_NO_IMAGEFORMAT_PNG formats << "png"; #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG + formats << "jpg" << "jpeg"; +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG + formats << "mng"; +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF + formats << "tif" << "tiff"; +#endif +#ifdef QT_BUILTIN_GIF_READER + formats << "gif"; +#endif #ifndef QT_NO_LIBRARY QFactoryLoader *l = loader(); diff --git a/src/plugins/imageformats/imageformats.pro b/src/plugins/imageformats/imageformats.pro index 2e4036b..5fff2de 100644 --- a/src/plugins/imageformats/imageformats.pro +++ b/src/plugins/imageformats/imageformats.pro @@ -1,8 +1,8 @@ TEMPLATE = subdirs -!contains(QT_CONFIG, no-jpeg):SUBDIRS += jpeg -!contains(QT_CONFIG, no-gif):SUBDIRS += gif -!contains(QT_CONFIG, no-mng):SUBDIRS += mng +!contains(QT_CONFIG, no-jpeg):!contains(QT_CONFIG, jpeg):SUBDIRS += jpeg +!contains(QT_CONFIG, no-gif):!contains(QT_CONFIG, gif):SUBDIRS += gif +!contains(QT_CONFIG, no-mng):!contains(QT_CONFIG, mng):SUBDIRS += mng contains(QT_CONFIG, svg):SUBDIRS += svg -!contains(QT_CONFIG, no-tiff):SUBDIRS += tiff +!contains(QT_CONFIG, no-tiff):!contains(QT_CONFIG, tiff):SUBDIRS += tiff !contains(QT_CONFIG, no-ico):SUBDIRS += ico diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro index 0c9b214..8c2710c 100644 --- a/src/winmain/winmain.pro +++ b/src/winmain/winmain.pro @@ -12,7 +12,6 @@ win32 { win32-borland:DEFINES += QT_NEEDS_QMAIN SOURCES = qtmain_win.cpp CONFIG += png - CONFIG -= jpeg INCLUDEPATH += tmp $$QMAKE_INCDIR_QT/QtCore } diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 70668c0..ae1af89 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -581,17 +581,13 @@ void Configure::parseCmdLine() // Image formats -------------------------------------------- else if (configCmdLine.at(i) == "-no-gif") dictionary[ "GIF" ] = "no"; - else if( configCmdLine.at(i) == "-qt-gif" ) - dictionary[ "GIF" ] = "auto"; else if (configCmdLine.at(i) == "-no-libtiff") { dictionary[ "TIFF"] = "no"; dictionary[ "LIBTIFF" ] = "no"; } else if (configCmdLine.at(i) == "-qt-libtiff") { - dictionary[ "TIFF" ] = "plugin"; dictionary[ "LIBTIFF" ] = "qt"; } else if (configCmdLine.at(i) == "-system-libtiff") { - dictionary[ "TIFF" ] = "plugin"; dictionary[ "LIBTIFF" ] = "system"; } @@ -599,10 +595,8 @@ void Configure::parseCmdLine() dictionary[ "JPEG" ] = "no"; dictionary[ "LIBJPEG" ] = "no"; } else if (configCmdLine.at(i) == "-qt-libjpeg") { - dictionary[ "JPEG" ] = "plugin"; dictionary[ "LIBJPEG" ] = "qt"; } else if (configCmdLine.at(i) == "-system-libjpeg") { - dictionary[ "JPEG" ] = "plugin"; dictionary[ "LIBJPEG" ] = "system"; } @@ -610,10 +604,8 @@ void Configure::parseCmdLine() dictionary[ "PNG" ] = "no"; dictionary[ "LIBPNG" ] = "no"; } else if (configCmdLine.at(i) == "-qt-libpng") { - dictionary[ "PNG" ] = "qt"; dictionary[ "LIBPNG" ] = "qt"; } else if (configCmdLine.at(i) == "-system-libpng") { - dictionary[ "PNG" ] = "qt"; dictionary[ "LIBPNG" ] = "system"; } @@ -621,10 +613,8 @@ void Configure::parseCmdLine() dictionary[ "MNG" ] = "no"; dictionary[ "LIBMNG" ] = "no"; } else if (configCmdLine.at(i) == "-qt-libmng") { - dictionary[ "MNG" ] = "qt"; dictionary[ "LIBMNG" ] = "qt"; } else if (configCmdLine.at(i) == "-system-libmng") { - dictionary[ "MNG" ] = "qt"; dictionary[ "LIBMNG" ] = "system"; } @@ -1750,22 +1740,22 @@ bool Configure::displayHelp() desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt."); desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n"); - desc("GIF", "no", "-no-gif", "Do not compile the plugin for GIF reading support."); - desc("GIF", "auto", "-qt-gif", "Compile the plugin for GIF reading support.\nSee also src/gui/image/qgifhandler.h\n"); + desc("GIF", "no", "-no-gif", "Do not compile GIF reading support."); + desc("GIF", "auto", "-qt-gif", "Compile GIF reading support.\nSee also src/gui/image/qgifhandler.h\n"); - desc("LIBPNG", "no", "-no-libpng", "Do not compile in PNG support."); + desc("LIBPNG", "no", "-no-libpng", "Do not compile PNG support."); desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt."); desc("LIBPNG", "system","-system-libpng", "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n"); - desc("LIBMNG", "no", "-no-libmng", "Do not compile in MNG support."); + desc("LIBMNG", "no", "-no-libmng", "Do not compile MNG support."); desc("LIBMNG", "qt", "-qt-libmng", "Use the libmng bundled with Qt."); desc("LIBMNG", "system","-system-libmng", "Use libmng from the operating system.\nSee See http://www.libmng.com\n"); - desc("LIBTIFF", "no", "-no-libtiff", "Do not compile the plugin for TIFF support."); + desc("LIBTIFF", "no", "-no-libtiff", "Do not compile TIFF support."); desc("LIBTIFF", "qt", "-qt-libtiff", "Use the libtiff bundled with Qt."); desc("LIBTIFF", "system","-system-libtiff", "Use libtiff from the operating system.\nSee http://www.libtiff.org\n"); - desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile the plugin for JPEG support."); + desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile JPEG support."); desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt."); desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n"); @@ -1957,21 +1947,28 @@ QString Configure::defaultTo(const QString &option) || option == "LIBTIFF") return "system"; - // We want PNG built-in + // PNG is always built-in, never a plugin if (option == "PNG") - return "qt"; + return "yes"; - // The JPEG image library can only be a plugin - if (option == "JPEG" - || option == "MNG" || option == "TIFF") - return "plugin"; - - // GIF off by default - if (option == "GIF") { - if (dictionary["SHARED"] == "yes") + // These database drivers and image formats can be built-in or plugins. + // Prefer plugins when Qt is shared. + if (dictionary[ "SHARED" ] == "yes") { + if (option == "SQL_MYSQL" + || option == "SQL_MYSQL" + || option == "SQL_ODBC" + || option == "SQL_OCI" + || option == "SQL_PSQL" + || option == "SQL_TDS" + || option == "SQL_DB2" + || option == "SQL_SQLITE" + || option == "SQL_SQLITE2" + || option == "SQL_IBASE" + || option == "JPEG" + || option == "MNG" + || option == "TIFF" + || option == "GIF") return "plugin"; - else - return "yes"; } // By default we do not want to compile OCI driver when compiling with @@ -1981,18 +1978,6 @@ QString Configure::defaultTo(const QString &option) && option == "SQL_OCI") return "no"; - if (option == "SQL_MYSQL" - || option == "SQL_MYSQL" - || option == "SQL_ODBC" - || option == "SQL_OCI" - || option == "SQL_PSQL" - || option == "SQL_TDS" - || option == "SQL_DB2" - || option == "SQL_SQLITE" - || option == "SQL_SQLITE2" - || option == "SQL_IBASE") - return "plugin"; - if (option == "SYNCQT" && (!QFile::exists(sourcePath + "/bin/syncqt") || !QFile::exists(sourcePath + "/bin/syncqt.bat"))) @@ -2469,14 +2454,14 @@ void Configure::generateOutputVars() if (dictionary[ "PNG" ] == "no") qtConfig += "no-png"; - else if( dictionary[ "PNG" ] == "qt" ) + else if (dictionary[ "PNG" ] == "yes") qtConfig += "png"; if (dictionary[ "LIBPNG" ] == "system") qtConfig += "system-png"; if (dictionary[ "MNG" ] == "no") qtConfig += "no-mng"; - else if( dictionary[ "MNG" ] == "qt" ) + else if (dictionary[ "MNG" ] == "yes") qtConfig += "mng"; if (dictionary[ "LIBMNG" ] == "system") qtConfig += "system-mng"; -- cgit v0.12 From 3f8a7df075f09c52f0684bbbe9a6214dde8df4ed Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Fri, 2 Jul 2010 18:30:34 +0200 Subject: Fixed whitespace formatting Merge-request: 715 Reviewed-by: Oswald Buddenhagen --- src/network/access/access.pri | 112 +++++++++++++++++++++--------------------- 1 file changed, 57 insertions(+), 55 deletions(-) diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 173a087..f7f6b5c 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -1,61 +1,63 @@ # Qt network access module -HEADERS += access/qftp.h \ - access/qhttp.h \ - access/qhttpnetworkheader_p.h \ - access/qhttpnetworkrequest_p.h \ - access/qhttpnetworkreply_p.h \ - access/qhttpnetworkconnection_p.h \ - access/qhttpnetworkconnectionchannel_p.h \ - access/qfilenetworkreply_p.h \ - access/qnetworkaccessmanager.h \ - access/qnetworkaccessmanager_p.h \ - access/qnetworkaccesscache_p.h \ - access/qnetworkaccessbackend_p.h \ - access/qnetworkaccessdatabackend_p.h \ - access/qnetworkaccessdebugpipebackend_p.h \ - access/qnetworkaccesshttpbackend_p.h \ - access/qnetworkaccessfilebackend_p.h \ - access/qnetworkaccesscachebackend_p.h \ - access/qnetworkaccessftpbackend_p.h \ - access/qnetworkcookie.h \ - access/qnetworkcookie_p.h \ - access/qnetworkcookiejar.h \ - access/qnetworkcookiejar_p.h \ - access/qnetworkrequest.h \ - access/qnetworkrequest_p.h \ - access/qnetworkreply.h \ - access/qnetworkreply_p.h \ - access/qnetworkreplyimpl_p.h \ - access/qabstractnetworkcache_p.h \ - access/qabstractnetworkcache.h \ - access/qnetworkdiskcache_p.h \ - access/qnetworkdiskcache.h +HEADERS += \ + access/qftp.h \ + access/qhttp.h \ + access/qhttpnetworkheader_p.h \ + access/qhttpnetworkrequest_p.h \ + access/qhttpnetworkreply_p.h \ + access/qhttpnetworkconnection_p.h \ + access/qhttpnetworkconnectionchannel_p.h \ + access/qfilenetworkreply_p.h \ + access/qnetworkaccessmanager.h \ + access/qnetworkaccessmanager_p.h \ + access/qnetworkaccesscache_p.h \ + access/qnetworkaccessbackend_p.h \ + access/qnetworkaccessdatabackend_p.h \ + access/qnetworkaccessdebugpipebackend_p.h \ + access/qnetworkaccesshttpbackend_p.h \ + access/qnetworkaccessfilebackend_p.h \ + access/qnetworkaccesscachebackend_p.h \ + access/qnetworkaccessftpbackend_p.h \ + access/qnetworkcookie.h \ + access/qnetworkcookie_p.h \ + access/qnetworkcookiejar.h \ + access/qnetworkcookiejar_p.h \ + access/qnetworkrequest.h \ + access/qnetworkrequest_p.h \ + access/qnetworkreply.h \ + access/qnetworkreply_p.h \ + access/qnetworkreplyimpl_p.h \ + access/qabstractnetworkcache_p.h \ + access/qabstractnetworkcache.h \ + access/qnetworkdiskcache_p.h \ + access/qnetworkdiskcache.h -SOURCES += access/qftp.cpp \ - access/qhttp.cpp \ - access/qhttpnetworkheader.cpp \ - access/qhttpnetworkrequest.cpp \ - access/qhttpnetworkreply.cpp \ - access/qhttpnetworkconnection.cpp \ - access/qhttpnetworkconnectionchannel.cpp \ - access/qfilenetworkreply.cpp \ - access/qnetworkaccessmanager.cpp \ - access/qnetworkaccesscache.cpp \ - access/qnetworkaccessbackend.cpp \ - access/qnetworkaccessdatabackend.cpp \ - access/qnetworkaccessdebugpipebackend.cpp \ - access/qnetworkaccessfilebackend.cpp \ - access/qnetworkaccesscachebackend.cpp \ - access/qnetworkaccessftpbackend.cpp \ - access/qnetworkaccesshttpbackend.cpp \ - access/qnetworkcookie.cpp \ - access/qnetworkcookiejar.cpp \ - access/qnetworkrequest.cpp \ - access/qnetworkreply.cpp \ - access/qnetworkreplyimpl.cpp \ - access/qabstractnetworkcache.cpp \ - access/qnetworkdiskcache.cpp +SOURCES += \ + access/qftp.cpp \ + access/qhttp.cpp \ + access/qhttpnetworkheader.cpp \ + access/qhttpnetworkrequest.cpp \ + access/qhttpnetworkreply.cpp \ + access/qhttpnetworkconnection.cpp \ + access/qhttpnetworkconnectionchannel.cpp \ + access/qfilenetworkreply.cpp \ + access/qnetworkaccessmanager.cpp \ + access/qnetworkaccesscache.cpp \ + access/qnetworkaccessbackend.cpp \ + access/qnetworkaccessdatabackend.cpp \ + access/qnetworkaccessdebugpipebackend.cpp \ + access/qnetworkaccessfilebackend.cpp \ + access/qnetworkaccesscachebackend.cpp \ + access/qnetworkaccessftpbackend.cpp \ + access/qnetworkaccesshttpbackend.cpp \ + access/qnetworkcookie.cpp \ + access/qnetworkcookiejar.cpp \ + access/qnetworkrequest.cpp \ + access/qnetworkreply.cpp \ + access/qnetworkreplyimpl.cpp \ + access/qabstractnetworkcache.cpp \ + access/qnetworkdiskcache.cpp #zlib support contains(QT_CONFIG, zlib) { -- cgit v0.12 From eaf757a5c449e115ced427a0129fb2209fd09e29 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Fri, 2 Jul 2010 18:30:35 +0200 Subject: Consolidate zlib configuration redundancy Merge-request: 715 Reviewed-by: Oswald Buddenhagen --- src/3rdparty/zlib.pri | 14 ++++++++++++++ src/corelib/tools/tools.pri | 23 ++--------------------- src/gui/painting/painting.pri | 9 +-------- src/network/access/access.pri | 9 +-------- src/svg/svg.pro | 9 +-------- src/tools/bootstrap/bootstrap.pro | 21 ++------------------- 6 files changed, 21 insertions(+), 64 deletions(-) create mode 100644 src/3rdparty/zlib.pri diff --git a/src/3rdparty/zlib.pri b/src/3rdparty/zlib.pri new file mode 100644 index 0000000..bae3221 --- /dev/null +++ b/src/3rdparty/zlib.pri @@ -0,0 +1,14 @@ +wince*: DEFINES += NO_ERRNO_H +INCLUDEPATH += $$PWD/zlib +SOURCES+= \ + $$PWD/zlib/adler32.c \ + $$PWD/zlib/compress.c \ + $$PWD/zlib/crc32.c \ + $$PWD/zlib/deflate.c \ + $$PWD/zlib/gzio.c \ + $$PWD/zlib/inffast.c \ + $$PWD/zlib/inflate.c \ + $$PWD/zlib/inftrees.c \ + $$PWD/zlib/trees.c \ + $$PWD/zlib/uncompr.c \ + $$PWD/zlib/zutil.c diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index e579dd5..d81ab04 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -89,27 +89,8 @@ else:unix:SOURCES += tools/qelapsedtimer_unix.cpp else:win32:SOURCES += tools/qelapsedtimer_win.cpp else:SOURCES += tools/qelapsedtimer_generic.cpp -#zlib support -contains(QT_CONFIG, zlib) { - wince*: DEFINES += NO_ERRNO_H - INCLUDEPATH += ../3rdparty/zlib - SOURCES+= \ - ../3rdparty/zlib/adler32.c \ - ../3rdparty/zlib/compress.c \ - ../3rdparty/zlib/crc32.c \ - ../3rdparty/zlib/deflate.c \ - ../3rdparty/zlib/gzio.c \ - ../3rdparty/zlib/inffast.c \ - ../3rdparty/zlib/inflate.c \ - ../3rdparty/zlib/inftrees.c \ - ../3rdparty/zlib/trees.c \ - ../3rdparty/zlib/uncompr.c \ - ../3rdparty/zlib/zutil.c -} else:!contains(QT_CONFIG, no-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} +contains(QT_CONFIG, zlib):include($$PWD/../../3rdparty/zlib.pri) +else:include($$PWD/../../3rdparty/zlib_dependency.pri) DEFINES += HB_EXPORT=Q_CORE_EXPORT INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index a5cfb84..07aabc9 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -402,11 +402,4 @@ neon:*-g++* { QMAKE_EXTRA_COMPILERS += neon_compiler } -contains(QT_CONFIG, zlib) { - INCLUDEPATH += ../3rdparty/zlib -} else:!contains(QT_CONFIG, no-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} - +include($$PWD/../../3rdparty/zlib_dependency.pri) diff --git a/src/network/access/access.pri b/src/network/access/access.pri index f7f6b5c..6a0cd32 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -59,11 +59,4 @@ SOURCES += \ access/qabstractnetworkcache.cpp \ access/qnetworkdiskcache.cpp -#zlib support -contains(QT_CONFIG, zlib) { - INCLUDEPATH += ../3rdparty/zlib -} else:!contains(QT_CONFIG, no-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} +include($$PWD/../../3rdparty/zlib_dependency.pri) diff --git a/src/svg/svg.pro b/src/svg/svg.pro index de4bba6..7b5251a 100644 --- a/src/svg/svg.pro +++ b/src/svg/svg.pro @@ -42,11 +42,4 @@ INCLUDEPATH += ../3rdparty/harfbuzz/src symbian:TARGET.UID3=0x2001B2E2 -#zlib support -contains(QT_CONFIG, zlib) { - INCLUDEPATH += ../3rdparty/zlib -} else:!contains(QT_CONFIG, no-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} +include(../3rdparty/zlib_dependency.pri) diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 149291a..a74c9c1 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -95,25 +95,8 @@ macx: { LIBS += -framework CoreServices } -contains(QT_CONFIG, zlib)|cross_compile { - INCLUDEPATH += ../../3rdparty/zlib - SOURCES+= \ - ../3rdparty/zlib/adler32.c \ - ../3rdparty/zlib/compress.c \ - ../3rdparty/zlib/crc32.c \ - ../3rdparty/zlib/deflate.c \ - ../3rdparty/zlib/gzio.c \ - ../3rdparty/zlib/inffast.c \ - ../3rdparty/zlib/inflate.c \ - ../3rdparty/zlib/inftrees.c \ - ../3rdparty/zlib/trees.c \ - ../3rdparty/zlib/uncompr.c \ - ../3rdparty/zlib/zutil.c -} else:!contains(QT_CONFIG, no-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} +if(contains(QT_CONFIG, zlib)|cross_compile):include(../../3rdparty/zlib.pri) +else:include(../../3rdparty/zlib_dependency.pri) lib.CONFIG = dummy_install INSTALLS += lib -- cgit v0.12 From 428cc105630fbec3fa9010cde347d2e1cd35eb49 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Sat, 3 Jul 2010 13:07:41 +0200 Subject: Fix Windows build Set the QT_NO_IMAGEFORMAT_* defines like the unix configure does. This avoids that we try to link the image handlers into QtGui when they are built as plugins. Reviewed-by: ossi --- tools/configure/configureapp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index ae1af89..952d4e0 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3033,10 +3033,10 @@ void Configure::generateConfigfiles() if (dictionary["STYLE_GTK"] != "yes") qconfigList += "QT_NO_STYLE_GTK"; if (dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1"; - if (dictionary["PNG"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_PNG"; - if (dictionary["MNG"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_MNG"; - if (dictionary["JPEG"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_JPEG"; - if (dictionary["TIFF"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_TIFF"; + if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG"; + if (dictionary["MNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_MNG"; + if (dictionary["JPEG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_JPEG"; + if (dictionary["TIFF"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_TIFF"; if (dictionary["ZLIB"] == "no") { qconfigList += "QT_NO_ZLIB"; qconfigList += "QT_NO_COMPRESS"; -- cgit v0.12 From f5ac9d719ac88499b2096718d31203b4ef227b9f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 3 Jul 2010 14:26:36 +0200 Subject: s/INCPATH/INCLUDEPATH/ --- tools/configure/configure.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index 64a6d9a..73f3317 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -23,7 +23,8 @@ win32-msvc* { PRECOMPILED_HEADER = configure_pch.h -INCPATH += $$QT_SOURCE_TREE/src/corelib/arch/generic \ +INCLUDEPATH += \ + $$QT_SOURCE_TREE/src/corelib/arch/generic \ $$QT_SOURCE_TREE/src/corelib/global \ $$QT_BUILD_TREE/include \ $$QT_BUILD_TREE/include/QtCore \ -- cgit v0.12 From 58078604455cc7a529d82e68adec77a880cbcbf7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 3 Jul 2010 14:27:09 +0200 Subject: rebuild configure --- configure.exe | Bin 1317888 -> 1318912 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/configure.exe b/configure.exe index 1fddc81..6817331 100755 Binary files a/configure.exe and b/configure.exe differ -- cgit v0.12 From 654f33a214508241dfc44168c359e46a55982110 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 1 Jul 2010 13:36:55 +0200 Subject: doc improvements --- src/corelib/io/qprocess.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index b5e7a97..8eba2b0 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1856,7 +1856,7 @@ QByteArray QProcess::readAllStandardError() } /*! - Starts the program \a program in a new process, if one is not already + Starts the given \a program in a new process, if none is already running, passing the command line arguments in \a arguments. The OpenMode is set to \a mode. @@ -1866,14 +1866,13 @@ QByteArray QProcess::readAllStandardError() process, a warning may be printed at the console, and the existing process will continue running. - \note Arguments that contain spaces are not passed to the - process as separate arguments. - \note Processes are started asynchronously, which means the started() and error() signals may be delayed. Call waitForStarted() to make sure the process has started (or has failed to start) and those signals have been emitted. + \note No further splitting of the arguments is performed. + \bold{Windows:} Arguments that contain spaces are wrapped in quotes. \sa pid(), started(), waitForStarted() @@ -2079,7 +2078,7 @@ QProcess::ExitStatus QProcess::exitStatus() const code of the process. Any data the new process writes to the console is forwarded to the calling process. - The environment and working directory are inherited by the calling + The environment and working directory are inherited from the calling process. On Windows, arguments that contain spaces are wrapped in quotes. -- cgit v0.12 From 306db146152c7b01b86fa7588be9941c47daead3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 4 Jul 2010 00:06:40 +0200 Subject: fix symbian build as absolutely braindead as it is, symbian is a unix as far as qmake is concerned. --- src/3rdparty/libtiff.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/libtiff.pri b/src/3rdparty/libtiff.pri index 5a522be..e43e1fe 100644 --- a/src/3rdparty/libtiff.pri +++ b/src/3rdparty/libtiff.pri @@ -37,7 +37,7 @@ SOURCES += \ wince*: SOURCES += $$PWD/../corelib/kernel/qfunctions_wince.cpp \ $$PWD/libtiff/libtiff/tif_wince.c win32: SOURCES += $$PWD/libtiff/libtiff/tif_win32.c -else:unix: SOURCES += $$PWD/libtiff/libtiff/tif_unix.c -else:symbian: SOURCES += $$PWD/libtiff/port/lfind.c +else: SOURCES += $$PWD/libtiff/libtiff/tif_unix.c +symbian: SOURCES += $$PWD/libtiff/port/lfind.c include($$PWD/zlib_dependency.pri) -- cgit v0.12 From 4cdd831191a22604486fa895c57532f319a56b96 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 4 Jul 2010 11:24:25 +0200 Subject: make image handler includes private now that they live in gui/image/ instead of plugins/imageformats/, the handlers need to get the usual _p suffix. --- src/gui/image/qgifhandler.cpp | 2 +- src/gui/image/qgifhandler.h | 96 ---------------------------------- src/gui/image/qgifhandler.pri | 2 +- src/gui/image/qgifhandler_p.h | 96 ++++++++++++++++++++++++++++++++++ src/gui/image/qimagereader.cpp | 8 +-- src/gui/image/qimagewriter.cpp | 8 +-- src/gui/image/qjpeghandler.cpp | 2 +- src/gui/image/qjpeghandler.h | 76 --------------------------- src/gui/image/qjpeghandler.pri | 2 +- src/gui/image/qjpeghandler_p.h | 76 +++++++++++++++++++++++++++ src/gui/image/qmnghandler.cpp | 2 +- src/gui/image/qmnghandler.h | 83 ----------------------------- src/gui/image/qmnghandler.pri | 2 +- src/gui/image/qmnghandler_p.h | 83 +++++++++++++++++++++++++++++ src/gui/image/qtiffhandler.cpp | 2 +- src/gui/image/qtiffhandler.h | 78 --------------------------- src/gui/image/qtiffhandler.pri | 2 +- src/gui/image/qtiffhandler_p.h | 78 +++++++++++++++++++++++++++ src/plugins/imageformats/gif/main.cpp | 2 +- src/plugins/imageformats/jpeg/main.cpp | 2 +- src/plugins/imageformats/mng/main.cpp | 2 +- src/plugins/imageformats/tiff/main.cpp | 2 +- 22 files changed, 353 insertions(+), 353 deletions(-) delete mode 100644 src/gui/image/qgifhandler.h create mode 100644 src/gui/image/qgifhandler_p.h delete mode 100644 src/gui/image/qjpeghandler.h create mode 100644 src/gui/image/qjpeghandler_p.h delete mode 100644 src/gui/image/qmnghandler.h create mode 100644 src/gui/image/qmnghandler_p.h delete mode 100644 src/gui/image/qtiffhandler.h create mode 100644 src/gui/image/qtiffhandler_p.h diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp index 129a11b..124d27b 100644 --- a/src/gui/image/qgifhandler.cpp +++ b/src/gui/image/qgifhandler.cpp @@ -44,7 +44,7 @@ ** ****************************************************************************/ -#include "qgifhandler.h" +#include "qgifhandler_p.h" #include #include diff --git a/src/gui/image/qgifhandler.h b/src/gui/image/qgifhandler.h deleted file mode 100644 index 8e07aff..0000000 --- a/src/gui/image/qgifhandler.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -** WARNING: -** A separate license from Unisys may be required to use the gif -** reader. See http://www.unisys.com/about__unisys/lzw/ -** for information from Unisys -** -****************************************************************************/ - -#ifndef QGIFHANDLER_H -#define QGIFHANDLER_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QGIFFormat; -class QGifHandler : public QImageIOHandler -{ -public: - QGifHandler(); - ~QGifHandler(); - - bool canRead() const; - bool read(QImage *image); - bool write(const QImage &image); - - QByteArray name() const; - - static bool canRead(QIODevice *device); - - QVariant option(ImageOption option) const; - void setOption(ImageOption option, const QVariant &value); - bool supportsOption(ImageOption option) const; - - int imageCount() const; - int loopCount() const; - int nextImageDelay() const; - int currentImageNumber() const; - -private: - bool imageIsComing() const; - QGIFFormat *gifFormat; - QString fileName; - mutable QByteArray buffer; - mutable QImage lastImage; - - mutable int nextDelay; - mutable int loopCnt; - int frameNumber; - mutable QVector imageSizes; - mutable bool scanIsCached; -}; - -QT_END_NAMESPACE - -#endif // QGIFHANDLER_H diff --git a/src/gui/image/qgifhandler.pri b/src/gui/image/qgifhandler.pri index 003476a..6eb0751 100644 --- a/src/gui/image/qgifhandler.pri +++ b/src/gui/image/qgifhandler.pri @@ -1,4 +1,4 @@ # common to plugin and built-in forms INCLUDEPATH *= $$PWD -HEADERS += $$PWD/qgifhandler.h +HEADERS += $$PWD/qgifhandler_p.h SOURCES += $$PWD/qgifhandler.cpp diff --git a/src/gui/image/qgifhandler_p.h b/src/gui/image/qgifhandler_p.h new file mode 100644 index 0000000..b2a9725 --- /dev/null +++ b/src/gui/image/qgifhandler_p.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +** WARNING: +** A separate license from Unisys may be required to use the gif +** reader. See http://www.unisys.com/about__unisys/lzw/ +** for information from Unisys +** +****************************************************************************/ + +#ifndef QGIFHANDLER_P_H +#define QGIFHANDLER_P_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QGIFFormat; +class QGifHandler : public QImageIOHandler +{ +public: + QGifHandler(); + ~QGifHandler(); + + bool canRead() const; + bool read(QImage *image); + bool write(const QImage &image); + + QByteArray name() const; + + static bool canRead(QIODevice *device); + + QVariant option(ImageOption option) const; + void setOption(ImageOption option, const QVariant &value); + bool supportsOption(ImageOption option) const; + + int imageCount() const; + int loopCount() const; + int nextImageDelay() const; + int currentImageNumber() const; + +private: + bool imageIsComing() const; + QGIFFormat *gifFormat; + QString fileName; + mutable QByteArray buffer; + mutable QImage lastImage; + + mutable int nextDelay; + mutable int loopCnt; + int frameNumber; + mutable QVector imageSizes; + mutable bool scanIsCached; +}; + +QT_END_NAMESPACE + +#endif // QGIFHANDLER_P_H diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 55c9341..ec56af2 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -142,16 +142,16 @@ #include #endif #ifndef QT_NO_IMAGEFORMAT_JPEG -#include +#include #endif #ifndef QT_NO_IMAGEFORMAT_MNG -#include +#include #endif #ifndef QT_NO_IMAGEFORMAT_TIFF -#include +#include #endif #ifdef QT_BUILTIN_GIF_READER -#include +#include #endif QT_BEGIN_NAMESPACE diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index a46fc48..b995914 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -115,16 +115,16 @@ #include #endif #ifndef QT_NO_IMAGEFORMAT_JPEG -#include +#include #endif #ifndef QT_NO_IMAGEFORMAT_MNG -#include +#include #endif #ifndef QT_NO_IMAGEFORMAT_TIFF -#include +#include #endif #ifdef QT_BUILTIN_GIF_READER -#include +#include #endif QT_BEGIN_NAMESPACE diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp index 60e7cce..972dd65 100644 --- a/src/gui/image/qjpeghandler.cpp +++ b/src/gui/image/qjpeghandler.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qjpeghandler.h" +#include "qjpeghandler_p.h" #include #include diff --git a/src/gui/image/qjpeghandler.h b/src/gui/image/qjpeghandler.h deleted file mode 100644 index c879f21..0000000 --- a/src/gui/image/qjpeghandler.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QJPEGHANDLER_H -#define QJPEGHANDLER_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QJpegHandlerPrivate; -class QJpegHandler : public QImageIOHandler -{ -public: - QJpegHandler(); - ~QJpegHandler(); - - bool canRead() const; - bool read(QImage *image); - bool write(const QImage &image); - - QByteArray name() const; - - static bool canRead(QIODevice *device); - - QVariant option(ImageOption option) const; - void setOption(ImageOption option, const QVariant &value); - bool supportsOption(ImageOption option) const; - -private: - QJpegHandlerPrivate *d; -}; - -QT_END_NAMESPACE - -#endif // QJPEGHANDLER_H diff --git a/src/gui/image/qjpeghandler.pri b/src/gui/image/qjpeghandler.pri index 28ec7dc..3cb35c9 100644 --- a/src/gui/image/qjpeghandler.pri +++ b/src/gui/image/qjpeghandler.pri @@ -1,6 +1,6 @@ # common to plugin and built-in forms INCLUDEPATH *= $$PWD -HEADERS += $$PWD/qjpeghandler.h +HEADERS += $$PWD/qjpeghandler_p.h SOURCES += $$PWD/qjpeghandler.cpp contains(QT_CONFIG, system-jpeg) { if(unix|win32-g++*): LIBS += -ljpeg diff --git a/src/gui/image/qjpeghandler_p.h b/src/gui/image/qjpeghandler_p.h new file mode 100644 index 0000000..5320a5e --- /dev/null +++ b/src/gui/image/qjpeghandler_p.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QJPEGHANDLER_P_H +#define QJPEGHANDLER_P_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QJpegHandlerPrivate; +class QJpegHandler : public QImageIOHandler +{ +public: + QJpegHandler(); + ~QJpegHandler(); + + bool canRead() const; + bool read(QImage *image); + bool write(const QImage &image); + + QByteArray name() const; + + static bool canRead(QIODevice *device); + + QVariant option(ImageOption option) const; + void setOption(ImageOption option, const QVariant &value); + bool supportsOption(ImageOption option) const; + +private: + QJpegHandlerPrivate *d; +}; + +QT_END_NAMESPACE + +#endif // QJPEGHANDLER_P_H diff --git a/src/gui/image/qmnghandler.cpp b/src/gui/image/qmnghandler.cpp index ec442a1..cf53af0 100644 --- a/src/gui/image/qmnghandler.cpp +++ b/src/gui/image/qmnghandler.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmnghandler.h" +#include "qmnghandler_p.h" #include "qimage.h" #include "qvariant.h" diff --git a/src/gui/image/qmnghandler.h b/src/gui/image/qmnghandler.h deleted file mode 100644 index 65243be..0000000 --- a/src/gui/image/qmnghandler.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMNGHANDLER_H -#define QMNGHANDLER_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QImage; -class QByteArray; -class QIODevice; -class QVariant; -class QMngHandlerPrivate; - -class QMngHandler : public QImageIOHandler -{ - public: - QMngHandler(); - ~QMngHandler(); - virtual bool canRead() const; - virtual QByteArray name() const; - virtual bool read(QImage *image); - virtual bool write(const QImage &image); - virtual int currentImageNumber() const; - virtual int imageCount() const; - virtual bool jumpToImage(int imageNumber); - virtual bool jumpToNextImage(); - virtual int loopCount() const; - virtual int nextImageDelay() const; - static bool canRead(QIODevice *device); - virtual QVariant option(ImageOption option) const; - virtual void setOption(ImageOption option, const QVariant & value); - virtual bool supportsOption(ImageOption option) const; - - private: - Q_DECLARE_PRIVATE(QMngHandler) - QScopedPointer d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QMNGHANDLER_H diff --git a/src/gui/image/qmnghandler.pri b/src/gui/image/qmnghandler.pri index ec1c19e..ffb98de 100644 --- a/src/gui/image/qmnghandler.pri +++ b/src/gui/image/qmnghandler.pri @@ -1,6 +1,6 @@ # common to plugin and built-in forms INCLUDEPATH *= $$PWD -HEADERS += $$PWD/qmnghandler.h +HEADERS += $$PWD/qmnghandler_p.h SOURCES += $$PWD/qmnghandler.cpp contains(QT_CONFIG, system-mng) { if(unix|win32-g++*):LIBS += -lmng diff --git a/src/gui/image/qmnghandler_p.h b/src/gui/image/qmnghandler_p.h new file mode 100644 index 0000000..c39d0a6 --- /dev/null +++ b/src/gui/image/qmnghandler_p.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMNGHANDLER_P_H +#define QMNGHANDLER_P_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QImage; +class QByteArray; +class QIODevice; +class QVariant; +class QMngHandlerPrivate; + +class QMngHandler : public QImageIOHandler +{ + public: + QMngHandler(); + ~QMngHandler(); + virtual bool canRead() const; + virtual QByteArray name() const; + virtual bool read(QImage *image); + virtual bool write(const QImage &image); + virtual int currentImageNumber() const; + virtual int imageCount() const; + virtual bool jumpToImage(int imageNumber); + virtual bool jumpToNextImage(); + virtual int loopCount() const; + virtual int nextImageDelay() const; + static bool canRead(QIODevice *device); + virtual QVariant option(ImageOption option) const; + virtual void setOption(ImageOption option, const QVariant & value); + virtual bool supportsOption(ImageOption option) const; + + private: + Q_DECLARE_PRIVATE(QMngHandler) + QScopedPointer d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QMNGHANDLER_P_H diff --git a/src/gui/image/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp index 619aa4e..de4f680 100644 --- a/src/gui/image/qtiffhandler.cpp +++ b/src/gui/image/qtiffhandler.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qtiffhandler.h" +#include "qtiffhandler_p.h" #include #include #include diff --git a/src/gui/image/qtiffhandler.h b/src/gui/image/qtiffhandler.h deleted file mode 100644 index 4534ed5..0000000 --- a/src/gui/image/qtiffhandler.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTIFFHANDLER_H -#define QTIFFHANDLER_H - -#include - -QT_BEGIN_NAMESPACE - -class QTiffHandler : public QImageIOHandler -{ -public: - QTiffHandler(); - - bool canRead() const; - bool read(QImage *image); - bool write(const QImage &image); - - QByteArray name() const; - - static bool canRead(QIODevice *device); - - QVariant option(ImageOption option) const; - void setOption(ImageOption option, const QVariant &value); - bool supportsOption(ImageOption option) const; - - enum Compression { - NoCompression = 0, - LzwCompression = 1 - }; -private: - void convert32BitOrder(void *buffer, int width); - void convert32BitOrderBigEndian(void *buffer, int width); - int compression; -}; - -QT_END_NAMESPACE - -#endif // QTIFFHANDLER_H diff --git a/src/gui/image/qtiffhandler.pri b/src/gui/image/qtiffhandler.pri index 8ac70d9..e1cc3ee 100644 --- a/src/gui/image/qtiffhandler.pri +++ b/src/gui/image/qtiffhandler.pri @@ -1,6 +1,6 @@ # common to plugin and built-in forms INCLUDEPATH *= $$PWD -HEADERS += $$PWD/qtiffhandler.h +HEADERS += $$PWD/qtiffhandler_p.h SOURCES += $$PWD/qtiffhandler.cpp contains(QT_CONFIG, system-tiff) { if(unix|win32-g++*):LIBS += -ltiff diff --git a/src/gui/image/qtiffhandler_p.h b/src/gui/image/qtiffhandler_p.h new file mode 100644 index 0000000..da7d7ed --- /dev/null +++ b/src/gui/image/qtiffhandler_p.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTIFFHANDLER_P_H +#define QTIFFHANDLER_P_H + +#include + +QT_BEGIN_NAMESPACE + +class QTiffHandler : public QImageIOHandler +{ +public: + QTiffHandler(); + + bool canRead() const; + bool read(QImage *image); + bool write(const QImage &image); + + QByteArray name() const; + + static bool canRead(QIODevice *device); + + QVariant option(ImageOption option) const; + void setOption(ImageOption option, const QVariant &value); + bool supportsOption(ImageOption option) const; + + enum Compression { + NoCompression = 0, + LzwCompression = 1 + }; +private: + void convert32BitOrder(void *buffer, int width); + void convert32BitOrderBigEndian(void *buffer, int width); + int compression; +}; + +QT_END_NAMESPACE + +#endif // QTIFFHANDLER_P_H diff --git a/src/plugins/imageformats/gif/main.cpp b/src/plugins/imageformats/gif/main.cpp index 3bb0bf4..99a9528 100644 --- a/src/plugins/imageformats/gif/main.cpp +++ b/src/plugins/imageformats/gif/main.cpp @@ -47,7 +47,7 @@ #ifdef QT_NO_IMAGEFORMAT_GIF #undef QT_NO_IMAGEFORMAT_GIF #endif -#include "qgifhandler.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/imageformats/jpeg/main.cpp b/src/plugins/imageformats/jpeg/main.cpp index 2a45cb0..8eb3f03 100644 --- a/src/plugins/imageformats/jpeg/main.cpp +++ b/src/plugins/imageformats/jpeg/main.cpp @@ -47,7 +47,7 @@ #ifdef QT_NO_IMAGEFORMAT_JPEG #undef QT_NO_IMAGEFORMAT_JPEG #endif -#include "qjpeghandler.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/imageformats/mng/main.cpp b/src/plugins/imageformats/mng/main.cpp index 84f085c..dd62ba5 100644 --- a/src/plugins/imageformats/mng/main.cpp +++ b/src/plugins/imageformats/mng/main.cpp @@ -47,7 +47,7 @@ #ifdef QT_NO_IMAGEFORMAT_MNG #undef QT_NO_IMAGEFORMAT_MNG #endif -#include "qmnghandler.h" +#include #include #include diff --git a/src/plugins/imageformats/tiff/main.cpp b/src/plugins/imageformats/tiff/main.cpp index fbcbd72..c022abe 100644 --- a/src/plugins/imageformats/tiff/main.cpp +++ b/src/plugins/imageformats/tiff/main.cpp @@ -47,7 +47,7 @@ #ifdef QT_NO_IMAGEFORMAT_TIFF #undef QT_NO_IMAGEFORMAT_TIFF #endif -#include "qtiffhandler.h" +#include QT_BEGIN_NAMESPACE -- cgit v0.12 From f3c12fedad6b9dd1917c329059b4c05175c03130 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 2 Jul 2010 12:51:13 +1000 Subject: Optimize QDeclarativeStyledText. Don't set the base font, as this is an expensive operation. The base font will automatically be merged in by the text engine. --- src/declarative/util/qdeclarativestyledtext.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/declarative/util/qdeclarativestyledtext.cpp b/src/declarative/util/qdeclarativestyledtext.cpp index babd71b..9b4955e 100644 --- a/src/declarative/util/qdeclarativestyledtext.cpp +++ b/src/declarative/util/qdeclarativestyledtext.cpp @@ -152,8 +152,6 @@ void QDeclarativeStyledTextPrivate::parse() QTextCharFormat format; if (formatStack.count()) format = formatStack.top(); - else - format.setFont(baseFont); if (parseTag(ch, text, drawText, format)) formatStack.push(format); } -- cgit v0.12 From 0085cfa78a712a7afbbbeb90a3d1149328b4d2fd Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 5 Jul 2010 10:14:00 +1000 Subject: Add styled text layout benchmark. --- tests/benchmarks/gui/text/qtext/main.cpp | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/benchmarks/gui/text/qtext/main.cpp b/tests/benchmarks/gui/text/qtext/main.cpp index eaa23e9..63daae0 100644 --- a/tests/benchmarks/gui/text/qtext/main.cpp +++ b/tests/benchmarks/gui/text/qtext/main.cpp @@ -84,9 +84,11 @@ private slots: void newLineReplacement(); void formatManipulation(); + void fontResolution(); void layout_data(); void layout(); + void formattedLayout(); void paintLayoutToPixmap(); void paintLayoutToPixmap_painterFill(); @@ -306,6 +308,18 @@ void tst_QText::formatManipulation() } } +void tst_QText::fontResolution() +{ + QFont font; + QFont font2; + font.setFamily("DejaVu"); + font2.setBold(true); + + QBENCHMARK { + QFont res = font.resolve(font2); + } +} + void tst_QText::layout_data() { QTest::addColumn("wrap"); @@ -339,6 +353,33 @@ void tst_QText::layout() } }*/ +void tst_QText::formattedLayout() +{ + //set up formatting + QList ranges; + { + QTextCharFormat format; + format.setForeground(QColor("steelblue")); + + QTextLayout::FormatRange formatRange; + formatRange.format = format; + formatRange.start = 0; + formatRange.length = 50; + + ranges.append(formatRange); + } + + QTextLayout layout(m_shortLorem); + layout.setAdditionalFormats(ranges); + setupTextLayout(&layout); + + QBENCHMARK { + QTextLayout layout(m_shortLorem); + layout.setAdditionalFormats(ranges); + setupTextLayout(&layout); + } +} + void tst_QText::paintLayoutToPixmap() { QTextLayout layout(m_shortLorem); -- cgit v0.12 From e0dd90bfe47a7e95ad9444b4a62dc1f426dee7fe Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 5 Jul 2010 12:04:55 +1000 Subject:
    shouldn't trigger a new format range in QDeclarativeStyledText. --- src/declarative/util/qdeclarativestyledtext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qdeclarativestyledtext.cpp b/src/declarative/util/qdeclarativestyledtext.cpp index 9b4955e..91566bc 100644 --- a/src/declarative/util/qdeclarativestyledtext.cpp +++ b/src/declarative/util/qdeclarativestyledtext.cpp @@ -196,8 +196,10 @@ bool QDeclarativeStyledTextPrivate::parseTag(const QChar *&ch, const QString &te if (char0 == QLatin1Char('b')) { if (tagLength == 1) format.setFontWeight(QFont::Bold); - else if (tagLength == 2 && tag.at(1) == QLatin1Char('r')) + else if (tagLength == 2 && tag.at(1) == QLatin1Char('r')) { textOut.append(QChar(QChar::LineSeparator)); + return false; + } } else if (char0 == QLatin1Char('i')) { if (tagLength == 1) format.setFontItalic(true); -- cgit v0.12 From 325691bfdbf394c6a7c19ef2c3cb6db9140b3e01 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 5 Jul 2010 12:16:10 +1000 Subject: Work around QTBUG-11929 --- src/declarative/qml/qdeclarativecomponent.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 9d3032c..5617ae9 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -448,7 +448,8 @@ void QDeclarativeComponent::loadUrl(const QUrl &url) d->clear(); - if (url.isRelative() && !url.isEmpty()) + if ((url.isRelative() && !url.isEmpty()) + || url.scheme() == QLatin1String("file")) // Workaround QTBUG-11929 d->url = d->engine->baseUrl().resolved(url); else d->url = url; -- cgit v0.12 From f3207f2228646019891784cbc131572f9f2887e1 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 5 Jul 2010 13:37:50 +1000 Subject: Set correct license header. Reviewed-by: Trust Me --- doc/src/examples/qml-webbrowser.qdoc | 38 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/doc/src/examples/qml-webbrowser.qdoc b/doc/src/examples/qml-webbrowser.qdoc index d322b02..a3cef66 100644 --- a/doc/src/examples/qml-webbrowser.qdoc +++ b/doc/src/examples/qml-webbrowser.qdoc @@ -6,35 +6,21 @@ ** ** This file is part of the documentation of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ -- cgit v0.12 From 79572155fa27b69339171cee2c1cd072b1af9026 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 5 Jul 2010 14:32:45 +1000 Subject: Loosen font-sensitive test. --- .../declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index a21630b..b6ca7e5 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -175,7 +175,8 @@ void tst_qdeclarativetextinput::width() QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->width(), qreal(metricWidth) + 1.);//1 for the cursor + int delta = abs(int(textinputObject->width()) - metricWidth); + QVERIFY(delta <= 3.0); // As best as we can hope for cross-platform. delete textinputObject; } -- cgit v0.12 From 1a8df0b42a945d7ad6a9e92d88c8b64cab3720e7 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 5 Jul 2010 14:45:45 +1000 Subject: Prepare for QTest persistent store for visual tests. --- .../tst_qdeclarativetextedit.cpp | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index fc329c8..65d45b1 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -306,17 +307,17 @@ void tst_qdeclarativetextedit::alignments_data() QTest::addColumn("vAlign"); QTest::addColumn("expectfile"); - QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << SRCDIR "/data/alignments_lt.png"; - QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << SRCDIR "/data/alignments_rt.png"; - QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << SRCDIR "/data/alignments_ct.png"; + QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << "alignments_lt"; + QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << "alignments_rt"; + QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << "alignments_ct"; - QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_lb.png"; - QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_rb.png"; - QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_cb.png"; + QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << "alignments_lb"; + QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << "alignments_rb"; + QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << "alignments_cb"; - QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_lc.png"; - QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_rc.png"; - QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_cc.png"; + QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << "alignments_lc"; + QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << "alignments_rc"; + QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << "alignments_cc"; } @@ -326,13 +327,6 @@ void tst_qdeclarativetextedit::alignments() QFETCH(int, vAlign); QFETCH(QString, expectfile); -#ifdef Q_WS_X11 - // Font-specific, but not likely platform-specific, so only test on one platform - QFont fn; - fn.setRawName("-misc-fixed-medium-r-*-*-8-*-*-*-*-*-*-*"); - QApplication::setFont(fn); -#endif - QDeclarativeView *canvas = createView(SRCDIR "/data/alignments.qml"); canvas->show(); @@ -350,14 +344,20 @@ void tst_qdeclarativetextedit::alignments() QPainter p(&actual); canvas->render(&p); - QImage expect(expectfile); + // XXX This will be replaced by some clever persistent platform image store. + QString persistent_dir = SRCDIR "/data"; + QString arch = "unknown-architecture"; // QTest needs to help with this. + + expectfile = persistent_dir + QDir::separator() + expectfile + "-" + arch + ".png"; -#ifdef Q_WS_X11 - // Font-specific, but not likely platform-specific, so only test on one platform - if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") { - QCOMPARE(actual,expect); + if (!QFile::exists(expectfile)) { + actual.save(expectfile); + qWarning() << "created" << expectfile; } -#endif + + QImage expect(expectfile); + + QCOMPARE(actual,expect); } -- cgit v0.12