diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/phonon/phonon/phonon_export.h | 6 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 155 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian_p.h | 54 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 51 | ||||
-rw-r--r-- | src/gui/styles/qs60style_simulated.cpp | 19 | ||||
-rw-r--r-- | src/network/socket/qabstractsocket.cpp | 2 | ||||
-rw-r--r-- | src/s60installs/qt_libs.pro | 2 | ||||
-rw-r--r-- | src/testlib/qtest_global.h | 4 |
8 files changed, 205 insertions, 88 deletions
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 diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 2f38a95..d745406 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,61 @@ 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), + m_iterationCount(1) +{ +} + +QActiveObject::~QActiveObject() +{ + if (m_hasRunAgain) + m_dispatcher->removeDeferredActiveObject(this); +} + +bool QActiveObject::okToRun() +{ + Q_ASSERT(!m_hasRunAgain); + + 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; + } +} + +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 +166,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 +192,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 +213,8 @@ void QTimerActiveObject::RunL() iStatus = KRequestPending; SetActive(); - // We complete it after the processEvents is done. + TRequestStatus *status = &iStatus; + QEventDispatcherSymbian::RequestComplete(status, KErrNone); } } @@ -180,33 +239,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 +269,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() @@ -466,8 +519,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) @@ -492,6 +544,9 @@ void QSocketActiveObject::DoCancel() void QSocketActiveObject::RunL() { + if (!okToRun()) + return; + m_dispatcher->socketFired(this); } @@ -508,9 +563,10 @@ 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_iterationCount(0), m_noSocketEvents(false) { } @@ -527,6 +583,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(); } @@ -537,6 +594,7 @@ void QEventDispatcherSymbian::closingDown() m_selectThread.stop(); } + delete m_completeDeferredAOs; delete m_wakeUpAO; if (m_activeScheduler) { delete m_activeScheduler; @@ -547,6 +605,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; @@ -633,9 +695,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; @@ -740,17 +799,28 @@ bool QEventDispatcherSymbian::sendPostedEvents() //return false; } -void QEventDispatcherSymbian::completeZeroTimers() +inline void QEventDispatcherSymbian::addDeferredActiveObject(QActiveObject *object) { - for (QHash<int, SymbianTimerInfoPtr>::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; } @@ -813,16 +883,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(); } @@ -833,12 +896,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 b5ce868..393749f 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -45,6 +45,25 @@ 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; + int m_iterationCount; +}; + class QWakeUpActiveObject : public CActive { public: @@ -76,10 +95,10 @@ struct SymbianTimerInfo : public QSharedData typedef QExplicitlySharedDataPointer<SymbianTimerInfo> 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 +112,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 +141,6 @@ protected: void RunL(); private: - QEventDispatcherSymbian *m_dispatcher; QSocketNotifier *m_notifier; bool m_inSocketEvent; bool m_deleteLater; @@ -187,7 +203,12 @@ public: void socketFired(QSocketActiveObject *socketAO); void wakeUpWasCalled(); void reactivateSocketNotifier(QSocketNotifier *notifier); - void completeZeroTimers(); + + void addDeferredActiveObject(QActiveObject *object); + 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); @@ -205,20 +226,21 @@ private: QHash<QSocketNotifier *, QSocketActiveObject *> m_notifiers; QWakeUpActiveObject *m_wakeUpAO; - QCompleteZeroTimersActiveObject *m_completeZeroTimersAO; + QCompleteDeferredAOs *m_completeDeferredAOs; volatile bool m_interrupt; QAtomicInt m_wakeUpDone; + unsigned char m_iterationCount; bool m_noSocketEvents; QList<QSocketActiveObject *> m_deferredSocketEvents; + QList<QActiveObject *> m_deferredActiveObjects; + 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 +252,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 diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 6f27de5..bf73494 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,13 @@ 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<QDial *> (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 +1134,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<const QStyleOptionSlider *>(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 +2291,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; } 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 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(); 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)" 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) |