From 529b648ece265f30784dadb96624e94b4ced5aba Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 28 Apr 2013 13:50:47 +0200 Subject: Fix possible race in QMutex As described in the QTBUG-30872, there may be a race condition involving 3 threads fighting for a mutex. I am surprised it was not caught before despite all the Q_ASSERT and the stress test in tst_qmutex. We do not need to call store(0) because the unlocking thread will eventually remove the BigNumber flag. And perhaps it even did it already, and another thread has incremented waiters (hence the Q_ASSERT is wrong) Here is a paste of part of the description from the bug report: --- many threads, one of them is ready to release mutex, while at least two other trying to acquire it d->waiters is 0 Thread 1 release mutex in unlockInternal: if (d->waiters.fetchAndAddRelease(-QMutexPrivate::BigNumber) == 0) d->waiters is now -QMutexPrivate::BigNumber Thread 2 try to acquire mutex in lockInternal: old_waiters = d->waiters.load(); if (old_waiters == -QMutexPrivate::BigNumber) { if (d_ptr.testAndSetAcquire(d, dummyLocked())) { It acquire 'about to release mutex' by changing d to dummyLocked Thread 1 continue release procedure: d->derefWaiters(0); d->waiters is now back to 0 Thread 3 try to acquire mutex in lockInternal: while (!d->waiters.testAndSetRelaxed(old_waiters, old_waiters + 1)); d->waiters is now 1 Thread 2 continue its dummy lock: d->waiters.store(0); d->waiters is force to 0 Thread 3 continue wait procedure but it realize that mutex was already unlocked so decrease back waiters if (d != d_ptr.loadAcquire()) { if (old_waiters != QMutexPrivate::BigNumber) { d->waiters.deref(); d->waiters became negative value of -1 Neither thread need internal data so it is released back to pool The waiters counter in released internal structure is still -1 --- Change-Id: I1b22555db764482775db6e64a8c9ffa9e1ab0cf6 Task-number: QTBUG-30872 Reviewed-by: Thiago Macieira --- src/corelib/thread/qmutex.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index 45e52d7b85..1ed4a77950 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -467,8 +467,6 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT // we try to acquire the mutex by changing to dummyLocked() if (d_ptr.testAndSetAcquire(d, dummyLocked())) { // Mutex acquired - Q_ASSERT(d->waiters.load() == -QMutexPrivate::BigNumber || d->waiters.load() == 0); - d->waiters.store(0); d->deref(); return true; } else { -- cgit v1.2.3 From 694559a201d1820c5427f7cc44401ba8d8ef7c12 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 26 Apr 2013 17:04:14 +0200 Subject: uclibc/pcre: Fix the linking of libQtCore for mips/uclibc The mips/uclibc features.h of the toolchain used by a former key account of PSO is defining both __USE_XOPEN2K and __USE_BSD this will lead to POSIX_MADV_* and MADV_* being defined while only the symbols for madvise are present. Change the order to make it link. Change-Id: If324b978d72ad2b37b8cd624562e81503c9465d4 Reviewed-by: Rafael Roquetto Reviewed-by: Andreas Holzammer Reviewed-by: Giuseppe D'Angelo --- src/3rdparty/pcre/sljit/sljitUtils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/pcre/sljit/sljitUtils.c b/src/3rdparty/pcre/sljit/sljitUtils.c index 1f023fa644..b29b4036b3 100644 --- a/src/3rdparty/pcre/sljit/sljitUtils.c +++ b/src/3rdparty/pcre/sljit/sljitUtils.c @@ -315,12 +315,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw SLJIT_CALL sljit_stack_resize(struct sljit_sta aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align; aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align; /* If madvise is available, we release the unnecessary space. */ -#if defined(POSIX_MADV_DONTNEED) - if (aligned_new_limit < aligned_old_limit) - posix_madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, POSIX_MADV_DONTNEED); -#elif defined(MADV_DONTNEED) +#if defined(MADV_DONTNEED) if (aligned_new_limit < aligned_old_limit) madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, MADV_DONTNEED); +#elif defined(POSIX_MADV_DONTNEED) + if (aligned_new_limit < aligned_old_limit) + posix_madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, POSIX_MADV_DONTNEED); #endif stack->limit = new_limit; return 0; -- cgit v1.2.3 From d59e9af592114f07e470dccbc92f5bb9e9cef2ab Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 29 Apr 2013 12:46:17 +0200 Subject: Make sure window is updated on resize event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After 475d1ed4f6a21686828fbd018542b469a8b2dbcd in qtdeclarative, orientation changes on Android were broken, because the resize event no longer implicitly causes an expose event. So we need to post both when doing the resize. Task-number: QTBUG-30909 Change-Id: I87c8c38e14d96a03b3409ef6439c3ac6ef432005 Reviewed-by: Samuel Rødal --- src/plugins/platforms/eglfs/qeglfswindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index ebf8e4af85..cd92a07f00 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -131,6 +131,7 @@ void QEglFSWindow::setGeometry(const QRect &) QRect rect(screen()->availableGeometry()); QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(window(), rect); + QWindowSystemInterface::handleExposeEvent(window(), QRegion(rect)); } void QEglFSWindow::setWindowState(Qt::WindowState) -- cgit v1.2.3 From b27e922e1c74f467843b7b8a01c2229b0fee5367 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Mon, 29 Apr 2013 12:13:11 +0200 Subject: test: Mark tst_menubar::task256322_highlight as XFAIL This test is unstable on Mac OS 10.7 with developer builds, so marking it as XFAIL if it happens to fail. Task-number: QTBUG-30565 Change-Id: If7094c3b19299f0dbe57cb82a8614032a75573d8 Reviewed-by: Friedemann Kleint Reviewed-by: Iikka Eklund --- tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index d1e6693608..e7450fdd2c 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -1184,7 +1184,12 @@ void tst_QMenuBar::task256322_highlight() QTest::mouseMove(win.menuBar(), nothingCenter); QTRY_VERIFY(!menu2.isVisible()); QVERIFY(!menu.isVisible()); - QCOMPARE(win.menuBar()->activeAction(), nothing); + QAction *activeAction = win.menuBar()->activeAction(); +#ifdef Q_OS_MAC + if ((QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) && (activeAction != nothing)) + QEXPECT_FAIL("", "QTBUG-30565: Unstable test", Continue); +#endif + QCOMPARE(activeAction, nothing); QTest::mouseRelease(win.menuBar(), Qt::LeftButton, 0, nothingCenter); } -- cgit v1.2.3 From 699e44ac03b9898020245b815f81d577fde63216 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 26 Apr 2013 11:36:23 +0200 Subject: fix quoting issues in vcxproj generator Fix passing of preprocessor definitions with double quotes to the resource compiler and to MIDL. Both have a different escaping mechanism then the C/C++ compiler tool. This fixes a regression introduced in 9e9911715c37511ece018aa9d36491b77872501b. Task-number: QTBUG-30859 Change-Id: Ifa041df407030320847373a5964a547c39dd5439 Reviewed-by: Oswald Buddenhagen Reviewed-by: Joerg Bornemann --- qmake/generators/win32/msbuild_objectmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 3e56911a38..c88f4e136f 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -1534,7 +1534,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCMIDLTool &tool) << attrTagL(_LocaleID, tool.LocaleID, /*ifNot*/ -1) << attrTagT(_MkTypLibCompatible, tool.MkTypLibCompatible) << attrTagS(_OutputDirectory, tool.OutputDirectory) - << attrTagX(_PreprocessorDefinitions, unquote(tool.PreprocessorDefinitions), ";") + << attrTagX(_PreprocessorDefinitions, tool.PreprocessorDefinitions, ";") << attrTagS(_ProxyFileName, tool.ProxyFileName) << attrTagS(_RedirectOutputAndErrors, tool.RedirectOutputAndErrors) << attrTagS(_ServerStubFile, tool.ServerStubFile) @@ -1619,7 +1619,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCResourceCompilerTool &tool) << attrTagS(_Culture, toString(tool.Culture)) << attrTagT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) //unused << attrTagT(_NullTerminateStrings, tool.NullTerminateStrings) - << attrTagX(_PreprocessorDefinitions, unquote(tool.PreprocessorDefinitions), ";") + << attrTagX(_PreprocessorDefinitions, tool.PreprocessorDefinitions, ";") << attrTagS(_ResourceOutputFileName, tool.ResourceOutputFileName) << attrTagT(_ShowProgress, toTriState(tool.ShowProgress)) << attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner) -- cgit v1.2.3 From 62eb4d7f3d8557fb4545b251b12d87679062cbaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 29 Apr 2013 14:19:45 +0200 Subject: iOS: Don't resize backing store twice in beginPaint() The first call to resize() was a left-over from before we had retina-support. Change-Id: I637e8d40f443f81fe7cfc367650bb28b917da2bc Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosbackingstore.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm index f3c1af2b2d..6007e247f0 100644 --- a/src/plugins/platforms/ios/qiosbackingstore.mm +++ b/src/plugins/platforms/ios/qiosbackingstore.mm @@ -74,7 +74,6 @@ void QIOSBackingStore::beginPaint(const QRegion &) m_context->makeCurrent(window()); - static_cast(paintDevice())->setSize(window()->size()); QIOSWindow *iosWindow = static_cast(window()->handle()); static_cast(paintDevice())->setSize(window()->size() * iosWindow->devicePixelRatio()); } -- cgit v1.2.3 From 586fb6d6320a28b0573ffb6bf14dcc140d677c0c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 27 Apr 2013 20:33:59 -0700 Subject: Add some extra tests for QString::arg Test locale-based formatting of numbers when we pass field width, base and fill characters. This now tests the fact that we replace a '0' for the locale's zero character. Change-Id: Ib872a592fd9a754e3ef11495a9497a6947056631 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Olivier Goffart --- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 0a1af0a058..e7ad52a257 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -4082,8 +4082,22 @@ void tst_QString::arg() QCOMPARE( QString("%2 %L1").arg(12345.6789).arg(12345.6789), QString("12345.7 12.345,7") ); + QCOMPARE( QString("[%2] [%L1]").arg(12345.6789, 9).arg(12345.6789, 9), + QString("[ 12345.7] [ 12.345,7]") ); + QCOMPARE( QString("[%2] [%L1]").arg(12345.6789, 9, 'g', 7).arg(12345.6789, 9, 'g', 7), + QString("[ 12345.68] [12.345,68]") ); + QCOMPARE( QString("[%2] [%L1]").arg(12345.6789, 10, 'g', 7, QLatin1Char('0')).arg(12345.6789, 10, 'g', 7, QLatin1Char('0')), + QString("[0012345.68] [012.345,68]") ); + QCOMPARE( QString("%2 %L1").arg(123456789).arg(123456789), QString("123456789 123.456.789") ); + QCOMPARE( QString("[%2] [%L1]").arg(123456789, 12).arg(123456789, 12), + QString("[ 123456789] [ 123.456.789]") ); + QCOMPARE( QString("[%2] [%L1]").arg(123456789, 13, 10, QLatin1Char('0')).arg(123456789, 12, 10, QLatin1Char('0')), + QString("[000123456789] [00123.456.789]") ); + QCOMPARE( QString("[%2] [%L1]").arg(123456789, 13, 16, QLatin1Char('0')).arg(123456789, 12, 16, QLatin1Char('0')), + QString("[0000075bcd15] [00000075bcd15]") ); + QCOMPARE( QString("%L2 %L1 %3").arg(12345.7).arg(123456789).arg('c'), QString("123.456.789 12.345,7 c") ); @@ -4125,6 +4139,14 @@ void tst_QString::arg() QCOMPARE(QString("%1").arg(1000., 3, 'g', -1, QChar('x')), QString("1000")); QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar('x')), QString("x-1")); QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar('x')), QString("-100")); + + QLocale::setDefault(QString("ar")); + QCOMPARE( QString("%L1").arg(12345.6789, 10, 'g', 7, QLatin1Char('0')), + QString::fromUtf8("\xd9\xa0\xd9\xa1\xd9\xa2\xd9\xac\xd9\xa3\xd9\xa4\xd9\xa5\xd9\xab\xd9\xa6\xd9\xa8") ); // "٠١٢٬٣٤٥٫٦٨" + QCOMPARE( QString("%L1").arg(123456789, 13, 10, QLatin1Char('0')), + QString("\xd9\xa0\xd9\xa0\xd9\xa1\xd9\xa2\xd9\xa3\xd9\xac\xd9\xa4\xd9\xa5\xd9\xa6\xd9\xac\xd9\xa7\xd9\xa8\xd9\xa9") ); // ٠٠١٢٣٬٤٥٦٬٧٨٩ + + QLocale::setDefault(QLocale::system()); } void tst_QString::number() -- cgit v1.2.3 From bf9ae9018e063e3f002588e31b1b4f9f66926408 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Fri, 29 Mar 2013 12:43:38 +0800 Subject: Doc: Give C++ class lists consistent titles The majority format is " C++ Classes" (see http://qt-project.org/doc/qt-5.0/qtdoc/modules-cpp.html) Also, fix a broken link (Qt Network C++ Classes) " C++ API" is perhaps the more correct format, but that's part of a much bigger cleanup: QTBUG-30556 Change-Id: I753365e2bec8d85d9a5f686b4aa35c9eeeaf0871 Reviewed-by: Jerome Pasion --- src/concurrent/doc/src/qtconcurrent-module.qdoc | 2 +- src/corelib/doc/src/qtcore-index.qdoc | 2 +- src/network/doc/src/network-programming.qdoc | 2 +- src/opengl/doc/src/qtopengl-index.qdoc | 2 +- src/opengl/doc/src/qtopengl-module.qdoc | 2 +- src/sql/doc/qtsql.qdocconf | 2 +- src/sql/doc/src/qtsql.qdoc | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/concurrent/doc/src/qtconcurrent-module.qdoc b/src/concurrent/doc/src/qtconcurrent-module.qdoc index 51721d916f..2144c2661a 100644 --- a/src/concurrent/doc/src/qtconcurrent-module.qdoc +++ b/src/concurrent/doc/src/qtconcurrent-module.qdoc @@ -27,7 +27,7 @@ /*! \module QtConcurrent - \title Qt Concurrent C++ classes + \title Qt Concurrent C++ Classes \brief The Qt Concurrent module contains functionality to support concurrent execution of program code \ingroup modules diff --git a/src/corelib/doc/src/qtcore-index.qdoc b/src/corelib/doc/src/qtcore-index.qdoc index 148dd68f55..9568ea9f8e 100644 --- a/src/corelib/doc/src/qtcore-index.qdoc +++ b/src/corelib/doc/src/qtcore-index.qdoc @@ -103,7 +103,7 @@ \section1 Reference These are links to the API reference materials. \list - \li \l{Qt Core C++ Classes}{C++ classes} + \li \l{Qt Core C++ Classes}{C++ Classes} \list \li \l{Animation Framework}{Animation Classes} \li \l{Threading Classes} diff --git a/src/network/doc/src/network-programming.qdoc b/src/network/doc/src/network-programming.qdoc index f236948b57..821b0ada15 100644 --- a/src/network/doc/src/network-programming.qdoc +++ b/src/network/doc/src/network-programming.qdoc @@ -51,7 +51,7 @@ \section1 Qt's Classes for Network Programming - The \l{Qt Network - C++ Classes} page contains a list of the C++ classes + The \l{Qt Network C++ Classes} page contains a list of the C++ classes in Qt Network. \section1 High Level Network Operations for HTTP and FTP diff --git a/src/opengl/doc/src/qtopengl-index.qdoc b/src/opengl/doc/src/qtopengl-index.qdoc index 94109aa706..fc131c4b17 100644 --- a/src/opengl/doc/src/qtopengl-index.qdoc +++ b/src/opengl/doc/src/qtopengl-index.qdoc @@ -67,6 +67,6 @@ OpenGL module can take advantage of the whole Qt API for non-OpenGL-specific GUI functionality. - The \l{Qt OpenGL C++ classes} page gives an overview over the available classes + The \l{Qt OpenGL C++ Classes} page gives an overview over the available classes int this module. */ diff --git a/src/opengl/doc/src/qtopengl-module.qdoc b/src/opengl/doc/src/qtopengl-module.qdoc index e75eb49447..9c15a54428 100644 --- a/src/opengl/doc/src/qtopengl-module.qdoc +++ b/src/opengl/doc/src/qtopengl-module.qdoc @@ -27,7 +27,7 @@ /*! \module QtOpenGL - \title Qt OpenGL C++ classes + \title Qt OpenGL C++ Classes \ingroup modules \ingroup technology-apis diff --git a/src/sql/doc/qtsql.qdocconf b/src/sql/doc/qtsql.qdocconf index e53bd50b55..c2686079d5 100644 --- a/src/sql/doc/qtsql.qdocconf +++ b/src/sql/doc/qtsql.qdocconf @@ -21,7 +21,7 @@ qhp.QtSql.customFilters.Qt.filterAttributes = qtsql $QT_VERSION qhp.QtSql.subprojects = classes qhp.QtSql.subprojects.classes.title = C++ Classes -qhp.QtSql.subprojects.classes.indexTitle = Qt SQL Module C++ Classes +qhp.QtSql.subprojects.classes.indexTitle = Qt SQL C++ Classes qhp.QtSql.subprojects.classes.selectors = class fake:headerfile qhp.QtSql.subprojects.classes.sortPages = true tagfile = ../../../doc/qtsql/qtsql.tags diff --git a/src/sql/doc/src/qtsql.qdoc b/src/sql/doc/src/qtsql.qdoc index 15b8603a66..8ce981756a 100644 --- a/src/sql/doc/src/qtsql.qdoc +++ b/src/sql/doc/src/qtsql.qdoc @@ -54,13 +54,13 @@ \section1 Reference These are links to the API reference materials. \list - \li \l{Qt SQL Module C++ Classes}{C++ classes} + \li \l{Qt SQL C++ Classes}{C++ Classes} \endlist */ /*! \module QtSql - \title Qt SQL Module C++ Classes + \title Qt SQL C++ Classes \ingroup modules \brief Provides a driver layer, SQL API layer, and a user interface layer for SQL databases. -- cgit v1.2.3 From 7375c06328f10071b1628874c96ed13142031dd7 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Wed, 24 Apr 2013 10:48:06 +0200 Subject: Doc: Zooming inside QTextEdit One can zoom in/out text inside a QTextEdit when the widget is read-only or when using the zoomIn/zoomOut functions. Zooming inside a HTML document only works if the font-style is not set to a fixed size inside the document though. Adding this information to the documentation. Change-Id: I66a62da53827e1ce3241ba16b91e86926b97c297 Reviewed-by: Jerome Pasion Reviewed-by: Frederik Gladhorn --- src/widgets/widgets/qtextedit.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index bf2c8a4495..4b3bf6de65 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -445,6 +445,8 @@ void QTextEditPrivate::_q_ensureVisible(const QRectF &_rect) example, the documentTitle() function will return the text from within HTML \c{} tags. + \note Zooming into HTML documents only works if the font-size is not set to a fixed size. + \section1 Using QTextEdit as an Editor All the information about using QTextEdit as a display widget also -- cgit v1.2.3 From dc5a579a163f53fc7ae443fb2b9eef8c4edd66fa Mon Sep 17 00:00:00 2001 From: Caroline Chao <caroline.chao@digia.com> Date: Tue, 23 Apr 2013 23:37:58 +0200 Subject: QPlainTextEdit: add missing feature zoom on Ctrl+Wheel When the control is read only. This is documented but not implemented. Add functions to zoomIn and zoomOut. Task-number: QTBUG-30845 Change-Id: I692b5f8cc5791498d34d35ea3dafa18b6e5d3e65 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> --- src/widgets/widgets/qplaintextedit.cpp | 46 ++++++++++++++++++++++++++++++++++ src/widgets/widgets/qplaintextedit.h | 3 +++ 2 files changed, 49 insertions(+) diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 95271adeb0..5a8da45a88 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -2223,11 +2223,57 @@ void QPlainTextEdit::changeEvent(QEvent *e) #ifndef QT_NO_WHEELEVENT void QPlainTextEdit::wheelEvent(QWheelEvent *e) { + Q_D(QPlainTextEdit); + if (!(d->control->textInteractionFlags() & Qt::TextEditable)) { + if (e->modifiers() & Qt::ControlModifier) { + const int delta = e->delta(); + if (delta < 0) + zoomOut(); + else if (delta > 0) + zoomIn(); + return; + } + } QAbstractScrollArea::wheelEvent(e); updateMicroFocus(); } #endif +/*! + \fn QPlainTextEdit::zoomIn(int range) + + Zooms in on the text by making the base font size \a range + points larger and recalculating all font sizes to be the new size. + This does not change the size of any images. + + \sa zoomOut() +*/ +void QPlainTextEdit::zoomIn(int range) +{ + QFont f = font(); + const int newSize = f.pointSize() + range; + if (newSize <= 0) + return; + f.setPointSize(newSize); + setFont(f); +} + +/*! + \fn QPlainTextEdit::zoomOut(int range) + + \overload + + Zooms out on the text by making the base font size \a range points + smaller and recalculating all font sizes to be the new size. This + does not change the size of any images. + + \sa zoomIn() +*/ +void QPlainTextEdit::zoomOut(int range) +{ + zoomIn(-range); +} + #ifndef QT_NO_CONTEXTMENU /*! This function creates the standard context menu which is shown when the user clicks on the line edit with the right mouse diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h index 42e8288cf3..81548818ef 100644 --- a/src/widgets/widgets/qplaintextedit.h +++ b/src/widgets/widgets/qplaintextedit.h @@ -202,6 +202,9 @@ public Q_SLOTS: void centerCursor(); + void zoomIn(int range = 1); + void zoomOut(int range = 1); + Q_SIGNALS: void textChanged(); void undoAvailable(bool b); -- cgit v1.2.3 From 124da0f5e6733b0f9f87367306c6d7c0b9513685 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge <shawn.rutledge@digia.com> Date: Tue, 30 Apr 2013 10:59:15 +0200 Subject: Fix possible segfault when setting up window's transient parent tp->handle() can be null. Task-number: QTBUG-30919 Change-Id: Ie18b70d4cc6916d2e821a71d00d1bf99956b0632 Reviewed-by: Liang Qi <liang.qi@digia.com> --- src/plugins/platforms/xcb/qxcbwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index c845b875bf..6291396e6e 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -630,7 +630,7 @@ void QXcbWindow::show() const QWindow *tp = window()->transientParent(); if (isTransient(window()) || tp != 0) { xcb_window_t transientXcbParent = 0; - if (tp) + if (tp && tp->handle()) transientXcbParent = static_cast<const QXcbWindow *>(tp->handle())->winId(); // Default to client leader if there is no transient parent, else modal dialogs can // be hidden by their parents. -- cgit v1.2.3 From 542e3be40d0323e239a2e6381e7fd60de9153a06 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge <shawn.rutledge@digia.com> Date: Tue, 30 Apr 2013 11:29:30 +0200 Subject: don't customize dialog buttons if GTK version is too old gtk_dialog_get_widget_for_response was introduced in GTK 2.20 Task-number: QTBUG-30610 Change-Id: I30510f132c1d81c5d44863b3efddbc5e50771362 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> --- src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp index 25d45eb81d..77a78d2140 100644 --- a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp +++ b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp @@ -430,6 +430,7 @@ void QGtk2FileDialogHelper::applyOptions() if (!initialNameFilter.isEmpty()) selectNameFilter(initialNameFilter); +#if GTK_CHECK_VERSION(2, 20, 0) GtkWidget *acceptButton = gtk_dialog_get_widget_for_response(gtkDialog, GTK_RESPONSE_OK); if (acceptButton) { if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept)) @@ -447,6 +448,7 @@ void QGtk2FileDialogHelper::applyOptions() else gtk_button_set_label(GTK_BUTTON(rejectButton), GTK_STOCK_CANCEL); } +#endif } void QGtk2FileDialogHelper::setNameFilters(const QStringList &filters) -- cgit v1.2.3 From a2892ad1d7584de62a1356812a4f9348f37e1d29 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@digia.com> Date: Mon, 29 Apr 2013 10:00:45 +0200 Subject: qdoc: Config class keeps track of current path The Config class is modified to build a single multimap containing a record for each variable found in each .qdocconf file. Each reacord contains not only the name and value of the variable, but also its location in the qdocconf file it was read from and the path to that file. This single multimap replaces 3 maps in the Config class. Task-number: QTBUG-30725 Change-Id: I049a69790f943b24c014a24b55b2b39725a1b56f Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> --- src/tools/qdoc/config.cpp | 313 +++++++++++++++++++----------------- src/tools/qdoc/config.h | 39 ++--- src/tools/qdoc/ditaxmlgenerator.cpp | 13 +- src/tools/qdoc/ditaxmlgenerator.h | 4 +- src/tools/qdoc/location.cpp | 29 +++- src/tools/qdoc/location.h | 3 +- 6 files changed, 221 insertions(+), 180 deletions(-) diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index 766697dfc2..5467791316 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -55,8 +55,9 @@ QT_BEGIN_NAMESPACE -/* - An entry on the MetaStack. +/*! + An entry in a stack, where each entry is a list + of string values. */ class MetaStackEntry { @@ -68,14 +69,19 @@ public: QStringList next; }; -/* +/*! + Start accumulating values in a list by appending an empty + string to the list. */ void MetaStackEntry::open() { next.append(QString()); } -/* +/*! + Stop accumulating values and append the list of accumulated + values to the complete list of accumulated values. + */ void MetaStackEntry::close() { @@ -83,8 +89,10 @@ void MetaStackEntry::close() next.clear(); } -/* - ### +/*! + \class MetaStack + + This class maintains a stack of values of config file variables. */ class MetaStack : private QStack<MetaStackEntry> { @@ -97,12 +105,21 @@ public: QStringList getExpanded(const Location& location); }; +/*! + The default constructor pushes a new stack entry and + opens it. + */ MetaStack::MetaStack() { push(MetaStackEntry()); top().open(); } +/*! + Processes the character \a ch using the \a location. + It really just builds up a name by appending \a ch to + it. + */ void MetaStack::process(QChar ch, const Location& location) { if (ch == QLatin1Char('{')) { @@ -133,6 +150,9 @@ void MetaStack::process(QChar ch, const Location& location) top().open(); } else { + /* + This is where all the processing is done. + */ QStringList::Iterator pre = top().next.begin(); while (pre != top().next.end()) { *pre += ch; @@ -141,6 +161,9 @@ void MetaStack::process(QChar ch, const Location& location) } } +/*! + Returns the accumulated string values. + */ QStringList MetaStack::getExpanded(const Location& location) { if (count() > 1) @@ -176,9 +199,7 @@ Config::Config(const QString& programName) { loc = Location::null; lastLocation_ = Location::null; - locMap.clear(); - stringPairMap.clear(); - stringListPairMap.clear(); + configVars_.clear(); numInstances++; } @@ -210,19 +231,6 @@ void Config::load(const QString& fileName) lastLocation_ = Location::null; } -/*! - Writes the qdoc configuration data to the named file. - The previous contents of the file are overwritten. - */ -void Config::unload(const QString& fileName) -{ - QStringPairMap::ConstIterator v = stringPairMap.constBegin(); - while (v != stringPairMap.constEnd()) { - qDebug() << v.key() << " = " << v.value().second; - ++v; - } - qDebug() << "fileName:" << fileName; -} /*! Joins all the strings in \a values into a single string with the individual \a values separated by ' '. Then it inserts the result @@ -233,10 +241,7 @@ void Config::unload(const QString& fileName) */ void Config::setStringList(const QString& var, const QStringList& values) { - stringPairMap[var].first = QDir::currentPath(); - stringPairMap[var].second = values.join(QLatin1Char(' ')); - stringListPairMap[var].first = QDir::currentPath(); - stringListPairMap[var].second = values; + configVars_.insert(var,ConfigVar(var, values, QDir::currentPath())); } /*! @@ -303,30 +308,29 @@ QSet<QString> Config::getOutputFormats() const */ QString Config::getString(const QString& var) const { - if (!locMap[var].isEmpty()) - (Location&) lastLocation_ = locMap[var]; - return stringPairMap[var].second; -} - -/*! - This function looks up the variable \a var in the location map - and, if found, sets the internal variable \c{lastLocation_} to the - location that \a var maps to. - - Then it looks up \a var in the configuration variable map and, - if found, constructs a path from the pair value, which consists - of the directory path of the configuration file where the value - came from, and the value itself. The constructed path is returned. - */ -QString Config::getPath(const QString& var) const -{ - if (!locMap[var].isEmpty()) - (Location&) lastLocation_ = locMap[var]; - QString path; - if (stringPairMap.contains(var)) { - path = QDir(stringPairMap[var].first + "/" + stringPairMap[var].second).absolutePath(); + QList<ConfigVar> configVars = configVars_.values(var); + QString value; + int high = 0; + if (!configVars.empty()) { + int i = configVars.size() - 1; + while (i >= 0) { + const ConfigVar& cv = configVars[i]; + if (!cv.location_.isEmpty()) + (Location&) lastLocation_ = cv.location_; + if (!cv.values_.isEmpty()) { + if (!cv.plus_) + value.clear(); + for (int j=0; j<cv.values_.size(); ++j) { + if (!value.isEmpty() && !value.endsWith(QChar('\n'))) + value.append(QChar(' ')); + value.append(cv.values_[j]); + high = j; + } + } + --i; + } } - return path; + return value; } /*! @@ -341,20 +345,36 @@ QSet<QString> Config::getStringSet(const QString& var) const /*! First, this function looks up the configuration variable \a var - in the location map and, if found, sets the internal variable + in the location map. If found, it sets the internal variable \c{lastLocation_} to the Location that \a var maps to. - Then it looks up the configuration variable \a var in the string - list map, and returns the string list that \a var maps to. + Then it looks up the configuration variable \a var in the map of + configuration variable records. If found, it gets a list of all + the records for \a var. Then it appends all the values for \a var + to a list and returns the list. As it appends the values from each + record, if the \a var used '=' instead of '+=' the list is cleared + before the values are appended. \note '+=' should always be used. + The final list is returned. */ QStringList Config::getStringList(const QString& var) const { - if (!locMap[var].isEmpty()) - (Location&) lastLocation_ = locMap[var]; - return stringListPairMap[var].second; + QList<ConfigVar> configVars = configVars_.values(var); + QStringList values; + if (!configVars.empty()) { + int i = configVars.size() - 1; + while (i >= 0) { + if (!configVars[i].location_.isEmpty()) + (Location&) lastLocation_ = configVars[i].location_; + if (configVars[i].plus_) + values.append(configVars[i].values_); + else + values = configVars[i].values_; + --i; + } + } + return values; } - /*! \brief Returns the a path list where all paths are canonicalized, then made relative to the config file. @@ -363,18 +383,26 @@ QStringList Config::getStringList(const QString& var) const */ QStringList Config::getCanonicalRelativePathList(const QString& var) const { - if (!locMap[var].isEmpty()) - (Location&) lastLocation_ = locMap[var]; QStringList t; - QStringListPairMap::const_iterator it = stringListPairMap.constFind(var); - if (it != stringListPairMap.constEnd()) { - const QStringList& sl = it.value().second; - if (!sl.isEmpty()) { - t.reserve(sl.size()); - for (int i=0; i<sl.size(); ++i) { - const QString &canonicalized = location().canonicalRelativePath(sl[i]); - t.append(canonicalized); + QList<ConfigVar> configVars = configVars_.values(var); + if (!configVars.empty()) { + int i = configVars.size() - 1; + while (i >= 0) { + const ConfigVar& cv = configVars[i]; + if (!cv.location_.isEmpty()) + (Location&) lastLocation_ = cv.location_; + if (!cv.plus_) + t.clear(); + const QString d = cv.currentPath_; + const QStringList& sl = cv.values_; + if (!sl.isEmpty()) { + t.reserve(t.size() + sl.size()); + for (int i=0; i<sl.size(); ++i) { + const QString& crp = Location::canonicalRelativePath(sl[i], d); + t.append(crp); + } } + --i; } } return t; @@ -382,32 +410,30 @@ QStringList Config::getCanonicalRelativePathList(const QString& var) const /*! This function should only be called when the configuration - variable \a var maps to a string list that contains file paths. + variable \a var maps to string lists that contain file paths. It cleans the paths with QDir::cleanPath() before returning them. - - First, this function looks up the configuration variable \a var - in the location map and, if found, sets the internal variable - \c{lastLocation_} the Location that \a var maps to. - - Then it looks up the configuration variable \a var in the string - list map, which maps to a string list that contains file paths. - These paths might not be clean, so QDir::cleanPath() is called - for each one. The string list returned contains cleaned paths. */ QStringList Config::getCleanPathList(const QString& var) const { - if (!locMap[var].isEmpty()) - (Location&) lastLocation_ = locMap[var]; QStringList t; - QStringListPairMap::const_iterator it = stringListPairMap.constFind(var); - if (it != stringListPairMap.constEnd()) { - const QStringList& sl = it.value().second; - if (!sl.isEmpty()) { - t.reserve(sl.size()); - for (int i=0; i<sl.size(); ++i) { - t.append(QDir::cleanPath(sl[i])); + QList<ConfigVar> configVars = configVars_.values(var); + if (!configVars.empty()) { + int i = configVars.size() - 1; + while (i >= 0) { + const ConfigVar& cv = configVars[i]; + if (!cv.plus_) + t.clear(); + if (!cv.location_.isEmpty()) + (Location&) lastLocation_ = cv.location_; + const QStringList& sl = cv.values_; + if (!sl.isEmpty()) { + t.reserve(t.size() + sl.size()); + for (int i=0; i<sl.size(); ++i) { + t.append(QDir::cleanPath(sl[i].simplified())); + } } + --i; } } return t; @@ -415,7 +441,7 @@ QStringList Config::getCleanPathList(const QString& var) const /*! This function should only be called when the configuration - variable \a var maps to a string list that contains file paths. + variable \a var maps to string lists that contain file paths. It cleans the paths with QDir::cleanPath() before returning them. @@ -424,30 +450,39 @@ QStringList Config::getCleanPathList(const QString& var) const \c{lastLocation_} the Location that \a var maps to. Then it looks up the configuration variable \a var in the string - list map, which maps to a string list that contains file paths. + list map, which maps to one or more records that each contains a + list of file paths. + These paths might not be clean, so QDir::cleanPath() is called for each one. The string list returned contains cleaned paths. */ QStringList Config::getPathList(const QString& var) const { - if (!locMap[var].isEmpty()) - (Location&) lastLocation_ = locMap[var]; QStringList t; - QStringListPairMap::const_iterator it = stringListPairMap.constFind(var); - if (it != stringListPairMap.constEnd()) { - const QStringList& sl = it.value().second; - const QString d = it.value().first; - if (!sl.isEmpty()) { - t.reserve(sl.size()); - for (int i=0; i<sl.size(); ++i) { - QFileInfo fileInfo; - QString path = d + "/" + QDir::cleanPath(sl[i]); - fileInfo.setFile(path); - if (!fileInfo.exists()) - lastLocation_.warning(tr("File '%1' does not exist").arg(path)); - else - t.append(path); + QList<ConfigVar> configVars = configVars_.values(var); + if (!configVars.empty()) { + int i = configVars.size() - 1; + while (i >= 0) { + const ConfigVar& cv = configVars[i]; + if (!cv.plus_) + t.clear(); + if (!cv.location_.isEmpty()) + (Location&) lastLocation_ = cv.location_; + const QString d = cv.currentPath_; + const QStringList& sl = cv.values_; + if (!sl.isEmpty()) { + t.reserve(t.size() + sl.size()); + for (int i=0; i<sl.size(); ++i) { + QFileInfo fileInfo; + QString path = d + "/" + QDir::cleanPath(sl[i].simplified()); + fileInfo.setFile(path); + if (!fileInfo.exists()) + lastLocation_.warning(tr("File '%1' does not exist").arg(path)); + else + t.append(path); + } } + --i; } } return t; @@ -509,30 +544,31 @@ QSet<QString> Config::subVars(const QString& var) const { QSet<QString> result; QString varDot = var + QLatin1Char('.'); - QStringPairMap::ConstIterator v = stringPairMap.constBegin(); - while (v != stringPairMap.constEnd()) { - if (v.key().startsWith(varDot)) { - QString subVar = v.key().mid(varDot.length()); + ConfigVarMultimap::ConstIterator i = configVars_.constBegin(); + while (i != configVars_.constEnd()) { + if (i.key().startsWith(varDot)) { + QString subVar = i.key().mid(varDot.length()); int dot = subVar.indexOf(QLatin1Char('.')); if (dot != -1) subVar.truncate(dot); - result.insert(subVar); + if (!result.contains(subVar)) + result.insert(subVar); } - ++v; + ++i; } return result; } /*! - Same as subVars(), but in this case we return a string map - with the matching keys (stripped of the prefix \a var and - mapped to their values. The pairs are inserted into \a t + Same as subVars(), but in this case we return a config var + multimap with the matching keys (stripped of the prefix \a var + and mapped to their values. The pairs are inserted into \a t */ -void Config::subVarsAndValues(const QString& var, QStringPairMap& t) const +void Config::subVarsAndValues(const QString& var, ConfigVarMultimap& t) const { QString varDot = var + QLatin1Char('.'); - QStringPairMap::ConstIterator v = stringPairMap.constBegin(); - while (v != stringPairMap.constEnd()) { + ConfigVarMultimap::ConstIterator v = configVars_.constBegin(); + while (v != configVars_.constEnd()) { if (v.key().startsWith(varDot)) { QString subVar = v.key().mid(varDot.length()); int dot = subVar.indexOf(QLatin1Char('.')); @@ -869,7 +905,7 @@ void Config::load(Location location, const QString& fileName) Location keyLoc = location; bool plus = false; QString stringValue; - QStringList stringListValue; + QStringList rhsValues; QString word; bool inQuote = false; bool prevWordQuoted = true; @@ -931,6 +967,7 @@ void Config::load(Location location, const QString& fileName) else { /* It wasn't an include statement, so it's something else. + We must see either '=' or '+=' next. If not, fatal error. */ if (cc == '+') { plus = true; @@ -972,7 +1009,12 @@ void Config::load(Location location, const QString& fileName) if (metWord) stringValue += QLatin1Char(' '); stringValue += word; - stringListValue << word; +#if 0 + if (metWord) + rhsValues << QString(" " + word); + else +#endif + rhsValues << word; metWord = true; word.clear(); prevWordQuoted = false; @@ -988,7 +1030,7 @@ void Config::load(Location location, const QString& fileName) stringValue += QLatin1Char(' '); stringValue += word; if (!word.isEmpty()) - stringListValue << word; + rhsValues << word; metWord = true; word.clear(); prevWordQuoted = true; @@ -1025,30 +1067,9 @@ void Config::load(Location location, const QString& fileName) if (!keySyntax.exactMatch(*key)) keyLoc.fatal(tr("Invalid key '%1'").arg(*key)); - if (plus) { - if (locMap[*key].isEmpty()) { - locMap[*key] = keyLoc; - } - else { - locMap[*key].setEtc(true); - } - if (stringPairMap[*key].second.isEmpty()) { - stringPairMap[*key].first = QDir::currentPath(); - stringPairMap[*key].second = stringValue; - } - else { - stringPairMap[*key].second += QLatin1Char(' ') + stringValue; - } - stringListPairMap[*key].first = QDir::currentPath(); - stringListPairMap[*key].second += stringListValue; - } - else { - locMap[*key] = keyLoc; - stringPairMap[*key].first = QDir::currentPath(); - stringPairMap[*key].second = stringValue; - stringListPairMap[*key].first = QDir::currentPath(); - stringListPairMap[*key].second = stringListValue; - } + ConfigVarMultimap::Iterator i; + i = configVars_.insert(*key, ConfigVar(*key, rhsValues, QDir::currentPath(), keyLoc)); + i.value().plus_ = (plus ? true : false); ++key; } } @@ -1058,8 +1079,9 @@ void Config::load(Location location, const QString& fileName) } } popWorkingDir(); - if (!workingDirs_.isEmpty()) - QDir::setCurrent(QFileInfo(workingDirs_.top()).path()); + if (!workingDirs_.isEmpty()) { + QDir::setCurrent(workingDirs_.top()); + } } QStringList Config::getFilesHere(const QString& uncleanDir, @@ -1068,8 +1090,7 @@ QStringList Config::getFilesHere(const QString& uncleanDir, const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles) { - // - QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : location.canonicalRelativePath(uncleanDir); + QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : Location::canonicalRelativePath(uncleanDir); QStringList result; if (excludedDirs.contains(dir)) return result; diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h index 521f1c12b8..c601cc062e 100644 --- a/src/tools/qdoc/config.h +++ b/src/tools/qdoc/config.h @@ -56,19 +56,29 @@ QT_BEGIN_NAMESPACE /* - In QStringPair, the first string is the path to a directory; - the second string is some value. + This struct contains all the information for + one config variable found in a qdocconf file. */ -typedef QPair<QString, QString> QStringPair; +struct ConfigVar { + bool plus_; + QString name_; + QStringList values_; + QString currentPath_; + Location location_; + + ConfigVar() : plus_(false) { } + + ConfigVar(const QString& name, const QStringList& values, const QString& dir) + : plus_(true), name_(name), values_(values), currentPath_(dir) { } + + ConfigVar(const QString& name, const QStringList& values, const QString& dir, const Location& loc) + : plus_(false), name_(name), values_(values), currentPath_(dir), location_(loc) { } +}; /* - In QStringListPair, the first string is the path to a directory; - the string list is a list of string values. + In this multimap, the key is a config variable name. */ -typedef QPair<QString, QStringList> QStringListPair; -typedef QMultiMap<QString, QStringPair> QStringPairMultiMap; -typedef QMap<QString, QStringPair> QStringPairMap; -typedef QMap<QString, QStringListPair> QStringListPairMap; +typedef QMultiMap<QString, ConfigVar> ConfigVarMultimap; class Config { @@ -79,7 +89,6 @@ public: ~Config(); void load(const QString& fileName); - void unload(const QString& fileName); void setStringList(const QString& var, const QStringList& values); const QString& programName() const { return prog; } @@ -90,7 +99,6 @@ public: QString getOutputDir() const; QSet<QString> getOutputFormats() const; QString getString(const QString& var) const; - QString getPath(const QString& var) const; QSet<QString> getStringSet(const QString& var) const; QStringList getStringList(const QString& var) const; QStringList getCanonicalRelativePathList(const QString& var) const; @@ -99,7 +107,7 @@ public: QRegExp getRegExp(const QString& var) const; QList<QRegExp> getRegExpList(const QString& var) const; QSet<QString> subVars(const QString& var) const; - void subVarsAndValues(const QString& var, QStringPairMap& t) const; + void subVarsAndValues(const QString& var, ConfigVarMultimap& t) const; QStringList getAllFiles(const QString& filesVar, const QString& dirsVar, const QSet<QString> &excludedDirs = QSet<QString>(), @@ -146,12 +154,7 @@ private: QString prog; Location loc; Location lastLocation_; - QMap<QString, Location> locMap; - QMap<QString, QString> stringValueMap; - QMap<QString, QStringList> stringListValueMap; - - QStringPairMap stringPairMap; - QStringListPairMap stringListPairMap; + ConfigVarMultimap configVars_; static QMap<QString, QString> uncompressedFiles; static QMap<QString, QString> extractedDirs; diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index a828101551..314dda3a9d 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -5829,8 +5829,11 @@ bool DitaXmlGenerator::writeMetadataElements(const InnerNode* inner, QString DitaXmlGenerator::getMetadataElement(const InnerNode* inner, DitaXmlGenerator::DitaTag t) { QString s = Generator::getMetadataElement(inner, ditaTags[t]); - if (s.isEmpty()) - s = metadataDefault(t); + if (s.isEmpty()) { + QStringList sl = metadataDefault(t); + if (!sl.isEmpty()) + s = sl[0]; + } return s; } @@ -5850,7 +5853,7 @@ QStringList DitaXmlGenerator::getMetadataElements(const InnerNode* inner, { QStringList s = Generator::getMetadataElements(inner,ditaTags[t]); if (s.isEmpty()) - s.append(metadataDefault(t)); + s = metadataDefault(t); return s; } @@ -5858,9 +5861,9 @@ QStringList DitaXmlGenerator::getMetadataElements(const InnerNode* inner, Returns the value of key \a t or an empty string if \a t is not found in the map. */ -QString DitaXmlGenerator::metadataDefault(DitaTag t) const +QStringList DitaXmlGenerator::metadataDefault(DitaTag t) const { - return metadataDefaults.value(ditaTags[t]).second; + return metadataDefaults.value(ditaTags[t]).values_; } /*! diff --git a/src/tools/qdoc/ditaxmlgenerator.h b/src/tools/qdoc/ditaxmlgenerator.h index 15ef4260b2..a55ccf81c8 100644 --- a/src/tools/qdoc/ditaxmlgenerator.h +++ b/src/tools/qdoc/ditaxmlgenerator.h @@ -458,7 +458,7 @@ private: int leaveSection(); bool inSection() const { return (sectionNestingLevel > 0); } int currentSectionNestingLevel() const { return sectionNestingLevel; } - QString metadataDefault(DitaTag t) const; + QStringList metadataDefault(DitaTag t) const; QString stripMarkup(const QString& src) const; Node* collectNodesByTypeAndSubtype(const InnerNode* parent); void writeDitaRefs(const DitaRefList& ditarefs); @@ -507,7 +507,7 @@ private: static QString ditaTags[]; QStack<QXmlStreamWriter*> xmlWriterStack; QStack<DitaTag> tagStack; - QStringPairMap metadataDefaults; + ConfigVarMultimap metadataDefaults; QVector<NodeMultiMap*> nodeTypeMaps; QVector<NodeMultiMap*> nodeSubtypeMaps; QVector<NodeMultiMap*> pageTypeMaps; diff --git a/src/tools/qdoc/location.cpp b/src/tools/qdoc/location.cpp index 86329b9190..91ee214aa1 100644 --- a/src/tools/qdoc/location.cpp +++ b/src/tools/qdoc/location.cpp @@ -229,15 +229,13 @@ QString Location::fileName() const /*! - * \brief Returns \a path which is canonicalized and relative to the config file. - * - * QDir::relativeFilePath does not canonicalize the paths, so - * if the config file is located at qtbase\src\widgets\doc\qtwidgets.qdocconf - * and it has a reference to any ancestor folder (e.g. ".." or even "../doc") - * \param path - * \return + \brief Returns \a path which is canonicalized and relative to the config file. + + QDir::relativeFilePath does not canonicalize the paths, so + if the config file is located at qtbase\src\widgets\doc\qtwidgets.qdocconf + and it has a reference to any ancestor folder (e.g. ".." or even "../doc") */ -QString Location::canonicalRelativePath(const QString &path) const +QString Location::canonicalRelativePath(const QString &path) { QDir configFileDir(QDir::current()); QDir dir(path); @@ -245,6 +243,21 @@ QString Location::canonicalRelativePath(const QString &path) const return configFileDir.relativeFilePath(canon); } +/*! + \brief Returns \a path which is canonicalized and relative to the \a configDir. + + QDir::relativeFilePath does not canonicalize the paths, so + if the config file is located at qtbase\src\widgets\doc\qtwidgets.qdocconf + and it has a reference to any ancestor folder (e.g. ".." or even "../doc") + */ +QString Location::canonicalRelativePath(const QString &path, const QString &configDir) +{ + QDir configFileDir(configDir); + QDir dir(path); + const QString canon = dir.canonicalPath(); + return configFileDir.relativeFilePath(canon); +} + /*! \fn int Location::lineNo() const Returns the current line number. Must not be called on an empty Location object. diff --git a/src/tools/qdoc/location.h b/src/tools/qdoc/location.h index 20ddfd076e..4604358fe5 100644 --- a/src/tools/qdoc/location.h +++ b/src/tools/qdoc/location.h @@ -81,7 +81,6 @@ public: int depth() const { return stkDepth; } const QString& filePath() const { return stkTop->filePath; } QString fileName() const; - QString canonicalRelativePath(const QString &path) const; int lineNo() const { return stkTop->lineNo; } int columnNo() const { return stkTop->columnNo; } bool etc() const { return etcetera; } @@ -101,6 +100,8 @@ public: static void logToStdErr(const QString& message); static void startLoggingProgress() { logProgress_ = true; } static void stopLoggingProgress() { logProgress_ = false; } + static QString canonicalRelativePath(const QString &path); + static QString canonicalRelativePath(const QString &path, const QString &configDir); private: enum MessageType { Warning, Error }; -- cgit v1.2.3 From 08be36c1767b1e8e29938b572ad598a0fea689f1 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@digia.com> Date: Tue, 30 Apr 2013 11:56:35 +0200 Subject: qdoc: Config class uses current path for each path var The Config class is further modified to make use of the current directory information it stores with each configuration variable. Task-number: QTBUG-30725 Change-Id: I34c845e6c05d7868266324f1d54e56f94d709f95 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> --- src/tools/qdoc/config.cpp | 15 ++++++++------- src/tools/qdoc/config.h | 2 +- src/tools/qdoc/location.cpp | 15 --------------- src/tools/qdoc/location.h | 1 - src/tools/qdoc/main.cpp | 2 +- 5 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index 5467791316..ce3b34841e 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -381,7 +381,7 @@ QStringList Config::getStringList(const QString& var) const \param var The variable containing the list of paths. \see Location::canonicalRelativePath() */ -QStringList Config::getCanonicalRelativePathList(const QString& var) const +QStringList Config::getCanonicalPathList(const QString& var) const { QStringList t; QList<ConfigVar> configVars = configVars_.values(var); @@ -391,15 +391,16 @@ QStringList Config::getCanonicalRelativePathList(const QString& var) const const ConfigVar& cv = configVars[i]; if (!cv.location_.isEmpty()) (Location&) lastLocation_ = cv.location_; - if (!cv.plus_) + if (!cv.plus_) { t.clear(); + } const QString d = cv.currentPath_; const QStringList& sl = cv.values_; if (!sl.isEmpty()) { t.reserve(t.size() + sl.size()); for (int i=0; i<sl.size(); ++i) { - const QString& crp = Location::canonicalRelativePath(sl[i], d); - t.append(crp); + QDir dir(d + "/" + sl[i]); + t.append(dir.canonicalPath()); } } --i; @@ -595,7 +596,7 @@ QStringList Config::getAllFiles(const QString &filesVar, const QSet<QString> &excludedFiles) { QStringList result = getStringList(filesVar); - QStringList dirs = getCanonicalRelativePathList(dirsVar); + QStringList dirs = getCanonicalPathList(dirsVar); QString nameFilter = getString(filesVar + dot + QLatin1String(CONFIG_FILEEXTENSIONS)); @@ -611,7 +612,7 @@ QStringList Config::getExampleQdocFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles) { QStringList result; - QStringList dirs = getCanonicalRelativePathList("exampledirs"); + QStringList dirs = getCanonicalPathList("exampledirs"); QString nameFilter = " *.qdoc"; QStringList::ConstIterator d = dirs.constBegin(); @@ -626,7 +627,7 @@ QStringList Config::getExampleImageFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles) { QStringList result; - QStringList dirs = getCanonicalRelativePathList("exampledirs"); + QStringList dirs = getCanonicalPathList("exampledirs"); QString nameFilter = getString(CONFIG_EXAMPLES + dot + QLatin1String(CONFIG_IMAGEEXTENSIONS)); QStringList::ConstIterator d = dirs.constBegin(); diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h index c601cc062e..8787d27eb3 100644 --- a/src/tools/qdoc/config.h +++ b/src/tools/qdoc/config.h @@ -101,7 +101,7 @@ public: QString getString(const QString& var) const; QSet<QString> getStringSet(const QString& var) const; QStringList getStringList(const QString& var) const; - QStringList getCanonicalRelativePathList(const QString& var) const; + QStringList getCanonicalPathList(const QString& var) const; QStringList getCleanPathList(const QString& var) const; QStringList getPathList(const QString& var) const; QRegExp getRegExp(const QString& var) const; diff --git a/src/tools/qdoc/location.cpp b/src/tools/qdoc/location.cpp index 91ee214aa1..64a635115e 100644 --- a/src/tools/qdoc/location.cpp +++ b/src/tools/qdoc/location.cpp @@ -243,21 +243,6 @@ QString Location::canonicalRelativePath(const QString &path) return configFileDir.relativeFilePath(canon); } -/*! - \brief Returns \a path which is canonicalized and relative to the \a configDir. - - QDir::relativeFilePath does not canonicalize the paths, so - if the config file is located at qtbase\src\widgets\doc\qtwidgets.qdocconf - and it has a reference to any ancestor folder (e.g. ".." or even "../doc") - */ -QString Location::canonicalRelativePath(const QString &path, const QString &configDir) -{ - QDir configFileDir(configDir); - QDir dir(path); - const QString canon = dir.canonicalPath(); - return configFileDir.relativeFilePath(canon); -} - /*! \fn int Location::lineNo() const Returns the current line number. Must not be called on an empty Location object. diff --git a/src/tools/qdoc/location.h b/src/tools/qdoc/location.h index 4604358fe5..33472810d3 100644 --- a/src/tools/qdoc/location.h +++ b/src/tools/qdoc/location.h @@ -101,7 +101,6 @@ public: static void startLoggingProgress() { logProgress_ = true; } static void stopLoggingProgress() { logProgress_ = false; } static QString canonicalRelativePath(const QString &path); - static QString canonicalRelativePath(const QString &path, const QString &configDir); private: enum MessageType { Warning, Error }; diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index 9c2dd4dcfc..3ec121f795 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -356,7 +356,7 @@ static void processQdocconfFile(const QString &fileName) QStringList excludedFilesList; Generator::debugSegfault("Reading excludedirs"); - excludedDirsList = config.getCanonicalRelativePathList(CONFIG_EXCLUDEDIRS); + excludedDirsList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS); foreach (const QString &excludeDir, excludedDirsList) { QString p = QDir::fromNativeSeparators(excludeDir); QDir tmp(p); -- cgit v1.2.3 From 16413d8bd11850a757031b9d8c2c79b1abf4154e Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Date: Fri, 26 Apr 2013 17:49:38 +0200 Subject: Mac style: Update appearance of 'button with menu' Most of the logic was still following the 10.6 UI guidelines, and had not yet been upgraded to the 10.7 new button look. We tried to keep 10.6 compatibility were possible, and improve 'small' and 'mini' Aqua sizes support. Change-Id: I64139f24cccd095e9349b27a987395210b55c586 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com> --- src/widgets/styles/qmacstyle_mac.mm | 88 +++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 19 deletions(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index b2bf2c5565..254b2fdb7a 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1660,7 +1660,20 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD extraHeight = 0, finalyoff = 0; - const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt); + const bool combo = opt->type == QStyleOption::SO_ComboBox; + const bool button = opt->type == QStyleOption::SO_Button; + const bool pressed = bdi->state == kThemeStatePressed; + + if (button && pressed) { + if (bdi->kind == kThemePushButton) { + extraHeight = 2; + } else if (bdi->kind == kThemePushButtonSmall) { + xoff = 1; + extraWidth = 2; + extraHeight = 5; + } + } + int width = int(macRect.size.width) + extraWidth; int height = int(macRect.size.height) + extraHeight; @@ -1668,8 +1681,9 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD return; // nothing to draw QString key = QLatin1String("$qt_mac_style_ctb_") + QString::number(bdi->kind) + QLatin1Char('_') - + QString::number(bdi->value) + QLatin1Char('_') + QString::number(width) - + QLatin1Char('_') + QString::number(height); + + QString::number(bdi->value) + QLatin1Char('_') + + (button ? QString::number(bdi->state) + QLatin1Char('_') : QString()) + + QLatin1Char('_') + QString::number(width) + QLatin1Char('_') + QString::number(height); QPixmap pm; if (!QPixmapCache::find(key, pm)) { QPixmap activePixmap(width, height); @@ -1680,17 +1694,18 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD // ourselves, if a scaled version is needed. QPainter tmpPainter(&activePixmap); QMacStylePrivate::drawCombobox(macRect, *bdi, &tmpPainter); - } - else { + } else { QMacCGContext cg(&activePixmap); HIRect newRect = CGRectMake(xoff, yoff, macRect.size.width, macRect.size.height); + if (button && pressed) + bdi->state = kThemeStateActive; HIThemeDrawButton(&newRect, bdi, cg, kHIThemeOrientationNormal, 0); } } - if (!combo && bdi->value == kThemeButtonOff) { + if (!combo && !button && bdi->value == kThemeButtonOff) { pm = activePixmap; - } else if (combo) { + } else if (combo || button) { QImage image = activePixmap.toImage(); for (int y = 0; y < height; ++y) { @@ -1711,6 +1726,8 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD qSwap(darkest, mid); int gray = (mid + 2 * lightest) / 3; + if (pressed) + gray *= 0.88; pixel = qRgba(gray, gray, gray, qAlpha(pixel)); } } @@ -1753,7 +1770,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD } QPixmapCache::insert(key, pm); } - p->drawPixmap(int(macRect.origin.x), int(macRect.origin.y) + finalyoff, width, height, pm); + p->drawPixmap(int(macRect.origin.x) - xoff, int(macRect.origin.y) + finalyoff, width, height, pm); } QMacStyle::QMacStyle() @@ -3539,23 +3556,52 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter newRect.origin.y += QMacStylePrivate::PushButtonTopOffset; newRect.size.width -= QMacStylePrivate::PushButtonRightOffset - 4; } - HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); - if (btn->features & QStyleOptionButton::HasMenu) { + bool hasMenu = btn->features & QStyleOptionButton::HasMenu; + if (hasMenu && bdi.state == kThemeStatePressed && QSysInfo::macVersion() > QSysInfo::MV_10_6) + d->drawColorlessButton(newRect, &bdi, p, opt); + else + HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); + + if (hasMenu) { int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w); QRect ir = btn->rect; - int arrowYOffset = bdi.kind == kThemePushButton ? 4 : 2; - HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset, - ir.height() / 2 - arrowYOffset, mbi, ir.height() / 2); + int arrowXOffset = 0; + if (QSysInfo::macVersion() > QSysInfo::MV_10_6) + arrowXOffset = bdi.kind == kThemePushButton ? 6 : + bdi.kind == kThemePushButtonSmall ? 7 : 8; + int arrowYOffset; + if (QSysInfo::macVersion() > QSysInfo::MV_10_6) + arrowYOffset = bdi.kind == kThemePushButton ? 3 : + bdi.kind == kThemePushButtonSmall ? 1 : 2; + else + arrowYOffset = bdi.kind == kThemePushButton ? 4 : 2; + if (!w) { + // adjustment for Qt Quick Controls + arrowYOffset -= ir.top(); + if (bdi.kind == kThemePushButtonSmall) + arrowYOffset += 1; + } + QRect ar = QRect(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset, + ir.height() / 2 - arrowYOffset, mbi, ir.height() / 2); + ar = visualRect(btn->direction, ir, ar); + HIRect arrowRect = CGRectMake(ar.x() + arrowXOffset, ar.y(), ar.width(), ar.height()); HIThemePopupArrowDrawInfo pdi; pdi.version = qt_mac_hitheme_version; pdi.state = tds == kThemeStateInactive ? kThemeStateActive : tds; pdi.orientation = kThemeArrowDown; - if (arrowRect.size.width < 8.) - pdi.size = kThemeArrow5pt; - else - pdi.size = kThemeArrow9pt; + if (QSysInfo::macVersion() > QSysInfo::MV_10_6) { + if (bdi.kind == kThemePushButtonMini) + pdi.size = kThemeArrow5pt; + else if (bdi.kind == kThemePushButton || bdi.kind == kThemePushButtonSmall) + pdi.size = kThemeArrow7pt; + } else { + if (arrowRect.size.width < 8.) + pdi.size = kThemeArrow5pt; + else + pdi.size = kThemeArrow9pt; + } HIThemeDrawPopupArrow(&arrowRect, &pdi, cg, kHIThemeOrientationNormal); } } @@ -3621,8 +3667,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QRect freeContentRect = btn->rect; QRect textRect = itemTextRect( btn->fontMetrics, freeContentRect, Qt::AlignCenter, btn->state & State_Enabled, btn->text); - if (hasMenu) - textRect.adjust(-1, 0, -1, 0); + if (hasMenu) { + if (QSysInfo::macVersion() > QSysInfo::MV_10_6) + textRect.moveTo(w ? 15 : 11, textRect.top()); // Supports Qt Quick Controls + else + textRect.adjust(-1, 0, -1, 0); + } // Draw the icon: if (hasIcon) { int contentW = textRect.width(); -- cgit v1.2.3 From 5e652bbcbc363ce979488d3f73e59674ec609e09 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Date: Mon, 29 Apr 2013 15:30:57 +0200 Subject: Mac style: Fix text offset within 'small' combobox Change-Id: I2bde1c71e0e79a6d8ef2897acc053357b12dc00c Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com> --- src/widgets/styles/qmacstyle_mac.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 254b2fdb7a..8ff6419075 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -3712,6 +3712,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { QStyleOptionComboBox comboCopy = *cb; comboCopy.direction = Qt::LeftToRight; + if ((opt->state & QStyle::State_Small) && QSysInfo::macVersion() > QSysInfo::MV_10_6) + comboCopy.rect.translate(0, w ? -1 : -2); // Supports Qt Quick Controls QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w); } break; -- cgit v1.2.3 From 6f87ca2908787f12de3f3a45361decf13f27db9e Mon Sep 17 00:00:00 2001 From: Jerome Pasion <jerome.pasion@digia.com> Date: Tue, 16 Apr 2013 16:24:45 +0200 Subject: Doc: Adding Qt Creator Manual as \externalpage -This should allow any Qt 5 module which inherit qt-module-defaults to link to the Qt Creator Manual. Change-Id: If413fe299fa604d16c06fa261024c1a12be24b09 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> --- doc/global/externalsites/qtcreator.qdoc | 491 ++++++++++++++++++++++++++++++++ 1 file changed, 491 insertions(+) create mode 100644 doc/global/externalsites/qtcreator.qdoc diff --git a/doc/global/externalsites/qtcreator.qdoc b/doc/global/externalsites/qtcreator.qdoc new file mode 100644 index 0000000000..9ac80eb831 --- /dev/null +++ b/doc/global/externalsites/qtcreator.qdoc @@ -0,0 +1,491 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-deployment-qnx.html + \title Qt Creator: Deploying Applications to QNX Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-bb10.html + \title Qt Creator: Connecting BlackBerry 10 Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-qnx.html + \title Qt Creator: Connecting QNX Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-deployment-bb10.html + \title Qt Creator: Deploying Applications to BlackBerry 10 Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-generic-linux.html + \title Qt Creator: Connecting Embedded Linux Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-publish-ovi-maemo.html + \title Qt Creator: Publishing Qt Content for Maemo Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-maemo-emulator.html + \title Qt Creator: Using Maemo or MeeGo Harmattan Emulator +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-meego.html + \title Qt Creator: Connecting MeeGo Harmattan Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-maemo.html + \title Qt Creator: Connecting Maemo Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-publish-ovi-meego.html + \title Qt Creator: Publishing Qt Content for MeeGo Harmattan Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-publishing-to-maemo-extras.html + \title Qt Creator: Publishing Maemo Applications to Extras-devel +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-deployment-maemo.html + \title Qt Creator: Deploying Applications to Linux-Based Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-faq.html + \title Qt Creator: FAQ +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-tips.html + \title Qt Creator: Tips and Tricks +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-help.html + \title Qt Creator: Using the Help Mode +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-quick-tour.html + \title Qt Creator: User Interface +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-cli.html + \title Qt Creator: Using Command Line Options +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-task-lists.html + \title Qt Creator: Showing Task List Files in Issues Pane +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-managing-sessions.html + \title Qt Creator: Managing Sessions +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-external.html + \title Qt Creator: Using External Tools +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-version-control.html + \title Qt Creator: Using Version Control Systems +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-keyboard-shortcuts.html + \title Qt Creator: Keyboard Shortcuts +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-screens.html + \title Qt Creator: Creating Screens +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-animations.html + \title Qt Creator: Animating Screens +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-user-interaction.html + \title Qt Creator: Adding User Interaction Methods +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-qml-application.html + \title Qt Creator: Creating a Qt Quick Application +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-export-to-qml.html + \title Qt Creator: Exporting Designs from Graphics Software +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-qml-modules-with-plugins.html + \title Qt Creator: Using QML Modules with Plugins +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-visual-editor.html + \title Qt Creator: Developing Qt Quick Applications +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-application-logic.html + \title Qt Creator: Implementing Application Logic +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-using-qt-quick-designer.html + \title Qt Creator: Using Qt Quick Designer +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-projects.html + \title Qt Creator: Creating Qt Quick Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-components.html + \title Qt Creator: Creating Components +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/qt-quick-toolbars.html + \title Qt Creator: Using Qt Quick Toolbars +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-buttons.html + \title Qt Creator: Creating Buttons +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-scalable-image.html + \title Qt Creator: Creating Scalable Buttons and Borders +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-options.html + \title Qt Creator: Configuring the Editor +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-functions.html + \title Qt Creator: Writing Code +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-coding-navigating.html + \title Qt Creator: Working in Edit Mode +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-highlighting.html + \title Qt Creator: Semantic Highlighting +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-checking-code-syntax.html + \title Qt Creator: Checking Code Syntax +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-completing-code.html + \title Qt Creator: Completing Code +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-codepasting.html + \title Qt Creator: Pasting and Fetching Code Snippets +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-macros.html + \title Qt Creator: Using Text Editing Macros +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-fakevim.html + \title Qt Creator: Using FakeVim Mode +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-indenting-code.html + \title Qt Creator: Indenting Text or Code +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-finding.html + \title Qt Creator: Finding and Replacing +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-refactoring.html + \title Qt Creator: Refactoring +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-locator.html + \title Qt Creator: Searching with the Locator +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-coding.html + \title Qt Creator: Coding +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-options-text.html + \title Qt Creator: Specifying Text Editor Settings +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-finding-overview.html + \title Qt Creator: Finding +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-mime-types.html + \title Qt Creator: Editing MIME Types +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-qml-debugging-example.html + \title Qt Creator: Debugging a Qt Quick Example Application +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debugging-example.html + \title Qt Creator: Debugging a C++ Example Application +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debugger-engines.html + \title Qt Creator: Setting Up Debugger +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debugging-qml.html + \title Qt Creator: Debugging Qt Quick Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debugging.html + \title Qt Creator: Debugging +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debugger-operating-modes.html + \title Qt Creator: Launching the Debugger +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debug-mode.html + \title Qt Creator: Interacting with the Debugger +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debugging-helpers.html + \title Qt Creator: Using Debugging Helpers +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-troubleshooting-debugging.html + \title Qt Creator: Troubleshooting Debugger +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/index.html + \title Qt Creator Manual +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-advanced.html + \title Qt Creator: Advanced Use +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-os-supported-platforms.html + \title Qt Creator: Supported Platforms +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-connecting-mobile.html + \title Qt Creator: Connecting Mobile Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-usability.html + \title Qt Creator: Optimizing Applications for Mobile Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-acknowledgements.html + \title Qt Creator: Acknowledgements +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-help-overview.html + \title Qt Creator: Getting Help +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/technical-support.html + \title Qt Creator: Technical Support +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-overview.html + \title Qt Creator: IDE Overview +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-testing.html + \title Qt Creator: Debugging and Analyzing +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-deployment.html + \title Qt Creator: Deploying to Mobile Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-tutorials.html + \title Qt Creator: Tutorials +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-known-issues.html + \title Qt Creator: Known Issues +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-design-mode.html + \title Qt Creator: Designing User Interfaces +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-publish-ovi.html + \title Qt Creator: Publishing +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-glossary.html + \title Qt Creator: Glossary +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-getting-started.html + \title Qt Creator: Getting Started +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-analyzer.html + \title Qt Creator: Detecting Memory Leaks +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-cache-profiler.html + \title Qt Creator: Profiling Function Execution +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-running-valgrind-remotely.html + \title Qt Creator: Running Valgrind Tools Remotely +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-valgrind-overview.html + \title Qt Creator: Using Valgrind Code Analysis Tools +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-analyze-mode.html + \title Qt Creator: Analyzing Code +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-qml-performance-monitor.html + \title Qt Creator: Profiling QML Applications +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-deploying-android.html + \title Qt Creator: Deploying Applications to Android Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-android.html + \title Qt Creator: Connecting Android Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-build-example-application.html + \title Qt Creator: Building and Running an Example +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-generic.html + \title Qt Creator: Setting Up a Generic Project +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-sharing-project-settings.html + \title Qt Creator: Sharing Project Settings +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-opening.html + \title Qt Creator: Opening Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-managing.html + \title Qt Creator: Managing Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-cmake.html + \title Qt Creator: Setting Up a CMake Project +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-targets.html + \title Qt Creator: Adding Kits +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-tool-chains.html + \title Qt Creator: Adding Compilers +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-qbs.html + \title Qt Creator: Setting Up a Qbs Project +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-creating.html + \title Qt Creator: Creating Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-wizards.html + \title Qt Creator: Adding New Custom Wizards +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-projects-autotools.html + \title Qt Creator: Setting Up an Autotools Project +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-configuring-projects.html + \title Qt Creator: Configuring Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-build-process-customizing.html + \title Qt Creator: Customizing the Build Process +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-build-settings.html + \title Qt Creator: Specifying Build Settings +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-code-style-settings.html + \title Qt Creator: Specifying Code Style Settings +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-run-settings.html + \title Qt Creator: Specifying Run Settings +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-qmake-libraries.html + \title Qt Creator: Adding Libraries to Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-other.html + \title Qt Creator: Using Other Build Systems +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-running-targets.html + \title Qt Creator: Running on Multiple Platforms +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-build-dependencies.html + \title Qt Creator: Specifying Dependencies +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-building-running.html + \title Qt Creator: Building and Running +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-settings.html + \title Qt Creator: Specifying Editor Settings +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-qmake.html + \title Qt Creator: Adding Qt Versions +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-building-targets.html + \title Qt Creator: Building for Multiple Platforms +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-using-qt-designer.html + \title Qt Creator: Developing Widget Based Applications +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-writing-program.html + \title Qt Creator: Creating a Qt Widget Based Application +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/adding-plugins.html + \title Qt Creator: Adding Qt Designer Plugins +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-configuring.html + \title Qt Creator: Configuring Qt Creator +*/ -- cgit v1.2.3 From 299154bd652a70c4ff90f2b2d08c1939cafe2df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= <tor.arne.vestbo@digia.com> Date: Tue, 30 Apr 2013 11:16:45 +0200 Subject: iOS: Simplify context format setup Change-Id: I6a6a025410298cecd5f62abd08388a7379359af7 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> --- src/plugins/platforms/ios/qioscontext.mm | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm index e2a6113010..9467cfdb42 100644 --- a/src/plugins/platforms/ios/qioscontext.mm +++ b/src/plugins/platforms/ios/qioscontext.mm @@ -52,20 +52,16 @@ QIOSContext::QIOSContext(QOpenGLContext *context) : QPlatformOpenGLContext() , m_eaglContext([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]) + , m_format(context->format()) { - // Start out with the requested format - QSurfaceFormat format = context->format(); - - format.setRenderableType(QSurfaceFormat::OpenGLES); - format.setMajorVersion(2); - format.setMinorVersion(0); + m_format.setRenderableType(QSurfaceFormat::OpenGLES); + m_format.setMajorVersion(2); + m_format.setMinorVersion(0); // Even though iOS internally double-buffers its rendering, we // report single-buffered here since the buffer remains unchanged // when swapping unlesss you manually clear it yourself. - format.setSwapBehavior(QSurfaceFormat::SingleBuffer); - - m_format = format; + m_format.setSwapBehavior(QSurfaceFormat::SingleBuffer); } QIOSContext::~QIOSContext() -- cgit v1.2.3 From c56372e379c8aae5e61badce1eaae2f7c3dfc2d5 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn <frederik.gladhorn@digia.com> Date: Wed, 24 Apr 2013 13:32:11 +0200 Subject: Clarify documentation for QKeyEvent::text Change-Id: I4b455a512b2e678b6127ea488b456c68eb80cdbc Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> --- src/gui/kernel/qevent.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index c5be379b7d..ba97db4d39 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -947,11 +947,14 @@ QKeyEvent::~QKeyEvent() /*! \fn QString QKeyEvent::text() const - Returns the Unicode text that this key generated. The text - returned can be an empty string in cases - where modifier keys, such as Shift, Control, Alt, and Meta, - are being pressed or released. In such cases key() will contain - a valid value. + Returns the Unicode text that this key generated. + + Return values when modifier keys such as + Shift, Control, Alt, and Meta are pressed + differ among platforms and could return an empty string. + + \note \l key() will always return a valid value, + independent of modifier keys. \sa Qt::WA_KeyCompression */ -- cgit v1.2.3 From 8d1b8b97ac64060b91170d95213f27cc888d09e7 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete <paul.tvete@digia.com> Date: Fri, 26 Apr 2013 16:24:22 +0200 Subject: Don't block back button after keyboard is hidden The back button would be non-responsive for 5 seconds after hiding the software keyboard. This is a minimal change that does not look into why we need to have a 5 second delay in the first place. Task-number: QTBUG-30752 Change-Id: Ied514b77650cea7accc37a03efef2ce861090f65 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> --- .../jar/src/org/qtproject/qt5/android/QtActivityDelegate.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index be618934df..06ece9d04c 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -704,10 +704,8 @@ public class QtActivityDelegate } } - if (keyCode == KeyEvent.KEYCODE_BACK && m_keyboardIsVisible) - { - if (!m_keyboardIsHiding) - hideSoftwareKeyboard(); + if (keyCode == KeyEvent.KEYCODE_BACK && m_keyboardIsVisible && !m_keyboardIsHiding) { + hideSoftwareKeyboard(); return true; } -- cgit v1.2.3 From 6c719079ecbd294478efa3d5969a4c83974d7aad Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete <paul.tvete@digia.com> Date: Tue, 30 Apr 2013 15:54:33 +0200 Subject: Android: don't crash on exit We have to call DetachCurrentThread() for each time we call AttachCurrentThread(). Fortunately we have this convenience class that we prepared earlier. Task-number: QTBUG-30847 Change-Id: I5ffb94b336d3787a3bae197bab22b91770d58848 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> --- .../platforms/android/src/qandroidinputcontext.cpp | 28 ++++++++++------------ .../android/src/qandroidplatformservices.cpp | 20 +++++++--------- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/plugins/platforms/android/src/qandroidinputcontext.cpp b/src/plugins/platforms/android/src/qandroidinputcontext.cpp index 2180560b04..1981ac0b75 100644 --- a/src/plugins/platforms/android/src/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/src/qandroidinputcontext.cpp @@ -237,13 +237,11 @@ static JNINativeMethod methods[] = { QAndroidInputContext::QAndroidInputContext():QPlatformInputContext() { - JNIEnv *env = 0; - if (QtAndroid::javaVM()->AttachCurrentThread(&env, NULL) < 0) { - qCritical() << "AttachCurrentThread failed"; + QtAndroid::AttachedJNIEnv env; + if (!env.jniEnv) return; - } - jclass clazz = QtAndroid::findClass(QtNativeInputConnectionClassName, env); + jclass clazz = QtAndroid::findClass(QtNativeInputConnectionClassName, env.jniEnv); if (clazz == NULL) { qCritical() << "Native registration unable to find class '" << QtNativeInputConnectionClassName @@ -251,14 +249,14 @@ QAndroidInputContext::QAndroidInputContext():QPlatformInputContext() return; } - if (env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])) < 0) { + if (env.jniEnv->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])) < 0) { qCritical() << "RegisterNatives failed for '" << QtNativeInputConnectionClassName << "'"; return; } - clazz = QtAndroid::findClass(QtExtractedTextClassName, env); + clazz = QtAndroid::findClass(QtExtractedTextClassName, env.jniEnv); if (clazz == NULL) { qCritical() << "Native registration unable to find class '" << QtExtractedTextClassName @@ -266,44 +264,44 @@ QAndroidInputContext::QAndroidInputContext():QPlatformInputContext() return; } - m_extractedTextClass = static_cast<jclass>(env->NewGlobalRef(clazz)); - m_classConstructorMethodID = env->GetMethodID(m_extractedTextClass, "<init>", "()V"); + m_extractedTextClass = static_cast<jclass>(env.jniEnv->NewGlobalRef(clazz)); + m_classConstructorMethodID = env.jniEnv->GetMethodID(m_extractedTextClass, "<init>", "()V"); if (m_classConstructorMethodID == NULL) { qCritical() << "GetMethodID failed"; return; } - m_partialEndOffsetFieldID = env->GetFieldID(m_extractedTextClass, "partialEndOffset", "I"); + m_partialEndOffsetFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "partialEndOffset", "I"); if (m_partialEndOffsetFieldID == NULL) { qCritical() << "Can't find field partialEndOffset"; return; } - m_partialStartOffsetFieldID = env->GetFieldID(m_extractedTextClass, "partialStartOffset", "I"); + m_partialStartOffsetFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "partialStartOffset", "I"); if (m_partialStartOffsetFieldID == NULL) { qCritical() << "Can't find field partialStartOffset"; return; } - m_selectionEndFieldID = env->GetFieldID(m_extractedTextClass, "selectionEnd", "I"); + m_selectionEndFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "selectionEnd", "I"); if (m_selectionEndFieldID == NULL) { qCritical() << "Can't find field selectionEnd"; return; } - m_selectionStartFieldID = env->GetFieldID(m_extractedTextClass, "selectionStart", "I"); + m_selectionStartFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "selectionStart", "I"); if (m_selectionStartFieldID == NULL) { qCritical() << "Can't find field selectionStart"; return; } - m_startOffsetFieldID = env->GetFieldID(m_extractedTextClass, "startOffset", "I"); + m_startOffsetFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "startOffset", "I"); if (m_startOffsetFieldID == NULL) { qCritical() << "Can't find field startOffset"; return; } - m_textFieldID = env->GetFieldID(m_extractedTextClass, "text", "Ljava/lang/String;"); + m_textFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "text", "Ljava/lang/String;"); if (m_textFieldID == NULL) { qCritical() << "Can't find field text"; return; diff --git a/src/plugins/platforms/android/src/qandroidplatformservices.cpp b/src/plugins/platforms/android/src/qandroidplatformservices.cpp index 841a9d4d51..0df882f1f0 100644 --- a/src/plugins/platforms/android/src/qandroidplatformservices.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformservices.cpp @@ -46,29 +46,25 @@ QAndroidPlatformServices::QAndroidPlatformServices() { - JNIEnv *env; - if (QtAndroid::javaVM()->AttachCurrentThread(&env, NULL) < 0) { - qCritical() << "AttachCurrentThread failed"; + QtAndroid::AttachedJNIEnv env; + if (!env.jniEnv) return; - } - m_openURIMethodID = env->GetStaticMethodID(QtAndroid::applicationClass(), + m_openURIMethodID = env.jniEnv->GetStaticMethodID(QtAndroid::applicationClass(), "openURL", "(Ljava/lang/String;)V"); } bool QAndroidPlatformServices::openUrl(const QUrl &url) { - JNIEnv *env; - if (QtAndroid::javaVM()->AttachCurrentThread(&env, NULL) < 0) { - qCritical() << "AttachCurrentThread failed"; + QtAndroid::AttachedJNIEnv env; + if (!env.jniEnv) return false; - } - jstring string = env->NewString(reinterpret_cast<const jchar *>(url.toString().constData()), + jstring string = env.jniEnv->NewString(reinterpret_cast<const jchar *>(url.toString().constData()), url.toString().length()); - env->CallStaticVoidMethod(QtAndroid::applicationClass(), m_openURIMethodID, string); - env->DeleteLocalRef(string); + env.jniEnv->CallStaticVoidMethod(QtAndroid::applicationClass(), m_openURIMethodID, string); + env.jniEnv->DeleteLocalRef(string); return true; } -- cgit v1.2.3 From 600c538cd6001c6729d5a7dd687d2ad42bf6a7de Mon Sep 17 00:00:00 2001 From: Thiago Macieira <thiago.macieira@intel.com> Date: Thu, 25 Apr 2013 21:43:21 -0700 Subject: Move the code that creates QLocalePrivate to separate functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Direct benefit is that the code between the two QLocale constructors taking language, country and (maybe) scripts is merged. This will also allow us to cache the QLocale::c() result. Change-Id: Ia46c5a37764dc287bfcd3a52a022ac413c53a582 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> --- src/corelib/tools/qlocale.cpp | 60 ++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index b5f983899a..27ad847611 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -713,6 +713,34 @@ static quint16 localeDataIndex(const QLocaleData *p) return index; } +static QLocalePrivate *localePrivateByName(const QString &name) +{ + return new QLocalePrivate(localeDataIndex(findLocaleData(name))); +} + +static QLocalePrivate *defaultLocalePrivate() +{ + return new QLocalePrivate(localeDataIndex(defaultData()), default_number_options); +} + +static QLocalePrivate *findLocalePrivate(QLocale::Language language, QLocale::Script script, + QLocale::Country country) +{ + const QLocaleData *data = QLocaleData::findLocaleData(language, script, country); + int index; + int numberOptions = 0; + + // If not found, should default to system + if (data->m_language_id == QLocale::C && language != QLocale::C) { + numberOptions = default_number_options; + index = localeDataIndex(defaultData()); + } else { + index = localeDataIndex(data); + } + return new QLocalePrivate(index, numberOptions); +} + + /*! \internal */ @@ -751,7 +779,7 @@ QLocale::QLocale(QLocalePrivate &dd) */ QLocale::QLocale(const QString &name) - : d(new QLocalePrivate(localeDataIndex(findLocaleData(name)))) + : d(localePrivateByName(name)) { } @@ -764,7 +792,7 @@ QLocale::QLocale(const QString &name) */ QLocale::QLocale() - : d(new QLocalePrivate(localeDataIndex(defaultData()), default_number_options)) + : d(defaultLocalePrivate()) { } @@ -788,21 +816,10 @@ QLocale::QLocale() */ QLocale::QLocale(Language language, Country country) + : d(findLocalePrivate(language, QLocale::AnyScript, country)) { - const QLocaleData *data = QLocaleData::findLocaleData(language, QLocale::AnyScript, country); - int index; - int numberOptions = 0; - - // If not found, should default to system - if (data->m_language_id == QLocale::C && language != QLocale::C) { - numberOptions = default_number_options; - index = localeDataIndex(defaultData()); - } else { - index = localeDataIndex(data); - } - d = new QLocalePrivate(index, numberOptions); } -\ + /*! \since 4.8 @@ -828,19 +845,8 @@ QLocale::QLocale(Language language, Country country) */ QLocale::QLocale(Language language, Script script, Country country) + : d(findLocalePrivate(language, script, country)) { - const QLocaleData *data = QLocaleData::findLocaleData(language, script, country); - int index; - int numberOptions = 0; - - // If not found, should default to system - if (data->m_language_id == QLocale::C && language != QLocale::C) { - numberOptions = default_number_options; - index = localeDataIndex(defaultData()); - } else { - index = localeDataIndex(data); - } - d = new QLocalePrivate(index, numberOptions); } /*! -- cgit v1.2.3 From 50ab31a5dfe491510e194e58075b648fd0b47e6a Mon Sep 17 00:00:00 2001 From: Thiago Macieira <thiago.macieira@intel.com> Date: Thu, 25 Apr 2013 22:19:02 -0700 Subject: QLocalePrivate: remove QLocalePrivate::m_index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's not used anywhere, so we don't need to cache the locale data index. We already have the pointer to the QLocaleData anyway. This saves us a few roundtrips calculating the index from the data pointer only to get the data pointer again. Change-Id: I6905d20a382ddcb9fb04cc886a17499b467f905a Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> --- src/corelib/tools/qlocale.cpp | 29 +++++++---------------------- src/corelib/tools/qlocale_p.h | 8 +++----- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 27ad847611..a8b2b9fedb 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -699,45 +699,30 @@ const QLocaleData *QLocalePrivate::dataPointerForIndex(quint16 index) return &locale_data[index]; } -static quint16 localeDataIndex(const QLocaleData *p) -{ -#ifndef QT_NO_SYSTEMLOCALE - Q_ASSERT((p >= locale_data && p - locale_data < locale_data_size) - || (p != 0 && p == system_data)); - quint16 index = p == system_data ? locale_data_size : p - locale_data; -#else - Q_ASSERT(p >= locale_data && p - locale_data < locale_data_size); - quint16 index = p - locale_data; -#endif - - return index; -} static QLocalePrivate *localePrivateByName(const QString &name) { - return new QLocalePrivate(localeDataIndex(findLocaleData(name))); + return new QLocalePrivate(findLocaleData(name)); } static QLocalePrivate *defaultLocalePrivate() { - return new QLocalePrivate(localeDataIndex(defaultData()), default_number_options); + return new QLocalePrivate(defaultData(), default_number_options); } static QLocalePrivate *findLocalePrivate(QLocale::Language language, QLocale::Script script, QLocale::Country country) { const QLocaleData *data = QLocaleData::findLocaleData(language, script, country); - int index; + int numberOptions = 0; // If not found, should default to system if (data->m_language_id == QLocale::C && language != QLocale::C) { numberOptions = default_number_options; - index = localeDataIndex(defaultData()); - } else { - index = localeDataIndex(data); + data = defaultData(); } - return new QLocalePrivate(index, numberOptions); + return new QLocalePrivate(data, numberOptions); } @@ -2123,7 +2108,7 @@ QString QLocale::toString(double i, char f, int prec) const QLocale QLocale::system() { - return QLocale(*new QLocalePrivate(localeDataIndex(systemData()))); + return QLocale(*new QLocalePrivate(systemData())); } @@ -2158,7 +2143,7 @@ QList<QLocale> QLocale::matchingLocales(QLocale::Language language, && (language == QLocale::AnyLanguage || data->m_language_id == uint(language))) { if ((script == QLocale::AnyScript || data->m_script_id == uint(script)) && (country == QLocale::AnyCountry || data->m_country_id == uint(country))) { - QLocale locale(*new QLocalePrivate(localeDataIndex(data))); + QLocale locale(*new QLocalePrivate(data)); result.append(locale); } ++data; diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index 9674342307..9ed1b6bf76 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -208,10 +208,9 @@ public: class Q_CORE_EXPORT QLocalePrivate : public QSharedData { public: - explicit QLocalePrivate(int index, int numberOptions = 0) - : m_index(index), m_numberOptions(numberOptions) + explicit QLocalePrivate(const QLocaleData *data, int numberOptions = 0) + : m_data(data), m_numberOptions(numberOptions) { - m_data = dataPointerForIndex(index); } ~QLocalePrivate() @@ -332,9 +331,8 @@ public: QString dateTimeToString(const QString &format, const QDate *date, const QTime *time, const QLocale *q) const; - quint16 m_index; - quint16 m_numberOptions; const QLocaleData *m_data; + quint16 m_numberOptions; }; inline char QLocalePrivate::digitToCLocale(QChar in) const -- cgit v1.2.3 From 08ac38a6e368b56d4dfdd872b62eafe13cd93157 Mon Sep 17 00:00:00 2001 From: Thiago Macieira <thiago.macieira@intel.com> Date: Sun, 28 Apr 2013 22:32:40 -0700 Subject: Make QLocalePrivate POD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QSharedDataPointer does not actually need a class derived from QSharedData. All it needs is a member called "ref". Change-Id: I2f7fe4cc143478ef7ef64681eada16e2d4c2e63a Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> --- src/corelib/tools/qlocale.cpp | 10 +++++----- src/corelib/tools/qlocale_p.h | 23 ++++++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index a8b2b9fedb..915a83e156 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -702,12 +702,12 @@ const QLocaleData *QLocalePrivate::dataPointerForIndex(quint16 index) static QLocalePrivate *localePrivateByName(const QString &name) { - return new QLocalePrivate(findLocaleData(name)); + return QLocalePrivate::create(findLocaleData(name)); } static QLocalePrivate *defaultLocalePrivate() { - return new QLocalePrivate(defaultData(), default_number_options); + return QLocalePrivate::create(defaultData(), default_number_options); } static QLocalePrivate *findLocalePrivate(QLocale::Language language, QLocale::Script script, @@ -722,7 +722,7 @@ static QLocalePrivate *findLocalePrivate(QLocale::Language language, QLocale::Sc numberOptions = default_number_options; data = defaultData(); } - return new QLocalePrivate(data, numberOptions); + return QLocalePrivate::create(data, numberOptions); } @@ -2108,7 +2108,7 @@ QString QLocale::toString(double i, char f, int prec) const QLocale QLocale::system() { - return QLocale(*new QLocalePrivate(systemData())); + return QLocale(*QLocalePrivate::create(systemData())); } @@ -2143,7 +2143,7 @@ QList<QLocale> QLocale::matchingLocales(QLocale::Language language, && (language == QLocale::AnyLanguage || data->m_language_id == uint(language))) { if ((script == QLocale::AnyScript || data->m_script_id == uint(script)) && (country == QLocale::AnyCountry || data->m_country_id == uint(country))) { - QLocale locale(*new QLocalePrivate(data)); + QLocale locale(*QLocalePrivate::create(data)); result.append(locale); } ++data; diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index 9ed1b6bf76..a6136ea774 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -205,16 +205,16 @@ public: quint16 m_weekend_end : 3; }; -class Q_CORE_EXPORT QLocalePrivate : public QSharedData +class Q_CORE_EXPORT QLocalePrivate { public: - explicit QLocalePrivate(const QLocaleData *data, int numberOptions = 0) - : m_data(data), m_numberOptions(numberOptions) - { - } - - ~QLocalePrivate() + static QLocalePrivate *create(const QLocaleData *data, int numberOptions = 0) { + QLocalePrivate *retval = new QLocalePrivate; + retval->m_data = data; + retval->ref.store(1); + retval->m_numberOptions = numberOptions; + return retval; } QChar decimal() const { return QChar(m_data->m_decimal); } @@ -332,9 +332,18 @@ public: const QLocale *q) const; const QLocaleData *m_data; + QBasicAtomicInt ref; quint16 m_numberOptions; }; +template <> +inline QLocalePrivate *QSharedDataPointer<QLocalePrivate>::clone() +{ + // cannot use QLocalePrivate's copy constructor + // since it is deleted in C++11 + return QLocalePrivate::create(d->m_data, d->m_numberOptions); +} + inline char QLocalePrivate::digitToCLocale(QChar in) const { const QChar _zero = zero(); -- cgit v1.2.3 From c90486066914d7c63716c12f6e2f1c8086f0eb37 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Date: Tue, 30 Apr 2013 17:16:13 +0200 Subject: Cocoa: Port QCocoaTheme::fileIconPixmap() to Cocoa Task-number: QTBUG-30907 Change-Id: Ie460db63413ab9c8e0fb5fb85af907e1c7f12759 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> --- src/plugins/platforms/cocoa/qcocoatheme.mm | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 8337e00eb6..36d7a49746 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -54,6 +54,7 @@ #include "qcocoamenu.h" #include "qcocoamenubar.h" #include "qcocoahelpers.h" +#include "qcocoaautoreleasepool.h" #include <QtCore/qfileinfo.h> #include <QtGui/private/qguiapplication_p.h> @@ -250,27 +251,17 @@ QPixmap QCocoaTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const QPixmap QCocoaTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size) const { - FSRef macRef; - OSStatus status = FSPathMakeRef(reinterpret_cast<const UInt8*>(fileInfo.canonicalFilePath().toUtf8().constData()), - &macRef, 0); - if (status != noErr) - return QPixmap(); - FSCatalogInfo info; - HFSUniStr255 macName; - status = FSGetCatalogInfo(&macRef, kIconServicesCatalogInfoMask, &info, &macName, 0, 0); - if (status != noErr) - return QPixmap(); - IconRef iconRef; - SInt16 iconLabel; - status = GetIconRefFromFileInfo(&macRef, macName.length, macName.unicode, - kIconServicesCatalogInfoMask, &info, kIconServicesNormalUsageFlag, - &iconRef, &iconLabel); - if (status != noErr) - return QPixmap(); + QCocoaAutoReleasePool pool; - QPixmap pixmap = qt_mac_convert_iconref(iconRef, size.width(), size.height()); - ReleaseIconRef(iconRef); + NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:QCFString::toNSString(fileInfo.canonicalFilePath())]; + if (!iconImage) + return QPixmap(); + NSRect iconRect = NSMakeRect(0, 0, size.width(), size.height()); + CGImageRef cgImage = [iconImage CGImageForProposedRect:&iconRect + context:[NSGraphicsContext currentContext] + hints:nil]; + QPixmap pixmap = QPixmap::fromImage(qt_mac_toQImage(cgImage)); return pixmap; } -- cgit v1.2.3 From 008aedc8d11f7bcfd4aa64aab064646bda812def Mon Sep 17 00:00:00 2001 From: Olivier Goffart <ogoffart@woboq.com> Date: Tue, 30 Apr 2013 17:35:05 +0200 Subject: QAccessible::State is no longer an enum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since 39a052c66479c6d7bd13c4f583fecf6a895b2948, QAccessible::State is no logner an enum that moc understand. moc currently silently ignores it the Q_ENUMS Change-Id: Iecc30ad57055fc9ccaa33e9e9c400d96997d0902 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> --- src/gui/accessible/qaccessible.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 283209d08f..6667cae237 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -68,7 +68,7 @@ class QTextCursor; class Q_GUI_EXPORT QAccessible { Q_GADGET - Q_ENUMS(Role Event State) + Q_ENUMS(Role Event) public: enum Event { -- cgit v1.2.3 From 02e406ac50e7e57ad50d9596e9db1b32639a6a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= <tor.arne.vestbo@digia.com> Date: Tue, 30 Apr 2013 12:33:02 +0200 Subject: iOS: Don't pretend like our OpenGL context is single-buffered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Internally iOS double-buffers its rendering using copy instead of flipping, so we reported that our context was single-buffered so that clients could take advantage of the unchanged buffer. This failed when clients (such as Qt itself) then assumed that calling swapBufferes() was not needed. We now properly report that we're double-buffered, and we'll have to find another way to report the way double-buffering works if that's still an optimization we'd like to provide to clients. Change-Id: Id2e4faa68ed3b837ad01d6f22b2927fc9c9769c2 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> --- src/plugins/platforms/ios/qioscontext.mm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm index 9467cfdb42..807c75df54 100644 --- a/src/plugins/platforms/ios/qioscontext.mm +++ b/src/plugins/platforms/ios/qioscontext.mm @@ -58,10 +58,11 @@ QIOSContext::QIOSContext(QOpenGLContext *context) m_format.setMajorVersion(2); m_format.setMinorVersion(0); - // Even though iOS internally double-buffers its rendering, we - // report single-buffered here since the buffer remains unchanged - // when swapping unlesss you manually clear it yourself. - m_format.setSwapBehavior(QSurfaceFormat::SingleBuffer); + // iOS internally double-buffers its rendering using copy instead of flipping, + // so technically we could report that we are single-buffered so that clients + // could take advantage of the unchanged buffer, but this means clients (and Qt) + // will also assume that swapBufferes() is not needed, which is _not_ the case. + m_format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); } QIOSContext::~QIOSContext() -- cgit v1.2.3 From 130b579a160e623066d20bf144ca230b721f0461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= <tor.arne.vestbo@digia.com> Date: Tue, 30 Apr 2013 13:29:54 +0200 Subject: iOS: Don't use -1 as magic value for UIDeviceOrientationFaceUp/Down The check in [QIOSOrientationListener orientationChanged] ensured we never reported the two unsupported orientations through QPA, but we were reporting back the orientation through QIOSScreen::orientation() as well, and that didn't have a guard for -1. This resulted in crashes in client code that assumed the range of QScreen::orientation() was defined by the enum, such as the paintedwindow example. The listener now ignores the two unsupported orientations, which leaves us at the previous orientation. For the conversion function, we still have to support all UIDeviceOrientations, so we fall back to portrait for the two unsupported orientations. In the future we should consider caching the previous value explicitly, or fall back to the interface orientation. Change-Id: Ic19d0ce86b4ddea250ea927d5e8664396b2b68fd Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> --- src/plugins/platforms/ios/qiosglobal.mm | 3 ++- src/plugins/platforms/ios/qiosscreen.mm | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index d26eca54e5..9abb4ba851 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -104,7 +104,8 @@ Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientat break; case UIDeviceOrientationFaceUp: case UIDeviceOrientationFaceDown: - qtOrientation = static_cast<Qt::ScreenOrientation>(-1); // not supported ATM. + // FIXME: Use cached device orientation, or fall back to interface orientation + qtOrientation = Qt::PortraitOrientation; break; default: qtOrientation = Qt::PortraitOrientation; diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index b73f9c3cbc..c1613c1af4 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -83,9 +83,18 @@ - (void) orientationChanged:(NSNotification *)notification { Q_UNUSED(notification); - Qt::ScreenOrientation orientation = toQtScreenOrientation([UIDevice currentDevice].orientation); - if (orientation != -1) - QWindowSystemInterface::handleScreenOrientationChange(m_screen->screen(), orientation); + + UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation; + switch (deviceOrientation) { + case UIDeviceOrientationFaceUp: + case UIDeviceOrientationFaceDown: + // We ignore these events, as iOS will send events with the 'regular' + // orientations alongside these two orientations. + return; + default: + Qt::ScreenOrientation screenOrientation = toQtScreenOrientation(deviceOrientation); + QWindowSystemInterface::handleScreenOrientationChange(m_screen->screen(), screenOrientation); + } } @end -- cgit v1.2.3 From e68845ec782886296621474b4b4222e42f9238e6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira <thiago.macieira@intel.com> Date: Wed, 24 Apr 2013 22:19:00 -0700 Subject: Oops: bugfix support for ref qualifiers in GCC 4.8.1 51ee309a7946f5377e26da23ae52171711e59461 introduced this check, but it was supposed to be >= (it's available in 4.8.1, not after 4.8.1) Change-Id: Id993b128de5c3500684833aea8ef556b31aac5f2 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> --- src/corelib/global/qcompilerdetection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index ab84adacce..9b609f76d0 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -658,7 +658,7 @@ # define Q_COMPILER_ALIGNOF # define Q_COMPILER_INHERITING_CONSTRUCTORS # define Q_COMPILER_THREAD_LOCAL -# if (__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ > 1 +# if (__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ >= 1 # define Q_COMPILER_REF_QUALIFIERS # endif # endif -- cgit v1.2.3 From 75fba93fc630cf33467702d4c50f0409c6fde4fa Mon Sep 17 00:00:00 2001 From: Thiago Macieira <thiago.macieira@intel.com> Date: Mon, 22 Apr 2013 16:12:33 -0700 Subject: Fix more warnings, found by cross-compiling Qt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit KeccakF-1600-opt32.c:497:5: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] harfbuzz-thai.c:264:49: error: comparison is always false due to limited range of data type [-Werror=type-limits] These warnings are caused by "char" defaulting to unsigned on ARM. In particular, the second warning was introduced by commit 785e95ef0a95ca8fb39ef57678cd4876ee657c43, which is not upstream... qbenchmarkvalgrind.cpp:224:5: error: variable ‘_qzz_res’ set but not used [-Werror=unused-but-set-variable] This one was fixed for x86-64 in 7b54571ec2032628ea71b0af but not for the other platforms. KeccakF-1600-opt32.c:250:5: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] This one is wasn't caught before because it applies only to big-endian code. Change-Id: Ice33b639e55d95140cbf912bb81b6f508ed3744a Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> --- src/3rdparty/harfbuzz/src/harfbuzz-thai.c | 2 +- src/3rdparty/sha3/KeccakF-1600-opt32.c | 8 ++++---- src/testlib/3rdparty/valgrind_p.h | 6 ++++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c index d8f7d44887..e351dbfd49 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c @@ -261,7 +261,7 @@ static HB_Bool HB_ThaiConvertStringToGlyphIndices (HB_ShaperItem *item) for (int lgi = 0; lgi < lgn; lgi++) { if ( rglyphs[lgi] == 0xdd/*TH_BLANK_BASE_GLYPH*/ ) { glyphString[slen++] = C_DOTTED_CIRCLE; - } else if (cstr[i] == (signed char)~0) { + } else if ((unsigned char)cstr[i] == (unsigned char)~0) { // The only glyphs that should be passed to this function that cannot be mapped to // tis620 are the ones of type Inherited class. Pass these glyphs untouched. glyphString[slen++] = string[i]; diff --git a/src/3rdparty/sha3/KeccakF-1600-opt32.c b/src/3rdparty/sha3/KeccakF-1600-opt32.c index b1b442c7e0..4e32dca9cb 100755 --- a/src/3rdparty/sha3/KeccakF-1600-opt32.c +++ b/src/3rdparty/sha3/KeccakF-1600-opt32.c @@ -114,8 +114,8 @@ static void setInterleavedWordsInto8bytes(UINT8* dest, UINT32 even, UINT32 odd) const UINT32 * pI = (const UINT32 *)input; \ UINT32 * pS = state; \ UINT32 t, x0, x1; \ - int i; \ - for (i = (rateInLanes)-1; i >= 0; --i) \ + int i; \ + for (i = (int)(rateInLanes)-1; i >= 0; --i) \ { \ x0 = *(pI++); \ t = (x0 ^ (x0 >> 1)) & 0x22222222UL; x0 = x0 ^ t ^ (t << 1); \ @@ -170,7 +170,7 @@ static void xor8bytesIntoInterleavedWords(UINT32* evenAndOdd, const UINT8* sourc #define xorLanesIntoState(laneCount, state, input) \ { \ - int i; \ + unsigned i; \ for(i=0; i<(laneCount); i++) \ xor8bytesIntoInterleavedWords(state+i*2, input+i*8); \ } @@ -212,7 +212,7 @@ static void setInterleavedWordsInto8bytes(UINT8* dest, UINT32* evenAndOdd) #define extractLanes(laneCount, state, data) \ { \ - int i; \ + unsigned i; \ for(i=0; i<(laneCount); i++) \ setInterleavedWordsInto8bytes(data+i*8, (UINT32*)state+i*2); \ } diff --git a/src/testlib/3rdparty/valgrind_p.h b/src/testlib/3rdparty/valgrind_p.h index bbce1b24d6..4745371d81 100644 --- a/src/testlib/3rdparty/valgrind_p.h +++ b/src/testlib/3rdparty/valgrind_p.h @@ -133,6 +133,7 @@ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \ { \ (_zzq_rlval) = (_zzq_default); \ + (void)_zzq_rlval; \ } #else /* ! NVALGRIND */ @@ -205,6 +206,7 @@ typedef : "cc", "memory" \ ); \ _zzq_rlval = _zzq_result; \ + (void)_zzq_rlval; \ } #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ @@ -319,6 +321,7 @@ typedef : "b" (_zzq_default), "b" (_zzq_ptr) \ : "cc", "memory", "r3", "r4"); \ _zzq_rlval = _zzq_result; \ + (void)_zzq_rlval; \ } #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ @@ -377,6 +380,7 @@ typedef : "0" (_zzq_default), "r" (_zzq_ptr) \ : "cc", "memory"); \ _zzq_rlval = _zzq_result; \ + (void)_zzq_rlval; \ } #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ @@ -447,6 +451,7 @@ typedef : "b" (_zzq_ptr) \ : "r3", "r4", "cc", "memory"); \ _zzq_rlval = _zzq_result; \ + (void)_zzq_rlval; \ } #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ @@ -519,6 +524,7 @@ typedef : "b" (_zzq_ptr) \ : "r3", "r4", "cc", "memory"); \ _zzq_rlval = _zzq_result; \ + (void)_zzq_rlval; \ } #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ -- cgit v1.2.3 From 94bed3ad148a6ecba91c0a32e0ee52deda3aec9f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Date: Fri, 19 Apr 2013 12:20:58 +0200 Subject: Make it possible to bundle Qt libraries in Android apk Add the enablers so that Qt Creator (or another deployment tool) can add a specification in the app's meta data of which libraries are bundled and the Java code required to extract plugins and imports into the required directory structure inside the app's data directory. This is intended to be an alternative to using Ministro for deployment, and the mechanism of extracting libraries on first startup is a work-around for the requirement in Qt of having this directory structure. For Qt 5.2, the approach should be changed to load plugins directly from the app's lib directory and the other files in imports will be bundled as qrcs in the native plugins. Task-number: QTBUG-30751 Change-Id: Ibdb3a672548b4802f9bf3ecd05fc194426ac30e7 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> --- src/android/java/AndroidManifest.xml | 6 +- ...HIS-BEFORE-MANUALLY-ADDING-FILES-TO-PACKAGE.txt | 6 ++ src/android/java/res/values/libs.xml | 2 + .../qtproject/qt5/android/bindings/QtActivity.java | 116 ++++++++++++++++++++- 4 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 src/android/java/READ-THIS-BEFORE-MANUALLY-ADDING-FILES-TO-PACKAGE.txt diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml index 6a407dcb6e..48fb23ab28 100644 --- a/src/android/java/AndroidManifest.xml +++ b/src/android/java/AndroidManifest.xml @@ -11,8 +11,12 @@ <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> <meta-data android:name="android.app.lib_name" android:value=""/> + <!-- Deploy Qt libs as part of package --> + <meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/> + <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/> + <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/> <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="0"/> + <meta-data android:name="android.app.use_local_qt_libs" android:value="1"/> <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> <meta-data android:name="android.app.load_local_libs" android:value=""/> <meta-data android:name="android.app.load_local_jars" android:value=""/> diff --git a/src/android/java/READ-THIS-BEFORE-MANUALLY-ADDING-FILES-TO-PACKAGE.txt b/src/android/java/READ-THIS-BEFORE-MANUALLY-ADDING-FILES-TO-PACKAGE.txt new file mode 100644 index 0000000000..978417721f --- /dev/null +++ b/src/android/java/READ-THIS-BEFORE-MANUALLY-ADDING-FILES-TO-PACKAGE.txt @@ -0,0 +1,6 @@ +If this package is accessed by Qt Creator, certain changes can be +overwritten without warning. In particular, Qt Creator may overwrite +settings which are maintained using its own UI, and files and +directories containing the string "--Managed_by_Qt_Creator--", as well +as native libraries whose file names begin with "libQt5" may be +deleted without warning if they are contained inside this package. diff --git a/src/android/java/res/values/libs.xml b/src/android/java/res/values/libs.xml index f47174e3d3..09fa409458 100644 --- a/src/android/java/res/values/libs.xml +++ b/src/android/java/res/values/libs.xml @@ -8,4 +8,6 @@ <item>Qt5Core</item> </array> <array name="bundled_libs"/> + <array name="bundled_in_lib" /> + <array name="bundled_in_assets" /> </resources> diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java index dfb638fbb0..22b34fdbef 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java @@ -27,6 +27,11 @@ package org.qtproject.qt5.android.bindings; import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.io.InputStream; +import java.io.FileOutputStream; +import java.io.FileInputStream; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; @@ -47,6 +52,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.content.res.Resources.Theme; +import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.Canvas; import android.net.Uri; @@ -89,6 +95,8 @@ public class QtActivity extends Activity private static final String ENVIRONMENT_VARIABLES_KEY = "environment.variables"; private static final String APPLICATION_PARAMETERS_KEY = "application.parameters"; private static final String BUNDLED_LIBRARIES_KEY = "bundled.libraries"; + private static final String BUNDLED_IN_LIB_RESOURCE_ID_KEY = "android.app.bundled_in_lib_resource_id"; + private static final String BUNDLED_IN_ASSETS_RESOURCE_ID_KEY = "android.app.bundled_in_assets_resource_id"; private static final String MAIN_LIBRARY_KEY = "main.library"; private static final String STATIC_INIT_CLASSES_KEY = "static.init.classes"; private static final String NECESSITAS_API_LEVEL_KEY = "necessitas.api.level"; @@ -120,6 +128,8 @@ public class QtActivity extends Activity // note that the android style plugin in Qt 5.1 is not fully functional. private static final int INCOMPATIBLE_MINISTRO_VERSION = 1; // Incompatible Ministro version. Ministro needs to be upgraded. + private static final int BUFFER_SIZE = 1024; + private ActivityInfo m_activityInfo = null; // activity info object, used to access the libs and the strings private DexClassLoader m_classLoader = null; // loader object private String[] m_sources = {"https://files.kde.org/necessitas/ministro/android/necessitas/qt5/latest"}; // Make sure you are using ONLY secure locations @@ -308,6 +318,92 @@ public class QtActivity extends Activity errorDialog.show(); } + static private void copyFile(InputStream inputStream, OutputStream outputStream) + throws IOException + { + byte[] buffer = new byte[BUFFER_SIZE]; + + int count; + while ((count = inputStream.read(buffer)) > 0) + outputStream.write(buffer, 0, count); + } + + + private void copyAsset(String source, String destination) + throws IOException + { + // Already exists, we don't have to do anything + File destinationFile = new File(destination); + if (destinationFile.exists()) + return; + + File parentDirectory = destinationFile.getParentFile(); + if (!parentDirectory.exists()) + parentDirectory.mkdirs(); + + destinationFile.createNewFile(); + + AssetManager assetsManager = getAssets(); + InputStream inputStream = assetsManager.open(source); + OutputStream outputStream = new FileOutputStream(destinationFile); + copyFile(inputStream, outputStream); + } + + private static void createBundledBinary(String source, String destination) + throws IOException + { + // Already exists, we don't have to do anything + File destinationFile = new File(destination); + if (destinationFile.exists()) + return; + + File parentDirectory = destinationFile.getParentFile(); + if (!parentDirectory.exists()) + parentDirectory.mkdirs(); + + destinationFile.createNewFile(); + + InputStream inputStream = new FileInputStream(source); + OutputStream outputStream = new FileOutputStream(destinationFile); + copyFile(inputStream, outputStream); + } + + private void extractBundledPluginsAndImports(String localPrefix) + throws IOException + { + ArrayList<String> libs = new ArrayList<String>(); + + { + String key = BUNDLED_IN_LIB_RESOURCE_ID_KEY; + java.util.Set<String> keys = m_activityInfo.metaData.keySet(); + if (m_activityInfo.metaData.containsKey(key)) { + String[] list = getResources().getStringArray(m_activityInfo.metaData.getInt(key)); + + for (String bundledImportBinary : list) { + String[] split = bundledImportBinary.split(":"); + String sourceFileName = localPrefix + "lib/" + split[0]; + String destinationFileName = localPrefix + split[1]; + createBundledBinary(sourceFileName, destinationFileName); + } + } + } + + { + String key = BUNDLED_IN_ASSETS_RESOURCE_ID_KEY; + if (m_activityInfo.metaData.containsKey(key)) { + String[] list = getResources().getStringArray(m_activityInfo.metaData.getInt(key)); + + for (String fileName : list) { + String[] split = fileName.split(":"); + String sourceFileName = split[0]; + String destinationFileName = localPrefix + split[1]; + copyAsset(sourceFileName, destinationFileName); + } + } + + } + } + private void startApp(final boolean firstStart) { try { @@ -328,13 +424,26 @@ public class QtActivity extends Activity && m_activityInfo.metaData.getInt("android.app.use_local_qt_libs") == 1) { ArrayList<String> libraryList = new ArrayList<String>(); + String localPrefix = "/data/local/tmp/qt/"; if (m_activityInfo.metaData.containsKey("android.app.libs_prefix")) localPrefix = m_activityInfo.metaData.getString("android.app.libs_prefix"); + boolean bundlingQtLibs = false; + if (m_activityInfo.metaData.containsKey("android.app.bundle_local_qt_libs") + && m_activityInfo.metaData.getInt("android.app.bundle_local_qt_libs") == 1) { + localPrefix = getApplicationInfo().dataDir + "/"; + extractBundledPluginsAndImports(localPrefix); + bundlingQtLibs = true; + } + if (m_qtLibs != null) { - for (int i=0;i<m_qtLibs.length;i++) - libraryList.add(localPrefix+"lib/lib"+m_qtLibs[i]+".so"); + for (int i=0;i<m_qtLibs.length;i++) { + libraryList.add(localPrefix + + "lib/lib" + + m_qtLibs[i] + + ".so"); + } } if (m_activityInfo.metaData.containsKey("android.app.load_local_libs")) { @@ -345,9 +454,10 @@ public class QtActivity extends Activity } } + String dexPaths = new String(); String pathSeparator = System.getProperty("path.separator", ":"); - if (m_activityInfo.metaData.containsKey("android.app.load_local_jars")) { + if (!bundlingQtLibs && m_activityInfo.metaData.containsKey("android.app.load_local_jars")) { String[] jarFiles = m_activityInfo.metaData.getString("android.app.load_local_jars").split(":"); for (String jar:jarFiles) { if (jar.length() > 0) { -- cgit v1.2.3 From 522c7ba1acaa02904e810662017b19e55c328d11 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Date: Fri, 26 Apr 2013 16:23:16 +0200 Subject: Enable bundling Qt in Android package in build system For bundling Qt, we need two things: 1. We need to build a regular .jar file out of the Java files, so that they can be built into the app package. Dexing the classes first (i.e. compiling the JVM bytecode to Dalvik bytecode) is required for loading the .jar file at run-time, but cannot be used for building it into the app, so we need two different paths. 2. We need to specify which extra files have to be bundled for each module (this is primarily for plugins and imports). This is because there is no static dependency on these files, so it cannot be detected during deployment. Task-number: QTBUG-30751 Change-Id: I733603ee5d1c64bd7c5b9357eb5d993b9d0298f7 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> --- mkspecs/features/java.prf | 18 ++++++++++-------- mkspecs/features/qt_android_deps.prf | 23 ++++++++++++++++++++++- src/android/jar/bundledjar.pro | 3 +++ src/android/jar/distributedjar.pro | 2 ++ src/android/jar/jar.pri | 18 ++++++++++++++++++ src/android/jar/jar.pro | 21 ++------------------- src/corelib/corelib.pro | 2 ++ src/gui/gui.pro | 4 ++++ src/network/network.pro | 3 +++ src/sql/sql.pro | 3 +++ src/widgets/widgets.pro | 3 +++ 11 files changed, 72 insertions(+), 28 deletions(-) create mode 100644 src/android/jar/bundledjar.pro create mode 100644 src/android/jar/distributedjar.pro create mode 100644 src/android/jar/jar.pri diff --git a/mkspecs/features/java.prf b/mkspecs/features/java.prf index 6cbd690c37..25f6e66427 100644 --- a/mkspecs/features/java.prf +++ b/mkspecs/features/java.prf @@ -17,7 +17,10 @@ android { CONFIG += android_app } -isEmpty(CLASS_DIR): CLASS_DIR = .classes +isEmpty(CLASS_DIR) { + bundled_jar_file: CLASS_DIR = .classes.bundled + else: CLASS_DIR = .classes +} CONFIG -= qt @@ -47,17 +50,16 @@ QMAKE_LIBS_OPENGL_ES2 = QMAKE_LIBDIR = QMAKE_EXTENSION_SHLIB = jar -# Override linker with dex (for Android) or jar (for other java builds) -android { - QMAKE_LINK_O_FLAG = --output= +# Override linker with dex (for distributable Android archives) or jar (for other java builds) +android:!bundled_jar_file { contains(QMAKE_HOST.os, Windows) { - QMAKE_LINK = $$PWD/data/android/dx $$SDK_ROOT --dex + DEX_CMD = $$PWD/data/android/dx $$SDK_ROOT } else { - QMAKE_LINK = $$SDK_ROOT/platform-tools/dx --dex + DEX_CMD = $$SDK_ROOT/platform-tools/dx } + QMAKE_LINK_SHLIB_CMD = $$DEX_CMD --dex --output $(TARGET) $$CLASS_DIR } else { - QMAKE_LINK_O_FLAG = "cf " - QMAKE_LINK = jar + QMAKE_LINK_SHLIB_CMD = jar cf $(TARGET) -C $$CLASS_DIR . } # Force link step to always happen, since we are always updating the diff --git a/mkspecs/features/qt_android_deps.prf b/mkspecs/features/qt_android_deps.prf index 27814a90a5..ba37649201 100644 --- a/mkspecs/features/qt_android_deps.prf +++ b/mkspecs/features/qt_android_deps.prf @@ -17,6 +17,12 @@ ANDROID_DEPENDS_DIR = $$MODULE_QMAKE_OUTDIR/lib/ DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml !build_pass { + !isEmpty(MODULE_PLUGIN_TYPES) { + for(PLUGIN_TYPE, MODULE_PLUGIN_TYPES) { + ANDROID_BUNDLED_FILES += "plugins/$$PLUGIN_TYPE" + } + } + !isEmpty(ANDROID_JAR_DEPENDENCIES) { for(JAR_FILE, ANDROID_JAR_DEPENDENCIES) { INIT_CLASS = $$section(JAR_FILE, ":", 1, 1) @@ -26,6 +32,15 @@ DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml } } + !isEmpty(ANDROID_BUNDLED_JAR_DEPENDENCIES) { + for(JAR_FILE, ANDROID_BUNDLED_JAR_DEPENDENCIES) { + INIT_CLASS = $$section(JAR_FILE, ":", 1, 1) + !isEmpty(INIT_CLASS): INIT_CLASS = "initClass=\"$$INIT_CLASS\"" + JAR_FILE = $$section(JAR_FILE, ":", 0, 0) + FILE_CONTENT += "<jar bundling=\"1\" file=\"$$JAR_FILE\" $$INIT_CLASS />" + } + } + !isEmpty(ANDROID_LIB_DEPENDENCIES) { for(LIB_FILE, ANDROID_LIB_DEPENDENCIES) { FILE_CONTENT += "<lib file=\"$$LIB_FILE\" />" @@ -40,13 +55,19 @@ DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml } } + !isEmpty(ANDROID_BUNDLED_FILES) { + for (BUNDLED_FILE, ANDROID_BUNDLED_FILES) { + FILE_CONTENT += "<bundled file=\"$$BUNDLED_FILE\" />" + } + } + !isEmpty(FILE_CONTENT) { FILE_CONTENT = "<rules><dependencies><lib name=\"$$TARGET\"><depends>" $$FILE_CONTENT "</depends></lib></dependencies></rules>" write_file($$DEPENDENCY_FILE, FILE_CONTENT) | error("Aborting.") } } -!isEmpty(ANDROID_JAR_DEPENDENCIES)|!isEmpty(ANDROID_LIB_DEPENDENCIES)|!isEmpty(ANDROID_LIB_DEPENDENCY_REPLACEMENTS) { +!isEmpty(ANDROID_JAR_DEPENDENCIES)|!isEmpty(ANDROID_LIB_DEPENDENCIES)|!isEmpty(ANDROID_LIB_DEPENDENCY_REPLACEMENTS)|!isEmpty(ANDROID_BUNDLED_JAR_DEPENDENCIES)|!isEmpty(ANDROID_BUNDLED_FILES) { install_dependencies_file.files = $$DEPENDENCY_FILE install_dependencies_file.path = $$[QT_INSTALL_LIBS] INSTALLS += install_dependencies_file diff --git a/src/android/jar/bundledjar.pro b/src/android/jar/bundledjar.pro new file mode 100644 index 0000000000..e82c01c51b --- /dev/null +++ b/src/android/jar/bundledjar.pro @@ -0,0 +1,3 @@ +TARGET = QtAndroid-bundled +CONFIG += bundled_jar_file +include(jar.pri) diff --git a/src/android/jar/distributedjar.pro b/src/android/jar/distributedjar.pro new file mode 100644 index 0000000000..15f362f629 --- /dev/null +++ b/src/android/jar/distributedjar.pro @@ -0,0 +1,2 @@ +TARGET = QtAndroid +include(jar.pri) diff --git a/src/android/jar/jar.pri b/src/android/jar/jar.pri new file mode 100644 index 0000000000..19501d7b29 --- /dev/null +++ b/src/android/jar/jar.pri @@ -0,0 +1,18 @@ +CONFIG += java +DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar + +PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/ + +JAVACLASSPATH += $$PWD/src/ +JAVASOURCES += \ + $$PATHPREFIX/QtActivityDelegate.java \ + $$PATHPREFIX/QtEditText.java \ + $$PATHPREFIX/QtInputConnection.java \ + $$PATHPREFIX/QtLayout.java \ + $$PATHPREFIX/QtNative.java \ + $$PATHPREFIX/QtNativeLibrariesDir.java \ + $$PATHPREFIX/QtSurface.java + +# install +target.path = $$[QT_INSTALL_PREFIX]/jar +INSTALLS += target diff --git a/src/android/jar/jar.pro b/src/android/jar/jar.pro index 1955f16142..8d19c1b7d6 100644 --- a/src/android/jar/jar.pro +++ b/src/android/jar/jar.pro @@ -1,19 +1,2 @@ -CONFIG += java -TARGET = QtAndroid -DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar - -PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/ - -JAVACLASSPATH += $$PWD/src/ -JAVASOURCES += \ - $$PATHPREFIX/QtActivityDelegate.java \ - $$PATHPREFIX/QtEditText.java \ - $$PATHPREFIX/QtInputConnection.java \ - $$PATHPREFIX/QtLayout.java \ - $$PATHPREFIX/QtNative.java \ - $$PATHPREFIX/QtNativeLibrariesDir.java \ - $$PATHPREFIX/QtSurface.java - -# install -target.path = $$[QT_INSTALL_PREFIX]/jar -INSTALLS += target +TEMPLATE = subdirs +SUBDIRS += bundledjar.pro distributedjar.pro diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 3b7eb11229..0a5cc04a17 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -21,6 +21,8 @@ ANDROID_JAR_DEPENDENCIES = \ ANDROID_LIB_DEPENDENCIES = \ plugins/platforms/android/libqtforandroid.so \ libs/libgnustl_shared.so +ANDROID_BUNDLED_JAR_DEPENDENCIES = \ + jar/QtAndroid-bundled.jar load(qt_module) diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 062f00c4c4..b44f563b3e 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -8,6 +8,10 @@ DEFINES += QT_NO_USING_NAMESPACE QMAKE_DOCS = $$PWD/doc/qtgui.qdocconf +MODULE_PLUGIN_TYPES = \ + platforms \ + imageformats + load(qt_module) # Code coverage with TestCocoon diff --git a/src/network/network.pro b/src/network/network.pro index d2b2447611..79e357e0cb 100644 --- a/src/network/network.pro +++ b/src/network/network.pro @@ -11,6 +11,9 @@ DEFINES += QT_NO_USING_NAMESPACE #DEFINES += QUDPSOCKET_DEBUG QUDPSERVER_DEBUG win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x64000000 +MODULE_PLUGIN_TYPES = \ + bearer + QMAKE_DOCS = $$PWD/doc/qtnetwork.qdocconf load(qt_module) diff --git a/src/sql/sql.pro b/src/sql/sql.pro index 4f5af51c52..10004cb445 100644 --- a/src/sql/sql.pro +++ b/src/sql/sql.pro @@ -4,6 +4,9 @@ QT = core-private DEFINES += QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000 +MODULE_PLUGIN_TYPES = \ + sqldrivers + QMAKE_DOCS = $$PWD/doc/qtsql.qdocconf load(qt_module) diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro index 18a4d57900..43f7ae8af3 100644 --- a/src/widgets/widgets.pro +++ b/src/widgets/widgets.pro @@ -7,6 +7,9 @@ DEFINES += QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000 irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused +MODULE_PLUGIN_TYPES = \ + accessible + QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf load(qt_module) -- cgit v1.2.3 From 05984c910fb6ab2670bbeefa87131a34537ea467 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Date: Wed, 1 May 2013 10:54:27 +0200 Subject: Reintroduce QIcon doc image (from Qt 4 docs) This fixes the [Missing image icon.png] warning on QIcon docs. Change-Id: I16aafb51c146fb675f657a7d8210033a17abf642 Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com> --- src/gui/doc/images/icon.png | Bin 0 -> 40790 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/gui/doc/images/icon.png diff --git a/src/gui/doc/images/icon.png b/src/gui/doc/images/icon.png new file mode 100644 index 0000000000..cc2b6ac93a Binary files /dev/null and b/src/gui/doc/images/icon.png differ -- cgit v1.2.3 From b1de018e9a1efcd0f9e298ae4c865197feb47895 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid <albert.astals@canonical.com> Date: Thu, 18 Apr 2013 18:58:18 +0200 Subject: Fix QLocale::standaloneMonthName when d->m_data == systemData() At the moment if d->m_data == systemData() it calls systemLocale()->query but forgets about the standalone part so you get the wrong data This patch introduces the new enums so that backends can implement properly the standaloneMonthName feature properly. At the moment the Windows and Mac ones still return the monthName, the Unix and Blackberry ones return the data we store in months_data Change-Id: Idc5a50b04ab1f914f16c7385be1dca2e027feae3 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Mehdi Fekari <mfekari@blackberry.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> --- src/corelib/tools/qlocale.cpp | 2 +- src/corelib/tools/qlocale_blackberry.cpp | 4 ++++ src/corelib/tools/qlocale_mac.mm | 4 +++- src/corelib/tools/qlocale_p.h | 4 +++- src/corelib/tools/qlocale_unix.cpp | 4 ++++ src/corelib/tools/qlocale_win.cpp | 2 ++ 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 915a83e156..3c918864f9 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2243,7 +2243,7 @@ QString QLocale::standaloneMonthName(int month, FormatType type) const #ifndef QT_NO_SYSTEMLOCALE if (d->m_data == systemData()) { QVariant res = systemLocale()->query(type == LongFormat - ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort, + ? QSystemLocale::StandaloneMonthNameLong : QSystemLocale::StandaloneMonthNameShort, month); if (!res.isNull()) return res.toString(); diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp index 1db7b7d546..6d60a97062 100644 --- a/src/corelib/tools/qlocale_blackberry.cpp +++ b/src/corelib/tools/qlocale_blackberry.cpp @@ -280,6 +280,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const return lc_language.monthName(in.toInt(), QLocale::LongFormat); case MonthNameShort: return lc_language.monthName(in.toInt(), QLocale::ShortFormat); + case StandaloneMonthNameLong: + return lc_language.standaloneMonthName(in.toInt(), QLocale::LongFormat); + case StandaloneMonthNameShort: + return lc_language.standaloneMonthName(in.toInt(), QLocale::ShortFormat); case DateToStringLong: return lc_region.toString(in.toDate(), QLocale::LongFormat); case DateToStringShort: diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm index 9292dccf19..f399b7689d 100644 --- a/src/corelib/tools/qlocale_mac.mm +++ b/src/corelib/tools/qlocale_mac.mm @@ -401,7 +401,9 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const return macDayName(in.toInt(), (type == DayNameShort)); case MonthNameLong: case MonthNameShort: - return macMonthName(in.toInt(), (type == MonthNameShort)); + case StandaloneMonthNameLong: + case StandaloneMonthNameShort: + return macMonthName(in.toInt(), (type == MonthNameShort || type == StandaloneMonthNameShort)); case DateToStringShort: case DateToStringLong: return macDateToString(in.toDate(), (type == DateToStringShort)); diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index a6136ea774..d3b0765f6c 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -115,7 +115,9 @@ public: ListToSeparatedString, // QString LocaleChanged, // system locale changed NativeLanguageName, // QString - NativeCountryName // QString + NativeCountryName, // QString + StandaloneMonthNameLong, // QString, in: int + StandaloneMonthNameShort // QString, in: int }; virtual QVariant query(QueryType type, QVariant in) const; virtual QLocale fallbackUiLocale() const; diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp index 4e443cd79b..9ea28895bd 100644 --- a/src/corelib/tools/qlocale_unix.cpp +++ b/src/corelib/tools/qlocale_unix.cpp @@ -173,6 +173,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const return lc_time.monthName(in.toInt(), QLocale::LongFormat); case MonthNameShort: return lc_time.monthName(in.toInt(), QLocale::ShortFormat); + case StandaloneMonthNameLong: + return lc_time.standaloneMonthName(in.toInt(), QLocale::LongFormat); + case StandaloneMonthNameShort: + return lc_time.standaloneMonthName(in.toInt(), QLocale::ShortFormat); case DateToStringLong: return lc_time.toString(in.toDate(), QLocale::LongFormat); case DateToStringShort: diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index d576f1c281..0730002ca3 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -684,8 +684,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case DayNameShort: return d->dayName(in.toInt(), QLocale::ShortFormat); case MonthNameLong: + case StandaloneMonthNameLong: return d->monthName(in.toInt(), QLocale::LongFormat); case MonthNameShort: + case StandaloneMonthNameShort: return d->monthName(in.toInt(), QLocale::ShortFormat); case DateToStringShort: return d->toString(in.toDate(), QLocale::ShortFormat); -- cgit v1.2.3 From a2f59955ae2f6c421496b8001894418ff930e9b8 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto <rafael.roquetto.qnx@kdab.com> Date: Wed, 1 May 2013 16:26:50 -0300 Subject: Fix QFontConfigDatabase crash Take into account the possibility that the target platform plugin does not support platform services. Change-Id: I48e7fac2e1230a9a7d450414044d23ed26b334be Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> --- src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 91472f9efb..f4cfa3ca40 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -648,8 +648,8 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QChar::Script sc } if (f.hintingPreference == QFont::PreferDefaultHinting) { - QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); - if (desktopEnvironment == "GNOME" || desktopEnvironment == "UNITY") { + const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services(); + if (services && (services->desktopEnvironment() == "GNOME" || services->desktopEnvironment() == "UNITY")) { void *hintStyleResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle", QGuiApplication::primaryScreen()); -- cgit v1.2.3 From 30a8d73fdca819f8803bbb12cdf51bba1d09b22f Mon Sep 17 00:00:00 2001 From: Thiago Macieira <thiago.macieira@intel.com> Date: Thu, 25 Apr 2013 21:50:18 -0700 Subject: QLocale: cache the C locale's private Change-Id: I81bbfeffebb5b7fc29d67bb7127beaf13838ac9f Reviewed-by: Lars Knoll <lars.knoll@digia.com> --- src/corelib/tools/qlocale.cpp | 15 ++++++++++++++- src/corelib/tools/qlocale_p.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 3c918864f9..57f9b22e53 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -529,6 +529,9 @@ int qt_repeatCount(const QString &s, int i) static const QLocaleData *default_data = 0; static uint default_number_options = 0; +static const QLocaleData *const c_data = locale_data; +static QLocalePrivate c_private = { c_data, Q_BASIC_ATOMIC_INITIALIZER(1), 0 }; + #ifndef QT_NO_SYSTEMLOCALE @@ -643,6 +646,12 @@ static const QLocaleData *defaultData() return default_data; } +const QLocaleData *QLocaleData::c() +{ + Q_ASSERT(locale_index[QLocale::C] == 0); + return c_data; +} + static QString getLocaleListData(const ushort *data, int size, int index) { static const ushort separator = ';'; @@ -699,9 +708,10 @@ const QLocaleData *QLocalePrivate::dataPointerForIndex(quint16 index) return &locale_data[index]; } - static QLocalePrivate *localePrivateByName(const QString &name) { + if (name == QLatin1String("C")) + return &c_private; return QLocalePrivate::create(findLocaleData(name)); } @@ -713,6 +723,9 @@ static QLocalePrivate *defaultLocalePrivate() static QLocalePrivate *findLocalePrivate(QLocale::Language language, QLocale::Script script, QLocale::Country country) { + if (language == QLocale::C) + return &c_private; + const QLocaleData *data = QLocaleData::findLocaleData(language, script, country); int numberOptions = 0; diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index d3b0765f6c..a62ee9304b 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -164,6 +164,7 @@ public: static const QLocaleData *findLocaleData(QLocale::Language language, QLocale::Script script, QLocale::Country country); + static const QLocaleData *c(); quint16 m_language_id, m_script_id, m_country_id; -- cgit v1.2.3 From 4d6572aac0eb1f75f3c810ce8e92635b956d29fc Mon Sep 17 00:00:00 2001 From: Thiago Macieira <thiago.macieira@intel.com> Date: Thu, 25 Apr 2013 22:25:15 -0700 Subject: QLocale: cache the QLocalePrivate for the default QLocale Change-Id: I6f05da4d426a0aa685dd9f2fd0020e413a4bebad Reviewed-by: Lars Knoll <lars.knoll@digia.com> --- src/corelib/tools/qlocale.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 57f9b22e53..991cc9e170 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -708,6 +708,9 @@ const QLocaleData *QLocalePrivate::dataPointerForIndex(quint16 index) return &locale_data[index]; } +Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate, + (QLocalePrivate::create(defaultData(), default_number_options))) + static QLocalePrivate *localePrivateByName(const QString &name) { if (name == QLatin1String("C")) @@ -715,11 +718,6 @@ static QLocalePrivate *localePrivateByName(const QString &name) return QLocalePrivate::create(findLocaleData(name)); } -static QLocalePrivate *defaultLocalePrivate() -{ - return QLocalePrivate::create(defaultData(), default_number_options); -} - static QLocalePrivate *findLocalePrivate(QLocale::Language language, QLocale::Script script, QLocale::Country country) { @@ -790,7 +788,7 @@ QLocale::QLocale(const QString &name) */ QLocale::QLocale() - : d(defaultLocalePrivate()) + : d(*defaultLocalePrivate) { } @@ -1002,6 +1000,11 @@ void QLocale::setDefault(const QLocale &locale) { default_data = locale.d->m_data; default_number_options = locale.numberOptions(); + + if (defaultLocalePrivate.exists()) { + // update the cached private + *defaultLocalePrivate = locale.d; + } } /*! -- cgit v1.2.3 From cd5d1524a048355d13cf62aecbc6d2edac2e067a Mon Sep 17 00:00:00 2001 From: Thiago Macieira <thiago.macieira@intel.com> Date: Fri, 3 May 2013 12:43:53 -0700 Subject: Autotest: Use the new test zone in all name-lookup unit tests I also modified tst_QDnsLookup the test to use ';' as a separator as opposed to spaces because I added MX and SRV records with multiple RRs. Change-Id: I62c7b6ad342c1bb23c4d9ac9730e35ab422e3ea2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Richard J. Moore <rich@kde.org> --- .../network/kernel/qdnslookup/tst_qdnslookup.cpp | 112 ++++++++++++++------- .../qdnslookup_appless/tst_qdnslookup_appless.cpp | 6 +- .../network/kernel/qhostinfo/tst_qhostinfo.cpp | 50 ++++----- 3 files changed, 107 insertions(+), 61 deletions(-) diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index a3ce31f585..9135c57420 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -59,6 +59,11 @@ class tst_QDnsLookup: public QObject { Q_OBJECT + QString domainName(const QString &input); + QString domainNameList(const QString &input); +public slots: + void initTestCase(); + private slots: void lookup_data(); void lookup(); @@ -66,6 +71,40 @@ private slots: void lookupAbortRetry(); }; +void tst_QDnsLookup::initTestCase() +{ + QTest::addColumn<QString>("tld"); + QTest::newRow("normal") << ".test.macieira.org"; + QTest::newRow("idn") << ".alqualond\xc3\xab.test.macieira.org"; +} + +QString tst_QDnsLookup::domainName(const QString &input) +{ + if (input.isEmpty()) + return input; + + if (input.endsWith(QLatin1Char('.'))) { + QString nodot = input; + nodot.chop(1); + return nodot; + } + + QFETCH_GLOBAL(QString, tld); + return input + tld; +} + +QString tst_QDnsLookup::domainNameList(const QString &input) +{ + QStringList list = input.split(QLatin1Char(';')); + QString result; + foreach (const QString &s, list) { + if (!result.isEmpty()) + result += ';'; + result += domainName(s); + } + return result; +} + void tst_QDnsLookup::lookup_data() { QTest::addColumn<int>("type"); @@ -81,47 +120,42 @@ void tst_QDnsLookup::lookup_data() QTest::newRow("a-empty") << int(QDnsLookup::A) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << ""<< "" << QByteArray(); QTest::newRow("a-notfound") << int(QDnsLookup::A) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("a-idn") << int(QDnsLookup::A) << QString::fromUtf8("alqualondë.troll.no") << int(QDnsLookup::NoError) << "alqualonde.troll.no" << "10.3.3.55" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("a-single") << int(QDnsLookup::A) << "lupinella.troll.no" << int(QDnsLookup::NoError) << "" << "10.3.4.6" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("a-multi") << int(QDnsLookup::A) << "multi.dev.troll.no" << int(QDnsLookup::NoError) << "" << "1.2.3.4 1.2.3.5 10.3.3.31" << "" << "" << "" << "" << QByteArray(); - + QTest::newRow("a-single") << int(QDnsLookup::A) << "a-single" << int(QDnsLookup::NoError) << "" << "192.0.2.1" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("a-multi") << int(QDnsLookup::A) << "a-multi" << int(QDnsLookup::NoError) << "" << "192.0.2.1;192.0.2.2;192.0.2.3" << "" << "" << "" << "" << QByteArray(); QTest::newRow("aaaa-empty") << int(QDnsLookup::AAAA) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("aaaa-notfound") << int(QDnsLookup::AAAA) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("aaaa-single") << int(QDnsLookup::AAAA) << "dns6-test-dev.troll.no" << int(QDnsLookup::NoError) << "" << "2001:470:1f01:115::10" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("aaaa-multi") << int(QDnsLookup::AAAA) << "multi-dns6-test-dev.troll.no" << int(QDnsLookup::NoError) << "" << "2001:470:1f01:115::11 2001:470:1f01:115::12" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("aaaa-single") << int(QDnsLookup::AAAA) << "aaaa-single" << int(QDnsLookup::NoError) << "" << "2001:db8::1" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("aaaa-multi") << int(QDnsLookup::AAAA) << "aaaa-multi" << int(QDnsLookup::NoError) << "" << "2001:db8::1;2001:db8::2;2001:db8::3" << "" << "" << "" << "" << QByteArray(); QTest::newRow("any-empty") << int(QDnsLookup::ANY) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("any-notfound") << int(QDnsLookup::ANY) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("any-ascii") << int(QDnsLookup::ANY) << "fluke.troll.no" << int(QDnsLookup::NoError) << "" << "10.3.3.31" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("any-a-single") << int(QDnsLookup::ANY) << "a-single" << int(QDnsLookup::NoError) << "" << "192.0.2.1" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("any-a-plus-aaaa") << int(QDnsLookup::ANY) << "a-plus-aaaa" << int(QDnsLookup::NoError) << "" << "198.51.100.1;2001:db8::1:1" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("any-multi") << int(QDnsLookup::ANY) << "multi" << int(QDnsLookup::NoError) << "" << "198.51.100.1;198.51.100.2;198.51.100.3;2001:db8::1:1;2001:db8::1:2" << "" << "" << "" << "" << QByteArray(); QTest::newRow("mx-empty") << int(QDnsLookup::MX) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("mx-notfound") << int(QDnsLookup::MX) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("mx-ascii") << int(QDnsLookup::MX) << "troll.no" << int(QDnsLookup::NoError) << "" << "" << "10 smtp.trolltech.com" << "" << "" << "" << QByteArray(); -#if 0 - // FIXME: we need an IDN MX record in the troll.no domain - QTest::newRow("mx-idn") << int(QDnsLookup::MX) << QString::fromUtf8("råkat.se") << int(QDnsLookup::NoError) << "" << "" << "10 mail.cdr.se" << "" << "" << "" << QByteArray(); -#endif + QTest::newRow("mx-single") << int(QDnsLookup::MX) << "mx-single" << int(QDnsLookup::NoError) << "" << "" << "10 multi" << "" << "" << "" << QByteArray(); + QTest::newRow("mx-single-cname") << int(QDnsLookup::MX) << "mx-single-cname" << int(QDnsLookup::NoError) << "" << "" << "10 cname" << "" << "" << "" << QByteArray(); + QTest::newRow("mx-multi") << int(QDnsLookup::MX) << "mx-multi" << int(QDnsLookup::NoError) << "" << "" << "10 multi;20 a-single" << "" << "" << "" << QByteArray(); QTest::newRow("ns-empty") << int(QDnsLookup::NS) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("ns-notfound") << int(QDnsLookup::NS) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("ns-ascii") << int(QDnsLookup::NS) << "troll.no" << int(QDnsLookup::NoError) << "" << "" << "" << "ns-0.trolltech.net ns-1.trolltech.net" << "" << "" << QByteArray(); + QTest::newRow("ns-single") << int(QDnsLookup::NS) << "ns-single" << int(QDnsLookup::NoError) << "" << "" << "" << "ns3.macieira.info." << "" << "" << QByteArray(); + QTest::newRow("ns-multi") << int(QDnsLookup::NS) << "ns-multi" << int(QDnsLookup::NoError) << "" << "" << "" << "gondolin.macieira.info.;ns3.macieira.info." << "" << "" << QByteArray(); QTest::newRow("ptr-empty") << int(QDnsLookup::PTR) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("ptr-notfound") << int(QDnsLookup::PTR) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - // FIXME: we need PTR records in the troll.no domain - QTest::newRow("ptr-ascii") << int(QDnsLookup::PTR) << "8.8.8.8.in-addr.arpa" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "google-public-dns-a.google.com" << "" << QByteArray(); + QTest::newRow("ptr-single") << int(QDnsLookup::PTR) << "ptr-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "a-single" << "" << QByteArray(); QTest::newRow("srv-empty") << int(QDnsLookup::SRV) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("srv-notfound") << int(QDnsLookup::SRV) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); -#if 0 - // FIXME: we need SRV records in the troll.no domain - QTest::newRow("srv-idn") << int(QDnsLookup::SRV) << QString::fromUtf8("_xmpp-client._tcp.råkat.se") << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "5 0 5224 jabber.cdr.se" << QByteArray(); -#endif + QTest::newRow("srv-single") << int(QDnsLookup::SRV) << "_echo._tcp.srv-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "5 0 7 multi" << QByteArray(); + QTest::newRow("srv-prio") << int(QDnsLookup::SRV) << "_echo._tcp.srv-prio" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "1 0 7 multi;2 0 7 a-plus-aaaa" << QByteArray(); QTest::newRow("txt-empty") << int(QDnsLookup::TXT) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("txt-notfound") << int(QDnsLookup::TXT) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - // FIXME: we need TXT records in the troll.no domain - QTest::newRow("txt-ascii") << int(QDnsLookup::TXT) << "gmail.com" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << QByteArray("v=spf1 redirect=_spf.google.com"); + QTest::newRow("txt-single") << int(QDnsLookup::TXT) << "txt-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << QByteArray("Hello"); } void tst_QDnsLookup::lookup() @@ -137,6 +171,14 @@ void tst_QDnsLookup::lookup() QFETCH(QString, srv); QFETCH(QByteArray, txt); + // transform the inputs + domain = domainName(domain); + cname = domainName(cname); + mx = domainNameList(mx); + ns = domainNameList(ns); + ptr = domainNameList(ptr); + srv = domainNameList(srv); + QDnsLookup lookup; lookup.setType(static_cast<QDnsLookup::Type>(type)); lookup.setName(domain); @@ -168,7 +210,7 @@ void tst_QDnsLookup::lookup() addresses << record.value().toString().toLower(); } addresses.sort(); - QCOMPARE(addresses.join(' '), host); + QCOMPARE(addresses.join(';'), host); // mail exchanges QStringList mailExchanges; @@ -176,7 +218,7 @@ void tst_QDnsLookup::lookup() QCOMPARE(record.name(), domain); mailExchanges << QString("%1 %2").arg(QString::number(record.preference()), record.exchange()); } - QCOMPARE(mailExchanges.join(' '), mx); + QCOMPARE(mailExchanges.join(';'), mx); // name servers QStringList nameServers; @@ -186,7 +228,7 @@ void tst_QDnsLookup::lookup() nameServers << record.value(); } nameServers.sort(); - QCOMPARE(nameServers.join(' '), ns); + QCOMPARE(nameServers.join(';'), ns); // pointers if (!ptr.isEmpty()) { @@ -208,7 +250,7 @@ void tst_QDnsLookup::lookup() QString::number(record.port()), record.target()); } - QCOMPARE(services.join(' '), srv); + QCOMPARE(services.join(';'), srv); // text if (!txt.isEmpty()) { @@ -228,25 +270,25 @@ void tst_QDnsLookup::lookupReuse() // first lookup lookup.setType(QDnsLookup::A); - lookup.setName("lupinella.troll.no"); + lookup.setName(domainName("a-single")); lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); - QCOMPARE(lookup.hostAddressRecords().first().name(), QString("lupinella.troll.no")); - QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("10.3.4.6")); + QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("a-single")); + QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("192.0.2.1")); // second lookup lookup.setType(QDnsLookup::AAAA); - lookup.setName("dns6-test-dev.troll.no"); + lookup.setName(domainName("aaaa-single")); lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); - QCOMPARE(lookup.hostAddressRecords().first().name(), QString("dns6-test-dev.troll.no")); - QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("2001:470:1f01:115::10")); + QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("aaaa-single")); + QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("2001:db8::1")); } @@ -256,7 +298,7 @@ void tst_QDnsLookup::lookupAbortRetry() // try and abort the lookup lookup.setType(QDnsLookup::A); - lookup.setName("lupinella.troll.no"); + lookup.setName(domainName("a-single")); lookup.lookup(); lookup.abort(); QVERIFY(waitForDone(&lookup)); @@ -266,14 +308,14 @@ void tst_QDnsLookup::lookupAbortRetry() // retry a different lookup lookup.setType(QDnsLookup::AAAA); - lookup.setName("dns6-test-dev.troll.no"); + lookup.setName(domainName("aaaa-single")); lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); - QCOMPARE(lookup.hostAddressRecords().first().name(), QString("dns6-test-dev.troll.no")); - QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("2001:470:1f01:115::10")); + QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("aaaa-single")); + QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("2001:db8::1")); } QTEST_MAIN(tst_QDnsLookup) diff --git a/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp b/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp index 4169d30466..84b63c7148 100644 --- a/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp +++ b/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp @@ -56,7 +56,7 @@ private slots: void tst_QDnsLookup_Appless::noApplication() { QTest::ignoreMessage(QtWarningMsg, "QDnsLookup requires a QCoreApplication"); - QDnsLookup dns(QDnsLookup::A, "troll.no"); + QDnsLookup dns(QDnsLookup::A, "a-single.test.macieira.org"); dns.lookup(); } @@ -66,7 +66,7 @@ void tst_QDnsLookup_Appless::recreateApplication() char **argv = 0; for (int i = 0; i < 10; ++i) { QCoreApplication app(argc, argv); - QDnsLookup dns(QDnsLookup::A, "lupinella.troll.no"); + QDnsLookup dns(QDnsLookup::A, "a-single.test.macieira.org"); dns.lookup(); if (!dns.isFinished()) { QObject::connect(&dns, SIGNAL(finished()), @@ -83,7 +83,7 @@ void tst_QDnsLookup_Appless::destroyApplicationDuringLookup() char **argv = 0; for (int i = 0; i < 10; ++i) { QCoreApplication app(argc, argv); - QDnsLookup dns(QDnsLookup::A, "lupinella.troll.no"); + QDnsLookup dns(QDnsLookup::A, "a-single.test.macieira.info"); dns.lookup(); } } diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index 2c295b5949..ee6ea546f3 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -93,7 +93,7 @@ #include "../../../network-settings.h" -const char * const lupinellaIp = "10.3.4.6"; +#define TEST_DOMAIN ".test.macieira.org" class tst_QHostInfo : public QObject @@ -223,7 +223,7 @@ void tst_QHostInfo::initTestCase() if (res == 0) { // this test worked freeaddrinfo(result); - res = getaddrinfo("ipv6-test.dev.troll.no", "80", &hint, &result); + res = getaddrinfo("aaaa-single" TEST_DOMAIN, "80", &hint, &result); if (res == 0 && result != 0 && result->ai_family != AF_INET) { freeaddrinfo(result); ipv6LookupsAvailable = true; @@ -260,14 +260,14 @@ void tst_QHostInfo::lookupIPv4_data() QTest::newRow("lookup_01") << QtNetworkSettings::serverName() << QtNetworkSettings::serverIP().toString() << int(QHostInfo::NoError); QTest::newRow("empty") << "" << "" << int(QHostInfo::HostNotFound); - QTest::newRow("single_ip4") << "lupinella.troll.no" << lupinellaIp << int(QHostInfo::NoError); - QTest::newRow("multiple_ip4") << "multi.dev.troll.no" << "1.2.3.4 1.2.3.5 10.3.3.31" << int(QHostInfo::NoError); - QTest::newRow("literal_ip4") << lupinellaIp << lupinellaIp << int(QHostInfo::NoError); + QTest::newRow("single_ip4") << "a-single" TEST_DOMAIN << "192.0.2.1" << int(QHostInfo::NoError); + QTest::newRow("multiple_ip4") << "a-multi" TEST_DOMAIN << "192.0.2.1 192.0.2.2 192.0.2.3" << int(QHostInfo::NoError); + QTest::newRow("literal_ip4") << "192.0.2.1" << "192.0.2.1" << int(QHostInfo::NoError); - QTest::newRow("notfound") << "this-name-does-not-exist-hopefully." << "" << int(QHostInfo::HostNotFound); + QTest::newRow("notfound") << "invalid" TEST_DOMAIN << "" << int(QHostInfo::HostNotFound); - QTest::newRow("idn-ace") << "xn--alqualond-34a.troll.no" << "10.3.3.55" << int(QHostInfo::NoError); - QTest::newRow("idn-unicode") << QString::fromLatin1("alqualond\353.troll.no") << "10.3.3.55" << int(QHostInfo::NoError); + QTest::newRow("idn-ace") << "a-single.xn--alqualond-34a" TEST_DOMAIN << "192.0.2.1" << int(QHostInfo::NoError); + QTest::newRow("idn-unicode") << QString::fromLatin1("a-single.alqualond\353" TEST_DOMAIN) << "192.0.2.1" << int(QHostInfo::NoError); } void tst_QHostInfo::lookupIPv4() @@ -305,11 +305,9 @@ void tst_QHostInfo::lookupIPv6_data() QTest::addColumn<QString>("addresses"); QTest::addColumn<int>("err"); - QTest::newRow("ipv6-net") << "www.ipv6-net.org" << "62.93.217.177 2001:618:1401::4" << int(QHostInfo::NoError); - QTest::newRow("ipv6-test") << "ipv6-test.dev.troll.no" << "2001:638:a00:2::2" << int(QHostInfo::NoError); - QTest::newRow("dns6-test") << "dns6-test-dev.troll.no" << "2001:470:1f01:115::10" << int(QHostInfo::NoError); - QTest::newRow("multi-dns6") << "multi-dns6-test-dev.troll.no" << "2001:470:1f01:115::11 2001:470:1f01:115::12" << int(QHostInfo::NoError); - QTest::newRow("dns46-test") << "dns46-test-dev.troll.no" << "10.3.4.90 2001:470:1f01:115::13" << int(QHostInfo::NoError); + QTest::newRow("aaaa-single") << "aaaa-single" TEST_DOMAIN << "2001:db8::1" << int(QHostInfo::NoError); + QTest::newRow("aaaa-multi") << "aaaa-multi" TEST_DOMAIN << "2001:db8::1 2001:db8::2 2001:db8::3" << int(QHostInfo::NoError); + QTest::newRow("a-plus-aaaa") << "a-plus-aaaa" TEST_DOMAIN << "198.51.100.1 2001:db8::1:1" << int(QHostInfo::NoError); // avoid using real IPv6 addresses here because this will do a DNS query // real addresses are between 2000:: and 3fff:ffff:ffff:ffff:ffff:ffff:ffff @@ -415,7 +413,7 @@ void tst_QHostInfo::raceCondition() { for (int i = 0; i < 1000; ++i) { QTcpSocket socket; - socket.connectToHost("notavalidname.troll.no", 80); + socket.connectToHost("invalid" TEST_DOMAIN, 80); } } @@ -424,10 +422,10 @@ class LookupThread : public QThread protected: inline void run() { - QHostInfo info = QHostInfo::fromName("qt-project.org"); + QHostInfo info = QHostInfo::fromName("a-single" TEST_DOMAIN); QCOMPARE(info.error(), QHostInfo::NoError); QVERIFY(info.addresses().count() > 0); - QCOMPARE(info.addresses().at(0).toString(), QString("87.238.53.172")); + QCOMPARE(info.addresses().at(0).toString(), QString("192.0.2.1")); } }; @@ -462,7 +460,7 @@ public: void LookupReceiver::start() { for (int i=0;i<numrequests;i++) - QHostInfo::lookupHost(QString("qt-project.org"), this, SLOT(resultsReady(QHostInfo))); + QHostInfo::lookupHost(QString("a-single" TEST_DOMAIN), this, SLOT(resultsReady(QHostInfo))); } void LookupReceiver::resultsReady(const QHostInfo &info) @@ -493,7 +491,7 @@ void tst_QHostInfo::threadSafetyAsynchronousAPI() QVERIFY(threads.at(k)->wait(60000)); foreach (LookupReceiver* receiver, receivers) { QCOMPARE(receiver->result.error(), QHostInfo::NoError); - QCOMPARE(receiver->result.addresses().at(0).toString(), QString("87.238.53.172")); + QCOMPARE(receiver->result.addresses().at(0).toString(), QString("192.0.2.1")); QCOMPARE(receiver->numrequests, 0); } } @@ -530,9 +528,15 @@ void tst_QHostInfo::multipleDifferentLookups_data() void tst_QHostInfo::multipleDifferentLookups() { QStringList hostnameList; - hostnameList << "www.ovi.com" << "www.nokia.com" << "qt-project.org" << "www.trolltech.com" << "troll.no" - << "www.qtcentre.org" << "forum.nokia.com" << "www.nokia.com" << "wiki.forum.nokia.com" - << "www.nokia.com" << "nokia.de" << "127.0.0.1" << "----"; + hostnameList << "a-single" TEST_DOMAIN + << "a-multi" TEST_DOMAIN + << "aaaa-single" TEST_DOMAIN + << "aaaa-multi" TEST_DOMAIN + << "a-plus-aaaa" TEST_DOMAIN + << "multi" TEST_DOMAIN + << "localhost" TEST_DOMAIN + << "cname" TEST_DOMAIN + << "127.0.0.1" << "----"; QFETCH(int, repeats); const int COUNT = hostnameList.size(); @@ -604,7 +608,7 @@ void tst_QHostInfo::abortHostLookup() lookupsDoneCounter = 0; bool valid = false; int id = -1; - QHostInfo result = qt_qhostinfo_lookup("qt-project.org", this, SLOT(resultsReady(QHostInfo)), &valid, &id); + QHostInfo result = qt_qhostinfo_lookup("a-single" TEST_DOMAIN, this, SLOT(resultsReady(QHostInfo)), &valid, &id); QVERIFY(!valid); //it is assumed that the DNS request/response in the backend is slower than it takes to call abort QHostInfo::abortHostLookup(id); @@ -631,7 +635,7 @@ void tst_QHostInfo::abortHostLookupInDifferentThread() lookupsDoneCounter = 0; bool valid = false; int id = -1; - QHostInfo result = qt_qhostinfo_lookup("qt-project.org", this, SLOT(resultsReady(QHostInfo)), &valid, &id); + QHostInfo result = qt_qhostinfo_lookup("a-single" TEST_DOMAIN, this, SLOT(resultsReady(QHostInfo)), &valid, &id); QVERIFY(!valid); QThread thread; LookupAborter aborter; -- cgit v1.2.3 From 95045168470f8865263145b86597b6641b4cc035 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether <jan-arve.saether@digia.com> Date: Fri, 3 May 2013 16:36:05 +0200 Subject: Remove the crash pending warning Even though the intentions of this warning were good, the warning was a bit harsh. In addition, in certain circumstances (like the autotest demonstrates) we could end up calling object() on an interface where the object was in the destructor. This could happen because: *after* we got the destroyed() signal, the widget would still notify the accessibility framework of a FocusOut event. Since the code even called object() from isValid(), we could not even (as a defensive measure to circumvent this issue) check the isValid() of an interface without getting this warning (duh). So - for isValid(), the warning is not needed at all, since the caller will of course check the result of isValid() and act accordingly. As for the result of object(), it should always be a pointer, but it might point to a partially destroyed object. To detect this, you simply check isValid() first: if (iface->isValid()) doStuff(iface->object()); Change-Id: I206307fe618806133d8c6bc338c412d0009d7181 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> --- src/gui/accessible/qaccessibleobject.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp index ccbfd36b70..664ff9eaf4 100644 --- a/src/gui/accessible/qaccessibleobject.cpp +++ b/src/gui/accessible/qaccessibleobject.cpp @@ -100,10 +100,6 @@ QAccessibleObject::~QAccessibleObject() */ QObject *QAccessibleObject::object() const { -#ifndef QT_NO_DEBUG - if (!d->object) - qWarning("QAccessibleInterface is invalid. Crash pending..."); -#endif return d->object; } -- cgit v1.2.3