diff options
author | Sarah Smith <sarah.j.smith@nokia.com> | 2009-09-08 00:35:06 (GMT) |
---|---|---|
committer | Sarah Smith <sarah.j.smith@nokia.com> | 2009-09-08 00:35:06 (GMT) |
commit | 693695e5677422625d555943586d41fbd9dbe971 (patch) | |
tree | 17e70dcb11f009398b083cb0361982ca32f2ac6e /src | |
parent | f4fa50c25aea68b7696ad7de289d93facac9f3e5 (diff) | |
parent | 4bb098ed9449bd3b2798000bc5394bda98c9165f (diff) | |
download | Qt-693695e5677422625d555943586d41fbd9dbe971.zip Qt-693695e5677422625d555943586d41fbd9dbe971.tar.gz Qt-693695e5677422625d555943586d41fbd9dbe971.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src')
33 files changed, 238 insertions, 139 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h index eeeac6f..594c4dd 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h @@ -32,6 +32,7 @@ #include "MacroAssembler.h" #include "Opcode.h" #include "Structure.h" +#include "StructureChain.h" #include <wtf/VectorTraits.h> #define POLYMORPHIC_LIST_CACHE_SIZE 8 diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp index 4a33e67..da541c5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -285,6 +285,11 @@ void JIT::emit_op_tear_off_arguments(Instruction*) void JIT::emit_op_ret(Instruction* currentInstruction) { +#ifdef QT_BUILD_SCRIPT_LIB + JITStubCall stubCall(this, JITStubs::cti_op_debug_return); + stubCall.addArgument(Imm32(currentInstruction[1].u.operand)); + stubCall.call(); +#endif // We could JIT generate the deref, only calling out to C when the refcount hits zero. if (m_codeBlock->needsFullScopeChain()) JITStubCall(this, JITStubs::cti_op_ret_scopeChain).call(); @@ -686,6 +691,7 @@ void JIT::emit_op_catch(Instruction* currentInstruction) emitPutVirtualRegister(currentInstruction[1].u.operand); #ifdef QT_BUILD_SCRIPT_LIB JITStubCall stubCall(this, JITStubs::cti_op_debug_catch); + stubCall.addArgument(Imm32(currentInstruction[1].u.operand)); stubCall.call(); #endif } diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index 0eb0799..0a5eb07 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -2747,9 +2747,23 @@ DEFINE_STUB_FUNCTION(void, op_debug_catch) STUB_INIT_STACK_FRAME(stackFrame); CallFrame* callFrame = stackFrame.callFrame; if (JSC::Debugger* debugger = callFrame->lexicalGlobalObject()->debugger() ) { - debugger->exceptionCatch(DebuggerCallFrame(callFrame), callFrame->codeBlock()->ownerNode()->sourceID()); + JSValue exceptionValue = callFrame->r(stackFrame.args[0].int32()).jsValue(); + DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue); + debugger->exceptionCatch(debuggerCallFrame, callFrame->codeBlock()->ownerNode()->sourceID()); } } + +DEFINE_STUB_FUNCTION(void, op_debug_return) +{ + STUB_INIT_STACK_FRAME(stackFrame); + CallFrame* callFrame = stackFrame.callFrame; + if (JSC::Debugger* debugger = callFrame->lexicalGlobalObject()->debugger() ) { + JSValue returnValue = callFrame->r(stackFrame.args[0].int32()).jsValue(); + intptr_t sourceID = callFrame->codeBlock()->ownerNode()->sourceID(); + debugger->functionExit(returnValue, sourceID); + } +} + #endif DEFINE_STUB_FUNCTION(EncodedJSValue, vm_throw) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h index 60bf64a..325c3fd 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h @@ -223,6 +223,7 @@ namespace JITStubs { extern "C" { void JIT_STUB cti_op_debug(STUB_ARGS_DECLARATION); #ifdef QT_BUILD_SCRIPT_LIB void JIT_STUB cti_op_debug_catch(STUB_ARGS_DECLARATION); + void JIT_STUB cti_op_debug_return(STUB_ARGS_DECLARATION); #endif void JIT_STUB cti_op_end(STUB_ARGS_DECLARATION); void JIT_STUB cti_op_jmp_scopes(STUB_ARGS_DECLARATION); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h index dc11fee..98e9b68 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h @@ -27,6 +27,7 @@ #include "NativeFunctionWrapper.h" #include "NumberPrototype.h" #include "StringPrototype.h" +#include "StructureChain.h" #include <wtf/HashSet.h> #include <wtf/OwnPtr.h> diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h index b4382f4..67ee9c8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h @@ -24,6 +24,7 @@ #include "CallFrame.h" #include "Identifier.h" #include "Structure.h" +#include "StructureChain.h" #include <wtf/HashSet.h> #include <wtf/Vector.h> diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h index 0de03a3..dcd4e50 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h @@ -30,7 +30,6 @@ #include "JSType.h" #include "JSValue.h" #include "PropertyMapHashTable.h" -#include "StructureChain.h" #include "StructureTransitionTable.h" #include "TypeInfo.h" #include "UString.h" @@ -47,6 +46,7 @@ namespace JSC { class PropertyNameArray; class PropertyNameArrayData; + class StructureChain; class Structure : public RefCounted<Structure> { public: diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp index 85049b1..acebc86 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "StructureChain.h" +#include "Structure.h" #include "JSObject.h" #include "Structure.h" @@ -46,6 +47,11 @@ StructureChain::StructureChain(Structure* head) m_vector[i] = 0; } +PassRefPtr<StructureChain> StructureChain::create(Structure* head) +{ + return adoptRef(new StructureChain(head)); +} + bool StructureChain::isCacheable() const { uint32_t i = 0; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h index c48749d..5990e17 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h @@ -37,7 +37,7 @@ namespace JSC { class StructureChain : public RefCounted<StructureChain> { public: - static PassRefPtr<StructureChain> create(Structure* head) { return adoptRef(new StructureChain(head)); } + static PassRefPtr<StructureChain> create(Structure* head); RefPtr<Structure>* head() { return m_vector.get(); } bool isCacheable() const; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index e1e4ba3..fa37d55 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -501,7 +501,7 @@ #endif #if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(QNX) \ - && !PLATFORM(SYMBIAN) && !COMPILER(RVCT) && !PLATFORM(AIX) + && !PLATFORM(SYMBIAN) && !COMPILER(RVCT) && !PLATFORM(AIX) && !PLATFORM(HPUX) #define HAVE_TM_GMTOFF 1 #define HAVE_TM_ZONE 1 #define HAVE_TIMEGM 1 diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index a2c532f..7285f69 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1364,7 +1364,7 @@ inline void qt_noop() {} #ifdef QT_BOOTSTRAPPED # define QT_NO_EXCEPTIONS #endif -#if defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN) +#if !defined(QT_NO_EXCEPTIONS) && defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN) # define QT_NO_EXCEPTIONS #endif diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 022211c..50b4af7 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -731,6 +731,8 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const } QAbstractFileEngine::FileFlags ret = 0; + if (type & FlagsMask) + ret |= LocalDiskFlag; bool exists = d->doStat(); if (!exists && !d->isSymlink()) return ret; @@ -796,7 +798,6 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const } } if (type & FlagsMask) { - ret |= LocalDiskFlag; if (exists) ret |= ExistsFlag; #if defined(Q_OS_SYMBIAN) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 9c308a3..c6ac6d4 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -1021,6 +1021,8 @@ void QEventDispatcherWin32::closingDown() // clean up any timers for (int i = 0; i < d->timerVec.count(); ++i) d->unregisterTimer(d->timerVec.at(i), true); + d->timerVec.clear(); + d->timerDict.clear(); } bool QEventDispatcherWin32::event(QEvent *e) diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index f562fb3..a5cdd45 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -78,13 +78,13 @@ QT_BEGIN_NAMESPACE /*! - \class QStateMachine - \reentrant + \class QStateMachine + \reentrant - \brief The QStateMachine class provides a hierarchical finite state machine. + \brief The QStateMachine class provides a hierarchical finite state machine. - \since 4.6 - \ingroup statemachine + \since 4.6 + \ingroup statemachine QStateMachine is based on the concepts and notation of \l{Statecharts: A visual formalism for complex @@ -128,21 +128,7 @@ QT_BEGIN_NAMESPACE The following snippet shows a state machine that will finish when a button is clicked: - \code - QPushButton button; - - QStateMachine machine; - QState *s1 = new QState(); - s1->assignProperty(&button, "text", "Click me"); - - QFinalState *s2 = new QFinalState(); - s1->addTransition(&button, SIGNAL(clicked()), s2); - - machine.addState(s1); - machine.addState(s2); - machine.setInitialState(s1); - machine.start(); - \endcode + \snippet doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp simple state machine This code example uses QState, which inherits QAbstractState. The QState class provides a state that you can use to set properties @@ -160,17 +146,7 @@ QT_BEGIN_NAMESPACE no error state applies to the erroneous state, the machine will stop executing and an error message will be printed to the console. - \omit This stuff will be moved elsewhere -This is - typically used in conjunction with \l{Signals and Slots}{signals}; the - signals determine the flow of the state graph, whereas the states' property - assignments and method invocations are the actions. - - The postEvent() function posts an event to the state machine. This is useful - when you are using custom events to trigger transitions. - \endomit - - \sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework} + \sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework} */ /*! @@ -1748,6 +1724,10 @@ bool QStateMachine::isRunning() const transition to the initial state. When a final top-level state (QFinalState) is entered, the machine will emit the finished() signal. + \note A state machine will not run without a running event loop, such as + the main application event loop started with QCoreApplication::exec() or + QApplication::exec(). + \sa started(), finished(), stop(), initialState() */ void QStateMachine::start() diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index eae3e63..7023e9e 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -934,7 +934,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) } QGraphicsItem *lastSubFocusItem = subFocusItem; - if (subFocusItem) { + if (subFocusItem && !inDestructor) { // Update the child focus chain; when reparenting an item that has a // focus child, ensure that that focus child clears its focus child // chain from our parents before it's reparented. diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index ea98cb2..52529ff 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1537,8 +1537,7 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event) QPoint offset = d->offset(); if ((command & QItemSelectionModel::Current) == 0) d->pressedPosition = pos + offset; - - if (d->pressedPosition == QPoint(-1, -1)) + else if (!indexAt(d->pressedPosition).isValid()) d->pressedPosition = visualRect(currentIndex()).center() + offset; if (edit(index, NoEditTriggers, event)) @@ -2089,8 +2088,8 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) // note that we don't check if the new current index is enabled because moveCursor() makes sure it is if (command & QItemSelectionModel::Current) { d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate); - if (d->pressedPosition == QPoint(-1, -1)) - d->pressedPosition = visualRect(oldCurrent).center(); + if (!indexAt(d->pressedPosition).isValid()) + d->pressedPosition = visualRect(oldCurrent).center() + d->offset(); QRect rect(d->pressedPosition - d->offset(), visualRect(newCurrent).center()); setSelection(rect, command); } else { diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 7831893..32502db 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -131,9 +131,9 @@ private: about the gesture is contained in the signal sender object. */ -/*! \fn void QGesture::cancelled() +/*! \fn void QGesture::canceled() - The signal is emitted when the gesture is cancelled, for example the + The signal is emitted when the gesture is canceled, for example the reset() function is called while the gesture was in the process of emitting a triggered() signal. Extended information about the gesture is contained in the sender object. @@ -230,7 +230,7 @@ Qt::GestureState QGesture::state() const \a state, and it should be called after all the internal properties have been initialized. - \sa started(), triggered(), finished(), cancelled() + \sa started(), triggered(), finished(), canceled() */ void QGesture::updateState(Qt::GestureState state) { @@ -258,7 +258,7 @@ void QGesture::updateState(Qt::GestureState state) else if (state == Qt::GestureFinished) emit finished(); else if (state == Qt::NoGesture) - emit cancelled(); + emit canceled(); if (state == Qt::GestureFinished) { // gesture is finished, so we reset the internal state. @@ -301,7 +301,7 @@ QGraphicsItem* QGesture::graphicsItem() const Resets the internal state of the gesture. This function might be called by the filterEvent() implementation in a derived class, or by the user to cancel a gesture. The base class implementation calls - updateState(Qt::NoGesture) which emits the cancelled() + updateState(Qt::NoGesture) which emits the canceled() signal if the state() of the gesture indicated it was active. */ void QGesture::reset() diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index ee6f8b3..23c64b2 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -90,7 +90,7 @@ Q_SIGNALS: void started(); void triggered(); void finished(); - void cancelled(); + void canceled(); private: friend class QWidget; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index ab192c5..e9b1bd3 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -4953,15 +4953,18 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void * if (modeSource && coverage == 255) { // Copy the first texture block - length = image_width; + length = qMin(image_width,length); + int tx = x; while (length) { int l = qMin(image_width - sx, length); if (buffer_size < l) l = buffer_size; - DST *dest = ((DST*)data->rasterBuffer->scanLine(spans->y)) + x; + DST *dest = ((DST*)data->rasterBuffer->scanLine(spans->y)) + tx; const SRC *src = (SRC*)data->texture.scanLine(sy) + sx; + qt_memconvert<DST, SRC>(dest, src, l); length -= l; + tx += l; sx = 0; } @@ -4971,8 +4974,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void * // We are dealing with one block of data // - More likely to fit in the cache // - can use memcpy - int copy_image_width = image_width; - length = spans->len - image_width; + int copy_image_width = qMin(image_width, int(spans->len)); + length = spans->len - copy_image_width; DST *src = ((DST*)data->rasterBuffer->scanLine(spans->y)) + x; DST *dest = src + copy_image_width; while (copy_image_width < length) { diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 7fefb19..817401e 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5126,6 +5126,9 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = Qt::LinksAccessibleByMouse; break; case SH_DialogButtonBox_ButtonsHaveIcons: +#ifdef Q_WS_X11 + return true; +#endif ret = 0; break; case SH_SpellCheckUnderlineStyle: @@ -5222,6 +5225,19 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { switch (sp) { + case SP_DialogYesButton: + case SP_DialogOkButton: + pixmap = QIcon::fromTheme(QLatin1String("dialog-ok")).pixmap(16); + break; + case SP_DialogApplyButton: + pixmap = QIcon::fromTheme(QLatin1String("dialog-ok-apply")).pixmap(16); + break; + case SP_DialogDiscardButton: + pixmap = QIcon::fromTheme(QLatin1String("edit-delete")).pixmap(16); + break; + case SP_DialogCloseButton: + pixmap = QIcon::fromTheme(QLatin1String("dialog-close")).pixmap(16); + break; case SP_DirHomeIcon: pixmap = QIcon::fromTheme(QLatin1String("user-home")).pixmap(16); break; @@ -5336,13 +5352,15 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti case SP_DialogHelpButton: pixmap = QIcon::fromTheme(QLatin1String("help-contents")).pixmap(24); break; + case SP_DialogNoButton: case SP_DialogCancelButton: - pixmap = QIcon::fromTheme(QLatin1String("process-stop")).pixmap(24); + pixmap = QIcon::fromTheme(QLatin1String("dialog-cancel"), + QIcon::fromTheme(QLatin1String("process-stop"))).pixmap(24); break; case SP_DialogSaveButton: pixmap = QIcon::fromTheme(QLatin1String("document-save")).pixmap(24); break; - case SP_FileLinkIcon: + case SP_FileLinkIcon: pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16); if (!pixmap.isNull()) { QPixmap fileIcon = QIcon::fromTheme(QLatin1String("text-x-generic")).pixmap(16); @@ -5530,6 +5548,25 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons case SP_DirOpenIcon: icon = QIcon::fromTheme(QLatin1String("folder-open")); break; + case SP_DialogSaveButton: + icon = QIcon::fromTheme(QLatin1String("document-save")); + break; + case SP_DialogApplyButton: + icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply")); + break; + case SP_DialogYesButton: + case SP_DialogOkButton: + icon = QIcon::fromTheme(QLatin1String("dialog-ok")); + break; + case SP_DialogDiscardButton: + icon = QIcon::fromTheme(QLatin1String("edit-delete")); + break; + case SP_DialogResetButton: + icon = QIcon::fromTheme(QLatin1String("edit-clear")); + break; + case SP_DialogHelpButton: + icon = QIcon::fromTheme(QLatin1String("help-contents")); + break; case SP_FileIcon: icon = QIcon::fromTheme(QLatin1String("text-x-generic")); break; @@ -5575,21 +5612,13 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons case SP_ArrowLeft: icon = QIcon::fromTheme(QLatin1String("go-previous")); break; - case SP_DialogHelpButton: - icon = QIcon::fromTheme(QLatin1String("help-contents")); - break; case SP_DialogCancelButton: - icon = QIcon::fromTheme(QLatin1String("process-stop")); + icon = QIcon::fromTheme(QLatin1String("dialog-cancel"), + QIcon::fromTheme(QLatin1String("process-stop"))); break; case SP_DialogCloseButton: icon = QIcon::fromTheme(QLatin1String("window-close")); break; - case SP_DialogApplyButton: - icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply")); - break; - case SP_DialogOkButton: - icon = QIcon::fromTheme(QLatin1String("dialog-ok")); - break; case SP_FileDialogDetailedView: icon = QIcon::fromTheme(QLatin1String("view-list-details")); break; @@ -5629,9 +5658,6 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons case SP_MediaVolumeMuted: icon = QIcon::fromTheme(QLatin1String("audio-volume-muted")); break; - case SP_DialogResetButton: - icon = QIcon::fromTheme(QLatin1String("edit-clear")); - break; case SP_ArrowForward: if (rtl) return standardIconImplementation(SP_ArrowLeft, option, widget); diff --git a/src/gui/styles/qmotifstyle.cpp b/src/gui/styles/qmotifstyle.cpp index 3550408..904a8f56 100644 --- a/src/gui/styles/qmotifstyle.cpp +++ b/src/gui/styles/qmotifstyle.cpp @@ -2683,6 +2683,9 @@ QMotifStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *w case SH_LineEdit_PasswordCharacter: ret = '*'; break; + case SH_DialogButtonBox_ButtonsHaveIcons: + ret = 0; + break; default: ret = QCommonStyle::styleHint(hint, opt, widget, returnData); break; diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 8250013..bdd72b7 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -5435,6 +5435,11 @@ int QPlastiqueStyle::styleHint(StyleHint hint, const QStyleOption *option, const case SH_Menu_SubMenuPopupDelay: ret = 96; // from Plastik break; +#ifdef Q_WS_X11 + case SH_DialogButtonBox_ButtonsHaveIcons: + ret = true; + break; +#endif #ifndef Q_OS_WIN case SH_Menu_AllowActiveAndDisabled: ret = false; diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 31f96c3..2a88578 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -1206,6 +1206,9 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid case SH_ItemView_ArrowKeysNavigateIntoChildren: ret = true; break; + case SH_DialogButtonBox_ButtonsHaveIcons: + ret = 0; + break; default: ret = QCommonStyle::styleHint(hint, opt, widget, returnData); break; diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index f252444..a38f276 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -1171,7 +1171,7 @@ static void parseShorthandFontProperty(const QVector<Value> &values, QFont *font { font->setStyle(QFont::StyleNormal); font->setWeight(QFont::Normal); - *fontSizeAdjustment = 0; + *fontSizeAdjustment = -255; int i = 0; while (i < values.count()) { diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index aa67677..9e0c5f8 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -207,9 +207,10 @@ QGLSignalProxy *QGLSignalProxy::instance() \i \link setSampleBuffers() Multisample buffers.\endlink \endlist - You can also specify preferred bit depths for the depth buffer, - alpha buffer, accumulation buffer and the stencil buffer with the - functions: setDepthBufferSize(), setAlphaBufferSize(), + You can also specify preferred bit depths for the color buffer, + depth buffer, alpha buffer, accumulation buffer and the stencil + buffer with the functions: setRedBufferSize(), setGreenBufferSize(), + setBlueBufferSize(), setDepthBufferSize(), setAlphaBufferSize(), setAccumBufferSize() and setStencilBufferSize(). Note that even if you specify that you prefer a 32 bit depth @@ -293,19 +294,20 @@ static inline GLint qgluProject(GLdouble objx, GLdouble objy, GLdouble objz, } /*! - Constructs a QGLFormat object with the factory default settings: + Constructs a QGLFormat object with the following default settings: \list \i \link setDoubleBuffer() Double buffer:\endlink Enabled. \i \link setDepth() Depth buffer:\endlink Enabled. \i \link setRgba() RGBA:\endlink Enabled (i.e., color index disabled). \i \link setAlpha() Alpha channel:\endlink Disabled. \i \link setAccum() Accumulator buffer:\endlink Disabled. - \i \link setStencil() Stencil buffer:\endlink Disabled. + \i \link setStencil() Stencil buffer:\endlink Enabled. \i \link setStereo() Stereo:\endlink Disabled. \i \link setDirectRendering() Direct rendering:\endlink Enabled. \i \link setOverlay() Overlay:\endlink Disabled. \i \link setPlane() Plane:\endlink 0 (i.e., normal plane). - \i \link setSampleBuffers() Multisample buffers:\endlink Disabled. + \i \link setSampleBuffers() Multisample buffers:\endlink Enabled on + OpenGL/ES 2.0, disabled on other platforms. \endlist */ @@ -316,26 +318,26 @@ QGLFormat::QGLFormat() /*! - Creates a QGLFormat object that is a copy of the current \link - defaultFormat() application default format\endlink. + Creates a QGLFormat object that is a copy of the current + defaultFormat(). - If \a options is not 0, this copy is modified by these format - options. The \a options parameter should be \c FormatOption values - OR'ed together. + If \a options is not 0, the default format is modified by the + specified format options. The \a options parameter should be + QGL::FormatOption values OR'ed together. This constructor makes it easy to specify a certain desired format in classes derived from QGLWidget, for example: \snippet doc/src/snippets/code/src_opengl_qgl.cpp 3 - Note that there are \c FormatOption values to turn format settings - both on and off, e.g. \c DepthBuffer and \c NoDepthBuffer, - \c DirectRendering and \c IndirectRendering, etc. + Note that there are QGL::FormatOption values to turn format settings + both on and off, e.g. QGL::DepthBuffer and QGL::NoDepthBuffer, + QGL::DirectRendering and QGL::IndirectRendering, etc. The \a plane parameter defaults to 0 and is the plane which this format should be associated with. Not all OpenGL implementations supports overlay/underlay rendering planes. - \sa defaultFormat(), setOption() + \sa defaultFormat(), setOption(), setPlane() */ QGLFormat::QGLFormat(QGL::FormatOptions options, int plane) @@ -742,7 +744,7 @@ void QGLFormat::setOverlay(bool enable) is 0, which means the normal plane. The default for overlay formats is 1, which is the first overlay plane. - \sa setPlane() + \sa setPlane(), defaultOverlayFormat() */ int QGLFormat::plane() const { @@ -1225,7 +1227,7 @@ void QGLFormat::setDefaultFormat(const QGLFormat &f) /*! Returns the default QGLFormat for overlay contexts. - The factory default overlay format is: + The default overlay format is: \list \i \link setDoubleBuffer() Double buffer:\endlink Disabled. \i \link setDepth() Depth buffer:\endlink Disabled. @@ -1236,6 +1238,7 @@ void QGLFormat::setDefaultFormat(const QGLFormat &f) \i \link setStereo() Stereo:\endlink Disabled. \i \link setDirectRendering() Direct rendering:\endlink Enabled. \i \link setOverlay() Overlay:\endlink Disabled. + \i \link setSampleBuffers() Multisample buffers:\endlink Disabled. \i \link setPlane() Plane:\endlink 1 (i.e., first overlay plane). \endlist diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 0d72469..daac760 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -408,7 +408,7 @@ private: Q_DISABLE_COPY(QGLContext) }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions); +Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions) class Q_OPENGL_EXPORT QGLWidget : public QWidget { diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 94e3930..452f155 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); -#define QGL_FUNC_CONTEXT QGLContext *ctx = d_ptr->ctx; +#define QGL_FUNC_CONTEXT QGLContextGroup *ctx = d_ptr->ctx; #define QT_CHECK_GLERROR() \ { \ @@ -74,9 +74,34 @@ extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); } \ } +#ifndef QT_OPENGL_ES +#define DEFAULT_FORMAT GL_RGBA8 +#else +#define DEFAULT_FORMAT GL_RGBA +#endif + class QGLFramebufferObjectFormatPrivate { public: + QGLFramebufferObjectFormatPrivate() + : ref(1), + samples(0), + attachment(QGLFramebufferObject::NoAttachment), + target(GL_TEXTURE_2D), + internal_format(DEFAULT_FORMAT) + { + } + QGLFramebufferObjectFormatPrivate + (const QGLFramebufferObjectFormatPrivate *other) + : ref(1), + samples(other->samples), + attachment(other->attachment), + target(other->target), + internal_format(other->internal_format) + { + } + + QAtomicInt ref; int samples; QGLFramebufferObject::Attachment attachment; GLenum target; @@ -109,6 +134,20 @@ public: */ /*! + \internal +*/ +void QGLFramebufferObjectFormat::detach() +{ + if (d->ref != 1) { + QGLFramebufferObjectFormatPrivate *newd + = new QGLFramebufferObjectFormatPrivate(d); + if (!d->ref.deref()) + delete d; + d = newd; + } +} + +/*! Creates a QGLFramebufferObjectFormat object for specifying the format of an OpenGL framebuffer object. @@ -118,19 +157,9 @@ public: \sa samples(), attachment(), target(), internalTextureFormat() */ -#ifndef QT_OPENGL_ES -#define DEFAULT_FORMAT GL_RGBA8 -#else -#define DEFAULT_FORMAT GL_RGBA -#endif - QGLFramebufferObjectFormat::QGLFramebufferObjectFormat() { d = new QGLFramebufferObjectFormatPrivate; - d->samples = 0; - d->attachment = QGLFramebufferObject::NoAttachment; - d->target = GL_TEXTURE_2D; - d->internal_format = DEFAULT_FORMAT; } /*! @@ -139,8 +168,8 @@ QGLFramebufferObjectFormat::QGLFramebufferObjectFormat() QGLFramebufferObjectFormat::QGLFramebufferObjectFormat(const QGLFramebufferObjectFormat &other) { - d = new QGLFramebufferObjectFormatPrivate; - *d = *other.d; + d = other.d; + d->ref.ref(); } /*! @@ -149,7 +178,12 @@ QGLFramebufferObjectFormat::QGLFramebufferObjectFormat(const QGLFramebufferObjec QGLFramebufferObjectFormat &QGLFramebufferObjectFormat::operator=(const QGLFramebufferObjectFormat &other) { - *d = *other.d; + if (d != other.d) { + other.d->ref.ref(); + if (!d->ref.deref()) + delete d; + d = other.d; + } return *this; } @@ -158,7 +192,8 @@ QGLFramebufferObjectFormat &QGLFramebufferObjectFormat::operator=(const QGLFrame */ QGLFramebufferObjectFormat::~QGLFramebufferObjectFormat() { - delete d; + if (!d->ref.deref()) + delete d; } /*! @@ -176,6 +211,7 @@ QGLFramebufferObjectFormat::~QGLFramebufferObjectFormat() */ void QGLFramebufferObjectFormat::setSamples(int samples) { + detach(); d->samples = samples; } @@ -197,6 +233,7 @@ int QGLFramebufferObjectFormat::samples() const */ void QGLFramebufferObjectFormat::setAttachment(QGLFramebufferObject::Attachment attachment) { + detach(); d->attachment = attachment; } @@ -219,6 +256,7 @@ QGLFramebufferObject::Attachment QGLFramebufferObjectFormat::attachment() const */ void QGLFramebufferObjectFormat::setTextureTarget(GLenum target) { + detach(); d->target = target; } @@ -242,6 +280,7 @@ GLenum QGLFramebufferObjectFormat::textureTarget() const */ void QGLFramebufferObjectFormat::setInternalTextureFormat(GLenum internalTextureFormat) { + detach(); d->internal_format = internalTextureFormat; } @@ -260,12 +299,14 @@ GLenum QGLFramebufferObjectFormat::internalTextureFormat() const /*! \internal */ void QGLFramebufferObjectFormat::setTextureTarget(QMacCompatGLenum target) { + detach(); d->target = target; } /*! \internal */ void QGLFramebufferObjectFormat::setInternalTextureFormat(QMacCompatGLenum internalTextureFormat) { + detach(); d->internal_format = internalTextureFormat; } #endif @@ -288,7 +329,7 @@ public: QGLFramebufferObjectFormat format; uint valid : 1; QGLFramebufferObject::Attachment fbo_attachment; - QGLContext *ctx; // for Windows extension ptrs + QGLContextGroup *ctx; // for Windows extension ptrs GLuint previous_fbo; mutable QPaintEngine *engine; }; @@ -340,9 +381,10 @@ bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::Attachment attachment, GLenum texture_target, GLenum internal_format, GLint samples) { - ctx = const_cast<QGLContext *>(QGLContext::currentContext()); + QGLContext *currentContext = const_cast<QGLContext *>(QGLContext::currentContext()); + ctx = QGLContextPrivate::contextGroup(currentContext); bool ext_detected = (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject); - if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(ctx))) + if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(currentContext))) return; size = sz; @@ -466,7 +508,7 @@ void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::At fbo_attachment = QGLFramebufferObject::NoAttachment; } - glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo); + glBindFramebuffer(GL_FRAMEBUFFER_EXT, currentContext->d_ptr->current_fbo); if (!valid) { if (color_buffer) glDeleteRenderbuffers(1, &color_buffer); @@ -736,16 +778,19 @@ QGLFramebufferObject::~QGLFramebufferObject() delete d->engine; - if (isValid() - && (d->ctx == QGLContext::currentContext() - || qgl_share_reg()->checkSharing(d->ctx, QGLContext::currentContext()))) - { + if (isValid()) { + const QGLContext *oldContext = QGLContext::currentContext(); + bool switchContext = !oldContext || QGLContextPrivate::contextGroup(oldContext) != ctx; + if (switchContext) + const_cast<QGLContext *>(ctx->context())->makeCurrent(); glDeleteTextures(1, &d->texture); if (d->color_buffer) glDeleteRenderbuffers(1, &d->color_buffer); if (d->depth_stencil_buffer) glDeleteRenderbuffers(1, &d->depth_stencil_buffer); glDeleteFramebuffers(1, &d->fbo); + if (oldContext && switchContext) + const_cast<QGLContext *>(oldContext)->makeCurrent(); } } @@ -867,7 +912,7 @@ QSize QGLFramebufferObject::size() const /*! Returns the format of this framebuffer object. */ -const QGLFramebufferObjectFormat &QGLFramebufferObject::format() const +QGLFramebufferObjectFormat QGLFramebufferObject::format() const { Q_D(const QGLFramebufferObject); return d->format; @@ -897,7 +942,7 @@ QImage QGLFramebufferObject::toImage() const bool wasBound = isBound(); if (!wasBound) const_cast<QGLFramebufferObject *>(this)->bind(); - QImage image = qt_gl_read_framebuffer(d->size, d->ctx->format().alpha(), true); + QImage image = qt_gl_read_framebuffer(d->size, format().textureTarget() != GL_RGB, true); if (!wasBound) const_cast<QGLFramebufferObject *>(this)->release(); @@ -969,16 +1014,14 @@ bool QGLFramebufferObject::hasOpenGLFramebufferObjects() */ void QGLFramebufferObject::drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget) { - Q_D(QGLFramebufferObject); - d->ctx->drawTexture(target, textureId, textureTarget); + const_cast<QGLContext *>(QGLContext::currentContext())->drawTexture(target, textureId, textureTarget); } #ifdef Q_MAC_COMPAT_GL_FUNCTIONS /*! \internal */ void QGLFramebufferObject::drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget) { - Q_D(QGLFramebufferObject); - d->ctx->drawTexture(target, textureId, textureTarget); + const_cast<QGLContext *>(QGLContext::currentContext())->drawTexture(target, textureId, textureTarget); } #endif @@ -994,16 +1037,14 @@ void QGLFramebufferObject::drawTexture(const QRectF &target, QMacCompatGLuint te */ void QGLFramebufferObject::drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget) { - Q_D(QGLFramebufferObject); - d->ctx->drawTexture(point, textureId, textureTarget); + const_cast<QGLContext *>(QGLContext::currentContext())->drawTexture(point, textureId, textureTarget); } #ifdef Q_MAC_COMPAT_GL_FUNCTIONS /*! \internal */ void QGLFramebufferObject::drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget) { - Q_D(QGLFramebufferObject); - d->ctx->drawTexture(point, textureId, textureTarget); + const_cast<QGLContext *>(QGLContext::currentContext())->drawTexture(point, textureId, textureTarget); } #endif @@ -1100,7 +1141,7 @@ QGLFramebufferObject::Attachment QGLFramebufferObject::attachment() const bool QGLFramebufferObject::isBound() const { Q_D(const QGLFramebufferObject); - return d->ctx->d_ptr->current_fbo == d->fbo; + return QGLContext::currentContext()->d_ptr->current_fbo == d->fbo; } /*! diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h index ec1ae7d..6c1c0be 100644 --- a/src/opengl/qglframebufferobject.h +++ b/src/opengl/qglframebufferobject.h @@ -93,7 +93,7 @@ public: virtual ~QGLFramebufferObject(); - const QGLFramebufferObjectFormat &format() const; + QGLFramebufferObjectFormat format() const; bool isValid() const; bool isBound() const; @@ -161,6 +161,8 @@ public: private: QGLFramebufferObjectFormatPrivate *d; + + void detach(); }; QT_END_NAMESPACE diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp index 333a415..13bc6a6 100644 --- a/src/script/api/qscriptengineagent.cpp +++ b/src/script/api/qscriptengineagent.cpp @@ -146,11 +146,7 @@ void QScriptEngineAgentPrivate::returnEvent(const JSC::DebuggerCallFrame& frame, { Q_UNUSED(frame); Q_UNUSED(lineno); -#if ENABLE(JIT) - functionExit(JSC::JSValue(), sourceID); -#else Q_UNUSED(sourceID); -#endif } void QScriptEngineAgentPrivate::exceptionThrow(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, bool hasHandler) diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp index 6187e6b..7bbe122 100644 --- a/src/sql/drivers/db2/qsql_db2.cpp +++ b/src/sql/drivers/db2/qsql_db2.cpp @@ -908,8 +908,9 @@ bool QDB2Result::fetchFirst() SQL_FETCH_FIRST, 0); if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) { - setLastError(qMakeError(QCoreApplication::translate("QDB2Result", "Unable to fetch first"), - QSqlError::StatementError, d)); + if(r!= SQL_NO_DATA) + setLastError(qMakeError(QCoreApplication::translate("QDB2Result", "Unable to fetch first"), + QSqlError::StatementError, d)); return false; } setAt(0); diff --git a/src/src.pro b/src/src.pro index 780e56e..240e1f7 100644 --- a/src/src.pro +++ b/src/src.pro @@ -120,7 +120,8 @@ src_webkit.target = sub-webkit src_tools_activeqt.depends = src_tools_idc src_gui src_plugins.depends = src_gui src_sql src_svg contains(QT_CONFIG, webkit) { - src_webkit.depends = src_gui src_sql src_network src_xml src_phonon + src_webkit.depends = src_gui src_sql src_network src_xml + contains(QT_CONFIG, phonon):src_webkit.depends += src_phonon #exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): src_webkit.depends += src_javascriptcore } contains(QT_CONFIG, qt3support): src_plugins.depends += src_qt3support diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index e2c3d92..35b8595 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -810,24 +810,27 @@ static bool resolveColor(const QStringRef &colorStr, QColor &color, QSvgHandler case 'r': { - // starts with "rgb(" - if (colorStrTr == QLatin1String("rgb(")) { + // starts with "rgb(", ends with ")" and consists of at least 7 characters "rgb(,,)" + if (colorStrTr.length() >= 7 && colorStrTr.at(colorStrTr.length() - 1) == QLatin1Char(')') + && QStringRef(colorStrTr.string(), colorStrTr.position(), 4) == QLatin1String("rgb(")) { const QChar *s = colorStrTr.constData() + 4; QVector<qreal> compo = parseNumbersList(s); //1 means that it failed after reaching non-parsable //character which is going to be "%" if (compo.size() == 1) { - const QChar *s = colorStrTr.constData() + 4; + s = colorStrTr.constData() + 4; compo = parsePercentageList(s); - compo[0] *= (qreal)2.55; - compo[1] *= (qreal)2.55; - compo[2] *= (qreal)2.55; + for (int i = 0; i < compo.size(); ++i) + compo[i] *= (qreal)2.55; } - color = QColor(int(compo[0]), - int(compo[1]), - int(compo[2])); - return true; + if (compo.size() == 3) { + color = QColor(int(compo[0]), + int(compo[1]), + int(compo[2])); + return true; + } + return false; } } break; diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index 8b06a29..1ab7401 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -117,7 +117,7 @@ namespace QTest static const char *mouseActionNames[] = { "MousePress", "MouseRelease", "MouseClick", "MouseDClick", "MouseMove" }; QString warning = QString::fromLatin1("Mouse event \"%1\" not accepted by receiving widget"); - QTest::qWarn(warning.arg(mouseActionNames[static_cast<int>(action)]).toAscii().data()); + QTest::qWarn(warning.arg(QString::fromLatin1(mouseActionNames[static_cast<int>(action)])).toAscii().data()); } } |