From 550d1d75740cda5be718b7ab36bb517ebb190439 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 15 Nov 2011 13:08:12 +0200 Subject: Fix alignment of non-wrapped richtext QML Text elements. QTextDocument needs to know the actual control width rather than the text width to be able to align the text to the control. Task-number: ou1cimx1#934687 Reviewed-by: Joona Petrell --- src/declarative/graphicsitems/qdeclarativetext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 20e4eef..684dc5a 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -289,7 +289,7 @@ void QDeclarativeTextPrivate::updateSize() doc->setTextWidth(-1); naturalWidth = doc->idealWidth(); } - if (wrapMode != QDeclarativeText::NoWrap && q->widthValid()) + if (q->widthValid()) doc->setTextWidth(q->width()); else doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) -- cgit v0.12 From 574464cd7e2940f2dadc4d556e24b944cf222f3d Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 9 Nov 2011 18:50:50 +0000 Subject: fix bearer crash Handle could be closed too early in some situations causing a panic. Reviewed-By: mread --- src/plugins/bearer/symbian/qnetworksession_impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index a7dad2b..f5f71cf 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -97,7 +97,6 @@ void QNetworkSessionPrivateImpl::closeHandles() QSymbianSocketManager::instance().setDefaultConnection(0); - iConnectionMonitor.Close(); #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - handles closed"; @@ -111,6 +110,7 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl() isOpening = false; closeHandles(); + iConnectionMonitor.Close(); #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - destroyed"; -- cgit v0.12 From 52a93f068d2869fbe4e4deae2ed704d683e12834 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Fri, 18 Nov 2011 12:07:08 +0000 Subject: Export QtGui functions required by QtMultimediaKit backend In order for video rendering to work, the Symbian QtMultimediaKit backend needs access to QtGui functionality which is not exposed via public interfaces, namely: * QSymbianControl::setIgnoreFocusChanged(bool) * Setting custom painting modes, which control how content is blitted from the backing store into the native window surface * Requesting notification when Qt drawing starts and stops, so that the backend can ensure this does not interfere with video rendering. Until now, this has been achieved by the backend including private QtGui headers. If these headers are not present in the environment in which QtMobility is compiled, a warning is printed, telling the user that video / viewfinder rendering will not work correctly when the resulting binaries are installed. This patch adds a Symbian-specific public interface to QtGui, which exports the functionality above. Task-number: MOBILITY-747 Reviewed-by: mread --- src/gui/painting/painting.pri | 6 +- src/gui/painting/qgraphicssystemhelper_symbian.cpp | 141 +++++++++++++++++++++ src/gui/painting/qgraphicssystemhelper_symbian.h | 82 ++++++++++++ 3 files changed, 227 insertions(+), 2 deletions(-) create mode 100644 src/gui/painting/qgraphicssystemhelper_symbian.cpp create mode 100644 src/gui/painting/qgraphicssystemhelper_symbian.h diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 27b1bf2..d4f904b 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -200,10 +200,12 @@ symbian { SOURCES += \ painting/qpaintengine_raster_symbian.cpp \ painting/qregion_s60.cpp \ - painting/qcolormap_s60.cpp + painting/qcolormap_s60.cpp \ + painting/qgraphicssystemhelper_symbian.cpp HEADERS += \ - painting/qpaintengine_raster_symbian_p.h + painting/qpaintengine_raster_symbian_p.h \ + painting/qgraphicssystemhelper_symbian.h } x11|embedded|qpa { diff --git a/src/gui/painting/qgraphicssystemhelper_symbian.cpp b/src/gui/painting/qgraphicssystemhelper_symbian.cpp new file mode 100644 index 0000000..eb70247 --- /dev/null +++ b/src/gui/painting/qgraphicssystemhelper_symbian.cpp @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystemhelper_symbian.h" +#include "qt_s60_p.h" +#include "qwidget_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \enum QSymbianGraphicsSystemHelper::NativePaintMode + + This enum controls the way in which QWidget paints content from the Qt + backing store into the corresponding native window surface. + + \value NativePaintModeDefault Default painting behaviour. + \value NativePaintModeZeroFill Ignore contents of backing store, and + fill the window surface region with zeroes. + \value NativePaintModeWriteAlpha By default, alpha values are only copied + from the backing store into the window surface if the top-level widget + has the Qt::WA_TranslucentBackground attribute. If this mode is set, + alpha values are copied regardless of the value of that attribute. + \value NativePaintModeDisable Do not paint anything into the native window + surface. + */ + +/*! + \class QSymbianGraphicsSystemHelper + \ingroup painting + + \brief QSymbianGraphicsSystemHelper defines functions required by + QtMultimediaKit in order to enable video rendering. + + This class is not intended for use by applications. +*/ + +/*! + Specify whether native focus change events should be ignored by the widget. +*/ + +void QSymbianGraphicsSystemHelper::setIgnoreFocusChanged(QWidget *widget, bool value) +{ + static_cast(widget->winId())->setIgnoreFocusChanged(value); +} + +/*! + Set the native paint mode to the specified \a mode. +*/ + +void QSymbianGraphicsSystemHelper::setNativePaintMode(QWidget *widget, NativePaintMode mode) +{ + QWidgetPrivate *widgetPrivate = qt_widget_private(widget->window()); + widgetPrivate->createExtra(); + QWExtra::NativePaintMode widgetMode = QWExtra::Default; + switch (mode) { + case NativePaintModeDefault: + break; + case NativePaintModeZeroFill: + widgetMode = QWExtra::ZeroFill; + break; + case NativePaintModeWriteAlpha: + widgetMode = QWExtra::BlitWriteAlpha; + break; + case NativePaintModeDisable: + widgetMode = QWExtra::Disable; + break; + } + widgetPrivate->extraData()->nativePaintMode = widgetMode; +} + +/*! + Set the native paint mode to the specified \a mode. +*/ + +void QSymbianGraphicsSystemHelper::setNativePaintMode(WId wid, NativePaintMode mode) +{ + QWidget *window = static_cast(wid)->widget()->window(); + setNativePaintMode(window, mode); +} + +/*! + Specify whether the widget should receive receive native paint events. + + If enabled, the QWidget::beginNativePaintEvent slot is called before + content from the backing store is written into the native window + surface, and QWidget::endNativePaintEvent is called once writing to + the native window surface is complete. + + This function is intended for use by QWidget clients such as video + widgets, which wish to use Direct Screen Access to write into the + native window surface. Such clients should stop their DSA session on + receipt of QWidget::beginNativePaintEvent, and re-start it on receipt of + QWidget::endNativePaintEvent. +*/ + +void QSymbianGraphicsSystemHelper::setReceiveNativePaintEvents(QWidget *widget, bool value) +{ + QWidgetPrivate *widgetPrivate = qt_widget_private(widget); + widgetPrivate->createExtra(); + widgetPrivate->extraData()->receiveNativePaintEvents = value; +} + +QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystemhelper_symbian.h b/src/gui/painting/qgraphicssystemhelper_symbian.h new file mode 100644 index 0000000..b74144e --- /dev/null +++ b/src/gui/painting/qgraphicssystemhelper_symbian.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSYMBIANGRAPHICSSYSTEMHELPER_H +#define QSYMBIANGRAPHICSSYSTEMHELPER_H + +#include + +#ifndef Q_OS_SYMBIAN +#error "This header file can only be included when building for Symbian" +#endif + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWidget; + +class Q_GUI_EXPORT QSymbianGraphicsSystemHelper +{ +public: + enum NativePaintMode { + NativePaintModeDefault, + NativePaintModeZeroFill, + NativePaintModeWriteAlpha, + NativePaintModeDisable + }; + + static void setIgnoreFocusChanged(QWidget *widget, bool value); + static void setNativePaintMode(QWidget *widget, NativePaintMode mode); + static void setNativePaintMode(WId wid, NativePaintMode mode); + static void setReceiveNativePaintEvents(QWidget *widget, bool value); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSYMBIANGRAPHICSSYSTEMHELPER_H + -- cgit v0.12 From bd5dfa8fd2f4d5dc4a1fe0984a53b966cff6470f Mon Sep 17 00:00:00 2001 From: mread Date: Fri, 18 Nov 2011 16:21:07 +0000 Subject: Surviving out of memory in Qt Quick app The QtQuickPlayground app contains a version of samegame which allow the user to edit the code. By setting the ball size to 8, the app can run out of memory. This leaves it in a pretty bad state. But apps on Symbian shouldn't crash due to OOM and should allow some operation. This change fixes the immediate OOM crashes in declarative, gui and corelib. It shows warning dialogs which explain what has gone wrong and leaves the app in a state that can be exited cleanly from the Symbian task list. Task-number: QT-5319 Reviewed-by: Shane Kearns Reviewed-by: Gareth Stockwell Reviewed-by: Martin Jones --- src/corelib/global/qglobal.cpp | 13 +- src/corelib/kernel/qeventdispatcher_symbian.cpp | 27 +++- src/corelib/kernel/qeventdispatcher_symbian_p.h | 4 + src/declarative/qml/qdeclarativecomponent.cpp | 102 +++++++------ src/declarative/qml/qdeclarativeengine.cpp | 4 +- src/declarative/qml/qpodvector_p.h | 4 +- src/gui/inputmethod/qcoefepinputcontext_p.h | 2 + src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 193 +++++++++++++----------- src/gui/kernel/qapplication_s60.cpp | 96 ++++++------ src/gui/painting/qgraphicssystemex_symbian.cpp | 2 +- 10 files changed, 253 insertions(+), 194 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 84d68e5..3675fc7 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2207,16 +2207,13 @@ void qt_message_output(QtMsgType msgType, const char *buf) OutputDebugString(reinterpret_cast (fstr.utf16())); #elif defined(Q_OS_SYMBIAN) // RDebug::Print has a cap of 256 characters so break it up - _LIT(format, "[Qt Message] %S"); - const int maxBlockSize = 256 - ((const TDesC &)format).Length(); + char format[] = "[Qt Message] %S"; + const int maxBlockSize = 256 - sizeof(format); const TPtrC8 ptr(reinterpret_cast(buf)); - HBufC* hbuffer = HBufC::New(qMin(maxBlockSize, ptr.Length())); - Q_CHECK_PTR(hbuffer); - for (int i = 0; i < ptr.Length(); i += hbuffer->Length()) { - hbuffer->Des().Copy(ptr.Mid(i, qMin(maxBlockSize, ptr.Length()-i))); - RDebug::Print(format, hbuffer); + for (int i = 0; i < ptr.Length(); i += maxBlockSize) { + TPtrC8 part(ptr.Mid(i, qMin(maxBlockSize, ptr.Length()-i))); + RDebug::Printf(format, &part); } - delete hbuffer; #else fprintf(stderr, "%s\n", buf); fflush(stderr); diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index ea466f5..da6f021 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -749,7 +749,7 @@ public: ObjectRun, ObjectDelayed }; - static RunResult RunMarkedIfReady(TInt &runPriority, TInt minimumPriority); + static RunResult RunMarkedIfReady(TInt &runPriority, TInt minimumPriority, QEventDispatcherSymbian *dispatcher); static bool UseRRActiveScheduler(); private: @@ -808,7 +808,7 @@ void QtRRActiveScheduler::MarkReadyToRun() } } -QtRRActiveScheduler::RunResult QtRRActiveScheduler::RunMarkedIfReady(TInt &runPriority, TInt minimumPriority) +QtRRActiveScheduler::RunResult QtRRActiveScheduler::RunMarkedIfReady(TInt &runPriority, TInt minimumPriority, QEventDispatcherSymbian *dispatcher) { RunResult result = NothingFound; TInt error=KErrNone; @@ -824,12 +824,12 @@ QtRRActiveScheduler::RunResult QtRRActiveScheduler::RunMarkedIfReady(TInt &runPr runPriority = active->Priority(); dataAccess->iStatus.iFlags&=~TRequestStatusAccess::ERequestActiveFlags; int vptr = *(int*)active; // vptr can be used to identify type when debugging leaves - TRAP(error, active->RunL()); + TRAP(error, QT_TRYCATCH_ERROR(error, active->RunL())); if (error!=KErrNone) error=active->RunError(error); if (error) { qWarning("Active object (ptr=0x%08x, vptr=0x%08x) leave: %i\n", active, vptr, error); - pS->Error(error); + dispatcher->activeObjectError(error); } return ObjectRun; } @@ -966,13 +966,15 @@ QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent) m_wakeUpDone(0), m_iterationCount(0), m_insideTimerEvent(false), - m_noSocketEvents(false) + m_noSocketEvents(false), + m_oomErrorCount(0) { #ifdef QT_SYMBIAN_PRIORITY_DROP m_delay = baseDelay; m_avgEventTime = 0; idleDetectorThread(); #endif + m_oomErrorTimer.start(); } QEventDispatcherSymbian::~QEventDispatcherSymbian() @@ -1098,7 +1100,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla // Standard or above priority AOs are scheduled round robin. // Lower priority AOs can only run if nothing higher priority has run. int runPriority = minPriority; - handledSymbianEvent = QtRRActiveScheduler::RunMarkedIfReady(runPriority, minPriority); + handledSymbianEvent = QtRRActiveScheduler::RunMarkedIfReady(runPriority, minPriority, this); minPriority = qMin(runPriority, int(CActive::EPriorityStandard)); } else { TInt error; @@ -1396,6 +1398,19 @@ QList QEventDispatcherSymbian::registeredTim return list; } +void QEventDispatcherSymbian::activeObjectError(int error) +{ + if (error == KErrNoMemory) { + // limit the number of reported out of memory errors, as the disappearance of the warning + // dialog can trigger further OOM errors causing a loop. + if (m_oomErrorTimer.restart() > 60000) // 1 minute + m_oomErrorCount = 0; + if (m_oomErrorCount++ >= 5) + return; + } + CActiveScheduler::Current()->Error(error); +} + /* * This active scheduler class implements a simple report and continue policy, for Symbian OS leaves * or exceptions from Qt that fall back to the scheduler. diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 01f5ab1..869fe31 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -264,6 +264,8 @@ public: static void RequestComplete(TRequestStatus *&status, TInt reason); static void RequestComplete(RThread &threadHandle, TRequestStatus *&status, TInt reason); + void activeObjectError(int error); + private: bool sendPostedEvents(); bool sendDeferredSocketEvents(); @@ -294,6 +296,8 @@ private: int m_delay; int m_avgEventTime; QElapsedTimer m_lastIdleRequestTimer; + int m_oomErrorCount; + QElapsedTimer m_oomErrorTimer; }; #ifdef QT_DEBUG diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index f423f50..0d892a2 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -936,50 +936,37 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state) { if (state->completePending) { - - for (int ii = 0; ii < state->bindValues.count(); ++ii) { - QDeclarativeEnginePrivate::SimpleList bv = - state->bindValues.at(ii); - for (int jj = 0; jj < bv.count; ++jj) { - if(bv.at(jj)) { - // XXX akennedy - bv.at(jj)->m_mePtr = 0; - bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | - QDeclarativePropertyPrivate::DontRemoveBinding); + QT_TRY { + for (int ii = 0; ii < state->bindValues.count(); ++ii) { + QDeclarativeEnginePrivate::SimpleList bv = + state->bindValues.at(ii); + for (int jj = 0; jj < bv.count; ++jj) { + if(bv.at(jj)) { + // XXX akennedy + bv.at(jj)->m_mePtr = 0; + bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | + QDeclarativePropertyPrivate::DontRemoveBinding); + } } + QDeclarativeEnginePrivate::clear(bv); } - QDeclarativeEnginePrivate::clear(bv); - } - for (int ii = 0; ii < state->parserStatus.count(); ++ii) { - QDeclarativeEnginePrivate::SimpleList ps = - state->parserStatus.at(ii); + for (int ii = 0; ii < state->parserStatus.count(); ++ii) { + QDeclarativeEnginePrivate::SimpleList ps = + state->parserStatus.at(ii); - for (int jj = ps.count - 1; jj >= 0; --jj) { - QDeclarativeParserStatus *status = ps.at(jj); - if (status && status->d) { - status->d = 0; - status->componentComplete(); + for (int jj = ps.count - 1; jj >= 0; --jj) { + QDeclarativeParserStatus *status = ps.at(jj); + if (status && status->d) { + status->d = 0; + status->componentComplete(); + } } + QDeclarativeEnginePrivate::clear(ps); } - QDeclarativeEnginePrivate::clear(ps); - } - - for (int ii = 0; ii < state->finalizedParserStatus.count(); ++ii) { - QPair, int> status = state->finalizedParserStatus.at(ii); - QObject *obj = status.first; - if (obj) { - void *args[] = { 0 }; - QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, - status.second, args); - } - } - //componentComplete() can register additional finalization objects - //that are then never handled. Handle them manually here. - if (1 == enginePriv->inProgressCreations) { - for (int ii = 0; ii < enginePriv->finalizedParserStatus.count(); ++ii) { - QPair, int> status = enginePriv->finalizedParserStatus.at(ii); + for (int ii = 0; ii < state->finalizedParserStatus.count(); ++ii) { + QPair, int> status = state->finalizedParserStatus.at(ii); QObject *obj = status.first; if (obj) { void *args[] = { 0 }; @@ -987,17 +974,38 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri status.second, args); } } - enginePriv->finalizedParserStatus.clear(); - } - while (state->componentAttached) { - QDeclarativeComponentAttached *a = state->componentAttached; - a->rem(); - QDeclarativeData *d = QDeclarativeData::get(a->parent()); - Q_ASSERT(d); - Q_ASSERT(d->context); - a->add(&d->context->componentAttached); - emit a->completed(); + //componentComplete() can register additional finalization objects + //that are then never handled. Handle them manually here. + if (1 == enginePriv->inProgressCreations) { + for (int ii = 0; ii < enginePriv->finalizedParserStatus.count(); ++ii) { + QPair, int> status = enginePriv->finalizedParserStatus.at(ii); + QObject *obj = status.first; + if (obj) { + void *args[] = { 0 }; + QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, + status.second, args); + } + } + enginePriv->finalizedParserStatus.clear(); + } + + while (state->componentAttached) { + QDeclarativeComponentAttached *a = state->componentAttached; + a->rem(); + QDeclarativeData *d = QDeclarativeData::get(a->parent()); + Q_ASSERT(d); + Q_ASSERT(d->context); + a->add(&d->context->componentAttached); + emit a->completed(); + } + } QT_CATCH(const std::exception&) { + state->bindValues.clear(); + state->parserStatus.clear(); + state->finalizedParserStatus.clear(); + state->completePending = false; + enginePriv->inProgressCreations--; + QT_RETHROW; } state->bindValues.clear(); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 1417b78..89a9809 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1202,8 +1202,8 @@ void QDeclarativeData::setBindingBit(QObject *obj, int bit) int arraySize = (props + 31) / 32; int oldArraySize = bindingBitsSize / 32; - bindingBits = (quint32 *)realloc(bindingBits, - arraySize * sizeof(quint32)); + bindingBits = (quint32 *)q_check_ptr(realloc(bindingBits, + arraySize * sizeof(quint32))); memset(bindingBits + oldArraySize, 0x00, diff --git a/src/declarative/qml/qpodvector_p.h b/src/declarative/qml/qpodvector_p.h index 7b50463..a055d17 100644 --- a/src/declarative/qml/qpodvector_p.h +++ b/src/declarative/qml/qpodvector_p.h @@ -89,7 +89,7 @@ public: void insert(int idx, const T &v) { if (m_count == m_capacity) { m_capacity += Increment; - m_data = (T *)realloc(m_data, m_capacity * sizeof(T)); + m_data = (T *)q_check_ptr(realloc(m_data, m_capacity * sizeof(T))); } int moveCount = m_count - idx; if (moveCount) @@ -101,7 +101,7 @@ public: void reserve(int count) { if (count >= m_capacity) { m_capacity = (count + (Increment-1)) & (0xFFFFFFFF - Increment + 1); - m_data = (T *)realloc(m_data, m_capacity * sizeof(T)); + m_data = (T *)q_check_ptr(realloc(m_data, m_capacity * sizeof(T))); } } diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 90d47f9..b17d9c7 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -162,6 +162,8 @@ private: void enableSymbianCcpuSupport(); void changeCBA(bool showCopyAndOrPaste); void copyOrCutTextToClipboard(const char *operation); + void getScreenCoordinatesForFepX(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent, + TInt aDocumentPosition) const; //From MEikCcpuEditor interface public: diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index ed7411f..44e0df0 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -1465,40 +1465,49 @@ void QCoeFepInputContext::CancelFepInlineEdit() m_pendingTransactionCancel = true; - QList attributes; - QInputMethodEvent event(QLatin1String(""), attributes); - event.setCommitString(QLatin1String(""), 0, 0); - m_preeditString.clear(); - m_inlinePosition = 0; - sendEvent(event); - - // Sync with native side editor state. Native side can then do various operations - // based on editor state, such as removing 'exact word bubble'. - if (!m_pendingInputCapabilitiesChanged) - ReportAknEdStateEvent(MAknEdStateObserver::EAknSyncEdwinState); + QT_TRY { + QList attributes; + QInputMethodEvent event(QLatin1String(""), attributes); + event.setCommitString(QLatin1String(""), 0, 0); + m_preeditString.clear(); + m_inlinePosition = 0; + sendEvent(event); + + // Sync with native side editor state. Native side can then do various operations + // based on editor state, such as removing 'exact word bubble'. + if (!m_pendingInputCapabilitiesChanged) + ReportAknEdStateEvent(MAknEdStateObserver::EAknSyncEdwinState); + } QT_CATCH(const std::exception&) { + m_preeditString.clear(); + m_inlinePosition = 0; + } m_pendingTransactionCancel = false; } TInt QCoeFepInputContext::DocumentLengthForFep() const { - QWidget *w = focusWidget(); - if (!w) - return 0; + QT_TRY { + QWidget *w = focusWidget(); + if (!w) + return 0; - QVariant variant = w->inputMethodQuery(Qt::ImSurroundingText); + QVariant variant = w->inputMethodQuery(Qt::ImSurroundingText); - int size = variant.value().size() + m_preeditString.size(); + int size = variant.value().size() + m_preeditString.size(); - // To fix an issue with backspaces not being generated if document size is zero, - // fake document length to be at least one always, except when dealing with - // hidden text widgets, where this faking would generate extra asterisk. Since the - // primary use of hidden text widgets is password fields, they are unlikely to - // support multiple lines anyway. - if (size == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText)) - size = 1; + // To fix an issue with backspaces not being generated if document size is zero, + // fake document length to be at least one always, except when dealing with + // hidden text widgets, where this faking would generate extra asterisk. Since the + // primary use of hidden text widgets is password fields, they are unlikely to + // support multiple lines anyway. + if (size == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText)) + size = 1; - return size; + return size; + } QT_CATCH(const std::exception&) { + return 0; + } } TInt QCoeFepInputContext::DocumentMaximumLengthForFep() const @@ -1540,42 +1549,46 @@ void QCoeFepInputContext::SetCursorSelectionForFepL(const TCursorSelection& aCur void QCoeFepInputContext::GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const { - QWidget *w = focusWidget(); - if (!w) { - aCursorSelection.SetSelection(0,0); - return; - } + QT_TRY { + QWidget *w = focusWidget(); + if (!w) { + aCursorSelection.SetSelection(0,0); + return; + } - int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + m_preeditString.size(); - int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt() + m_preeditString.size(); + int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + m_preeditString.size(); + int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt() + m_preeditString.size(); - // If the position is stored, use that value, so that word replacement from proposed word - // lists are added to the correct position. - if (m_cachedCursorAndAnchorPosition != -1) { - cursor = m_cachedCursorAndAnchorPosition; - anchor = m_cachedCursorAndAnchorPosition; - } - QString text = w->inputMethodQuery(Qt::ImSurroundingText).value(); - int combinedSize = text.size() + m_preeditString.size(); - if (combinedSize < anchor || combinedSize < cursor) { - // ### TODO! FIXME! QTBUG-5050 - // This is a hack to prevent crashing in 4.6 with QLineEdits that use input masks. - // The root problem is that cursor position is relative to displayed text instead of the - // actual text we get. - // - // To properly fix this we would need to know the displayText of QLineEdits instead - // of just the text, which on itself should be a trivial change. The difficulties start - // when we need to commit the changes back to the QLineEdit, which would have to be somehow - // able to handle displayText, too. - // - // Until properly fixed, the cursor and anchor positions will not reflect correct positions - // for masked QLineEdits, unless all the masked positions are filled in order so that - // cursor position relative to the displayed text matches position relative to actual text. - aCursorSelection.iAnchorPos = combinedSize; - aCursorSelection.iCursorPos = combinedSize; - } else { - aCursorSelection.iAnchorPos = anchor; - aCursorSelection.iCursorPos = cursor; + // If the position is stored, use that value, so that word replacement from proposed word + // lists are added to the correct position. + if (m_cachedCursorAndAnchorPosition != -1) { + cursor = m_cachedCursorAndAnchorPosition; + anchor = m_cachedCursorAndAnchorPosition; + } + QString text = w->inputMethodQuery(Qt::ImSurroundingText).value(); + int combinedSize = text.size() + m_preeditString.size(); + if (combinedSize < anchor || combinedSize < cursor) { + // ### TODO! FIXME! QTBUG-5050 + // This is a hack to prevent crashing in 4.6 with QLineEdits that use input masks. + // The root problem is that cursor position is relative to displayed text instead of the + // actual text we get. + // + // To properly fix this we would need to know the displayText of QLineEdits instead + // of just the text, which on itself should be a trivial change. The difficulties start + // when we need to commit the changes back to the QLineEdit, which would have to be somehow + // able to handle displayText, too. + // + // Until properly fixed, the cursor and anchor positions will not reflect correct positions + // for masked QLineEdits, unless all the masked positions are filled in order so that + // cursor position relative to the displayed text matches position relative to actual text. + aCursorSelection.iAnchorPos = combinedSize; + aCursorSelection.iCursorPos = combinedSize; + } else { + aCursorSelection.iAnchorPos = anchor; + aCursorSelection.iCursorPos = cursor; + } + } QT_CATCH(const std::exception&) { + aCursorSelection.SetSelection(0,0); } } @@ -1618,6 +1631,12 @@ void QCoeFepInputContext::GetFormatForFep(TCharFormat& aFormat, TInt /* aDocumen } void QCoeFepInputContext::GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine, TInt& aHeight, + TInt& aAscent, TInt aDocumentPosition) const +{ + QT_TRYCATCH_LEAVING(getScreenCoordinatesForFepX(aLeftSideOfBaseLine, aHeight, aAscent, aDocumentPosition)); +} + +void QCoeFepInputContext::getScreenCoordinatesForFepX(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent, TInt /* aDocumentPosition */) const { QWidget *w = focusWidget(); @@ -1774,36 +1793,40 @@ TBool QCoeFepInputContext::CcpuIsFocused() const TBool QCoeFepInputContext::CcpuCanCut() const { - bool retval = false; - if (m_inDestruction) - return retval; - QWidget *w = focusWidget(); - QObject *focusObject = 0; - if (!w) { - w = m_lastFocusedEditor; - focusObject = m_lastFocusedObject; - } else { - w = getQWidgetFromQGraphicsView(w, &focusObject); - } - if (w) { - QRect microFocus = w->inputMethodQuery(Qt::ImMicroFocus).toRect(); - if (microFocus.isNull()) { - // For some reason, the editor does not have microfocus. Most probably, - // it is due to using native fullscreen editing mode with QML apps. - // Try accessing "selectedText" directly. - QObject *invokeTarget = w; - if (focusObject) - invokeTarget = focusObject; - - QString selectedText = invokeTarget->property("selectedText").toString(); - retval = !selectedText.isNull(); + QT_TRY { + bool retval = false; + if (m_inDestruction) + return retval; + QWidget *w = focusWidget(); + QObject *focusObject = 0; + if (!w) { + w = m_lastFocusedEditor; + focusObject = m_lastFocusedObject; } else { - int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); - int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt(); - retval = cursor != anchor; + w = getQWidgetFromQGraphicsView(w, &focusObject); } + if (w) { + QRect microFocus = w->inputMethodQuery(Qt::ImMicroFocus).toRect(); + if (microFocus.isNull()) { + // For some reason, the editor does not have microfocus. Most probably, + // it is due to using native fullscreen editing mode with QML apps. + // Try accessing "selectedText" directly. + QObject *invokeTarget = w; + if (focusObject) + invokeTarget = focusObject; + + QString selectedText = invokeTarget->property("selectedText").toString(); + retval = !selectedText.isNull(); + } else { + int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); + int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt(); + retval = cursor != anchor; + } + } + return retval; + } QT_CATCH(const std::exception&) { + return EFalse; } - return retval; } void QCoeFepInputContext::CcpuCutL() diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index fe239f5..bb84491 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1534,53 +1534,57 @@ bool QSymbianControl::hasFocusedAndVisibleChild(QWidget *parentWidget) void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) { - if (m_ignoreFocusChanged || (qwidget->windowType() & Qt::WindowType_Mask) == Qt::Desktop) - return; + QT_TRY { + if (m_ignoreFocusChanged || (qwidget->windowType() & Qt::WindowType_Mask) == Qt::Desktop) + return; #ifdef Q_WS_S60 - if (S60->splitViewLastWidget) - return; + if (S60->splitViewLastWidget) + return; #endif - // Popups never get focused, but still receive the FocusChanged when they are hidden. - if (QApplicationPrivate::popupWidgets != 0 - || (qwidget->windowType() & Qt::Popup) == Qt::Popup) - return; - - if (IsFocused() && IsVisible()) { - if (m_symbianPopupIsOpen) { - QWidget *fw = QApplication::focusWidget(); - if (fw) { - QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); - QCoreApplication::sendEvent(fw, &event); - } - m_symbianPopupIsOpen = false; - } + // Popups never get focused, but still receive the FocusChanged when they are hidden. + if (QApplicationPrivate::popupWidgets != 0 + || (qwidget->windowType() & Qt::Popup) == Qt::Popup) + return; - QApplication::setActiveWindow(qwidget->window()); - qwidget->d_func()->setWindowIcon_sys(true); - qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); -#ifdef Q_WS_S60 - if (qwidget->isWindow()) - S60->setRecursiveDecorationsVisibility(qwidget, qwidget->windowState()); -#endif - } else { - QWidget *parentWindow = qwidget->window(); - if (QApplication::activeWindow() == parentWindow && !hasFocusedAndVisibleChild(parentWindow)) { - if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { + if (IsFocused() && IsVisible()) { + if (m_symbianPopupIsOpen) { QWidget *fw = QApplication::focusWidget(); if (fw) { - QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); + QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); QCoreApplication::sendEvent(fw, &event); } - m_symbianPopupIsOpen = true; - return; + m_symbianPopupIsOpen = false; } - QApplication::setActiveWindow(0); + QApplication::setActiveWindow(qwidget->window()); + qwidget->d_func()->setWindowIcon_sys(true); + qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); +#ifdef Q_WS_S60 + if (qwidget->isWindow()) + S60->setRecursiveDecorationsVisibility(qwidget, qwidget->windowState()); +#endif + } else { + QWidget *parentWindow = qwidget->window(); + if (QApplication::activeWindow() == parentWindow && !hasFocusedAndVisibleChild(parentWindow)) { + if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { + QWidget *fw = QApplication::focusWidget(); + if (fw) { + QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); + QCoreApplication::sendEvent(fw, &event); + } + m_symbianPopupIsOpen = true; + return; + } + + QApplication::setActiveWindow(0); + } } + // else { We don't touch the active window unless we were explicitly activated or deactivated } + } QT_CATCH(const std::exception&) { + // ignore errors } - // else { We don't touch the active window unless we were explicitly activated or deactivated } } void QSymbianControl::handleClientAreaChange() @@ -2377,19 +2381,25 @@ int QApplication::symbianProcessEvent(const QSymbianEvent *event) QScopedLoopLevelCounter counter(d->threadData); - if (d->eventDispatcher->filterEvent(const_cast(event))) - return 1; + QT_TRY { + if (d->eventDispatcher->filterEvent(const_cast(event))) + return 1; + + QWidget *w = qApp ? qApp->focusWidget() : 0; + if (w) { + QInputContext *ic = w->inputContext(); + if (ic && ic->symbianFilterEvent(w, event)) + return 1; + } - QWidget *w = qApp ? qApp->focusWidget() : 0; - if (w) { - QInputContext *ic = w->inputContext(); - if (ic && ic->symbianFilterEvent(w, event)) + if (symbianEventFilter(event)) return 1; + } QT_CATCH(const std::exception& ex) { + // don't allow an exception to stop exit command handling + if (event->type() != QSymbianEvent::CommandEvent || event->command() != EEikCmdExit) + QT_RETHROW; } - if (symbianEventFilter(event)) - return 1; - switch (event->type()) { case QSymbianEvent::WindowServerEvent: return d->symbianProcessWsEvent(event); diff --git a/src/gui/painting/qgraphicssystemex_symbian.cpp b/src/gui/painting/qgraphicssystemex_symbian.cpp index 5a182ff..5bfd5a8 100644 --- a/src/gui/painting/qgraphicssystemex_symbian.cpp +++ b/src/gui/painting/qgraphicssystemex_symbian.cpp @@ -74,7 +74,7 @@ bool QSymbianGraphicsSystemEx::hasBCM2727() #if 1 // Hacky but fast ~0ms. const char* vendor = eglQueryString(display, EGL_VENDOR); - if (strstr(vendor, "Broadcom")) { + if (vendor && strstr(vendor, "Broadcom")) { const TUid KIvePropertyCat = {0x2726beef}; enum TIvePropertyChipType { EVCBCM2727B1 = 0x00000000, -- cgit v0.12 From 431bb1e39f2df69329607b96f7178aea42962318 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 22 Nov 2011 14:19:27 +0000 Subject: Symbian: don't merge native clipboard, overwrite. If copying text from a Qt application that has both plaintext and formatted text representations, then S60 applications only see the plaintext. If copying data from an S60 application, the Qt application can see the plaintext. However as this was merged with the existing clipboard contents in Qt, the formatted text was unchanged. Now, we clear the internal clipboard QMimeData before writing the contents of the symbian clipboard to it. This ensures stale data from a previous copy is not left behind. Task-Number: ou1cimx1#927246 Reviewed-By: mread --- src/gui/kernel/qclipboard_s60.cpp | 3 ++ tests/auto/qclipboard/tst_qclipboard.cpp | 64 +++++++++++++++++++++++++------- 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp index f5314bd..dc812fb 100644 --- a/src/gui/kernel/qclipboard_s60.cpp +++ b/src/gui/kernel/qclipboard_s60.cpp @@ -187,6 +187,7 @@ void readSymbianStoreLX(QMimeData* aData, CClipboard* clipboard) QString string = qt_TDesC2QString(buf); CleanupStack::PopAndDestroy(text); + aData->clear(); aData->setText(string); } @@ -196,6 +197,8 @@ void readFromStreamLX(QMimeData* aData,RReadStream& aStream) // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. TCardinality mimeTypeCount; aStream >> mimeTypeCount; + if (mimeTypeCount > 0) + aData->clear(); for (int i = 0; i< mimeTypeCount;i++) { // mime type diff --git a/tests/auto/qclipboard/tst_qclipboard.cpp b/tests/auto/qclipboard/tst_qclipboard.cpp index 94981cf..ea470e7 100644 --- a/tests/auto/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/qclipboard/tst_qclipboard.cpp @@ -73,6 +73,7 @@ private slots: #ifdef Q_OS_SYMBIAN void pasteCopySymbian(); void copyPasteSymbian(); + void copyCopyPasteSymbian(); #endif private: @@ -347,17 +348,17 @@ void tst_QClipboard::clearBeforeSetText() QCOMPARE(QApplication::clipboard()->text(), text); } +#ifdef Q_OS_SYMBIAN /* Test that text copied from qt application can be pasted with symbian clipboard */ -#ifdef Q_OS_SYMBIAN // ### This test case only makes sense in symbian void tst_QClipboard::pasteCopySymbian() { if (!nativeClipboardWorking()) QSKIP("Native clipboard not working in this setup", SkipAll); - const QString string("Test string symbian."); + const QString string("Test string qt->symbian."); QApplication::clipboard()->setText(string); const TInt KPlainTextBegin = 0; @@ -381,19 +382,9 @@ void tst_QClipboard::pasteCopySymbian() QCOMPARE(string, storeString); } -#endif -/* - Test that text copied to symbian clipboard - can be pasted to qt clipboard -*/ -#ifdef Q_OS_SYMBIAN -// ### This test case only makes sense in symbian -void tst_QClipboard::copyPasteSymbian() +static void nativeCopyHelper(const QString &string) { - if (!nativeClipboardWorking()) - QSKIP("Native clipboard not working in this setup", SkipAll); - const QString string("Test string symbian."); const TInt KPlainTextBegin = 0; RFs fs = qt_s60GetRFs(); @@ -412,8 +403,55 @@ void tst_QClipboard::copyPasteSymbian() (cb->StreamDictionary()).AssignL(KClipboardUidTypePlainText, symbianStId); cb->CommitL(); CleanupStack::PopAndDestroy(2, cb); +} + +/* + Test that text copied to symbian clipboard + can be pasted to qt clipboard +*/ +// ### This test case only makes sense in symbian +void tst_QClipboard::copyPasteSymbian() +{ + if (!nativeClipboardWorking()) + QSKIP("Native clipboard not working in this setup", SkipAll); + const QString string("Test string symbian->qt."); + + nativeCopyHelper(string); + + QCOMPARE(QApplication::clipboard()->text(), string); +} + +/* + Test that text copied to symbian clipboard + can be pasted to qt clipboard, even if Qt + clipboard already had copied formatted text +*/ +// ### This test case only makes sense in symbian +void tst_QClipboard::copyCopyPasteSymbian() +{ + if (!nativeClipboardWorking()) + QSKIP("Native clipboard not working in this setup", SkipAll); + + //first copy some mime data with text/html and text/plain representations + QMimeData *mimeData = new QMimeData; + const QString preCopy(QLatin1String("qt_symbian")); + mimeData->setText(preCopy); + mimeData->setHtml(preCopy); + QApplication::clipboard()->setMimeData(mimeData); + + //check both representations are pastable + QCOMPARE(QApplication::clipboard()->mimeData()->html(), preCopy); + QCOMPARE(QApplication::clipboard()->mimeData()->text(), preCopy); + + //native copy some plain text + const QString string("symbian_qt"); + nativeCopyHelper(string); + //check text/plain is pastable QCOMPARE(QApplication::clipboard()->text(), string); + QCOMPARE(QApplication::clipboard()->mimeData()->text(), string); + //check text/html is cleared + QVERIFY(QApplication::clipboard()->mimeData()->html().isEmpty()); } #endif -- cgit v0.12 From 9cc57e15c72576b7150223d179e6d66d4e06dd28 Mon Sep 17 00:00:00 2001 From: Pasi Pentikainen Date: Tue, 22 Nov 2011 17:08:48 +0200 Subject: Fix Linux-Symbian parallel cross-compilation configure step The qtconfig.flm is mostly rewritten to support parallel Raptor Linux-Symbian cross-compilation. Reviewed-by: Miikka Heikkinen Done-with: Samu Sillanpaa Task-number: QTBUG-14361 --- config.profiles/symbian/qtconfig.flm | 97 +++++++++++++++++++++++------------- 1 file changed, 63 insertions(+), 34 deletions(-) diff --git a/config.profiles/symbian/qtconfig.flm b/config.profiles/symbian/qtconfig.flm index 2689d03..07c2349 100644 --- a/config.profiles/symbian/qtconfig.flm +++ b/config.profiles/symbian/qtconfig.flm @@ -10,52 +10,76 @@ QT_ROOT:= ../.. TARGETDIR:=$(EPOCROOT)/$(INSTALLPATH) MKSPECDIR:=$(EPOCROOT)/$(INSTALLPATH)/qt -SOURCEDIR:=$(EXTENSION_ROOT)/$(QT_ROOT)/bin +TOOLSBINDIR:=$(EXTENSION_ROOT)/$(QT_ROOT)/bin TOOLSSRCDIR:=$(EXTENSION_ROOT)/$(QT_ROOT)/src/tools LANGUAGETOOLDIR:=$(EXTENSION_ROOT)/$(QT_ROOT)/tools/linguist CONFIGURE_APP:=configure$(DOTEXE) +BOOTSTRAP_LIB:=$(TOOLSSRCDIR)/bootstrap/libbootstrap.a $(call makepath,$(TARGETDIR)) +WHATTARGETS:= +CLEANTARGETS:= + ifneq ($(filter linux,$(HOSTPLATFORM)),) PLATFORM:=$(PLATFORM.LINUX) else PLATFORM:=$(PLATFORM.WIN32) endif -TARGET_TOOLS:=$(TARGETDIR)/qmake$(DOTEXE) $(TARGETDIR)/moc$(DOTEXE) $(TARGETDIR)/rcc$(DOTEXE) $(TARGETDIR)/uic$(DOTEXE) $(TARGETDIR)/lrelease$(DOTEXE) -QT_TOOLS:= $(TOOLSSRCDIR)/uic $(TOOLSSRCDIR)/moc $(TOOLSSRCDIR)/rcc $(LANGUAGETOOLDIR)/lrelease -SOURCE_TOOLS:=$(SOURCEDIR)/qmake$(DOTEXE) $(SOURCEDIR)/moc$(DOTEXE) $(SOURCEDIR)/rcc$(DOTEXE) $(SOURCEDIR)/uic$(DOTEXE) $(SOURCEDIR)/lrelease$(DOTEXE) +QT_TOOLS:=uic moc rcc -define QtConfiguration -ifneq ($(filter linux,$(HOSTPLATFORM)),) -$(TARGET_TOOLS): $(QT_TOOLS) -else -$(TARGET_TOOLS): $(SOURCEDIR)/qmake$(DOTEXE) -endif +# Build every tool with it's own target +define qt_tool + +TARGET:: $(TARGETDIR)/$1$(DOTEXE) + +WHATTARGETS:=$$(WHATTARGETS) $(TARGETDIR)/$1$(DOTEXE) $(TOOLSBINDIR)/$1$(DOTEXE) +CLEANTARGETS:=$$(CLEANTARGETS) $(TARGETDIR)/$1$(DOTEXE) $(TOOLSBINDIR)/$1$(DOTEXE) + +$(TARGETDIR)/$1$(DOTEXE): $(TOOLSBINDIR)/$1$(DOTEXE) $(call startrule,qtconf_deploy) \ - $(GNUCP) $(SOURCEDIR)/$$(notdir $$@) $$@ \ + $(GNUCP) $$^ $$@ \ $(call endrule,qtconf_deploy) ifneq ($(filter linux,$(HOSTPLATFORM)),) -$(QT_TOOLS): $(TOOLSSRCDIR)/bootstrap +# On linux, the tools are built separately +$(TOOLSBINDIR)/$1$(DOTEXE): $(BOOTSTRAP_LIB) $(call startrule,qtconf_tools_build) \ - cd $$@; \ - $(GNUMAKE38); \ - cd .. \ + cd $(TOOLSSRCDIR)/$1 && $(GNUMAKE38) \ $(call endrule,qtconf_tools_build) +else +# On windows, the tools are built by configure.exe (building of qmake) +$(TOOLSBINDIR)/$1$(DOTEXE): $(TARGETDIR)/qmake$(DOTEXE) +endif + +endef -$(TOOLSSRCDIR)/bootstrap:$(SOURCEDIR)/qmake$(DOTEXE) +define qt_bootstrap +$(BOOTSTRAP_LIB): $(TOOLSBINDIR)/qmake$(DOTEXE) $(call startrule,qtconf_bootstrap_build) \ - cd $(TOOLSSRCDIR)/bootstrap; \ - $(GNUMAKE38); \ - cd .. \ + cd $(TOOLSSRCDIR)/bootstrap && $(GNUMAKE38) && $(GNUTOUCH) $$@ \ $(call endrule,qtconf_bootstrap_build) -endif +CLEANTARGETS:=$$(CLEANTARGETS) $(BOOTSTRAP_LIB) +endef + + +define qt_qmake -$(SOURCEDIR)/qmake$(DOTEXE): $(EXTENSION_ROOT)/$(QT_ROOT)/$(CONFIGURE_APP) +TARGET:: $(TARGETDIR)/qmake$(DOTEXE) + +WHATTARGETS:=$$(WHATTARGETS) $(TARGETDIR)/qmake$(DOTEXE) $(TOOLSBINDIR)/qmake$(DOTEXE) +CLEANTARGETS:=$$(CLEANTARGETS) $(TARGETDIR)/qmake$(DOTEXE) $(TOOLSBINDIR)/qmake$(DOTEXE) + +$(TARGETDIR)/qmake$(DOTEXE): $(TOOLSBINDIR)/qmake$(DOTEXE) + $(call startrule,qmake_deploy) \ + $(GNUCP) $$^ $$@ \ + $(call endrule,qmake_deploy) + +$(TOOLSBINDIR)/qmake$(DOTEXE): $(EXTENSION_ROOT)/$(QT_ROOT)/$(CONFIGURE_APP) $(call startrule,qtconf) \ + $(GNUCHMOD) a+x $(EXTENSION_ROOT)/$(QT_ROOT)/$(CONFIGURE_APP) $(EXTENSION_ROOT)/$(QT_ROOT)/config.tests/unix/* && \ cd $(EXTENSION_ROOT)/$(QT_ROOT) && unset INCLUDE && unset LIB && $(EXTENSION_ROOT)/$(QT_ROOT)/$(CONFIGURE_APP) -platform $(PLATFORM) -xplatform $(XPLATFORM) $(OPTIONS) \ $(call endrule,qtconf) $(call startrule,headerexport) \ @@ -91,25 +115,30 @@ WHAT:: ); \ echo "$(call whatLogClose)" \ $(call endrawoutput) -endef + +endef + # Here a variable named "done_" gets created GUARD:=done_$(call sanitise,$(TARGETDIR)/qmake$(DOTEXE)) # If variable "done_..." not set, set it to 1, so that -# UREL and UDEB do not execute makesis twice on the same target +# UREL and UDEB do not execute makesis twice on the same target ifeq ($($(GUARD)),) $(GUARD):=1 + +$(eval $(qt_qmake)) + +# Bootstrap is needed only on Linux ifneq ($(filter linux,$(HOSTPLATFORM)),) -EXPORT:: $(QT_TOOLS) $(TARGET_TOOLS) -else -EXPORT:: $(TARGET_TOOLS) -endif -$(eval $(call QtConfiguration)) -ifeq ($(OSTYPE),unix) -$(eval $(call whatmacro,$(QT_TOOLS) $(TARGET_TOOLS))) -$(eval $(call GenerateStandardCleanTarget,$(QT_TOOLS) $(TARGET_TOOLS) $(SOURCE_TOOLS),$(TARGETDIR))) -else -$(eval $(call whatmacro,$(TARGET_TOOLS))) -$(eval $(call GenerateStandardCleanTarget,$(TARGET_TOOLS) $(SOURCE_TOOLS),$(TARGETDIR))) +$(eval $(qt_bootstrap)) endif + +$(eval $(foreach TOOL,$(QT_TOOLS),$(call qt_tool,$(TOOL)))) + +TOOLSSRCDIR:=$(LANGUAGETOOLDIR) +$(eval $(call qt_tool,lrelease)) + +$(eval $(call whatmacro,$(WHATTARGETS))) +$(eval $(call GenerateStandardCleanTarget,$(CLEANTARGETS),$(TARGETDIR))) + endif -- cgit v0.12