From cbe647bcb7f2df85d9bd350e8e4f8fd1f5fb287a Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 15 May 2009 14:35:48 +0200 Subject: Made the RequestComplete debug code depend on QT_DEBUG. --- src/corelib/kernel/qeventdispatcher_symbian_p.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index b5ce868..8144472 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -216,9 +216,7 @@ private: RProcess m_processHandle; }; -#define DEBUG_REQUEST_COMPLETE - -#ifdef DEBUG_REQUEST_COMPLETE +#ifdef QT_DEBUG // EActive is defined to 1 and ERequestPending to 2, but they are both private. // A little dangerous to rely on, but it is only for debugging. # define REQUEST_STATUS_ACTIVE_AND_PENDING 3 @@ -230,7 +228,7 @@ private: #endif // Convenience functions for doing some sanity checking on our own complete code. -// Unless you define DEBUG_REQUEST_COMPLETE, it is exactly equivalent to the Symbian version. +// Unless QT_DEBUG is defined, it is exactly equivalent to the Symbian version. inline void QEventDispatcherSymbian::RequestComplete(TRequestStatus *&status, TInt reason) { VERIFY_PENDING_REQUEST_STATUS -- cgit v0.12 From 8cb4166fcfc65f74c583b15388cbcd18b96fa990 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 15 May 2009 14:50:32 +0200 Subject: Removed obsolete code. This is not necesary anymore after we started using the QCompleteZeroTimerActiveObject to complete zero timers. AutoTest: qtimer and qeventloop passed RevBy: Trust me --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 6c47c7b..beccffc 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -599,9 +599,6 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla timeState = SubsequentRun; }; - // Complete zero timers so that we get them next time. - completeZeroTimers(); - emit awake(); m_noSocketEvents = oldNoSocketEventsValue; -- cgit v0.12 From 7e19f2cccae0ed161399e454a2215438dd989daa Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 15 May 2009 16:08:58 +0200 Subject: Corrected wrong comment. --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index beccffc..1581d9b 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -155,7 +155,7 @@ void QTimerActiveObject::RunL() iStatus = KRequestPending; SetActive(); - // We complete it after the processEvents is done. + // We complete it when the QCompleteZeroTimersActiveObject is run. } } -- cgit v0.12 From 4fc19dd2632a846477c8cb223350165c1c4ff8cb Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 19 May 2009 10:00:48 +0200 Subject: Unbreak build, spotted by various people. Not tested, but should work(TM). --- src/s60installs/qt_libs.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/qt_libs.pro b/src/s60installs/qt_libs.pro index 99fde62..9aadfc0 100644 --- a/src/s60installs/qt_libs.pro +++ b/src/s60installs/qt_libs.pro @@ -66,7 +66,7 @@ symbian: { } contains(QT_CONFIG, phonon): { - qtlibraries.sources += QtPhonon.dll + qtlibraries.sources += Phonon.dll } BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" -- cgit v0.12 From 073c403cf3453818563c3a0e69e29fb403d22c22 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 19 May 2009 10:03:29 +0200 Subject: This lines are not needed as we monitor events in exception fd_set and map them to read / write notifications. --- src/network/socket/qabstractsocket.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 8ae247c..67e32fe 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -991,7 +991,6 @@ void QAbstractSocketPrivate::_q_connectToNextAddress() // Wait for a write notification that will eventually call // _q_testConnection(). socketEngine->setWriteNotificationEnabled(true); - socketEngine->setExceptionNotificationEnabled(true); break; } while (state != QAbstractSocket::ConnectedState); } @@ -1052,7 +1051,6 @@ void QAbstractSocketPrivate::_q_abortConnectionAttempt() #endif if (socketEngine) { socketEngine->setWriteNotificationEnabled(false); - socketEngine->setExceptionNotificationEnabled(false); } connectTimer->stop(); -- cgit v0.12 From 1a1f4a8b3c8850d7abe4dda5b85b850094cf7a6a Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 19 May 2009 12:58:58 +0200 Subject: Added test for checking that timers only fire once per processEvents. --- tests/auto/qtimer/tst_qtimer.cpp | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index cde2765..39144af 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -84,6 +84,8 @@ private slots: void deleteLaterOnQTimer(); // long name, don't want to shadow QObject::deleteLater() void moveToThread(); void restartedTimerFiresTooSoon(); + void timerFiresOnlyOncePerProcessEvents_data(); + void timerFiresOnlyOncePerProcessEvents(); }; class TimerHelper : public QObject @@ -480,6 +482,58 @@ void tst_QTimer::restartedTimerFiresTooSoon() QVERIFY(object.eventLoop.exec() == 0); } +class LongLastingSlotClass : public QObject +{ + Q_OBJECT + +public: + LongLastingSlotClass(QTimer *timer) : count(0), timer(timer) {} + +public slots: + void longLastingSlot() + { + // Don't use timers for this, because we are testing them. + QTime time; + time.start(); + while (time.elapsed() < 200) { + for (int c = 0; c < 100000; c++) {} // Mindless looping. + } + if (++count >= 2) { + timer->stop(); + } + } + +public: + int count; + QTimer *timer; +}; + +void tst_QTimer::timerFiresOnlyOncePerProcessEvents_data() +{ + QTest::addColumn("interval"); + QTest::newRow("zero timer") << 0; + QTest::newRow("non-zero timer") << 10; +} + +void tst_QTimer::timerFiresOnlyOncePerProcessEvents() +{ + QFETCH(int, interval); + + QTimer t; + LongLastingSlotClass longSlot(&t); + t.start(interval); + connect(&t, SIGNAL(timeout()), &longSlot, SLOT(longLastingSlot())); + // Loop because there may be other events pending. + while (longSlot.count == 0) { + QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); + } + +#ifdef Q_OS_SYMBIAN + QEXPECT_FAIL("non-zero timer", "Will be fixed in next commit", Abort); +#endif + QCOMPARE(longSlot.count, 1); +} + QTEST_MAIN(tst_QTimer) #include "tst_qtimer.moc" \ -- cgit v0.12 From 16887d14b975c4740f037366dc7e45d59731fb47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Tue, 19 May 2009 16:01:56 +0300 Subject: S60Style: Styling QDial. --- src/gui/styles/qs60style.cpp | 52 +++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 6f27de5..c082125 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -10,33 +10,37 @@ ****************************************************************************/ #include "qs60style_p.h" + #include "qapplication.h" #include "qpainter.h" #include "qstyleoption.h" #include "qresizeevent" #include "qpixmapcache" -#include "qlistview.h" + #include "qcalendarwidget.h" -#include "qtabbar.h" +#include "qdial.h" +#include "qdialog.h" +#include "qerrormessage.h" +#include "qgroupbox.h" +#include "qheaderview.h" +#include "qlist.h" #include "qlistwidget.h" +#include "qlistview.h" #include "qmenu.h" -#include "qpushbutton.h" #include "qmenubar.h" +#include "qmessagebox.h" +#include "qpushbutton.h" +#include "qscrollbar.h" +#include "qtabbar.h" #include "qtablewidget.h" +#include "qtableview.h" #include "qtoolbar.h" -#include "qgroupbox.h" #include "qtoolbutton.h" +#include "qtreeview.h" + #include "private/qtoolbarextension_p.h" #include "private/qcombobox_p.h" #include "private/qwidget_p.h" -#include "qscrollbar.h" -#include "qlist.h" -#include "qtableview.h" -#include "qheaderview.h" -#include "qtreeview.h" -#include "qdialog.h" -#include "qmessagebox.h" -#include "qerrormessage.h" #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN) @@ -524,7 +528,7 @@ void QS60StylePrivate::setThemePalette(QApplication *app) const widgetPalette.setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture()); widgetPalette.setColor(QPalette::Base, Qt::transparent); // set button and tooltipbase based on pixel colors - QColor buttonColor = colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal); + const QColor buttonColor = colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal); widgetPalette.setColor(QPalette::Button, buttonColor ); widgetPalette.setColor(QPalette::Light, widgetPalette.color(QPalette::Button).lighter()); widgetPalette.setColor(QPalette::Dark, widgetPalette.color(QPalette::Button).darker()); @@ -633,7 +637,14 @@ void QS60Style::polish(QWidget *widget) widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QLineEdit"); - + } else if (qobject_cast (widget)) { + const QColor color(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0)); + widgetPalette.setColor(QPalette::WindowText, color); + widgetPalette.setColor(QPalette::Button, QApplication::palette().color(QPalette::Button)); + widgetPalette.setColor(QPalette::Dark, color.darker()); + widgetPalette.setColor(QPalette::Light, color.lighter()); + QApplication::setPalette(widgetPalette, "QDial"); + } } } @@ -1124,15 +1135,20 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom } break; #endif //QT_NO_GROUPBOX +#ifndef QT_NO_DIAL + case CC_Dial: + if (const QStyleOptionSlider *slider = qstyleoption_cast(option)) { + QStyleOptionSlider optionSlider = *slider; + QCommonStyle::drawComplexControl(control, &optionSlider, painter, widget); + } + break; +#endif //QT_NO_DIAL //todo: remove non-used complex widgets in final version case CC_TitleBar: #ifdef QT3_SUPPORT case CC_Q3ListView: #endif //QT3_SUPPORT -#ifndef QT_NO_DIAL - case CC_Dial: -#endif //QT_NO_DIAL #ifndef QT_NO_WORKSPACE case CC_MdiControls: #endif //QT_NO_WORKSPACE @@ -2276,6 +2292,8 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_ComboBox_PopupFrameStyle: retValue = QFrame::NoFrame; break; + case SH_Dial_BackgroundRole: + retValue = QPalette::Base; default: break; } -- cgit v0.12 From ae85bab1ec5d66d4bfb628da4f0e5514dc85f5a5 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 19 May 2009 16:04:58 +0300 Subject: Importing macros for testlib did not get defined properly for RVCT. RevBy: axis --- src/testlib/qtest_global.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/testlib/qtest_global.h b/src/testlib/qtest_global.h index ebfdae1..ba7da2a 100644 --- a/src/testlib/qtest_global.h +++ b/src/testlib/qtest_global.h @@ -52,7 +52,7 @@ QT_MODULE(Test) #ifdef QTEST_EMBED # define Q_TESTLIB_EXPORT -#elif !defined(QT_SHARED) +#elif !defined(QT_SHARED) && !(defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)) # define Q_TESTLIB_EXPORT #else # ifdef QTESTLIB_MAKEDLL @@ -64,7 +64,7 @@ QT_MODULE(Test) #if (defined (Q_CC_MSVC) && _MSC_VER < 1310) || defined (Q_CC_SUN) || defined (Q_CC_XLC) || (defined (Q_CC_GNU) && (__GNUC__ - 0 < 3)) || defined (Q_CC_NOKIAX86) # define QTEST_NO_SPECIALIZATIONS -#endif +#endif #if (defined Q_CC_HPACC) && (defined __ia64) -- cgit v0.12 From dbf64e86f37384a991153335ca4c1528cf44295a Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 15 May 2009 17:43:57 +0200 Subject: Changed the way that Qt handles active objects. The change was done in order to get a more round-robin type of event handling, at least for Qt active objects. With this change, each object will only execute once within each call to processEvents, like other platforms. This is required for certain tests using Open C, because some of the function calls in that library take much longer than their desktop counterparts. Therefore the timer expires before the previous timer handler was finished and the test gets stuck executing the same timer over and over. By returning from processEvents after one iteration, we prevent this. RevBy: Aleksandar Sasha Babic AutoTest: Passed --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 143 ++++++++++++++++-------- src/corelib/kernel/qeventdispatcher_symbian_p.h | 44 ++++++-- tests/auto/qtimer/tst_qtimer.cpp | 3 - 3 files changed, 129 insertions(+), 61 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 1581d9b..e1e3e0e 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -22,7 +22,7 @@ QT_BEGIN_NAMESPACE #define WAKE_UP_PRIORITY CActive::EPriorityStandard #define TIMER_PRIORITY CActive::EPriorityLow -#define COMPLETE_ZERO_TIMERS_PRIORITY CActive::EPriorityIdle +#define COMPLETE_DEFERRED_ACTIVE_OBJECTS_PRIORITY CActive::EPriorityIdle static inline int qt_pipe_write(int socket, const char *data, qint64 len) { @@ -82,6 +82,57 @@ private: QMutex *m_mutex; }; +/* + * This class is designed to aid in implementing event handling in a more round robin fashion. We + * cannot change active objects that we do not own, but the active objects that Qt owns will use + * this as a base class with convenience functions. + * + * Here is how it works: On every RunL, the deriving class should call okToRun(). This will allow + * exactly one run of the active object, and mark it as such. If it is called again, it will return + * false, and add the object to a queue so it can be run later. + * + * The QCompleteDeferredAOs class is a special object that runs after all others, which will + * reactivate the objects that were previously not run. + */ +inline QActiveObject::QActiveObject(TInt priority, QEventDispatcherSymbian *dispatcher) + : CActive(priority), + m_dispatcher(dispatcher), + m_hasAlreadyRun(false), + m_hasRunAgain(false) +{ +} + +QActiveObject::~QActiveObject() +{ + if (m_hasRunAgain) + m_dispatcher->removeDeferredActiveObject(this); +} + +bool QActiveObject::okToRun() +{ + Q_ASSERT(!m_hasRunAgain); + + if (m_hasAlreadyRun) { + m_dispatcher->addDeferredActiveObject(this); + m_hasRunAgain = true; + return false; + } else { + m_hasAlreadyRun = true; + return true; + } +} + +void QActiveObject::reactivateAndComplete() +{ + iStatus = KRequestPending; + SetActive(); + TRequestStatus *status = &iStatus; + QEventDispatcherSymbian::RequestComplete(status, KErrNone); + + m_hasRunAgain = false; + m_hasAlreadyRun = false; +} + QWakeUpActiveObject::QWakeUpActiveObject(QEventDispatcherSymbian *dispatcher) : CActive(WAKE_UP_PRIORITY), m_dispatcher(dispatcher) @@ -111,8 +162,8 @@ void QWakeUpActiveObject::RunL() m_dispatcher->wakeUpWasCalled(); } -QTimerActiveObject::QTimerActiveObject(SymbianTimerInfo *timerInfo) - : CActive(TIMER_PRIORITY), +QTimerActiveObject::QTimerActiveObject(QEventDispatcherSymbian *dispatcher, SymbianTimerInfo *timerInfo) + : QActiveObject(TIMER_PRIORITY, dispatcher), m_timerInfo(timerInfo) { } @@ -137,6 +188,9 @@ void QTimerActiveObject::DoCancel() void QTimerActiveObject::RunL() { + if (!okToRun()) + return; + if (m_timerInfo->interval > 0) { // Start a new timer immediately so that we don't lose time. iStatus = KRequestPending; @@ -155,7 +209,8 @@ void QTimerActiveObject::RunL() iStatus = KRequestPending; SetActive(); - // We complete it when the QCompleteZeroTimersActiveObject is run. + TRequestStatus *status = &iStatus; + QEventDispatcherSymbian::RequestComplete(status, KErrNone); } } @@ -180,33 +235,29 @@ SymbianTimerInfo::~SymbianTimerInfo() delete timerAO; } -QCompleteZeroTimersActiveObject::QCompleteZeroTimersActiveObject(QEventDispatcherSymbian *dispatcher) - : CActive(COMPLETE_ZERO_TIMERS_PRIORITY), +QCompleteDeferredAOs::QCompleteDeferredAOs(QEventDispatcherSymbian *dispatcher) + : CActive(COMPLETE_DEFERRED_ACTIVE_OBJECTS_PRIORITY), m_dispatcher(dispatcher) { CActiveScheduler::Add(this); iStatus = KRequestPending; SetActive(); - TRequestStatus *status = &iStatus; - QEventDispatcherSymbian::RequestComplete(status, KErrNone); } -QCompleteZeroTimersActiveObject::~QCompleteZeroTimersActiveObject() +QCompleteDeferredAOs::~QCompleteDeferredAOs() { Cancel(); } -bool QCompleteZeroTimersActiveObject::ref() +void QCompleteDeferredAOs::complete() { - return (++m_refCount != 0); -} - -bool QCompleteZeroTimersActiveObject::deref() -{ - return (--m_refCount != 0); + if (iStatus.Int() & KRequestPending) { + TRequestStatus *status = &iStatus; + QEventDispatcherSymbian::RequestComplete(status, KErrNone); + } } -void QCompleteZeroTimersActiveObject::DoCancel() +void QCompleteDeferredAOs::DoCancel() { if (iStatus.Int() & KRequestPending) { TRequestStatus *status = &iStatus; @@ -214,14 +265,12 @@ void QCompleteZeroTimersActiveObject::DoCancel() } } -void QCompleteZeroTimersActiveObject::RunL() +void QCompleteDeferredAOs::RunL() { - m_dispatcher->completeZeroTimers(); - iStatus = KRequestPending; SetActive(); - TRequestStatus *status = &iStatus; - QEventDispatcherSymbian::RequestComplete(status, KErrNone); + + m_dispatcher->reactivateDeferredActiveObjects(); } QSelectThread::QSelectThread() @@ -432,8 +481,7 @@ void QSelectThread::stop() } QSocketActiveObject::QSocketActiveObject(QEventDispatcherSymbian *dispatcher, QSocketNotifier *notifier) - : CActive(CActive::EPriorityStandard), - m_dispatcher(dispatcher), + : QActiveObject(CActive::EPriorityStandard, dispatcher), m_notifier(notifier), m_inSocketEvent(false), m_deleteLater(false) @@ -458,6 +506,9 @@ void QSocketActiveObject::DoCancel() void QSocketActiveObject::RunL() { + if (!okToRun()) + return; + m_dispatcher->socketFired(this); } @@ -474,7 +525,7 @@ QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent) : QAbstractEventDispatcher(parent), m_activeScheduler(0), m_wakeUpAO(0), - m_completeZeroTimersAO(0), + m_completeDeferredAOs(0), m_interrupt(false), m_wakeUpDone(0), m_noSocketEvents(false) @@ -493,6 +544,7 @@ void QEventDispatcherSymbian::startingUp() CActiveScheduler::Install(m_activeScheduler); } m_wakeUpAO = new(ELeave) QWakeUpActiveObject(this); + m_completeDeferredAOs = new(ELeave) QCompleteDeferredAOs(this); // We already might have posted events, wakeup once to process them wakeUp(); } @@ -503,6 +555,7 @@ void QEventDispatcherSymbian::closingDown() m_selectThread.stop(); } + delete m_completeDeferredAOs; delete m_wakeUpAO; if (m_activeScheduler) { delete m_activeScheduler; @@ -703,17 +756,28 @@ bool QEventDispatcherSymbian::sendPostedEvents() //return false; } -void QEventDispatcherSymbian::completeZeroTimers() +inline void QEventDispatcherSymbian::addDeferredActiveObject(QActiveObject *object) { - for (QHash::iterator i = m_timerList.begin(); i != m_timerList.end(); ++i) { - if ((*i)->interval == 0 && (*i)->timerAO->iStatus.Int() & KRequestPending) { - TRequestStatus *status = &(*i)->timerAO->iStatus; - QEventDispatcherSymbian::RequestComplete(status, KErrNone); - } + if (m_deferredActiveObjects.isEmpty()) { + m_completeDeferredAOs->complete(); + } + m_deferredActiveObjects.append(object); +} + +inline void QEventDispatcherSymbian::removeDeferredActiveObject(QActiveObject *object) +{ + m_deferredActiveObjects.removeAll(object); +} + +void QEventDispatcherSymbian::reactivateDeferredActiveObjects() +{ + while (!m_deferredActiveObjects.isEmpty()) { + QActiveObject *object = m_deferredActiveObjects.takeFirst(); + object->reactivateAndComplete(); } // We do this because we want to return from processEvents. This is because - // each invocation of processEvents should only run each zero timer once. + // each invocation of processEvents should only run each active object once. // The active scheduler should run them continously, however. m_interrupt = true; } @@ -776,16 +840,9 @@ void QEventDispatcherSymbian::registerTimer ( int timerId, int interval, QObject timer->inTimerEvent = false; timer->receiver = object; timer->dispatcher = this; - timer->timerAO = new(ELeave) QTimerActiveObject(timer.data()); + timer->timerAO = new(ELeave) QTimerActiveObject(this, timer.data()); m_timerList.insert(timerId, timer); - if (interval == 0) { - if (!m_completeZeroTimersAO) { - m_completeZeroTimersAO = new (ELeave) QCompleteZeroTimersActiveObject(this); - } - m_completeZeroTimersAO->ref(); - } - timer->timerAO->Start(); } @@ -796,12 +853,6 @@ bool QEventDispatcherSymbian::unregisterTimer ( int timerId ) } SymbianTimerInfoPtr timerInfo = m_timerList.take(timerId); - if (timerInfo->interval == 0) { - if (!m_completeZeroTimersAO->deref()) { - delete m_completeZeroTimersAO; - m_completeZeroTimersAO = 0; - } - } return true; } diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 8144472..3233fe4 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -45,6 +45,24 @@ QT_BEGIN_NAMESPACE class QEventDispatcherSymbian; class QTimerActiveObject; +class QActiveObject : public CActive +{ +public: + QActiveObject(TInt priority, QEventDispatcherSymbian *dispatcher); + ~QActiveObject(); + + bool okToRun(); + + void reactivateAndComplete(); + +protected: + QEventDispatcherSymbian *m_dispatcher; + +private: + bool m_hasAlreadyRun : 1; + bool m_hasRunAgain : 1; +}; + class QWakeUpActiveObject : public CActive { public: @@ -76,10 +94,10 @@ struct SymbianTimerInfo : public QSharedData typedef QExplicitlySharedDataPointer SymbianTimerInfoPtr; // This is a bit of a proxy class. See comments in SetActive and Start for details. -class QTimerActiveObject : public CActive +class QTimerActiveObject : public QActiveObject { public: - QTimerActiveObject(SymbianTimerInfo *timerInfo); + QTimerActiveObject(QEventDispatcherSymbian *dispatcher, SymbianTimerInfo *timerInfo); ~QTimerActiveObject(); void Start(); @@ -93,25 +111,23 @@ private: RTimer m_rTimer; }; -class QCompleteZeroTimersActiveObject : public CActive +class QCompleteDeferredAOs : public CActive { public: - QCompleteZeroTimersActiveObject(QEventDispatcherSymbian *dispatcher); - ~QCompleteZeroTimersActiveObject(); + QCompleteDeferredAOs(QEventDispatcherSymbian *dispatcher); + ~QCompleteDeferredAOs(); - bool ref(); - bool deref(); + void complete(); protected: void DoCancel(); void RunL(); private: - int m_refCount; QEventDispatcherSymbian *m_dispatcher; }; -class QSocketActiveObject : public CActive +class QSocketActiveObject : public QActiveObject { public: QSocketActiveObject(QEventDispatcherSymbian *dispatcher, QSocketNotifier *notifier); @@ -124,7 +140,6 @@ protected: void RunL(); private: - QEventDispatcherSymbian *m_dispatcher; QSocketNotifier *m_notifier; bool m_inSocketEvent; bool m_deleteLater; @@ -187,7 +202,10 @@ public: void socketFired(QSocketActiveObject *socketAO); void wakeUpWasCalled(); void reactivateSocketNotifier(QSocketNotifier *notifier); - void completeZeroTimers(); + + void addDeferredActiveObject(QActiveObject *object); + void removeDeferredActiveObject(QActiveObject *object); + void reactivateDeferredActiveObjects(); static void RequestComplete(TRequestStatus *&status, TInt reason); static void RequestComplete(RThread &threadHandle, TRequestStatus *&status, TInt reason); @@ -205,7 +223,7 @@ private: QHash m_notifiers; QWakeUpActiveObject *m_wakeUpAO; - QCompleteZeroTimersActiveObject *m_completeZeroTimersAO; + QCompleteDeferredAOs *m_completeDeferredAOs; volatile bool m_interrupt; QAtomicInt m_wakeUpDone; @@ -213,6 +231,8 @@ private: bool m_noSocketEvents; QList m_deferredSocketEvents; + QList m_deferredActiveObjects; + RProcess m_processHandle; }; diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 39144af..0051a9b 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -528,9 +528,6 @@ void tst_QTimer::timerFiresOnlyOncePerProcessEvents() QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); } -#ifdef Q_OS_SYMBIAN - QEXPECT_FAIL("non-zero timer", "Will be fixed in next commit", Abort); -#endif QCOMPARE(longSlot.count, 1); } -- cgit v0.12 From a1db305f482de2d24797b8f99a752e49e80fa392 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 19 May 2009 16:17:29 +0200 Subject: Made a small correction and optmization to the event dispatcher. By keeping record of the iteration count of the event loop, we can determine whether the active object being processed is being run for the first time or not in the current iteration. This is slightly faster, since it saves us from adding the AO to the deferred queue the second time around if the iteration is different. It is also slightly more correct, since otherwise running a timer twice would take three calls to processEvents instead of two (first time: run AO, second time: add to queue, third time: run AO from the queue). RevBy: Trust me AutoTest: Passed --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 19 ++++++++++++++----- src/corelib/kernel/qeventdispatcher_symbian_p.h | 4 ++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index e1e3e0e..aca328a 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -98,7 +98,8 @@ inline QActiveObject::QActiveObject(TInt priority, QEventDispatcherSymbian *disp : CActive(priority), m_dispatcher(dispatcher), m_hasAlreadyRun(false), - m_hasRunAgain(false) + m_hasRunAgain(false), + m_iterationCount(1) { } @@ -112,13 +113,16 @@ bool QActiveObject::okToRun() { Q_ASSERT(!m_hasRunAgain); - if (m_hasAlreadyRun) { + if (!m_hasAlreadyRun || m_dispatcher->iterationCount() != m_iterationCount) { + // First occurrence of this event in this iteration. + m_hasAlreadyRun = true; + m_iterationCount = m_dispatcher->iterationCount(); + return true; + } else { + // The event has already occurred. m_dispatcher->addDeferredActiveObject(this); m_hasRunAgain = true; return false; - } else { - m_hasAlreadyRun = true; - return true; } } @@ -528,6 +532,7 @@ QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent) m_completeDeferredAOs(0), m_interrupt(false), m_wakeUpDone(0), + m_iterationCount(0), m_noSocketEvents(false) { } @@ -566,6 +571,10 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla { Q_D(QAbstractEventDispatcher); + // It is safe if this counter overflows. The main importance is that each + // iteration count is different from the last. + m_iterationCount++; + RThread &thread = d->threadData->symbian_thread_handle; bool block; diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 3233fe4..393749f 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -61,6 +61,7 @@ protected: private: bool m_hasAlreadyRun : 1; bool m_hasRunAgain : 1; + int m_iterationCount; }; class QWakeUpActiveObject : public CActive @@ -207,6 +208,8 @@ public: void removeDeferredActiveObject(QActiveObject *object); void reactivateDeferredActiveObjects(); + inline int iterationCount() const { return m_iterationCount; } + static void RequestComplete(TRequestStatus *&status, TInt reason); static void RequestComplete(RThread &threadHandle, TRequestStatus *&status, TInt reason); @@ -228,6 +231,7 @@ private: volatile bool m_interrupt; QAtomicInt m_wakeUpDone; + unsigned char m_iterationCount; bool m_noSocketEvents; QList m_deferredSocketEvents; -- cgit v0.12 From f2c1e1ce97cac87c9a1fb8df5a09608dc9252948 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 19 May 2009 16:35:49 +0200 Subject: Ensure that the export symbols are correct. Patch supplied by Saleem/Dallas team. Reviewed-By: Thiago Reviewed-By: jbache --- src/3rdparty/phonon/phonon/phonon_export.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/phonon/phonon_export.h b/src/3rdparty/phonon/phonon/phonon_export.h index e579f67..5f93ea0 100644 --- a/src/3rdparty/phonon/phonon/phonon_export.h +++ b/src/3rdparty/phonon/phonon/phonon_export.h @@ -32,7 +32,11 @@ # define PHONON_EXPORT Q_DECL_IMPORT # endif # else /* UNIX */ -# define PHONON_EXPORT Q_DECL_EXPORT +# ifdef MAKE_PHONON_LIB /* We are building this library */ +# define PHONON_EXPORT Q_DECL_EXPORT +# else /* We are using this library */ +# define PHONON_EXPORT Q_DECL_IMPORT +# endif # endif #endif -- cgit v0.12 From 2f37788e164bcf4c179e5603c1e9d9a5c5bcd6cc Mon Sep 17 00:00:00 2001 From: Markku Luukkainen Date: Tue, 19 May 2009 16:59:42 +0200 Subject: removed extra brace character causing compilation failure --- src/gui/styles/qs60style.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index c082125..bf73494 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -645,7 +645,6 @@ void QS60Style::polish(QWidget *widget) widgetPalette.setColor(QPalette::Light, color.lighter()); QApplication::setPalette(widgetPalette, "QDial"); } - } } void QS60Style::unpolish(QApplication *application) -- cgit v0.12 From 515916da3ddd0e7a7fc1b7c4e6d2e17d3576b803 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 19 May 2009 19:13:39 +0200 Subject: Testing 'dictionary' if it contains a value before using operator[]. T & QMap::operator[]: "If the map contains no item with key key, the function inserts a default-constructed value into the map with key key, and returns a reference to it" How many occurences of 'dictionary["foo"].startsWith("bar")' has that file by the way? --- tools/configure/configureapp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 2c20d51..a879e5d 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1886,14 +1886,14 @@ bool Configure::checkAvailability(const QString &part) else if (part == "SQL_DB2") available = findFile("sqlcli.h") && findFile("sqlcli1.h") && findFile("db2cli.lib"); else if (part == "SQL_SQLITE") - if (dictionary["XQMAKESPEC"].startsWith("symbian")) + if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) available = false; // In Symbian we only support system sqlite option else available = true; // Built in, we have a fork else if (part == "SQL_SQLITE_LIB") { if (dictionary[ "SQL_SQLITE_LIB" ] == "system") { // Symbian has multiple .lib/.dll files we need to find - if (dictionary["XQMAKESPEC"].startsWith("symbian")) { + if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) { available = true; // There is sqlite_symbian plugin which exports the necessary stuff dictionary[ "QT_LFLAGS_SQLITE" ] += "-lsqlite3"; } else { -- cgit v0.12 From 2698a9f27eb83a7145560def144bdc53ad5c2eb8 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 19 May 2009 19:14:55 +0200 Subject: Fresh build with commit eb4c00a469f473a33103652ed977eabb4fb9ce9b (MSVC 2008, No MS runtimes, UPXed) --- configure.exe | Bin 856064 -> 535040 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/configure.exe b/configure.exe index 5710503..30383d8 100755 Binary files a/configure.exe and b/configure.exe differ -- cgit v0.12 From 9db91e3d4a7f3bd92c7815b3257f459f3b3de01f Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 19 May 2009 19:58:57 +0200 Subject: Stub for backgroundTexture() --- src/gui/styles/qs60style_simulated.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 17c1ebe..5a88f9a 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -191,6 +191,25 @@ QVariant QS60StylePrivate::styleProperty_specific(const char *name) const return styleProperty(name); } +QPixmap QS60StylePrivate::backgroundTexture() +{ + static QPixmap result; + // Poor mans caching. + Making sure that there is always only one background image in memory at a time + +/* + TODO: 1) Hold the background QPixmap as pointer in a static class member. + Also add a deleteBackground() function and call that in ~QS60StylePrivate() + 2) Don't cache the background at all as soon as we have native pixmap support +*/ + + if (!m_backgroundValid) { + result = QPixmap(); + result = part(QS60StyleEnums::SP_QsnBgScreen, QApplication::activeWindow()->size()); + m_backgroundValid = true; + } + return result; +} + bool QS60StylePrivate::isTouchSupported() { #ifdef QT_KEYPAD_NAVIGATION -- cgit v0.12