diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-09-30 13:11:39 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-09-30 13:11:39 (GMT) |
commit | 7c33e0f95789af1f6c091db89581f8a26b10682d (patch) | |
tree | cb8faa2ab6ce19c85a8c0c90dc852db08375868e /src | |
parent | da935e9df4c63490a7d2a716236f1e781c2d75a6 (diff) | |
parent | c3ef2d3a6d9a6e35b05cbd8f370630d5dd85415e (diff) | |
download | Qt-7c33e0f95789af1f6c091db89581f8a26b10682d.zip Qt-7c33e0f95789af1f6c091db89581f8a26b10682d.tar.gz Qt-7c33e0f95789af1f6c091db89581f8a26b10682d.tar.bz2 |
Merge commit 'origin/4.6' into mmfphonon
Diffstat (limited to 'src')
72 files changed, 774 insertions, 399 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp index 4200023..76c8510 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp @@ -3084,6 +3084,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi #else newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, asObject(v)); #endif + Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount; ArgList args(thisRegister + 1, argCount - 1); @@ -3242,7 +3243,6 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, asObject(v)); #endif - Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount; ArgList args(thisRegister + 1, argCount - 1); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp index 0b147df..08a4493 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp @@ -2429,8 +2429,13 @@ DEFINE_STUB_FUNCTION(int, op_eq) goto start; } - if (src2.isObject()) - return asObject(cell1) == asObject(src2); + if (src2.isObject()) { + return asObject(cell1) == asObject(src2) +#ifdef QT_BUILD_SCRIPT_LIB + || asObject(cell1)->compareToObject(stackFrame.callFrame, asObject(src2)) +#endif + ; + } src1 = asObject(cell1)->toPrimitive(stackFrame.callFrame); CHECK_FOR_EXCEPTION(); goto start; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp index 05e3d7b..f7bda9e 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp @@ -46,7 +46,6 @@ #define DO_PROPERTYMAP_CONSTENCY_CHECK 0 #endif -using namespace std; using namespace WTF; namespace JSC { diff --git a/src/3rdparty/javascriptcore/VERSION b/src/3rdparty/javascriptcore/VERSION index ae70d26..edcf898 100644 --- a/src/3rdparty/javascriptcore/VERSION +++ b/src/3rdparty/javascriptcore/VERSION @@ -4,8 +4,8 @@ This is a snapshot of JavaScriptCore from The commit imported was from the - jsc-for-qtscript-4.6-staging-28092009 branch/tag + jsc-for-qtscript-4.6-staging-30092009 branch/tag and has the sha1 checksum - b98dec961e9389ddd5e10d7c4086de9a297cb984 + e8f42cf0203bee0ba89a05e0e773d713782129b4 diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index 4acaaa4..9843a6c 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -17,6 +17,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. */ #include <QObject> +#include <QCoreApplication> #include <AudioEqualizerBase.h> #include <BassBoostBase.h> @@ -57,21 +58,21 @@ QHash<QByteArray, QVariant> EffectFactory::audioEffectDescriptions(AbstractAudio switch (type) { case AbstractAudioEffect::EffectAudioEqualizer: - return constructEffectDescription(QObject::tr("audio equalizer"), "Audio equalizer."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "audio equalizer"), "Audio equalizer."); case AbstractAudioEffect::EffectBassBoost: - return constructEffectDescription(QObject::tr("Bass boost"), "Bass boost."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Bass boost"), "Bass boost."); case AbstractAudioEffect::EffectDistanceAttenuation: - return constructEffectDescription(QObject::tr("Distance Attenuation"), "Distance Attenuation."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Distance Attenuation"), "Distance Attenuation."); case AbstractAudioEffect::EffectEnvironmentalReverb: - return constructEffectDescription(QObject::tr("Environmental Reverb"), "Environmental Reverb."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Environmental Reverb"), "Environmental Reverb."); case AbstractAudioEffect::EffectListenerOrientation: - return constructEffectDescription(QObject::tr("Environmental Reverb"), "Environmental Reverb."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Environmental Reverb"), "Environmental Reverb."); case AbstractAudioEffect::EffectLoudness: - return constructEffectDescription(QObject::tr("Loudness"), "Loudness."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Loudness"), "Loudness."); case AbstractAudioEffect::EffectSourceOrientation: - return constructEffectDescription(QObject::tr("Source Orientation"), "Source Orientation."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Source Orientation"), "Source Orientation."); case AbstractAudioEffect::EffectStereoWidening: - return constructEffectDescription(QObject::tr("Stereo Widening"), "Stereo Widening."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Stereo Widening"), "Stereo Widening."); } Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown effect type."); diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index bca9baa..02a1586 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -5,6 +5,7 @@ HEADERS += \ io/qabstractfileengine_p.h \ io/qbuffer.h \ io/qdatastream.h \ + io/qdatastream_p.h \ io/qdebug.h \ io/qdir.h \ io/qdiriterator.h \ diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index 9339b8e..cc62201 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qdatastream.h" +#include "qdatastream_p.h" #ifndef QT_NO_DATASTREAM #include "qbuffer.h" @@ -193,6 +194,21 @@ QT_BEGIN_NAMESPACE */ /*! + \enum QDataStream::FloatingPointPrecision + + The precision of floating point numbers used for reading/writing the data. This will only have + an effect if the version of the data stream is Qt_4_6 or higher. + + \warning The floating point precision must be set to the same value on the object that writes + and the object that reads the data stream. + + \value SinglePrecision All floating point numbers in the data stream have 32-bit precision. + \value DoublePrecision All floating point numbers in the data stream have 64-bit precision. + + \sa setFloatingPointPrecision(), floatingPointPrecision() +*/ + +/*! \enum QDataStream::Status This enum describes the current status of the data stream. @@ -222,7 +238,7 @@ QT_BEGIN_NAMESPACE #endif enum { - DefaultStreamVersion = QDataStream::Qt_4_5 + DefaultStreamVersion = QDataStream::Qt_4_6 }; // ### 5.0: when streaming invalid QVariants, just the type should @@ -414,6 +430,42 @@ bool QDataStream::atEnd() const } /*! + Returns the floating point precision of the data stream. + + \since 4.6 + + \sa FloatingPointPrecision setFloatingPointPrecision() +*/ +QDataStream::FloatingPointPrecision QDataStream::floatingPointPrecision() const +{ + return d == 0 ? QDataStream::DoublePrecision : d->floatingPointPrecision; +} + +/*! + Sets the floating point precision of the data stream. If the floating point precision is + DoublePrecision and the version of the data stream is Qt_4_6 or higher, all floating point + numbers will be written and read with 64-bit precision. If the floating point precision is + SinglePrecision and the version is Qt_4_6 or higher, all floating point numbers will be written + and read with 32-bit precision. + + For versions prior to Qt_4_6, the precision of floating point numbers in the data stream depends + on the stream operator called. + + The default is DoublePrecision. + + \warning This property must be set to the same value on the object that writes and the object + that reads the data stream. + + \since 4.6 +*/ +void QDataStream::setFloatingPointPrecision(QDataStream::FloatingPointPrecision precision) +{ + if (d == 0) + d.reset(new QDataStreamPrivate()); + d->floatingPointPrecision = precision; +} + +/*! Returns the status of the data stream. \sa Status setStatus() resetStatus() @@ -517,7 +569,7 @@ void QDataStream::setByteOrder(ByteOrder bo) \value Qt_4_3 Version 9 (Qt 4.3) \value Qt_4_4 Version 10 (Qt 4.4) \value Qt_4_5 Version 11 (Qt 4.5) - \omitvalue Qt_4_6 + \value Qt_4_6 Version 12 (Qt 4.6) \sa setVersion(), version() */ @@ -754,13 +806,23 @@ QDataStream &QDataStream::operator>>(bool &i) /*! \overload - Reads a 32-bit floating point number from the stream into \a f, + Reads a floating point number from the stream into \a f, using the standard IEEE 754 format. Returns a reference to the stream. + + \sa setFloatingPointPrecision() */ QDataStream &QDataStream::operator>>(float &f) -{ +{ + if (version() >= QDataStream::Qt_4_6 + && floatingPointPrecision() == QDataStream::DoublePrecision) { + double d; + *this >> d; + f = d; + return *this; + } + f = 0.0f; CHECK_STREAM_PRECOND(*this) if (noswap) { @@ -796,13 +858,23 @@ QDataStream &QDataStream::operator>>(float &f) /*! \overload - Reads a 64-bit floating point number from the stream into \a f, + Reads a floating point number from the stream into \a f, using the standard IEEE 754 format. Returns a reference to the stream. + + \sa setFloatingPointPrecision() */ QDataStream &QDataStream::operator>>(double &f) { + if (version() >= QDataStream::Qt_4_6 + && floatingPointPrecision() == QDataStream::SinglePrecision) { + float d; + *this >> d; + f = d; + return *this; + } + f = 0.0; CHECK_STREAM_PRECOND(*this) #ifndef Q_DOUBLE_FORMAT @@ -1115,12 +1187,20 @@ QDataStream &QDataStream::operator<<(bool i) /*! \overload - Writes a 32-bit floating point number, \a f, to the stream using + Writes a floating point number, \a f, to the stream using the standard IEEE 754 format. Returns a reference to the stream. + + \sa setFloatingPointPrecision() */ QDataStream &QDataStream::operator<<(float f) { + if (version() >= QDataStream::Qt_4_6 + && floatingPointPrecision() == QDataStream::DoublePrecision) { + *this << double(f); + return *this; + } + CHECK_STREAM_PRECOND(*this) float g = f; // fixes float-on-stack problem if (noswap) { // no conversion needed @@ -1146,12 +1226,20 @@ QDataStream &QDataStream::operator<<(float f) /*! \overload - Writes a 64-bit floating point number, \a f, to the stream using + Writes a floating point number, \a f, to the stream using the standard IEEE 754 format. Returns a reference to the stream. + + \sa setFloatingPointPrecision() */ QDataStream &QDataStream::operator<<(double f) { + if (version() >= QDataStream::Qt_4_6 + && floatingPointPrecision() == QDataStream::SinglePrecision) { + *this << float(f); + return *this; + } + CHECK_STREAM_PRECOND(*this) #ifndef Q_DOUBLE_FORMAT if (noswap) { diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h index b376de6..6e83204 100644 --- a/src/corelib/io/qdatastream.h +++ b/src/corelib/io/qdatastream.h @@ -42,6 +42,7 @@ #ifndef QDATASTREAM_H #define QDATASTREAM_H +#include <QtCore/qscopedpointer.h> #include <QtCore/qiodevice.h> #include <QtCore/qglobal.h> @@ -83,7 +84,7 @@ public: Qt_4_3 = 9, Qt_4_4 = 10, Qt_4_5 = 11, - Qt_4_6 = Qt_4_5 + Qt_4_6 = 12, #if QT_VERSION >= 0x040700 #error Add the datastream version for this Qt version Qt_4_7 = Qt_4_6 @@ -101,6 +102,11 @@ public: ReadCorruptData }; + enum FloatingPointPrecision { + SinglePrecision, + DoublePrecision + }; + QDataStream(); explicit QDataStream(QIODevice *); #ifdef QT3_SUPPORT @@ -123,6 +129,9 @@ public: void setStatus(Status status); void resetStatus(); + FloatingPointPrecision floatingPointPrecision() const; + void setFloatingPointPrecision(FloatingPointPrecision precision); + ByteOrder byteOrder() const; void setByteOrder(ByteOrder); @@ -176,7 +185,7 @@ public: private: Q_DISABLE_COPY(QDataStream) - QDataStreamPrivate *d; + QScopedPointer<QDataStreamPrivate> d; QIODevice *dev; bool owndev; diff --git a/src/corelib/io/qdatastream_p.h b/src/corelib/io/qdatastream_p.h new file mode 100644 index 0000000..157fee9 --- /dev/null +++ b/src/corelib/io/qdatastream_p.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDATASTREAM_P_H +#define QDATASTREAM_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <qdatastream.h> + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_DATASTREAM +class QDataStreamPrivate +{ +public: + QDataStreamPrivate() : floatingPointPrecision(QDataStream::DoublePrecision) { } + + QDataStream::FloatingPointPrecision floatingPointPrecision; +}; +#endif + +QT_END_NAMESPACE + +#endif // QDATASTREAM_P_H diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index face923..c9a4cf1 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -172,6 +172,8 @@ #include "private/qunicodetables_p.h" #include "qatomic.h" #include "qbytearray.h" +#include "qdir.h" +#include "qfile.h" #include "qlist.h" #ifndef QT_NO_REGEXP #include "qregexp.h" @@ -5547,6 +5549,79 @@ QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode parsingMode) } /*! + Returns a valid URL from a user supplied \a userInput string if one can be + deducted. In the case that is not possible, an invalid QUrl() is returned. + + \since 4.6 + + Most applications that can browse the web, allow the user to input a URL + in the form of a plain string. This string can be manually typed into + a location bar, obtained from the clipboard, or passed in via command + line arguments. + + When the string is not already a valid URL, a best guess is performed, + making various web related assumptions. + + In the case the string corresponds to a valid file path on the system, + a file:// URL is constructed, using QUrl::fromLocalFile(). + + If that is not the case, an attempt is made to turn the string into a + http:// or ftp:// URL. The latter in the case the string starts with + 'ftp'. The result is then passed through QUrl's tolerant parser, and + in the case or success, a valid QUrl is returned, or else a QUrl(). + + \section1 Examples: + + \list + \o qt.nokia.com becomes http://qt.nokia.com + \o ftp.qt.nokia.com becomes ftp://ftp.qt.nokia.com + \o localhost becomes http://localhost + \o /home/user/test.html becomes file:///home/user/test.html (if exists) + \endlist + + \section2 Tips to avoid erroneous character conversion when dealing with + URLs and strings: + + \list + \o When creating an URL QString from a QByteArray or a char*, always use + QString::fromUtf8(). + \o Favor the use of QUrl::fromEncoded() and QUrl::toEncoded() instead of + QUrl(string) and QUrl::toString() when converting QUrl to/from string. + \endlist +*/ +QUrl QUrl::fromUserInput(const QString &userInput) +{ + QString trimmedString = userInput.trimmed(); + + // Absolute files + if (QDir::isAbsolutePath(trimmedString)) + return QUrl::fromLocalFile(trimmedString); + + // Check the most common case of a valid url with scheme and host first + QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode); + if (url.isValid() && !url.scheme().isEmpty() && !url.host().isEmpty()) + return url; + + // If the string is missing the scheme or the scheme is not valid, prepend a scheme + QString scheme = url.scheme(); + if (scheme.isEmpty() || scheme.contains(QLatin1Char('.')) || scheme == QLatin1String("localhost")) { + // Do not do anything for strings such as "foo", only "foo.com" + int dotIndex = trimmedString.indexOf(QLatin1Char('.')); + if (dotIndex != -1 || trimmedString.startsWith(QLatin1String("localhost"))) { + const QString hostscheme = trimmedString.left(dotIndex).toLower(); + QByteArray scheme = (hostscheme == QLatin1String("ftp")) ? "ftp" : "http"; + trimmedString = QLatin1String(scheme) + QLatin1String("://") + trimmedString; + } + url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode); + } + + if (url.isValid()) + return url; + + return QUrl(); +} + +/*! Returns a decoded copy of \a input. \a input is first decoded from percent encoding, then converted from UTF-8 to unicode. */ diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index b00074a..f76d345 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -189,6 +189,8 @@ public: static QUrl fromEncoded(const QByteArray &url, ParsingMode mode); // ### Qt 5: merge the two fromEncoded() functions, with mode = TolerantMode + static QUrl fromUserInput(const QString &userInput); + void detach(); bool isDetached() const; diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 8d50870c..c7144e4 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -1265,11 +1265,13 @@ void QStateMachinePrivate::_q_process() break; case Finished: state = NotRunning; + cancelAllDelayedEvents(); unregisterAllTransitions(); emit q->finished(); break; case Stopped: state = NotRunning; + cancelAllDelayedEvents(); unregisterAllTransitions(); emit q->stopped(); break; @@ -1291,6 +1293,19 @@ void QStateMachinePrivate::processEvents(EventProcessingMode processingMode) } } +void QStateMachinePrivate::cancelAllDelayedEvents() +{ + Q_Q(QStateMachine); + QHash<int, QEvent*>::const_iterator it; + for (it = delayedEvents.constBegin(); it != delayedEvents.constEnd(); ++it) { + int id = it.key(); + QEvent *e = it.value(); + q->killTimer(id); + delete e; + } + delayedEvents.clear(); +} + namespace { class GoToStateTransition : public QAbstractTransition @@ -1587,6 +1602,18 @@ QStateMachine::~QStateMachine() { } +/*! + \enum QStateMachine::EventPriority + + This enum type specifies the priority of an event posted to the state + machine using postEvent(). + + Events of high priority are processed before events of normal priority. + + \value NormalPriority The event has normal priority. + \value HighPriority The event has high priority. +*/ + /*! \enum QStateMachine::Error This enum type defines errors that can occur in the state machine at run time. When the state @@ -1798,47 +1825,99 @@ void QStateMachine::stop() } /*! - Posts the given \a event for processing by this state machine, with a delay - of \a delay milliseconds. + Posts the given \a event of the given \a priority for processing by this + state machine. This function returns immediately. The event is added to the state machine's event queue. Events are processed in the order posted. The state machine takes ownership of the event and deletes it once it has been processed. You can only post events when the state machine is running. + + \sa postDelayedEvent() */ -void QStateMachine::postEvent(QEvent *event, int delay) +void QStateMachine::postEvent(QEvent *event, EventPriority priority) { Q_D(QStateMachine); if (d->state != QStateMachinePrivate::Running) { qWarning("QStateMachine::postEvent: cannot post event when the state machine is not running"); return; } + if (!event) { + qWarning("QStateMachine::postEvent: cannot post null event"); + return; + } #ifdef QSTATEMACHINE_DEBUG - qDebug() << this << ": posting external event" << event << "with delay" << delay; + qDebug() << this << ": posting event" << event; #endif - if (delay) { - int tid = startTimer(delay); - d->delayedEvents[tid] = event; - } else { + switch (priority) { + case NormalPriority: d->externalEventQueue.append(event); - d->processEvents(QStateMachinePrivate::QueuedProcessing); + break; + case HighPriority: + d->internalEventQueue.append(event); + break; } + d->processEvents(QStateMachinePrivate::QueuedProcessing); } /*! - \internal + Posts the given \a event for processing by this state machine, with the + given \a delay in milliseconds. Returns an identifier associated with the + delayed event, or -1 if the event could not be posted. - Posts the given internal \a event for processing by this state machine. + This function returns immediately. When the delay has expired, the event + will be added to the state machine's event queue for processing. The state + machine takes ownership of the event and deletes it once it has been + processed. + + You can only post events when the state machine is running. + + \sa cancelDelayedEvent(), postEvent() */ -void QStateMachine::postInternalEvent(QEvent *event) +int QStateMachine::postDelayedEvent(QEvent *event, int delay) { Q_D(QStateMachine); + if (d->state != QStateMachinePrivate::Running) { + qWarning("QStateMachine::postDelayedEvent: cannot post event when the state machine is not running"); + return -1; + } + if (!event) { + qWarning("QStateMachine::postDelayedEvent: cannot post null event"); + return -1; + } + if (delay < 0) { + qWarning("QStateMachine::postDelayedEvent: delay cannot be negative"); + return -1; + } #ifdef QSTATEMACHINE_DEBUG - qDebug() << this << ": posting internal event" << event; + qDebug() << this << ": posting event" << event << "with delay" << delay; #endif - d->internalEventQueue.append(event); - d->processEvents(QStateMachinePrivate::QueuedProcessing); + int tid = startTimer(delay); + d->delayedEvents[tid] = event; + return tid; +} + +/*! + Cancels the delayed event identified by the given \a id. The id should be a + value returned by a call to postDelayedEvent(). Returns true if the event + was successfully cancelled, otherwise returns false. + + \sa postDelayedEvent() +*/ +bool QStateMachine::cancelDelayedEvent(int id) +{ + Q_D(QStateMachine); + if (d->state != QStateMachinePrivate::Running) { + qWarning("QStateMachine::cancelDelayedEvent: the machine is not running"); + return false; + } + QEvent *e = d->delayedEvents.take(id); + if (!e) + return false; + killTimer(id); + delete e; + return true; } /*! @@ -1882,9 +1961,14 @@ bool QStateMachine::event(QEvent *e) if (e->type() == QEvent::Timer) { QTimerEvent *te = static_cast<QTimerEvent*>(e); int tid = te->timerId(); - if (d->delayedEvents.contains(tid)) { + if (d->state != QStateMachinePrivate::Running) { + // This event has been cancelled already + Q_ASSERT(!d->delayedEvents.contains(tid)); + return true; + } + QEvent *ee = d->delayedEvents.take(tid); + if (ee != 0) { killTimer(tid); - QEvent *ee = d->delayedEvents.take(tid); d->externalEventQueue.append(ee); d->processEvents(QStateMachinePrivate::DirectProcessing); return true; diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h index a0b2b14..321a05c 100644 --- a/src/corelib/statemachine/qstatemachine.h +++ b/src/corelib/statemachine/qstatemachine.h @@ -102,6 +102,11 @@ public: QEvent *m_event; }; + enum EventPriority { + NormalPriority, + HighPriority + }; + enum RestorePolicy { DoNotRestoreProperties, RestoreProperties @@ -138,7 +143,9 @@ public: QStateMachine::RestorePolicy globalRestorePolicy() const; void setGlobalRestorePolicy(QStateMachine::RestorePolicy restorePolicy); - void postEvent(QEvent *event, int delay = 0); + void postEvent(QEvent *event, EventPriority priority = NormalPriority); + int postDelayedEvent(QEvent *event, int delay); + bool cancelDelayedEvent(int id); QSet<QAbstractState*> configuration() const; @@ -158,8 +165,6 @@ protected: void onEntry(QEvent *event); void onExit(QEvent *event); - void postInternalEvent(QEvent *event); - virtual void beginSelectTransitions(QEvent *event); virtual void endSelectTransitions(QEvent *event); diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h index 141bc5c..cf7a073 100644 --- a/src/corelib/statemachine/qstatemachine_p.h +++ b/src/corelib/statemachine/qstatemachine_p.h @@ -160,6 +160,7 @@ public: void handleTransitionSignal(QObject *sender, int signalIndex, void **args); void processEvents(EventProcessingMode processingMode); + void cancelAllDelayedEvents(); #ifndef QT_NO_PROPERTIES typedef QPair<QObject *, QByteArray> RestorableId; diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index e1a0e06..efa39b5 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -198,6 +198,17 @@ template <int N> struct QConcatenable<char[N]> } }; +template <int N> struct QConcatenable<const char[N]> +{ + typedef const char type[N]; + static int size(const char[N]) { return N - 1; } + static inline void appendTo(const char a[N], QChar *&out) + { + for (int i = 0; i < N - 1; ++i) + *out++ = QLatin1Char(a[i]); + } +}; + template <> struct QConcatenable<const char *> { typedef char const *type; @@ -241,7 +252,7 @@ template <typename A, typename B> QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type> operator%(const A &a, const B &b) { - return QStringBuilder<A, B>(a, b); + return QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>(a, b); } #ifdef QT_USE_FAST_OPERATOR_PLUS @@ -249,7 +260,7 @@ template <typename A, typename B> QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type> operator+(const A &a, const B &b) { - return QStringBuilder<A, B>(a, b); + return QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>(a, b); } #endif diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 14f19f2..297c900 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -317,6 +317,7 @@ QFileDialog::QFileDialog(QWidget *parent, Qt::WindowFlags f) { Q_D(QFileDialog); d->init(); + d->lineEdit()->selectAll(); } /*! @@ -334,6 +335,7 @@ QFileDialog::QFileDialog(QWidget *parent, { Q_D(QFileDialog); d->init(directory, filter, caption); + d->lineEdit()->selectAll(); } /*! diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp index ca882c5..60fae27 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/gui/dialogs/qfontdialog.cpp @@ -602,6 +602,8 @@ void QFontDialogPrivate::updateStyles() } if (!found) styleList->setCurrentItem(0); + } else { + styleList->setCurrentItem(0); } styleEdit->setText(styleList->currentText()); diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index b3ebb2b..fdb1708 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -80,6 +80,24 @@ PM_LayoutHorizontalSpacing (or PM_LayoutVerticalSpacing for vertical anchors). */ +/*! + \class QGraphicsAnchor + \brief The QGraphicsAnchor class represents an anchor between two items in a + QGraphicsAnchorLayout. + \since 4.6 + \ingroup appearance + \ingroup geomanagement + \ingroup graphicsview-api + + The graphics anchor provides an API that enables you to query and manipulate the + properties an anchor has. When an anchor is added to the layout with + QGraphicsAnchorLayout::addAnchor(), a QGraphicsAnchor instance is returned where the properties + are initialized to their default values. The properties can then be further changed, and they + will be picked up the next time the layout is activated. + + \sa QGraphicsAnchorLayout::anchor() + +*/ #include "qgraphicsanchorlayout_p.h" QT_BEGIN_NAMESPACE @@ -288,18 +306,6 @@ void QGraphicsAnchorLayout::addAnchors(QGraphicsLayoutItem *firstItem, } /*! - Returns true if there are no arrangement that satisfies all constraints. - Otherwise returns false. - - \sa addAnchor() -*/ -bool QGraphicsAnchorLayout::hasConflicts() const -{ - Q_D(const QGraphicsAnchorLayout); - return d->hasConflicts(); -} - -/*! Sets the default horizontal spacing for the anchor layout to \a spacing. \sa horizontalSpacing(), setVerticalSpacing(), setSpacing() diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.h b/src/gui/graphicsview/qgraphicsanchorlayout.h index 44074d1..d9a87ba 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout.h @@ -93,7 +93,6 @@ public: QGraphicsLayoutItem *secondItem, Qt::Orientations orientations = Qt::Horizontal | Qt::Vertical); - bool hasConflicts() const; void setHorizontalSpacing(qreal spacing); void setVerticalSpacing(qreal spacing); void setSpacing(qreal spacing); diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 49aabf5..f75118b 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -2287,6 +2287,13 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(QList<QSimplexConstraint *> co return feasible; } +/*! + \internal + Returns true if there are no arrangement that satisfies all constraints. + Otherwise returns false. + + \sa addAnchor() +*/ bool QGraphicsAnchorLayoutPrivate::hasConflicts() const { QGraphicsAnchorLayoutPrivate *that = const_cast<QGraphicsAnchorLayoutPrivate*>(this); diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 4e1bcd4..c86bfa3 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -343,7 +343,7 @@ public: QGraphicsAnchorLayout private methods and attributes. */ -class QGraphicsAnchorLayoutPrivate : public QGraphicsLayoutPrivate +class Q_AUTOTEST_EXPORT QGraphicsAnchorLayoutPrivate : public QGraphicsLayoutPrivate { Q_DECLARE_PUBLIC(QGraphicsAnchorLayout) @@ -370,6 +370,11 @@ public: QGraphicsAnchorLayoutPrivate(); + static QGraphicsAnchorLayoutPrivate *get(QGraphicsAnchorLayout *q) + { + return q ? q->d_func() : 0; + } + static Qt::AnchorPoint oppositeEdge( Qt::AnchorPoint edge); diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index c3934c7..d7a7bd2 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -5140,14 +5140,8 @@ void QGraphicsItem::update(const QRectF &rect) } while ((item = item->d_ptr->parent)); if (CacheMode(d_ptr->cacheMode) != NoCache) { - QGraphicsItemCache *cache = d_ptr->extraItemCache(); - if (d_ptr->discardUpdateRequest(/* ignoreVisibleBit = */ false, - /* ignoreClipping = */ false, - /* ignoreDirtyBit = */ true)) { - return; - } - // Invalidate cache. + QGraphicsItemCache *cache = d_ptr->extraItemCache(); if (!cache->allExposed) { if (rect.isNull()) { cache->allExposed = true; @@ -5161,6 +5155,9 @@ void QGraphicsItem::update(const QRectF &rect) return; } + if (d_ptr->discardUpdateRequest()) + return; + if (d_ptr->scene) d_ptr->scene->d_func()->markDirty(this, rect); } diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 71d0cd1..992e754 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1472,6 +1472,7 @@ bool QApplication::s60EventFilter(TWsEvent * /* aEvent */) */ void QApplication::symbianHandleCommand(int command) { + QScopedLoopLevelCounter counter(d_func()->threadData); switch (command) { #ifdef Q_WS_S60 case EAknSoftkeyExit: { diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index fa2b22f..4396766 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -807,7 +807,7 @@ public: // internal inline void setWidget(QWidget *awidget) { _widget = awidget; } inline void setDeviceType(DeviceType adeviceType) { _deviceType = adeviceType; } - inline void setTouchPointStates(Qt::TouchPointStates touchPointStates) { _touchPointStates = touchPointStates; } + inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; } inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; } protected: diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index aec757f..b44ef7f 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -571,7 +571,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_Mac}, {QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, QApplicationPrivate::KB_All}, - {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Win}, + {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_S60}, {QKeySequence::Redo, 0, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Mac},//different priority from above {QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, QApplicationPrivate::KB_All}, {QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, QApplicationPrivate::KB_Mac}, @@ -600,7 +600,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QApplicationPrivate::KB_Win}, {QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, QApplicationPrivate::KB_KDE}, {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac}, - {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, + {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, {QKeySequence::Redo, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Mac}, //different priority from above {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Mac },//different priority from above diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 91f4163..45695d9 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -238,7 +238,7 @@ void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys) } if (needsExitButton) - QT_TRAP_THROWING(nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QObject::tr("Exit")))); + QT_TRAP_THROWING(nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QSoftKeyManager::tr("Exit")))); nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 08fe5b9..e2de148 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11454,6 +11454,10 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction) QWidget *targetWidget = 0; int shortestDistance = INT_MAX; foreach(QWidget *targetCandidate, QApplication::allWidgets()) { + + if (targetCandidate->focusProxy()) //skip if focus proxy set + continue; + const QRect targetCandidateRect = targetCandidate->rect().translated(targetCandidate->mapToGlobal(QPoint())); if ( targetCandidate != sourceWidget && targetCandidate->focusPolicy() & Qt::TabFocus diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index cfa3f2a..b32e00a 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -228,14 +228,14 @@ Q_INLINE_TEMPLATE QMatrix4x4::QMatrix4x4 (const QGenericMatrix<N, M, qreal>& matrix) { const qreal *values = matrix.constData(); - for (int col = 0; col < 4; ++col) { - for (int row = 0; row < 4; ++row) { - if (col < N && row < M) - m[col][row] = values[col * M + row]; - else if (col == row) - m[col][row] = 1.0f; + for (int matrixCol = 0; matrixCol < 4; ++matrixCol) { + for (int matrixRow = 0; matrixRow < 4; ++matrixRow) { + if (matrixCol < N && matrixRow < M) + m[matrixCol][matrixRow] = values[matrixCol * M + matrixRow]; + else if (matrixCol == matrixRow) + m[matrixCol][matrixRow] = 1.0f; else - m[col][row] = 0.0f; + m[matrixCol][matrixRow] = 0.0f; } } flagBits = General; @@ -246,14 +246,14 @@ QGenericMatrix<N, M, qreal> QMatrix4x4::toGenericMatrix() const { QGenericMatrix<N, M, qreal> result; qreal *values = result.data(); - for (int col = 0; col < N; ++col) { - for (int row = 0; row < M; ++row) { - if (col < 4 && row < 4) - values[col * M + row] = m[col][row]; - else if (col == row) - values[col * M + row] = 1.0f; + for (int matrixCol = 0; matrixCol < N; ++matrixCol) { + for (int matrixRow = 0; matrixRow < M; ++matrixRow) { + if (matrixCol < 4 && matrixRow < 4) + values[matrixCol * M + matrixRow] = m[matrixCol][matrixRow]; + else if (matrixCol == matrixRow) + values[matrixCol * M + matrixRow] = 1.0f; else - values[col * M + row] = 0.0f; + values[matrixCol * M + matrixRow] = 0.0f; } } return result; @@ -261,17 +261,17 @@ QGenericMatrix<N, M, qreal> QMatrix4x4::toGenericMatrix() const #endif -inline const qreal& QMatrix4x4::operator()(int row, int column) const +inline const qreal& QMatrix4x4::operator()(int aRow, int aColumn) const { - Q_ASSERT(row >= 0 && row < 4 && column >= 0 && column < 4); - return m[column][row]; + Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4); + return m[aColumn][aRow]; } -inline qreal& QMatrix4x4::operator()(int row, int column) +inline qreal& QMatrix4x4::operator()(int aRow, int aColumn) { - Q_ASSERT(row >= 0 && row < 4 && column >= 0 && column < 4); + Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4); flagBits = General; - return m[column][row]; + return m[aColumn][aRow]; } inline QVector4D QMatrix4x4::column(int index) const diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h index dd5dddc..7480a5c 100644 --- a/src/gui/math3d/qquaternion.h +++ b/src/gui/math3d/qquaternion.h @@ -138,7 +138,7 @@ private: inline QQuaternion::QQuaternion() : wp(1.0f), xp(0.0f), yp(0.0f), zp(0.0f) {} -inline QQuaternion::QQuaternion(qreal scalar, qreal xpos, qreal ypos, qreal zpos) : wp(scalar), xp(xpos), yp(ypos), zp(zpos) {} +inline QQuaternion::QQuaternion(qreal aScalar, qreal xpos, qreal ypos, qreal zpos) : wp(aScalar), xp(xpos), yp(ypos), zp(zpos) {} inline bool QQuaternion::isNull() const @@ -156,10 +156,10 @@ inline qreal QQuaternion::y() const { return qreal(yp); } inline qreal QQuaternion::z() const { return qreal(zp); } inline qreal QQuaternion::scalar() const { return qreal(wp); } -inline void QQuaternion::setX(qreal x) { xp = x; } -inline void QQuaternion::setY(qreal y) { yp = y; } -inline void QQuaternion::setZ(qreal z) { zp = z; } -inline void QQuaternion::setScalar(qreal scalar) { wp = scalar; } +inline void QQuaternion::setX(qreal aX) { xp = aX; } +inline void QQuaternion::setY(qreal aY) { yp = aY; } +inline void QQuaternion::setZ(qreal aZ) { zp = aZ; } +inline void QQuaternion::setScalar(qreal aScalar) { wp = aScalar; } inline QQuaternion QQuaternion::conjugate() const { @@ -274,14 +274,14 @@ inline bool qFuzzyCompare(const QQuaternion& q1, const QQuaternion& q2) #ifndef QT_NO_VECTOR3D -inline QQuaternion::QQuaternion(qreal scalar, const QVector3D& vector) - : wp(scalar), xp(vector.x()), yp(vector.y()), zp(vector.z()) {} +inline QQuaternion::QQuaternion(qreal aScalar, const QVector3D& aVector) + : wp(aScalar), xp(aVector.x()), yp(aVector.y()), zp(aVector.z()) {} -inline void QQuaternion::setVector(const QVector3D& vector) +inline void QQuaternion::setVector(const QVector3D& aVector) { - xp = vector.x(); - yp = vector.y(); - zp = vector.z(); + xp = aVector.x(); + yp = aVector.y(); + zp = aVector.z(); } inline QVector3D QQuaternion::vector() const @@ -291,17 +291,17 @@ inline QVector3D QQuaternion::vector() const #endif -inline void QQuaternion::setVector(qreal x, qreal y, qreal z) +inline void QQuaternion::setVector(qreal aX, qreal aY, qreal aZ) { - xp = x; - yp = y; - zp = z; + xp = aX; + yp = aY; + zp = aZ; } #ifndef QT_NO_VECTOR4D -inline QQuaternion::QQuaternion(const QVector4D& vector) - : wp(vector.w()), xp(vector.x()), yp(vector.y()), zp(vector.z()) {} +inline QQuaternion::QQuaternion(const QVector4D& aVector) + : wp(aVector.w()), xp(aVector.x()), yp(aVector.y()), zp(aVector.z()) {} inline QVector4D QQuaternion::toVector4D() const { diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h index 570e864..cd9a12c 100644 --- a/src/gui/math3d/qvector2d.h +++ b/src/gui/math3d/qvector2d.h @@ -144,8 +144,8 @@ inline bool QVector2D::isNull() const inline qreal QVector2D::x() const { return qreal(xp); } inline qreal QVector2D::y() const { return qreal(yp); } -inline void QVector2D::setX(qreal x) { xp = x; } -inline void QVector2D::setY(qreal y) { yp = y; } +inline void QVector2D::setX(qreal aX) { xp = aX; } +inline void QVector2D::setY(qreal aY) { yp = aY; } inline QVector2D &QVector2D::operator+=(const QVector2D &vector) { diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h index 1291c96..60bd693 100644 --- a/src/gui/math3d/qvector3d.h +++ b/src/gui/math3d/qvector3d.h @@ -160,9 +160,9 @@ inline qreal QVector3D::x() const { return qreal(xp); } inline qreal QVector3D::y() const { return qreal(yp); } inline qreal QVector3D::z() const { return qreal(zp); } -inline void QVector3D::setX(qreal x) { xp = x; } -inline void QVector3D::setY(qreal y) { yp = y; } -inline void QVector3D::setZ(qreal z) { zp = z; } +inline void QVector3D::setX(qreal aX) { xp = aX; } +inline void QVector3D::setY(qreal aY) { yp = aY; } +inline void QVector3D::setZ(qreal aZ) { zp = aZ; } inline QVector3D &QVector3D::operator+=(const QVector3D &vector) { diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h index ad0718a..c35b536 100644 --- a/src/gui/math3d/qvector4d.h +++ b/src/gui/math3d/qvector4d.h @@ -158,10 +158,10 @@ inline qreal QVector4D::y() const { return qreal(yp); } inline qreal QVector4D::z() const { return qreal(zp); } inline qreal QVector4D::w() const { return qreal(wp); } -inline void QVector4D::setX(qreal x) { xp = x; } -inline void QVector4D::setY(qreal y) { yp = y; } -inline void QVector4D::setZ(qreal z) { zp = z; } -inline void QVector4D::setW(qreal w) { wp = w; } +inline void QVector4D::setX(qreal aX) { xp = aX; } +inline void QVector4D::setY(qreal aY) { yp = aY; } +inline void QVector4D::setZ(qreal aZ) { zp = aZ; } +inline void QVector4D::setW(qreal aW) { wp = aW; } inline QVector4D &QVector4D::operator+=(const QVector4D &vector) { diff --git a/src/gui/s60framework/qs60mainapplication.h b/src/gui/s60framework/qs60mainapplication.h index 457764c..5f621e0 100644 --- a/src/gui/s60framework/qs60mainapplication.h +++ b/src/gui/s60framework/qs60mainapplication.h @@ -42,7 +42,7 @@ #ifndef QS60MAINAPPLICATION_H #define QS60MAINAPPLICATION_H -#include <qglobal.h> +#include <QtCore/qglobal.h> #ifdef Q_WS_S60 diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 1e57167..6bdb79e 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2397,8 +2397,6 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple // lets use spinbox frame here as well, as no combobox specific value available. const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0; const int buttonWidth = QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize); - const int xposMod = (cmb->rect.x()) + width - buttonMargin - buttonWidth; - const int ypos = cmb->rect.y(); QSize buttonSize; buttonSize.setHeight(qMax(8, (cmb->rect.height()>>1) - frameThickness)); //minimum of 8 pixels @@ -2406,15 +2404,18 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple buttonSize = buttonSize.expandedTo(QApplication::globalStrut()); switch (scontrol) { case SC_ComboBoxArrow: - ret.setRect(xposMod, ypos + buttonMargin, buttonWidth, height - 2*buttonMargin); + ret.setRect( + ret.x() + ret.width() - buttonMargin - buttonWidth, + ret.y() + buttonMargin, + buttonWidth, + height - 2*buttonMargin); break; case SC_ComboBoxEditField: { - const int withFrameX = cmb->rect.x() + cmb->rect.width() - frameThickness - buttonSize.width(); - ret = QRect( - frameThickness, - frameThickness, - withFrameX - frameThickness, - cmb->rect.height() - 2*frameThickness); + ret.setRect( + ret.x() + frameThickness, + ret.y() + frameThickness, + ret.width() - 2*frameThickness - buttonSize.width(), + ret.height() - 2*frameThickness); } break; default: diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index fd18bc3..6be3197 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -76,6 +76,9 @@ public: void unpolish(QWidget *widget); void polish(QApplication *application); void unpolish(QApplication *application); +#ifndef Q_NO_USING_KEYWORD + using QCommonStyle::polish; +#endif void setStyleProperty(const char *name, const QVariant &value); QVariant styleProperty(const char *name) const; diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index 996e471..ef3f2ae 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -628,13 +628,13 @@ QImage QFontEngineQPF::alphaMapForGlyph(glyph_t g) { const Glyph *glyph = findGlyph(g); if (!glyph) - QImage(); + return QImage(); const uchar *bits = ((const uchar *) glyph) + sizeof(Glyph); QImage image(glyph->width, glyph->height, QImage::Format_Indexed8); for (int j=0; j<256; ++j) - image.setColor(j, 0xff000000 | j | (j<<8) | (j<<16)); + image.setColor(j, qRgba(0, 0, 0, j)); for (int i=0; i<glyph->height; ++i) { memcpy(image.scanLine(i), bits, glyph->bytesPerLine); diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp index 888e1be..de8028c 100644 --- a/src/gui/text/qfontengine_qws.cpp +++ b/src/gui/text/qfontengine_qws.cpp @@ -528,10 +528,12 @@ QImage QFontEngineQPF1::alphaMapForGlyph(glyph_t g) QImage image; if (mono) { image = QImage((glyph->metrics->width+7)&~7, glyph->metrics->height, QImage::Format_Mono); + image.setColor(0, qRgba(0, 0, 0, 0)); + image.setColor(1, qRgba(0, 0, 0, 255)); } else { image = QImage(glyph->metrics->width, glyph->metrics->height, QImage::Format_Indexed8); for (int j=0; j<256; ++j) - image.setColor(j, 0xff000000 | j | (j<<8) | (j<<16)); + image.setColor(j, qRgba(0, 0, 0, j)); } for (int i=0; i<glyph->metrics->height; ++i) { memcpy(image.scanLine(i), bits, glyph->metrics->linestep); diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 61532b9..95ff4c1 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -403,8 +403,8 @@ QComboBoxPrivateContainer::QComboBoxPrivateContainer(QAbstractItemView *itemView layout->setMargin(0); #ifdef QT_SOFTKEYS_ENABLED - selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, itemView); - cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, itemView); + selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, this); + cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, this); addAction(selectAction); addAction(cancelAction); #endif @@ -534,6 +534,7 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView) this, SLOT(setCurrentIndex(QModelIndex))); disconnect(view, SIGNAL(destroyed()), this, SLOT(viewDestroyed())); + delete view; view = 0; } @@ -571,11 +572,6 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView) this, SLOT(setCurrentIndex(QModelIndex))); connect(view, SIGNAL(destroyed()), this, SLOT(viewDestroyed())); - -#ifdef QT_SOFTKEYS_ENABLED - selectAction->setParent(itemView); - cancelAction->setParent(itemView); -#endif } /*! diff --git a/src/gui/widgets/qvalidator.h b/src/gui/widgets/qvalidator.h index 268ecaa..a0d9534 100644 --- a/src/gui/widgets/qvalidator.h +++ b/src/gui/widgets/qvalidator.h @@ -61,7 +61,7 @@ class Q_GUI_EXPORT QValidator : public QObject { Q_OBJECT public: - explicit QValidator(QObject * parent=0); + explicit QValidator(QObject * parent = 0); ~QValidator(); enum State { @@ -100,7 +100,7 @@ class Q_GUI_EXPORT QIntValidator : public QValidator Q_PROPERTY(int top READ top WRITE setTop) public: - explicit QIntValidator(QObject * parent=0); + explicit QIntValidator(QObject * parent = 0); QIntValidator(int bottom, int top, QObject * parent); ~QIntValidator(); diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index f36ffc8..46c4392 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -57,6 +57,8 @@ QT_BEGIN_NAMESPACE //#define DEBUG_AUDIO 1 +static const int minimumIntervalTime = 50; + QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): settings(audioFormat) { @@ -248,6 +250,7 @@ bool QAudioInputPrivate::open() qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()"; #endif timeStamp.restart(); + elapsedTimeOffset = 0; int dir; int err=-1; @@ -283,69 +286,69 @@ bool QAudioInputPrivate::open() err = snd_pcm_hw_params_any( handle, hwparams ); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_any: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_any: err = %1").arg(err); } if ( !fatal ) { err = snd_pcm_hw_params_set_rate_resample( handle, hwparams, 1 ); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_rate_resample: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_rate_resample: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params_set_access( handle, hwparams, access ); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_access: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_access: err = %1").arg(err); } } if ( !fatal ) { err = setFormat(); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_format: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_format: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channels() ); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_channels: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_channels: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params_set_rate_near( handle, hwparams, &freakuency, 0 ); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_rate_near: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_rate_near: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, &dir); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_buffer_time_near: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_buffer_time_near: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, &dir); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_period_time_near: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_period_time_near: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params_set_periods_near(handle, hwparams, &chunks, &dir); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_periods_near: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_periods_near: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params(handle, hwparams); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioInput: snd_pcm_hw_params: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params: err = %1").arg(err); } } if( err < 0) { @@ -443,7 +446,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) if (readFrames >= 0) { err = snd_pcm_frames_to_bytes(handle, readFrames); #ifdef DEBUG_AUDIO - qDebug()<<QString(tr("PULL: read in bytes = %1 (frames=%2)")).arg(err).arg(readFrames).toLatin1().constData(); + qDebug()<<QString::fromLatin1("PULL: read in bytes = %1 (frames=%2)").arg(err).arg(readFrames).toLatin1().constData(); #endif break; } else if((readFrames == -EAGAIN) || (readFrames == -EINTR)) { @@ -531,7 +534,10 @@ int QAudioInputPrivate::periodSize() const void QAudioInputPrivate::setNotifyInterval(int ms) { - intervalTime = ms; + if(ms >= minimumIntervalTime) + intervalTime = ms; + else + intervalTime = minimumIntervalTime; } int QAudioInputPrivate::notifyInterval() const @@ -579,8 +585,9 @@ bool QAudioInputPrivate::deviceReady() if(deviceState != QAudio::ActiveState) return true; - if(timeStamp.elapsed() > intervalTime && intervalTime > 50) { + if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { emit notify(); + elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime; timeStamp.restart(); } return true; @@ -650,7 +657,7 @@ qint64 InputPrivate::readData( char* data, qint64 len) if (readFrames >= 0) { err = snd_pcm_frames_to_bytes(audioDevice->handle, readFrames); #ifdef DEBUG_AUDIO - qDebug()<<QString(tr("PUSH: read in bytes = %1 (frames=%2)")).arg(err).arg(readFrames).toLatin1().constData(); + qDebug()<<QString::fromLatin1("PUSH: read in bytes = %1 (frames=%2)").arg(err).arg(readFrames).toLatin1().constData(); #endif break; } else if((readFrames == -EAGAIN) || (readFrames == -EINTR)) { diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h index a1cc738..5583ea0 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.h +++ b/src/multimedia/audio/qaudioinput_alsa_p.h @@ -117,6 +117,7 @@ private: QTimer* timer; QTime timeStamp; + qint64 elapsedTimeOffset; int intervalTime; char* audioBuffer; int bytesAvailable; diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 31441ae..d4226f5 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE static CRITICAL_SECTION waveInCriticalSection; +static const int minimumIntervalTime = 50; + QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): settings(audioFormat) { @@ -226,6 +228,7 @@ bool QAudioInputPrivate::open() period_size = buffer_size/2; #endif timeStamp.restart(); + elapsedTimeOffset = 0; wfx.nSamplesPerSec = settings.frequency(); wfx.wBitsPerSample = settings.sampleSize(); wfx.nChannels = settings.channels(); @@ -297,6 +300,7 @@ bool QAudioInputPrivate::open() return false; } timeStampOpened.restart(); + elapsedTimeOffset = 0; totalTimeValue = 0; errorState = QAudio::NoError; deviceState = QAudio::ActiveState; @@ -473,7 +477,10 @@ int QAudioInputPrivate::periodSize() const void QAudioInputPrivate::setNotifyInterval(int ms) { - intervalTime = ms; + if(ms >= minimumIntervalTime) + intervalTime = ms; + else + intervalTime = minimumIntervalTime; } int QAudioInputPrivate::notifyInterval() const @@ -524,8 +531,9 @@ bool QAudioInputPrivate::deviceReady() if(deviceState != QAudio::ActiveState) return true; - if(timeStamp.elapsed() > intervalTime && intervalTime > 50) { + if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { emit notify(); + elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime; timeStamp.restart(); } return true; diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h index 3363b6a..26c470d 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.h +++ b/src/multimedia/audio/qaudioinput_win32_p.h @@ -109,6 +109,7 @@ private: int bytesAvailable; int intervalTime; QTime timeStamp; + qint64 elapsedTimeOffset; QTime timeStampOpened; qint64 totalTimeValue; bool pullMode; diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp index e8a3f5c..0d37d61 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp @@ -57,6 +57,8 @@ QT_BEGIN_NAMESPACE //#define DEBUG_AUDIO 1 +static const int minimumIntervalTime = 50; + QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): settings(audioFormat) { @@ -271,6 +273,7 @@ bool QAudioOutputPrivate::open() qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()"; #endif timeStamp.restart(); + elapsedTimeOffset = 0; int dir; int err=-1; @@ -304,69 +307,69 @@ bool QAudioOutputPrivate::open() err = snd_pcm_hw_params_any( handle, hwparams ); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_any: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_any: err = %1").arg(err); } if ( !fatal ) { err = snd_pcm_hw_params_set_rate_resample( handle, hwparams, 1 ); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_rate_resample: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_rate_resample: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params_set_access( handle, hwparams, access ); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_access: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_access: err = %1").arg(err); } } if ( !fatal ) { err = setFormat(); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_format: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_format: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channels() ); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_channels: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_channels: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params_set_rate_near( handle, hwparams, &freakuency, 0 ); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_rate_near: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_rate_near: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, &dir); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_buffer_time_near: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_buffer_time_near: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, &dir); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_period_time_near: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_period_time_near: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params_set_periods_near(handle, hwparams, &chunks, &dir); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_periods_near: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_periods_near: err = %1").arg(err); } } if ( !fatal ) { err = snd_pcm_hw_params(handle, hwparams); if ( err < 0 ) { fatal = true; - errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params: err = %1")).arg(err); + errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params: err = %1").arg(err); } } if( err < 0) { @@ -404,6 +407,8 @@ bool QAudioOutputPrivate::open() // Step 6: Start audio processing timer->start(period_time/1000); + timeStamp.restart(); + elapsedTimeOffset = 0; errorState = QAudio::NoError; totalTimeValue = 0; opened = true; @@ -500,7 +505,10 @@ int QAudioOutputPrivate::bufferSize() const void QAudioOutputPrivate::setNotifyInterval(int ms) { - intervalTime = ms; + if(ms >= minimumIntervalTime) + intervalTime = ms; + else + intervalTime = minimumIntervalTime; } int QAudioOutputPrivate::notifyInterval() const @@ -629,8 +637,9 @@ bool QAudioOutputPrivate::deviceReady() if(deviceState != QAudio::ActiveState) return true; - if(timeStamp.elapsed() > intervalTime && intervalTime > 50) { + if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { emit notify(); + elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime; timeStamp.restart(); } return true; diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/multimedia/audio/qaudiooutput_alsa_p.h index 63fe348..6d4177d 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.h +++ b/src/multimedia/audio/qaudiooutput_alsa_p.h @@ -134,6 +134,7 @@ private: QByteArray m_device; int bytesAvailable; QTime timeStamp; + qint64 elapsedTimeOffset; char* audioBuffer; snd_pcm_t* handle; snd_async_handler_t* ahandler; diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index aea3a3f..bb61f41 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -58,6 +58,8 @@ QT_BEGIN_NAMESPACE static CRITICAL_SECTION waveOutCriticalSection; +static const int minimumIntervalTime = 50; + QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): settings(audioFormat) { @@ -221,6 +223,7 @@ bool QAudioOutputPrivate::open() audioBuffer = new char[buffer_size]; timeStamp.restart(); + elapsedTimeOffset = 0; wfx.nSamplesPerSec = settings.frequency(); wfx.wBitsPerSample = settings.sampleSize(); @@ -261,6 +264,7 @@ bool QAudioOutputPrivate::open() totalTimeValue = 0; timeStampOpened.restart(); + elapsedTimeOffset = 0; errorState = QAudio::NoError; if(pullMode) { @@ -316,7 +320,10 @@ int QAudioOutputPrivate::bufferSize() const void QAudioOutputPrivate::setNotifyInterval(int ms) { - intervalTime = ms; + if(ms >= minimumIntervalTime) + intervalTime = ms; + else + intervalTime = minimumIntervalTime; } int QAudioOutputPrivate::notifyInterval() const @@ -420,7 +427,6 @@ void QAudioOutputPrivate::feedback() bool QAudioOutputPrivate::deviceReady() { if(pullMode) { - int i = 0; int chunks = bytesAvailable/period_size; #ifdef DEBUG_AUDIO qDebug()<<"deviceReady() avail="<<bytesAvailable<<" bytes, period size="<<period_size<<" bytes"; @@ -430,6 +436,22 @@ bool QAudioOutputPrivate::deviceReady() if(totalTimeValue == 0) startup = true; + bool full=false; + EnterCriticalSection(&waveOutCriticalSection); + if(waveFreeBlockCount==0) full = true; + LeaveCriticalSection(&waveOutCriticalSection); + if (full){ +#ifdef DEBUG_AUDIO + qDebug() << "Skipping data as unable to write"; +#endif + if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime ) { + emit notify(); + elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime; + timeStamp.restart(); + } + return true; + } + if(startup) waveOutPause(hWaveOut); int input = period_size*chunks; @@ -451,7 +473,7 @@ bool QAudioOutputPrivate::deviceReady() } LeaveCriticalSection(&waveOutCriticalSection); - } else if(i < 0) { + } else if(l < 0) { bytesAvailable = bytesFree(); errorState = QAudio::IOError; } @@ -459,8 +481,9 @@ bool QAudioOutputPrivate::deviceReady() if(deviceState != QAudio::ActiveState) return true; - if(timeStamp.elapsed() > intervalTime && intervalTime > 50) { + if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { emit notify(); + elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime; timeStamp.restart(); } @@ -468,7 +491,7 @@ bool QAudioOutputPrivate::deviceReady() } qint64 QAudioOutputPrivate::clock() const -{ +{ if(deviceState != QAudio::ActiveState) return 0; diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h index 5c08bf4..bcf8e1e 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.h +++ b/src/multimedia/audio/qaudiooutput_win32_p.h @@ -109,6 +109,7 @@ private: bool resuming; int bytesAvailable; QTime timeStamp; + qint64 elapsedTimeOffset; QTime timeStampOpened; qint32 buffer_size; qint32 period_size; diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp index 55aa77a..d9d7234 100644 --- a/src/network/kernel/qhostinfo_win.cpp +++ b/src/network/kernel/qhostinfo_win.cpp @@ -186,7 +186,7 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) results.setHostName(hostName); if (aceHostname.isEmpty()) { results.setError(QHostInfo::HostNotFound); - results.setErrorString(hostName.isEmpty() ? QObject::tr("No host name given") : QObject::tr("Invalid hostname")); + results.setErrorString(hostName.isEmpty() ? tr("No host name given") : tr("Invalid hostname")); return results; } } else { diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 0ad6772..1276443 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1624,9 +1624,8 @@ void QGLTextureCache::pixmapCleanupHook(QPixmap* pixmap) } #if defined(Q_WS_X11) QPixmapData *pd = pixmap->data_ptr().data(); - // Only need to delete the gl surface if the pixmap is about to be deleted - if (pd->ref == 0) - QGLContextPrivate::destroyGlSurfaceForPixmap(pd); + Q_ASSERT(pd->ref == 1); // Make sure reference counting isn't broken + QGLContextPrivate::destroyGlSurfaceForPixmap(pd); #endif } diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 5ce1a45..6c93bea 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -142,10 +142,12 @@ void QGLContext::reset() d->cleanup(); doneCurrent(); if (d->eglContext) { + if (d->eglSurface != EGL_NO_SURFACE) + eglDestroySurface(d->eglContext->display(), d->eglSurface); delete d->eglContext; - d->eglContext = 0; } - d->eglSurface = EGL_NO_SURFACE; // XXX - probably need to destroy surface + d->eglContext = 0; + d->eglSurface = EGL_NO_SURFACE; d->crWin = false; d->sharing = false; d->valid = false; diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index bb3cb5d..15714c2 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -79,30 +79,24 @@ protected: bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &pixmap, const QRectF &srcRect) const; }; -#ifndef QT_OPENGL_ES_2 - -class QGLPixmapConvolutionFilter: public QGLPixmapFilter<QPixmapConvolutionFilter> +class QGLPixmapConvolutionFilter: public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapConvolutionFilter> { public: QGLPixmapConvolutionFilter(); ~QGLPixmapConvolutionFilter(); + void setUniforms(QGLShaderProgram *program); + protected: bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const; private: QByteArray generateConvolutionShader() const; - mutable QGLShaderProgram *m_program; - mutable int m_scaleUniform; - mutable int m_matrixUniform; - - mutable int m_kernelWidth; - mutable int m_kernelHeight; + mutable QSize m_srcSize; + mutable int m_prevKernelSize; }; -#endif - class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapBlurFilter> { public: @@ -147,57 +141,16 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr return d->blurFilter.data(); } -#ifndef QT_OPENGL_ES_2 case QPixmapFilter::ConvolutionFilter: if (!d->convolutionFilter) d->convolutionFilter.reset(new QGLPixmapConvolutionFilter); return d->convolutionFilter.data(); -#endif default: break; } return QPaintEngineEx::pixmapFilter(type, prototype); } -#ifndef QT_OPENGL_ES_2 // XXX: needs to be ported - -extern void qt_add_rect_to_array(const QRectF &r, q_vertexType *array); -extern void qt_add_texcoords_to_array(qreal x1, qreal y1, qreal x2, qreal y2, q_vertexType *array); - -static void qgl_drawTexture(const QRectF &rect, int tx_width, int tx_height, const QRectF & src) -{ -#ifndef QT_OPENGL_ES - glPushAttrib(GL_CURRENT_BIT); -#endif - qreal x1, x2, y1, y2; - - x1 = src.x() / tx_width; - x2 = x1 + src.width() / tx_width; - y1 = 1.0 - ((src.y() / tx_height) + (src.height() / tx_height)); - y2 = 1.0 - (src.y() / tx_height); - - q_vertexType vertexArray[4*2]; - q_vertexType texCoordArray[4*2]; - - qt_add_rect_to_array(rect, vertexArray); - qt_add_texcoords_to_array(x1, y2, x2, y1, texCoordArray); - - glVertexPointer(2, q_vertexTypeEnum, 0, vertexArray); - glTexCoordPointer(2, q_vertexTypeEnum, 0, texCoordArray); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_VERTEX_ARRAY); - -#ifndef QT_OPENGL_ES - glPopAttrib(); -#endif -} - -#endif // !QT_OPENGL_ES_2 - static const char *qt_gl_colorize_filter = "uniform lowp vec4 colorizeColor;" "uniform lowp float colorizeStrength;" @@ -231,102 +184,88 @@ void QGLPixmapColorizeFilter::setUniforms(QGLShaderProgram *program) program->setUniformValue("colorizeStrength", float(strength())); } -#ifndef QT_OPENGL_ES_2 +void QGLPixmapConvolutionFilter::setUniforms(QGLShaderProgram *program) +{ + const qreal *kernel = convolutionKernel(); + int kernelWidth = columns(); + int kernelHeight = rows(); + int kernelSize = kernelWidth * kernelHeight; + + QVarLengthArray<GLfloat> matrix(kernelSize); + QVarLengthArray<GLfloat> offset(kernelSize * 2); + + for(int i = 0; i < kernelSize; ++i) + matrix[i] = kernel[i]; + + for(int y = 0; y < kernelHeight; ++y) { + for(int x = 0; x < kernelWidth; ++x) { + offset[(y * kernelWidth + x) * 2] = x - (kernelWidth / 2); + offset[(y * kernelWidth + x) * 2 + 1] = (kernelHeight / 2) - y; + } + } + + const qreal iw = 1.0 / m_srcSize.width(); + const qreal ih = 1.0 / m_srcSize.height(); + program->setUniformValue("inv_texture_size", iw, ih); + program->setUniformValueArray("matrix", matrix.constData(), kernelSize, 1); + program->setUniformValueArray("offset", offset.constData(), kernelSize, 2); +} // generates convolution filter code for arbitrary sized kernel QByteArray QGLPixmapConvolutionFilter::generateConvolutionShader() const { QByteArray code; - code.append("uniform sampler2D texture;\n" - "uniform vec2 inv_texture_size;\n" - "uniform float matrix["); - code.append(QByteArray::number(m_kernelWidth * m_kernelHeight)); - code.append("];\n" - "vec2 offset["); - code.append(QByteArray::number(m_kernelWidth*m_kernelHeight)); + int kernelWidth = columns(); + int kernelHeight = rows(); + int kernelSize = kernelWidth * kernelHeight; + code.append("uniform highp vec2 inv_texture_size;\n" + "uniform mediump float matrix["); + code.append(QByteArray::number(kernelSize)); code.append("];\n" - "void main(void) {\n"); - - for(int y = 0; y < m_kernelHeight; y++) { - for(int x = 0; x < m_kernelWidth; x++) { - code.append(" offset["); - code.append(QByteArray::number(y * m_kernelWidth + x)); - code.append("] = vec2(inv_texture_size.x * "); - code.append(QByteArray::number(x-(int)(m_kernelWidth/2))); - code.append(".0, inv_texture_size.y * "); - code.append(QByteArray::number((int)(m_kernelHeight/2)-y)); - code.append(".0);\n"); - } - } + "uniform highp vec2 offset["); + code.append(QByteArray::number(kernelSize)); + code.append("];\n"); + code.append("lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {\n"); code.append(" int i = 0;\n" - " vec2 coords = gl_TexCoord[0].st;\n" - " vec4 sum = vec4(0.0);\n" + " lowp vec4 sum = vec4(0.0);\n" " for (i = 0; i < "); - code.append(QByteArray::number(m_kernelWidth * m_kernelHeight)); + code.append(QByteArray::number(kernelSize)); code.append("; i++) {\n" - " vec4 tmp = texture2D(texture,coords+offset[i]);\n" - " sum += matrix[i] * tmp;\n" + " sum += matrix[i] * texture2D(src,srcCoords+inv_texture_size*offset[i]);\n" " }\n" - " gl_FragColor = sum;\n" + " return sum;\n" "}"); return code; } QGLPixmapConvolutionFilter::QGLPixmapConvolutionFilter() - : m_program(0) - , m_scaleUniform(0) - , m_matrixUniform(0) - , m_kernelWidth(0) - , m_kernelHeight(0) + : m_prevKernelSize(-1) { } QGLPixmapConvolutionFilter::~QGLPixmapConvolutionFilter() { - delete m_program; } -bool QGLPixmapConvolutionFilter::processGL(QPainter *, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const +bool QGLPixmapConvolutionFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const { - QRectF target = (srcRect.isNull() ? QRectF(src.rect()) : srcRect).translated(pos); - - bindTexture(src); -#ifdef GL_CLAMP - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); -#endif - if (!m_program || m_kernelWidth != columns() || m_kernelHeight != rows()) { - delete m_program; - - m_kernelWidth = columns(); - m_kernelHeight = rows(); - - QByteArray code = generateConvolutionShader(); - m_program = new QGLShaderProgram(); - m_program->addShader(QGLShader::FragmentShader, code); - m_program->link(); - m_scaleUniform = m_program->uniformLocation("inv_texture_size"); - m_matrixUniform = m_program->uniformLocation("matrix"); + QGLPixmapConvolutionFilter *filter = const_cast<QGLPixmapConvolutionFilter *>(this); + + m_srcSize = src.size(); + + int kernelSize = rows() * columns(); + if (m_prevKernelSize == -1 || m_prevKernelSize != kernelSize) { + filter->setSource(generateConvolutionShader()); + m_prevKernelSize = kernelSize; } - const qreal *kernel = convolutionKernel(); - GLfloat *conv = new GLfloat[m_kernelWidth * m_kernelHeight]; - for(int i = 0; i < m_kernelWidth * m_kernelHeight; ++i) - conv[i] = kernel[i]; - - const qreal iw = 1.0 / src.width(); - const qreal ih = 1.0 / src.height(); - m_program->enable(); - m_program->setUniformValue(m_scaleUniform, iw, ih); - m_program->setUniformValueArray(m_matrixUniform, conv, m_kernelWidth * m_kernelHeight, 1); - - qgl_drawTexture(target, src.width(), src.height(), boundingRectFor(srcRect)); - m_program->disable(); + filter->setOnPainter(painter); + painter->drawPixmap(pos, src, srcRect); + filter->removeFromPainter(painter); + return true; } -#endif // !QT_OPENGL_ES_2 - static const char *qt_gl_blur_filter_fast = "const int samples = 9;" "uniform mediump vec2 delta;" diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index bd3883a..a904064 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4791,22 +4791,6 @@ void QGLGlyphCache::cacheGlyphs(QGLContext *context, const QTextItemInt &ti, } QImage glyph_im(ti.fontEngine->alphaMapForGlyph(glyphs[i])); - - // The QPF implementation of alphaMapForGlyph() uses the color - // RGBA = (value, value, value, 255) instead of the color - // RGBA = (0, 0, 0, value) that the other font engines use. - // We modify the image colors to rectify this situation. - QFontEngine::Type type = ti.fontEngine->type(); - if (type == QFontEngine::QPF1 || type == QFontEngine::QPF2) { - if (glyph_im.format() == QImage::Format_Indexed8) { - for (int i = 0; i < 256; ++i) - glyph_im.setColor(i, qRgba(0, 0, 0, i)); - } else if (glyph_im.format() == QImage::Format_Mono) { - glyph_im.setColor(0, qRgba(0, 0, 0, 0)); - glyph_im.setColor(1, qRgba(0, 0, 0, 255)); - } - } - glyph_im = glyph_im.convertToFormat(QImage::Format_Indexed8); glyph_width = glyph_im.width(); Q_ASSERT(glyph_width >= 0); diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 3558c28..b129164 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3023,20 +3023,6 @@ void QVGFontGlyphCache::cacheGlyphs VGImage vgImage = VG_INVALID_HANDLE; metrics = ti.fontEngine->boundingBox(glyph); if (!scaledImage.isNull()) { // Not a space character - // The QPF implementation of alphaMapForGlyph() uses the color - // RGBA = (value, value, value, 255) instead of the color - // RGBA = (0, 0, 0, value) that the other font engines use. - // We modify the image colors to rectify this situation. - QFontEngine::Type type = ti.fontEngine->type(); - if (type == QFontEngine::QPF1 || type == QFontEngine::QPF2) { - if (scaledImage.format() == QImage::Format_Indexed8) { - for (int i = 0; i < 256; ++i) - scaledImage.setColor(i, qRgba(0, 0, 0, i)); - } else if (scaledImage.format() == QImage::Format_Mono) { - scaledImage.setColor(0, qRgba(0, 0, 0, 0)); - scaledImage.setColor(1, qRgba(0, 0, 0, 255)); - } - } if (scaledImage.format() == QImage::Format_Indexed8) { vgImage = vgCreateImage(VG_A_8, scaledImage.width(), scaledImage.height(), VG_IMAGE_QUALITY_FASTER); vgImageSubData(vgImage, scaledImage.bits(), scaledImage.bytesPerLine(), VG_A_8, 0, 0, scaledImage.width(), scaledImage.height()); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 043189e..a9ae72c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -1249,7 +1249,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * dbg << dev << "of type" << dev->devType(); } - dbg << QString("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0')) + dbg << QString::fromLatin1("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0')) << "simplePen" << simplePen << "clipType" << clipType << "compositionModeStatus" << compositionModeStatus; diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 88abc78..d21c524 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -19,6 +19,7 @@ symbian: { QtXml.dll \ QtGui.dll \ QtNetwork.dll \ + QtScript.dll \ QtTest.dll \ QtSql.dll @@ -93,6 +94,10 @@ symbian: { qtlibraries.sources += Phonon.dll } + contains(QT_CONFIG, webkit): { + qtlibraries.sources += QtWebKit.dll + } + graphicssystems_plugins.path = $$QT_PLUGINS_BASE_DIR/graphicssystems contains(QT_CONFIG, openvg) { qtlibraries.sources = QtOpenVG.dll diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index ee25239..9604fff 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1606,6 +1606,9 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, } #ifndef QT_NO_REGEXP + +extern QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax); + /*! Creates a QtScript object of class RegExp with the given \a regexp. @@ -1620,7 +1623,6 @@ QScriptValue QScriptEngine::newRegExp(const QRegExp ®exp) JSC::ArgList args(buf, sizeof(buf)); //convert the pattern to a ECMAScript pattern - extern QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax); QString pattern = qt_regexp_toCanonical(regexp.pattern(), regexp.patternSyntax()); if (regexp.isMinimal()) { QString ecmaPattern; diff --git a/src/script/api/qscriptvalue.h b/src/script/api/qscriptvalue.h index 2bc89bd..32f7a43 100644 --- a/src/script/api/qscriptvalue.h +++ b/src/script/api/qscriptvalue.h @@ -216,9 +216,9 @@ public: private: // force compile error, prevent QScriptValue(bool) to be called - inline QScriptValue(void *); + QScriptValue(void *); // force compile error, prevent QScriptValue(QScriptEngine*, bool) to be called - inline QScriptValue(QScriptEngine *, void *); + QScriptValue(QScriptEngine *, void *); QScriptValue(QScriptValuePrivate*); diff --git a/src/script/script.pro b/src/script/script.pro index 6c6b701..659aa26 100644 --- a/src/script/script.pro +++ b/src/script/script.pro @@ -62,6 +62,9 @@ DEFINES += WTF_USE_JAVASCRIPTCORE_BINDINGS=1 WTF_CHANGES=1 DEFINES += NDEBUG +# Avoid JSC C API functions being exported. +DEFINES += JS_EXPORT="" JS_EXPORTDATA="" + INCLUDEPATH += $$PWD include(script.pri) diff --git a/src/scripttools/debugging/qscriptbreakpointsmodel.cpp b/src/scripttools/debugging/qscriptbreakpointsmodel.cpp index 82a7c6a..40acebb 100644 --- a/src/scripttools/debugging/qscriptbreakpointsmodel.cpp +++ b/src/scripttools/debugging/qscriptbreakpointsmodel.cpp @@ -47,6 +47,7 @@ #include "private/qabstractitemmodel_p.h" #include <QtCore/qpair.h> +#include <QtCore/qcoreapplication.h> #include <QtGui/qicon.h> #include <QtCore/qdebug.h> @@ -451,17 +452,17 @@ QVariant QScriptBreakpointsModel::headerData(int section, Qt::Orientation orient if (orient == Qt::Horizontal) { if (role == Qt::DisplayRole) { if (section == 0) - return QObject::tr("ID"); + return QCoreApplication::translate("QScriptBreakpointsModel", "ID"); else if (section == 1) - return QObject::tr("Location"); + return QCoreApplication::translate("QScriptBreakpointsModel", "Location"); else if (section == 2) - return QObject::tr("Condition"); + return QCoreApplication::translate("QScriptBreakpointsModel", "Condition"); else if (section == 3) - return QObject::tr("Ignore-count"); + return QCoreApplication::translate("QScriptBreakpointsModel", "Ignore-count"); else if (section == 4) - return QObject::tr("Single-shot"); + return QCoreApplication::translate("QScriptBreakpointsModel", "Single-shot"); else if (section == 5) - return QObject::tr("Hit-count"); + return QCoreApplication::translate("QScriptBreakpointsModel", "Hit-count"); } } return QVariant(); diff --git a/src/scripttools/debugging/qscriptbreakpointswidget.cpp b/src/scripttools/debugging/qscriptbreakpointswidget.cpp index 356c6d5..688c7c8 100644 --- a/src/scripttools/debugging/qscriptbreakpointswidget.cpp +++ b/src/scripttools/debugging/qscriptbreakpointswidget.cpp @@ -78,7 +78,7 @@ public: toolClose = new QToolButton(this); toolClose->setIcon(QIcon(QString::fromUtf8(":/qt/scripttools/debugging/images/%1/closetab.png").arg(system))); toolClose->setAutoRaise(true); - toolClose->setText(QObject::tr("Close")); + toolClose->setText(tr("Close")); hboxLayout->addWidget(toolClose); fileNameEdit = new QLineEdit(); @@ -295,13 +295,13 @@ QScriptBreakpointsWidget::QScriptBreakpointsWidget(QWidget *parent) QIcon newBreakpointIcon; newBreakpointIcon.addPixmap(d->pixmap(QString::fromLatin1("new.png")), QIcon::Normal); - QAction *newBreakpointAction = new QAction(newBreakpointIcon, QObject::tr("New"), this); + QAction *newBreakpointAction = new QAction(newBreakpointIcon, tr("New"), this); QObject::connect(newBreakpointAction, SIGNAL(triggered()), this, SLOT(_q_newBreakpoint())); QIcon deleteBreakpointIcon; deleteBreakpointIcon.addPixmap(d->pixmap(QString::fromLatin1("delete.png")), QIcon::Normal); - d->deleteBreakpointAction = new QAction(deleteBreakpointIcon, QObject::tr("Delete"), this); + d->deleteBreakpointAction = new QAction(deleteBreakpointIcon, tr("Delete"), this); d->deleteBreakpointAction->setEnabled(false); QObject::connect(d->deleteBreakpointAction, SIGNAL(triggered()), this, SLOT(_q_deleteBreakpoint())); diff --git a/src/scripttools/debugging/qscriptdebugger.cpp b/src/scripttools/debugging/qscriptdebugger.cpp index c09e494..58d707f 100644 --- a/src/scripttools/debugging/qscriptdebugger.cpp +++ b/src/scripttools/debugging/qscriptdebugger.cpp @@ -882,8 +882,8 @@ void QScriptDebuggerPrivate::_q_goToLine() if (!view) return; bool ok = false; - int lineNumber = QInputDialog::getInteger(0, QObject::tr("Go to Line"), - QObject::tr("Line:"), + int lineNumber = QInputDialog::getInteger(0, QScriptDebugger::tr("Go to Line"), + QScriptDebugger::tr("Line:"), view->cursorLineNumber(), 1, INT_MAX, 1, &ok); if (ok) @@ -1674,9 +1674,9 @@ QAction *QScriptDebugger::interruptAction(QObject *parent) const interruptIcon.addPixmap(d->pixmap(QString::fromLatin1("interrupt.png")), QIcon::Normal); interruptIcon.addPixmap(d->pixmap(QString::fromLatin1("d_interrupt.png")), QIcon::Disabled); QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->interruptAction = new QAction(interruptIcon, QObject::tr("Interrupt"), parent); + that->d_func()->interruptAction = new QAction(interruptIcon, QScriptDebugger::tr("Interrupt"), parent); d->interruptAction->setEnabled(!d->interactive); - d->interruptAction->setShortcut(QObject::tr("Shift+F5")); + d->interruptAction->setShortcut(QScriptDebugger::tr("Shift+F5")); QObject::connect(d->interruptAction, SIGNAL(triggered()), that, SLOT(_q_interrupt())); } @@ -1691,9 +1691,9 @@ QAction *QScriptDebugger::continueAction(QObject *parent) const continueIcon.addPixmap(d->pixmap(QString::fromLatin1("play.png")), QIcon::Normal); continueIcon.addPixmap(d->pixmap(QString::fromLatin1("d_play.png")), QIcon::Disabled); QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->continueAction = new QAction(continueIcon, QObject::tr("Continue"), parent); + that->d_func()->continueAction = new QAction(continueIcon, QScriptDebugger::tr("Continue"), parent); d->continueAction->setEnabled(d->interactive); - d->continueAction->setShortcut(QObject::tr("F5")); + d->continueAction->setShortcut(QScriptDebugger::tr("F5")); QObject::connect(d->continueAction, SIGNAL(triggered()), that, SLOT(_q_continue())); } @@ -1708,9 +1708,9 @@ QAction *QScriptDebugger::stepIntoAction(QObject *parent) const stepIntoIcon.addPixmap(d->pixmap(QString::fromLatin1("stepinto.png")), QIcon::Normal); stepIntoIcon.addPixmap(d->pixmap(QString::fromLatin1("d_stepinto.png")), QIcon::Disabled); QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->stepIntoAction = new QAction(stepIntoIcon, QObject::tr("Step Into"), parent); + that->d_func()->stepIntoAction = new QAction(stepIntoIcon, QScriptDebugger::tr("Step Into"), parent); d->stepIntoAction->setEnabled(d->interactive); - d->stepIntoAction->setShortcut(QObject::tr("F11")); + d->stepIntoAction->setShortcut(QScriptDebugger::tr("F11")); QObject::connect(d->stepIntoAction, SIGNAL(triggered()), that, SLOT(_q_stepInto())); } @@ -1725,9 +1725,9 @@ QAction *QScriptDebugger::stepOverAction(QObject *parent) const stepOverIcon.addPixmap(d->pixmap(QString::fromLatin1("stepover.png")), QIcon::Normal); stepOverIcon.addPixmap(d->pixmap(QString::fromLatin1("d_stepover.png")), QIcon::Disabled); QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->stepOverAction = new QAction(stepOverIcon, QObject::tr("Step Over"), parent); + that->d_func()->stepOverAction = new QAction(stepOverIcon, QScriptDebugger::tr("Step Over"), parent); d->stepOverAction->setEnabled(d->interactive); - d->stepOverAction->setShortcut(QObject::tr("F10")); + d->stepOverAction->setShortcut(QScriptDebugger::tr("F10")); QObject::connect(d->stepOverAction, SIGNAL(triggered()), that, SLOT(_q_stepOver())); } @@ -1742,9 +1742,9 @@ QAction *QScriptDebugger::stepOutAction(QObject *parent) const stepOutIcon.addPixmap(d->pixmap(QString::fromLatin1("stepout.png")), QIcon::Normal); stepOutIcon.addPixmap(d->pixmap(QString::fromLatin1("d_stepout.png")), QIcon::Disabled); QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->stepOutAction = new QAction(stepOutIcon, QObject::tr("Step Out"), parent); + that->d_func()->stepOutAction = new QAction(stepOutIcon, QScriptDebugger::tr("Step Out"), parent); d->stepOutAction->setEnabled(d->interactive); - d->stepOutAction->setShortcut(QObject::tr("Shift+F11")); + d->stepOutAction->setShortcut(QScriptDebugger::tr("Shift+F11")); QObject::connect(d->stepOutAction, SIGNAL(triggered()), that, SLOT(_q_stepOut())); } @@ -1759,9 +1759,9 @@ QAction *QScriptDebugger::runToCursorAction(QObject *parent) const runToCursorIcon.addPixmap(d->pixmap(QString::fromLatin1("runtocursor.png")), QIcon::Normal); runToCursorIcon.addPixmap(d->pixmap(QString::fromLatin1("d_runtocursor.png")), QIcon::Disabled); QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->runToCursorAction = new QAction(runToCursorIcon, QObject::tr("Run to Cursor"), parent); + that->d_func()->runToCursorAction = new QAction(runToCursorIcon, QScriptDebugger::tr("Run to Cursor"), parent); d->runToCursorAction->setEnabled(d->interactive); - d->runToCursorAction->setShortcut(QObject::tr("Ctrl+F10")); + d->runToCursorAction->setShortcut(QScriptDebugger::tr("Ctrl+F10")); QObject::connect(d->runToCursorAction, SIGNAL(triggered()), that, SLOT(_q_runToCursor())); } @@ -1777,7 +1777,7 @@ QAction *QScriptDebugger::runToNewScriptAction(QObject *parent) const runToNewScriptIcon.addPixmap(d->pixmap(QString::fromLatin1("d_breakonscriptload.png")), QIcon::Disabled); QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->runToNewScriptAction = new QAction(runToNewScriptIcon, - QObject::tr("Run to New Script"), parent); + QScriptDebugger::tr("Run to New Script"), parent); d->runToNewScriptAction->setEnabled(d->interactive); QObject::connect(d->runToNewScriptAction, SIGNAL(triggered()), that, SLOT(_q_runToNewScript())); @@ -1792,8 +1792,8 @@ QAction *QScriptDebugger::toggleBreakpointAction(QObject *parent) const QIcon toggleBreakpointIcon; QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->toggleBreakpointAction = new QAction(toggleBreakpointIcon, - QObject::tr("Toggle Breakpoint"), parent); - d->toggleBreakpointAction->setShortcut(QObject::tr("F9")); + QScriptDebugger::tr("Toggle Breakpoint"), parent); + d->toggleBreakpointAction->setShortcut(QScriptDebugger::tr("F9")); d->toggleBreakpointAction->setEnabled((d->codeWidget != 0) && (d->codeWidget->currentView() != 0)); QObject::connect(d->toggleBreakpointAction, SIGNAL(triggered()), that, SLOT(_q_toggleBreakpoint())); @@ -1807,7 +1807,7 @@ QAction *QScriptDebugger::clearDebugOutputAction(QObject *parent) const if (!d->clearDebugOutputAction) { QIcon clearDebugOutputIcon; QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->clearDebugOutputAction = new QAction(clearDebugOutputIcon, QObject::tr("Clear Debug Output"), parent); + that->d_func()->clearDebugOutputAction = new QAction(clearDebugOutputIcon, QScriptDebugger::tr("Clear Debug Output"), parent); QObject::connect(d->clearDebugOutputAction, SIGNAL(triggered()), that, SLOT(_q_clearDebugOutput())); } @@ -1820,7 +1820,7 @@ QAction *QScriptDebugger::clearErrorLogAction(QObject *parent) const if (!d->clearErrorLogAction) { QIcon clearErrorLogIcon; QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->clearErrorLogAction = new QAction(clearErrorLogIcon, QObject::tr("Clear Error Log"), parent); + that->d_func()->clearErrorLogAction = new QAction(clearErrorLogIcon, QScriptDebugger::tr("Clear Error Log"), parent); QObject::connect(d->clearErrorLogAction, SIGNAL(triggered()), that, SLOT(_q_clearErrorLog())); } @@ -1833,7 +1833,7 @@ QAction *QScriptDebugger::clearConsoleAction(QObject *parent) const if (!d->clearConsoleAction) { QIcon clearConsoleIcon; QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->clearConsoleAction = new QAction(clearConsoleIcon, QObject::tr("Clear Console"), parent); + that->d_func()->clearConsoleAction = new QAction(clearConsoleIcon, QScriptDebugger::tr("Clear Console"), parent); QObject::connect(d->clearConsoleAction, SIGNAL(triggered()), that, SLOT(_q_clearConsole())); } @@ -1847,8 +1847,8 @@ QAction *QScriptDebugger::findInScriptAction(QObject *parent) const QIcon findInScriptIcon; findInScriptIcon.addPixmap(d->pixmap(QString::fromLatin1("find.png")), QIcon::Normal); QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->findInScriptAction = new QAction(findInScriptIcon, QObject::tr("&Find in Script..."), parent); - d->findInScriptAction->setShortcut(QObject::tr("Ctrl+F")); + that->d_func()->findInScriptAction = new QAction(findInScriptIcon, QScriptDebugger::tr("&Find in Script..."), parent); + d->findInScriptAction->setShortcut(QScriptDebugger::tr("Ctrl+F")); d->findInScriptAction->setEnabled( (d->codeFinderWidget != 0) && (d->codeWidget != 0) @@ -1865,9 +1865,9 @@ QAction *QScriptDebugger::findNextInScriptAction(QObject *parent) const if (!d->findNextInScriptAction) { QIcon findNextInScriptIcon; QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->findNextInScriptAction = new QAction(findNextInScriptIcon, QObject::tr("Find &Next"), parent); + that->d_func()->findNextInScriptAction = new QAction(findNextInScriptIcon, QScriptDebugger::tr("Find &Next"), parent); d->findNextInScriptAction->setEnabled(d->codeFinderWidget && !d->codeFinderWidget->text().isEmpty()); - d->findNextInScriptAction->setShortcut(QObject::tr("F3")); + d->findNextInScriptAction->setShortcut(QScriptDebugger::tr("F3")); QObject::connect(d->findNextInScriptAction, SIGNAL(triggered()), that, SLOT(_q_findNextInScript())); } @@ -1880,9 +1880,9 @@ QAction *QScriptDebugger::findPreviousInScriptAction(QObject *parent) const if (!d->findPreviousInScriptAction) { QIcon findPreviousInScriptIcon; QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->findPreviousInScriptAction = new QAction(findPreviousInScriptIcon, QObject::tr("Find &Previous"), parent); + that->d_func()->findPreviousInScriptAction = new QAction(findPreviousInScriptIcon, QScriptDebugger::tr("Find &Previous"), parent); d->findPreviousInScriptAction->setEnabled(d->codeFinderWidget && !d->codeFinderWidget->text().isEmpty()); - d->findPreviousInScriptAction->setShortcut(QObject::tr("Shift+F3")); + d->findPreviousInScriptAction->setShortcut(QScriptDebugger::tr("Shift+F3")); QObject::connect(d->findPreviousInScriptAction, SIGNAL(triggered()), that, SLOT(_q_findPreviousInScript())); } @@ -1895,8 +1895,8 @@ QAction *QScriptDebugger::goToLineAction(QObject *parent) const if (!d->goToLineAction) { QIcon goToLineIcon; QScriptDebugger *that = const_cast<QScriptDebugger*>(this); - that->d_func()->goToLineAction = new QAction(goToLineIcon, QObject::tr("Go to Line"), parent); - d->goToLineAction->setShortcut(QObject::tr("Ctrl+G")); + that->d_func()->goToLineAction = new QAction(goToLineIcon, QScriptDebugger::tr("Go to Line"), parent); + d->goToLineAction->setShortcut(QScriptDebugger::tr("Ctrl+G")); d->goToLineAction->setEnabled((d->codeWidget != 0) && (d->codeWidget->currentView() != 0)); QObject::connect(d->goToLineAction, SIGNAL(triggered()), that, SLOT(_q_goToLine())); @@ -1907,7 +1907,7 @@ QAction *QScriptDebugger::goToLineAction(QObject *parent) const QMenu *QScriptDebugger::createStandardMenu(QWidget *widgetParent, QObject *actionParent) { QMenu *menu = new QMenu(widgetParent); - menu->setTitle(QObject::tr("Debug")); + menu->setTitle(QScriptDebugger::tr("Debug")); menu->addAction(action(ContinueAction, actionParent)); menu->addAction(action(InterruptAction, actionParent)); menu->addAction(action(StepIntoAction, actionParent)); diff --git a/src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp b/src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp index 5ef5a0c..8ed0aaa 100644 --- a/src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp +++ b/src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp @@ -138,7 +138,7 @@ QScriptDebuggerCodeFinderWidget::QScriptDebuggerCodeFinderWidget(QWidget *parent d->toolClose = new QToolButton(this); d->toolClose->setIcon(QIcon(QString::fromUtf8(":/qt/scripttools/debugging/images/%1/closetab.png").arg(system))); d->toolClose->setAutoRaise(true); - d->toolClose->setText(QObject::tr("Close")); + d->toolClose->setText(tr("Close")); hboxLayout->addWidget(d->toolClose); d->editFind = new QLineEdit(this); diff --git a/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp b/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp index 15d43f4..9caefce 100644 --- a/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp +++ b/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp @@ -53,6 +53,7 @@ #include "private/qabstractitemmodel_p.h" #include <QtCore/qdebug.h> +#include <QtCore/qcoreapplication.h> #include <QtGui/qbrush.h> #include <QtGui/qfont.h> @@ -868,9 +869,9 @@ QVariant QScriptDebuggerLocalsModel::headerData(int section, Qt::Orientation ori if (orient == Qt::Horizontal) { if (role == Qt::DisplayRole) { if (section == 0) - return QObject::tr("Name"); + return QCoreApplication::translate("QScriptDebuggerLocalsModel", "Name"); else if (section == 1) - return QObject::tr("Value"); + return QCoreApplication::translate("QScriptDebuggerLocalsModel", "Value"); } } return QVariant(); diff --git a/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp b/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp index a63ea73..2d56e17 100644 --- a/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp +++ b/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp @@ -45,6 +45,7 @@ #include <QtScript/qscriptcontextinfo.h> #include <QtCore/qfileinfo.h> +#include <QtCore/qcoreapplication.h> QT_BEGIN_NAMESPACE @@ -157,11 +158,11 @@ QVariant QScriptDebuggerStackModel::headerData(int section, Qt::Orientation orie return QVariant(); if (role == Qt::DisplayRole) { if (section == 0) - return QObject::tr("Level"); + return QCoreApplication::translate("QScriptDebuggerStackModel", "Level"); else if (section == 1) - return QObject::tr("Name"); + return QCoreApplication::translate("QScriptDebuggerStackModel", "Name"); else if (section == 2) - return QObject::tr("Location"); + return QCoreApplication::translate("QScriptDebuggerStackModel", "Location"); } return QVariant(); } diff --git a/src/scripttools/debugging/qscriptedit.cpp b/src/scripttools/debugging/qscriptedit.cpp index 8db9cea..7f0a5e0 100644 --- a/src/scripttools/debugging/qscriptedit.cpp +++ b/src/scripttools/debugging/qscriptedit.cpp @@ -408,14 +408,14 @@ void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e) return; bool has = m_breakpoints.contains(lineNumber); QMenu *popup = new QMenu(); - QAction *toggleAct = new QAction(QObject::tr("Toggle Breakpoint"), popup); + QAction *toggleAct = new QAction(tr("Toggle Breakpoint"), popup); popup->addAction(toggleAct); - QAction *disableAct = new QAction(QObject::tr("Disable Breakpoint"), popup); - QAction *enableAct = new QAction(QObject::tr("Enable Breakpoint"), popup); + QAction *disableAct = new QAction(tr("Disable Breakpoint"), popup); + QAction *enableAct = new QAction(tr("Enable Breakpoint"), popup); QWidget *conditionWidget = new QWidget(); { QHBoxLayout *hbox = new QHBoxLayout(conditionWidget); - hbox->addWidget(new QLabel(QObject::tr("Breakpoint Condition:"))); + hbox->addWidget(new QLabel(tr("Breakpoint Condition:"))); hbox->addWidget(new QLineEdit()); } // QWidgetAction *conditionAct = new QWidgetAction(popup); diff --git a/src/scripttools/debugging/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp index 7456da0..915d511 100644 --- a/src/scripttools/debugging/qscriptenginedebugger.cpp +++ b/src/scripttools/debugging/qscriptenginedebugger.cpp @@ -520,43 +520,43 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const QMainWindow *win = new QMainWindow(); QDockWidget *scriptsDock = new QDockWidget(win); scriptsDock->setObjectName(QLatin1String("qtscriptdebugger_scriptsDockWidget")); - scriptsDock->setWindowTitle(QObject::tr("Loaded Scripts")); + scriptsDock->setWindowTitle(tr("Loaded Scripts")); scriptsDock->setWidget(widget(ScriptsWidget)); win->addDockWidget(Qt::LeftDockWidgetArea, scriptsDock); QDockWidget *breakpointsDock = new QDockWidget(win); breakpointsDock->setObjectName(QLatin1String("qtscriptdebugger_breakpointsDockWidget")); - breakpointsDock->setWindowTitle(QObject::tr("Breakpoints")); + breakpointsDock->setWindowTitle(tr("Breakpoints")); breakpointsDock->setWidget(widget(BreakpointsWidget)); win->addDockWidget(Qt::LeftDockWidgetArea, breakpointsDock); QDockWidget *stackDock = new QDockWidget(win); stackDock->setObjectName(QLatin1String("qtscriptdebugger_stackDockWidget")); - stackDock->setWindowTitle(QObject::tr("Stack")); + stackDock->setWindowTitle(tr("Stack")); stackDock->setWidget(widget(StackWidget)); win->addDockWidget(Qt::RightDockWidgetArea, stackDock); QDockWidget *localsDock = new QDockWidget(win); localsDock->setObjectName(QLatin1String("qtscriptdebugger_localsDockWidget")); - localsDock->setWindowTitle(QObject::tr("Locals")); + localsDock->setWindowTitle(tr("Locals")); localsDock->setWidget(widget(LocalsWidget)); win->addDockWidget(Qt::RightDockWidgetArea, localsDock); QDockWidget *consoleDock = new QDockWidget(win); consoleDock->setObjectName(QLatin1String("qtscriptdebugger_consoleDockWidget")); - consoleDock->setWindowTitle(QObject::tr("Console")); + consoleDock->setWindowTitle(tr("Console")); consoleDock->setWidget(widget(ConsoleWidget)); win->addDockWidget(Qt::BottomDockWidgetArea, consoleDock); QDockWidget *debugOutputDock = new QDockWidget(win); debugOutputDock->setObjectName(QLatin1String("qtscriptdebugger_debugOutputDockWidget")); - debugOutputDock->setWindowTitle(QObject::tr("Debug Output")); + debugOutputDock->setWindowTitle(tr("Debug Output")); debugOutputDock->setWidget(widget(DebugOutputWidget)); win->addDockWidget(Qt::BottomDockWidgetArea, debugOutputDock); QDockWidget *errorLogDock = new QDockWidget(win); errorLogDock->setObjectName(QLatin1String("qtscriptdebugger_errorLogDockWidget")); - errorLogDock->setWindowTitle(QObject::tr("Error Log")); + errorLogDock->setWindowTitle(tr("Error Log")); errorLogDock->setWidget(widget(ErrorLogWidget)); win->addDockWidget(Qt::BottomDockWidgetArea, errorLogDock); @@ -568,14 +568,14 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const #ifndef QT_NO_MENUBAR win->menuBar()->addMenu(that->createStandardMenu(win)); - QMenu *editMenu = win->menuBar()->addMenu(QObject::tr("Search")); + QMenu *editMenu = win->menuBar()->addMenu(tr("Search")); editMenu->addAction(action(FindInScriptAction)); editMenu->addAction(action(FindNextInScriptAction)); editMenu->addAction(action(FindPreviousInScriptAction)); editMenu->addSeparator(); editMenu->addAction(action(GoToLineAction)); - QMenu *viewMenu = win->menuBar()->addMenu(QObject::tr("View")); + QMenu *viewMenu = win->menuBar()->addMenu(tr("View")); viewMenu->addAction(scriptsDock->toggleViewAction()); viewMenu->addAction(breakpointsDock->toggleViewAction()); viewMenu->addAction(stackDock->toggleViewAction()); @@ -593,7 +593,7 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const widget(CodeFinderWidget)->hide(); win->setCentralWidget(central); - win->setWindowTitle(QObject::tr("Qt Script Debugger")); + win->setWindowTitle(tr("Qt Script Debugger")); win->setUnifiedTitleAndToolBarOnMac(true); QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 7cf5e8b..ff9458b 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -127,7 +127,7 @@ class QODBCPrivate { public: QODBCPrivate(QODBCDriverPrivate *dpp) - : hStmt(0), useSchema(false), hasSQLFetchScroll(true), driverPrivate(dpp) + : hStmt(0), useSchema(false), hasSQLFetchScroll(true), driverPrivate(dpp), userForwardOnly(false) { unicode = false; } @@ -148,6 +148,7 @@ public: int disconnectCount; bool hasSQLFetchScroll; QODBCDriverPrivate *driverPrivate; + bool userForwardOnly; bool isStmtHandleValid(const QSqlDriver *driver); void updateStmtHandleState(const QSqlDriver *driver); @@ -848,7 +849,7 @@ bool QODBCResult::reset (const QString& query) d->updateStmtHandleState(driver()); - if (isForwardOnly()) { + if (d->userForwardOnly) { r = SQLSetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER)SQL_CURSOR_FORWARD_ONLY, @@ -885,7 +886,7 @@ bool QODBCResult::reset (const QString& query) SQLINTEGER isScrollable, bufferLength; r = SQLGetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_SCROLLABLE, &isScrollable, SQL_IS_INTEGER, &bufferLength); if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) - setForwardOnly(isScrollable==SQL_NONSCROLLABLE); + QSqlResult::setForwardOnly(isScrollable==SQL_NONSCROLLABLE); SQLSMALLINT count; SQLNumResultCols(d->hStmt, &count); @@ -1194,7 +1195,7 @@ bool QODBCResult::prepare(const QString& query) d->updateStmtHandleState(driver()); - if (isForwardOnly()) { + if (d->userForwardOnly) { r = SQLSetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER)SQL_CURSOR_FORWARD_ONLY, @@ -1508,7 +1509,7 @@ bool QODBCResult::exec() SQLINTEGER isScrollable, bufferLength; r = SQLGetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_SCROLLABLE, &isScrollable, SQL_IS_INTEGER, &bufferLength); if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) - setForwardOnly(isScrollable==SQL_NONSCROLLABLE); + QSqlResult::setForwardOnly(isScrollable==SQL_NONSCROLLABLE); SQLSMALLINT count; SQLNumResultCols(d->hStmt, &count); @@ -1639,6 +1640,12 @@ void QODBCResult::virtual_hook(int id, void *data) } } +void QODBCResult::setForwardOnly(bool forward) +{ + d->userForwardOnly = forward; + QSqlResult::setForwardOnly(forward); +} + //////////////////////////////////////// diff --git a/src/sql/drivers/odbc/qsql_odbc.h b/src/sql/drivers/odbc/qsql_odbc.h index d8a3b69..8bd7660 100644 --- a/src/sql/drivers/odbc/qsql_odbc.h +++ b/src/sql/drivers/odbc/qsql_odbc.h @@ -100,6 +100,7 @@ public: bool exec(); QVariant handle() const; + virtual void setForwardOnly(bool forward); protected: bool fetchNext(); diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp index 46508a0..2508833 100644 --- a/src/sql/drivers/tds/qsql_tds.cpp +++ b/src/sql/drivers/tds/qsql_tds.cpp @@ -754,7 +754,9 @@ QString QTDSDriver::formatValue(const QSqlField &field, r = QLatin1String("NULL"); else if (field.type() == QVariant::DateTime) { if (field.value().toDateTime().isValid()){ - r = field.value().toDateTime().toString(QLatin1String("'yyyyMMdd hh:mm:ss'")); + r = field.value().toDateTime().toString(QLatin1String("yyyyMMdd hh:mm:ss")); + r.prepend(QLatin1String("'")); + r.append(QLatin1String("'")); } else r = QLatin1String("NULL"); } else if (field.type() == QVariant::ByteArray) { @@ -805,4 +807,15 @@ QSqlIndex QTDSDriver::primaryIndex(const QString& tablename) const return idx; } +QString QTDSDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const +{ + QString res = identifier; + if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { + res.replace(QLatin1Char('"'), QLatin1String("\"\"")); + res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); + res.replace(QLatin1Char('.'), QLatin1String("\".\"")); + } + return res; +} + QT_END_NAMESPACE diff --git a/src/sql/drivers/tds/qsql_tds.h b/src/sql/drivers/tds/qsql_tds.h index 6001106..0ceae6d 100644 --- a/src/sql/drivers/tds/qsql_tds.h +++ b/src/sql/drivers/tds/qsql_tds.h @@ -116,6 +116,8 @@ public: bool trimStrings) const; QVariant handle() const; + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + protected: bool beginTransaction(); bool commitTransaction(); diff --git a/src/testlib/qtestcoreelement.h b/src/testlib/qtestcoreelement.h index e9691d5..b5e5d0f 100644 --- a/src/testlib/qtestcoreelement.h +++ b/src/testlib/qtestcoreelement.h @@ -93,9 +93,9 @@ void QTestCoreElement<ElementType>::addAttribute(const QTest::AttributeIndex att if (attribute(attributeIndex)) return; - QTestElementAttribute *attribute = new QTestElementAttribute; - attribute->setPair(attributeIndex, value); - attribute->addToList(&listOfAttributes); + QTestElementAttribute *testAttribute = new QTestElementAttribute; + testAttribute->setPair(attributeIndex, value); + testAttribute->addToList(&listOfAttributes); } template <class ElementType> diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp index 10318f1..0980777 100644 --- a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp +++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp @@ -455,7 +455,7 @@ bool XsdValidatingInstanceReader::validateElement(const XsdElement::Ptr &declara const QString value = attribute(m_xsiNilName); const Boolean::Ptr nil = Boolean::fromLexical(value); if (nil->hasError()) { - error(QtXmlPatterns::tr("attribute %1 contains invalid data: %1").arg(formatKeyword(QLatin1String("nil"))).arg(formatData(value))); + error(QtXmlPatterns::tr("attribute %1 contains invalid data: %2").arg(formatKeyword(QLatin1String("nil"))).arg(formatData(value))); return false; } |