From 51cf737151c1c446a9ce77832774202b6bdb4ba2 Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Thu, 22 Jul 2010 12:42:34 +1000 Subject: Fixed QVideoSurfaceFormat::isValid() Trivial fix, valid formats have pixel format != Invalid, not ==. Task-number: QTBUG-12337 Reviewed-by: Andrew den Exter --- src/multimedia/video/qvideosurfaceformat.cpp | 2 +- .../tst_qvideosurfaceformat.cpp | 27 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp index 1fc13a6..3afbdc9 100644 --- a/src/multimedia/video/qvideosurfaceformat.cpp +++ b/src/multimedia/video/qvideosurfaceformat.cpp @@ -252,7 +252,7 @@ QVideoSurfaceFormat::~QVideoSurfaceFormat() bool QVideoSurfaceFormat::isValid() const { - return d->pixelFormat == QVideoFrame::Format_Invalid && d->frameSize.isValid(); + return d->pixelFormat != QVideoFrame::Format_Invalid && d->frameSize.isValid(); } /*! diff --git a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp index 8a4307e..a4bfb89 100644 --- a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp +++ b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp @@ -127,16 +127,37 @@ void tst_QVideoSurfaceFormat::construct_data() QTest::addColumn("frameSize"); QTest::addColumn("pixelFormat"); QTest::addColumn("handleType"); + QTest::addColumn("valid"); QTest::newRow("32x32 rgb32 no handle") << QSize(32, 32) << QVideoFrame::Format_RGB32 - << QAbstractVideoBuffer::NoHandle; + << QAbstractVideoBuffer::NoHandle + << true; QTest::newRow("1024x768 YUV444 GL texture") << QSize(32, 32) << QVideoFrame::Format_YUV444 - << QAbstractVideoBuffer::GLTextureHandle; + << QAbstractVideoBuffer::GLTextureHandle + << true; + + QTest::newRow("32x32 invalid no handle") + << QSize(32, 32) + << QVideoFrame::Format_Invalid + << QAbstractVideoBuffer::NoHandle + << false; + + QTest::newRow("invalid size, rgb32 no handle") + << QSize() + << QVideoFrame::Format_RGB32 + << QAbstractVideoBuffer::NoHandle + << false; + + QTest::newRow("0x0 rgb32 no handle") + << QSize(0,0) + << QVideoFrame::Format_RGB32 + << QAbstractVideoBuffer::NoHandle + << true; } void tst_QVideoSurfaceFormat::construct() @@ -144,6 +165,7 @@ void tst_QVideoSurfaceFormat::construct() QFETCH(QSize, frameSize); QFETCH(QVideoFrame::PixelFormat, pixelFormat); QFETCH(QAbstractVideoBuffer::HandleType, handleType); + QFETCH(bool, valid); QRect viewport(QPoint(0, 0), frameSize); @@ -154,6 +176,7 @@ void tst_QVideoSurfaceFormat::construct() QCOMPARE(format.frameSize(), frameSize); QCOMPARE(format.frameWidth(), frameSize.width()); QCOMPARE(format.frameHeight(), frameSize.height()); + QCOMPARE(format.isValid(), valid); QCOMPARE(format.viewport(), viewport); QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom); QCOMPARE(format.frameRate(), 0.0); -- cgit v0.12 From 5b984faebca64b0542e0221efdee188af22df4bc Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 22 Jul 2010 13:29:02 +0200 Subject: Fix Rhys' qmake warnings --- examples/network/torrent/torrent.pro | 2 +- tests/auto/qnetworkreply/test/test.pro | 2 +- tests/benchmarks/network/network.pro | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/network/torrent/torrent.pro b/examples/network/torrent/torrent.pro index 7665455..44716fd 100644 --- a/examples/network/torrent/torrent.pro +++ b/examples/network/torrent/torrent.pro @@ -5,7 +5,7 @@ HEADERS += addtorrentdialog.h \ metainfo.h \ peerwireclient.h \ ratecontroller.h \ - filemanager.h \ + filemanager.h \ torrentclient.h \ torrentserver.h \ trackerclient.h diff --git a/tests/auto/qnetworkreply/test/test.pro b/tests/auto/qnetworkreply/test/test.pro index 7bf3852..e63146c 100644 --- a/tests/auto/qnetworkreply/test/test.pro +++ b/tests/auto/qnetworkreply/test/test.pro @@ -31,7 +31,7 @@ symbian:{ DEPLOYMENT += certFiles # Symbian toolchain does not support correct include semantics - INCPATH+=..\..\..\..\include\QtNetwork\private + INCLUDEPATH+=..\..\..\..\include\QtNetwork\private # bigfile test case requires more heap TARGET.EPOCHEAPSIZE="0x100 0x1000000" TARGET.CAPABILITY="ALL -TCB" diff --git a/tests/benchmarks/network/network.pro b/tests/benchmarks/network/network.pro index 4e83db2..ea0f821 100644 --- a/tests/benchmarks/network/network.pro +++ b/tests/benchmarks/network/network.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -SUBDIRS = \ +SUBDIRS = \ access \ kernel \ socket -- cgit v0.12 From 6b6778c7f0e56dc6128b8d6d986cb8874fdf30cd Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 22 Jul 2010 13:33:18 +0200 Subject: One more .pro fix for deprecated INCPATH --- tests/auto/qsocks5socketengine/qsocks5socketengine.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro index 4a32852..5e3c92c 100644 --- a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro +++ b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro @@ -10,7 +10,7 @@ MOC_DIR=tmp QT = core network # Symbian toolchain does not support correct include semantics -symbian:INCPATH+=..\..\..\include\QtNetwork\private +symbian:INCLUDEPATH+=..\..\..\include\QtNetwork\private requires(contains(QT_CONFIG,private_tests)) -- cgit v0.12 From cc3c416682791e1a2fd61d9a473ba3b4715c502d Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Fri, 23 Jul 2010 15:16:32 +0100 Subject: Ensure backing store is deleted before top-level window If this is not done, later deletion of the backing store may cause a crash. If the backing store is an EGL surface, its destruction includes a call to eglDestroySurface(), which triggers an exception if the window handle passed as a parameter is no longer valid. Task-number: QTBUG-10643 Task-number: QTBUG-11376 Reviewed-by: Jason Barron --- src/gui/kernel/qapplication_s60.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index f39b462..d5ff792 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -371,6 +371,10 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop) QSymbianControl::~QSymbianControl() { + // Ensure backing store is deleted before the top-level + // window is destroyed + qt_widget_private(qwidget)->topData()->backingStore.destroy(); + if (S60->curWin == this) S60->curWin = 0; if (!QApplicationPrivate::is_app_closing) { -- cgit v0.12 From 3695cb25e4a53921880cfea4d4c731df44fa4396 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 26 Jul 2010 11:53:28 +0100 Subject: Removed QEXPECT_FAIL macros from test cases which now pass Task-number: QTBUG-10643 Task-number: QTBUG-11376 Reviewed-by: Jason Barron --- tests/auto/qwidget/tst_qwidget.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 140356b..2397380 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9681,7 +9681,6 @@ void tst_QWidget::destroyBackingStoreWhenHidden() // Native child widget should once again share parent's backing store QVERIFY(0 != backingStore(parent)); - QEXPECT_FAIL("", "QTBUG-10643", Continue); QVERIFY(0 == backingStore(child)); } @@ -9730,7 +9729,7 @@ void tst_QWidget::destroyBackingStoreWhenHidden() QVERIFY(0 != backingStore(child)); // Parent is obscured, therefore its backing store should be destroyed - QEXPECT_FAIL("", "QTBUG-10643", Continue); + QEXPECT_FAIL("", "QTBUG-12406", Continue); QVERIFY(0 == backingStore(parent)); // Disable full screen @@ -9744,7 +9743,6 @@ void tst_QWidget::destroyBackingStoreWhenHidden() // Native child widget should once again share parent's backing store QVERIFY(0 != backingStore(parent)); - QEXPECT_FAIL("", "QTBUG-10643", Continue); QVERIFY(0 == backingStore(child)); } } -- cgit v0.12 From 3c7e7992461b1fef37ada68244f1b5b891015bda Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 26 Jul 2010 20:51:32 +0200 Subject: Fix crash when all the items in a QListView are hidden Calling QIconModeViewBase::initDynamicLayout() on the second and successive segments would return QPoint(-1,-1), resulting in a totally empty area rectangle for all the items while in QIconModeViewBase::doDynamicLayout(). This rectangle is used to initialize the BSP tree, and produces an arithmetic exception when empty. Furthermore, a rendering bug was also apparent when displaying the first item of a segment while the last item of the previous segment was hidden. Auto-tests included. Reviewed-by: Olivier Task-number: QTBUG-12308 --- src/gui/itemviews/qlistview.cpp | 7 ++++- tests/auto/qlistview/tst_qlistview.cpp | 51 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index b2def39..64ae0db 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -2773,7 +2773,10 @@ QPoint QIconModeViewBase::initDynamicLayout(const QListViewLayoutInfo &info) y = info.bounds.y() + info.spacing; items.reserve(rowCount() - hiddenCount()); } else { - const QListViewItem item = items.at(info.first - 1); + int idx = info.first - 1; + while (idx > 0 && !items.at(idx).isValid()) + --idx; + const QListViewItem &item = items.at(idx); x = item.x; y = item.y; if (info.flow == QListView::LeftToRight) @@ -2899,6 +2902,8 @@ void QIconModeViewBase::doDynamicLayout(const QListViewLayoutInfo &info) // resize the content area if (done || !info.bounds.contains(item->rect())) contentsSize = QSize(rect.width(), rect.height()); + if (rect.size().isEmpty()) + return; // resize tree int insertFrom = info.first; if (done || info.first == 0) { diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index d2181f8..e5b42ce 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -123,6 +124,8 @@ private slots: void taskQTBUG_435_deselectOnViewportClick(); void taskQTBUG_2678_spacingAndWrappedText(); void taskQTBUG_5877_skippingItemInPageDownUp(); + void taskQTBUG_12308_artihmeticException(); + void taskQTBUG_12308_wrongFlowLayout(); }; // Testing get/set functions @@ -1941,5 +1944,53 @@ void tst_QListView::taskQTBUG_5877_skippingItemInPageDownUp() } } +void tst_QListView::taskQTBUG_12308_artihmeticException() +{ + QListWidget lw; + lw.setLayoutMode(QListView::Batched); + lw.setViewMode(QListView::IconMode); + for (int i = 0; i < lw.batchSize() + 1; i++) { + QListWidgetItem *item = new QListWidgetItem(); + item->setText(QString("Item %L1").arg(i)); + lw.addItem(item); + item->setHidden(true); + } + lw.show(); + QTest::qWaitForWindowShown(&lw); + // No crash, it's all right. +} + +class Delegate12308 : public QStyledItemDelegate +{ + Q_OBJECT +public: + Delegate12308(QObject *parent = 0) : QStyledItemDelegate(parent) + { } + + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const + { + QVERIFY(option.rect.topLeft() != QPoint(-1, -1)); + QStyledItemDelegate::paint(painter, option, index); + } +}; + +void tst_QListView::taskQTBUG_12308_wrongFlowLayout() +{ + QListWidget lw; + Delegate12308 delegate; + lw.setLayoutMode(QListView::Batched); + lw.setViewMode(QListView::IconMode); + lw.setItemDelegate(&delegate); + for (int i = 0; i < lw.batchSize() + 1; i++) { + QListWidgetItem *item = new QListWidgetItem(); + item->setText(QString("Item %L1").arg(i)); + lw.addItem(item); + if (!item->text().contains(QString::fromAscii("1"))) + item->setHidden(true); + } + lw.show(); + QTest::qWaitForWindowShown(&lw); +} + QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" -- cgit v0.12 From f4f10d2a2d60790939492694abf6b9578a5f048a Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 27 Jul 2010 13:55:43 +0200 Subject: Workaround for QTBUG-8013: Do not return an ascent of 0 Symbian's CFont::FontMaxAscent() returns in some cases an incorrect value of 0. That usually happens (for some font sizes) if a stroke based font is the main system font. We were able to reproduce it on some S60 3.2 devices with a chinese language pack installed. This patch will test if CFont::FontMaxAscent() returns 0. And if so, it alculates an ascent taht makes more sense. Task-number: QTBUG-8013 Reviewed-by: Liang Qi --- src/gui/text/qfontengine_s60.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 93f02ff..9073f89 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -291,7 +291,10 @@ glyph_metrics_t QFontEngineS60::boundingBox(glyph_t glyph) QFixed QFontEngineS60::ascent() const { - return m_originalFont->FontMaxAscent(); + // Workaround for QTBUG-8013 + // Stroke based fonts may return an incorrect FontMaxAscent of 0. + const QFixed ascent = m_originalFont->FontMaxAscent(); + return (ascent > 0) ? ascent : QFixed::fromReal(m_originalFontSizeInPixels) - descent(); } QFixed QFontEngineS60::descent() const -- cgit v0.12 From be1e08209a1cef9ff15fc5cc49d4d1d611d917cb Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 27 Jul 2010 13:55:43 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( d521d7d81e8f0297c94be9ebd8af67ee130d0edb ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2010-07-27 Simon Hausmann Reviewed by Tor Arne Vestbø. [Qt] Incorrect input method hints https://bugs.webkit.org/show_bug.cgi?id=43037 Properly set or reset all input method hints when activating input fields. * WebCoreSupport/EditorClientQt.cpp: (WebCore::EditorClientQt::setInputMethodState): * tests/qwebview/tst_qwebview.cpp: (tst_QWebView::focusInputTypes): Extended unit test to verify that we reset hints. --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 16 +++++++++++++ .../WebKit/qt/WebCoreSupport/EditorClientQt.cpp | 26 ++++++++++------------ .../WebKit/qt/tests/qwebview/tst_qwebview.cpp | 23 ++++++++++++++----- 4 files changed, 47 insertions(+), 20 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index b6178b9..358024b 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 038b62085831eef4dee423361c65ecd55b7b9b1d + d521d7d81e8f0297c94be9ebd8af67ee130d0edb diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index cf335a1..7d419d5 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,19 @@ +2010-07-27 Simon Hausmann + + Reviewed by Tor Arne Vestbø. + + [Qt] Incorrect input method hints + https://bugs.webkit.org/show_bug.cgi?id=43037 + + Properly set or reset all input method hints when + activating input fields. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + * tests/qwebview/tst_qwebview.cpp: + (tst_QWebView::focusInputTypes): Extended unit test to verify that we + reset hints. + 2010-06-18 Simon Hausmann Reviewed by Antti Koivisto. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 3255c8e..cb0758b 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -608,20 +608,18 @@ void EditorClientQt::setInputMethodState(bool active) inputElement = static_cast(frame->document()->focusedNode()); if (inputElement) { - if (!active) { - // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag - // for password fields. The Qt platform is responsible for determining which widget - // will receive input method events for password fields. - active = inputElement->isPasswordField(); - webPageClient->setInputMethodHint(Qt::ImhHiddenText, active); - } else { - // Set input method hints for "number", "tel", "email", and "url" input elements. - webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, inputElement->isTelephoneField()); - webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, inputElement->isNumberField()); - webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, inputElement->isEmailField()); - webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, inputElement->isUrlField()); - webPageClient->setInputMethodHint(Qt::ImhHiddenText, inputElement->isPasswordField()); - } + // Set input method hints for "number", "tel", "email", "url" and "password" input elements. + webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, inputElement->isTelephoneField()); + webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, inputElement->isNumberField()); + webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, inputElement->isEmailField()); + webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, inputElement->isUrlField()); + // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag + // for password fields. The Qt platform is responsible for determining which widget + // will receive input method events for password fields. + bool isPasswordField = inputElement->isPasswordField(); + webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField); + if (isPasswordField) + active = true; } #if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN) diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp index 5e8e8a9..facee59 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -254,23 +254,36 @@ void tst_QWebView::focusInputTypes() // 'password' field webView->fireMouseClick(QPoint(20, 60)); - QVERIFY(webView->inputMethodHints() & Qt::ImhHiddenText); + QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText); // 'tel' field webView->fireMouseClick(QPoint(20, 110)); - QVERIFY(webView->inputMethodHints() & Qt::ImhDialableCharactersOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhDialableCharactersOnly); // 'number' field webView->fireMouseClick(QPoint(20, 160)); - QVERIFY(webView->inputMethodHints() & Qt::ImhDigitsOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhDigitsOnly); // 'email' field webView->fireMouseClick(QPoint(20, 210)); - QVERIFY(webView->inputMethodHints() & Qt::ImhEmailCharactersOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhEmailCharactersOnly); // 'url' field webView->fireMouseClick(QPoint(20, 260)); - QVERIFY(webView->inputMethodHints() & Qt::ImhUrlCharactersOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhUrlCharactersOnly); + + // 'password' field + webView->fireMouseClick(QPoint(20, 60)); + QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText); + + // 'text' type + webView->fireMouseClick(QPoint(20, 10)); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) + QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase); + QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText); +#else + QVERIFY(webView->inputMethodHints() == Qt::ImhNone); +#endif delete webView; -- cgit v0.12 From 859cca02a89ecadbb5578bb113e535374bcfcaca Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 26 Jul 2010 14:04:52 +0100 Subject: Clear Qt::WA_OutsideWSRange when making window fullscreen Task-number: QTBUG-10269 Reviewed-by: Jason Barron --- src/gui/kernel/qwidget_s60.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 2818d88..75a11ee 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1133,8 +1133,10 @@ void QWidget::setWindowState(Qt::WindowStates newstate) const bool cbaVisibilityHint = windowFlags() & Qt::WindowSoftkeysVisibleHint; if (newstate & Qt::WindowFullScreen && !cbaVisibilityHint) { + setAttribute(Qt::WA_OutsideWSRange, false); window->SetExtentToWholeScreen(); } else if (newstate & Qt::WindowMaximized || ((newstate & Qt::WindowFullScreen) && cbaVisibilityHint)) { + setAttribute(Qt::WA_OutsideWSRange, false); TRect maxExtent = qt_QRect2TRect(qApp->desktop()->availableGeometry(this)); window->SetExtent(maxExtent.iTl, maxExtent.Size()); } else { -- cgit v0.12 From 92d6d1c974206bac7520101ad26ca93eb0b4d977 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 27 Jul 2010 16:23:52 +0100 Subject: Ensure that window rectangle is updated when CBA visibility changes In S60, there are two pieces of screen furniture, changes in whose visibility or size can affect the size of the Qt application window. These are the status pane, at the top of the screen, and the CBA at the bottom. QSymbianControl listens for changes in status pane visibility and size by implementing MEikStatusPaneObserver. Notifications received via this interface trigger a call to QSymbianControl::handleClientAreaChange() which resizes the control. There is no corresponding interface through which to receive notifications of changes in CBA visibility. This patch introduces a utility function for setting the visibility of both the status pane and CBA, which ensures that the control's rectangle is updated when either one changes. Task-number: QTBUG-5320 Reviewed-by: Jason Barron --- src/gui/kernel/qapplication_s60.cpp | 36 +++++++++++++++++++++++++----------- src/gui/kernel/qt_s60_p.h | 3 +++ src/gui/kernel/qwidget_s60.cpp | 15 +++++---------- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 1c06100..e8ee2e4 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -112,6 +112,25 @@ QS60Data* qGlobalS60Data() return qt_s60Data(); } +#ifdef Q_WS_S60 +void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, bool buttonGroupVisible) +{ + bool buttonGroupVisibilityChanged = false; + if (CEikButtonGroupContainer *const b = buttonGroupContainer()) { + buttonGroupVisibilityChanged = (b->IsVisible() != buttonGroupVisible); + b->MakeVisible(buttonGroupVisible); + } + bool statusPaneVisibilityChanged = false; + if (CEikStatusPane *const s = statusPane()) { + statusPaneVisibilityChanged = (s->IsVisible() != statusPaneVisible); + s->MakeVisible(statusPaneVisible); + } + if (buttonGroupVisibilityChanged && !statusPaneVisibilityChanged) + // Ensure that control rectangle is updated + static_cast(QApplication::activeWindow()->winId())->handleClientAreaChange(); +} +#endif + bool qt_nograb() // application no-grab option { #if defined(QT_DEBUG) @@ -1100,17 +1119,12 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); #ifdef Q_WS_S60 // If widget is fullscreen/minimized, hide status pane and button container otherwise show them. - CEikStatusPane *statusPane = S60->statusPane(); - CEikButtonGroupContainer *buttonGroup = S60->buttonGroupContainer(); - TBool visible = !(qwidget->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); - if (statusPane) - statusPane->MakeVisible(visible); - if (buttonGroup) { - // Visibility - const TBool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; - const TBool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint; - buttonGroup->MakeVisible(visible || (isFullscreen && cbaVisibilityHint)); - } + const bool visible = !(qwidget->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); + const bool statusPaneVisibility = visible; + const bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; + const bool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint; + const bool buttonGroupVisibility = (visible || (isFullscreen && cbaVisibilityHint)); + S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); #endif } else if (QApplication::activeWindow() == qwidget->window()) { if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index d8ef67d..6be9bbc 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -155,6 +155,7 @@ public: static inline CAknTitlePane* titlePane(); static inline CAknContextPane* contextPane(); static inline CEikButtonGroupContainer* buttonGroupContainer(); + static void setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, bool buttonGroupVisible); #endif #ifdef Q_OS_SYMBIAN @@ -236,6 +237,8 @@ private: #ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event); #endif + +public: void handleClientAreaChange(); private: diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 75a11ee..56349ad 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1113,15 +1113,10 @@ void QWidget::setWindowState(Qt::WindowStates newstate) // The window decoration visibility has to be changed before doing actual window state // change since in that order the availableGeometry will return directly the right size and // we will avoid unnecessarty redraws - CEikStatusPane *statusPane = S60->statusPane(); - CEikButtonGroupContainer *buttonGroup = S60->buttonGroupContainer(); - TBool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); - if (statusPane) - statusPane->MakeVisible(visible); - if (buttonGroup) { - // Visibility - buttonGroup->MakeVisible(visible || (isFullscreen && cbaRequested)); - } + const bool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); + const bool statusPaneVisibility = visible; + const bool buttonGroupVisibility = (visible || (isFullscreen && cbaRequested)); + S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); #endif // Q_WS_S60 // Ensure the initial size is valid, since we store it as normalGeometry below. @@ -1145,7 +1140,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) // accurate because it did not consider the status pane. This means that when returning // normal mode after showing the status pane, the geometry would overlap so we should // move it if it never had an explicit position. - if (!wasMoved && statusPane && visible) { + if (!wasMoved && S60->statusPane() && visible) { TPoint tl = static_cast(S60->appUi())->ClientRect().iTl; normalGeometry.setTopLeft(QPoint(tl.iX, tl.iY)); } -- cgit v0.12 From 688791b4d39ed4e96c43621e28c6bb3098d3b70c Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 29 Jul 2010 16:20:48 +1000 Subject: Improve utility of QMLViewer Adds a startup animation for all platforms, and adds support for file associated and drag and drop on Mac OS X QTBUG-12496 --- tools/qml/Info_mac.plist | 31 +++ tools/qml/browser/Browser.qml | 284 ++++++++++++++++++++ tools/qml/browser/browser.qrc | 9 + tools/qml/browser/images/folder.png | Bin 0 -> 1841 bytes tools/qml/browser/images/titlebar.png | Bin 0 -> 1436 bytes tools/qml/browser/images/titlebar.sci | 5 + tools/qml/browser/images/up.png | Bin 0 -> 662 bytes tools/qml/content/Browser.qml | 284 -------------------- tools/qml/content/images/folder.png | Bin 1841 -> 0 bytes tools/qml/content/images/titlebar.png | Bin 1436 -> 0 bytes tools/qml/content/images/titlebar.sci | 5 - tools/qml/content/images/up.png | Bin 662 -> 0 bytes tools/qml/main.cpp | 476 +++++++++++++++++++++------------- tools/qml/qml.pri | 4 +- tools/qml/qmlruntime.cpp | 62 ++++- tools/qml/qmlruntime.h | 1 + tools/qml/qmlruntime.qrc | 9 - tools/qml/startup/Logo.qml | 138 ++++++++++ tools/qml/startup/qt-back.png | Bin 0 -> 3549 bytes tools/qml/startup/qt-blue.jpg | Bin 0 -> 20900 bytes tools/qml/startup/qt-front.png | Bin 0 -> 3318 bytes tools/qml/startup/qt-sketch.jpg | Bin 0 -> 17048 bytes tools/qml/startup/qt-text.png | Bin 0 -> 14565 bytes tools/qml/startup/quick-blur.png | Bin 0 -> 2826 bytes tools/qml/startup/quick-regular.png | Bin 0 -> 1399 bytes tools/qml/startup/shadow.png | Bin 0 -> 1592 bytes tools/qml/startup/startup.qml | 126 +++++++++ tools/qml/startup/startup.qrc | 16 ++ tools/qml/startup/white-star.png | Bin 0 -> 2651 bytes 29 files changed, 968 insertions(+), 482 deletions(-) create mode 100644 tools/qml/browser/Browser.qml create mode 100644 tools/qml/browser/browser.qrc create mode 100644 tools/qml/browser/images/folder.png create mode 100644 tools/qml/browser/images/titlebar.png create mode 100644 tools/qml/browser/images/titlebar.sci create mode 100644 tools/qml/browser/images/up.png delete mode 100644 tools/qml/content/Browser.qml delete mode 100644 tools/qml/content/images/folder.png delete mode 100644 tools/qml/content/images/titlebar.png delete mode 100644 tools/qml/content/images/titlebar.sci delete mode 100644 tools/qml/content/images/up.png delete mode 100644 tools/qml/qmlruntime.qrc create mode 100644 tools/qml/startup/Logo.qml create mode 100644 tools/qml/startup/qt-back.png create mode 100644 tools/qml/startup/qt-blue.jpg create mode 100644 tools/qml/startup/qt-front.png create mode 100644 tools/qml/startup/qt-sketch.jpg create mode 100644 tools/qml/startup/qt-text.png create mode 100644 tools/qml/startup/quick-blur.png create mode 100644 tools/qml/startup/quick-regular.png create mode 100644 tools/qml/startup/shadow.png create mode 100644 tools/qml/startup/startup.qml create mode 100644 tools/qml/startup/startup.qrc create mode 100644 tools/qml/startup/white-star.png diff --git a/tools/qml/Info_mac.plist b/tools/qml/Info_mac.plist index 80ca6a3..0877547 100644 --- a/tools/qml/Info_mac.plist +++ b/tools/qml/Info_mac.plist @@ -14,5 +14,36 @@ @TYPEINFO@ CFBundleExecutable @EXECUTABLE@ + UTExportedTypeDeclarations + + + UTTypeIdentifier + com.nokia.qt.qml + UTTypeDescription + Qt Markup Language + UTTypeConformsTo + + public.plain-text + + UTTypeTagSpecification + + public.filename-extension + + qml + + + + + CFBundleDocumentTypes + + + LSItemContentTypes + + com.nokia.qt.qml + + CFBundleTypeRole + Viewer + + diff --git a/tools/qml/browser/Browser.qml b/tools/qml/browser/Browser.qml new file mode 100644 index 0000000..ff2bb47 --- /dev/null +++ b/tools/qml/browser/Browser.qml @@ -0,0 +1,284 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 +import Qt.labs.folderlistmodel 1.0 + +Rectangle { + id: root + property bool keyPressed: false + property variant folders: folders1 + property variant view: view1 + width: 320 + height: 480 + color: palette.window + + FolderListModel { + id: folders1 + nameFilters: [ "*.qml" ] + folder: qmlViewerFolder + } + FolderListModel { + id: folders2 + nameFilters: [ "*.qml" ] + folder: qmlViewerFolder + } + + SystemPalette { id: palette } + + function down(path) { + if (folders == folders1) { + view = view2 + folders = folders2; + view1.state = "exitLeft"; + } else { + view = view1 + folders = folders1; + view2.state = "exitLeft"; + } + view.x = root.width; + view.state = "current"; + view.focus = true; + folders.folder = path; + } + function up() { + var path = folders.parentFolder; + if (folders == folders1) { + view = view2 + folders = folders2; + view1.state = "exitRight"; + } else { + view = view1 + folders = folders1; + view2.state = "exitRight"; + } + view.x = -root.width; + view.state = "current"; + view.focus = true; + folders.folder = path; + } + + Component { + id: folderDelegate + Rectangle { + id: wrapper + function launch() { + if (folders.isFolder(index)) { + down(filePath); + } else { + qmlViewer.launch(filePath); + } + } + width: root.width + height: 52 + color: "transparent" + Rectangle { + id: highlight; visible: false + anchors.fill: parent + gradient: Gradient { + GradientStop { id: t1; position: 0.0; color: palette.highlight } + GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) } + } + } + Item { + width: 48; height: 48 + Image { source: "images/folder.png"; anchors.centerIn: parent; visible: folders.isFolder(index)} + } + Text { + id: nameText + anchors.fill: parent; verticalAlignment: Text.AlignVCenter + text: fileName + anchors.leftMargin: 54 + font.pixelSize: 32 + color: (wrapper.ListView.isCurrentItem && root.keyPressed) ? palette.highlightedText : palette.windowText + elide: Text.ElideRight + } + MouseArea { + id: mouseRegion + anchors.fill: parent + onClicked: { if (folders == wrapper.ListView.view.model) launch() } + } + states: [ + State { + name: "pressed" + when: mouseRegion.pressed + PropertyChanges { target: highlight; visible: true } + PropertyChanges { target: nameText; color: palette.highlightedText } + } + ] + } + } + + ListView { + id: view1 + anchors.top: titleBar.bottom + anchors.bottom: parent.bottom + x: 0 + width: parent.width + model: folders1 + delegate: folderDelegate + highlight: Rectangle { color: palette.highlight; visible: root.keyPressed && view1.count != 0 } + highlightMoveSpeed: 1000 + pressDelay: 100 + focus: true + state: "current" + states: [ + State { + name: "current" + PropertyChanges { target: view1; x: 0 } + }, + State { + name: "exitLeft" + PropertyChanges { target: view1; x: -root.width } + }, + State { + name: "exitRight" + PropertyChanges { target: view1; x: root.width } + } + ] + transitions: [ + Transition { + to: "current" + SequentialAnimation { + NumberAnimation { properties: "x"; duration: 250 } + } + }, + Transition { + NumberAnimation { properties: "x"; duration: 250 } + NumberAnimation { properties: "x"; duration: 250 } + } + ] + Keys.onPressed: { root.keyPressed = true; } + } + + ListView { + id: view2 + anchors.top: titleBar.bottom + anchors.bottom: parent.bottom + x: parent.width + width: parent.width + model: folders2 + delegate: folderDelegate + highlight: Rectangle { color: palette.highlight; visible: root.keyPressed && view2.count != 0 } + highlightMoveSpeed: 1000 + pressDelay: 100 + states: [ + State { + name: "current" + PropertyChanges { target: view2; x: 0 } + }, + State { + name: "exitLeft" + PropertyChanges { target: view2; x: -root.width } + }, + State { + name: "exitRight" + PropertyChanges { target: view2; x: root.width } + } + ] + transitions: [ + Transition { + to: "current" + SequentialAnimation { + NumberAnimation { properties: "x"; duration: 250 } + } + }, + Transition { + NumberAnimation { properties: "x"; duration: 250 } + } + ] + Keys.onPressed: { root.keyPressed = true; } + } + + Keys.onPressed: { + root.keyPressed = true; + if (event.key == Qt.Key_Return || event.key == Qt.Key_Select || event.key == Qt.Key_Right) { + view.currentItem.launch(); + event.accepted = true; + } else if (event.key == Qt.Key_Left) { + up(); + } + } + + BorderImage { + source: "images/titlebar.sci"; + width: parent.width; + height: 52 + y: -7 + id: titleBar + + Rectangle { + id: upButton + width: 48 + height: titleBar.height - 7 + color: "transparent" + + Image { anchors.centerIn: parent; source: "images/up.png" } + MouseArea { id: upRegion; anchors.centerIn: parent + width: 56 + height: 56 + onClicked: if (folders.parentFolder != "") up() + } + states: [ + State { + name: "pressed" + when: upRegion.pressed + PropertyChanges { target: upButton; color: palette.highlight } + } + ] + } + Rectangle { + color: "gray" + x: 48 + width: 1 + height: 44 + } + + Text { + anchors.left: upButton.right; anchors.right: parent.right; height: parent.height + anchors.leftMargin: 4; anchors.rightMargin: 4 + text: folders.folder + color: "white" + elide: Text.ElideLeft; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter + font.pixelSize: 32 + } + } +} diff --git a/tools/qml/browser/browser.qrc b/tools/qml/browser/browser.qrc new file mode 100644 index 0000000..9c688e7 --- /dev/null +++ b/tools/qml/browser/browser.qrc @@ -0,0 +1,9 @@ + + + Browser.qml + images/up.png + images/folder.png + images/titlebar.sci + images/titlebar.png + + diff --git a/tools/qml/browser/images/folder.png b/tools/qml/browser/images/folder.png new file mode 100644 index 0000000..e53e2ad Binary files /dev/null and b/tools/qml/browser/images/folder.png differ diff --git a/tools/qml/browser/images/titlebar.png b/tools/qml/browser/images/titlebar.png new file mode 100644 index 0000000..51c9008 Binary files /dev/null and b/tools/qml/browser/images/titlebar.png differ diff --git a/tools/qml/browser/images/titlebar.sci b/tools/qml/browser/images/titlebar.sci new file mode 100644 index 0000000..0418d94 --- /dev/null +++ b/tools/qml/browser/images/titlebar.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 12 +border.bottom: 12 +border.right: 10 +source: titlebar.png diff --git a/tools/qml/browser/images/up.png b/tools/qml/browser/images/up.png new file mode 100644 index 0000000..b05f802 Binary files /dev/null and b/tools/qml/browser/images/up.png differ diff --git a/tools/qml/content/Browser.qml b/tools/qml/content/Browser.qml deleted file mode 100644 index ff2bb47..0000000 --- a/tools/qml/content/Browser.qml +++ /dev/null @@ -1,284 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 -import Qt.labs.folderlistmodel 1.0 - -Rectangle { - id: root - property bool keyPressed: false - property variant folders: folders1 - property variant view: view1 - width: 320 - height: 480 - color: palette.window - - FolderListModel { - id: folders1 - nameFilters: [ "*.qml" ] - folder: qmlViewerFolder - } - FolderListModel { - id: folders2 - nameFilters: [ "*.qml" ] - folder: qmlViewerFolder - } - - SystemPalette { id: palette } - - function down(path) { - if (folders == folders1) { - view = view2 - folders = folders2; - view1.state = "exitLeft"; - } else { - view = view1 - folders = folders1; - view2.state = "exitLeft"; - } - view.x = root.width; - view.state = "current"; - view.focus = true; - folders.folder = path; - } - function up() { - var path = folders.parentFolder; - if (folders == folders1) { - view = view2 - folders = folders2; - view1.state = "exitRight"; - } else { - view = view1 - folders = folders1; - view2.state = "exitRight"; - } - view.x = -root.width; - view.state = "current"; - view.focus = true; - folders.folder = path; - } - - Component { - id: folderDelegate - Rectangle { - id: wrapper - function launch() { - if (folders.isFolder(index)) { - down(filePath); - } else { - qmlViewer.launch(filePath); - } - } - width: root.width - height: 52 - color: "transparent" - Rectangle { - id: highlight; visible: false - anchors.fill: parent - gradient: Gradient { - GradientStop { id: t1; position: 0.0; color: palette.highlight } - GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) } - } - } - Item { - width: 48; height: 48 - Image { source: "images/folder.png"; anchors.centerIn: parent; visible: folders.isFolder(index)} - } - Text { - id: nameText - anchors.fill: parent; verticalAlignment: Text.AlignVCenter - text: fileName - anchors.leftMargin: 54 - font.pixelSize: 32 - color: (wrapper.ListView.isCurrentItem && root.keyPressed) ? palette.highlightedText : palette.windowText - elide: Text.ElideRight - } - MouseArea { - id: mouseRegion - anchors.fill: parent - onClicked: { if (folders == wrapper.ListView.view.model) launch() } - } - states: [ - State { - name: "pressed" - when: mouseRegion.pressed - PropertyChanges { target: highlight; visible: true } - PropertyChanges { target: nameText; color: palette.highlightedText } - } - ] - } - } - - ListView { - id: view1 - anchors.top: titleBar.bottom - anchors.bottom: parent.bottom - x: 0 - width: parent.width - model: folders1 - delegate: folderDelegate - highlight: Rectangle { color: palette.highlight; visible: root.keyPressed && view1.count != 0 } - highlightMoveSpeed: 1000 - pressDelay: 100 - focus: true - state: "current" - states: [ - State { - name: "current" - PropertyChanges { target: view1; x: 0 } - }, - State { - name: "exitLeft" - PropertyChanges { target: view1; x: -root.width } - }, - State { - name: "exitRight" - PropertyChanges { target: view1; x: root.width } - } - ] - transitions: [ - Transition { - to: "current" - SequentialAnimation { - NumberAnimation { properties: "x"; duration: 250 } - } - }, - Transition { - NumberAnimation { properties: "x"; duration: 250 } - NumberAnimation { properties: "x"; duration: 250 } - } - ] - Keys.onPressed: { root.keyPressed = true; } - } - - ListView { - id: view2 - anchors.top: titleBar.bottom - anchors.bottom: parent.bottom - x: parent.width - width: parent.width - model: folders2 - delegate: folderDelegate - highlight: Rectangle { color: palette.highlight; visible: root.keyPressed && view2.count != 0 } - highlightMoveSpeed: 1000 - pressDelay: 100 - states: [ - State { - name: "current" - PropertyChanges { target: view2; x: 0 } - }, - State { - name: "exitLeft" - PropertyChanges { target: view2; x: -root.width } - }, - State { - name: "exitRight" - PropertyChanges { target: view2; x: root.width } - } - ] - transitions: [ - Transition { - to: "current" - SequentialAnimation { - NumberAnimation { properties: "x"; duration: 250 } - } - }, - Transition { - NumberAnimation { properties: "x"; duration: 250 } - } - ] - Keys.onPressed: { root.keyPressed = true; } - } - - Keys.onPressed: { - root.keyPressed = true; - if (event.key == Qt.Key_Return || event.key == Qt.Key_Select || event.key == Qt.Key_Right) { - view.currentItem.launch(); - event.accepted = true; - } else if (event.key == Qt.Key_Left) { - up(); - } - } - - BorderImage { - source: "images/titlebar.sci"; - width: parent.width; - height: 52 - y: -7 - id: titleBar - - Rectangle { - id: upButton - width: 48 - height: titleBar.height - 7 - color: "transparent" - - Image { anchors.centerIn: parent; source: "images/up.png" } - MouseArea { id: upRegion; anchors.centerIn: parent - width: 56 - height: 56 - onClicked: if (folders.parentFolder != "") up() - } - states: [ - State { - name: "pressed" - when: upRegion.pressed - PropertyChanges { target: upButton; color: palette.highlight } - } - ] - } - Rectangle { - color: "gray" - x: 48 - width: 1 - height: 44 - } - - Text { - anchors.left: upButton.right; anchors.right: parent.right; height: parent.height - anchors.leftMargin: 4; anchors.rightMargin: 4 - text: folders.folder - color: "white" - elide: Text.ElideLeft; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter - font.pixelSize: 32 - } - } -} diff --git a/tools/qml/content/images/folder.png b/tools/qml/content/images/folder.png deleted file mode 100644 index e53e2ad..0000000 Binary files a/tools/qml/content/images/folder.png and /dev/null differ diff --git a/tools/qml/content/images/titlebar.png b/tools/qml/content/images/titlebar.png deleted file mode 100644 index 51c9008..0000000 Binary files a/tools/qml/content/images/titlebar.png and /dev/null differ diff --git a/tools/qml/content/images/titlebar.sci b/tools/qml/content/images/titlebar.sci deleted file mode 100644 index 0418d94..0000000 --- a/tools/qml/content/images/titlebar.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 10 -border.top: 12 -border.bottom: 12 -border.right: 10 -source: titlebar.png diff --git a/tools/qml/content/images/up.png b/tools/qml/content/images/up.png deleted file mode 100644 index b05f802..0000000 Binary files a/tools/qml/content/images/up.png and /dev/null differ diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 4b1162e..7421b5e 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -56,7 +56,8 @@ QT_USE_NAMESPACE QtMsgHandler systemMsgOutput = 0; - +static QDeclarativeViewer *openFile(const QString &fileName); +static void showViewer(QDeclarativeViewer *viewer); #if defined (Q_OS_SYMBIAN) #include @@ -117,6 +118,11 @@ void myMessageOutput(QtMsgType type, const char *msg) #endif +static QDeclarativeViewer* globalViewer = 0; + +// The qml file that is shown if the user didn't specify a QML file +QString initialFile = "qrc:/startup/startup.qml"; + void usage() { qWarning("Usage: qmlviewer [options] "); @@ -175,135 +181,200 @@ void scriptOptsUsage() enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings }; -int main(int argc, char ** argv) +struct ViewerOptions { -#if defined (Q_OS_SYMBIAN) - qInstallMsgHandler(myMessageOutput); -#else - systemMsgOutput = qInstallMsgHandler(myMessageOutput); + ViewerOptions() + : frameless(false), + fps(0.0), + autorecord_from(0), + autorecord_to(0), + dither("none"), + runScript(false), + devkeys(false), + cache(0), + useGL(false), + fullScreen(false), + stayOnTop(false), + maximized(false), + useNativeFileBrowser(true), + experimentalGestures(false), + warningsConfig(DefaultWarnings), + sizeToView(true) + { +#if defined(Q_OS_SYMBIAN) + maximized = true; + useNativeFileBrowser = false; #endif -#if defined (Q_OS_WIN) - // Debugging output is not visible by default on Windows - - // therefore show modal dialog with errors instad. - atexit(showWarnings); +#if defined(Q_WS_MAC) + useGL = true; #endif - -#if defined (Q_WS_X11) || defined (Q_WS_MAC) - //### default to using raster graphics backend for now - bool gsSpecified = false; - for (int i = 0; i < argc; ++i) { - QString arg = argv[i]; - if (arg == "-graphicssystem") { - gsSpecified = true; - break; - } } - if (!gsSpecified) - QApplication::setGraphicsSystem("raster"); -#endif - - QApplication app(argc, argv); - app.setApplicationName("QtQmlViewer"); - app.setOrganizationName("Nokia"); - app.setOrganizationDomain("nokia.com"); - - - - QDeclarativeViewer::registerTypes(); - QDeclarativeTester::registerTypes(); - - bool frameless = false; - QString fileName; - double fps = 0; - int autorecord_from = 0; - int autorecord_to = 0; - QString dither = "none"; + bool frameless; + double fps; + int autorecord_from; + int autorecord_to; + QString dither; QString recordfile; QStringList recordargs; QStringList imports; QStringList plugins; QString script; QString scriptopts; - bool runScript = false; - bool devkeys = false; - int cache = 0; + bool runScript; + bool devkeys; + int cache; QString translationFile; - bool useGL = false; - bool fullScreen = false; - bool stayOnTop = false; - bool maximized = false; - bool useNativeFileBrowser = true; - bool experimentalGestures = false; + bool useGL; + bool fullScreen; + bool stayOnTop; + bool maximized; + bool useNativeFileBrowser; + bool experimentalGestures; - WarningsConfig warningsConfig = DefaultWarnings; - bool sizeToView = true; + WarningsConfig warningsConfig; + bool sizeToView; -#if defined(Q_OS_SYMBIAN) - maximized = true; - useNativeFileBrowser = false; -#endif + QDeclarativeViewer::ScriptOptions scriptOptions; +}; -#if defined(Q_WS_MAC) - useGL = true; -#endif +static ViewerOptions opts; +static QStringList fileNames; - for (int i = 1; i < argc; ++i) { - bool lastArg = (i == argc - 1); - QString arg = argv[i]; +class Application : public QApplication +{ + Q_OBJECT +public: + Application(int &argc, char **&argv) + : QApplication(argc, argv) + {} + +protected: + bool event(QEvent *ev) + { + if (ev->type() != QEvent::FileOpen) + return QApplication::event(ev); + + QFileOpenEvent *fev = static_cast(ev); + + globalViewer->open(fev->file()); + if (!globalViewer->isVisible()) + showViewer(globalViewer); + + return true; + } + +private Q_SLOTS: + void showInitialViewer() + { + QApplication::processEvents(); + + QDeclarativeViewer *viewer = globalViewer; + if (!viewer) + return; + if (viewer->currentFile().isEmpty()) { + if(opts.useNativeFileBrowser) + viewer->open(initialFile); + else + viewer->openFile(); + } + if (!viewer->isVisible()) + showViewer(viewer); + } +}; + +static void parseScriptOptions() +{ + QStringList options = + opts.scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts); + + QDeclarativeViewer::ScriptOptions scriptOptions = 0; + for (int i = 0; i < options.count(); ++i) { + const QString &option = options.at(i); + if (option == QLatin1String("help")) { + scriptOptsUsage(); + } else if (option == QLatin1String("play")) { + scriptOptions |= QDeclarativeViewer::Play; + } else if (option == QLatin1String("record")) { + scriptOptions |= QDeclarativeViewer::Record; + } else if (option == QLatin1String("testimages")) { + scriptOptions |= QDeclarativeViewer::TestImages; + } else if (option == QLatin1String("testerror")) { + scriptOptions |= QDeclarativeViewer::TestErrorProperty; + } else if (option == QLatin1String("exitoncomplete")) { + scriptOptions |= QDeclarativeViewer::ExitOnComplete; + } else if (option == QLatin1String("exitonfailure")) { + scriptOptions |= QDeclarativeViewer::ExitOnFailure; + } else if (option == QLatin1String("saveonexit")) { + scriptOptions |= QDeclarativeViewer::SaveOnExit; + } else if (option == QLatin1String("snapshot")) { + scriptOptions |= QDeclarativeViewer::Snapshot; + } else { + scriptOptsUsage(); + } + } + + opts.scriptOptions = scriptOptions; +} + +static void parseCommandLineOptions(const QStringList &arguments) +{ + for (int i = 1; i < arguments.count(); ++i) { + bool lastArg = (i == arguments.count() - 1); + QString arg = arguments.at(i); if (arg == "-frameless") { - frameless = true; + opts.frameless = true; } else if (arg == "-maximized") { - maximized = true; + opts.maximized = true; } else if (arg == "-fullscreen") { - fullScreen = true; + opts.fullScreen = true; } else if (arg == "-stayontop") { - stayOnTop = true; + opts.stayOnTop = true; } else if (arg == "-netcache") { if (lastArg) usage(); - cache = QString(argv[++i]).toInt(); + opts.cache = arguments.at(++i).toInt(); } else if (arg == "-recordrate") { if (lastArg) usage(); - fps = QString(argv[++i]).toDouble(); + opts.fps = arguments.at(++i).toDouble(); } else if (arg == "-recordfile") { if (lastArg) usage(); - recordfile = QString(argv[++i]); + opts.recordfile = arguments.at(++i); } else if (arg == "-record") { if (lastArg) usage(); - recordargs << QString(argv[++i]); + opts.recordargs << arguments.at(++i); } else if (arg == "-recorddither") { if (lastArg) usage(); - dither = QString(argv[++i]); + opts.dither = arguments.at(++i); } else if (arg == "-autorecord") { if (lastArg) usage(); - QString range = QString(argv[++i]); + QString range = arguments.at(++i); int dash = range.indexOf('-'); if (dash > 0) - autorecord_from = range.left(dash).toInt(); - autorecord_to = range.mid(dash+1).toInt(); + opts.autorecord_from = range.left(dash).toInt(); + opts.autorecord_to = range.mid(dash+1).toInt(); } else if (arg == "-devicekeys") { - devkeys = true; + opts.devkeys = true; } else if (arg == "-dragthreshold") { if (lastArg) usage(); - app.setStartDragDistance(QString(argv[++i]).toInt()); + qApp->setStartDragDistance(arguments.at(++i).toInt()); } else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) { qWarning("Qt QML Viewer version %s", QT_VERSION_STR); exit(0); } else if (arg == "-translation") { if (lastArg) usage(); - translationFile = argv[++i]; + opts.translationFile = arguments.at(++i); } else if (arg == "-opengl") { - useGL = true; + opts.useGL = true; } else if (arg == "-qmlbrowser") { - useNativeFileBrowser = false; + opts.useNativeFileBrowser = false; } else if (arg == "-warnings") { if (lastArg) usage(); - QString warningsStr = QString(argv[++i]); + QString warningsStr = arguments.at(++i); if (warningsStr == QLatin1String("show")) { - warningsConfig = ShowWarnings; + opts.warningsConfig = ShowWarnings; } else if (warningsStr == QLatin1String("hide")) { - warningsConfig = HideWarnings; + opts.warningsConfig = HideWarnings; } else { usage(); } @@ -316,152 +387,203 @@ int main(int argc, char ** argv) qWarning("Current search path: %s", paths.toLocal8Bit().constData()); exit(0); } - imports << QString(argv[++i]); + opts.imports << arguments.at(++i); } else if (arg == "-P") { if (lastArg) usage(); - plugins << QString(argv[++i]); + opts.plugins << arguments.at(++i); } else if (arg == "-script") { if (lastArg) usage(); - script = QString(argv[++i]); + opts.script = arguments.at(++i); } else if (arg == "-scriptopts") { if (lastArg) usage(); - scriptopts = QString(argv[++i]); + opts.scriptopts = arguments.at(++i); } else if (arg == "-savescript") { if (lastArg) usage(); - script = QString(argv[++i]); - runScript = false; + opts.script = arguments.at(++i); + opts.runScript = false; } else if (arg == "-playscript") { if (lastArg) usage(); - script = QString(argv[++i]); - runScript = true; + opts.script = arguments.at(++i); + opts.runScript = true; } else if (arg == "-sizeviewtorootobject") { - sizeToView = false; + opts.sizeToView = false; } else if (arg == "-sizerootobjecttoview") { - sizeToView = true; + opts.sizeToView = true; } else if (arg == "-experimentalgestures") { - experimentalGestures = true; - } else if (arg[0] != '-') { - fileName = arg; - } else if (1 || arg == "-help") { + opts.experimentalGestures = true; + } else if (!arg.startsWith('-')) { + fileNames.append(arg); + } else if (true || arg == "-help") { usage(); } } - QTranslator qmlTranslator; - if (!translationFile.isEmpty()) { - qmlTranslator.load(translationFile); - app.installTranslator(&qmlTranslator); + if (!opts.scriptopts.isEmpty()) { + + parseScriptOptions(); + + if (opts.script.isEmpty()) + usage(); + + if (!(opts.scriptOptions & QDeclarativeViewer::Record) && !(opts.scriptOptions & QDeclarativeViewer::Play)) + scriptOptsUsage(); + } else if (!opts.script.isEmpty()) { + usage(); } - Qt::WFlags wflags = (frameless ? Qt::FramelessWindowHint : Qt::Widget); - if (stayOnTop) +} + +static QDeclarativeViewer *createViewer() +{ + Qt::WFlags wflags = (opts.frameless ? Qt::FramelessWindowHint : Qt::Widget); + if (opts.stayOnTop) wflags |= Qt::WindowStaysOnTopHint; QDeclarativeViewer *viewer = new QDeclarativeViewer(0, wflags); viewer->setAttribute(Qt::WA_DeleteOnClose, true); - if (!scriptopts.isEmpty()) { - QStringList options = - scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts); - - QDeclarativeViewer::ScriptOptions scriptOptions = 0; - for (int i = 0; i < options.count(); ++i) { - const QString &option = options.at(i); - if (option == QLatin1String("help")) { - scriptOptsUsage(); - } else if (option == QLatin1String("play")) { - scriptOptions |= QDeclarativeViewer::Play; - } else if (option == QLatin1String("record")) { - scriptOptions |= QDeclarativeViewer::Record; - } else if (option == QLatin1String("testimages")) { - scriptOptions |= QDeclarativeViewer::TestImages; - } else if (option == QLatin1String("testerror")) { - scriptOptions |= QDeclarativeViewer::TestErrorProperty; - } else if (option == QLatin1String("exitoncomplete")) { - scriptOptions |= QDeclarativeViewer::ExitOnComplete; - } else if (option == QLatin1String("exitonfailure")) { - scriptOptions |= QDeclarativeViewer::ExitOnFailure; - } else if (option == QLatin1String("saveonexit")) { - scriptOptions |= QDeclarativeViewer::SaveOnExit; - } else if (option == QLatin1String("snapshot")) { - scriptOptions |= QDeclarativeViewer::Snapshot; - } else { - scriptOptsUsage(); - } - } - - if (script.isEmpty()) - usage(); - if (!(scriptOptions & QDeclarativeViewer::Record) && !(scriptOptions & QDeclarativeViewer::Play)) - scriptOptsUsage(); - viewer->setScriptOptions(scriptOptions); - viewer->setScript(script); - } else if (!script.isEmpty()) { - usage(); + if (!opts.scriptopts.isEmpty()) { + viewer->setScriptOptions(opts.scriptOptions); + viewer->setScript(opts.script); } #if !defined(Q_OS_SYMBIAN) logger = viewer->warningsWidget(); - if (warningsConfig == ShowWarnings) { + if (opts.warningsConfig == ShowWarnings) { logger.data()->setDefaultVisibility(LoggerWidget::ShowWarnings); logger.data()->show(); - } else if (warningsConfig == HideWarnings){ + } else if (opts.warningsConfig == HideWarnings){ logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings); } #endif - if (experimentalGestures) + if (opts.experimentalGestures) viewer->enableExperimentalGestures(); - foreach (QString lib, imports) + foreach (QString lib, opts.imports) viewer->addLibraryPath(lib); - foreach (QString plugin, plugins) + foreach (QString plugin, opts.plugins) viewer->addPluginPath(plugin); - viewer->setNetworkCacheSize(cache); - viewer->setRecordFile(recordfile); - viewer->setSizeToView(sizeToView); - if (fps>0) - viewer->setRecordRate(fps); - if (autorecord_to) - viewer->setAutoRecord(autorecord_from,autorecord_to); - if (devkeys) + viewer->setNetworkCacheSize(opts.cache); + viewer->setRecordFile(opts.recordfile); + viewer->setSizeToView(opts.sizeToView); + if (opts.fps > 0) + viewer->setRecordRate(opts.fps); + if (opts.autorecord_to) + viewer->setAutoRecord(opts.autorecord_from, opts.autorecord_to); + if (opts.devkeys) viewer->setDeviceKeys(true); - viewer->setRecordDither(dither); - if (recordargs.count()) - viewer->setRecordArgs(recordargs); + viewer->setRecordDither(opts.dither); + if (opts.recordargs.count()) + viewer->setRecordArgs(opts.recordargs); + + viewer->setUseNativeFileBrowser(opts.useNativeFileBrowser); - viewer->setUseNativeFileBrowser(useNativeFileBrowser); - if (fullScreen && maximized) + return viewer; +} + +void showViewer(QDeclarativeViewer *viewer) +{ + if (opts.fullScreen) + viewer->showFullScreen(); + else if (opts.maximized) + viewer->showMaximized(); + else + viewer->show(); + + viewer->setUseGL(opts.useGL); + viewer->raise(); +} + +QDeclarativeViewer *openFile(const QString &fileName) +{ + QDeclarativeViewer *viewer = globalViewer; + + viewer->open(fileName); + showViewer(viewer); + + return viewer; +} + +int main(int argc, char ** argv) +{ +#if defined (Q_OS_SYMBIAN) + qInstallMsgHandler(myMessageOutput); +#else + systemMsgOutput = qInstallMsgHandler(myMessageOutput); +#endif + +#if defined (Q_OS_WIN) + // Debugging output is not visible by default on Windows - + // therefore show modal dialog with errors instad. + atexit(showWarnings); +#endif + +#if defined (Q_WS_X11) || defined (Q_WS_MAC) + //### default to using raster graphics backend for now + bool gsSpecified = false; + for (int i = 0; i < argc; ++i) { + QString arg = argv[i]; + if (arg == "-graphicssystem") { + gsSpecified = true; + break; + } + } + + if (!gsSpecified) + QApplication::setGraphicsSystem("raster"); +#endif + + Application app(argc, argv); + app.setApplicationName("QtQmlViewer"); + app.setOrganizationName("Nokia"); + app.setOrganizationDomain("nokia.com"); + + QDeclarativeViewer::registerTypes(); + QDeclarativeTester::registerTypes(); + + parseCommandLineOptions(app.arguments()); + + QTranslator qmlTranslator; + if (!opts.translationFile.isEmpty()) { + qmlTranslator.load(opts.translationFile); + app.installTranslator(&qmlTranslator); + } + + if (opts.fullScreen && opts.maximized) qWarning() << "Both -fullscreen and -maximized specified. Using -fullscreen."; - if (fileName.isEmpty()) { + if (fileNames.isEmpty()) { QFile qmlapp(QLatin1String("qmlapp")); if (qmlapp.exists() && qmlapp.open(QFile::ReadOnly)) { - QString content = QString::fromUtf8(qmlapp.readAll()); - qmlapp.close(); - - int newline = content.indexOf(QLatin1Char('\n')); - if (newline >= 0) - fileName = content.left(newline); - else - fileName = content; - } + QString content = QString::fromUtf8(qmlapp.readAll()); + qmlapp.close(); + + int newline = content.indexOf(QLatin1Char('\n')); + if (newline >= 0) + fileNames += content.left(newline); + else + fileNames += content; + } } - if (!fileName.isEmpty()) { - viewer->open(fileName); - fullScreen ? viewer->showFullScreen() : maximized ? viewer->showMaximized() : viewer->show(); + globalViewer = createViewer(); + + if (fileNames.isEmpty()) { + // show the initial viewer delayed. + // This prevents an initial viewer popping up while there + // are FileOpen events coming through the event queue + QTimer::singleShot(1, &app, SLOT(showInitialViewer())); } else { - if (!useNativeFileBrowser) - viewer->openFile(); - fullScreen ? viewer->showFullScreen() : maximized ? viewer->showMaximized() : viewer->show(); - if (useNativeFileBrowser) - viewer->openFile(); + foreach (const QString &fileName, fileNames) + openFile(fileName); } - viewer->setUseGL(useGL); - viewer->raise(); + + QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); return app.exec(); } + +#include "main.moc" diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri index 80afb45..e5b2c7f 100644 --- a/tools/qml/qml.pri +++ b/tools/qml/qml.pri @@ -16,7 +16,9 @@ SOURCES += $$PWD/qmlruntime.cpp \ $$PWD/qdeclarativetester.cpp \ $$PWD/loggerwidget.cpp -RESOURCES = $$PWD/qmlruntime.qrc +RESOURCES = $$PWD/browser/browser.qrc \ + $$PWD/startup/startup.qrc + symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { SOURCES += $$PWD/deviceorientation_symbian.cpp FORMS = $$PWD/recopts.ui \ diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 951b187..08a578c 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -102,6 +102,49 @@ QT_BEGIN_NAMESPACE +class DragAndDropView : public QDeclarativeView +{ + Q_OBJECT +public: + DragAndDropView(QDeclarativeViewer *parent = 0) + : QDeclarativeView(parent) + { + setAcceptDrops(true); + } + + void dragEnterEvent(QDragEnterEvent *event) + { + const QMimeData *mimeData = event->mimeData(); + if (mimeData->hasUrls()) + event->acceptProposedAction(); + } + + void dragMoveEvent(QDragMoveEvent *event) + { + event->acceptProposedAction(); + } + + void dragLeaveEvent(QDragLeaveEvent *event) + { + event->accept(); + } + + void dropEvent(QDropEvent *event) + { + const QMimeData *mimeData = event->mimeData(); + if (!mimeData->hasUrls()) + return; + const QList urlList = mimeData->urls(); + foreach (const QUrl &url, urlList) { + if (url.scheme() == QLatin1String("file")) { + static_cast(parent())->open(url.toLocalFile()); + event->accept(); + return; + } + } + } +}; + class Runtime : public QObject { Q_OBJECT @@ -596,7 +639,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) recdlg->warning->hide(); } - canvas = new QDeclarativeView(this); + canvas = new DragAndDropView(this); canvas->setAttribute(Qt::WA_OpaquePaintEvent); canvas->setAttribute(Qt::WA_NoSystemBackground); @@ -605,7 +648,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged())); - QObject::connect(canvas->engine(), SIGNAL(quit()), QCoreApplication::instance (), SLOT(quit())); + QObject::connect(canvas->engine(), SIGNAL(quit()), this, SLOT(close())); QObject::connect(warningsWidget(), SIGNAL(opened()), this, SLOT(warningsWidgetOpened())); QObject::connect(warningsWidget(), SIGNAL(closed()), this, SLOT(warningsWidgetClosed())); @@ -664,11 +707,11 @@ LoggerWidget *QDeclarativeViewer::warningsWidget() const void QDeclarativeViewer::createMenu() { QAction *openAction = new QAction(tr("&Open..."), this); - openAction->setShortcut(QKeySequence("Ctrl+O")); + openAction->setShortcuts(QKeySequence::Open); connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); QAction *reloadAction = new QAction(tr("&Reload"), this); - reloadAction->setShortcut(QKeySequence("Ctrl+R")); + reloadAction->setShortcuts(QKeySequence::Refresh); connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload())); QAction *snapshotAction = new QAction(tr("&Take Snapshot"), this); @@ -717,10 +760,16 @@ void QDeclarativeViewer::createMenu() landscapeInvAction->setCheckable(true); QAction *aboutAction = new QAction(tr("&About Qt..."), this); + aboutAction->setMenuRole(QAction::AboutQtRole); connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); + QAction *closeAction = new QAction(tr("&Close"), this); + closeAction->setShortcuts(QKeySequence::Close); + connect(closeAction, SIGNAL(triggered()), this, SLOT(close())); + QAction *quitAction = new QAction(tr("&Quit"), this); - quitAction->setShortcut(QKeySequence("Ctrl+Q")); + quitAction->setMenuRole(QAction::QuitRole); + quitAction->setShortcuts(QKeySequence::Quit); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); QMenuBar *menu = menuBar(); @@ -751,6 +800,7 @@ void QDeclarativeViewer::createMenu() fileMenu->addAction(openAction); fileMenu->addAction(reloadAction); fileMenu->addSeparator(); + fileMenu->addAction(closeAction); fileMenu->addAction(quitAction); #if !defined(Q_OS_SYMBIAN) @@ -927,7 +977,7 @@ void QDeclarativeViewer::openFile() { QString cur = canvas->source().toLocalFile(); if (useQmlFileBrowser) { - open("qrc:/content/Browser.qml"); + open("qrc:/browser/Browser.qml"); } else { QString fileName = QFileDialog::getOpenFileName(this, tr("Open QML file"), cur, tr("QML Files (*.qml)")); if (!fileName.isEmpty()) { diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index 68d3452..7385b14 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -105,6 +105,7 @@ public: QDeclarativeView *view() const; LoggerWidget *warningsWidget() const; + QString currentFile() const { return currentFileOrUrl; } void enableExperimentalGestures(); diff --git a/tools/qml/qmlruntime.qrc b/tools/qml/qmlruntime.qrc deleted file mode 100644 index 3a9e608..0000000 --- a/tools/qml/qmlruntime.qrc +++ /dev/null @@ -1,9 +0,0 @@ - - - content/Browser.qml - content/images/up.png - content/images/folder.png - content/images/titlebar.sci - content/images/titlebar.png - - diff --git a/tools/qml/startup/Logo.qml b/tools/qml/startup/Logo.qml new file mode 100644 index 0000000..9252223 --- /dev/null +++ b/tools/qml/startup/Logo.qml @@ -0,0 +1,138 @@ +import Qt 4.7 + +Rectangle { + id: myApp + width: 411 + height: 411 + color: "transparent" + property alias logoState : myApp.state + signal animationFinished + + Item { + id: sketchBlueHolder + width: sketchLogo.width + height: sketchLogo.height + Image { + id: image1 + x: -44 + y: -45 + smooth: true + source: "shadow.png" + } + Item { + clip: true + width: sketchLogo.width + height: sketchLogo.height + Image { + id: sketchLogo + smooth: true + source: "qt-sketch.jpg" + } + Image { + id: blueLogo + y: -420 + smooth: true + source: "qt-blue.jpg" + } + } + } + + states: [ + State { + name: "showBlueprint" + PropertyChanges { + target: blueLogo + y: 0 + } + PropertyChanges { + target: sketchLogo + opacity: 0 + } + }, + State { + extend: "showBlueprint" + name: "finale" + PropertyChanges { + target: fullLogo + opacity: 1 + } + PropertyChanges { + target: backLogo + opacity: 1 + scale: 1 + } + PropertyChanges { + target: frontLogo + opacity: 1 + scale: 1 + } + PropertyChanges { + target: qtText + opacity: 1 + scale: 1 + } + PropertyChanges { + target: sketchBlueHolder + opacity: 0 + scale: 1.4 + } + } + ] + + transitions: [ + Transition { + to: "showBlueprint" + SequentialAnimation { + NumberAnimation { property: "y"; duration: 600; easing.type: "OutBounce" } + PropertyAction { target: sketchLogo; property: "opacity" } + } + }, + Transition { + to: "finale" + PropertyAction { target: fullLogo; property: "opacity" } + SequentialAnimation { + NumberAnimation { target: backLogo; properties: "scale, opacity"; duration: 300 } + NumberAnimation { target: frontLogo; properties: "scale, opacity"; duration: 300 } + ParallelAnimation { + NumberAnimation { target: qtText; properties: "opacity, scale"; duration: 400; easing.type: "OutQuad" } + NumberAnimation { target: sketchBlueHolder; property: "opacity"; duration: 300; easing.type: "OutQuad" } + NumberAnimation { target: sketchBlueHolder; property: "scale"; duration: 320; easing.type: "OutQuad" } + } + PauseAnimation { duration: 1000 } + ScriptAction { script: myApp.animationFinished() } + } + } + ] + + Item { + id: fullLogo + opacity: 0 + Image { + id: backLogo + x: -16 + y: -41 + opacity: 0 + scale: 0.7 + smooth: true + source: "qt-back.png" + } + Image { + id: frontLogo + x: -17 + y: -41 + opacity: 0 + scale: 1.2 + smooth: true + source: "qt-front.png" + } + Image { + id: qtText + x: -10 + y: -41 + opacity: 0 + scale: 1.2 + smooth: true + source: "qt-text.png" + } + } +} diff --git a/tools/qml/startup/qt-back.png b/tools/qml/startup/qt-back.png new file mode 100644 index 0000000..077215f Binary files /dev/null and b/tools/qml/startup/qt-back.png differ diff --git a/tools/qml/startup/qt-blue.jpg b/tools/qml/startup/qt-blue.jpg new file mode 100644 index 0000000..b204896 Binary files /dev/null and b/tools/qml/startup/qt-blue.jpg differ diff --git a/tools/qml/startup/qt-front.png b/tools/qml/startup/qt-front.png new file mode 100644 index 0000000..dbfb43e Binary files /dev/null and b/tools/qml/startup/qt-front.png differ diff --git a/tools/qml/startup/qt-sketch.jpg b/tools/qml/startup/qt-sketch.jpg new file mode 100644 index 0000000..1ede6f0 Binary files /dev/null and b/tools/qml/startup/qt-sketch.jpg differ diff --git a/tools/qml/startup/qt-text.png b/tools/qml/startup/qt-text.png new file mode 100644 index 0000000..d44995c Binary files /dev/null and b/tools/qml/startup/qt-text.png differ diff --git a/tools/qml/startup/quick-blur.png b/tools/qml/startup/quick-blur.png new file mode 100644 index 0000000..29ec243 Binary files /dev/null and b/tools/qml/startup/quick-blur.png differ diff --git a/tools/qml/startup/quick-regular.png b/tools/qml/startup/quick-regular.png new file mode 100644 index 0000000..38321cb Binary files /dev/null and b/tools/qml/startup/quick-regular.png differ diff --git a/tools/qml/startup/shadow.png b/tools/qml/startup/shadow.png new file mode 100644 index 0000000..44f92fe Binary files /dev/null and b/tools/qml/startup/shadow.png differ diff --git a/tools/qml/startup/startup.qml b/tools/qml/startup/startup.qml new file mode 100644 index 0000000..6792150 --- /dev/null +++ b/tools/qml/startup/startup.qml @@ -0,0 +1,126 @@ +import Qt 4.7 + +Rectangle { + id: treatsApp + width: 800 + height: 480 + color: "darkgrey" + Component.onCompleted: treatsApp.state = "part1" + signal animationFinished + + Logo { + id: logo + x: 165 + y: 35 + rotation: -15 + scale: 0.6 + opacity: 0 + onAnimationFinished: treatsApp.animationFinished(); + } + + states: [ + State { + name: "part1" + PropertyChanges { + target: logo + scale: 0.8 + opacity: 1 + rotation: 0 + } + PropertyChanges { + target: treatsApp + color: "black" + } + PropertyChanges { + target: logo + y: 10 + } + PropertyChanges { + target: quickblur + x: logo.x + 145 + } + PropertyChanges { + target: blurText + opacity: 0 + } + PropertyChanges { + target: quickregular + opacity: 1 + } + PropertyChanges { + target: star + x: -7 + y: -37 + } + } + ] + + + Item { + id: quickblur + x: 800//325 + y: 344 + Image { + id: blurText + source: "quick-blur.png" + } + Image { + id: quickregular + x: -1 + y: 0 + opacity: 0 + source: "quick-regular.png" + } + Image { + id: star + x: -1 + y: 0 + opacity: 0 + source: "white-star.png" + smooth: true + NumberAnimation on rotation { + from: 0 + to: 360 + loops: NumberAnimation.Infinite + running: true + duration: 2000 + } + } + } + + transitions: [ + Transition { + ParallelAnimation { + NumberAnimation { target: logo; property: "opacity"; duration: 500 } + NumberAnimation { target: logo; property: "scale"; duration: 4000; } + NumberAnimation { target: logo; property: "rotation"; duration: 2000; easing.type: "OutBack"} + ColorAnimation { duration: 3000} + SequentialAnimation { + PauseAnimation { duration: 1000 } + ScriptAction { script: logo.logoState = "showBlueprint" } + PauseAnimation { duration: 800 } + ScriptAction { script: logo.logoState = "finale" } + PauseAnimation { duration: 800 } + ParallelAnimation { + NumberAnimation { target: quickblur; property: "x"; duration: 200;} + SequentialAnimation { + PauseAnimation { duration: 200} + ParallelAnimation { + NumberAnimation { target: blurText; property: "opacity"; duration: 300;} + NumberAnimation { target: quickregular; property: "opacity"; duration: 300;} + } + NumberAnimation { target: star; property: "opacity"; from: 0; to: 1; duration: 500 } + PauseAnimation { duration: 200 } + NumberAnimation { target: star; property: "opacity"; from: 1; to: 0; duration: 500 } + } + SequentialAnimation { + PauseAnimation { duration: 150} + NumberAnimation { target: logo; property: "y"; duration: 300; easing.type: "OutBounce" } + } + } + } + } + } + ] + +} // treatsApp diff --git a/tools/qml/startup/startup.qrc b/tools/qml/startup/startup.qrc new file mode 100644 index 0000000..52e6705 --- /dev/null +++ b/tools/qml/startup/startup.qrc @@ -0,0 +1,16 @@ + + + Logo.qml + qt-back.png + qt-blue.jpg + qt-front.png + qt-sketch.jpg + qt-text.png + quick-blur.png + quick-regular.png + shadow.png + startup.qml + startup.qrc + white-star.png + + diff --git a/tools/qml/startup/white-star.png b/tools/qml/startup/white-star.png new file mode 100644 index 0000000..f467c94 Binary files /dev/null and b/tools/qml/startup/white-star.png differ -- cgit v0.12 From 77fda24918bff693a20ae11eae64809a9c4689dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Garc=C3=ADa=20Garz=C3=B3n?= Date: Sun, 18 Jul 2010 05:17:22 +0200 Subject: Added *_location variables to pkg-config files for rcc, lupdate and lrelease Task-number: QTBUG-11546 Reviewed-by: ossi --- src/qbase.pri | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/qbase.pri b/src/qbase.pri index 064e67c..f6af22f 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -160,13 +160,25 @@ DEFINES *= QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end +qtPrepareTool(QMAKE_LUPDATE, lupdate) +qtPrepareTool(QMAKE_LRELEASE, lrelease) + moc_dir.name = moc_location moc_dir.variable = QMAKE_MOC uic_dir.name = uic_location uic_dir.variable = QMAKE_UIC -QMAKE_PKGCONFIG_VARIABLES += moc_dir uic_dir +rcc_dir.name = rcc_location +rcc_dir.variable = QMAKE_RCC + +lupdate_dir.name = lupdate_location +lupdate_dir.variable = QMAKE_LUPDATE + +lrelease_dir.name = lrelease_location +lrelease_dir.variable = QMAKE_LRELEASE + +QMAKE_PKGCONFIG_VARIABLES += moc_dir uic_dir rcc_dir lupdate_dir lrelease_dir include(qt_targets.pri) -- cgit v0.12 From 9e846d7b36124087708f08a10bb677a878875f92 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 27 Jul 2010 19:28:33 +0200 Subject: fix epic fail from 4ba6646 Reviewed-by: joerg --- bin/syncqt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/syncqt b/bin/syncqt index eda36d5..1e553dc 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -994,14 +994,12 @@ if($check_includes) { for (keys(%modules)) { #iteration info my $lib = $_; - my $dir = "$modules{$lib}"; - { - my $current_dir = "$_"; + { #calc subdirs - my @subdirs = ($current_dir); + my @subdirs = ($modules{$lib}); foreach (@subdirs) { my $subdir = "$_"; - opendir DIR, "$subdir"; + opendir DIR, "$subdir" or die "Huh, directory ".$subdir." cannot be opened."; while(my $t = readdir(DIR)) { push @subdirs, "$subdir/$t" if(-d "$subdir/$t" && !($t eq ".") && !($t eq "..") && !($t eq ".obj") && -- cgit v0.12 From 3643d21756a6bd9ed06a409457d6e8c93aba3b43 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Thu, 29 Jul 2010 11:15:00 +0200 Subject: fixes for using freetds DBNTWIN32 only if not Q_USE_SYBASE. Workaround for RETCODE typedef conflict between ODBC and FreeTDS. Include winsock2.h supplies SOCKET for FreeTDS. Merge-request: 684 Reviewed-by: Oswald Buddenhagen --- src/sql/drivers/tds/qsql_tds.h | 3 +++ src/sql/kernel/qsqldatabase.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/sql/drivers/tds/qsql_tds.h b/src/sql/drivers/tds/qsql_tds.h index f23a672..3594a4d 100644 --- a/src/sql/drivers/tds/qsql_tds.h +++ b/src/sql/drivers/tds/qsql_tds.h @@ -48,7 +48,10 @@ #ifdef Q_OS_WIN32 #define WIN32_LEAN_AND_MEAN +#ifndef Q_USE_SYBASE #define DBNTWIN32 // indicates 32bit windows dblib +#endif +#include #include #include #include diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 76bc2b0..2ab37de 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -60,7 +60,10 @@ #include "../drivers/oci/qsql_oci.h" #endif #ifdef QT_SQL_TDS +// conflicting RETCODE typedef between odbc and freetds +#define RETCODE DBRETCODE #include "../drivers/tds/qsql_tds.h" +#undef RETCODE #endif #ifdef QT_SQL_DB2 #include "../drivers/db2/qsql_db2.h" -- cgit v0.12 From a542b798e468f775ab09a7846c8fe185eece6ab3 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Thu, 29 Jul 2010 11:18:37 +0200 Subject: Fix compilation - disable TextInput when QT_NO_LINEEDIT is defined Merge-request: 739 Reviewed-by: Oswald Buddenhagen --- src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp | 2 ++ src/declarative/graphicsitems/qdeclarativetextinput.cpp | 4 ++++ src/declarative/graphicsitems/qdeclarativetextinput_p.h | 4 ++++ src/declarative/graphicsitems/qdeclarativetextinput_p_p.h | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 5d623dc..783eff1 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -142,7 +142,9 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("Qt",4,7,"Scale"); qmlRegisterType("Qt",4,7,"Text"); qmlRegisterType("Qt",4,7,"TextEdit"); +#ifndef QT_NO_LINEEDIT qmlRegisterType("Qt",4,7,"TextInput"); +#endif qmlRegisterType("Qt",4,7,"ViewSection"); qmlRegisterType("Qt",4,7,"VisualDataModel"); qmlRegisterType("Qt",4,7,"VisualItemModel"); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 34f5897..90f5a70 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -51,6 +51,8 @@ #include #include +#ifndef QT_NO_LINEEDIT + QT_BEGIN_NAMESPACE /*! @@ -1537,3 +1539,5 @@ void QDeclarativeTextInput::updateSize(bool needsRedraw) QT_END_NAMESPACE +#endif // QT_NO_LINEEDIT + diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index ba3f5b1..06f77e5 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -48,6 +48,8 @@ #include #include +#ifndef QT_NO_LINEEDIT + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -263,4 +265,6 @@ QML_DECLARE_TYPE(QRegExpValidator) QT_END_HEADER +#endif // QT_NO_LINEEDIT + #endif // QDECLARATIVETEXTINPUT_H diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h index 4ac5134..5ad6a3b 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h @@ -62,6 +62,8 @@ // // We mean it. +#ifndef QT_NO_LINEEDIT + QT_BEGIN_NAMESPACE class QDeclarativeTextInputPrivate : public QDeclarativePaintedItemPrivate @@ -132,5 +134,7 @@ public: QT_END_NAMESPACE +#endif // QT_NO_LINEEDIT + #endif -- cgit v0.12 From 510c8d6bd7c7623bb41878b8246375a403f3ba1d Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Thu, 29 Jul 2010 11:22:51 +0200 Subject: Fix compilation with QT_NO_XMLSTREAMREADER Merge-request: 757 Reviewed-by: Oswald Buddenhagen --- src/declarative/qml/qdeclarativeengine.cpp | 2 ++ src/declarative/qml/qdeclarativexmlhttprequest.cpp | 4 ++++ src/declarative/qml/qdeclarativexmlhttprequest_p.h | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 8eb0939..e8cb36e 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -301,7 +301,9 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr + QDir::separator() + QLatin1String("OfflineStorage"); #endif +#ifndef QT_NO_XMLSTREAMREADER qt_add_qmlxmlhttprequest(this); +#endif qt_add_qmlsqldatabase(this); // XXX A Multimedia "Qt.Sound" class also needs to be made available, // XXX but we don't want a dependency in that cirection. diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp index acd1f51..d5b7ecc 100644 --- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp +++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp @@ -58,6 +58,8 @@ #include #include +#ifndef QT_NO_XMLSTREAMREADER + // From DOM-Level-3-Core spec // http://www.w3.org/TR/DOM-Level-3-Core/core.html #define INDEX_SIZE_ERR 1 @@ -1662,4 +1664,6 @@ void qt_add_qmlxmlhttprequest(QScriptEngine *engine) QT_END_NAMESPACE +#endif // QT_NO_XMLSTREAMREADER + #include diff --git a/src/declarative/qml/qdeclarativexmlhttprequest_p.h b/src/declarative/qml/qdeclarativexmlhttprequest_p.h index 068cd0f..f340c1c 100644 --- a/src/declarative/qml/qdeclarativexmlhttprequest_p.h +++ b/src/declarative/qml/qdeclarativexmlhttprequest_p.h @@ -56,6 +56,8 @@ #include +#ifndef QT_NO_XMLSTREAMREADER + QT_BEGIN_NAMESPACE class QScriptEngine; @@ -63,5 +65,7 @@ void qt_add_qmlxmlhttprequest(QScriptEngine *engine); QT_END_NAMESPACE +#endif // QT_NO_XMLSTREAMREADER + #endif // QDECLARATIVEXMLHTTPREQUEST_P_H -- cgit v0.12 From e98ec548d4f7b0558742014933457f756bdd8bf1 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Thu, 29 Jul 2010 11:24:12 +0200 Subject: Fix compilation with QT_NO_TEXTCODEC Merge-request: 755 Reviewed-by: Oswald Buddenhagen --- src/declarative/qml/qdeclarativeerror.cpp | 2 ++ src/declarative/qml/qdeclarativescriptparser.cpp | 2 ++ src/declarative/qml/qdeclarativexmlhttprequest.cpp | 3 ++- src/gui/image/qpnghandler.cpp | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qdeclarativeerror.cpp b/src/declarative/qml/qdeclarativeerror.cpp index 8717f56..0ab5cd9 100644 --- a/src/declarative/qml/qdeclarativeerror.cpp +++ b/src/declarative/qml/qdeclarativeerror.cpp @@ -250,7 +250,9 @@ QDebug operator<<(QDebug debug, const QDeclarativeError &error) if (f.open(QIODevice::ReadOnly)) { QByteArray data = f.readAll(); QTextStream stream(data, QIODevice::ReadOnly); +#ifndef QT_NO_TEXTCODEC stream.setCodec("UTF-8"); +#endif const QString code = stream.readAll(); const QStringList lines = code.split(QLatin1Char('\n')); diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 4d98ca8..f703cf5 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -831,7 +831,9 @@ bool QDeclarativeScriptParser::parse(const QByteArray &qmldata, const QUrl &url) _scriptFile = fileName; QTextStream stream(qmldata, QIODevice::ReadOnly); +#ifndef QT_NO_TEXTCODEC stream.setCodec("UTF-8"); +#endif const QString code = stream.readAll(); data = new QDeclarativeScriptParserJsASTData(fileName); diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp index d5b7ecc..ff1a0e9 100644 --- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp +++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp @@ -1306,10 +1306,11 @@ QString QDeclarativeXMLHttpRequest::responseBody() const { QXmlStreamReader reader(m_responseEntityBody); reader.readNext(); +#ifndef QT_NO_TEXTCODEC QTextCodec *codec = QTextCodec::codecForName(reader.documentEncoding().toString().toUtf8()); if (codec) return codec->toUnicode(m_responseEntityBody); - +#endif return QString::fromUtf8(m_responseEntityBody); } diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 2cf8222..dc54313 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -389,7 +389,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader() while (num_text--) { QString key, value; -#if defined(PNG_iTXt_SUPPORTED) +#if defined(PNG_iTXt_SUPPORTED) && !defined(QT_NO_TEXTCODEC) if (text_ptr->lang) { QTextCodec *codec = QTextCodec::codecForName(text_ptr->lang); if (codec) { -- cgit v0.12 From c8f2b393bf168e7d30239e44d0cb8fda3f9be8a0 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 29 Jul 2010 13:26:07 +0200 Subject: Add license header Fixes the licenseCheck autotest --- tools/qml/startup/Logo.qml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tools/qml/startup/Logo.qml b/tools/qml/startup/Logo.qml index 9252223..8d9708d 100644 --- a/tools/qml/startup/Logo.qml +++ b/tools/qml/startup/Logo.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + import Qt 4.7 Rectangle { -- cgit v0.12 From 5bdb85e3b21bcf624eb1830aa32d027e0c6870fe Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Thu, 29 Jul 2010 14:59:55 +0200 Subject: Fixed spelling mistakes in documented functions, classes, etc. Part of QTBUG-11938 and QTBUG-10801 --- demos/embedded/desktopservices/contenttab.cpp | 2 +- demos/embedded/desktopservices/desktopwidget.cpp | 2 +- demos/embedded/fluidlauncher/fluidlauncher.cpp | 2 +- demos/embedded/fluidlauncher/pictureflow.cpp | 2 +- demos/embedded/raycasting/raycasting.cpp | 2 +- examples/animation/stickman/lifecycle.cpp | 2 +- .../referenceexamples/adding/main.cpp | 2 +- .../referenceexamples/attached/main.cpp | 2 +- .../referenceexamples/binding/main.cpp | 2 +- .../referenceexamples/coercion/main.cpp | 2 +- .../referenceexamples/default/main.cpp | 2 +- .../referenceexamples/extended/main.cpp | 2 +- .../referenceexamples/grouped/main.cpp | 2 +- .../referenceexamples/properties/main.cpp | 2 +- .../referenceexamples/signal/main.cpp | 2 +- .../referenceexamples/valuesource/main.cpp | 2 +- examples/network/download/main.cpp | 2 +- examples/network/http/httpwindow.cpp | 2 +- examples/network/torrent/torrentclient.cpp | 22 +++++++++++----------- examples/opengl/shared/qtlogo.cpp | 2 +- examples/tools/customcompleter/textedit.cpp | 2 +- examples/xml/htmlinfo/main.cpp | 2 +- src/corelib/concurrent/qtconcurrentexception.cpp | 2 +- src/corelib/global/qglobal.cpp | 6 +++--- src/corelib/io/qtextstream.cpp | 2 +- src/corelib/kernel/qeventdispatcher_symbian.cpp | 2 +- src/corelib/kernel/qmetatype.cpp | 2 +- src/corelib/tools/qbytearray.cpp | 2 +- src/corelib/tools/qsharedpointer.cpp | 2 +- src/corelib/tools/qtextboundaryfinder.cpp | 2 +- src/dbus/qdbusconnection.cpp | 2 +- src/dbus/qdbusserver.cpp | 2 +- src/declarative/debugger/qpacketprotocol.cpp | 2 +- src/declarative/graphicsitems/qdeclarativeitem.cpp | 4 ++-- src/declarative/util/qdeclarativeanimation.cpp | 14 +++++++------- .../util/qdeclarativesmoothedanimation.cpp | 2 +- src/declarative/util/qdeclarativetimeline.cpp | 4 ++-- src/declarative/util/qdeclarativeview.cpp | 4 ++-- src/declarative/util/qlistmodelinterface.cpp | 2 +- src/gui/graphicsview/qgraphicsitem.cpp | 6 +++--- tools/assistant/lib/qhelpsearchengine.cpp | 10 +++++----- tools/porting/src/semantic.cpp | 6 +++--- 42 files changed, 71 insertions(+), 71 deletions(-) diff --git a/demos/embedded/desktopservices/contenttab.cpp b/demos/embedded/desktopservices/contenttab.cpp index fa9c586..8b344ce 100644 --- a/demos/embedded/desktopservices/contenttab.cpp +++ b/demos/embedded/desktopservices/contenttab.cpp @@ -125,7 +125,7 @@ void ContentTab::keyPressEvent(QKeyEvent *event) void ContentTab::handleErrorInOpen(QListWidgetItem *item) { Q_UNUSED(item); - QMessageBox::warning(this, tr("Operation Failed"), tr("Unkown error!"), QMessageBox::Close); + QMessageBox::warning(this, tr("Operation Failed"), tr("Unknown error!"), QMessageBox::Close); } // NEW SLOTS diff --git a/demos/embedded/desktopservices/desktopwidget.cpp b/demos/embedded/desktopservices/desktopwidget.cpp index 39a56a4..ff3cb09 100644 --- a/demos/embedded/desktopservices/desktopwidget.cpp +++ b/demos/embedded/desktopservices/desktopwidget.cpp @@ -73,7 +73,7 @@ DesktopWidget::DesktopWidget(QWidget *parent) : QWidget(parent) // Links LinkTab* othersTab = new LinkTab(tabWidget);; - // Given icon file will be overriden by LinkTab + // Given icon file will be overridden by LinkTab othersTab->init(QDesktopServices::PicturesLocation, "", ""); tabWidget->addTab(othersTab, tr("Links")); diff --git a/demos/embedded/fluidlauncher/fluidlauncher.cpp b/demos/embedded/fluidlauncher/fluidlauncher.cpp index 1fb2376..19eb8d2 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.cpp +++ b/demos/embedded/fluidlauncher/fluidlauncher.cpp @@ -154,7 +154,7 @@ void FluidLauncher::parseDemos(QXmlStreamReader& reader) DemoApplication* newDemo = new DemoApplication( filename.toString(), - name.isEmpty() ? "Unamed Demo" : name.toString(), + name.isEmpty() ? "Unnamed Demo" : name.toString(), image.toString(), args.toString().split(" ")); demoList.append(newDemo); diff --git a/demos/embedded/fluidlauncher/pictureflow.cpp b/demos/embedded/fluidlauncher/pictureflow.cpp index 8435c8f..d606269 100644 --- a/demos/embedded/fluidlauncher/pictureflow.cpp +++ b/demos/embedded/fluidlauncher/pictureflow.cpp @@ -603,7 +603,7 @@ static QImage prepareSurface(QImage img, int w, int h) Qt::TransformationMode mode = Qt::SmoothTransformation; img = img.scaled(w, h, Qt::IgnoreAspectRatio, mode); - // slightly larger, to accomodate for the reflection + // slightly larger, to accommodate for the reflection int hs = h * 2; int hofs = h / 3; diff --git a/demos/embedded/raycasting/raycasting.cpp b/demos/embedded/raycasting/raycasting.cpp index 75ba147..21aa2c3 100644 --- a/demos/embedded/raycasting/raycasting.cpp +++ b/demos/embedded/raycasting/raycasting.cpp @@ -142,7 +142,7 @@ public: qreal dv = -2 * cosa / bufw; for (int ray = 0; ray < bufw; ++ray, u += du, v += dv) { - // everytime this ray advances 'u' units in x direction, + // every time this ray advances 'u' units in x direction, // it also advanced 'v' units in y direction qreal uu = (u < 0) ? -u : u; qreal vv = (v < 0) ? -v : v; diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index 8778046..02cdb71 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -103,7 +103,7 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) m_animationGroup->addAnimation(pa); } - // Set up intial state graph + // Set up initial state graph //! [3] m_machine = new QStateMachine(); m_machine->addDefaultAnimation(m_animationGroup); diff --git a/examples/declarative/cppextensions/referenceexamples/adding/main.cpp b/examples/declarative/cppextensions/referenceexamples/adding/main.cpp index f429b6e..391113c 100644 --- a/examples/declarative/cppextensions/referenceexamples/adding/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/adding/main.cpp @@ -57,7 +57,7 @@ int main(int argc, char ** argv) qWarning() << "The person's name is" << person->name(); qWarning() << "They wear a" << person->shoeSize() << "sized shoe"; } else { - qWarning() << "An error occured"; + qWarning() << "An error occurred"; } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/attached/main.cpp b/examples/declarative/cppextensions/referenceexamples/attached/main.cpp index 22e844f..5a39a98 100644 --- a/examples/declarative/cppextensions/referenceexamples/attached/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/attached/main.cpp @@ -83,7 +83,7 @@ int main(int argc, char ** argv) } } else { - qWarning() << "An error occured"; + qWarning() << "An error occurred"; } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/binding/main.cpp b/examples/declarative/cppextensions/referenceexamples/binding/main.cpp index 29da994..fe1bbc8 100644 --- a/examples/declarative/cppextensions/referenceexamples/binding/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/binding/main.cpp @@ -85,7 +85,7 @@ int main(int argc, char ** argv) party->startParty(); } else { - qWarning() << "An error occured"; + qWarning() << "An error occurred"; } return app.exec(); diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp b/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp index 9b32c8b..5c53368 100644 --- a/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp @@ -70,7 +70,7 @@ int main(int argc, char ** argv) for (int ii = 0; ii < party->guestCount(); ++ii) qWarning() << " " << party->guest(ii)->name(); } else { - qWarning() << "An error occured"; + qWarning() << "An error occurred"; } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/default/main.cpp b/examples/declarative/cppextensions/referenceexamples/default/main.cpp index f3a7068..f611bc4 100644 --- a/examples/declarative/cppextensions/referenceexamples/default/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/default/main.cpp @@ -68,7 +68,7 @@ int main(int argc, char ** argv) for (int ii = 0; ii < party->guestCount(); ++ii) qWarning() << " " << party->guest(ii)->name(); } else { - qWarning() << "An error occured"; + qWarning() << "An error occurred"; } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/extended/main.cpp b/examples/declarative/cppextensions/referenceexamples/extended/main.cpp index fb7ce1a..65527c3 100644 --- a/examples/declarative/cppextensions/referenceexamples/extended/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/extended/main.cpp @@ -58,7 +58,7 @@ int main(int argc, char ** argv) edit->show(); return app.exec(); } else { - qWarning() << "An error occured"; + qWarning() << "An error occurred"; return 0; } } diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp b/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp index f2e0f55..e56a14d 100644 --- a/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp @@ -78,7 +78,7 @@ int main(int argc, char ** argv) qWarning() << bestShoe->name() << "is wearing the best shoes!"; } else { - qWarning() << "An error occured"; + qWarning() << "An error occurred"; } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/properties/main.cpp b/examples/declarative/cppextensions/referenceexamples/properties/main.cpp index b5dafe2..80237ef 100644 --- a/examples/declarative/cppextensions/referenceexamples/properties/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/properties/main.cpp @@ -61,7 +61,7 @@ int main(int argc, char ** argv) for (int ii = 0; ii < party->guestCount(); ++ii) qWarning() << " " << party->guest(ii)->name(); } else { - qWarning() << "An error occured"; + qWarning() << "An error occurred"; } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/signal/main.cpp b/examples/declarative/cppextensions/referenceexamples/signal/main.cpp index 6add975..56c0809 100644 --- a/examples/declarative/cppextensions/referenceexamples/signal/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/signal/main.cpp @@ -84,7 +84,7 @@ int main(int argc, char ** argv) party->startParty(); } else { - qWarning() << "An error occured"; + qWarning() << "An error occurred"; } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp b/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp index 5752af7..40dc3cb 100644 --- a/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp @@ -86,7 +86,7 @@ int main(int argc, char ** argv) party->startParty(); } else { - qWarning() << "An error occured"; + qWarning() << "An error occurred"; } return app.exec(); diff --git a/examples/network/download/main.cpp b/examples/network/download/main.cpp index c322a44..0fb9137 100644 --- a/examples/network/download/main.cpp +++ b/examples/network/download/main.cpp @@ -150,7 +150,7 @@ void DownloadManager::downloadFinished(QNetworkReply *reply) } else { QString filename = saveFileName(url); if (saveToDisk(filename, reply)) - printf("Download of %s succeded (saved to %s)\n", + printf("Download of %s succeeded (saved to %s)\n", url.toEncoded().constData(), qPrintable(filename)); } diff --git a/examples/network/http/httpwindow.cpp b/examples/network/http/httpwindow.cpp index b1ea98c..ea48546 100644 --- a/examples/network/http/httpwindow.cpp +++ b/examples/network/http/httpwindow.cpp @@ -206,7 +206,7 @@ void HttpWindow::httpFinished() void HttpWindow::httpReadyRead() { - // this slot gets called everytime the QNetworkReply has new data. + // this slot gets called every time the QNetworkReply has new data. // We read all of its new data and write it into the file. // That way we use less RAM than when reading it at the finished() // signal of the QNetworkReply diff --git a/examples/network/torrent/torrentclient.cpp b/examples/network/torrent/torrentclient.cpp index 5e25b9a..b7607a6 100644 --- a/examples/network/torrent/torrentclient.cpp +++ b/examples/network/torrent/torrentclient.cpp @@ -1243,8 +1243,8 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client) // depending on the state we're in. int pieceIndex = 0; if (d->state == WarmingUp || (qrand() & 4) == 0) { - int *occurrances = new int[d->pieceCount]; - memset(occurrances, 0, d->pieceCount * sizeof(int)); + int *occurrences = new int[d->pieceCount]; + memset(occurrences, 0, d->pieceCount * sizeof(int)); // Count how many of each piece are available. foreach (PeerWireClient *peer, d->connections) { @@ -1252,38 +1252,38 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client) int peerPiecesSize = peerPieces.size(); for (int i = 0; i < peerPiecesSize; ++i) { if (peerPieces.testBit(i)) - ++occurrances[i]; + ++occurrences[i]; } } // Find the rarest or most common pieces. - int numOccurrances = d->state == WarmingUp ? 0 : 99999; + int numOccurrences = d->state == WarmingUp ? 0 : 99999; QList piecesReadyForDownload; for (int i = 0; i < d->pieceCount; ++i) { if (d->state == WarmingUp) { // Add common pieces - if (occurrances[i] >= numOccurrances + if (occurrences[i] >= numOccurrences && incompletePiecesAvailableToClient.testBit(i)) { - if (occurrances[i] > numOccurrances) + if (occurrences[i] > numOccurrences) piecesReadyForDownload.clear(); piecesReadyForDownload.append(i); - numOccurrances = occurrances[i]; + numOccurrences = occurrences[i]; } } else { // Add rare pieces - if (occurrances[i] <= numOccurrances + if (occurrences[i] <= numOccurrences && incompletePiecesAvailableToClient.testBit(i)) { - if (occurrances[i] < numOccurrances) + if (occurrences[i] < numOccurrences) piecesReadyForDownload.clear(); piecesReadyForDownload.append(i); - numOccurrances = occurrances[i]; + numOccurrences = occurrences[i]; } } } // Select one piece randomly pieceIndex = piecesReadyForDownload.at(qrand() % piecesReadyForDownload.size()); - delete [] occurrances; + delete [] occurrences; } else { // Make up a list of available piece indices, and pick // a random one. diff --git a/examples/opengl/shared/qtlogo.cpp b/examples/opengl/shared/qtlogo.cpp index 0352d29..0165032 100644 --- a/examples/opengl/shared/qtlogo.cpp +++ b/examples/opengl/shared/qtlogo.cpp @@ -327,7 +327,7 @@ RectTorus::RectTorus(Geometry *g, qreal iRad, qreal oRad, qreal depth, int k) QVector in_back = extrude(inside, depth); QVector out_back = extrude(outside, depth); - // Create front, back and sides as seperate patches so that smooth normals + // Create front, back and sides as separate patches so that smooth normals // are generated for the curving sides, but a faceted edge is created between // sides and front/back Patch *front = new Patch(g); diff --git a/examples/tools/customcompleter/textedit.cpp b/examples/tools/customcompleter/textedit.cpp index 5467e53..77699e0 100644 --- a/examples/tools/customcompleter/textedit.cpp +++ b/examples/tools/customcompleter/textedit.cpp @@ -141,7 +141,7 @@ void TextEdit::keyPressEvent(QKeyEvent *e) } bool isShortcut = ((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_E); // CTRL+E - if (!c || !isShortcut) // dont process the shortcut when we have a completer + if (!c || !isShortcut) // do not process the shortcut when we have a completer QTextEdit::keyPressEvent(e); //! [7] diff --git a/examples/xml/htmlinfo/main.cpp b/examples/xml/htmlinfo/main.cpp index 066edb6..06fc33d 100644 --- a/examples/xml/htmlinfo/main.cpp +++ b/examples/xml/htmlinfo/main.cpp @@ -94,7 +94,7 @@ void parseHtmlFile(QTextStream &out, const QString &fileName) { int main(int argc, char **argv) { - // intialize QtCore application + // initialize QtCore application QCoreApplication app(argc, argv); // get a list of all html files in the current directory diff --git a/src/corelib/concurrent/qtconcurrentexception.cpp b/src/corelib/concurrent/qtconcurrentexception.cpp index e7f4674..fad04a6 100644 --- a/src/corelib/concurrent/qtconcurrentexception.cpp +++ b/src/corelib/concurrent/qtconcurrentexception.cpp @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE the Qt Concurrent functions will throw a QtConcurrent::UnhandledException in the receiver thread. - When using QFuture, transferred exceptions willl be thrown when calling the following functions: + When using QFuture, transferred exceptions will be thrown when calling the following functions: \list \o QFuture::waitForFinished() \o QFuture::result() diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index c956b85..861d77d 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2374,7 +2374,7 @@ void qDebug(const char *msg, ...) This syntax inserts a space between each item, and appends a newline at the end. - To supress the output at runtime, install your own message handler + To suppress the output at runtime, install your own message handler with qInstallMsgHandler(). \sa qDebug(), qCritical(), qFatal(), qInstallMsgHandler(), @@ -2410,7 +2410,7 @@ void qWarning(const char *msg, ...) A space is inserted between the items, and a newline is appended at the end. - To supress the output at runtime, install your own message handler + To suppress the output at runtime, install your own message handler with qInstallMsgHandler(). \sa qDebug(), qWarning(), qFatal(), qInstallMsgHandler(), @@ -2475,7 +2475,7 @@ void qErrnoWarning(int code, const char *msg, ...) Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 30 - To supress the output at runtime, install your own message handler + To suppress the output at runtime, install your own message handler with qInstallMsgHandler(). \sa qDebug(), qCritical(), qWarning(), qInstallMsgHandler(), diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index b1c403f..eab0662 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -1991,7 +1991,7 @@ bool QTextStreamPrivate::getReal(double *f) return true; buf[i] = '\0'; - // backward-compatibility. Old implmentation supported +nan/-nan + // backward-compatibility. Old implementation supported +nan/-nan // for some reason. QLocale only checks for lower-case // nan/+inf/-inf, so here we also check for uppercase and mixed // case versions. diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 2a52044..1bad8ed 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -423,7 +423,7 @@ void QSelectThread::run() // ones that return -1 in select // after loop update notifiers for all of them - // as we dont have "exception" notifier type + // as we don't have "exception" notifier type // we should force monitoring fd_set of this // type as well diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 6ebaaa3..fef02cf 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1415,7 +1415,7 @@ void QMetaType::destroy(int type, void *data) \snippet doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp 4 - This function is usefull to register typedefs so they can be used + This function is useful to register typedefs so they can be used by QMetaProperty, or in QueuedConnections \snippet doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp 9 diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index a5cb16a..8d38e4c 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1809,7 +1809,7 @@ QByteArray &QByteArray::replace(int pos, int len, const QByteArray &after) Replaces \a len bytes from index position \a pos with the zero terminated string \a after. - Notice: this can change the lenght of the byte array. + Notice: this can change the length of the byte array. */ QByteArray &QByteArray::replace(int pos, int len, const char *after) { diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 1b4b356..f102598 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -482,7 +482,7 @@ becomes managed by this QSharedPointer and must not be passed to another QSharedPointer object or deleted outside this object. - The \a deleter paramter specifies the custom deleter for this + The \a deleter parameter specifies the custom deleter for this object. The custom deleter is called when the strong reference count drops to 0 instead of the operator delete(). This is useful, for instance, for calling deleteLater() in a QObject instead: diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp index bcddcb2..0428782 100644 --- a/src/corelib/tools/qtextboundaryfinder.cpp +++ b/src/corelib/tools/qtextboundaryfinder.cpp @@ -244,7 +244,7 @@ QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, const QString &strin data required, it will use this instead of allocating its own buffer. \warning QTextBoundaryFinder does not create a copy of \a chars. It is the - application programmer's responsability to ensure the array is allocated for + application programmer's responsibility to ensure the array is allocated for as long as the QTextBoundaryFinder object stays alive. The same applies to \a buffer. */ diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 6f86856..5cbb8ca 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -916,7 +916,7 @@ QString QDBusConnection::name() const /*! Attempts to register the \a serviceName on the D-Bus server and - returns true if the registration succeded. The registration will + returns true if the registration succeeded. The registration will fail if the name is already registered by another application. \sa unregisterService(), QDBusConnectionInterface::registerService() diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp index 2377795..6a4553c 100644 --- a/src/dbus/qdbusserver.cpp +++ b/src/dbus/qdbusserver.cpp @@ -100,7 +100,7 @@ QDBusError QDBusServer::lastError() const } /*! - Returns the address this server is assosiated with. + Returns the address this server is associated with. */ QString QDBusServer::address() const { diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index 6241922..878f42f 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -422,7 +422,7 @@ QPacket::~QPacket() /*! Creates a copy of \a other. The initial stream positions are shared, but the - two packets are otherwise independant. + two packets are otherwise independent. */ QPacket::QPacket(const QPacket & other) : QDataStream(), b(other.b), buf(0) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 83f9b20..c80fc2f 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -423,7 +423,7 @@ void QDeclarativeItemKeyFilter::componentComplete() \brief The KeyNavigation attached property supports key navigation by arrow keys. It is common in key-based UIs to use arrow keys to navigate - between focussed items. The KeyNavigation property provides a + between focused items. The KeyNavigation property provides a convenient way of specifying which item will gain focus when an arrow key is pressed. The following example provides key navigation for a 2x2 grid of items. @@ -2482,7 +2482,7 @@ QDeclarativeListProperty QDeclarativeItemPrivate::transi Item { filter: [ Blur { ... }, - Relection { ... } + Reflection { ... } ... ] } diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 9806957..8c1c95a 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -1937,15 +1937,15 @@ void QDeclarativePropertyAnimation::setTo(const QVariant &t) \o \inlineimage qeasingcurve-inquart.png \row \o \c Easing.OutQuart - \o Easing curve for a cubic (t^4) function: decelerating from zero velocity. + \o Easing curve for a quartic (t^4) function: decelerating from zero velocity. \o \inlineimage qeasingcurve-outquart.png \row \o \c Easing.InOutQuart - \o Easing curve for a cubic (t^4) function: acceleration until halfway, then deceleration. + \o Easing curve for a quartic (t^4) function: acceleration until halfway, then deceleration. \o \inlineimage qeasingcurve-inoutquart.png \row \o \c Easing.OutInQuart - \o Easing curve for a cubic (t^4) function: deceleration until halfway, then acceleration. + \o Easing curve for a quartic (t^4) function: deceleration until halfway, then acceleration. \o \inlineimage qeasingcurve-outinquart.png \row \o \c Easing.InQuint @@ -1953,15 +1953,15 @@ void QDeclarativePropertyAnimation::setTo(const QVariant &t) \o \inlineimage qeasingcurve-inquint.png \row \o \c Easing.OutQuint - \o Easing curve for a cubic (t^5) function: decelerating from zero velocity. + \o Easing curve for a quintic (t^5) function: decelerating from zero velocity. \o \inlineimage qeasingcurve-outquint.png \row \o \c Easing.InOutQuint - \o Easing curve for a cubic (t^5) function: acceleration until halfway, then deceleration. + \o Easing curve for a quintic (t^5) function: acceleration until halfway, then deceleration. \o \inlineimage qeasingcurve-inoutquint.png \row \o \c Easing.OutInQuint - \o Easing curve for a cubic (t^5) function: deceleration until halfway, then acceleration. + \o Easing curve for a quintic (t^5) function: deceleration until halfway, then acceleration. \o \inlineimage qeasingcurve-outinquint.png \row \o \c Easing.InSine @@ -2416,7 +2416,7 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions enabled. Such an item can be set using the \l via property. By default, when used in a transition, ParentAnimation animates all parent - changes. This can be overriden by setting a specific target item using the + changes. This can be overridden by setting a specific target item using the \l target property. \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index 11c3d4b..727f427 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -375,7 +375,7 @@ void QDeclarativeSmoothedAnimation::transition(QDeclarativeStateActions &actions \list \o SmoothedAnimation.Eased (default) - the animation will smoothly decelerate, and then reverse direction - \o SmoothedAnimation.Immediate - the animation will immediately begin accelerating in the reverse direction, begining with a velocity of 0 + \o SmoothedAnimation.Immediate - the animation will immediately begin accelerating in the reverse direction, beginning with a velocity of 0 \o SmoothedAnimation.Sync - the property is immediately set to the target value \endlist */ diff --git a/src/declarative/util/qdeclarativetimeline.cpp b/src/declarative/util/qdeclarativetimeline.cpp index 0258b3c..378c539 100644 --- a/src/declarative/util/qdeclarativetimeline.cpp +++ b/src/declarative/util/qdeclarativetimeline.cpp @@ -524,7 +524,7 @@ int QDeclarativeTimeLine::duration() const Following operations on \a timeLineValue in this timeline will be scheduled after all the currently scheduled actions on \a syncTo are complete. In - psuedo-code this is equivalent to: + pseudo-code this is equivalent to: \code QDeclarativeTimeLine::pause(timeLineValue, min(0, length_of(syncTo) - length_of(timeLineValue))) \endcode @@ -549,7 +549,7 @@ void QDeclarativeTimeLine::sync(QDeclarativeTimeLineValue &timeLineValue, QDecla Synchronize the end point of \a timeLineValue to the endpoint of the longest action cursrently scheduled in the timeline. - In psuedo-code, this is equivalent to: + In pseudo-code, this is equivalent to: \code QDeclarativeTimeLine::pause(timeLineValue, length_of(timeline) - length_of(timeLineValue)) \endcode diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 7546a50..8f06858 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -365,7 +365,7 @@ QDeclarativeContext* QDeclarativeView::rootContext() const \value Null This QDeclarativeView has no source set. \value Ready This QDeclarativeView has loaded and created the QML component. \value Loading This QDeclarativeView is loading network data. - \value Error An error has occured. Call errorDescription() to retrieve a description. + \value Error An error has occurred. Call errorDescription() to retrieve a description. */ /*! \enum QDeclarativeView::ResizeMode @@ -391,7 +391,7 @@ QDeclarativeView::Status QDeclarativeView::status() const } /*! - Return the list of errors that occured during the last compile or create + Return the list of errors that occurred during the last compile or create operation. An empty list is returned if isError() is not set. */ QList QDeclarativeView::errors() const diff --git a/src/declarative/util/qlistmodelinterface.cpp b/src/declarative/util/qlistmodelinterface.cpp index 98d6a5b..acf4dd6 100644 --- a/src/declarative/util/qlistmodelinterface.cpp +++ b/src/declarative/util/qlistmodelinterface.cpp @@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE */ /*! \fn QHash QListModelInterface::data(int index, const QList& roles) const - Returns the data at the given \a index for the specifed \a roles. + Returns the data at the given \a index for the specified \a roles. */ /*! \fn bool QListModelInterface::setData(int index, const QHash& values) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index a2ae385..1626d83 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -3931,7 +3931,7 @@ void QGraphicsItem::setScale(qreal factor) Returns a list of graphics transforms that currently apply to this item. QGraphicsTransform is for applying and controlling a chain of individual - transformation operations on an item. It's particularily useful in + transformation operations on an item. It's particularly useful in animations, where each transform operation needs to be interpolated independently, or differently. @@ -3958,7 +3958,7 @@ QList QGraphicsItem::transformations() const an item, you can call setTransform(). QGraphicsTransform is for applying and controlling a chain of individual - transformation operations on an item. It's particularily useful in + transformation operations on an item. It's particularly useful in animations, where each transform operation needs to be interpolated independently, or differently. @@ -5152,7 +5152,7 @@ QPainterPath QGraphicsItem::opaqueArea() const The bounding region describes a coarse outline of the item's visual contents. Although it's expensive to calculate, it's also more precise than boundingRect(), and it can help to avoid unnecessary repainting when - an item is updated. This is particularily efficient for thin items (e.g., + an item is updated. This is particularly efficient for thin items (e.g., lines or simple polygons). You can tune the granularity for the bounding region by calling setBoundingRegionGranularity(). The default granularity is 0; in which the item's bounding region is the same as its bounding diff --git a/tools/assistant/lib/qhelpsearchengine.cpp b/tools/assistant/lib/qhelpsearchengine.cpp index 9914efa..164163a 100644 --- a/tools/assistant/lib/qhelpsearchengine.cpp +++ b/tools/assistant/lib/qhelpsearchengine.cpp @@ -263,17 +263,17 @@ private: engines setupFinished() signal to know when it can start to index documentation. After starting the indexing process the signal indexingStarted() is emitted and - on the end of the indexing process the indexingFinished() is emited. To stop + on the end of the indexing process the indexingFinished() is emitted. To stop the indexing one can call cancelIndexing(). While the indexing process has finished, the search engine can now be used to search thru its index for a given term. To do this one may use the possibility of creating the QHelpSearchQuery list by self or reuse the QHelpSearchQueryWidget which has the inbuild - functionality to set up a proper search querys list that get's passed to the search engines + functionality to set up a proper search queries list that get's passed to the search engines search() function. After the list of querys has been passed to the search engine, the signal searchingStarted() - is emited and after the search has finished the searchingFinished() signal is emited. The + is emitted and after the search has finished the searchingFinished() signal is emitted. The search process can be stopped by calling cancelSearching(). If the search succeeds, the searchingFinished() will be called with the search hits count, @@ -318,7 +318,7 @@ private: uses the given \a helpEngine to access the documentation that needs to be indexed. The QHelpEngine's setupFinished() signal is automatically connected to the QHelpSearchEngine's indexing function, so that new documentation will be indexed - after the signal is emited. + after the signal is emitted. */ QHelpSearchEngine::QHelpSearchEngine(QHelpEngineCore *helpEngine, QObject *parent) : QObject(parent) @@ -434,7 +434,7 @@ void QHelpSearchEngine::cancelSearching() } /*! - Starts the search process using the given list of querys \a queryList + Starts the search process using the given list of queries \a queryList build by the search field name and the values to search for. */ void QHelpSearchEngine::search(const QList &queryList) diff --git a/tools/porting/src/semantic.cpp b/tools/porting/src/semantic.cpp index 268e037..cf0b141 100644 --- a/tools/porting/src/semantic.cpp +++ b/tools/porting/src/semantic.cpp @@ -768,7 +768,7 @@ void Semantic::parseTypedef(TypedefAST *ast) void Semantic::parseTypeSpecifier(TypeSpecifierAST *ast) { // If this is a classSpecifier or a EnumSpecifier we skip the name lookup, - // becuase looking up the name "E" in a class definition like + // because looking up the name "E" in a class definition like // "class E { ..." makes no sense. (There might be a variable named E // already declared, but that variable is now shadowed by the class type.) if( ast->nodeType() != NodeType_EnumSpecifier @@ -807,7 +807,7 @@ void Semantic::parseNameUse(NameAST* name) /* looks up name used in basescope. If name->isGlobal() is true or if classOrNamespaceList() - returns a non-emty list, the C++ qualified name lookup rules are used. Otherwise the + returns a non-empty list, the C++ qualified name lookup rules are used. Otherwise the unquialified name lookup rules are used. Returns the a list of members that was found, In most cases this list will contain zero or one element, exept in the case of overloaded functions. TODO: Argument-dependent name lookup @@ -975,7 +975,7 @@ FunctionMember *Semantic::functionLookup(CodeModel::Scope *baseScope, */ FunctionMember *Semantic::selectFunction(QList candidatateList, const DeclaratorAST *functionDeclarator) { - // get arguments for funciton we are looking for + // get arguments for function we are looking for FunctionMember testFunction; parseFunctionArguments(functionDeclarator, &testFunction); const ArgumentCollection testArgumentCollection = testFunction.arguments(); -- cgit v0.12 From 34d7bfd51d1dec1b3f397c733fc637af19dc0c97 Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 28 Jul 2010 14:44:34 +0200 Subject: Fixed a problem with dso dependencies. Dependencies to dso files were not generated correctly, both because the PRE_TARGETDEPS variable seems to be local to the function it was in, and also because the regular expression was wrong (it has to match the whole string). Also switched to qt_ style variable names to avoid clashes. RevBy: Trust me --- mkspecs/features/symbian/symbian_building.prf | 40 ++++++++++++++------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index a36193e..c119c90 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -42,29 +42,31 @@ contains(QMAKE_CFLAGS, "--thumb")|contains(QMAKE_CXXFLAGS, "--thumb")|contains(Q DEFINES += __MARM_THUMB__ } -defineReplace(processSymbianLibraries) { - library = $$replace(1, "\\.dll$", ".dso") - library = $$replace(library, "^-l", "") - isFullName = $$find(library, \\.) - isEmpty(isFullName):library="$${library}.dso" - linux-gcce { - newLIB = "-l:$${library}" - } else { - newLIB = "$${library}" - } - contains(library, "\\.dso$")|contains(library, "\\.lib$"):PRE_TARGETDEPS += $$library - return($$newLIB) +defineReplace(processSymbianLibrary) { + qt_library = $$replace(1, "\\.dll$", ".dso") + qt_library = $$replace(qt_library, "^-l", "") + isFullName = $$find(qt_library, \\.) + isEmpty(isFullName):qt_library="$${qt_library}.dso" + return($$qt_library) } -for(libraries, LIBS) { - newLIBS += $$processSymbianLibraries($$libraries) +qt_libraries = $$split(LIBS, " ") +LIBS = +for(qt_library, qt_libraries) { + qt_newLib = $$processSymbianLibrary($$qt_library) + contains(qt_newLib, ".*\\.dso$")|contains(qt_newLib, ".*\\.lib$"):PRE_TARGETDEPS += $$qt_newLib + linux-gcce:qt_newLib = "-l:$$qt_newLib" + LIBS += $$qt_newLib } -LIBS = $$newLIBS -newLIBS = -for(libraries, QMAKE_LIBS) { - newLIBS += $$processSymbianLibraries($$libraries) + +qt_libraries = $$split(QMAKE_LIBS, " ") +QMAKE_LIBS = +for(qt_library, qt_libraries) { + qt_newLib = $$processSymbianLibrary($$qt_library) + contains(qt_newLib, ".*\\.dso$")|contains(qt_newLib, ".*\\.lib$"):PRE_TARGETDEPS += $$qt_newLib + linux-gcce:qt_newLib = "-l:$$qt_newLib" + QMAKE_LIBS += $$qt_newLib } -QMAKE_LIBS = $$newLIBS elf2e32_LIBPATH = for(libPath, QMAKE_LIBDIR) { -- cgit v0.12 From ddbffbe7271cfdd3935c188ccb8e804ad73627f6 Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 28 Jul 2010 16:10:40 +0200 Subject: Removed static on a member that didn't have to be. One step further towards no static data... RevBy: Trust me --- src/gui/kernel/qapplication_p.h | 2 +- src/gui/kernel/qapplication_s60.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 3a3f816..53205b5 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -603,7 +603,7 @@ private: #endif #ifdef Q_OS_SYMBIAN - static QHash scanCodeCache; + QHash scanCodeCache; #endif static QApplicationPrivate *self; diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index e8ee2e4..46a151b 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -226,8 +226,6 @@ void QS60Beep::MatoPlayComplete(TInt aError) } -QHash QApplicationPrivate::scanCodeCache; - static Qt::KeyboardModifiers mapToQtModifiers(TUint s60Modifiers) { Qt::KeyboardModifiers result = Qt::NoModifier; @@ -2096,13 +2094,18 @@ void QApplication::setEffectEnabled(Qt::UIEffect /* effect */, bool /* enable */ TUint QApplicationPrivate::resolveS60ScanCode(TInt scanCode, TUint keysym) { + if (!scanCode) + return keysym; + + QApplicationPrivate *d = QApplicationPrivate::instance(); + if (keysym) { // If keysym is specified, cache it. - scanCodeCache.insert(scanCode, keysym); + d->scanCodeCache.insert(scanCode, keysym); return keysym; } else { // If not, retrieve the cached version. - return scanCodeCache[scanCode]; + return d->scanCodeCache[scanCode]; } } -- cgit v0.12 From 998ba966215482048f7fa93908212b1ee4a0c357 Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 28 Jul 2010 11:24:59 +0200 Subject: Refactored the virtual mouse handling code into its own function. RevBy: Trust me --- src/gui/kernel/qapplication_s60.cpp | 351 ++++++++++++++++++------------------ src/gui/kernel/qt_s60_p.h | 1 + 2 files changed, 181 insertions(+), 171 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 46a151b..c57f245 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -647,178 +647,9 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod case EEventKeyUp: case EEventKey: { -#ifndef QT_NO_CURSOR - if (S60->mouseInteractionEnabled && S60->virtualMouseRequired) { - //translate keys to pointer - if ((keyEvent.iScanCode >= EStdKeyLeftArrow && keyEvent.iScanCode <= EStdKeyDownArrow) || - (keyEvent.iScanCode >= EStdKeyDevice10 && keyEvent.iScanCode <= EStdKeyDevice13) || - keyEvent.iScanCode == EStdKeyDevice3) { - QPoint pos = QCursor::pos(); - TPointerEvent fakeEvent; - fakeEvent.iType = (TPointerEvent::TType)(-1); - fakeEvent.iModifiers = keyEvent.iModifiers; - TInt x = pos.x(); - TInt y = pos.y(); - if (type == EEventKeyUp) { - S60->virtualMouseAccelTimeout.start(); - switch (keyEvent.iScanCode) { - case EStdKeyLeftArrow: - S60->virtualMousePressedKeys &= ~QS60Data::Left; - break; - case EStdKeyRightArrow: - S60->virtualMousePressedKeys &= ~QS60Data::Right; - break; - case EStdKeyUpArrow: - S60->virtualMousePressedKeys &= ~QS60Data::Up; - break; - case EStdKeyDownArrow: - S60->virtualMousePressedKeys &= ~QS60Data::Down; - break; - // diagonal keys (named aliases don't exist in 3.1 SDK) - case EStdKeyDevice10: - S60->virtualMousePressedKeys &= ~QS60Data::LeftUp; - break; - case EStdKeyDevice11: - S60->virtualMousePressedKeys &= ~QS60Data::RightUp; - break; - case EStdKeyDevice12: - S60->virtualMousePressedKeys &= ~QS60Data::RightDown; - break; - case EStdKeyDevice13: - S60->virtualMousePressedKeys &= ~QS60Data::LeftDown; - break; - case EStdKeyDevice3: //select - if (S60->virtualMousePressedKeys & QS60Data::Select) - fakeEvent.iType = TPointerEvent::EButton1Up; - S60->virtualMousePressedKeys &= ~QS60Data::Select; - break; - } - } - else if (type == EEventKey) { - int dx = 0; - int dy = 0; - if (keyEvent.iScanCode != EStdKeyDevice3) { - m_doubleClickTimer.invalidate(); - //reset mouse accelleration after a short time with no moves - const int maxTimeBetweenKeyEventsMs = 500; - if (S60->virtualMouseAccelTimeout.isValid() && - S60->virtualMouseAccelTimeout.hasExpired(maxTimeBetweenKeyEventsMs)) { - S60->virtualMouseAccelDX = 0; - S60->virtualMouseAccelDY = 0; - } - S60->virtualMouseAccelTimeout.invalidate(); - } - switch (keyEvent.iScanCode) { - case EStdKeyLeftArrow: - S60->virtualMousePressedKeys |= QS60Data::Left; - dx = -1; - fakeEvent.iType = TPointerEvent::EMove; - break; - case EStdKeyRightArrow: - S60->virtualMousePressedKeys |= QS60Data::Right; - dx = 1; - fakeEvent.iType = TPointerEvent::EMove; - break; - case EStdKeyUpArrow: - S60->virtualMousePressedKeys |= QS60Data::Up; - dy = -1; - fakeEvent.iType = TPointerEvent::EMove; - break; - case EStdKeyDownArrow: - S60->virtualMousePressedKeys |= QS60Data::Down; - dy = 1; - fakeEvent.iType = TPointerEvent::EMove; - break; - case EStdKeyDevice10: - S60->virtualMousePressedKeys |= QS60Data::LeftUp; - dx = -1; - dy = -1; - fakeEvent.iType = TPointerEvent::EMove; - break; - case EStdKeyDevice11: - S60->virtualMousePressedKeys |= QS60Data::RightUp; - dx = 1; - dy = -1; - fakeEvent.iType = TPointerEvent::EMove; - break; - case EStdKeyDevice12: - S60->virtualMousePressedKeys |= QS60Data::RightDown; - dx = 1; - dy = 1; - fakeEvent.iType = TPointerEvent::EMove; - break; - case EStdKeyDevice13: - S60->virtualMousePressedKeys |= QS60Data::LeftDown; - dx = -1; - dy = 1; - fakeEvent.iType = TPointerEvent::EMove; - break; - case EStdKeyDevice3: - // Platform bug. If you start pressing several keys simultaneously (for - // example for drag'n'drop), Symbian starts producing spurious up and - // down messages for some keys. Therefore, make sure we have a clean slate - // of pressed keys before starting a new button press. - if (S60->virtualMousePressedKeys & QS60Data::Select) { - return EKeyWasConsumed; - } else { - S60->virtualMousePressedKeys |= QS60Data::Select; - fakeEvent.iType = TPointerEvent::EButton1Down; - if (m_doubleClickTimer.isValid() - && !m_doubleClickTimer.hasExpired(QApplication::doubleClickInterval())) { - fakeEvent.iModifiers |= EModifierDoubleClick; - m_doubleClickTimer.invalidate(); - } else { - m_doubleClickTimer.start(); - } - } - break; - } - if (dx) { - int cdx = S60->virtualMouseAccelDX; - //reset accel on change of sign, else double accel - if (dx * cdx <= 0) - cdx = dx; - else - cdx *= 4; - //cap accelleration - if (dx * cdx > S60->virtualMouseMaxAccel) - cdx = dx * S60->virtualMouseMaxAccel; - //move mouse position - x += cdx; - S60->virtualMouseAccelDX = cdx; - } + if (handleVirtualMouse(keyEvent, type) == EKeyWasConsumed) + return EKeyWasConsumed; - if (dy) { - int cdy = S60->virtualMouseAccelDY; - if (dy * cdy <= 0) - cdy = dy; - else - cdy *= 4; - if (dy * cdy > S60->virtualMouseMaxAccel) - cdy = dy * S60->virtualMouseMaxAccel; - y += cdy; - S60->virtualMouseAccelDY = cdy; - } - } - //clip to screen size (window server allows a sprite hotspot to be outside the screen) - if (x < 0) - x = 0; - else if (x >= S60->screenWidthInPixels) - x = S60->screenWidthInPixels - 1; - if (y < 0) - y = 0; - else if (y >= S60->screenHeightInPixels) - y = S60->screenHeightInPixels - 1; - TPoint epos(x, y); - TPoint cpos = epos - PositionRelativeToScreen(); - fakeEvent.iPosition = cpos; - fakeEvent.iParentPosition = epos; - if(fakeEvent.iType != -1) - HandlePointerEvent(fakeEvent); - return EKeyWasConsumed; - } - } -#endif // S60 has a confusing way of delivering key events. There are three types of // events: EKeyEvent, EKeyEventDown and EKeyEventUp. When a key is pressed, the // two first events are generated. When releasing the key, the last one is @@ -890,6 +721,184 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod return EKeyWasNotConsumed; } +TKeyResponse QSymbianControl::handleVirtualMouse(const TKeyEvent& keyEvent,TEventCode type) +{ +#ifndef QT_NO_CURSOR + if (S60->mouseInteractionEnabled && S60->virtualMouseRequired) { + //translate keys to pointer + if ((keyEvent.iScanCode >= EStdKeyLeftArrow && keyEvent.iScanCode <= EStdKeyDownArrow) || + (keyEvent.iScanCode >= EStdKeyDevice10 && keyEvent.iScanCode <= EStdKeyDevice13) || + keyEvent.iScanCode == EStdKeyDevice3) { + QPoint pos = QCursor::pos(); + TPointerEvent fakeEvent; + fakeEvent.iType = (TPointerEvent::TType)(-1); + fakeEvent.iModifiers = keyEvent.iModifiers; + TInt x = pos.x(); + TInt y = pos.y(); + if (type == EEventKeyUp) { + S60->virtualMouseAccelTimeout.start(); + switch (keyEvent.iScanCode) { + case EStdKeyLeftArrow: + S60->virtualMousePressedKeys &= ~QS60Data::Left; + break; + case EStdKeyRightArrow: + S60->virtualMousePressedKeys &= ~QS60Data::Right; + break; + case EStdKeyUpArrow: + S60->virtualMousePressedKeys &= ~QS60Data::Up; + break; + case EStdKeyDownArrow: + S60->virtualMousePressedKeys &= ~QS60Data::Down; + break; + // diagonal keys (named aliases don't exist in 3.1 SDK) + case EStdKeyDevice10: + S60->virtualMousePressedKeys &= ~QS60Data::LeftUp; + break; + case EStdKeyDevice11: + S60->virtualMousePressedKeys &= ~QS60Data::RightUp; + break; + case EStdKeyDevice12: + S60->virtualMousePressedKeys &= ~QS60Data::RightDown; + break; + case EStdKeyDevice13: + S60->virtualMousePressedKeys &= ~QS60Data::LeftDown; + break; + case EStdKeyDevice3: //select + if (S60->virtualMousePressedKeys & QS60Data::Select) + fakeEvent.iType = TPointerEvent::EButton1Up; + S60->virtualMousePressedKeys &= ~QS60Data::Select; + break; + } + } + else if (type == EEventKey) { + int dx = 0; + int dy = 0; + if (keyEvent.iScanCode != EStdKeyDevice3) { + m_doubleClickTimer.invalidate(); + //reset mouse accelleration after a short time with no moves + const int maxTimeBetweenKeyEventsMs = 500; + if (S60->virtualMouseAccelTimeout.isValid() && + S60->virtualMouseAccelTimeout.hasExpired(maxTimeBetweenKeyEventsMs)) { + S60->virtualMouseAccelDX = 0; + S60->virtualMouseAccelDY = 0; + } + S60->virtualMouseAccelTimeout.invalidate(); + } + switch (keyEvent.iScanCode) { + case EStdKeyLeftArrow: + S60->virtualMousePressedKeys |= QS60Data::Left; + dx = -1; + fakeEvent.iType = TPointerEvent::EMove; + break; + case EStdKeyRightArrow: + S60->virtualMousePressedKeys |= QS60Data::Right; + dx = 1; + fakeEvent.iType = TPointerEvent::EMove; + break; + case EStdKeyUpArrow: + S60->virtualMousePressedKeys |= QS60Data::Up; + dy = -1; + fakeEvent.iType = TPointerEvent::EMove; + break; + case EStdKeyDownArrow: + S60->virtualMousePressedKeys |= QS60Data::Down; + dy = 1; + fakeEvent.iType = TPointerEvent::EMove; + break; + case EStdKeyDevice10: + S60->virtualMousePressedKeys |= QS60Data::LeftUp; + dx = -1; + dy = -1; + fakeEvent.iType = TPointerEvent::EMove; + break; + case EStdKeyDevice11: + S60->virtualMousePressedKeys |= QS60Data::RightUp; + dx = 1; + dy = -1; + fakeEvent.iType = TPointerEvent::EMove; + break; + case EStdKeyDevice12: + S60->virtualMousePressedKeys |= QS60Data::RightDown; + dx = 1; + dy = 1; + fakeEvent.iType = TPointerEvent::EMove; + break; + case EStdKeyDevice13: + S60->virtualMousePressedKeys |= QS60Data::LeftDown; + dx = -1; + dy = 1; + fakeEvent.iType = TPointerEvent::EMove; + break; + case EStdKeyDevice3: + // Platform bug. If you start pressing several keys simultaneously (for + // example for drag'n'drop), Symbian starts producing spurious up and + // down messages for some keys. Therefore, make sure we have a clean slate + // of pressed keys before starting a new button press. + if (S60->virtualMousePressedKeys & QS60Data::Select) { + return EKeyWasConsumed; + } else { + S60->virtualMousePressedKeys |= QS60Data::Select; + fakeEvent.iType = TPointerEvent::EButton1Down; + if (m_doubleClickTimer.isValid() + && !m_doubleClickTimer.hasExpired(QApplication::doubleClickInterval())) { + fakeEvent.iModifiers |= EModifierDoubleClick; + m_doubleClickTimer.invalidate(); + } else { + m_doubleClickTimer.start(); + } + } + break; + } + if (dx) { + int cdx = S60->virtualMouseAccelDX; + //reset accel on change of sign, else double accel + if (dx * cdx <= 0) + cdx = dx; + else + cdx *= 4; + //cap accelleration + if (dx * cdx > S60->virtualMouseMaxAccel) + cdx = dx * S60->virtualMouseMaxAccel; + //move mouse position + x += cdx; + S60->virtualMouseAccelDX = cdx; + } + + if (dy) { + int cdy = S60->virtualMouseAccelDY; + if (dy * cdy <= 0) + cdy = dy; + else + cdy *= 4; + if (dy * cdy > S60->virtualMouseMaxAccel) + cdy = dy * S60->virtualMouseMaxAccel; + y += cdy; + S60->virtualMouseAccelDY = cdy; + } + } + //clip to screen size (window server allows a sprite hotspot to be outside the screen) + if (x < 0) + x = 0; + else if (x >= S60->screenWidthInPixels) + x = S60->screenWidthInPixels - 1; + if (y < 0) + y = 0; + else if (y >= S60->screenHeightInPixels) + y = S60->screenHeightInPixels - 1; + TPoint epos(x, y); + TPoint cpos = epos - PositionRelativeToScreen(); + fakeEvent.iPosition = cpos; + fakeEvent.iParentPosition = epos; + if(fakeEvent.iType != -1) + HandlePointerEvent(fakeEvent); + return EKeyWasConsumed; + } + } +#endif + + return EKeyWasNotConsumed; +} + void QSymbianControl::sendInputEvent(QWidget *widget, QInputEvent *inputEvent) { switch (inputEvent->type()) { diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 6be9bbc..6004961 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -225,6 +225,7 @@ private: void HandlePointerEvent(const TPointerEvent& aPointerEvent); TKeyResponse OfferKeyEvent(const TKeyEvent& aKeyEvent,TEventCode aType); TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent); + TKeyResponse handleVirtualMouse(const TKeyEvent& keyEvent,TEventCode type); bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent); void sendMouseEvent( QWidget *receiver, -- cgit v0.12 From 5a3246b198ced3634bd974919e78310d536be27e Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 28 Jul 2010 11:30:24 +0200 Subject: Cleaned up old comments. --- src/gui/kernel/qapplication_s60.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index c57f245..bb30bcb 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -661,14 +661,6 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod // the EKeyEvent events. This is what resolveS60ScanCode does. - // ### hackish way to send Qt application to background when pressing right softkey - /* - if( keyEvent.iScanCode == EStdKeyDevice1 ) { - S60->window_group->SetOrdinalPosition(-1); - qApp->setActiveWindow(0); - return EKeyWasNotConsumed; - } - */ TUint s60Keysym = QApplicationPrivate::resolveS60ScanCode(keyEvent.iScanCode, keyEvent.iCode); @@ -687,10 +679,6 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod QKeyEventEx qKeyEvent(type == EEventKeyUp ? QEvent::KeyRelease : QEvent::KeyPress, keyCode, mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods), (keyEvent.iRepeats != 0), 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers); -// WId wid = reinterpret_cast(keyEvent.Handle())->Child(); -// if (!wid) -// Could happen if window isn't shown yet. -// return EKeyWasNotConsumed; QWidget *widget; widget = QWidget::keyboardGrabber(); if (!widget) { -- cgit v0.12 From 041570ca54824ee358593f112b38e26632c3ebbf Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 29 Jul 2010 10:25:40 +0200 Subject: Fixed key event handling on Symbian. After looking at QTBUG-11338 and Qt's behavior, it became clear that we needed more state tracking in the key event handling code, to be able to handle all the different ways that we can get key events. This inspired having three states for each used scan code, instead of the old code, which only took the current scan code into account. This should make Symbian behave identically to Linux. Task: QTBUG-11338 AutoTest: N/A, platform specific code. There was lots of manual testing on 5800, N97 and N95. RevBy: Jason Barron --- src/gui/kernel/qapplication_s60.cpp | 164 ++++++++++++++++++++++++------------ src/gui/kernel/qt_s60_p.h | 9 ++ 2 files changed, 118 insertions(+), 55 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index bb30bcb..f8734b2 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -642,71 +642,125 @@ TKeyResponse QSymbianControl::OfferKeyEventL(const TKeyEvent& keyEvent, TEventCo TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCode type) { - switch (type) { - //case EEventKeyDown: // <-- Intentionally left out. See below. - case EEventKeyUp: - case EEventKey: - { + /* + S60 has a confusing way of delivering key events. There are three types of + events: EEventKey, EEventKeyDown and EEventKeyUp. When a key is pressed, + EEventKeyDown is first generated, followed by EEventKey. Then, when the key is + released, EEventKeyUp is generated. + However, it is possible that only the EEventKey is generated alone, typically + in relation to virtual keyboards. In that case we need to take care to + generate both press and release events in Qt, since applications expect that. + We do this by having three states for each used scan code, depending on the + events received. See the switch below for what happens in each state + transition. + */ + + if (type != EEventKeyDown) if (handleVirtualMouse(keyEvent, type) == EKeyWasConsumed) return EKeyWasConsumed; - // S60 has a confusing way of delivering key events. There are three types of - // events: EKeyEvent, EKeyEventDown and EKeyEventUp. When a key is pressed, the - // two first events are generated. When releasing the key, the last one is - // generated. - // Because S60 does not generate keysyms for EKeyEventDown and EKeyEventUp events, - // we need to do some special tricks to map it to the Qt way. First, we completely - // discard EKeyEventDown events, since they are redundant. Second, since - // EKeyEventUp does not give us a keysym, we need to cache the keysyms from - // the EKeyEvent events. This is what resolveS60ScanCode does. - - - - TUint s60Keysym = QApplicationPrivate::resolveS60ScanCode(keyEvent.iScanCode, - keyEvent.iCode); - int keyCode; - if (s60Keysym == EKeyNull){ //some key events have 0 in iCode, for them iScanCode should be used - keyCode = qt_keymapper_private()->mapS60ScanCodesToQt(keyEvent.iScanCode); - } else if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) { - // Normal characters keys. - keyCode = s60Keysym; - } else { - // Special S60 keys. - keyCode = qt_keymapper_private()->mapS60KeyToQt(s60Keysym); + TKeyResponse ret = EKeyWasNotConsumed; +#define GET_RETURN(x) (ret = ((x) == EKeyWasConsumed) ? EKeyWasConsumed : ret) + + // This top level switch corresponds to the states, and the inner switches + // correspond to the transitions. + QS60Data::ScanCodeState &scanCodeState = S60->scanCodeStates[keyEvent.iScanCode]; + switch (scanCodeState) { + case QS60Data::Unpressed: + switch (type) { + case EEventKeyDown: + scanCodeState = QS60Data::KeyDown; + break; + case EEventKey: + GET_RETURN(sendSymbianKeyEvent(keyEvent, QEvent::KeyPress)); + GET_RETURN(sendSymbianKeyEvent(keyEvent, QEvent::KeyRelease)); + break; + case EEventKeyUp: + // No action. + break; } - - Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers); - QKeyEventEx qKeyEvent(type == EEventKeyUp ? QEvent::KeyRelease : QEvent::KeyPress, keyCode, - mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods), - (keyEvent.iRepeats != 0), 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers); - QWidget *widget; - widget = QWidget::keyboardGrabber(); - if (!widget) { - if (QApplicationPrivate::popupWidgets != 0) { - widget = QApplication::activePopupWidget()->focusWidget(); - if (!widget) { - widget = QApplication::activePopupWidget(); - } - } else { - widget = QApplicationPrivate::focus_widget; - if (!widget) { - widget = qwidget; - } - } + break; + case QS60Data::KeyDown: + switch (type) { + case EEventKeyDown: + // This should never happen, just stay in this state to be safe. + break; + case EEventKey: + GET_RETURN(sendSymbianKeyEvent(keyEvent, QEvent::KeyPress)); + scanCodeState = QS60Data::KeyDownAndKey; + break; + case EEventKeyUp: + scanCodeState = QS60Data::Unpressed; + break; + } + break; + case QS60Data::KeyDownAndKey: + switch (type) { + case EEventKeyDown: + // This should never happen, just stay in this state to be safe. + break; + case EEventKey: + GET_RETURN(sendSymbianKeyEvent(keyEvent, QEvent::KeyRelease)); + GET_RETURN(sendSymbianKeyEvent(keyEvent, QEvent::KeyPress)); + break; + case EEventKeyUp: + GET_RETURN(sendSymbianKeyEvent(keyEvent, QEvent::KeyRelease)); + scanCodeState = QS60Data::Unpressed; + break; } + break; + } + return ret; - QEventDispatcherS60 *dispatcher; - // It is theoretically possible for someone to install a different event dispatcher. - if ((dispatcher = qobject_cast(widget->d_func()->threadData->eventDispatcher)) != 0) { - if (dispatcher->excludeUserInputEvents()) { - dispatcher->saveInputEvent(this, widget, new QKeyEventEx(qKeyEvent)); - return EKeyWasConsumed; +#undef GET_RETURN +} + +TKeyResponse QSymbianControl::sendSymbianKeyEvent(const TKeyEvent &keyEvent, QEvent::Type type) +{ + // Because S60 does not generate keysyms for EKeyEventDown and EKeyEventUp + // events, we need to cache the keysyms from the EKeyEvent events. This is what + // resolveS60ScanCode does. + TUint s60Keysym = QApplicationPrivate::resolveS60ScanCode(keyEvent.iScanCode, + keyEvent.iCode); + int keyCode; + if (s60Keysym == EKeyNull){ //some key events have 0 in iCode, for them iScanCode should be used + keyCode = qt_keymapper_private()->mapS60ScanCodesToQt(keyEvent.iScanCode); + } else if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) { + // Normal characters keys. + keyCode = s60Keysym; + } else { + // Special S60 keys. + keyCode = qt_keymapper_private()->mapS60KeyToQt(s60Keysym); + } + + Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers); + QKeyEventEx qKeyEvent(type, keyCode, mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods), + (keyEvent.iRepeats != 0), 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers); + QWidget *widget; + widget = QWidget::keyboardGrabber(); + if (!widget) { + if (QApplicationPrivate::popupWidgets != 0) { + widget = QApplication::activePopupWidget()->focusWidget(); + if (!widget) { + widget = QApplication::activePopupWidget(); + } + } else { + widget = QApplicationPrivate::focus_widget; + if (!widget) { + widget = qwidget; } } - return sendKeyEvent(widget, &qKeyEvent); } + + QEventDispatcherS60 *dispatcher; + // It is theoretically possible for someone to install a different event dispatcher. + if ((dispatcher = qobject_cast(widget->d_func()->threadData->eventDispatcher)) != 0) { + if (dispatcher->excludeUserInputEvents()) { + dispatcher->saveInputEvent(this, widget, new QKeyEventEx(qKeyEvent)); + return EKeyWasConsumed; + } } - return EKeyWasNotConsumed; + return sendKeyEvent(widget, &qKeyEvent); } TKeyResponse QSymbianControl::handleVirtualMouse(const TKeyEvent& keyEvent,TEventCode type) diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 6004961..7f0c99e 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -143,6 +143,14 @@ public: int menuBeingConstructed : 1; int memoryLimitForHwRendering; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type + + enum ScanCodeState { + Unpressed, + KeyDown, + KeyDownAndKey + }; + QHash scanCodeStates; + static inline void updateScreenSize(); inline RWsSession& wsSession(); static inline RWindowGroup& windowGroup(); @@ -224,6 +232,7 @@ protected: private: void HandlePointerEvent(const TPointerEvent& aPointerEvent); TKeyResponse OfferKeyEvent(const TKeyEvent& aKeyEvent,TEventCode aType); + TKeyResponse sendSymbianKeyEvent(const TKeyEvent &keyEvent, QEvent::Type type); TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent); TKeyResponse handleVirtualMouse(const TKeyEvent& keyEvent,TEventCode type); bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent); -- cgit v0.12 From 1d26798c0882ac9be1059ab612533d1750a3ac7b Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 29 Jul 2010 18:56:42 +0200 Subject: doc: Add a note about QCoreApplication::applicationDirPath --- doc/src/platforms/mac-differences.qdoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/src/platforms/mac-differences.qdoc b/doc/src/platforms/mac-differences.qdoc index 766c619..2501656 100644 --- a/doc/src/platforms/mac-differences.qdoc +++ b/doc/src/platforms/mac-differences.qdoc @@ -175,6 +175,9 @@ \l{http://developer.apple.com/documentation/CoreFoundation/Reference/CFBundleRef/index.html} {Apple's Developer Website}. + Note: QCoreApplication::applicationDirPath() can be used to determine + the path of the binary within the bundle. + \section2 Translating the Application Menu and Native Dialogs The items in the Application Menu will be merged correctly for -- cgit v0.12 From 73595a315989581e2f59b28af5d150d39ea6b8ff Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 29 Jul 2010 22:09:00 +0200 Subject: Updated WebKit to e6e692bb056670e2781dd0bc473a60757ae53992 Backported various crash fixes --- src/3rdparty/webkit/.tag | 2 +- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 73 +++++++++ .../JavaScriptCore/interpreter/Interpreter.cpp | 16 +- .../webkit/JavaScriptCore/jit/JITStubs.cpp | 43 +++--- .../webkit/JavaScriptCore/runtime/Arguments.h | 4 + .../webkit/JavaScriptCore/runtime/JSArray.cpp | 6 +- .../JavaScriptCore/yarr/RegexInterpreter.cpp | 2 +- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 166 +++++++++++++++++++++ src/3rdparty/webkit/WebCore/dom/CharacterData.cpp | 8 +- src/3rdparty/webkit/WebCore/dom/Element.cpp | 17 ++- src/3rdparty/webkit/WebCore/dom/Element.h | 4 + src/3rdparty/webkit/WebCore/dom/Text.cpp | 2 +- .../webkit/WebCore/platform/text/BidiResolver.h | 67 +++++---- .../webkit/WebCore/rendering/RenderBlock.cpp | 6 + .../webkit/WebCore/rendering/RenderSVGText.cpp | 13 ++ .../webkit/WebCore/rendering/RenderSVGText.h | 3 + .../webkit/WebCore/rendering/RenderWidget.cpp | 4 + src/3rdparty/webkit/WebCore/svg/SVGElement.cpp | 9 ++ .../webkit/WebCore/svg/SVGFontFaceElement.cpp | 1 - .../webkit/WebCore/svg/SVGForeignObjectElement.cpp | 4 + src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp | 4 + src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp | 2 +- 23 files changed, 393 insertions(+), 65 deletions(-) diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 3cb818d..0b414ab 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -0be9ff9f2b1ec2b748885ac15299bc1c65aca590 +e6e692bb056670e2781dd0bc473a60757ae53992 diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index ea680ac..c09ad79 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,76 @@ +2010-07-02 Peter Varga + + Reviewed by Oliver Hunt. + + The alternativeFrameLocation value is wrong in the emitDisjunction function in + case of PatternTerm::TypeParentheticalAssertion. This value needs to be + computed from term.frameLocation instead of term.inputPosition. This mistake caused glibc + memory corruption in some cases. + Layout test added for checking of TypeParentheticalAssertion case. + https://bugs.webkit.org/show_bug.cgi?id=41458 + + * yarr/RegexInterpreter.cpp: + (JSC::Yarr::ByteCompiler::emitDisjunction): + +2010-07-03 Yong Li + + Reviewed by Darin Adler. + + Make Arguments::MaxArguments clamping work for numbers >= 0x80000000 in + the interpreter as well as the JIT. + + https://bugs.webkit.org/show_bug.cgi?id=41351 + rdar://problem/8142141 + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): Fix signed integer overflow problem + in op_load_varargs handling. 0xFFFFFFFF was read as -1. + +2010-07-04 Mark Rowe + + Build fix after r62456. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): Be slightly more consistent in using uint32_t to prevent + warnings about comparisons between signed and unsigned types, and attempts to call an overload + of std::min that doesn't exist. + +2010-07-02 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Clamp the number of arguments supported by function.apply + https://bugs.webkit.org/show_bug.cgi?id=41351 + + + Add clamping logic to function.apply similar to that + enforced by firefox. We have a smaller clamp than + firefox as our calling convention means that stack + usage is proportional to argument count -- the firefox + limit is larger than you could actually call. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * runtime/Arguments.h: + (JSC::Arguments::): + +2010-07-01 Oliver Hunt + + Reviewed by Geoff Garen. + + Improve reentrancy logic in polymorphic cache stubs + + + + Make the polymorphic cache stubs handle reentrancy + better. + + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + (JSC::getPolymorphicAccessStructureListSlot): + 2009-10-30 Tor Arne Vestbø Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp index 2713fd4..73efc0d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2008 Cameron Zwarich * * Redistribution and use in source and binary forms, with or without @@ -3454,9 +3454,10 @@ skip_id_custom_self: int argsOffset = vPC[2].u.operand; JSValue arguments = callFrame->r(argsOffset).jsValue(); - int32_t argCount = 0; + uint32_t argCount = 0; if (!arguments) { argCount = (uint32_t)(callFrame->argumentCount()) - 1; + argCount = min(argCount, Arguments::MaxArguments); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -3464,9 +3465,9 @@ skip_id_custom_self: goto vm_throw; } ASSERT(!callFrame->callee()->isHostFunction()); - int32_t expectedParams = callFrame->callee()->jsExecutable()->parameterCount(); - int32_t inplaceArgs = min(argCount, expectedParams); - int32_t i = 0; + uint32_t expectedParams = callFrame->callee()->jsExecutable()->parameterCount(); + uint32_t inplaceArgs = min(argCount, expectedParams); + uint32_t i = 0; Register* argStore = callFrame->registers() + argsOffset; // First step is to copy the "expected" parameters from their normal location relative to the callframe @@ -3483,6 +3484,7 @@ skip_id_custom_self: if (asObject(arguments)->classInfo() == &Arguments::info) { Arguments* args = asArguments(arguments); argCount = args->numProvidedArguments(callFrame); + argCount = min(argCount, Arguments::MaxArguments); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -3493,6 +3495,7 @@ skip_id_custom_self: } else if (isJSArray(&callFrame->globalData(), arguments)) { JSArray* array = asArray(arguments); argCount = array->length(); + argCount = min(argCount, Arguments::MaxArguments); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -3503,6 +3506,7 @@ skip_id_custom_self: } else if (asObject(arguments)->inherits(&JSArray::info)) { JSObject* argObject = asObject(arguments); argCount = argObject->get(callFrame, callFrame->propertyNames().length).toUInt32(callFrame); + argCount = min(argCount, Arguments::MaxArguments); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -3510,7 +3514,7 @@ skip_id_custom_self: goto vm_throw; } Register* argsBuffer = callFrame->registers() + argsOffset; - for (int32_t i = 0; i < argCount; ++i) { + for (uint32_t i = 0; i < argCount; ++i) { argsBuffer[i] = asObject(arguments)->get(callFrame, i); CHECK_FOR_EXCEPTION(); } diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index daa945c..e5fcdc4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -1330,17 +1330,18 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_self_fail) if (stubInfo->accessType == access_get_by_id_self) { ASSERT(!stubInfo->stubRoutine); polymorphicStructureList = new PolymorphicAccessStructureList(CodeLocationLabel(), stubInfo->u.getByIdSelf.baseObjectStructure); - stubInfo->initGetByIdSelfList(polymorphicStructureList, 2); + stubInfo->initGetByIdSelfList(polymorphicStructureList, 1); } else { polymorphicStructureList = stubInfo->u.getByIdSelfList.structureList; listIndex = stubInfo->u.getByIdSelfList.listSize; - stubInfo->u.getByIdSelfList.listSize++; } + if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) { + stubInfo->u.getByIdSelfList.listSize++; + JIT::compileGetByIdSelfList(callFrame->scopeChain()->globalData, codeBlock, stubInfo, polymorphicStructureList, listIndex, asCell(baseValue)->structure(), ident, slot, slot.cachedOffset()); - JIT::compileGetByIdSelfList(callFrame->scopeChain()->globalData, codeBlock, stubInfo, polymorphicStructureList, listIndex, asCell(baseValue)->structure(), ident, slot, slot.cachedOffset()); - - if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) - ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic)); + if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) + ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic)); + } } else ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic)); return JSValue::encode(result); @@ -1365,13 +1366,14 @@ static PolymorphicAccessStructureList* getPolymorphicAccessStructureListSlot(Str case access_get_by_id_proto_list: prototypeStructureList = stubInfo->u.getByIdProtoList.structureList; listIndex = stubInfo->u.getByIdProtoList.listSize; - stubInfo->u.getByIdProtoList.listSize++; + if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) + stubInfo->u.getByIdProtoList.listSize++; break; default: ASSERT_NOT_REACHED(); } - ASSERT(listIndex < POLYMORPHIC_LIST_CACHE_SIZE); + ASSERT(listIndex <= POLYMORPHIC_LIST_CACHE_SIZE); return prototypeStructureList; } @@ -1446,21 +1448,24 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_proto_list) int listIndex; PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex); + if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) { + JIT::compileGetByIdProtoList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, slotBaseObject->structure(), propertyName, slot, offset); - JIT::compileGetByIdProtoList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, slotBaseObject->structure(), propertyName, slot, offset); - - if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) - ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full)); + if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) + ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full)); + } } else if (size_t count = normalizePrototypeChain(callFrame, baseValue, slot.slotBase(), propertyName, offset)) { ASSERT(!asCell(baseValue)->structure()->isDictionary()); int listIndex; PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex); + + if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) { + StructureChain* protoChain = structure->prototypeChain(callFrame); + JIT::compileGetByIdChainList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, protoChain, count, propertyName, slot, offset); - StructureChain* protoChain = structure->prototypeChain(callFrame); - JIT::compileGetByIdChainList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, protoChain, count, propertyName, slot, offset); - - if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) - ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full)); + if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) + ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full)); + } } else ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail)); @@ -2129,6 +2134,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs) if (!arguments) { int providedParams = callFrame->registers()[RegisterFile::ArgumentCount].i() - 1; argCount = providedParams; + argCount = min(argCount, static_cast(Arguments::MaxArguments)); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -2164,6 +2170,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs) if (asObject(arguments)->classInfo() == &Arguments::info) { Arguments* argsObject = asArguments(arguments); argCount = argsObject->numProvidedArguments(callFrame); + argCount = min(argCount, static_cast(Arguments::MaxArguments)); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -2174,6 +2181,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs) } else if (isJSArray(&callFrame->globalData(), arguments)) { JSArray* array = asArray(arguments); argCount = array->length(); + argCount = min(argCount, static_cast(Arguments::MaxArguments)); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { @@ -2184,6 +2192,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs) } else if (asObject(arguments)->inherits(&JSArray::info)) { JSObject* argObject = asObject(arguments); argCount = argObject->get(callFrame, callFrame->propertyNames().length).toUInt32(callFrame); + argCount = min(argCount, static_cast(Arguments::MaxArguments)); int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize; Register* newEnd = callFrame->registers() + sizeDelta; if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) { diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.h index 9797e08..cca3cf2 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.h @@ -55,6 +55,10 @@ namespace JSC { class Arguments : public JSObject { public: + // Use an enum because otherwise gcc insists on doing a memory + // read. + enum { MaxArguments = 0x10000 }; + enum NoParametersType { NoParameters }; Arguments(CallFrame*); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp index d3ef44c..ae9e038 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp @@ -948,10 +948,10 @@ void JSArray::fillArgList(ExecState* exec, MarkedArgumentBuffer& args) void JSArray::copyToRegisters(ExecState* exec, Register* buffer, uint32_t maxSize) { - ASSERT(m_storage->m_length == maxSize); + ASSERT(m_storage->m_length >= maxSize); UNUSED_PARAM(maxSize); JSValue* vector = m_storage->m_vector; - unsigned vectorEnd = min(m_storage->m_length, m_vectorLength); + unsigned vectorEnd = min(maxSize, m_vectorLength); unsigned i = 0; for (; i < vectorEnd; ++i) { JSValue& v = vector[i]; @@ -960,7 +960,7 @@ void JSArray::copyToRegisters(ExecState* exec, Register* buffer, uint32_t maxSiz buffer[i] = v; } - for (; i < m_storage->m_length; ++i) + for (; i < maxSize; ++i) buffer[i] = get(exec, i); } diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp index c2cb1c2..647b20a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp @@ -1554,7 +1554,7 @@ public: } case PatternTerm::TypeParentheticalAssertion: { - unsigned alternativeFrameLocation = term.inputPosition + RegexStackSpaceForBackTrackInfoParentheticalAssertion; + unsigned alternativeFrameLocation = term.frameLocation + RegexStackSpaceForBackTrackInfoParentheticalAssertion; atomParentheticalAssertionBegin(term.parentheses.subpatternId, term.invertOrCapture, term.frameLocation, alternativeFrameLocation); emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, 0); diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index f12f6b5..f8403fb 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 0be9ff9f2b1ec2b748885ac15299bc1c65aca590 + e6e692bb056670e2781dd0bc473a60757ae53992 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index f7f2803..5189eb5 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,169 @@ +2010-07-06 Nikolas Zimmermann + + Reviewed by Dirk Schulze. + + on causes crashes, if SVGUseElement gets detached + https://bugs.webkit.org/show_bug.cgi?id=41621 + + Do not call removeFromMappedElementSheet() from the SVGFontFaceElement destructor, + as that can potentially cause the element to be reattached while destructing. + + In order to fix the crash in the testcase, the order of calling the base-class detach + method in SVGUseElement and the instance/shadow tree destruction has to be reversed, + matching the order in removedFromDocument(). + + Test: svg/custom/use-font-face-crash.svg + + * svg/SVGFontFaceElement.cpp: + (WebCore::SVGFontFaceElement::~SVGFontFaceElement): Remove removeFromMappedElementSheet() call. + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::detach): Reverse order of calling base-class detach method and instance/shadow tree destruction. + +2010-07-06 Nikolas Zimmermann + + Reviewed by Darin Adler. + + on causes crashes, if SVGUseElement gets detached + https://bugs.webkit.org/show_bug.cgi?id=41621 + + Do not call removeFromMappedElementSheet() from the destructor, as the call to document()->updateStyleSelector() that can potentially + cause the element to be reattached while destructing. It's not needed at all, because removedFromDocument() is called before destruction, + which already calls removeFromMappedElementSheet() - at this point it's still safe to update the style selector. + + The crash is reproducable when using on . + + Test: svg/custom/use-font-face-crash.svg + + * svg/SVGFontFaceElement.cpp: + (WebCore::SVGFontFaceElement::~SVGFontFaceElement): + +2010-07-05 Nikolas Zimmermann + + Reviewed by Darin Adler. + + Memory corruption with SVG element + https://bugs.webkit.org/show_bug.cgi?id=40994 + + Fix race condition in svgAttributeChanged. Never call svgAttributeChanged() from attributeChanged() + when we're synchronizing SVG attributes. It leads to either unnecessary extra work being done or + crashes. Especially together with / which always synchronize the SVGAnimatedPoints + datastructure with the points attribute, no matter if there are changes are not. This should be + furhter optimized, but this fix is sane and fixes the root of the evil races. + + Test: svg/custom/use-property-synchronization-crash.svg + + * svg/SVGElement.cpp: + (WebCore::SVGElement::attributeChanged): + +2010-06-11 Abhishek Arya + + Reviewed by David Hyatt. + + Don't process floats if parent node is not a RenderBlock. + https://bugs.webkit.org/show_bug.cgi?id=40033 + + Test: svg/text/clear-floats-crash.svg + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::clearFloats): + +2010-06-23 Nikolas Zimmermann + + Reviewed by Eric Seidel. + + Reproducible crash in com.apple.WebCore 0x01ed3784 WebCore::RenderLineBoxList::appendLineBox(WebCore::InlineFlowBox*) + 36 + https://bugs.webkit.org/show_bug.cgi?id=40953 + + REGRESSION (r58209-58231): Memory corruption with invalid SVG + https://bugs.webkit.org/show_bug.cgi?id=40173 + + Fix several crashes, all related to and/or invalid SVG documents. + - Only allow nodes, as direct children of a , not any other "partial" SVG content. + - Assure to create RenderSVGRoot objects for nodes in , treat them as "outermost SVG elements". + - Never allow any partial SVG content to appear in any document. Only elements are allowed. + + Tests: svg/custom/bug45331.svg + svg/foreignObject/disallowed-svg-nodes-as-direct-children.svg + svg/foreignObject/no-crash-with-svg-content-in-html-document.svg + svg/foreignObject/svg-document-as-direct-child.svg + svg/foreignObject/svg-document-in-html-document.svg + svg/foreignObject/text-tref-02-b.svg + + * dom/Element.cpp: Added childShouldCreateRenderer, with ENABLE(SVG) guards. + (WebCore::Element::childShouldCreateRenderer): Only create a renderer for a SVG child, if we're a SVG element, or if the child is a element. + * dom/Element.h: Added childShouldCreateRenderer, with ENABLE(SVG) guards. + * svg/SVGForeignObjectElement.cpp: + (WebCore::SVGForeignObjectElement::childShouldCreateRenderer): Disallow arbitary SVG content, only elements are allowed as direct children of a + * svg/SVGSVGElement.cpp: + (WebCore::SVGSVGElement::isOutermostSVG): Be sure to create RenderSVGRoot objects for elements inside + +2010-06-10 Abhishek Arya + + Reviewed by Dave Hyatt. + + Do not render CSS Styles :first-letter and :first-line in a SVG text element context. + https://bugs.webkit.org/show_bug.cgi?id=40031 + + Test: svg/text/text-style-invalid.svg + + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::firstLineBlock): + (WebCore::RenderSVGText::updateFirstLetter): + * rendering/RenderSVGText.h: + +2010-07-01 Justin Schuh + + Reviewed by Dan Bernstein. + + Prevent crash on counter destruction + https://bugs.webkit.org/show_bug.cgi?id=40032 + + Added counter destruction to RenderWidget::destroy() + + Test: fast/css/counters/destroy-counter-crash.html + + * rendering/RenderWidget.cpp: + (WebCore::RenderWidget::destroy): + +2010-06-29 Dan Bernstein + + Reviewed by Darin Adler. + + Certain text is repeated after using splitText() + + Tests: fast/text/setData-dirty-lines.html + fast/text/splitText-dirty-lines.html + + * dom/CharacterData.cpp: + (WebCore::CharacterData::setData): Call RenderText::setTextWithOffset() rather than + setText(), because only the former correctly dirties line boxes. + * dom/Text.cpp: + (WebCore::Text::splitText): Ditto. + +2010-06-25 Dan Bernstein + + Reviewed by Sam Weinig. + + Certain text is repeated before and after a line break + + Test: fast/text/bidi-explicit-embedding-past-end.html + + * platform/text/BidiResolver.h: + (WebCore::::createBidiRunsForLine): Committing explicit embedding past the end of the range + creates BidiRuns up to the end of the range, so at that point, we can stop iterating. + +2010-06-10 Tony Chang + + Reviewed by Kent Tamura. + + crash when focus is changed while trying to focus next element + https://bugs.webkit.org/show_bug.cgi?id=40407 + + Test: fast/events/focus-change-crash.html + + * dom/Element.cpp: + (WebCore::Element::focus): + 2010-07-01 Andreas Kling Reviewed by Tor Arne Vestbø. diff --git a/src/3rdparty/webkit/WebCore/dom/CharacterData.cpp b/src/3rdparty/webkit/WebCore/dom/CharacterData.cpp index 3c3dc37..cb12184 100644 --- a/src/3rdparty/webkit/WebCore/dom/CharacterData.cpp +++ b/src/3rdparty/webkit/WebCore/dom/CharacterData.cpp @@ -46,15 +46,15 @@ void CharacterData::setData(const String& data, ExceptionCode&) int oldLength = length(); RefPtr oldStr = m_data; m_data = dataImpl; - + if ((!renderer() || !rendererIsNeeded(renderer()->style())) && attached()) { detach(); attach(); } else if (renderer()) - toRenderText(renderer())->setText(m_data); - + toRenderText(renderer())->setTextWithOffset(m_data, 0, oldLength); + dispatchModifiedEvent(oldStr.get()); - + document()->textRemoved(this, 0, oldLength); } diff --git a/src/3rdparty/webkit/WebCore/dom/Element.cpp b/src/3rdparty/webkit/WebCore/dom/Element.cpp index a02bb4c..4c93020 100644 --- a/src/3rdparty/webkit/WebCore/dom/Element.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Element.cpp @@ -1311,8 +1311,12 @@ void Element::focus(bool restorePreviousSelection) return; } - if (Page* page = doc->page()) + RefPtr protect; + if (Page* page = doc->page()) { + // Focus and change event handlers can cause us to lose our last ref. + protect = this; page->focusController()->setFocusedNode(this, doc->frame()); + } // Setting the focused node above might have invalidated the layout due to scripts. doc->updateLayoutIgnorePendingStylesheets(); @@ -1535,4 +1539,15 @@ const QualifiedName& Element::rareIDAttributeName() const return rareData()->m_idAttributeName; } +#if ENABLE(SVG) +bool Element::childShouldCreateRenderer(Node* child) const +{ + // Only create renderers for SVG elements whose parents are SVG elements, or for proper subdocuments. + if (child->isSVGElement()) + return child->hasTagName(SVGNames::svgTag) || isSVGElement(); + + return Node::childShouldCreateRenderer(child); +} +#endif + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/Element.h b/src/3rdparty/webkit/WebCore/dom/Element.h index 348ed1c..36c4f1b 100644 --- a/src/3rdparty/webkit/WebCore/dom/Element.h +++ b/src/3rdparty/webkit/WebCore/dom/Element.h @@ -270,6 +270,10 @@ public: virtual void dispatchFormControlChangeEvent() { } +#if ENABLE(SVG) + virtual bool childShouldCreateRenderer(Node*) const; +#endif + protected: Element(const QualifiedName&, Document*, ConstructionType); diff --git a/src/3rdparty/webkit/WebCore/dom/Text.cpp b/src/3rdparty/webkit/WebCore/dom/Text.cpp index 1ce074a..229fa88 100644 --- a/src/3rdparty/webkit/WebCore/dom/Text.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Text.cpp @@ -77,7 +77,7 @@ PassRefPtr Text::splitText(unsigned offset, ExceptionCode& ec) document()->textNodeSplit(this); if (renderer()) - toRenderText(renderer())->setText(dataImpl()); + toRenderText(renderer())->setTextWithOffset(dataImpl(), 0, oldStr->length()); return newText.release(); } diff --git a/src/3rdparty/webkit/WebCore/platform/text/BidiResolver.h b/src/3rdparty/webkit/WebCore/platform/text/BidiResolver.h index 286cdcd..a99fd01 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/BidiResolver.h +++ b/src/3rdparty/webkit/WebCore/platform/text/BidiResolver.h @@ -806,35 +806,33 @@ void BidiResolver::createBidiRunsForLine(const Iterator& end, boo break; } - if (pastEnd) { - if (eor == current) { - if (!reachedEndOfLine) { - eor = endOfLine; - switch (m_status.eor) { - case LeftToRight: - case RightToLeft: - case ArabicNumber: - m_direction = m_status.eor; - break; - case EuropeanNumber: - m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : EuropeanNumber; - break; - default: - ASSERT(false); - } - appendRun(); + if (pastEnd && eor == current) { + if (!reachedEndOfLine) { + eor = endOfLine; + switch (m_status.eor) { + case LeftToRight: + case RightToLeft: + case ArabicNumber: + m_direction = m_status.eor; + break; + case EuropeanNumber: + m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : EuropeanNumber; + break; + default: + ASSERT(false); } - current = end; - m_status = stateAtEnd.m_status; - sor = stateAtEnd.sor; - eor = stateAtEnd.eor; - last = stateAtEnd.last; - reachedEndOfLine = stateAtEnd.reachedEndOfLine; - lastBeforeET = stateAtEnd.lastBeforeET; - emptyRun = stateAtEnd.emptyRun; - m_direction = OtherNeutral; - break; + appendRun(); } + current = end; + m_status = stateAtEnd.m_status; + sor = stateAtEnd.sor; + eor = stateAtEnd.eor; + last = stateAtEnd.last; + reachedEndOfLine = stateAtEnd.reachedEndOfLine; + lastBeforeET = stateAtEnd.lastBeforeET; + emptyRun = stateAtEnd.emptyRun; + m_direction = OtherNeutral; + break; } // set m_status.last as needed. @@ -887,8 +885,21 @@ void BidiResolver::createBidiRunsForLine(const Iterator& end, boo } increment(); - if (!m_currentExplicitEmbeddingSequence.isEmpty()) + if (!m_currentExplicitEmbeddingSequence.isEmpty()) { commitExplicitEmbedding(); + if (pastEnd) { + current = end; + m_status = stateAtEnd.m_status; + sor = stateAtEnd.sor; + eor = stateAtEnd.eor; + last = stateAtEnd.last; + reachedEndOfLine = stateAtEnd.reachedEndOfLine; + lastBeforeET = stateAtEnd.lastBeforeET; + emptyRun = stateAtEnd.emptyRun; + m_direction = OtherNeutral; + break; + } + } if (emptyRun && (dirCurrent == RightToLeftEmbedding || dirCurrent == LeftToRightEmbedding diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp index 798663e..e7fa753 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp @@ -2981,6 +2981,12 @@ void RenderBlock::clearFloats() m_floatingObjects->clear(); } + // We should not process floats if the parent node is not a RenderBlock. Otherwise, we will add + // floats in an invalid context. This will cause a crash arising from a bad cast on the parent. + // See , where float property is applied on a text node in a SVG. + if (!parent() || !parent()->isRenderBlock()) + return; + // Attempt to locate a previous sibling with overhanging floats. We skip any elements that are // out of flow (like floating/positioned elements), and we also skip over any objects that may have shifted // to avoid floats. diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.cpp index 76b8b86..de902e0 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.cpp @@ -225,6 +225,19 @@ FloatRect RenderSVGText::repaintRectInLocalCoordinates() const return repaintRect; } +// Fix for . We should not render :first-line CSS Style +// in a SVG text element context. +RenderBlock* RenderSVGText::firstLineBlock() const +{ + return 0; +} + +// Fix for . We should not render :first-letter CSS Style +// in a SVG text element context. +void RenderSVGText::updateFirstLetter() +{ +} + } #endif // ENABLE(SVG) diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.h b/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.h index ab4b09b..f09e396 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderSVGText.h @@ -72,6 +72,9 @@ private: virtual RootInlineBox* createRootInlineBox(); + virtual RenderBlock* firstLineBlock() const; + virtual void updateFirstLetter(); + AffineTransform m_localTransform; }; diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp index 561bead..251a65d 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp @@ -27,6 +27,7 @@ #include "AnimationController.h" #include "GraphicsContext.h" #include "HitTestResult.h" +#include "RenderCounter.h" #include "RenderView.h" #include "RenderWidgetProtector.h" @@ -114,6 +115,9 @@ void RenderWidget::destroy() if (RenderView* v = view()) v->removeWidget(this); + if (m_hasCounterNodeMap) + RenderCounter::destroyCounterNodes(this); + if (AXObjectCache::accessibilityEnabled()) { document()->axObjectCache()->childrenChanged(this->parent()); document()->axObjectCache()->remove(this); diff --git a/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp index 41bbba4..974bf2a 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGElement.cpp @@ -304,6 +304,15 @@ void SVGElement::attributeChanged(Attribute* attr, bool preserveDecls) return; StyledElement::attributeChanged(attr, preserveDecls); + + // When an animated SVG property changes through SVG DOM, svgAttributeChanged() is called, not attributeChanged(). + // Next time someone tries to access the XML attributes, the synchronization code starts. During that synchronization + // SVGAnimatedPropertySynchronizer may call NamedNodeMap::removeAttribute(), which in turn calls attributeChanged(). + // At this point we're not allowed to call svgAttributeChanged() again - it may lead to extra work being done, or crashes + // see bug https://bugs.webkit.org/show_bug.cgi?id=40994. + if (m_synchronizingSVGAttributes) + return; + svgAttributeChanged(attr->name()); } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGFontFaceElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGFontFaceElement.cpp index 25b3aea..de646c6 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGFontFaceElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGFontFaceElement.cpp @@ -59,7 +59,6 @@ SVGFontFaceElement::SVGFontFaceElement(const QualifiedName& tagName, Document* d SVGFontFaceElement::~SVGFontFaceElement() { - removeFromMappedElementSheet(); } static int cssPropertyIdForSVGAttributeName(const QualifiedName& attrName) diff --git a/src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.cpp index d28e2a4..e7b5389 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.cpp @@ -125,6 +125,10 @@ RenderObject* SVGForeignObjectElement::createRenderer(RenderArena* arena, Render bool SVGForeignObjectElement::childShouldCreateRenderer(Node* child) const { + // Disallow arbitary SVG content. Only allow proper subdocuments. + if (child->isSVGElement()) + return child->hasTagName(SVGNames::svgTag); + // Skip over SVG rules which disallow non-SVG kids return StyledElement::childShouldCreateRenderer(child); } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp index 4c06008..5237715 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp @@ -538,6 +538,10 @@ bool SVGSVGElement::isOutermostSVG() const if (!parentNode()) return true; + // We act like an outermost SVG element, if we're a direct child of a element. + if (parentNode()->hasTagName(SVGNames::foreignObjectTag)) + return true; + // This is true whenever this is the outermost SVG, even if there are HTML elements outside it return !parentNode()->isSVGElement(); } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp index 45bab6a..57d56e1 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp @@ -572,8 +572,8 @@ void SVGUseElement::attach() void SVGUseElement::detach() { - SVGStyledTransformableElement::detach(); m_targetElementInstance = 0; + SVGStyledTransformableElement::detach(); } static bool isDirectReference(Node* n) -- cgit v0.12 From efa23362ede82f43b24107423a2cd7c169db3e39 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 29 Jul 2010 22:10:31 +0200 Subject: add license header --- tools/qml/startup/startup.qml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tools/qml/startup/startup.qml b/tools/qml/startup/startup.qml index 6792150..be67598 100644 --- a/tools/qml/startup/startup.qml +++ b/tools/qml/startup/startup.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + import Qt 4.7 Rectangle { -- cgit v0.12 From 597a842d66dc04181bfd063863216acbb11ce3bc Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 30 Jul 2010 08:17:21 +1000 Subject: Fix crash on Desktop platforms. Missing check for null networkSession. Task-number: QTBUG-12501 --- examples/network/fortuneserver/server.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/examples/network/fortuneserver/server.cpp b/examples/network/fortuneserver/server.cpp index b931b96..4dca38c 100644 --- a/examples/network/fortuneserver/server.cpp +++ b/examples/network/fortuneserver/server.cpp @@ -107,17 +107,19 @@ Server::Server(QWidget *parent) void Server::sessionOpened() { // Save the used configuration - QNetworkConfiguration config = networkSession->configuration(); - QString id; - if (config.type() == QNetworkConfiguration::UserChoice) - id = networkSession->sessionProperty(QLatin1String("UserChoiceConfiguration")).toString(); - else - id = config.identifier(); - - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - settings.beginGroup(QLatin1String("QtNetwork")); - settings.setValue(QLatin1String("DefaultNetworkConfiguration"), id); - settings.endGroup(); + if (networkSession) { + QNetworkConfiguration config = networkSession->configuration(); + QString id; + if (config.type() == QNetworkConfiguration::UserChoice) + id = networkSession->sessionProperty(QLatin1String("UserChoiceConfiguration")).toString(); + else + id = config.identifier(); + + QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); + settings.beginGroup(QLatin1String("QtNetwork")); + settings.setValue(QLatin1String("DefaultNetworkConfiguration"), id); + settings.endGroup(); + } //! [0] //! [1] tcpServer = new QTcpServer(this); -- cgit v0.12 From eef2e72976f3f8d10a34c9dfb3f60f40616f4df9 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 30 Jul 2010 12:59:56 +1000 Subject: Update QML Documents example Task-number: QTBUG-12526 --- doc/src/declarative/pics/anatomy-component.png | Bin 16117 -> 4902 bytes doc/src/declarative/qdeclarativedocument.qdoc | 58 ++++++++++++---------- doc/src/snippets/declarative/qmldocuments.qml | 66 +++++++++++++++++++++++++ 3 files changed, 98 insertions(+), 26 deletions(-) create mode 100644 doc/src/snippets/declarative/qmldocuments.qml diff --git a/doc/src/declarative/pics/anatomy-component.png b/doc/src/declarative/pics/anatomy-component.png index 70ed983..6125b00 100644 Binary files a/doc/src/declarative/pics/anatomy-component.png and b/doc/src/declarative/pics/anatomy-component.png differ diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc index a2ed205..f12e547 100644 --- a/doc/src/declarative/qdeclarativedocument.qdoc +++ b/doc/src/declarative/qdeclarativedocument.qdoc @@ -73,51 +73,57 @@ document - such as \c Rectangle and \c ListView - including those made within an import statements. QML does not import any modules by default, so at least one \c import statement must be present or no elements will be available! + +\section1 Documents as Component Definitions + A QML document defines a single, top-level \l {QDeclarativeComponent}{QML component}. A QML component is a template that is interpreted by the QML runtime to create an object with some predefined behaviour. As it is a template, a single QML component can be "run" multiple times to produce several objects, each of which are said to be \e instances of the component. Once created, instances are not dependent on the component that created them, so they can -operate on independent data. Here is an example of a simple "Button" component that is -instantiated four times, each with a different value for its \c text property. +operate on independent data. Here is an example of a simple "Button" component (defined +in a \c Button.qml file) that is instantiated four times by \c application.qml. +Each instance is created with a different value for its \c text property: -\raw HTML -
-\endraw -\code +\table +\row +\o Button.qml +\o application.qml + +\row +\o \snippet doc/src/snippets/declarative/qmldocuments.qml 0 +\o +\qml import Qt 4.7 -BorderImage { - property alias text: textElement.text - width: 100; height: 30; source: "images/toolbutton.sci" - - Text { - id: textElement - anchors.centerIn: parent - font.pointSize: 20 - style: Text.Raised - color: "white" - } +Column { + spacing: 10 + + Button { text: "Apple" } + Button { text: "Orange" } + Button { text: "Pear" } + Button { text: "Grape" } } -\endcode -\raw HTML - -\endraw +\endqml + \image anatomy-component.png -\raw HTML -
-\endraw + +\endtable Any snippet of QML code can become a component, just by placing it in the file ".qml" -where is the new element name, and begins with an uppercase letter. Note that +where is the new element name, and begins with an \bold uppercase letter. Note that the case of all characters in the are significant on some filesystems, notably UNIX filesystems. It is recommended that the case of the filename matches the case of the component name in QML exactly, regardless of the platform the QML will be deployed to. -These QML files automatically become available as new QML element types +These QML component files automatically become available as new QML element types to other QML components and applications in the same directory. + + +\section1 Inline Components + In addition to the top-level component that all QML documents define, and any reusable components placed in separate files, documents may also include \e inline components. Inline components are declared using the diff --git a/doc/src/snippets/declarative/qmldocuments.qml b/doc/src/snippets/declarative/qmldocuments.qml new file mode 100644 index 0000000..c19a658 --- /dev/null +++ b/doc/src/snippets/declarative/qmldocuments.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Rectangle { + property alias text: textItem.text + + width: 100; height: 30 + border.width: 1 + radius: 5 + smooth: true + + gradient: Gradient { + GradientStop { position: 0.0; color: "darkGray" } + GradientStop { position: 0.5; color: "black" } + GradientStop { position: 1.0; color: "darkGray" } + } + + Text { + id: textItem + anchors.centerIn: parent + font.pointSize: 20 + color: "white" + } + +} +//![0] -- cgit v0.12 From 765c263d538b258f223dfb6bd7f62dbd19853db6 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 30 Jul 2010 13:01:23 +1000 Subject: Mention scope of id uniqueness Task-number: QTBUG-12528 --- doc/src/declarative/qdeclarativedocument.qdoc | 4 ++++ doc/src/declarative/qdeclarativeintro.qdoc | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc index f12e547..068297a 100644 --- a/doc/src/declarative/qdeclarativedocument.qdoc +++ b/doc/src/declarative/qdeclarativedocument.qdoc @@ -73,6 +73,10 @@ document - such as \c Rectangle and \c ListView - including those made within an import statements. QML does not import any modules by default, so at least one \c import statement must be present or no elements will be available! +Each \c id value in a QML document must be unique within that document. They +do not need to be unique across different documents as id values are +resolved according to the document scope. + \section1 Documents as Component Definitions diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc index 75055d8..fa42f59 100644 --- a/doc/src/declarative/qdeclarativeintro.qdoc +++ b/doc/src/declarative/qdeclarativeintro.qdoc @@ -87,6 +87,10 @@ Rectangle { width: 100; height: 100 } When multiple property/value pairs are specified on a single line, they must be separated by a semicolon. +The \c import statement imports the \c Qt \l{QML Modules}{module}, which contains all of the +standard \l {QML Elements}. Without this import statement, the \l Rectangle +and \l Image elements would not be available. + \section1 Expressions In addition to assigning values to properties, you can also assign @@ -181,7 +185,8 @@ Item { \section3 The \c id property -Each object can be given a special unique property called an \e id. Assigning an id enables the object +Each object can be given a special unique property called an \e id. No other object within the +same \l{QML Documents}{QML document} can have the same \c id value. Assigning an id enables the object to be referred to by other objects and scripts. The first Rectangle element below has an \e id, "myRect". The second Rectange element defines its -- cgit v0.12 From ca61cd321b867d912bd13b0530fbf2847d1c593c Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 30 Jul 2010 15:34:15 +1000 Subject: Add missing image Task-number: QTBUG-12529 --- doc/src/images/qml-pathview-example.png | Bin 0 -> 22077 bytes src/declarative/graphicsitems/qdeclarativepathview.cpp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 doc/src/images/qml-pathview-example.png diff --git a/doc/src/images/qml-pathview-example.png b/doc/src/images/qml-pathview-example.png new file mode 100644 index 0000000..c874c5c Binary files /dev/null and b/doc/src/images/qml-pathview-example.png differ diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 5dcf1b7..06ac275 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -364,7 +364,7 @@ void QDeclarativePathViewPrivate::regenerate() to set \e {clip: true} in order to have the out of view items clipped nicely. - \sa Path + \sa Path, {declarative/modelviews/pathview}{PathView example} */ QDeclarativePathView::QDeclarativePathView(QDeclarativeItem *parent) -- cgit v0.12 From 7e8073b37a8a3e58d82b71934f085ec8143935eb Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 30 Jul 2010 08:40:39 +0200 Subject: Fixed a broken def file entry. --- src/s60installs/bwins/QtGuiu.def | 2 +- src/s60installs/eabi/QtGuiu.def | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index b06cbba..53ec18c 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12372,7 +12372,7 @@ EXPORTS ?staticMetaObject@QBoxLayout@@2UQMetaObject@@B @ 12371 NONAME ; struct QMetaObject const QBoxLayout::staticMetaObject ?qt_tab_all_widgets@@3_NA @ 12372 NONAME ; bool qt_tab_all_widgets ?staticMetaObject@QSpinBox@@2UQMetaObject@@B @ 12373 NONAME ; struct QMetaObject const QSpinBox::staticMetaObject - ?scanCodeCache@QApplicationPrivate@@0V?$QHash@HI@@A @ 12374 NONAME ; class QHash QApplicationPrivate::scanCodeCache + ?scanCodeCache@QApplicationPrivate@@0V?$QHash@HI@@A @ 12374 NONAME ABSENT ; class QHash QApplicationPrivate::scanCodeCache ?staticMetaObject@QItemSelectionModel@@2UQMetaObject@@B @ 12375 NONAME ; struct QMetaObject const QItemSelectionModel::staticMetaObject ?staticMetaObject@QItemDelegate@@2UQMetaObject@@B @ 12376 NONAME ; struct QMetaObject const QItemDelegate::staticMetaObject ?staticMetaObject@QPushButton@@2UQMetaObject@@B @ 12377 NONAME ; struct QMetaObject const QPushButton::staticMetaObject diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 8c11002..559c896 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -4294,7 +4294,7 @@ EXPORTS _ZN19QApplicationPrivate13animate_comboE @ 4293 NONAME DATA 1 _ZN19QApplicationPrivate13mouse_buttonsE @ 4294 NONAME DATA 4 _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent @ 4295 NONAME - _ZN19QApplicationPrivate13scanCodeCacheE @ 4296 NONAME DATA 4 + _ZN19QApplicationPrivate13scanCodeCacheE @ 4296 NONAME DATA 4 ABSENT _ZN19QApplicationPrivate13setSystemFontERK5QFont @ 4297 NONAME _ZN19QApplicationPrivate13styleOverrideE @ 4298 NONAME DATA 4 _ZN19QApplicationPrivate14autoSipEnabledE @ 4299 NONAME DATA 1 -- cgit v0.12 From fb47a99e1d0020e8dcc4cc4f9c188ccd2fd5ee3e Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Fri, 30 Jul 2010 13:00:34 +0200 Subject: QFileDialog crashes when empty selectedFilter is set on Carbon. We were making the wrong assumption that the selectedFilter string will be valid always, when calling functions like getSaveFileName(). Task-number: QTBUG-12461 Reviewed-by: Denis --- src/gui/dialogs/qfiledialog_mac.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index f1afaa9..64fc0ee 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -782,9 +782,11 @@ void QFileDialogPrivate::qt_mac_filedialog_event_proc(const NavEventCallbackMess const QtMacFilterName &fn = fileDialogPrivate->filterInfo.filters.at( fileDialogPrivate->filterInfo.currentSelection); QStringList reg = fn.regexp.split(QLatin1String(";"), QString::SkipEmptyParts); - QString r = reg.first(); - r = r.right(r.length()-1); // Strip the * - base += r; //"." + QString::number(s->menuType); + if (reg.count()) { + QString r = reg.first(); + r = r.right(r.length()-1); // Strip the * + base += r; //"." + QString::number(s->menuType); + } NavDialogSetSaveFileName(p->context, QCFString::toCFStringRef(base)); } #ifdef DEBUG_FILEDIALOG_FILTERS -- cgit v0.12 From 07e74a963dbd2bf597dbea231d7b2cefba05fde2 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 30 Jul 2010 14:48:28 +0200 Subject: Fixed the incorrect diagram for bug QTBUG-12385. --- .../addressbook-tutorial-part1-labeled-layout.png | Bin 20739 -> 19114 bytes ...ddressbook-tutorial-part1-labeled-screenshot.png | Bin 26594 -> 23223 bytes .../addressbook-tutorial-part1-screenshot.png | Bin 7180 -> 9872 bytes .../addressbook-tutorial-part2-add-contact.png | Bin 10255 -> 12936 bytes .../addressbook-tutorial-part2-add-successful.png | Bin 8089 -> 10825 bytes .../addressbook-tutorial-part2-labeled-layout.png | Bin 31947 -> 27103 bytes .../addressbook-tutorial-part3-labeled-layout.png | Bin 39500 -> 27467 bytes .../addressbook-tutorial-part3-screenshot.png | Bin 10460 -> 14041 bytes .../images/addressbook-tutorial-part4-remove.png | Bin 13860 -> 22248 bytes .../addressbook-tutorial-part5-finddialog.png | Bin 6982 -> 10046 bytes .../images/addressbook-tutorial-part5-notfound.png | Bin 8177 -> 10789 bytes .../addressbook-tutorial-part5-screenshot.png | Bin 12557 -> 15849 bytes doc/src/images/addressbook-tutorial-part6-load.png | Bin 40623 -> 24797 bytes doc/src/images/addressbook-tutorial-part6-save.png | Bin 40406 -> 24747 bytes .../addressbook-tutorial-part6-screenshot.png | Bin 13598 -> 16819 bytes .../addressbook-tutorial-part7-screenshot.png | Bin 14822 -> 18369 bytes doc/src/images/addressbook-tutorial-screenshot.png | Bin 11916 -> 15275 bytes doc/src/images/addressbook-tutorial.png | Bin 11481 -> 6200 bytes 18 files changed, 0 insertions(+), 0 deletions(-) diff --git a/doc/src/images/addressbook-tutorial-part1-labeled-layout.png b/doc/src/images/addressbook-tutorial-part1-labeled-layout.png index ef514c8..b19cb36 100644 Binary files a/doc/src/images/addressbook-tutorial-part1-labeled-layout.png and b/doc/src/images/addressbook-tutorial-part1-labeled-layout.png differ diff --git a/doc/src/images/addressbook-tutorial-part1-labeled-screenshot.png b/doc/src/images/addressbook-tutorial-part1-labeled-screenshot.png index 4381079..f9b91ee 100644 Binary files a/doc/src/images/addressbook-tutorial-part1-labeled-screenshot.png and b/doc/src/images/addressbook-tutorial-part1-labeled-screenshot.png differ diff --git a/doc/src/images/addressbook-tutorial-part1-screenshot.png b/doc/src/images/addressbook-tutorial-part1-screenshot.png index cf15627..454b095 100644 Binary files a/doc/src/images/addressbook-tutorial-part1-screenshot.png and b/doc/src/images/addressbook-tutorial-part1-screenshot.png differ diff --git a/doc/src/images/addressbook-tutorial-part2-add-contact.png b/doc/src/images/addressbook-tutorial-part2-add-contact.png index 330858d..6f2b947 100644 Binary files a/doc/src/images/addressbook-tutorial-part2-add-contact.png and b/doc/src/images/addressbook-tutorial-part2-add-contact.png differ diff --git a/doc/src/images/addressbook-tutorial-part2-add-successful.png b/doc/src/images/addressbook-tutorial-part2-add-successful.png index 3b108fb..99a2154 100644 Binary files a/doc/src/images/addressbook-tutorial-part2-add-successful.png and b/doc/src/images/addressbook-tutorial-part2-add-successful.png differ diff --git a/doc/src/images/addressbook-tutorial-part2-labeled-layout.png b/doc/src/images/addressbook-tutorial-part2-labeled-layout.png index 73f6dfb..1e000c8 100644 Binary files a/doc/src/images/addressbook-tutorial-part2-labeled-layout.png and b/doc/src/images/addressbook-tutorial-part2-labeled-layout.png differ diff --git a/doc/src/images/addressbook-tutorial-part3-labeled-layout.png b/doc/src/images/addressbook-tutorial-part3-labeled-layout.png index 662fa7f..1981ba8 100644 Binary files a/doc/src/images/addressbook-tutorial-part3-labeled-layout.png and b/doc/src/images/addressbook-tutorial-part3-labeled-layout.png differ diff --git a/doc/src/images/addressbook-tutorial-part3-screenshot.png b/doc/src/images/addressbook-tutorial-part3-screenshot.png index 97d1357..75159b4 100644 Binary files a/doc/src/images/addressbook-tutorial-part3-screenshot.png and b/doc/src/images/addressbook-tutorial-part3-screenshot.png differ diff --git a/doc/src/images/addressbook-tutorial-part4-remove.png b/doc/src/images/addressbook-tutorial-part4-remove.png index 42b0f92..8eb259e 100644 Binary files a/doc/src/images/addressbook-tutorial-part4-remove.png and b/doc/src/images/addressbook-tutorial-part4-remove.png differ diff --git a/doc/src/images/addressbook-tutorial-part5-finddialog.png b/doc/src/images/addressbook-tutorial-part5-finddialog.png index 18e5451..743d92e 100644 Binary files a/doc/src/images/addressbook-tutorial-part5-finddialog.png and b/doc/src/images/addressbook-tutorial-part5-finddialog.png differ diff --git a/doc/src/images/addressbook-tutorial-part5-notfound.png b/doc/src/images/addressbook-tutorial-part5-notfound.png index be7172e..2d35766 100644 Binary files a/doc/src/images/addressbook-tutorial-part5-notfound.png and b/doc/src/images/addressbook-tutorial-part5-notfound.png differ diff --git a/doc/src/images/addressbook-tutorial-part5-screenshot.png b/doc/src/images/addressbook-tutorial-part5-screenshot.png index ea4a66c..3abe277 100644 Binary files a/doc/src/images/addressbook-tutorial-part5-screenshot.png and b/doc/src/images/addressbook-tutorial-part5-screenshot.png differ diff --git a/doc/src/images/addressbook-tutorial-part6-load.png b/doc/src/images/addressbook-tutorial-part6-load.png index 95fdcaf..a027a1d 100644 Binary files a/doc/src/images/addressbook-tutorial-part6-load.png and b/doc/src/images/addressbook-tutorial-part6-load.png differ diff --git a/doc/src/images/addressbook-tutorial-part6-save.png b/doc/src/images/addressbook-tutorial-part6-save.png index c0deb70..757feeb 100644 Binary files a/doc/src/images/addressbook-tutorial-part6-save.png and b/doc/src/images/addressbook-tutorial-part6-save.png differ diff --git a/doc/src/images/addressbook-tutorial-part6-screenshot.png b/doc/src/images/addressbook-tutorial-part6-screenshot.png index f77bf03..7bb2f74 100644 Binary files a/doc/src/images/addressbook-tutorial-part6-screenshot.png and b/doc/src/images/addressbook-tutorial-part6-screenshot.png differ diff --git a/doc/src/images/addressbook-tutorial-part7-screenshot.png b/doc/src/images/addressbook-tutorial-part7-screenshot.png index d6b0a50..3e7b3ca 100644 Binary files a/doc/src/images/addressbook-tutorial-part7-screenshot.png and b/doc/src/images/addressbook-tutorial-part7-screenshot.png differ diff --git a/doc/src/images/addressbook-tutorial-screenshot.png b/doc/src/images/addressbook-tutorial-screenshot.png index d6727dc..3fba6e8 100644 Binary files a/doc/src/images/addressbook-tutorial-screenshot.png and b/doc/src/images/addressbook-tutorial-screenshot.png differ diff --git a/doc/src/images/addressbook-tutorial.png b/doc/src/images/addressbook-tutorial.png index 495edda..f80b42d 100644 Binary files a/doc/src/images/addressbook-tutorial.png and b/doc/src/images/addressbook-tutorial.png differ -- cgit v0.12