From c676b7095d826dc2d006f52a4b234546af5e2137 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 20 Jul 2011 01:19:26 -0700 Subject: Don't include qdbusvirtualobject header twice. It was in the public and private headers section. Reviewed-by: Thiago --- src/dbus/dbus.pro | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro index d21b380..37e5925 100644 --- a/src/dbus/dbus.pro +++ b/src/dbus/dbus.pro @@ -61,8 +61,7 @@ HEADERS += $$PUB_HEADERS \ qdbuspendingcall_p.h \ qdbus_symbols_p.h \ qdbusservicewatcher.h \ - qdbusunixfiledescriptor.h \ - qdbusvirtualobject.h + qdbusunixfiledescriptor.h SOURCES += qdbusconnection.cpp \ qdbusconnectioninterface.cpp \ qdbuserror.cpp \ -- cgit v0.12 From 89fb49ab13949d5ed1fb8bf0d306d9f1b2c38a71 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Fri, 15 Jul 2011 14:03:15 +0200 Subject: Add a way to check if we have a matching family in the database. This is needed in order to get proper font fallback, and incidentally webfonts, working in QtWebKit. See: https://bugs.webkit.org/show_bug.cgi?id=55036 Internal for now, maybe it could be made public for a future release. Task-number: QTBUG-15575 Change-Id: I5c454689125cd9d5fda26ff2149208ed1beec24d Reviewed-on: http://codereview.qt.nokia.com/1829 Reviewed-by: Qt Sanity Bot Reviewed-by: Jiang Jiang Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontdatabase.cpp | 10 ++++++++++ src/gui/text/qfontdatabase.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 3762f39..4e667a4 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -2239,6 +2239,16 @@ int QFontDatabase::weight(const QString &family, } +/*! \internal */ +bool QFontDatabase::hasFamily(const QString &family) const +{ + QString parsedFamily, foundry; + parseFontName(family, foundry, parsedFamily); + const QString familyAlias = resolveFontFamilyAlias(parsedFamily); + return families().contains(familyAlias, Qt::CaseInsensitive); +} + + /*! Returns the names the \a writingSystem (e.g. for displaying to the user in a dialog). diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h index d3463a0..b1f370e 100644 --- a/src/gui/text/qfontdatabase.h +++ b/src/gui/text/qfontdatabase.h @@ -138,6 +138,8 @@ public: bool bold(const QString &family, const QString &style) const; int weight(const QString &family, const QString &style) const; + bool hasFamily(const QString &family) const; + static QString writingSystemName(WritingSystem writingSystem); static QString writingSystemSample(WritingSystem writingSystem); -- cgit v0.12 From 500f8a4368be85a0ae8b7c46012deb0ab0c844ad Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Thu, 21 Jul 2011 15:09:24 +0200 Subject: Switch to use floating point pixelSize in QRawFont completely Reviewed-by: Eskil --- src/gui/text/qrawfont.cpp | 8 ++++---- src/gui/text/qrawfont.h | 8 ++++---- src/gui/text/qrawfont_ft.cpp | 2 +- src/gui/text/qrawfont_mac.cpp | 2 +- src/gui/text/qrawfont_p.h | 2 +- src/gui/text/qrawfont_qpa.cpp | 2 +- src/gui/text/qrawfont_win.cpp | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index ec5cc18..2c60b14 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -139,7 +139,7 @@ QRawFont::QRawFont() \note The referenced file must contain a TrueType or OpenType font. */ QRawFont::QRawFont(const QString &fileName, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference) : d(new QRawFontPrivate) { @@ -154,7 +154,7 @@ QRawFont::QRawFont(const QString &fileName, \note The data must contain a TrueType or OpenType font. */ QRawFont::QRawFont(const QByteArray &fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference) : d(new QRawFontPrivate) { @@ -204,7 +204,7 @@ bool QRawFont::isValid() const \sa loadFromData() */ void QRawFont::loadFromFile(const QString &fileName, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference) { QFile file(fileName); @@ -222,7 +222,7 @@ void QRawFont::loadFromFile(const QString &fileName, \sa loadFromFile() */ void QRawFont::loadFromData(const QByteArray &fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference) { detach(); diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index 99e0837..88ec6cb 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -70,10 +70,10 @@ public: QRawFont(); QRawFont(const QString &fileName, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting); QRawFont(const QByteArray &fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting); QRawFont(const QRawFont &other); ~QRawFont(); @@ -114,11 +114,11 @@ public: qreal unitsPerEm() const; void loadFromFile(const QString &fileName, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference); void loadFromData(const QByteArray &fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference); bool supportsCharacter(quint32 ucs4) const; diff --git a/src/gui/text/qrawfont_ft.cpp b/src/gui/text/qrawfont_ft.cpp index db60459..5bba221 100644 --- a/src/gui/text/qrawfont_ft.cpp +++ b/src/gui/text/qrawfont_ft.cpp @@ -98,7 +98,7 @@ void QRawFontPrivate::platformCleanUp() // Font engine handles all resources } -void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, int pixelSize, +void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) { Q_ASSERT(fontEngine == 0); diff --git a/src/gui/text/qrawfont_mac.cpp b/src/gui/text/qrawfont_mac.cpp index df68eb7..40c719a 100644 --- a/src/gui/text/qrawfont_mac.cpp +++ b/src/gui/text/qrawfont_mac.cpp @@ -55,7 +55,7 @@ void QRawFontPrivate::platformCleanUp() extern int qt_defaultDpi(); void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference) { // Mac OS X ignores it diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h index a7a03b7..fdf7cad 100644 --- a/src/gui/text/qrawfont_p.h +++ b/src/gui/text/qrawfont_p.h @@ -99,7 +99,7 @@ public: void cleanUp(); void platformCleanUp(); void platformLoadFromData(const QByteArray &fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference); static QRawFontPrivate *get(const QRawFont &font) { return font.d.data(); } diff --git a/src/gui/text/qrawfont_qpa.cpp b/src/gui/text/qrawfont_qpa.cpp index 3492946..6a69804 100644 --- a/src/gui/text/qrawfont_qpa.cpp +++ b/src/gui/text/qrawfont_qpa.cpp @@ -53,7 +53,7 @@ void QRawFontPrivate::platformCleanUp() { } -void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, int pixelSize, +void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) { Q_ASSERT(fontEngine == 0); diff --git a/src/gui/text/qrawfont_win.cpp b/src/gui/text/qrawfont_win.cpp index 6c62673..779652f 100644 --- a/src/gui/text/qrawfont_win.cpp +++ b/src/gui/text/qrawfont_win.cpp @@ -545,7 +545,7 @@ void QRawFontPrivate::platformCleanUp() } void QRawFontPrivate::platformLoadFromData(const QByteArray &_fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference) { QByteArray fontData(_fontData); -- cgit v0.12 From 8ed1f02c0ca4626ddb2e9262aad4459ff3474630 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Fri, 22 Jul 2011 13:16:41 +0200 Subject: optimize QRawFont::supportsCharacter() a single UCS-4-encoded codepoint could morph into 1 or 2 UCS-2-encoded codepoints only; thus, allocating QString just to parse it could be avoided and the well-defined UCS-4 to UCS-2 arithmetic could be used instead Merge-request: 1305 Reviewed-by: Jiang Jiang --- src/gui/text/qrawfont.cpp | 17 ++++++++++++++--- src/gui/text/qrawfont.h | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 2c60b14..e3e5c57 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -624,7 +624,7 @@ QList QRawFont::supportedWritingSystems() const \sa supportedWritingSystems() */ -bool QRawFont::supportsCharacter(const QChar &character) const +bool QRawFont::supportsCharacter(QChar character) const { if (!isValid()) return false; @@ -633,6 +633,7 @@ bool QRawFont::supportsCharacter(const QChar &character) const } /*! + \overload Returns true if the font has a glyph that corresponds to the UCS-4 encoded character \a ucs4. \sa supportedWritingSystems() @@ -642,8 +643,18 @@ bool QRawFont::supportsCharacter(quint32 ucs4) const if (!isValid()) return false; - QString str = QString::fromUcs4(&ucs4, 1); - return d->fontEngine->canRender(str.constData(), str.size()); + QChar str[2]; + int len; + if (!QChar::requiresSurrogates(ucs4)) { + str[0] = QChar(ucs4); + len = 1; + } else { + str[0] = QChar(QChar::highSurrogate(ucs4)); + str[1] = QChar(QChar::lowSurrogate(ucs4)); + len = 2; + } + + return d->fontEngine->canRender(str, len); } // qfontdatabase.cpp diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index 88ec6cb..d5b5680 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -122,7 +122,7 @@ public: QFont::HintingPreference hintingPreference); bool supportsCharacter(quint32 ucs4) const; - bool supportsCharacter(const QChar &character) const; + bool supportsCharacter(QChar character) const; QList supportedWritingSystems() const; QByteArray fontTable(const char *tagName) const; -- cgit v0.12 From a237c2cacec31e1aef00ff4e0b5707efc52d9b31 Mon Sep 17 00:00:00 2001 From: Ilya Konkov Date: Fri, 22 Jul 2011 13:25:46 +0200 Subject: Add initial support for bitmap version 4/5 headers. The headers are just skipped, information stored in them is ignored. Merge-request: 824 Reviewed-by: Kim Motoyoshi Kalland --- src/gui/image/qbmphandler.cpp | 64 ++++++++++++++++++++++---- tests/auto/qimagereader/images/test32bfv4.bmp | Bin 0 -> 232874 bytes tests/auto/qimagereader/images/test32v5.bmp | Bin 0 -> 174858 bytes tests/auto/qimagereader/qimagereader.qrc | 2 + tests/auto/qimagereader/tst_qimagereader.cpp | 22 +++++++++ 5 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 tests/auto/qimagereader/images/test32bfv4.bmp create mode 100644 tests/auto/qimagereader/images/test32v5.bmp diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 07de4d3..8840a83 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -97,8 +97,10 @@ static QDataStream &operator<<(QDataStream &s, const BMP_FILEHDR &bf) const int BMP_OLD = 12; // old Windows/OS2 BMP size -const int BMP_WIN = 40; // new Windows BMP size +const int BMP_WIN = 40; // Windows BMP v3 size const int BMP_OS2 = 64; // new OS/2 BMP size +const int BMP_WIN4 = 108; // Windows BMP v4 size +const int BMP_WIN5 = 124; // Windows BMP v5 size const int BMP_RGB = 0; // no compression const int BMP_RLE8 = 1; // run-length encoded, 8 bits @@ -109,7 +111,7 @@ const int BMP_BITFIELDS = 3; // RGB values encoded in dat static QDataStream &operator>>(QDataStream &s, BMP_INFOHDR &bi) { s >> bi.biSize; - if (bi.biSize == BMP_WIN || bi.biSize == BMP_OS2) { + if (bi.biSize == BMP_WIN || bi.biSize == BMP_OS2 || bi.biSize == BMP_WIN4 || bi.biSize == BMP_WIN5) { s >> bi.biWidth >> bi.biHeight >> bi.biPlanes >> bi.biBitCount; s >> bi.biCompression >> bi.biSizeImage; s >> bi.biXPelsPerMeter >> bi.biYPelsPerMeter; @@ -255,7 +257,57 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int image.setDotsPerMeterY(bi.biYPelsPerMeter); if (!d->isSequential()) - d->seek(startpos + BMP_FILEHDR_SIZE + bi.biSize); // goto start of colormap + d->seek(startpos + BMP_FILEHDR_SIZE + (bi.biSize >= BMP_WIN4? BMP_WIN : bi.biSize)); // goto start of colormap + + if (bi.biSize >= BMP_WIN4 || (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32))) { + Q_ASSERT(ncols == 0); + + if (d->read((char *)&red_mask, sizeof(red_mask)) != sizeof(red_mask)) + return false; + if (d->read((char *)&green_mask, sizeof(green_mask)) != sizeof(green_mask)) + return false; + if (d->read((char *)&blue_mask, sizeof(blue_mask)) != sizeof(blue_mask)) + return false; + + // Read BMP v4+ header + if (bi.biSize >= BMP_WIN4) { + int alpha_mask = 0; + int CSType = 0; + int gamma_red = 0; + int gamma_green = 0; + int gamma_blue = 0; + int endpoints[9]; + + if (d->read((char *)&alpha_mask, sizeof(alpha_mask)) != sizeof(alpha_mask)) + return false; + if (d->read((char *)&CSType, sizeof(CSType)) != sizeof(CSType)) + return false; + if (d->read((char *)&endpoints, sizeof(endpoints)) != sizeof(endpoints)) + return false; + if (d->read((char *)&gamma_red, sizeof(gamma_red)) != sizeof(gamma_red)) + return false; + if (d->read((char *)&gamma_green, sizeof(gamma_green)) != sizeof(gamma_green)) + return false; + if (d->read((char *)&gamma_blue, sizeof(gamma_blue)) != sizeof(gamma_blue)) + return false; + + if (bi.biSize == BMP_WIN5) { + qint32 intent = 0; + qint32 profileData = 0; + qint32 profileSize = 0; + qint32 reserved = 0; + + if (d->read((char *)&intent, sizeof(intent)) != sizeof(intent)) + return false; + if (d->read((char *)&profileData, sizeof(profileData)) != sizeof(profileData)) + return false; + if (d->read((char *)&profileSize, sizeof(profileSize)) != sizeof(profileSize)) + return false; + if (d->read((char *)&reserved, sizeof(reserved)) != sizeof(reserved) || reserved != 0) + return false; + } + } + } if (ncols > 0) { // read color table uchar rgb[4]; @@ -268,12 +320,6 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int return false; } } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) { - if (d->read((char *)&red_mask, sizeof(red_mask)) != sizeof(red_mask)) - return false; - if (d->read((char *)&green_mask, sizeof(green_mask)) != sizeof(green_mask)) - return false; - if (d->read((char *)&blue_mask, sizeof(blue_mask)) != sizeof(blue_mask)) - return false; red_shift = calc_shift(red_mask); red_scale = 256 / ((red_mask >> red_shift) + 1); green_shift = calc_shift(green_mask); diff --git a/tests/auto/qimagereader/images/test32bfv4.bmp b/tests/auto/qimagereader/images/test32bfv4.bmp new file mode 100644 index 0000000..3706037 Binary files /dev/null and b/tests/auto/qimagereader/images/test32bfv4.bmp differ diff --git a/tests/auto/qimagereader/images/test32v5.bmp b/tests/auto/qimagereader/images/test32v5.bmp new file mode 100644 index 0000000..8ad3cfa Binary files /dev/null and b/tests/auto/qimagereader/images/test32v5.bmp differ diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc index 632b73a..2c70652 100644 --- a/tests/auto/qimagereader/qimagereader.qrc +++ b/tests/auto/qimagereader/qimagereader.qrc @@ -42,6 +42,8 @@ images/teapot.ppm images/test.ppm images/test.xpm + images/test32bfv4.bmp + images/test32v5.bmp images/tst7.bmp images/tst7.png images/transparent.xpm diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 5c65cb3..5d958d7 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -234,6 +234,8 @@ void tst_QImageReader::readImage_data() QTest::newRow("empty") << QString() << false << QByteArray(); QTest::newRow("BMP: colorful") << QString("colorful.bmp") << true << QByteArray("bmp"); + QTest::newRow("BMP: test32bfv4") << QString("test32bfv4.bmp") << true << QByteArray("bmp"); + QTest::newRow("BMP: test32v5") << QString("test32v5.bmp") << true << QByteArray("bmp"); QTest::newRow("BMP: font") << QString("font.bmp") << true << QByteArray("bmp"); QTest::newRow("BMP: signed char") << QString("crash-signed-char.bmp") << true << QByteArray("bmp"); QTest::newRow("BMP: 4bpp RLE") << QString("4bpp-rle.bmp") << true << QByteArray("bmp"); @@ -432,6 +434,8 @@ void tst_QImageReader::setClipRect_data() QTest::addColumn("newRect"); QTest::addColumn("format"); QTest::newRow("BMP: colorful") << "colorful" << QRect(0, 0, 50, 50) << QByteArray("bmp"); + QTest::newRow("BMP: test32bfv4") << "test32bfv4" << QRect(0, 0, 50, 50) << QByteArray("bmp"); + QTest::newRow("BMP: test32v5") << "test32v5" << QRect(0, 0, 50, 50) << QByteArray("bmp"); QTest::newRow("BMP: font") << "font" << QRect(0, 0, 50, 50) << QByteArray("bmp"); QTest::newRow("BMP: 4bpp uncompressed") << "tst7.bmp" << QRect(0, 0, 31, 31) << QByteArray("bmp"); QTest::newRow("XPM: marble") << "marble" << QRect(0, 0, 50, 50) << QByteArray("xpm"); @@ -484,6 +488,8 @@ void tst_QImageReader::setScaledClipRect_data() QTest::addColumn("format"); QTest::newRow("BMP: colorful") << "colorful" << QRect(0, 0, 50, 50) << QByteArray("bmp"); + QTest::newRow("BMP: test32bfv4") << "test32bfv4" << QRect(0, 0, 50, 50) << QByteArray("bmp"); + QTest::newRow("BMP: test32v5") << "test32v5" << QRect(0, 0, 50, 50) << QByteArray("bmp"); QTest::newRow("BMP: font") << "font" << QRect(0, 0, 50, 50) << QByteArray("bmp"); QTest::newRow("XPM: marble") << "marble" << QRect(0, 0, 50, 50) << QByteArray("xpm"); QTest::newRow("PNG: kollada") << "kollada" << QRect(0, 0, 50, 50) << QByteArray("png"); @@ -555,6 +561,8 @@ void tst_QImageReader::imageFormat_data() QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm") << QImage::Format_Indexed8; QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp") << QImage::Format_Indexed8; QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp") << QImage::Format_Indexed8; + QTest::newRow("bmp-3") << QString("test32bfv4.bmp") << QByteArray("bmp") << QImage::Format_RGB32; + QTest::newRow("bmp-4") << QString("test32v5.bmp") << QByteArray("bmp") << QImage::Format_RGB32; QTest::newRow("png") << QString("kollada.png") << QByteArray("png") << QImage::Format_ARGB32; QTest::newRow("png-2") << QString("YCbCr_cmyk.png") << QByteArray("png") << QImage::Format_RGB32; QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng") << QImage::Format_Invalid; @@ -684,6 +692,8 @@ void tst_QImageReader::supportsAnimation_data() QTest::newRow("BMP: colorful") << QString("colorful.bmp") << false; QTest::newRow("BMP: font") << QString("font.bmp") << false; QTest::newRow("BMP: signed char") << QString("crash-signed-char.bmp") << false; + QTest::newRow("BMP: test32bfv4") << QString("test32bfv4.bmp") << false;; + QTest::newRow("BMP: test32v5") << QString("test32v5.bmp") << false; QTest::newRow("XPM: marble") << QString("marble.xpm") << false; QTest::newRow("PNG: kollada") << QString("kollada.png") << false; QTest::newRow("PPM: teapot") << QString("teapot.ppm") << false; @@ -1064,6 +1074,8 @@ void tst_QImageReader::readFromDevice_data() QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm"); QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp"); QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp"); + QTest::newRow("bmp-3") << QString("test32bfv4.bmp") << QByteArray("bmp"); + QTest::newRow("bmp-4") << QString("test32v5.bmp") << QByteArray("bmp"); QTest::newRow("png") << QString("kollada.png") << QByteArray("png"); #ifdef QTEST_HAVE_MNG QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng"); @@ -1155,6 +1167,8 @@ void tst_QImageReader::readFromFileAfterJunk_data() QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm"); QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp"); QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp"); + QTest::newRow("bmp-3") << QString("test32bfv4.bmp") << QByteArray("bmp"); + QTest::newRow("bmp-4") << QString("test32v5.bmp") << QByteArray("bmp"); QTest::newRow("png") << QString("kollada.png") << QByteArray("png"); // QTest::newRow("mng-1") << QString("images/ball.mng") << QByteArray("mng"); // QTest::newRow("mng-2") << QString("images/fire.mng") << QByteArray("mng"); @@ -1233,6 +1247,8 @@ void tst_QImageReader::devicePosition_data() QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm"); QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp"); QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp"); + QTest::newRow("bmp-3") << QString("test32bfv4.bmp") << QByteArray("bmp"); + QTest::newRow("bmp-4") << QString("test32v5.bmp") << QByteArray("bmp"); QTest::newRow("png") << QString("kollada.png") << QByteArray("png"); // QTest::newRow("mng-1") << QString("images/ball.mng") << QByteArray("mng"); // QTest::newRow("mng-2") << QString("images/fire.mng") << QByteArray("mng"); @@ -1305,6 +1321,12 @@ void tst_QImageReader::readFromResources_data() QTest::newRow("4bpp-rle.bmp") << QString("4bpp-rle.bmp") << QByteArray("bmp") << QSize(640, 480) << QString(""); + QTest::newRow("test32bfv4.bmp") << QString("test32bfv4.bmp") + << QByteArray("bmp") << QSize(373, 156) + << QString(""); + QTest::newRow("test32v5.bmp") << QString("test32v5.bmp") + << QByteArray("bmp") << QSize(373, 156) + << QString(""); #ifdef QTEST_HAVE_GIF QTest::newRow("corrupt.gif") << QString("corrupt.gif") << QByteArray("gif") << QSize(0, 0) -- cgit v0.12 From 5dcc69927538bc195236fd7c4287976c819aa8df Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 25 Jul 2011 10:39:23 +0200 Subject: Get subpixel antialiasing again w/combo of raster and affine transform Revert part of hot fix 48ff7e5af99923396243940979d15d4ec2e2730c since it is no longer needed in Qt 4.8 due to the introduction of a separate code path for the FreeType case in drawCachedGlyphs(). This is also explained in the description for that commit. The consequence of the commit was that subpixel antialiasing would be turned off for all text drawn with a transformation and the raster engine. In the past this was not the case, it is however the case in several other paint engine, so the regression was deemed okay to hot fix the original problem. In Qt 4.8 the original problem has been fixed properly. Task-number: QTBUG-16205 Reviewed-by: Jiang Jiang --- src/gui/painting/qpaintengine_raster.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 9ba4592..626100a 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2862,15 +2862,9 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, } else #endif { - QFontEngineGlyphCache::Type glyphType; - if (fontEngine->glyphFormat >= 0) { - glyphType = QFontEngineGlyphCache::Type(fontEngine->glyphFormat); - } else if (s->matrix.type() > QTransform::TxTranslate - && d->glyphCacheType == QFontEngineGlyphCache::Raster_RGBMask) { - glyphType = QFontEngineGlyphCache::Raster_A8; - } else { - glyphType = d->glyphCacheType; - } + QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 + ? QFontEngineGlyphCache::Type(fontEngine->glyphFormat) + : d->glyphCacheType; QImageTextureGlyphCache *cache = static_cast(fontEngine->glyphCache(0, glyphType, s->matrix)); -- cgit v0.12 From 64066a0dcc55ea3ae681e0d2e870aa1cd0a56170 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 20 Jul 2011 14:24:37 +0200 Subject: Fix uikit simulator build. --- mkspecs/qpa/macx-iphonesimulator-g++/qmake.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkspecs/qpa/macx-iphonesimulator-g++/qmake.conf b/mkspecs/qpa/macx-iphonesimulator-g++/qmake.conf index 481a268..de4c8b4 100644 --- a/mkspecs/qpa/macx-iphonesimulator-g++/qmake.conf +++ b/mkspecs/qpa/macx-iphonesimulator-g++/qmake.conf @@ -45,8 +45,8 @@ QMAKE_LINK_SHLIB = $$QMAKE_CXX QMAKE_CFLAGS += -arch i386 -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden -QMAKE_OBJECTIVE_CFLAGS += -arch i386 -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -QMAKE_OBJECTIVE_CFLAGS_X86 += -arch i386 -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 +QMAKE_OBJECTIVE_CFLAGS += -arch i386 -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -fobjc-abi-version=2 -fobjc-legacy-dispatch +QMAKE_OBJECTIVE_CFLAGS_X86 += -arch i386 -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -fobjc-abi-version=2 -fobjc-legacy-dispatch QMAKE_LFLAGS += -arch i386 -Wl,-syslibroot,$$QMAKE_IOS_SDK QMAKE_LFLAGS += -framework Foundation -framework UIKit -framework QuartzCore -lz -- cgit v0.12 From 4bac95354ba73cdbe69f3dfface799fd5fc92c77 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 20 Jul 2011 14:29:02 +0200 Subject: Add flickrdemo uikit example project. --- .../examples/flickrdemo/flickrdemo-Info.plist | 41 ++ .../flickrdemo.xcodeproj/project.pbxproj | 503 +++++++++++++++++++++ .../examples/flickrdemo/flickrdemo_Prefix.pch | 8 + .../platforms/uikit/examples/flickrdemo/main.mm | 78 ++++ .../qmltest/qmltest.xcodeproj/project.pbxproj | 8 + 5 files changed, 638 insertions(+) create mode 100644 src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo-Info.plist create mode 100755 src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj create mode 100644 src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo_Prefix.pch create mode 100644 src/plugins/platforms/uikit/examples/flickrdemo/main.mm diff --git a/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo-Info.plist b/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo-Info.plist new file mode 100644 index 0000000..5bc1ac9 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo-Info.plist @@ -0,0 +1,41 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.nokia.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UIRequiredDeviceCapabilities + + wifi + + UIRequiresPersistentWiFi + + UIStatusBarHidden + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + + + diff --git a/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj b/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj new file mode 100755 index 0000000..59aa398 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo.xcodeproj/project.pbxproj @@ -0,0 +1,503 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; + D333CCF213B88A4D0070E08E /* moc_qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D333CCEF13B88A4D0070E08E /* moc_qmlapplicationviewer.cpp */; }; + D333CCF313B88A4D0070E08E /* moc_qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D333CCEF13B88A4D0070E08E /* moc_qmlapplicationviewer.cpp */; }; + D333CCF413B88A4D0070E08E /* qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D333CCF013B88A4D0070E08E /* qmlapplicationviewer.cpp */; }; + D333CCF513B88A4D0070E08E /* qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D333CCF013B88A4D0070E08E /* qmlapplicationviewer.cpp */; }; + D3A51610134B03DE00E30E2F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3A5160F134B03DE00E30E2F /* OpenGLES.framework */; }; + D3A51612134B03E900E30E2F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3A51611134B03E900E30E2F /* QuartzCore.framework */; }; + D3A51614134B040600E30E2F /* libQtOpenGL_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3A51613134B040600E30E2F /* libQtOpenGL_debug.a */; }; + D3A51615134B041500E30E2F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3A51611134B03E900E30E2F /* QuartzCore.framework */; }; + D3A51616134B041500E30E2F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3A5160F134B03DE00E30E2F /* OpenGLES.framework */; }; + D3A51618134B042A00E30E2F /* libQtOpenGL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3A51617134B042A00E30E2F /* libQtOpenGL.a */; }; + D3CAA7C813264AAD008BB877 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7C713264AAD008BB877 /* main.mm */; }; + D3CAA7EC13264F52008BB877 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7C713264AAD008BB877 /* main.mm */; }; + D3CAA7F013264F52008BB877 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; + D3CAA7FA13264F8A008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; + D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; + D3CAA81B13265056008BB877 /* libQtCore_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81613265056008BB877 /* libQtCore_debug.a */; }; + D3CAA81C13265056008BB877 /* libQtDeclarative_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */; }; + D3CAA81D13265056008BB877 /* libQtGui_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81813265056008BB877 /* libQtGui_debug.a */; }; + D3CAA81E13265056008BB877 /* libQtScript_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81913265056008BB877 /* libQtScript_debug.a */; }; + D3CAA81F13265056008BB877 /* libQtSql_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81A13265056008BB877 /* libQtSql_debug.a */; }; + D3CAA8211326507D008BB877 /* libquikit_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA8201326507D008BB877 /* libquikit_debug.a */; }; + D3CAA82813265220008BB877 /* libQtNetwork_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA82713265220008BB877 /* libQtNetwork_debug.a */; }; + D3CAA88A132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; + D3CAA88B132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; + D3D815F31329339300CDE422 /* flickr in Resources */ = {isa = PBXBuildFile; fileRef = D3D815D31329339300CDE422 /* flickr */; }; + D3D815F4132933AB00CDE422 /* flickr in Resources */ = {isa = PBXBuildFile; fileRef = D3D815D31329339300CDE422 /* flickr */; }; + D3D8160A13293C9B00CDE422 /* libQtXml_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D8160813293C9B00CDE422 /* libQtXml_debug.a */; }; + D3D8160B13293C9B00CDE422 /* libQtXmlPatterns_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D8160913293C9B00CDE422 /* libQtXmlPatterns_debug.a */; }; + D3D81758132A184300CDE422 /* libQtCore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D81752132A184300CDE422 /* libQtCore.a */; }; + D3D81759132A184300CDE422 /* libQtDeclarative.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D81753132A184300CDE422 /* libQtDeclarative.a */; }; + D3D8175A132A184300CDE422 /* libQtGui.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D81754132A184300CDE422 /* libQtGui.a */; }; + D3D8175B132A184300CDE422 /* libQtNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D81755132A184300CDE422 /* libQtNetwork.a */; }; + D3D8175C132A184300CDE422 /* libQtScript.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D81756132A184300CDE422 /* libQtScript.a */; }; + D3D8175D132A184300CDE422 /* libQtSql.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D81757132A184300CDE422 /* libQtSql.a */; }; + D3D81760132A185A00CDE422 /* libQtXml.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D8175E132A185A00CDE422 /* libQtXml.a */; }; + D3D81761132A185A00CDE422 /* libQtXmlPatterns.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D8175F132A185A00CDE422 /* libQtXmlPatterns.a */; }; + D3D81763132A186B00CDE422 /* libquikit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D81762132A186B00CDE422 /* libquikit.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D6058910D05DD3D006BFB54 /* flickrdemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = flickrdemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 32CA4F630368D1EE00C91783 /* flickrdemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = flickrdemo_Prefix.pch; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* flickrdemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "flickrdemo-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; + D333CCEF13B88A4D0070E08E /* moc_qmlapplicationviewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_qmlapplicationviewer.cpp; path = ../share/qmlapplicationviewer/moc_qmlapplicationviewer.cpp; sourceTree = ""; }; + D333CCF013B88A4D0070E08E /* qmlapplicationviewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = qmlapplicationviewer.cpp; path = ../share/qmlapplicationviewer/qmlapplicationviewer.cpp; sourceTree = ""; }; + D333CCF113B88A4D0070E08E /* qmlapplicationviewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qmlapplicationviewer.h; path = ../share/qmlapplicationviewer/qmlapplicationviewer.h; sourceTree = ""; }; + D3A5160F134B03DE00E30E2F /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + D3A51611134B03E900E30E2F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + D3A51613134B040600E30E2F /* libQtOpenGL_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtOpenGL_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtOpenGL_debug.a"; sourceTree = ""; }; + D3A51617134B042A00E30E2F /* libQtOpenGL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtOpenGL.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtOpenGL.a"; sourceTree = ""; }; + D3CAA7C713264AAD008BB877 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; + D3CAA7F613264F52008BB877 /* flickrdemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = flickrdemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.2.3.dylib; path = usr/lib/libz.1.2.3.dylib; sourceTree = SDKROOT; }; + D3CAA81613265056008BB877 /* libQtCore_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtCore_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtDeclarative_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81813265056008BB877 /* libQtGui_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtGui_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtGui_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81913265056008BB877 /* libQtScript_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtScript_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81A13265056008BB877 /* libQtSql_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtSql_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA8201326507D008BB877 /* libquikit_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms/libquikit_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA82713265220008BB877 /* libQtNetwork_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtNetwork_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA836132652E5008BB877 /* fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = fonts; path = ../../../../../../lib/fonts; sourceTree = SOURCE_ROOT; }; + D3D815D31329339300CDE422 /* flickr */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flickr; path = ../../../../../../demos/declarative/flickr; sourceTree = SOURCE_ROOT; }; + D3D8160813293C9B00CDE422 /* libQtXml_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXml_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtXml_debug.a"; sourceTree = SOURCE_ROOT; }; + D3D8160913293C9B00CDE422 /* libQtXmlPatterns_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXmlPatterns_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtXmlPatterns_debug.a"; sourceTree = SOURCE_ROOT; }; + D3D81752132A184300CDE422 /* libQtCore.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtCore.a"; sourceTree = SOURCE_ROOT; }; + D3D81753132A184300CDE422 /* libQtDeclarative.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtDeclarative.a"; sourceTree = SOURCE_ROOT; }; + D3D81754132A184300CDE422 /* libQtGui.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtGui.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtGui.a"; sourceTree = SOURCE_ROOT; }; + D3D81755132A184300CDE422 /* libQtNetwork.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtNetwork.a"; sourceTree = SOURCE_ROOT; }; + D3D81756132A184300CDE422 /* libQtScript.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtScript.a"; sourceTree = SOURCE_ROOT; }; + D3D81757132A184300CDE422 /* libQtSql.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtSql.a"; sourceTree = SOURCE_ROOT; }; + D3D8175E132A185A00CDE422 /* libQtXml.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXml.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtXml.a"; sourceTree = SOURCE_ROOT; }; + D3D8175F132A185A00CDE422 /* libQtXmlPatterns.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXmlPatterns.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtXmlPatterns.a"; sourceTree = SOURCE_ROOT; }; + D3D81762132A186B00CDE422 /* libquikit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit.a; path = "../../../../../../../qt-lighthouse-ios-device/plugins/platforms/libquikit.a"; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3A51614134B040600E30E2F /* libQtOpenGL_debug.a in Frameworks */, + D3A51612134B03E900E30E2F /* QuartzCore.framework in Frameworks */, + D3A51610134B03DE00E30E2F /* OpenGLES.framework in Frameworks */, + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, + D3CAA7FA13264F8A008BB877 /* libz.1.2.3.dylib in Frameworks */, + D3CAA81B13265056008BB877 /* libQtCore_debug.a in Frameworks */, + D3CAA81C13265056008BB877 /* libQtDeclarative_debug.a in Frameworks */, + D3CAA81D13265056008BB877 /* libQtGui_debug.a in Frameworks */, + D3CAA81E13265056008BB877 /* libQtScript_debug.a in Frameworks */, + D3CAA81F13265056008BB877 /* libQtSql_debug.a in Frameworks */, + D3CAA8211326507D008BB877 /* libquikit_debug.a in Frameworks */, + D3CAA82813265220008BB877 /* libQtNetwork_debug.a in Frameworks */, + D3D8160A13293C9B00CDE422 /* libQtXml_debug.a in Frameworks */, + D3D8160B13293C9B00CDE422 /* libQtXmlPatterns_debug.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3CAA7EF13264F52008BB877 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3A51618134B042A00E30E2F /* libQtOpenGL.a in Frameworks */, + D3CAA7F013264F52008BB877 /* Foundation.framework in Frameworks */, + D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */, + D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */, + D3A51615134B041500E30E2F /* QuartzCore.framework in Frameworks */, + D3A51616134B041500E30E2F /* OpenGLES.framework in Frameworks */, + D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */, + D3D81758132A184300CDE422 /* libQtCore.a in Frameworks */, + D3D81759132A184300CDE422 /* libQtDeclarative.a in Frameworks */, + D3D8175A132A184300CDE422 /* libQtGui.a in Frameworks */, + D3D8175B132A184300CDE422 /* libQtNetwork.a in Frameworks */, + D3D8175C132A184300CDE422 /* libQtScript.a in Frameworks */, + D3D8175D132A184300CDE422 /* libQtSql.a in Frameworks */, + D3D81760132A185A00CDE422 /* libQtXml.a in Frameworks */, + D3D81761132A185A00CDE422 /* libQtXmlPatterns.a in Frameworks */, + D3D81763132A186B00CDE422 /* libquikit.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* flickrdemo.app */, + D3CAA7F613264F52008BB877 /* flickrdemo.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + D3CAA7E213264E8C008BB877 /* QMLApplicationViewer */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = CustomTemplate; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* flickrdemo_Prefix.pch */, + D3CAA7C713264AAD008BB877 /* main.mm */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + D3D815D31329339300CDE422 /* flickr */, + D3CAA836132652E5008BB877 /* fonts */, + 8D1107310486CEB800E47090 /* flickrdemo-Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + D3CAA81513265035008BB877 /* Simulator */, + D3CAA8141326500A008BB877 /* Device */, + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + 1D30AB110D05D00D00671497 /* Foundation.framework */, + 288765A40DF7441C002DB57D /* CoreGraphics.framework */, + D3A51611134B03E900E30E2F /* QuartzCore.framework */, + D3A5160F134B03DE00E30E2F /* OpenGLES.framework */, + D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */, + ); + name = Frameworks; + sourceTree = ""; + }; + D3CAA7E213264E8C008BB877 /* QMLApplicationViewer */ = { + isa = PBXGroup; + children = ( + D333CCEF13B88A4D0070E08E /* moc_qmlapplicationviewer.cpp */, + D333CCF013B88A4D0070E08E /* qmlapplicationviewer.cpp */, + D333CCF113B88A4D0070E08E /* qmlapplicationviewer.h */, + ); + name = QMLApplicationViewer; + sourceTree = ""; + }; + D3CAA8141326500A008BB877 /* Device */ = { + isa = PBXGroup; + children = ( + D3D81762132A186B00CDE422 /* libquikit.a */, + D3D81752132A184300CDE422 /* libQtCore.a */, + D3D81753132A184300CDE422 /* libQtDeclarative.a */, + D3D81754132A184300CDE422 /* libQtGui.a */, + D3D81755132A184300CDE422 /* libQtNetwork.a */, + D3A51617134B042A00E30E2F /* libQtOpenGL.a */, + D3D81756132A184300CDE422 /* libQtScript.a */, + D3D81757132A184300CDE422 /* libQtSql.a */, + D3D8175E132A185A00CDE422 /* libQtXml.a */, + D3D8175F132A185A00CDE422 /* libQtXmlPatterns.a */, + ); + name = Device; + sourceTree = ""; + }; + D3CAA81513265035008BB877 /* Simulator */ = { + isa = PBXGroup; + children = ( + D3CAA8201326507D008BB877 /* libquikit_debug.a */, + D3CAA81613265056008BB877 /* libQtCore_debug.a */, + D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */, + D3CAA81813265056008BB877 /* libQtGui_debug.a */, + D3CAA82713265220008BB877 /* libQtNetwork_debug.a */, + D3A51613134B040600E30E2F /* libQtOpenGL_debug.a */, + D3CAA81913265056008BB877 /* libQtScript_debug.a */, + D3CAA81A13265056008BB877 /* libQtSql_debug.a */, + D3D8160813293C9B00CDE422 /* libQtXml_debug.a */, + D3D8160913293C9B00CDE422 /* libQtXmlPatterns_debug.a */, + ); + name = Simulator; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* flickrdemo simulator */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "flickrdemo simulator" */; + buildPhases = ( + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "flickrdemo simulator"; + productName = flickrdemo; + productReference = 1D6058910D05DD3D006BFB54 /* flickrdemo.app */; + productType = "com.apple.product-type.application"; + }; + D3CAA7E813264F52008BB877 /* flickrdemo device */ = { + isa = PBXNativeTarget; + buildConfigurationList = D3CAA7F313264F52008BB877 /* Build configuration list for PBXNativeTarget "flickrdemo device" */; + buildPhases = ( + D3CAA7E913264F52008BB877 /* Resources */, + D3CAA7EB13264F52008BB877 /* Sources */, + D3CAA7EF13264F52008BB877 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "flickrdemo device"; + productName = flickrdemo; + productReference = D3CAA7F613264F52008BB877 /* flickrdemo.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "flickrdemo" */; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* flickrdemo simulator */, + D3CAA7E813264F52008BB877 /* flickrdemo device */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA88A132652E5008BB877 /* fonts in Resources */, + D3D815F31329339300CDE422 /* flickr in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3CAA7E913264F52008BB877 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA88B132652E5008BB877 /* fonts in Resources */, + D3D815F4132933AB00CDE422 /* flickr in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA7C813264AAD008BB877 /* main.mm in Sources */, + D333CCF213B88A4D0070E08E /* moc_qmlapplicationviewer.cpp in Sources */, + D333CCF413B88A4D0070E08E /* qmlapplicationviewer.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3CAA7EB13264F52008BB877 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA7EC13264F52008BB877 /* main.mm in Sources */, + D333CCF313B88A4D0070E08E /* moc_qmlapplicationviewer.cpp in Sources */, + D333CCF513B88A4D0070E08E /* qmlapplicationviewer.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = flickrdemo_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/include\"/**"; + INFOPLIST_FILE = "flickrdemo-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/lib\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/lib\"", + ); + PRODUCT_NAME = flickrdemo; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = flickrdemo_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/include\"/**"; + INFOPLIST_FILE = "flickrdemo-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/lib\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/lib\"", + ); + PRODUCT_NAME = flickrdemo; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + PREBINDING = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Release; + }; + D3CAA7F413264F52008BB877 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = flickrdemo_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/include\"/**"; + INFOPLIST_FILE = "flickrdemo-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/lib\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/plugins/platforms\"", + ); + PRODUCT_NAME = flickrdemo; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + D3CAA7F513264F52008BB877 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = flickrdemo_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/include\"/**"; + INFOPLIST_FILE = "flickrdemo-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/lib\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/plugins/platforms\"", + ); + PRODUCT_NAME = flickrdemo; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "flickrdemo simulator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "flickrdemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D3CAA7F313264F52008BB877 /* Build configuration list for PBXNativeTarget "flickrdemo device" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D3CAA7F413264F52008BB877 /* Debug */, + D3CAA7F513264F52008BB877 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo_Prefix.pch b/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo_Prefix.pch new file mode 100644 index 0000000..d807759 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/flickrdemo/flickrdemo_Prefix.pch @@ -0,0 +1,8 @@ +// +// Prefix header for all source files of the 'flickrdemo' project +// + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/src/plugins/platforms/uikit/examples/flickrdemo/main.mm b/src/plugins/platforms/uikit/examples/flickrdemo/main.mm new file mode 100644 index 0000000..3d1feb9 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/flickrdemo/main.mm @@ -0,0 +1,78 @@ +/**************************************************************************** + ** + ** Copyright (C) 2011 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$ + ** GNU Lesser General Public License Usage + ** 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. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU General + ** Public License version 3.0 as published by the Free Software Foundation + ** and appearing in the file LICENSE.GPL included in the packaging of this + ** file. Please review the following information to ensure the GNU General + ** Public License version 3.0 requirements will be met: + ** http://www.gnu.org/copyleft/gpl.html. + ** + ** Other Usage + ** Alternatively, this file may be used in accordance with the terms and + ** conditions contained in a signed written agreement between you and Nokia. + ** + ** + ** + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#import + +#include "../share/qmlapplicationviewer/qmlapplicationviewer.h" + +#include +#include +#include + +Q_IMPORT_PLUGIN(UIKit) + +static QString qStringFromNSString(NSString *nsstring) +{ + return QString::fromUtf8([nsstring UTF8String]); +} + +static QString documentsDirectory() +{ + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString *documentsDirectory = [paths objectAtIndex:0]; + return qStringFromNSString(documentsDirectory); +} + +int main(int argc, char *argv[]) { + + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + + QApplication app(argc, argv); + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.engine()->setOfflineStoragePath(documentsDirectory()); + NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; + viewer.setMainQmlFile(qStringFromNSString([resourcePath stringByAppendingPathComponent:@"flickr/flickr.qml"])); + viewer.showMaximized(); + int retVal = app.exec(); + [pool release]; + return retVal; +} diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj index 02a028d..96c1932 100755 --- a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj @@ -358,12 +358,14 @@ GCC_PREFIX_HEADER = qmltest_Prefix.pch; HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/include\"/**"; INFOPLIST_FILE = "qmltest-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/lib\"", "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms\"", ); PRODUCT_NAME = qmltest; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -377,12 +379,14 @@ GCC_PREFIX_HEADER = qmltest_Prefix.pch; HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/include\"/**"; INFOPLIST_FILE = "qmltest-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/lib\"", "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms\"", ); PRODUCT_NAME = qmltest; + TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; @@ -426,12 +430,14 @@ GCC_PREFIX_HEADER = qmltest_Prefix.pch; HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/include\"/**"; INFOPLIST_FILE = "qmltest-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/lib\"", "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/plugins/platforms\"", ); PRODUCT_NAME = qmltest; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -445,12 +451,14 @@ GCC_PREFIX_HEADER = qmltest_Prefix.pch; HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/include\"/**"; INFOPLIST_FILE = "qmltest-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/lib\"", "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/plugins/platforms\"", ); PRODUCT_NAME = qmltest; + TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; -- cgit v0.12 From 58d34f97594d9cbb8c7b60d05c5226f70d286be0 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 25 Jul 2011 11:12:10 +0200 Subject: Add some sound support to the uikit platform. --- src/plugins/platforms/uikit/README | 7 +- .../platforms/uikit/phonon_av/avaudiooutput.cpp | 73 +++++ .../platforms/uikit/phonon_av/avaudiooutput.h | 68 +++++ .../platforms/uikit/phonon_av/avbackend.cpp | 127 +++++++++ src/plugins/platforms/uikit/phonon_av/avbackend.h | 73 +++++ .../platforms/uikit/phonon_av/avmediaobject.h | 123 +++++++++ .../platforms/uikit/phonon_av/avmediaobject.mm | 298 +++++++++++++++++++++ .../platforms/uikit/phonon_av/phonon_av.pro | 31 +++ src/plugins/platforms/uikit/platform.pro | 27 ++ src/plugins/platforms/uikit/uikit.pro | 29 +- 10 files changed, 827 insertions(+), 29 deletions(-) create mode 100644 src/plugins/platforms/uikit/phonon_av/avaudiooutput.cpp create mode 100644 src/plugins/platforms/uikit/phonon_av/avaudiooutput.h create mode 100644 src/plugins/platforms/uikit/phonon_av/avbackend.cpp create mode 100644 src/plugins/platforms/uikit/phonon_av/avbackend.h create mode 100644 src/plugins/platforms/uikit/phonon_av/avmediaobject.h create mode 100644 src/plugins/platforms/uikit/phonon_av/avmediaobject.mm create mode 100644 src/plugins/platforms/uikit/phonon_av/phonon_av.pro create mode 100644 src/plugins/platforms/uikit/platform.pro diff --git a/src/plugins/platforms/uikit/README b/src/plugins/platforms/uikit/README index ffd31df..8b43201 100644 --- a/src/plugins/platforms/uikit/README +++ b/src/plugins/platforms/uikit/README @@ -18,11 +18,11 @@ After configuring and building Qt you need to also build src/plugins/platforms/u Simulator: ---------- -configure -qpa -xplatform qpa/macx-iphonesimulator-g++ -arch i386 -developer-build -opengl es2 -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations +configure -qpa -xplatform qpa/macx-iphonesimulator-g++ -arch i386 -developer-build -opengl es2 -no-accessibility -no-qt3support -no-multimedia -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations Device: ------- -configure -qpa -xplatform qpa/macx-iphonedevice-g++ -arch armv7 -developer-build -release -opengl es2 -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations +configure -qpa -xplatform qpa/macx-iphonedevice-g++ -arch armv7 -developer-build -release -opengl es2 -no-accessibility -no-qt3support -no-multimedia -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations 2) XCode setup: - there are examples in the examples subdirectory of the platform plugin @@ -40,6 +40,9 @@ configure -qpa -xplatform qpa/macx-iphonedevice-g++ -arch armv7 -developer-build - add "$(SRCROOT)/../qmltest" to the include search path if you didn't copy but linked to the qmlapplicationviewer - for device set the architecture to armv7 only + - to use sound in your application, Q_IMPORT_PLUGIN(phonon_av), + #include , + and call Phonon::Factory::setBackend(qt_plugin_instance_phonon_av()); 3) Done: Build and Run. diff --git a/src/plugins/platforms/uikit/phonon_av/avaudiooutput.cpp b/src/plugins/platforms/uikit/phonon_av/avaudiooutput.cpp new file mode 100644 index 0000000..97ab6c9 --- /dev/null +++ b/src/plugins/platforms/uikit/phonon_av/avaudiooutput.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "avaudiooutput.h" + +AVAudioOutput::AVAudioOutput(QObject *parent) + : QObject(parent), + m_volume(1.) +{ +} + +AVAudioOutput::~AVAudioOutput() +{ +} + +qreal AVAudioOutput::volume() const +{ + return m_volume; +} + +void AVAudioOutput::setVolume(qreal value) +{ + m_volume = value; + emit volumeChanged(value); +} + +int AVAudioOutput::outputDevice() const +{ + return 0; +} + +bool AVAudioOutput::setOutputDevice(int newDevice) +{ + return (newDevice == 0); +} diff --git a/src/plugins/platforms/uikit/phonon_av/avaudiooutput.h b/src/plugins/platforms/uikit/phonon_av/avaudiooutput.h new file mode 100644 index 0000000..4b08b06 --- /dev/null +++ b/src/plugins/platforms/uikit/phonon_av/avaudiooutput.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef AV_AUDIOOUTPUT_H +#define AV_AUDIOOUTPUT_H + +#include +#include + +class AVAudioOutput : public QObject, public Phonon::AudioOutputInterface +{ + Q_OBJECT + Q_INTERFACES(Phonon::AudioOutputInterface) +public: + AVAudioOutput(QObject *parent); + ~AVAudioOutput(); + + qreal volume() const; + void setVolume(qreal value); + int outputDevice() const; + bool setOutputDevice(int newDevice); + +Q_SIGNALS: + void audioDeviceFailed(); + void volumeChanged(qreal); +private: + qreal m_volume; +}; + +#endif // AV_AUDIOOUTPUT_H diff --git a/src/plugins/platforms/uikit/phonon_av/avbackend.cpp b/src/plugins/platforms/uikit/phonon_av/avbackend.cpp new file mode 100644 index 0000000..ba1f808 --- /dev/null +++ b/src/plugins/platforms/uikit/phonon_av/avbackend.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "avbackend.h" +#include "avaudiooutput.h" +#include "avmediaobject.h" + +#include +#include +#include +#include + +#include + +AVBackend::AVBackend(QObject *parent) + : QObject(parent) +{ +} + +AVBackend::~AVBackend() +{ +} + +QObject *AVBackend::createObject(BackendInterface::Class c, QObject *parent, const QList &args) +{ + Q_UNUSED(args); + switch (c) + { + case MediaObjectClass: + return new AVMediaObject(parent); + case AudioOutputClass: + return new AVAudioOutput(parent); + default: + return 0; + } +} + +QList AVBackend::objectDescriptionIndexes(Phonon::ObjectDescriptionType type) const +{ + if (type == Phonon::AudioOutputDeviceType) + return QList() << 0; + return QList(); +} + +QHash AVBackend::objectDescriptionProperties(Phonon::ObjectDescriptionType type, int index) const +{ + Q_UNUSED(index); + QHash r; + if (type == Phonon::AudioOutputDeviceType) + r["name"] = QLatin1String("AVAudioPlayer"); + return r; +} + +bool AVBackend::startConnectionChange(QSet connection) +{ + Q_UNUSED(connection) + return true; +} + +bool AVBackend::connectNodes(QObject *node1, QObject *node2) +{ + AVMediaObject *media = qobject_cast(node1); + AVAudioOutput *output = qobject_cast(node2); + if (media && output) + media->setAudioOutput(output); + return true; +} + +bool AVBackend::disconnectNodes(QObject *node1, QObject *node2) +{ + AVMediaObject *media = qobject_cast(node1); + AVAudioOutput *output = qobject_cast(node2); + if (media && output) + media->setAudioOutput(0); + return true; +} + +bool AVBackend::endConnectionChange(QSet connection) +{ + Q_UNUSED(connection) + return true; +} + +QStringList AVBackend::availableMimeTypes() const +{ + return QStringList(); +} + +Q_EXPORT_PLUGIN2(phonon_av, AVBackend) diff --git a/src/plugins/platforms/uikit/phonon_av/avbackend.h b/src/plugins/platforms/uikit/phonon_av/avbackend.h new file mode 100644 index 0000000..cfb1bfc --- /dev/null +++ b/src/plugins/platforms/uikit/phonon_av/avbackend.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef AV_BACKEND_H +#define AV_BACKEND_H + +#include +#include + +#include + +class AVAudioOutput; +class AVMediaObject; + +class AVBackend : public QObject, public Phonon::BackendInterface +{ + Q_OBJECT + Q_INTERFACES(Phonon::BackendInterface) +public: + AVBackend(QObject *parent = 0); + ~AVBackend(); + + QObject *createObject(Phonon::BackendInterface::Class, QObject *parent, const QList &args); + QList objectDescriptionIndexes(Phonon::ObjectDescriptionType type) const; + QHash objectDescriptionProperties(Phonon::ObjectDescriptionType type, int index) const; + + bool startConnectionChange(QSet connection); + bool connectNodes(QObject *node1, QObject *node2); + bool disconnectNodes(QObject *node1, QObject *node2); + bool endConnectionChange(QSet connection); + + QStringList availableMimeTypes() const; +}; + +#endif // AV_BACKEND_H diff --git a/src/plugins/platforms/uikit/phonon_av/avmediaobject.h b/src/plugins/platforms/uikit/phonon_av/avmediaobject.h new file mode 100644 index 0000000..0ca900e --- /dev/null +++ b/src/plugins/platforms/uikit/phonon_av/avmediaobject.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef AV_MEDIAOBJECT_H +#define AV_MEDIAOBJECT_H + +#include + +#include + +class AVAudioOutput; +class AVMediaObjectPrivate; + +using namespace Phonon; + +class AVMediaObject : public QObject, public Phonon::MediaObjectInterface +{ + Q_OBJECT + Q_INTERFACES(Phonon::MediaObjectInterface) + +public: + AVMediaObject(QObject *parent); + ~AVMediaObject(); + void play(); + void pause(); + void stop(); + void seek(qint64 milliseconds); + qint32 tickInterval() const; + void setTickInterval(qint32 newTickInterval); + bool hasVideo() const; + bool isSeekable() const; + qint64 currentTime() const; + Phonon::State state() const; + QString errorString() const; + Phonon::ErrorType errorType() const; + qint64 totalTime() const; + Phonon::MediaSource source() const; + void setSource(const Phonon::MediaSource &source); + void setNextSource(const Phonon::MediaSource &source); + + qint32 prefinishMark() const; + void setPrefinishMark(qint32 newPrefinishMark); + qint32 transitionTime() const; + void setTransitionTime(qint32); + +Q_SIGNALS: + void stateChanged(Phonon::State newstate, Phonon::State oldstate); + void totalTimeChanged(qint64 length); + void currentSourceChanged(const MediaSource&); + void aboutToFinish(); + void finished(); + //TODO + void tick(qint64 time); + +// unused + void seekableChanged(bool); + void hasVideoChanged(bool); + void bufferStatus(int); + void prefinishMarkReached(qint32); + void metaDataChanged(const QMultiMap &); + +public: + void setAudioOutput(AVAudioOutput *audioOutput); + void handlePlayerFinished(); + +private Q_SLOTS: + void setVolume(qreal newVolume); + +private: + void changeState(Phonon::State state); + bool checkPlayer() const; + + qint32 m_tickInterval; + Phonon::State m_state; + mutable QString m_errorString; + mutable Phonon::ErrorType m_errorType; + Phonon::MediaSource m_mediaSource; + + AVAudioOutput *m_output; + AVMediaObjectPrivate *d; +}; + +QT_END_NAMESPACE + +#endif // PHONON_MEDIAOBJECT_H diff --git a/src/plugins/platforms/uikit/phonon_av/avmediaobject.mm b/src/plugins/platforms/uikit/phonon_av/avmediaobject.mm new file mode 100644 index 0000000..39d062b --- /dev/null +++ b/src/plugins/platforms/uikit/phonon_av/avmediaobject.mm @@ -0,0 +1,298 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "avmediaobject.h" +#include "avaudiooutput.h" + +#include +#import +#import +#import + +@interface AudioPlayerDelegate : NSObject { + AVMediaObject *mediaObject; +} + +- (id)initWithMediaObject:(AVMediaObject *)obj; +- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag; + +@end + +@implementation AudioPlayerDelegate + +- (id)initWithMediaObject:(AVMediaObject *)obj +{ + if (self = [self init]) { + mediaObject = obj; + } + return self; +} + +- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag +{ + Q_UNUSED(flag) + Q_UNUSED(player) + mediaObject->handlePlayerFinished(); +} + +@end + +class AVMediaObjectPrivate { +public: + AVMediaObjectPrivate(AVMediaObject *parent) + : player(0) + { + delegate = [[AudioPlayerDelegate alloc] initWithMediaObject:parent]; + } + ~AVMediaObjectPrivate() + { + [delegate release]; + } + + AVAudioPlayer *player; + AudioPlayerDelegate *delegate; +}; + +AVMediaObject::AVMediaObject(QObject *parent) + : QObject(parent), + m_tickInterval(0), + m_state(Phonon::LoadingState), + m_errorType(Phonon::NoError), + m_output(0), + d(new AVMediaObjectPrivate(this)) +{ +} + +AVMediaObject::~AVMediaObject() +{ + if (m_state == Phonon::PlayingState) + stop(); + [d->player release]; + delete d; +} + +void AVMediaObject::changeState(Phonon::State state) +{ + if (m_state == state) + return; + Phonon::State oldState = m_state; + m_state = state; + emit stateChanged(m_state, oldState); +} + +bool AVMediaObject::checkPlayer() const +{ + if (!d->player) { + m_errorType = Phonon::NormalError; + m_errorString = tr("Media source has not been set."); + return false; + } + return true; +} + +void AVMediaObject::play() +{ + if (!checkPlayer()) + return; + if (![d->player play]) { + m_errorType = Phonon::NormalError; + m_errorString = tr("Failed to play media source."); + return; + } + changeState(Phonon::PlayingState); +} + +void AVMediaObject::pause() +{ + if (!checkPlayer()) + return; + [d->player pause]; + changeState(Phonon::PausedState); +} + +void AVMediaObject::stop() +{ + if (!checkPlayer()) + return; + [d->player stop]; + d->player.currentTime = 0; + changeState(Phonon::StoppedState); +} + +void AVMediaObject::seek(qint64 milliseconds) +{ + if (!checkPlayer()) + return; + d->player.currentTime = milliseconds/1000.; +} + +qint32 AVMediaObject::tickInterval() const +{ + return m_tickInterval; +} + +void AVMediaObject::setTickInterval(qint32 newTickInterval) +{ + m_tickInterval = newTickInterval; + //TODO +} + +bool AVMediaObject::hasVideo() const +{ + return false; +} + +bool AVMediaObject::isSeekable() const +{ + return true; +} + +qint64 AVMediaObject::currentTime() const +{ + if (!checkPlayer()) + return 0; + return (qint64)(d->player.currentTime * 1000); +} + +Phonon::State AVMediaObject::state() const +{ + return m_state; +} + +QString AVMediaObject::errorString() const +{ + return m_errorString; +} + +Phonon::ErrorType AVMediaObject::errorType() const +{ + return m_errorType; +} + +qint64 AVMediaObject::totalTime() const +{ + if (!checkPlayer()) + return 0; + return d->player.duration; +} + +Phonon::MediaSource AVMediaObject::source() const +{ + return m_mediaSource; +} + +void AVMediaObject::setSource(const Phonon::MediaSource &source) +{ + if (d->player) { + stop(); + [d->player release]; + d->player = 0; + } + m_mediaSource = source; + NSString *urlString = [NSString stringWithCString:source.url().toEncoded().constData() + encoding:NSASCIIStringEncoding]; + NSURL *url = [NSURL URLWithString:urlString]; + d->player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:NULL]; + if (!d->player) { + m_errorString = tr("Failed to create player for '%1'").arg(source.url().toString()); + changeState(Phonon::ErrorState); + return; + } + d->player.delegate = d->delegate; + [d->player prepareToPlay]; + changeState(Phonon::StoppedState); + emit currentSourceChanged(m_mediaSource); + emit totalTimeChanged((qint64)(d->player.duration * 1000)); +} + +void AVMediaObject::setNextSource(const Phonon::MediaSource &source) +{ + setSource(source); +} + +qint32 AVMediaObject::prefinishMark() const +{ + // not implemented + return 0; +} + +void AVMediaObject::setPrefinishMark(qint32) +{ + // not implemented +} + +qint32 AVMediaObject::transitionTime() const +{ + // not implemented + return 0; +} + +void AVMediaObject::setTransitionTime(qint32) +{ + // not implemented +} + +void AVMediaObject::setAudioOutput(AVAudioOutput *audioOutput) +{ + if (m_output) { + disconnect(m_output, SIGNAL(volumeChanged(qreal)), this, SLOT(setVolume(qreal))); + } + m_output = audioOutput; + if (m_output) { + connect(m_output, SIGNAL(volumeChanged(qreal)), this, SLOT(setVolume(qreal))); + setVolume(m_output->volume()); + } +} + +void AVMediaObject::setVolume(qreal newVolume) +{ + if (!d->player) // do nothing, will be set when player is created + return; + [d->player setVolume:qMin((float)1.0, (float)newVolume)]; +} + +void AVMediaObject::handlePlayerFinished() +{ + emit aboutToFinish(); + changeState(Phonon::StoppedState); + emit finished(); + NSLog(@"finished!"); +} diff --git a/src/plugins/platforms/uikit/phonon_av/phonon_av.pro b/src/plugins/platforms/uikit/phonon_av/phonon_av.pro new file mode 100644 index 0000000..05af5a3 --- /dev/null +++ b/src/plugins/platforms/uikit/phonon_av/phonon_av.pro @@ -0,0 +1,31 @@ +DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend +QT += phonon +TARGET = phonon_av +include(../../../qpluginbase.pri) + +DEFINES += PHONON_MAKE_QT_ONLY_BACKEND + +HEADERS += avaudiooutput.h \ + avbackend.h \ + avmediaobject.h + +SOURCES += avaudiooutput.cpp \ + avbackend.cpp + +OBJECTIVE_SOURCES += avmediaobject.mm + +LIBS += -framework AVFoundation + +target.path = $$[QT_INSTALL_PLUGINS]/phonon_backend +INSTALLS += target + + + + + + + + + + + diff --git a/src/plugins/platforms/uikit/platform.pro b/src/plugins/platforms/uikit/platform.pro new file mode 100644 index 0000000..273c00d --- /dev/null +++ b/src/plugins/platforms/uikit/platform.pro @@ -0,0 +1,27 @@ +TARGET = quikit +include(../../qpluginbase.pri) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +QT += opengl + +OBJECTIVE_SOURCES = main.mm \ + quikitintegration.mm \ + quikitwindow.mm \ + quikitscreen.mm \ + quikiteventloop.mm \ + quikitwindowsurface.mm + +OBJECTIVE_HEADERS = quikitintegration.h \ + quikitwindow.h \ + quikitscreen.h \ + quikiteventloop.h \ + quikitwindowsurface.h + +HEADERS = quikitsoftwareinputhandler.h + +#add libz for freetype. +LIBS += -lz + +include(../fontdatabases/genericunix/genericunix.pri) +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target diff --git a/src/plugins/platforms/uikit/uikit.pro b/src/plugins/platforms/uikit/uikit.pro index 273c00d..5cfd8b8 100644 --- a/src/plugins/platforms/uikit/uikit.pro +++ b/src/plugins/platforms/uikit/uikit.pro @@ -1,27 +1,2 @@ -TARGET = quikit -include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms - -QT += opengl - -OBJECTIVE_SOURCES = main.mm \ - quikitintegration.mm \ - quikitwindow.mm \ - quikitscreen.mm \ - quikiteventloop.mm \ - quikitwindowsurface.mm - -OBJECTIVE_HEADERS = quikitintegration.h \ - quikitwindow.h \ - quikitscreen.h \ - quikiteventloop.h \ - quikitwindowsurface.h - -HEADERS = quikitsoftwareinputhandler.h - -#add libz for freetype. -LIBS += -lz - -include(../fontdatabases/genericunix/genericunix.pri) -target.path += $$[QT_INSTALL_PLUGINS]/platforms -INSTALLS += target +TEMPLATE = subdirs +SUBDIRS += platform.pro phonon_av -- cgit v0.12 From 484f291ccc743e833abe620f3e61154ca7b5f610 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 26 Jul 2011 09:07:10 +0200 Subject: Remove debug output. --- src/plugins/platforms/uikit/phonon_av/avmediaobject.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/uikit/phonon_av/avmediaobject.mm b/src/plugins/platforms/uikit/phonon_av/avmediaobject.mm index 39d062b..388866f 100644 --- a/src/plugins/platforms/uikit/phonon_av/avmediaobject.mm +++ b/src/plugins/platforms/uikit/phonon_av/avmediaobject.mm @@ -294,5 +294,4 @@ void AVMediaObject::handlePlayerFinished() emit aboutToFinish(); changeState(Phonon::StoppedState); emit finished(); - NSLog(@"finished!"); } -- cgit v0.12 From 5c1ec4373f63045c4c56f748e47612b3bfc9ab88 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 22 Jul 2011 16:52:35 +0200 Subject: Revert "fix QFileInfo::isSymLink() for NTFS mount points" This reverts commit 70a434dc1c24f306805900b5ad7a45c7272702c6. --- src/corelib/io/qfilesystemmetadata_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h index de5b003..c961101 100644 --- a/src/corelib/io/qfilesystemmetadata_p.h +++ b/src/corelib/io/qfilesystemmetadata_p.h @@ -369,7 +369,8 @@ inline void QFileSystemMetaData::fillFromFindData(WIN32_FIND_DATA &findData, boo entryFlags &= ~LinkType; #if !defined(Q_OS_WINCE) if ((fileAttribute_ & FILE_ATTRIBUTE_REPARSE_POINT) - && (findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) { + && (findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK + || findData.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT)) { entryFlags |= LinkType; } #endif -- cgit v0.12 From d852e6164a4aaf8e235e97cba8f0e8e9b933987c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 15 Jul 2011 17:29:29 +0200 Subject: Properly resolve and use glMapBuffer / glUnmapBuffer on GLES2. Even though we're able to resolve the function pointers, the spec says we have to check for the GL_OES_mapbuffer extension before we use them. Fixes a crash on a platform that doesn't advertise the extension but still resolves the function pointers. Reviewed-by: Kim --- src/opengl/qglbuffer.cpp | 4 ++++ src/opengl/qglextensions.cpp | 33 ++++++++++++++++++++------------- src/opengl/qglextensions_p.h | 4 ++++ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp index a1ec3ef..b5c6b83 100644 --- a/src/opengl/qglbuffer.cpp +++ b/src/opengl/qglbuffer.cpp @@ -543,6 +543,10 @@ void *QGLBuffer::map(QGLBuffer::Access access) return 0; if (!glMapBufferARB) return 0; +#ifdef QT_OPENGL_ES_2 + if (access != QGLBuffer::WriteOnly) + return 0; +#endif return glMapBufferARB(d->type, access); } diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp index 98d2960..64f7526 100644 --- a/src/opengl/qglextensions.cpp +++ b/src/opengl/qglextensions.cpp @@ -191,23 +191,30 @@ bool qt_resolve_frag_program_extensions(QGLContext *ctx) bool qt_resolve_buffer_extensions(QGLContext *ctx) { + if (!QGLContextPrivate::extensionFuncs(ctx).qt_bufferFuncsResolved) { #if defined(QGL_RESOLVE_BUFFER_FUNCS) - if (glBindBuffer && glDeleteBuffers && glGenBuffers && glBufferData - && glBufferSubData && glGetBufferParameteriv) - return true; + glBindBuffer = (_glBindBuffer) qt_gl_getProcAddressARB(ctx, "glBindBuffer"); + glDeleteBuffers = (_glDeleteBuffers) qt_gl_getProcAddressARB(ctx, "glDeleteBuffers"); + glGenBuffers = (_glGenBuffers) qt_gl_getProcAddressARB(ctx, "glGenBuffers"); + glBufferData = (_glBufferData) qt_gl_getProcAddressARB(ctx, "glBufferData"); + glBufferSubData = (_glBufferSubData) qt_gl_getProcAddressARB(ctx, "glBufferSubData"); + glGetBufferSubData = (_glGetBufferSubData) qt_gl_getProcAddressARB(ctx, "glGetBufferSubData"); + glGetBufferParameteriv = (_glGetBufferParameteriv) qt_gl_getProcAddressARB(ctx, "glGetBufferParameteriv"); #endif -#if defined(QGL_RESOLVE_BUFFER_FUNCS) - glBindBuffer = (_glBindBuffer) qt_gl_getProcAddressARB(ctx, "glBindBuffer"); - glDeleteBuffers = (_glDeleteBuffers) qt_gl_getProcAddressARB(ctx, "glDeleteBuffers"); - glGenBuffers = (_glGenBuffers) qt_gl_getProcAddressARB(ctx, "glGenBuffers"); - glBufferData = (_glBufferData) qt_gl_getProcAddressARB(ctx, "glBufferData"); - glBufferSubData = (_glBufferSubData) qt_gl_getProcAddressARB(ctx, "glBufferSubData"); - glGetBufferSubData = (_glGetBufferSubData) qt_gl_getProcAddressARB(ctx, "glGetBufferSubData"); - glGetBufferParameteriv = (_glGetBufferParameteriv) qt_gl_getProcAddressARB(ctx, "glGetBufferParameteriv"); +#ifdef QT_OPENGL_ES_2 + QGLExtensionMatcher extensions; + if (extensions.match("GL_OES_mapbuffer")) { + glMapBufferARB = (_glMapBufferARB) qt_gl_getProcAddressARB(ctx, "glMapBufferOES"); + glUnmapBufferARB = (_glUnmapBufferARB) qt_gl_getProcAddressARB(ctx, "glUnmapBufferOES"); + } +#else + glMapBufferARB = (_glMapBufferARB) qt_gl_getProcAddressARB(ctx, "glMapBuffer"); + glUnmapBufferARB = (_glUnmapBufferARB) qt_gl_getProcAddressARB(ctx, "glUnmapBuffer"); #endif - glMapBufferARB = (_glMapBufferARB) qt_gl_getProcAddressARB(ctx, "glMapBuffer"); - glUnmapBufferARB = (_glUnmapBufferARB) qt_gl_getProcAddressARB(ctx, "glUnmapBuffer"); + + QGLContextPrivate::extensionFuncs(ctx).qt_bufferFuncsResolved = true; + } #if defined(QGL_RESOLVE_BUFFER_FUNCS) return glBindBuffer diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h index 98433c3..f85c89b 100644 --- a/src/opengl/qglextensions_p.h +++ b/src/opengl/qglextensions_p.h @@ -332,6 +332,8 @@ struct QGLExtensionFuncs qt_glMapBufferARB = 0; qt_glUnmapBufferARB = 0; + qt_bufferFuncsResolved = false; + qt_glProgramParameteriEXT = 0; qt_glFramebufferTextureEXT = 0; qt_glFramebufferTextureLayerEXT = 0; @@ -457,6 +459,8 @@ struct QGLExtensionFuncs _glMapBufferARB qt_glMapBufferARB; _glUnmapBufferARB qt_glUnmapBufferARB; + bool qt_bufferFuncsResolved; + // Geometry shaders... _glProgramParameteriEXT qt_glProgramParameteriEXT; _glFramebufferTextureEXT qt_glFramebufferTextureEXT; -- cgit v0.12 From 5842d19cf3dff37a85cbdb31ab5a170ceaf5c7fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 7 Jul 2011 10:51:52 +0200 Subject: Fixed holes in border image drawing by introducing new API. When rasterizing two adjacent QRectFs it's important that the shared x or y-edges have the exact same coordinates, or there might be a hole or an overlapping pixel when they are rasterized. Since the drawPixmapFragments API was based on a center position and a scale, it can not be used for this purpose, as the in the situation of two horizontally adjacent rectangles the right edge of the left-most rect and the left edge of the right-most edge are computed differently. Thus rounding errors can cause them to not be equal, especially when there's also a scaling / translating painter transform involved. Thus, to not sacrifice performance, we need to introduce a new drawPixmapFragments API that's simply takes an array of target rectangles and an array of source rectangles. It should give a slight performance boost for the border pixmap use case as well, since there are less floating point multiplications / divisions involved. Task-number: QTBUG-19079 Reviewed-by: Kim --- src/gui/painting/qdrawutil.cpp | 179 ++++++--------------- src/gui/painting/qemulationpaintengine.cpp | 41 +++++ src/gui/painting/qemulationpaintengine_p.h | 5 + src/gui/painting/qpaintengine_raster.cpp | 11 +- src/gui/painting/qpaintengineex.cpp | 16 ++ src/gui/painting/qpaintengineex_p.h | 4 +- src/gui/painting/qpainter.cpp | 46 ++++++ src/gui/painting/qpainter.h | 2 + .../gl2paintengineex/qpaintengineex_opengl2.cpp | 128 +++++++++++++-- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 10 +- 10 files changed, 294 insertions(+), 148 deletions(-) diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index 98294cb..1e98b05 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1084,7 +1084,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, according to the \a margins structure. */ -typedef QVarLengthArray QPixmapFragmentsArray; +typedef QVarLengthArray QRectFArray; /*! \since 4.6 @@ -1105,12 +1105,8 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin const QPixmap &pixmap, const QRect &sourceRect,const QMargins &sourceMargins, const QTileRules &rules, QDrawBorderPixmap::DrawingHints hints) { - QPainter::PixmapFragment d; - d.opacity = 1.0; - d.rotation = 0.0; - - QPixmapFragmentsArray opaqueData; - QPixmapFragmentsArray translucentData; + QRectFArray sourceData[2]; + QRectFArray targetData[2]; // source center const int sourceCenterTop = sourceRect.top() + sourceMargins.top(); @@ -1192,166 +1188,95 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin // corners if (targetMargins.top() > 0 && targetMargins.left() > 0 && sourceMargins.top() > 0 && sourceMargins.left() > 0) { // top left - d.x = (0.5 * (xTarget[1] + xTarget[0])); - d.y = (0.5 * (yTarget[1] + yTarget[0])); - d.sourceLeft = sourceRect.left(); - d.sourceTop = sourceRect.top(); - d.width = sourceMargins.left(); - d.height = sourceMargins.top(); - d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width; - d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height; - if (hints & QDrawBorderPixmap::OpaqueTopLeft) - opaqueData.append(d); - else - translucentData.append(d); + int index = bool(hints & QDrawBorderPixmap::OpaqueTopLeft); + sourceData[index].append(QRectF(sourceRect.topLeft(), QSizeF(sourceMargins.left(), sourceMargins.top()))); + targetData[index].append(QRectF(QPointF(xTarget[0], yTarget[0]), QPointF(xTarget[1], yTarget[1]))); } if (targetMargins.top() > 0 && targetMargins.right() > 0 && sourceMargins.top() > 0 && sourceMargins.right() > 0) { // top right - d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1])); - d.y = (0.5 * (yTarget[1] + yTarget[0])); - d.sourceLeft = sourceCenterRight; - d.sourceTop = sourceRect.top(); - d.width = sourceMargins.right(); - d.height = sourceMargins.top(); - d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width; - d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height; - if (hints & QDrawBorderPixmap::OpaqueTopRight) - opaqueData.append(d); - else - translucentData.append(d); + int index = bool(hints & QDrawBorderPixmap::OpaqueTopRight); + sourceData[index].append(QRectF(QPointF(sourceCenterRight, sourceRect.top()), QSizeF(sourceMargins.right(), sourceMargins.top()))); + targetData[index].append(QRectF(QPointF(xTarget[columns-1], yTarget[0]), QPointF(xTarget[columns], yTarget[1]))); } if (targetMargins.bottom() > 0 && targetMargins.left() > 0 && sourceMargins.bottom() > 0 && sourceMargins.left() > 0) { // bottom left - d.x = (0.5 * (xTarget[1] + xTarget[0])); - d.y =(0.5 * (yTarget[rows] + yTarget[rows - 1])); - d.sourceLeft = sourceRect.left(); - d.sourceTop = sourceCenterBottom; - d.width = sourceMargins.left(); - d.height = sourceMargins.bottom(); - d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width; - d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height; - if (hints & QDrawBorderPixmap::OpaqueBottomLeft) - opaqueData.append(d); - else - translucentData.append(d); + int index = bool(hints & QDrawBorderPixmap::OpaqueBottomLeft); + sourceData[index].append(QRectF(QPointF(sourceRect.left(), sourceCenterBottom), QSizeF(sourceMargins.left(), sourceMargins.bottom()))); + targetData[index].append(QRectF(QPointF(xTarget[0], yTarget[rows - 1]), QPointF(xTarget[1], yTarget[rows]))); } if (targetMargins.bottom() > 0 && targetMargins.right() > 0 && sourceMargins.bottom() > 0 && sourceMargins.right() > 0) { // bottom right - d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1])); - d.y = (0.5 * (yTarget[rows] + yTarget[rows - 1])); - d.sourceLeft = sourceCenterRight; - d.sourceTop = sourceCenterBottom; - d.width = sourceMargins.right(); - d.height = sourceMargins.bottom(); - d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width; - d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height; - if (hints & QDrawBorderPixmap::OpaqueBottomRight) - opaqueData.append(d); - else - translucentData.append(d); + int index = bool(hints & QDrawBorderPixmap::OpaqueBottomRight); + sourceData[index].append(QRectF(QPointF(sourceCenterRight, sourceCenterBottom), QSizeF(sourceMargins.right(), sourceMargins.bottom()))); + targetData[index].append(QRectF(QPointF(xTarget[columns - 1], yTarget[rows - 1]), QPointF(xTarget[columns], yTarget[rows]))); } // horizontal edges if (targetCenterWidth > 0 && sourceCenterWidth > 0) { if (targetMargins.top() > 0 && sourceMargins.top() > 0) { // top - QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueTop ? opaqueData : translucentData; - d.sourceLeft = sourceCenterLeft; - d.sourceTop = sourceRect.top(); - d.width = sourceCenterWidth; - d.height = sourceMargins.top(); - d.y = (0.5 * (yTarget[1] + yTarget[0])); - d.scaleX = dx / d.width; - d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height; + int index = bool(hints & QDrawBorderPixmap::OpaqueTop); for (int i = 1; i < columns - 1; ++i) { - d.x = (0.5 * (xTarget[i + 1] + xTarget[i])); - data.append(d); + if (rules.horizontal == Qt::RepeatTile && i == columns - 2) { + sourceData[index].append(QRectF(QPointF(sourceCenterLeft, sourceRect.top()), QSizeF(xTarget[i + 1] - xTarget[i], sourceMargins.top()))); + } else { + sourceData[index].append(QRectF(QPointF(sourceCenterLeft, sourceRect.top()), QSizeF(sourceCenterWidth, sourceMargins.top()))); + } + targetData[index].append(QRectF(QPointF(xTarget[i], yTarget[0]), QPointF(xTarget[i + 1], yTarget[1]))); } - if (rules.horizontal == Qt::RepeatTile) - data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX); } if (targetMargins.bottom() > 0 && sourceMargins.bottom() > 0) { // bottom - QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueBottom ? opaqueData : translucentData; - d.sourceLeft = sourceCenterLeft; - d.sourceTop = sourceCenterBottom; - d.width = sourceCenterWidth; - d.height = sourceMargins.bottom(); - d.y = (0.5 * (yTarget[rows] + yTarget[rows - 1])); - d.scaleX = dx / d.width; - d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height; + int index = bool(hints & QDrawBorderPixmap::OpaqueBottom); for (int i = 1; i < columns - 1; ++i) { - d.x = (0.5 * (xTarget[i + 1] + xTarget[i])); - data.append(d); + if (rules.horizontal == Qt::RepeatTile && i == columns - 2) { + sourceData[index].append(QRectF(QPointF(sourceCenterLeft, sourceCenterBottom), QSizeF(xTarget[i + 1] - xTarget[i], sourceMargins.bottom()))); + } else { + sourceData[index].append(QRectF(QPointF(sourceCenterLeft, sourceCenterBottom), QSizeF(sourceCenterWidth, sourceMargins.bottom()))); + } + targetData[index].append(QRectF(QPointF(xTarget[i], yTarget[rows - 1]), QPointF(xTarget[i + 1], yTarget[rows]))); } - if (rules.horizontal == Qt::RepeatTile) - data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX); } } // vertical edges if (targetCenterHeight > 0 && sourceCenterHeight > 0) { if (targetMargins.left() > 0 && sourceMargins.left() > 0) { // left - QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueLeft ? opaqueData : translucentData; - d.sourceLeft = sourceRect.left(); - d.sourceTop = sourceCenterTop; - d.width = sourceMargins.left(); - d.height = sourceCenterHeight; - d.x = (0.5 * (xTarget[1] + xTarget[0])); - d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width; - d.scaleY = dy / d.height; + int index = bool(hints & QDrawBorderPixmap::OpaqueLeft); for (int i = 1; i < rows - 1; ++i) { - d.y = (0.5 * (yTarget[i + 1] + yTarget[i])); - data.append(d); + if (rules.vertical == Qt::RepeatTile && i == rows - 2) { + sourceData[index].append(QRectF(QPointF(sourceRect.left(), sourceCenterTop), QSizeF(sourceMargins.left(), yTarget[i + 1] - yTarget[i]))); + } else { + sourceData[index].append(QRectF(QPointF(sourceRect.left(), sourceCenterTop), QSizeF(sourceMargins.left(), sourceCenterHeight))); + } + targetData[index].append(QRectF(QPointF(xTarget[0], yTarget[i]), QPointF(xTarget[1], yTarget[i + 1]))); } - if (rules.vertical == Qt::RepeatTile) - data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY); } if (targetMargins.right() > 0 && sourceMargins.right() > 0) { // right - QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueRight ? opaqueData : translucentData; - d.sourceLeft = sourceCenterRight; - d.sourceTop = sourceCenterTop; - d.width = sourceMargins.right(); - d.height = sourceCenterHeight; - d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1])); - d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width; - d.scaleY = dy / d.height; + int index = bool(hints & QDrawBorderPixmap::OpaqueRight); for (int i = 1; i < rows - 1; ++i) { - d.y = (0.5 * (yTarget[i + 1] + yTarget[i])); - data.append(d); + if (rules.vertical == Qt::RepeatTile && i == rows - 2) { + sourceData[index].append(QRectF(QPointF(sourceCenterRight, sourceCenterTop), QSizeF(sourceMargins.right(), yTarget[i + 1] - yTarget[i]))); + } else { + sourceData[index].append(QRectF(QPointF(sourceCenterRight, sourceCenterTop), QSizeF(sourceMargins.right(), sourceCenterHeight))); + } + targetData[index].append(QRectF(QPointF(xTarget[columns - 1], yTarget[i]), QPointF(xTarget[columns], yTarget[i + 1]))); } - if (rules.vertical == Qt::RepeatTile) - data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY); } } // center if (targetCenterWidth > 0 && targetCenterHeight > 0 && sourceCenterWidth > 0 && sourceCenterHeight > 0) { - QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueCenter ? opaqueData : translucentData; - d.sourceLeft = sourceCenterLeft; - d.sourceTop = sourceCenterTop; - d.width = sourceCenterWidth; - d.height = sourceCenterHeight; - d.scaleX = dx / d.width; - d.scaleY = dy / d.height; - - qreal repeatWidth = (xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX; - qreal repeatHeight = (yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY; - + int index = bool(hints & QDrawBorderPixmap::OpaqueCenter); for (int j = 1; j < rows - 1; ++j) { - d.y = (0.5 * (yTarget[j + 1] + yTarget[j])); + qreal sourceHeight = (rules.vertical == Qt::RepeatTile && j == rows - 2) ? yTarget[j + 1] - yTarget[j] : sourceCenterHeight; for (int i = 1; i < columns - 1; ++i) { - d.x = (0.5 * (xTarget[i + 1] + xTarget[i])); - data.append(d); + qreal sourceWidth = (rules.horizontal == Qt::RepeatTile && i == columns - 2) ? xTarget[i + 1] - xTarget[i] : sourceCenterWidth; + sourceData[index].append(QRectF(QPointF(sourceCenterLeft, sourceCenterTop), QSizeF(sourceWidth, sourceHeight))); + targetData[index].append(QRectF(QPointF(xTarget[i], yTarget[j]), QPointF(xTarget[i + 1], yTarget[j + 1]))); } - if (rules.horizontal == Qt::RepeatTile) - data[data.size() - 1].width = repeatWidth; - } - if (rules.vertical == Qt::RepeatTile) { - for (int i = 1; i < columns - 1; ++i) - data[data.size() - i].height = repeatHeight; } } - if (opaqueData.size()) - painter->drawPixmapFragments(opaqueData.data(), opaqueData.size(), pixmap, QPainter::OpaqueHint); - if (translucentData.size()) - painter->drawPixmapFragments(translucentData.data(), translucentData.size(), pixmap); + for (int i = 0; i < 2; ++i) { + if (sourceData[i].size()) + painter->drawPixmapFragments(targetData[i].data(), sourceData[i].data(), sourceData[i].size(), pixmap, i == 1 ? QPainter::OpaqueHint : QPainter::PixmapFragmentHint(0)); + } if (oldAA) painter->setRenderHint(QPainter::Antialiasing, true); diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp index 903ab1f..d7ad0f6 100644 --- a/src/gui/painting/qemulationpaintengine.cpp +++ b/src/gui/painting/qemulationpaintengine.cpp @@ -222,6 +222,47 @@ void QEmulationPaintEngine::drawImage(const QRectF &r, const QImage &pm, const Q real_engine->drawImage(r, pm, sr, flags); } +void QEmulationPaintEngine::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints) +{ + if (state()->bgMode == Qt::OpaqueMode && pixmap.isQBitmap()) { + qreal oldOpacity = real_engine->state()->opacity; + QTransform oldTransform = real_engine->state()->matrix; + + for (int i = 0; i < fragmentCount; ++i) { + QTransform transform = oldTransform; + transform.translate(fragments[i].x, fragments[i].y); + transform.rotate(fragments[i].rotation); + real_engine->state()->opacity = oldOpacity * fragments[i].opacity; + real_engine->state()->matrix = transform; + real_engine->opacityChanged(); + real_engine->transformChanged(); + + qreal w = fragments[i].scaleX * fragments[i].width; + qreal h = fragments[i].scaleY * fragments[i].height; + fillBGRect(QRectF(-0.5 * w, -0.5 * h, w, h)); + } + + real_engine->state()->opacity = oldOpacity; + real_engine->state()->matrix = oldTransform; + real_engine->opacityChanged(); + real_engine->transformChanged(); + } + + real_engine->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); +} + +void QEmulationPaintEngine::drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints) +{ + if (state()->bgMode == Qt::OpaqueMode && pixmap.isQBitmap()) { + for (int i = 0; i < fragmentCount; ++i) + fillBGRect(targetRects[i]); + } + + real_engine->drawPixmapFragments(targetRects, sourceRects, fragmentCount, pixmap, hints); +} + void QEmulationPaintEngine::clipEnabledChanged() { real_engine->clipEnabledChanged(); diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h index fdc3688..b4ed7e7 100644 --- a/src/gui/painting/qemulationpaintengine_p.h +++ b/src/gui/painting/qemulationpaintengine_p.h @@ -81,6 +81,11 @@ public: virtual void drawStaticTextItem(QStaticTextItem *item); virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags); + + virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints); + virtual void drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints); virtual void clipEnabledChanged(); virtual void penChanged(); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 626100a..d77ef82 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2396,12 +2396,13 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe d->image_filler_xform.setupMatrix(copy, s->flags.bilinear); if (!s->flags.antialiased && s->matrix.type() == QTransform::TxScale) { - QRectF rr = s->matrix.mapRect(r); + QPointF rr_tl = s->matrix.map(r.topLeft()); + QPointF rr_br = s->matrix.map(r.bottomRight()); - const int x1 = qRound(rr.x()); - const int y1 = qRound(rr.y()); - const int x2 = qRound(rr.right()); - const int y2 = qRound(rr.bottom()); + const int x1 = qRound(rr_tl.x()); + const int y1 = qRound(rr_tl.y()); + const int x2 = qRound(rr_br.x()); + const int y2 = qRound(rr_br.y()); fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler_xform, d); return; diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 5105d9a..6df410b 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -1003,6 +1003,22 @@ void QPaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragmen transformChanged(); } +void QPaintEngineEx::drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, + const QPixmap &pixmap, QPainter::PixmapFragmentHints /*hints*/) +{ + if (pixmap.isNull()) + return; + + if (sourceRects) { + for (int i = 0; i < fragmentCount; ++i) + drawPixmap(targetRects[i], pixmap, sourceRects[i]); + } else { + QRectF sourceRect = pixmap.rect(); + for (int i = 0; i < fragmentCount; ++i) + drawPixmap(targetRects[i], pixmap, sourceRect); + } +} + void QPaintEngineEx::setState(QPainterState *s) { QPaintEngine::state = s; diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index c605685..275a6e0 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -198,7 +198,9 @@ public: virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, - QFlags hints); + QPainter::PixmapFragmentHints hints); + virtual void drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints); virtual void updateState(const QPaintEngineState &state); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 1d10d75..8e64f3b 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -9248,6 +9248,52 @@ void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragment } /*! + \since 4.8 + + This function is used to draw the same \a pixmap with multiple target + and source rectangles. If \a sourceRects is 0, the whole pixmap will be + rendered at each of the target rectangles. The \a hints parameter can be + used to pass in drawing hints. + + This function is potentially faster than multiple calls to drawPixmap(), + since the backend can optimize state changes. + + \sa QPainter::PixmapFragmentHint +*/ + +void QPainter::drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, + const QPixmap &pixmap, PixmapFragmentHints hints) +{ + Q_D(QPainter); + + if (!d->engine || pixmap.isNull()) + return; + +#ifndef QT_NO_DEBUG + if (sourceRects) { + for (int i = 0; i < fragmentCount; ++i) { + QRectF sourceRect = sourceRects[i]; + if (!(QRectF(pixmap.rect()).contains(sourceRect))) + qWarning("QPainter::drawPixmapFragments - the source rect is not contained by the pixmap's rectangle"); + } + } +#endif + + if (d->engine->isExtended()) { + d->extended->drawPixmapFragments(targetRects, sourceRects, fragmentCount, pixmap, hints); + } else { + if (sourceRects) { + for (int i = 0; i < fragmentCount; ++i) + drawPixmap(targetRects[i], pixmap, sourceRects[i]); + } else { + QRectF sourceRect = pixmap.rect(); + for (int i = 0; i < fragmentCount; ++i) + drawPixmap(targetRects[i], pixmap, sourceRect); + } + } +} + +/*! \since 4.7 \class QPainter::PixmapFragment diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index 30f8da0..12a14a2 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -380,6 +380,8 @@ public: void drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, PixmapFragmentHints hints = 0); + void drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, + const QPixmap &pixmap, PixmapFragmentHints hints = 0); void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags = Qt::AutoColor); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 0d2f2a2..a961366 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -651,7 +651,7 @@ void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) if (newMode == mode) return; - if (mode == TextDrawingMode || mode == ImageDrawingMode || mode == ImageArrayDrawingMode) { + if (mode == TextDrawingMode || imageDrawingMode) { lastTextureUsed = GLuint(-1); } @@ -661,14 +661,21 @@ void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) shaderManager->setHasComplexGeometry(false); } + imageDrawingMode = false; + if (newMode == ImageDrawingMode) { setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, staticTextureCoordinateArray); + imageDrawingMode = true; } - if (newMode == ImageArrayDrawingMode) { + if (newMode == ImageArrayDrawingMode || newMode == ImageArrayWithOpacityDrawingMode) { setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); + imageDrawingMode = true; + } + + if (newMode == ImageArrayWithOpacityDrawingMode) { setVertexAttributePointer(QT_OPACITY_ATTR, (GLfloat*)opacityArray.data()); } @@ -1096,7 +1103,7 @@ void QGL2PaintEngineExPrivate::resetClipIfNeeded() bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) { - if (brushTextureDirty && mode != ImageDrawingMode && mode != ImageArrayDrawingMode) + if (brushTextureDirty && !imageDrawingMode) updateBrushTexture(); if (compositionModeDirty) @@ -1116,12 +1123,12 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) } QGLEngineShaderManager::OpacityMode opacityMode; - if (mode == ImageArrayDrawingMode) { + if (mode == ImageArrayWithOpacityDrawingMode) { opacityMode = QGLEngineShaderManager::AttributeOpacity; } else { opacityMode = stateHasOpacity ? QGLEngineShaderManager::UniformOpacity : QGLEngineShaderManager::NoOpacity; - if (stateHasOpacity && (mode != ImageDrawingMode)) { + if (stateHasOpacity && !imageDrawingMode) { // Using a brush bool brushIsPattern = (currentBrush.style() >= Qt::Dense1Pattern) && (currentBrush.style() <= Qt::DiagCrossPattern); @@ -1141,7 +1148,7 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) matrixUniformDirty = true; } - if (brushUniformsDirty && mode != ImageDrawingMode && mode != ImageArrayDrawingMode) + if (brushUniformsDirty && !imageDrawingMode) updateBrushUniforms(); if (opacityMode == QGLEngineShaderManager::UniformOpacity && opacityUniformDirty) { @@ -1881,23 +1888,46 @@ void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *frag return; } + QSize size = pixmap.size(); + ensureActive(); int max_texture_size = d->ctx->d_func()->maxTextureSize(); - if (pixmap.width() > max_texture_size || pixmap.height() > max_texture_size) { + if (size.width() > max_texture_size || size.height() > max_texture_size) { QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); - d->drawPixmapFragments(fragments, fragmentCount, scaled, hints); + d->drawPixmapFragments(fragments, fragmentCount, scaled, size, hints); } else { - d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); + d->drawPixmapFragments(fragments, fragmentCount, pixmap, size, hints); } } +void QGL2PaintEngineEx::drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints) +{ + Q_D(QGL2PaintEngineEx); + // Use fallback for extended composition modes. + if (state()->composition_mode > QPainter::CompositionMode_Plus) { + QPaintEngineEx::drawPixmapFragments(targetRects, sourceRects, fragmentCount, pixmap, hints); + return; + } + + QSize size = pixmap.size(); + + ensureActive(); + int max_texture_size = d->ctx->d_func()->maxTextureSize(); + if (size.width() > max_texture_size || size.height() > max_texture_size) { + QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); + d->drawPixmapFragments(targetRects, sourceRects, fragmentCount, scaled, size, hints); + } else { + d->drawPixmapFragments(targetRects, sourceRects, fragmentCount, pixmap, size, hints); + } +} void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, - QPainter::PixmapFragmentHints hints) + const QSize &size, QPainter::PixmapFragmentHints hints) { - GLfloat dx = 1.0f / pixmap.size().width(); - GLfloat dy = 1.0f / pixmap.size().height(); + GLfloat dx = 1.0f / size.width(); + GLfloat dy = 1.0f / size.height(); vertexCoordinateArray.clear(); textureCoordinateArray.clear(); @@ -1958,7 +1988,7 @@ void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragmen data[i].y = 1 - data[i].y; } - transferMode(ImageArrayDrawingMode); + transferMode(allOpaque ? ImageArrayDrawingMode : ImageArrayWithOpacityDrawingMode); bool isBitmap = pixmap.isQBitmap(); bool isOpaque = !isBitmap && (!pixmap.hasAlpha() || (hints & QPainter::OpaqueHint)) && allOpaque; @@ -1981,6 +2011,77 @@ void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragmen glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount); } +void QGL2PaintEngineExPrivate::drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, + const QPixmap &pixmap, const QSize &size, + QPainter::PixmapFragmentHints hints) +{ + GLfloat dx = 1.0f / size.width(); + GLfloat dy = 1.0f / size.height(); + + vertexCoordinateArray.clear(); + textureCoordinateArray.clear(); + + if (snapToPixelGrid) { + snapToPixelGrid = false; + matrixDirty = true; + } + + for (int i = 0; i < fragmentCount; ++i) { + vertexCoordinateArray.addVertex(targetRects[i].right(), targetRects[i].bottom()); + vertexCoordinateArray.addVertex(targetRects[i].right(), targetRects[i].top()); + vertexCoordinateArray.addVertex(targetRects[i].left(), targetRects[i].top()); + vertexCoordinateArray.addVertex(targetRects[i].left(), targetRects[i].top()); + vertexCoordinateArray.addVertex(targetRects[i].left(), targetRects[i].bottom()); + vertexCoordinateArray.addVertex(targetRects[i].right(), targetRects[i].bottom()); + + QRectF sourceRect = sourceRects ? sourceRects[i] : QRectF(0, 0, size.width(), size.height()); + + QGLRect src(sourceRect.left() * dx, sourceRect.top() * dy, + sourceRect.right() * dx, sourceRect.bottom() * dy); + + textureCoordinateArray.addVertex(src.right, src.bottom); + textureCoordinateArray.addVertex(src.right, src.top); + textureCoordinateArray.addVertex(src.left, src.top); + textureCoordinateArray.addVertex(src.left, src.top); + textureCoordinateArray.addVertex(src.left, src.bottom); + textureCoordinateArray.addVertex(src.right, src.bottom); + } + + glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); + QGLTexture *texture = ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption + | QGLContext::CanFlipNativePixmapBindOption); + + if (texture->options & QGLContext::InvertedYBindOption) { + // Flip texture y-coordinate. + QGLPoint *data = textureCoordinateArray.data(); + for (int i = 0; i < 6 * fragmentCount; ++i) + data[i].y = 1 - data[i].y; + } + + transferMode(ImageArrayDrawingMode); + + bool isBitmap = pixmap.isQBitmap(); + bool isOpaque = !isBitmap && (!pixmap.hasAlpha() || (hints & QPainter::OpaqueHint)); + + updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, + q->state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); + + // Setup for texture drawing + currentBrush = noBrush; + shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc + : QGLEngineShaderManager::ImageSrc); + if (prepareForDraw(isOpaque)) + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT); + + if (isBitmap) { + QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); + } + + glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount); +} + bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) { Q_D(QGL2PaintEngineEx); @@ -2001,6 +2102,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) d->width = sz.width(); d->height = sz.height(); d->mode = BrushDrawingMode; + d->imageDrawingMode = false; d->brushTextureDirty = true; d->brushUniformsDirty = true; d->matrixUniformDirty = true; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 2895d5a..80daf63 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -68,7 +68,8 @@ enum EngineMode { ImageDrawingMode, TextDrawingMode, BrushDrawingMode, - ImageArrayDrawingMode + ImageArrayDrawingMode, + ImageArrayWithOpacityDrawingMode }; QT_BEGIN_NAMESPACE @@ -126,6 +127,8 @@ public: virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints); + virtual void drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints); virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags = Qt::AutoColor); virtual void drawTextItem(const QPointF &p, const QTextItem &textItem); @@ -202,7 +205,9 @@ public: void fill(const QVectorPath &path); void stroke(const QVectorPath &path, const QPen &pen); void drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false); - void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, + void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, const QSize &size, + QPainter::PixmapFragmentHints hints); + void drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap, const QSize &size, QPainter::PixmapFragmentHints hints); void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem); @@ -255,6 +260,7 @@ public: int width, height; QGLContext *ctx; EngineMode mode; + bool imageDrawingMode; QFontEngineGlyphCache::Type glyphCacheType; // Dirty flags -- cgit v0.12 From c5eaa8ce8df78de97e2d148af247865dfdee3e90 Mon Sep 17 00:00:00 2001 From: Nikolaos Korkakakis Date: Tue, 26 Jul 2011 10:58:46 +0200 Subject: Fix the compilation error when QT_NO_PLUGIN_CHECK was set. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 1307 Reviewed-by: Samuel Rødal --- src/corelib/plugin/qlibrary.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 314ccd7..f1ed8e4 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -649,7 +649,12 @@ bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt #else szData = pfn(); #endif - return qt_parse_pattern(szData, qt_version, debug, key); + +#ifdef QT_NO_PLUGIN_CHECK + return true; +#else + return qt_parse_pattern(szData, qt_version, debug, key); +#endif } bool QLibraryPrivate::isPlugin(QSettings *settings) -- cgit v0.12 From 2fa986aa670bee0fafb30241f40bb3556594e32b Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 26 Jul 2011 16:03:37 +0200 Subject: Include trailing space width in RTL text line width Task-number: QTBUG-15511 Reviewed-by: Eskil --- src/gui/text/qtextlayout.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 3f0b9e8..05b1d08 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1917,8 +1917,12 @@ found: if (line.textWidth > 0 && item < eng->layoutData->items.size()) eng->maxWidth += lbh.spaceData.textWidth; - if (eng->option.flags() & QTextOption::IncludeTrailingSpaces) + // In the latter case, text are drawn with trailing spaces at the beginning + // of a line, so the naturalTextWidth should contain the space width + if ((eng->option.flags() & QTextOption::IncludeTrailingSpaces) || + (line.width == QFIXED_MAX && eng->isRightToLeft())) { line.textWidth += lbh.spaceData.textWidth; + } if (lbh.spaceData.length) { line.length += lbh.spaceData.length; line.hasTrailingSpaces = true; -- cgit v0.12 From 07565b925cb92f9d28ae4586f112e0ed52d2c451 Mon Sep 17 00:00:00 2001 From: Nikolaos Korkakakis Date: Tue, 26 Jul 2011 16:32:46 +0200 Subject: OpenVG cleanup. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes needed to reflect the updates in the QWindowSurface. Merge-request: 1309 Reviewed-by: Samuel Rødal --- src/openvg/qwindowsurface_vg.cpp | 7 +++++++ src/openvg/qwindowsurface_vg_p.h | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp index 778e14c..2935316 100644 --- a/src/openvg/qwindowsurface_vg.cpp +++ b/src/openvg/qwindowsurface_vg.cpp @@ -93,10 +93,17 @@ void QVGWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoin d_ptr->endPaint(parent, region); } +#if !defined(Q_WS_QPA) void QVGWindowSurface::setGeometry(const QRect &rect) { QWindowSurface::setGeometry(rect); } +#else +void QVGWindowSurface::resize(const QSize &size) +{ + QWindowSurface::resize(size); +} +#endif //!Q_WS_QPA bool QVGWindowSurface::scroll(const QRegion &area, int dx, int dy) { diff --git a/src/openvg/qwindowsurface_vg_p.h b/src/openvg/qwindowsurface_vg_p.h index 4ce73eb..b5c6da3 100644 --- a/src/openvg/qwindowsurface_vg_p.h +++ b/src/openvg/qwindowsurface_vg_p.h @@ -70,7 +70,13 @@ public: QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + +#if !defined(Q_WS_QPA) void setGeometry(const QRect &rect); +#else + void resize(const QSize &size); +#endif + bool scroll(const QRegion &area, int dx, int dy); void beginPaint(const QRegion ®ion); -- cgit v0.12 From 0b16c7a8a5522e3bc7414130dc609763bc2f4e3d Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 26 Jul 2011 15:14:20 +0200 Subject: Fix typo. Reviewed-by: TrustMe --- tools/macdeployqt/shared/shared.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/macdeployqt/shared/shared.cpp b/tools/macdeployqt/shared/shared.cpp index c411683..74dd4a4 100644 --- a/tools/macdeployqt/shared/shared.cpp +++ b/tools/macdeployqt/shared/shared.cpp @@ -350,18 +350,18 @@ DeploymentInfo deployQtFrameworks(QList frameworks, LogNormal(); LogNormal() << "Deploying Qt frameworks found inside:" << binaryPath; QStringList copiedFrameworks; - DeploymentInfo deploymenInfo; + DeploymentInfo deploymentInfo; while (frameworks.isEmpty() == false) { const FrameworkInfo framework = frameworks.takeFirst(); copiedFrameworks.append(framework.frameworkName); // Get the qt path from one of the Qt frameworks; - if (deploymenInfo.qtPath.isNull() && framework.frameworkName.contains("Qt") + if (deploymentInfo.qtPath.isNull() && framework.frameworkName.contains("Qt") && framework.frameworkDirectory.contains("/lib")) { - deploymenInfo.qtPath = framework.frameworkDirectory; - deploymenInfo.qtPath.chop(5); // remove "/lib/" + deploymentInfo.qtPath = framework.frameworkDirectory; + deploymentInfo.qtPath.chop(5); // remove "/lib/" } if (framework.installName.startsWith("/@executable_path/")) { @@ -394,8 +394,8 @@ DeploymentInfo deployQtFrameworks(QList frameworks, } } } - deploymenInfo.deployedFrameworks = copiedFrameworks; - return deploymenInfo; + deploymentInfo.deployedFrameworks = copiedFrameworks; + return deploymentInfo; } DeploymentInfo deployQtFrameworks(const QString &appBundlePath, bool useDebugLibs) -- cgit v0.12 From 2ccef4f57f036a486cb96904298a8b4673ff0aec Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 26 Jul 2011 16:00:58 +0200 Subject: Guard macdeployqt against @rpath and @loader_path too. Reviewed-by: TrustMe --- tools/macdeployqt/shared/shared.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/macdeployqt/shared/shared.cpp b/tools/macdeployqt/shared/shared.cpp index 74dd4a4..bb37f0b 100644 --- a/tools/macdeployqt/shared/shared.cpp +++ b/tools/macdeployqt/shared/shared.cpp @@ -111,7 +111,7 @@ FrameworkInfo parseOtoolLibraryLine(const QString &line, bool useDebugLibs) // Don't deploy system libraries. if (trimmed.startsWith("/System/Library/") || (trimmed.startsWith("/usr/lib/") && trimmed.contains("libQt") == false) // exception for libQtuitools and libQtlucene - || trimmed.startsWith("@executable_path")) + || trimmed.startsWith("@executable_path") || trimmed.startsWith("@loader_path") || trimmed.startsWith("@rpath")) return info; enum State {QtPath, FrameworkName, DylibName, Version, End}; @@ -238,7 +238,7 @@ QList getQtFrameworks(const QString &path, bool useDebugLibs) QStringList outputLines = output.split("\n"); outputLines.removeFirst(); // remove line containing the binary path if (path.contains(".framework") || path.contains(".dylib")) - outputLines.removeFirst(); // frameworks and dylibs lists themselves as a dependency. + outputLines.removeFirst(); // frameworks and dylibs print install name of themselves first. return getQtFrameworks(outputLines, useDebugLibs); } -- cgit v0.12 From 4bda273330f6705b79cf18c3ea8ef294f58a5239 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 26 Jul 2011 17:03:03 +0200 Subject: Make mac(deploy|change)qt handle dylibs that use Qt inside an app bundle. Needed e.g. for Qt Creator, which is a bundle of plugins. Reviewed-by: TrustMe --- tools/macdeployqt/shared/shared.cpp | 67 ++++++++++++++++++++++++++++--------- tools/macdeployqt/shared/shared.h | 5 +-- 2 files changed, 54 insertions(+), 18 deletions(-) diff --git a/tools/macdeployqt/shared/shared.cpp b/tools/macdeployqt/shared/shared.cpp index bb37f0b..30c493f 100644 --- a/tools/macdeployqt/shared/shared.cpp +++ b/tools/macdeployqt/shared/shared.cpp @@ -84,6 +84,7 @@ inline QDebug operator<<(QDebug debug, const ApplicationBundleInfo &info) { debug << "Application bundle path" << info.path << "\n"; debug << "Binary path" << info.binaryPath << "\n"; + debug << "Additional libraries" << info.libraryPaths << "\n"; return debug; } @@ -208,6 +209,21 @@ QString findAppBinary(const QString &appBundlePath) return QString(); } +QStringList findAppLibraries(const QString &appBundlePath) +{ + QStringList result; + // dylibs + QDirIterator iter(appBundlePath, QStringList() << QString::fromLatin1("*.dylib"), + QDir::Files, QDirIterator::Subdirectories); + + while (iter.hasNext()) { + iter.next(); + result << iter.fileInfo().filePath(); + } + return result; +} + + QList getQtFrameworks(const QStringList &otoolLines, bool useDebugLibs) { QList libraries; @@ -243,6 +259,21 @@ QList getQtFrameworks(const QString &path, bool useDebugLibs) return getQtFrameworks(outputLines, useDebugLibs); } +QList getQtFrameworksForPaths(const QStringList &paths, bool useDebugLibs) +{ + QList result; + QSet existing; + foreach (const QString &path, paths) { + foreach (const FrameworkInfo &info, getQtFrameworks(path, useDebugLibs)) { + if (!existing.contains(info.frameworkPath)) { // avoid duplicates + existing.insert(info.frameworkPath); + result << info; + } + } + } + return result; +} + // copies everything _inside_ sourcePath to destinationPath void recursiveCopy(const QString &sourcePath, const QString &destinationPath) { @@ -312,13 +343,14 @@ void changeIdentification(const QString &id, const QString &binaryPath) runInstallNameTool(QStringList() << "-id" << id << binaryPath); } -void changeInstallName(const QString &oldName, const QString &newName, const QString &binaryPath) +void changeInstallName(const QString &oldName, const QString &newName, const QStringList &binaryPaths) { LogDebug() << "Using install_name_tool:"; - LogDebug() << " in" << binaryPath; + LogDebug() << " in" << binaryPaths; LogDebug() << " change reference" << oldName; LogDebug() << " to" << newName; - runInstallNameTool(QStringList() << "-change" << oldName << newName << binaryPath); + foreach (const QString &path, binaryPaths) + runInstallNameTool(QStringList() << "-change" << oldName << newName << path); } void runStrip(const QString &binaryPath) @@ -345,10 +377,10 @@ void runStrip(const QString &binaryPath) a list of actually deployed frameworks. */ DeploymentInfo deployQtFrameworks(QList frameworks, - const QString &bundlePath, const QString &binaryPath, bool useDebugLibs) + const QString &bundlePath, const QStringList &binaryPaths, bool useDebugLibs) { LogNormal(); - LogNormal() << "Deploying Qt frameworks found inside:" << binaryPath; + LogNormal() << "Deploying Qt frameworks found inside:" << binaryPaths; QStringList copiedFrameworks; DeploymentInfo deploymentInfo; @@ -370,7 +402,7 @@ DeploymentInfo deployQtFrameworks(QList frameworks, } // Install_name_tool the new id into the binary - changeInstallName(framework.installName, framework.deployedInstallName, binaryPath); + changeInstallName(framework.installName, framework.deployedInstallName, binaryPaths); // Copy farmework to app bundle. const QString deployedBinaryPath = copyFramework(framework, bundlePath); @@ -386,7 +418,7 @@ DeploymentInfo deployQtFrameworks(QList frameworks, QList dependencies = getQtFrameworks(deployedBinaryPath, useDebugLibs); foreach (FrameworkInfo dependency, dependencies) { - changeInstallName(dependency.installName, dependency.deployedInstallName, deployedBinaryPath); + changeInstallName(dependency.installName, dependency.deployedInstallName, QStringList() << deployedBinaryPath); // Deploy framework if necessary. if (copiedFrameworks.contains(dependency.frameworkName) == false && frameworks.contains(dependency) == false) { @@ -403,7 +435,9 @@ DeploymentInfo deployQtFrameworks(const QString &appBundlePath, bool useDebugLib ApplicationBundleInfo applicationBundle; applicationBundle.path = appBundlePath; applicationBundle.binaryPath = findAppBinary(appBundlePath); - QList frameworks = getQtFrameworks(applicationBundle.binaryPath, useDebugLibs); + applicationBundle.libraryPaths = findAppLibraries(appBundlePath); + QStringList allBinaryPaths = QStringList() << applicationBundle.binaryPath << applicationBundle.libraryPaths; + QList frameworks = getQtFrameworksForPaths(allBinaryPaths, useDebugLibs); if (frameworks.isEmpty()) { LogWarning(); LogWarning() << "Could not find any external Qt frameworks to deploy in" << appBundlePath; @@ -411,7 +445,7 @@ DeploymentInfo deployQtFrameworks(const QString &appBundlePath, bool useDebugLib LogWarning() << "If so, you will need to rebuild" << appBundlePath << "before trying again."; return DeploymentInfo(); } else { - return deployQtFrameworks(frameworks, applicationBundle.path, applicationBundle.binaryPath, useDebugLibs); + return deployQtFrameworks(frameworks, applicationBundle.path, allBinaryPaths, useDebugLibs); } } @@ -477,11 +511,11 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl if (pluginName.contains("libphonon_qt7")) { changeInstallName("/System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo", "/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore", - destinationPath); + QStringList() << destinationPath); } QList frameworks = getQtFrameworks(destinationPath, useDebugLibs); - deployQtFrameworks(frameworks, appBundleInfo.path, destinationPath, useDebugLibs); + deployQtFrameworks(frameworks, appBundleInfo.path, QStringList() << destinationPath, useDebugLibs); } } // foreach plugins @@ -527,9 +561,9 @@ void deployPlugins(const QString &appBundlePath, DeploymentInfo deploymentInfo, } -void changeQtFrameworks(const QList frameworks, const QString &appBinaryPath, const QString &absoluteQtPath) +void changeQtFrameworks(const QList frameworks, const QStringList &binaryPaths, const QString &absoluteQtPath) { - LogNormal() << "Changing" << appBinaryPath << "to link against"; + LogNormal() << "Changing" << binaryPaths << "to link against"; LogNormal() << "Qt in" << absoluteQtPath; QString finalQtPath = absoluteQtPath; @@ -539,21 +573,22 @@ void changeQtFrameworks(const QList frameworks, const QString &ap foreach (FrameworkInfo framework, frameworks) { const QString oldBinaryId = framework.installName; const QString newBinaryId = finalQtPath + framework.frameworkName + framework.binaryPath; - changeInstallName(oldBinaryId, newBinaryId, appBinaryPath); + changeInstallName(oldBinaryId, newBinaryId, binaryPaths); } } void changeQtFrameworks(const QString appPath, const QString &qtPath, bool useDebugLibs) { const QString appBinaryPath = findAppBinary(appPath); - const QList frameworks = getQtFrameworks(appBinaryPath, useDebugLibs); + const QStringList libraryPaths = findAppLibraries(appPath); + const QList frameworks = getQtFrameworksForPaths(QStringList() << appBinaryPath << libraryPaths, useDebugLibs); if (frameworks.isEmpty()) { LogWarning(); LogWarning() << "Could not find any _external_ Qt frameworks to change in" << appPath; return; } else { const QString absoluteQtPath = QDir(qtPath).absolutePath(); - changeQtFrameworks(frameworks, appBinaryPath, absoluteQtPath); + changeQtFrameworks(frameworks, QStringList() << appBinaryPath << libraryPaths, absoluteQtPath); } } diff --git a/tools/macdeployqt/shared/shared.h b/tools/macdeployqt/shared/shared.h index 5eec3cf..ab9ada2 100644 --- a/tools/macdeployqt/shared/shared.h +++ b/tools/macdeployqt/shared/shared.h @@ -77,6 +77,7 @@ class ApplicationBundleInfo public: QString path; QString binaryPath; + QStringList libraryPaths; }; class DeploymentInfo @@ -91,7 +92,7 @@ public: inline QDebug operator<<(QDebug debug, const ApplicationBundleInfo &info); void changeQtFrameworks(const QString appPath, const QString &qtPath, bool useDebugLibs); -void changeQtFrameworks(const QList frameworks, const QString &appBinaryPath, const QString &qtPath); +void changeQtFrameworks(const QList frameworks, const QStringList &binaryPaths, const QString &qtPath); FrameworkInfo parseOtoolLibraryLine(const QString &line, bool useDebugLibs); QString findAppBinary(const QString &appBundlePath); @@ -103,7 +104,7 @@ DeploymentInfo deployQtFrameworks(QList frameworks, const QString void createQtConf(const QString &appBundlePath); void deployPlugins(const QString &appBundlePath, DeploymentInfo deploymentInfo, bool useDebugLibs); void changeIdentification(const QString &id, const QString &binaryPath); -void changeInstallName(const QString &oldName, const QString &newName, const QString &binaryPath); +void changeInstallName(const QString &oldName, const QString &newName, const QStringList &binaryPaths); QString findAppBinary(const QString &appBundlePath); void createDiskImage(const QString &appBundlePath); -- cgit v0.12 From 80c5ea1a99e0c7794245e53175c949597315c96f Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 27 Jul 2011 13:47:17 +0200 Subject: Document support for Linguist on Mac. Fixes dragging documents on Linguist dock icon, double clicking document in Finder, and the "open" terminal command. Task-number: QTBUG-20194 Reviewed-by: Oswald Buddenhagen --- tools/linguist/linguist/Info_mac.plist | 60 ++++++++++++++++++++++++++++++++++ tools/linguist/linguist/main.cpp | 58 ++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) diff --git a/tools/linguist/linguist/Info_mac.plist b/tools/linguist/linguist/Info_mac.plist index b11f493..b37a43b 100644 --- a/tools/linguist/linguist/Info_mac.plist +++ b/tools/linguist/linguist/Info_mac.plist @@ -14,5 +14,65 @@ ???? CFBundleExecutable Linguist + + CFBundleDocumentTypes + + + CFBundleTypeRole + Editor + CFBundleTypeIconFile + linguist.icns + CFBundleTypeExtensions + + qph + + CFBundleTypeName + Qt Linguist 'Phrase Book' + LSHandlerRank + Default + + + CFBundleTypeRole + Editor + CFBundleTypeIconFile + linguist.icns + CFBundleTypeExtensions + + ts + + CFBundleTypeName + Qt Translation Source + LSHandlerRank + Default + + + CFBundleTypeRole + Editor + CFBundleTypeIconFile + linguist.icns + CFBundleTypeExtensions + + po + + CFBundleTypeName + GNU Gettext Localization File + LSHandlerRank + Default + + + CFBundleTypeRole + Editor + CFBundleTypeIconFile + linguist.icns + CFBundleTypeExtensions + + xlf + + CFBundleTypeName + XLIFF Localization File + LSHandlerRank + Default + + diff --git a/tools/linguist/linguist/main.cpp b/tools/linguist/linguist/main.cpp index a137f36..ba45613 100644 --- a/tools/linguist/linguist/main.cpp +++ b/tools/linguist/linguist/main.cpp @@ -54,8 +54,54 @@ #include #include +#ifdef Q_WS_MAC +#include +#include +#endif // Q_WS_MAC + QT_USE_NAMESPACE +#ifdef Q_WS_MAC +class ApplicationEventFilter : public QObject +{ + Q_OBJECT + +public: + ApplicationEventFilter() + : m_mainWindow(0) + { + } + + void setMainWindow(MainWindow *mw) + { + m_mainWindow = mw; + if (!m_filesToOpen.isEmpty() && m_mainWindow) { + m_mainWindow->openFiles(m_filesToOpen); + m_filesToOpen.clear(); + } + } + +protected: + bool eventFilter(QObject *object, QEvent *event) + { + if (object == qApp && event->type() == QEvent::FileOpen) { + QFileOpenEvent *e = static_cast(event); + QString file = e->url().toLocalFile(); + if (!m_mainWindow) + m_filesToOpen << file; + else + m_mainWindow->openFiles(QStringList() << file); + return true; + } + return QObject::eventFilter(object, event); + } + +private: + MainWindow *m_mainWindow; + QStringList m_filesToOpen; +}; +#endif // Q_WS_MAC + int main(int argc, char **argv) { Q_INIT_RESOURCE(linguist); @@ -63,6 +109,11 @@ int main(int argc, char **argv) QApplication app(argc, argv); QApplication::setOverrideCursor(Qt::WaitCursor); +#ifdef Q_WS_MAC + ApplicationEventFilter eventFilter; + app.installEventFilter(&eventFilter); +#endif // Q_WS_MAC + QStringList files; QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); QStringList args = app.arguments(); @@ -111,6 +162,9 @@ int main(int argc, char **argv) splash->show(); MainWindow mw; +#ifdef Q_WS_MAC + eventFilter.setMainWindow(&mw); +#endif // Q_WS_MAC mw.show(); splash->finish(&mw); QApplication::restoreOverrideCursor(); @@ -119,3 +173,7 @@ int main(int argc, char **argv) return app.exec(); } + +#ifdef Q_WS_MAC +#include "main.moc" +#endif // Q_WS_MAC -- cgit v0.12 From 3a66c5da851223cb4017d69ef3cca7d3818431c7 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 29 Jul 2011 10:40:47 +0200 Subject: Make macdeployqt more robust against usage of symbolic links. If binaries linked against Versions/Current *and* a specific version, the framework's binary would be copied twice, leading to duplicate symbols exceptions. Instead we now check for that condition and replicate the symbolic link. Reviewed-by: TrustMe --- tools/macdeployqt/shared/shared.cpp | 45 ++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/tools/macdeployqt/shared/shared.cpp b/tools/macdeployqt/shared/shared.cpp index 30c493f..1a9a6ab 100644 --- a/tools/macdeployqt/shared/shared.cpp +++ b/tools/macdeployqt/shared/shared.cpp @@ -72,7 +72,7 @@ QDebug operator<<(QDebug debug, const FrameworkInfo &info) debug << "Install name" << info.installName << "\n"; debug << "Deployed install name" << info.deployedInstallName << "\n"; debug << "Source file Path" << info.sourceFilePath << "\n"; - debug << "Deployed Directory (relative to bundle)" << info.destinationDirectory << "\n"; + debug << "Destination Directory (relative to bundle)" << info.destinationDirectory << "\n"; return debug; } @@ -295,32 +295,51 @@ void recursiveCopy(const QString &sourcePath, const QString &destinationPath) QString copyFramework(const FrameworkInfo &framework, const QString path) { QString from = framework.sourceFilePath; - QString toDir = path + "/" + framework.destinationDirectory; - QString to = toDir + "/" + framework.binaryName; - if (QFile::exists(from) == false) { + if (!QFile::exists(from)) { LogError() << "no file at" << from; return QString(); } + QFileInfo fromDirInfo(framework.frameworkPath + QLatin1Char('/') + + framework.binaryDirectory); + bool fromDirIsSymLink = fromDirInfo.isSymLink(); + QString unresolvedToDir = path + "/" + framework.destinationDirectory; + QString resolvedToDir; + QString relativeLinkTarget; // will contain the link from Current to e.g. 4 in the Versions directory + if (fromDirIsSymLink) { + // handle the case where framework is referenced with Versions/Current + // which is a symbolic link, so copy to target and recreate as symbolic link + relativeLinkTarget = QDir(fromDirInfo.canonicalPath()) + .relativeFilePath(QFileInfo(fromDirInfo.symLinkTarget()).canonicalFilePath()); + resolvedToDir = QFileInfo(unresolvedToDir).path() + QLatin1Char('/') + relativeLinkTarget; + } else { + resolvedToDir = unresolvedToDir; + } + QString to = resolvedToDir + "/" + framework.binaryName; + + // create the (non-symlink) dir QDir dir; - if (dir.mkpath(toDir) == false) { + if (!dir.mkpath(resolvedToDir)) { LogError() << "could not create destination directory" << to; return QString(); } + if (!QFile::exists(to)) { // copy the binary and resources if that wasn't done before + copyFilePrintStatus(from, to); - if (QFile::exists(to)) { - return QString(); + const QString resourcesSourcePath = framework.frameworkPath + "/Resources"; + const QString resourcesDestianationPath = path + "/Contents/Frameworks/" + framework.frameworkName + "/Resources"; + recursiveCopy(resourcesSourcePath, resourcesDestianationPath); } - copyFilePrintStatus(from, to); - - const QString resourcesSourcePath = framework.frameworkPath + "/Resources"; - const QString resourcesDestianationPath = path + "/Contents/Frameworks/" + framework.frameworkName + "/Resources"; - recursiveCopy(resourcesSourcePath, resourcesDestianationPath); - + // create the Versions/Current symlink dir if necessary + if (fromDirIsSymLink) { + QFile::link(relativeLinkTarget, unresolvedToDir); + LogNormal() << " linked:" << unresolvedToDir; + LogNormal() << " to" << resolvedToDir << "(" << relativeLinkTarget << ")"; + } return to; } -- cgit v0.12 From df3f763920b1450733817596148e087d11c0c543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mill=C3=A1n=20Soto?= Date: Fri, 29 Jul 2011 10:35:54 -0700 Subject: Call QAccessible::updateAccessibility when a widget is deleted Merge-request: 1310 Reviewed-by: Frederik Gladhorn --- src/gui/kernel/qwidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index a2109b4..0dd6cfe 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1670,6 +1670,10 @@ QWidget::~QWidget() if (!d->children.isEmpty()) d->deleteChildren(); +#ifndef QT_NOACCESSIBILITY + QAccessible::updateAccessibility(this, 0, QAccessible::ObjectDestroyed); +#endif + QApplication::removePostedEvents(this); QT_TRY { -- cgit v0.12 From eaf3b5ff76e4866ef3597110c6e565305c3298ad Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 29 Jul 2011 14:43:01 -0700 Subject: Fix typo for ifdef QT_NO_ACCESSIBILITY Reviewed-by: TrustMe --- src/gui/kernel/qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 0dd6cfe..ad8fbb7 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1670,7 +1670,7 @@ QWidget::~QWidget() if (!d->children.isEmpty()) d->deleteChildren(); -#ifndef QT_NOACCESSIBILITY +#ifndef QT_NO_ACCESSIBILITY QAccessible::updateAccessibility(this, 0, QAccessible::ObjectDestroyed); #endif -- cgit v0.12 From 9d674794b60a07850e8c3123ebb18f023f7134e9 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 22 Jul 2011 16:52:35 +0200 Subject: Revert "fix QFileInfo::isSymLink() for NTFS mount points" This reverts commit 70a434dc1c24f306805900b5ad7a45c7272702c6. --- src/corelib/io/qfilesystemmetadata_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h index de5b003..c961101 100644 --- a/src/corelib/io/qfilesystemmetadata_p.h +++ b/src/corelib/io/qfilesystemmetadata_p.h @@ -369,7 +369,8 @@ inline void QFileSystemMetaData::fillFromFindData(WIN32_FIND_DATA &findData, boo entryFlags &= ~LinkType; #if !defined(Q_OS_WINCE) if ((fileAttribute_ & FILE_ATTRIBUTE_REPARSE_POINT) - && (findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) { + && (findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK + || findData.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT)) { entryFlags |= LinkType; } #endif -- cgit v0.12 From 31f7ecbdcdbafbac5bbfa693e4d060757244941b Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 2 Aug 2011 16:09:24 +0200 Subject: QLabel documentation: add warning about sanitizing input make users more aware of QLabel guessing the text format. Reviewed-by: Gabriel de Dietrich --- src/gui/widgets/qlabel.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index 26dd0e1..7a94f42 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -88,6 +88,13 @@ QT_BEGIN_NAMESPACE by clear(). \endtable + \warning When passing a QString to the constructor or calling setText(), + make sure to sanitize your input, as QLabel tries to guess whether it + displays the text as plain text or as rich text. You may want to call + setTextFormat() explicitly, e.g. in case you expect the text to be in + plain format but cannot control the text source (for instance when + displaying data loaded from the Web). + When the content is changed using any of these functions, any previous content is cleared. -- cgit v0.12