From 09bf0e548a5542ac594e5d44639cb0aeaecdf661 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Fri, 8 Oct 2010 15:37:05 +1000 Subject: Add header guards to audio example headers. Task-number: QTBUG-13413 Reviewed-by: Andrew den Exter --- examples/multimedia/audiodevices/audiodevices.h | 4 ++++ examples/multimedia/audioinput/audioinput.h | 5 +++++ examples/multimedia/audiooutput/audiooutput.h | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/examples/multimedia/audiodevices/audiodevices.h b/examples/multimedia/audiodevices/audiodevices.h index b5b5204..d448a41 100644 --- a/examples/multimedia/audiodevices/audiodevices.h +++ b/examples/multimedia/audiodevices/audiodevices.h @@ -39,6 +39,8 @@ ** ****************************************************************************/ +#ifndef AUDIODEVICES_H +#define AUDIODEVICES_H #include #include @@ -78,3 +80,5 @@ private slots: }; +#endif + diff --git a/examples/multimedia/audioinput/audioinput.h b/examples/multimedia/audioinput/audioinput.h index be721de..bc3d702 100644 --- a/examples/multimedia/audioinput/audioinput.h +++ b/examples/multimedia/audioinput/audioinput.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef AUDIOINPUT_H +#define AUDIOINPUT_H + #include #include #include @@ -133,3 +136,5 @@ private: static const QString ResumeLabel; }; +#endif + diff --git a/examples/multimedia/audiooutput/audiooutput.h b/examples/multimedia/audiooutput/audiooutput.h index 889482b..bfcbf62 100644 --- a/examples/multimedia/audiooutput/audiooutput.h +++ b/examples/multimedia/audiooutput/audiooutput.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef AUDIOOUTPUT_H +#define AUDIOOUTPUT_H + #include #include @@ -116,3 +119,5 @@ private slots: void deviceChanged(int index); }; +#endif + -- cgit v0.12 From 7702bd86f2c0a9b2dc1ddcd745445f8c3fd2602f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 8 Oct 2010 17:05:27 +0200 Subject: Doc: Fixed qdoc warning. Reviewed-by: hjk --- src/corelib/tools/qcryptographichash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp index f418de9..8b1464f 100644 --- a/src/corelib/tools/qcryptographichash.cpp +++ b/src/corelib/tools/qcryptographichash.cpp @@ -147,7 +147,7 @@ void QCryptographicHash::addData(const char *data, int length) } /*! - /overload + \overload */ void QCryptographicHash::addData(const QByteArray &data) { -- cgit v0.12 From 7ed040dd9f4769be9b254623d295aa93dbd569b8 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 12 Oct 2010 13:31:44 +1000 Subject: Rename .pro file to match directory name. Task-number: none Reviewed-by: Trust Me --- tests/manual/qtouchevent/multitouch.pro | 5 ----- tests/manual/qtouchevent/qtouchevent.pro | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 tests/manual/qtouchevent/multitouch.pro create mode 100644 tests/manual/qtouchevent/qtouchevent.pro diff --git a/tests/manual/qtouchevent/multitouch.pro b/tests/manual/qtouchevent/multitouch.pro deleted file mode 100644 index de1ee06..0000000 --- a/tests/manual/qtouchevent/multitouch.pro +++ /dev/null @@ -1,5 +0,0 @@ -QT += testlib -SOURCES = main.cpp \ - touchwidget.cpp -FORMS += form.ui -HEADERS += touchwidget.h diff --git a/tests/manual/qtouchevent/qtouchevent.pro b/tests/manual/qtouchevent/qtouchevent.pro new file mode 100644 index 0000000..de1ee06 --- /dev/null +++ b/tests/manual/qtouchevent/qtouchevent.pro @@ -0,0 +1,5 @@ +QT += testlib +SOURCES = main.cpp \ + touchwidget.cpp +FORMS += form.ui +HEADERS += touchwidget.h -- cgit v0.12 From 8bac84cba1cc1de4c3d0b87772168184a2540076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 12 Oct 2010 12:54:15 +0200 Subject: Revert "Don't define highp/mediump/lowp if desktop GL has them" This reverts commit 6155050f68cc86c445552da61a5f240c16f5e2cd. The GL_ARB_ES2_compatibility extension does not mention the lowp, mediump or highp keywords. Task-number: QTBUG-14384 Reviewed-by: Samuel Reviewed-by: Prasanth --- dist/changes-4.6.4 | 4 +--- src/opengl/qgl.cpp | 3 --- src/opengl/qgl_p.h | 3 +-- src/opengl/qglshaderprogram.cpp | 10 ++-------- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/dist/changes-4.6.4 b/dist/changes-4.6.4 index 389aa3a..3949b9a 100644 --- a/dist/changes-4.6.4 +++ b/dist/changes-4.6.4 @@ -66,8 +66,6 @@ QtOpenGL - QGLShaderProgram * [QTBUG-12478] Don't resolve GLSL extensions if no shaders. * [QTBUG-12591] setUniformValue(QSize) was setting (w,w) not (w,h). - * [QTBUG-12862] Don't #define highp/mediump/lowp if the desktop OpenGL - implementation has the GL_ARB_ES2_compatibility extension. * [QTBUG-12554] Wrong OpenGLVersionFlags on OpenGL 4.0 systems. QtScript @@ -109,7 +107,7 @@ Third party components Qt for Unix (X11 and Mac OS X) ------------------------------ - - + - Qt for Linux/X11 ---------------- diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index f3d0d81..49a362c 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4933,8 +4933,6 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FragmentShader; if (extensions.match("GL_ARB_shader_objects")) glExtensions |= FragmentShader; - if (extensions.match("GL_ARB_ES2_compatibility")) - glExtensions |= ES2Compatibility; if (extensions.match("GL_ARB_texture_mirrored_repeat")) glExtensions |= MirroredRepeat; if (extensions.match("GL_EXT_framebuffer_object")) @@ -4953,7 +4951,6 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FramebufferObject; glExtensions |= GenerateMipmap; glExtensions |= FragmentShader; - glExtensions |= ES2Compatibility; #endif #if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) if (extensions.match("GL_OES_framebuffer_object")) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 1603ca1..4facb65 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -291,8 +291,7 @@ public: DDSTextureCompression = 0x00008000, ETC1TextureCompression = 0x00010000, PVRTCTextureCompression = 0x00020000, - FragmentShader = 0x00040000, - ES2Compatibility = 0x00080000 + FragmentShader = 0x00040000 }; Q_DECLARE_FLAGS(Extensions, Extension) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 9bfe027..edbb635 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -97,10 +97,6 @@ QT_BEGIN_NAMESPACE to just features that are present in GLSL/ES, and avoid standard variable names that only work on the desktop. - If the \c{GL_ARB_ES2_compatibility} extension is present, - then the above prefix is not added because the desktop OpenGL - implementation supports precision qualifiers. - \section1 Simple shader example \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 1 @@ -394,10 +390,8 @@ bool QGLShader::compileSourceCode(const char *source) srclen.append(GLint(headerLen)); } #ifdef QGL_DEFINE_QUALIFIERS - if (!(QGLExtensions::glExtensions() & QGLExtensions::ES2Compatibility)) { - src.append(qualifierDefines); - srclen.append(GLint(sizeof(qualifierDefines) - 1)); - } + src.append(qualifierDefines); + srclen.append(GLint(sizeof(qualifierDefines) - 1)); #endif #ifdef QGL_REDEFINE_HIGHP if (d->shaderType == Fragment) { -- cgit v0.12 From ca53010303bca1b686fdd0488e0549c0a42a60a1 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Wed, 13 Oct 2010 11:43:25 +1000 Subject: Demo Spectrum wav data size is not calculated correctly - Grab length of audio data from Data chunk size - Read from the device no greater than the audio Data chunk size Task-number: QTBUG-13779 Reviewed-by: Andrew den Exter --- demos/spectrum/app/wavfile.cpp | 168 ++++++++++++++++++++++------------------- demos/spectrum/app/wavfile.h | 1 + 2 files changed, 90 insertions(+), 79 deletions(-) diff --git a/demos/spectrum/app/wavfile.cpp b/demos/spectrum/app/wavfile.cpp index b9467e3..74d5918 100644 --- a/demos/spectrum/app/wavfile.cpp +++ b/demos/spectrum/app/wavfile.cpp @@ -76,80 +76,84 @@ struct CombinedHeader { RIFFHeader riff; WAVEHeader wave; - DATAHeader data; }; -static const int HeaderLength = sizeof(CombinedHeader); WavFile::WavFile(const QAudioFormat &format, qint64 dataLength) - : m_format(format) - , m_dataLength(dataLength) + : m_format(format) + , m_dataLength(dataLength) + , m_dataPosition(0) { - } bool WavFile::readHeader(QIODevice &device) { - bool result = true; - - if (!device.isSequential()) - result = device.seek(0); - // else, assume that current position is the start of the header - - if (result) { - CombinedHeader header; - result = (device.read(reinterpret_cast(&header), HeaderLength) == HeaderLength); - if (result) { - if ((memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0 - || memcmp(&header.riff.descriptor.id, "RIFX", 4) == 0) - && memcmp(&header.riff.type, "WAVE", 4) == 0 - && memcmp(&header.wave.descriptor.id, "fmt ", 4) == 0 - && header.wave.audioFormat == 1 // PCM - ) { - if (memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0) - m_format.setByteOrder(QAudioFormat::LittleEndian); - else - m_format.setByteOrder(QAudioFormat::BigEndian); - - m_format.setChannels(qFromLittleEndian(header.wave.numChannels)); - m_format.setCodec("audio/pcm"); - m_format.setFrequency(qFromLittleEndian(header.wave.sampleRate)); - m_format.setSampleSize(qFromLittleEndian(header.wave.bitsPerSample)); - - switch(header.wave.bitsPerSample) { - case 8: - m_format.setSampleType(QAudioFormat::UnSignedInt); - break; - case 16: - m_format.setSampleType(QAudioFormat::SignedInt); - break; - default: - result = false; - } - - m_dataLength = device.size() - HeaderLength; - } else { - result = false; - } + if (!device.isSequential()) { + if (!device.seek(0)) + return false; + // XXX: else, assume that current position is the start of the header + } + + CombinedHeader header; + if (device.read(reinterpret_cast(&header), sizeof(CombinedHeader)) != sizeof(CombinedHeader)) + return false; + + if ((memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0 + || memcmp(&header.riff.descriptor.id, "RIFX", 4) == 0) + && memcmp(&header.riff.type, "WAVE", 4) == 0 + && memcmp(&header.wave.descriptor.id, "fmt ", 4) == 0 + && (header.wave.audioFormat == 1 || header.wave.audioFormat == 0)) { + + // Read off remaining header information + DATAHeader dataHeader; + + if (qFromLittleEndian(header.wave.descriptor.size) > sizeof(WAVEHeader)) { + // Extended data available + quint16 extraFormatBytes; + if (device.peek((char*)&extraFormatBytes, sizeof(quint16)) != sizeof(quint16)) + return false; + const qint64 throwAwayBytes = sizeof(quint16) + qFromLittleEndian(extraFormatBytes); + if (device.read(throwAwayBytes).size() != throwAwayBytes) + return false; } + + if (device.read((char*)&dataHeader, sizeof(DATAHeader)) != sizeof(DATAHeader)) + return false; + + // Establish format + if (memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0) + m_format.setByteOrder(QAudioFormat::LittleEndian); + else + m_format.setByteOrder(QAudioFormat::BigEndian); + + int bps = qFromLittleEndian(header.wave.bitsPerSample); + m_format.setChannels(qFromLittleEndian(header.wave.numChannels)); + m_format.setCodec("audio/pcm"); + m_format.setFrequency(qFromLittleEndian(header.wave.sampleRate)); + m_format.setSampleSize(qFromLittleEndian(header.wave.bitsPerSample)); + m_format.setSampleType(bps == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt); + + m_dataLength = qFromLittleEndian(dataHeader.descriptor.size); + m_dataPosition = 0; } - return result; + return true; } bool WavFile::writeHeader(QIODevice &device) { CombinedHeader header; + DATAHeader dataHeader; - memset(&header, 0, HeaderLength); + memset(&header, 0, sizeof(CombinedHeader)); // RIFF header if (m_format.byteOrder() == QAudioFormat::LittleEndian) strncpy(&header.riff.descriptor.id[0], "RIFF", 4); else strncpy(&header.riff.descriptor.id[0], "RIFX", 4); - qToLittleEndian(quint32(m_dataLength + HeaderLength - 8), + qToLittleEndian(quint32(m_dataLength + sizeof(CombinedHeader) + sizeof(DATAHeader) - sizeof(chunk)), reinterpret_cast(&header.riff.descriptor.size)); strncpy(&header.riff.type[0], "WAVE", 4); @@ -171,11 +175,12 @@ bool WavFile::writeHeader(QIODevice &device) reinterpret_cast(&header.wave.bitsPerSample)); // DATA header - strncpy(&header.data.descriptor.id[0], "data", 4); + strncpy(dataHeader.descriptor.id, "data", 4); qToLittleEndian(quint32(m_dataLength), - reinterpret_cast(&header.data.descriptor.size)); + reinterpret_cast(&dataHeader.descriptor.size)); - return (device.write(reinterpret_cast(&header), HeaderLength) == HeaderLength); + return device.write(reinterpret_cast(&header), sizeof(CombinedHeader)) == sizeof(CombinedHeader) + && device.write(reinterpret_cast(&dataHeader), sizeof(DATAHeader)) == sizeof(DATAHeader); } const QAudioFormat& WavFile::format() const @@ -190,7 +195,7 @@ qint64 WavFile::dataLength() const qint64 WavFile::headerLength() { - return HeaderLength; + return sizeof(CombinedHeader); } bool WavFile::writeDataLength(QIODevice &device, qint64 dataLength) @@ -205,42 +210,47 @@ bool WavFile::writeDataLength(QIODevice &device, qint64 dataLength) return result; } -#include -#include - qint64 WavFile::readData(QIODevice &device, QByteArray &buffer, QAudioFormat outputFormat) { - if (QAudioFormat() == outputFormat) + // Sanity checks + if (!outputFormat.isValid()) outputFormat = m_format; + if (!isPCMS16LE(outputFormat) || !isPCMS16LE(m_format)) + return 0; + + if (m_dataPosition == m_dataLength) + return 0; + + // Process qint64 result = 0; - QFile file("wav.txt"); - file.open(QIODevice::WriteOnly | QIODevice::Text); - QTextStream stream; - stream.setDevice(&file); - - if (isPCMS16LE(outputFormat) && isPCMS16LE(m_format)) { - QVector inputSample(2 * m_format.channels()); - - qint16 *output = reinterpret_cast(buffer.data()); - - while (result < buffer.size()) { - if (device.read(inputSample.data(), inputSample.count())) { - int inputIdx = 0; - for (int outputIdx = 0; outputIdx < outputFormat.channels(); ++outputIdx) { - const qint16* input = reinterpret_cast(inputSample.data() + 2 * inputIdx); - *output++ = qFromLittleEndian(*input); - result += 2; - if (inputIdx < m_format.channels()) - ++inputIdx; - } - } else { - break; + const int frameSize = 2 * m_format.channels(); // 16 bit samples + QVector inputSample(frameSize); + + qint16 *output = reinterpret_cast(buffer.data()); + + while (result < buffer.size()) { + if (m_dataPosition == m_dataLength) + break; + + // XXX only working with particular alignments + if (device.read(inputSample.data(), inputSample.count())) { + int inputIdx = 0; + for (int outputIdx = 0; outputIdx < outputFormat.channels(); ++outputIdx) { + const qint16* input = reinterpret_cast(inputSample.data() + 2 * inputIdx); + *output++ = qFromLittleEndian(*input); + result += 2; + if (inputIdx < m_format.channels()) + ++inputIdx; } + m_dataPosition += frameSize; + } else { + break; } } + return result; } diff --git a/demos/spectrum/app/wavfile.h b/demos/spectrum/app/wavfile.h index f2f3304..fc14b08 100644 --- a/demos/spectrum/app/wavfile.h +++ b/demos/spectrum/app/wavfile.h @@ -77,6 +77,7 @@ public: private: QAudioFormat m_format; qint64 m_dataLength; + qint64 m_dataPosition; }; #endif -- cgit v0.12 From 9d81ddd3da51166a9fc92073cf7ba508cdd22dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 22 Oct 2010 12:17:56 +0200 Subject: Added support for blitting to native child widgets in GL window surface. Support blitting by copying from the top-level window's back buffer to a temporary texture and then blitting from the texture to the native child widget. Performance suffers, but it's better than failing. Reviewed-by: Gunnar Sletta --- src/opengl/qgl.cpp | 2 +- src/opengl/qgl_egl.cpp | 4 +- src/opengl/qgl_p.h | 2 +- src/opengl/qwindowsurface_gl.cpp | 139 +++++++++++++++++++++++---------------- src/opengl/qwindowsurface_gl_p.h | 1 + 5 files changed, 88 insertions(+), 60 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 62eff6e..dbd295f 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2104,7 +2104,7 @@ void QGLContextPrivate::syncGlState() #undef ctx #ifdef QT_NO_EGL -void QGLContextPrivate::swapRegion(const QRegion *) +void QGLContextPrivate::swapRegion(const QRegion &) { Q_Q(QGLContext); q->swapBuffers(); diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index c79c4cd..27f7ad9 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -276,12 +276,12 @@ EGLSurface QGLContextPrivate::eglSurfaceForDevice() const return eglSurface; } -void QGLContextPrivate::swapRegion(const QRegion *region) +void QGLContextPrivate::swapRegion(const QRegion ®ion) { if (!valid || !eglContext) return; - eglContext->swapBuffersRegion2NOK(eglSurfaceForDevice(), region); + eglContext->swapBuffersRegion2NOK(eglSurfaceForDevice(), ®ion); } void QGLWidget::setMouseTracking(bool enable) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 6c494ee..f86c77f 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -343,7 +343,7 @@ public: void setVertexAttribArrayEnabled(int arrayIndex, bool enabled = true); void syncGlState(); // Makes sure the GL context's state is what we think it is - void swapRegion(const QRegion *region); + void swapRegion(const QRegion ®ion); #if defined(Q_WS_WIN) void updateFormatVersion(); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 8157b2a..9f3dcdf 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -275,6 +275,8 @@ struct QGLWindowSurfacePrivate QRegion paintedRegion; QSize size; + QSize textureSize; + QList buffers; QGLWindowSurfaceGLPaintDevice glDevice; QGLWindowSurface* q_ptr; @@ -316,6 +318,7 @@ QGLWindowSurface::QGLWindowSurface(QWidget *window) d_ptr->pb = 0; d_ptr->fbo = 0; d_ptr->ctx = 0; + d_ptr->tex_id = 0; #if defined (QT_OPENGL_ES_2) d_ptr->tried_fbo = true; d_ptr->tried_pb = true; @@ -433,7 +436,7 @@ static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, void QGLWindowSurface::beginPaint(const QRegion &) { - if (! context()) + if (!context()) return; int clearFlags = 0; @@ -457,13 +460,42 @@ void QGLWindowSurface::endPaint(const QRegion &rgn) d_ptr->buffers.clear(); } -void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset) +static void blitTexture(QGLContext *ctx, GLuint texture, const QSize &viewport, const QSize &texSize, const QRect &targetRect, const QRect &sourceRect) { - if (context() && widget != window()) { - qWarning("No native child widget support in GL window surface without FBOs or pixel buffers"); - return; - } + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_BLEND); + + glViewport(0, 0, viewport.width(), viewport.height()); + + QGLShaderProgram *blitProgram = + QGLEngineSharedShaders::shadersForContext(ctx)->blitProgram(); + blitProgram->bind(); + blitProgram->setUniformValue("imageTexture", 0 /*QT_IMAGE_TEXTURE_UNIT*/); + + // The shader manager's blit program does not multiply the + // vertices by the pmv matrix, so we need to do the effect + // of the orthographic projection here ourselves. + QRectF r; + qreal w = viewport.width(); + qreal h = viewport.height(); + r.setLeft((targetRect.left() / w) * 2.0f - 1.0f); + if (targetRect.right() == (viewport.width() - 1)) + r.setRight(1.0f); + else + r.setRight((targetRect.right() / w) * 2.0f - 1.0f); + r.setBottom((targetRect.top() / h) * 2.0f - 1.0f); + if (targetRect.bottom() == (viewport.height() - 1)) + r.setTop(1.0f); + else + r.setTop((targetRect.bottom() / w) * 2.0f - 1.0f); + + drawTexture(r, texture, texSize, sourceRect); +} + +void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset) +{ //### Find out why d_ptr->geometry_updated isn't always false. // flush() should not be called when d_ptr->geometry_updated is true. It assumes that either // d_ptr->fbo or d_ptr->pb is allocated and has the correct size. @@ -534,12 +566,29 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & } } #endif - if (hasPartialUpdateSupport() && - d_ptr->paintedRegion.boundingRect().width() * d_ptr->paintedRegion.boundingRect().height() < - geometry().width() * geometry().height() * 0.2) { - context()->d_func()->swapRegion(&d_ptr->paintedRegion); - } else - context()->swapBuffers(); + bool doingPartialUpdate = hasPartialUpdateSupport() && br.width() * br.height() < parent->geometry().width() * parent->geometry().height() * 0.2; + QGLContext *ctx = reinterpret_cast(parent->d_func()->extraData()->glContext); + if (widget != window()) { + if (initializeOffscreenTexture(window()->size())) + qWarning() << "QGLWindowSurface: Flushing to native child widget, may lead to significant performance loss"; + glBindTexture(target, d_ptr->tex_id); + + const uint bottom = window()->height() - (br.y() + br.height()); + glCopyTexSubImage2D(target, 0, br.x(), bottom, br.x(), bottom, br.width(), br.height()); + + glBindTexture(target, 0); + + ctx->makeCurrent(); + if (doingPartialUpdate) + blitTexture(ctx, d_ptr->tex_id, parent->size(), window()->size(), rect, br); + else + blitTexture(ctx, d_ptr->tex_id, parent->size(), window()->size(), parent->rect(), parent->rect().translated(offset + wOffset)); + } + + if (doingPartialUpdate) + ctx->d_func()->swapRegion(br); + else + ctx->swapBuffers(); d_ptr->paintedRegion = QRegion(); } else { @@ -665,38 +714,10 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & else if (d_ptr->fbo) { Q_UNUSED(target); - GLuint texture = d_ptr->fbo->texture(); - - glDisable(GL_DEPTH_TEST); - if (d_ptr->fbo->isBound()) d_ptr->fbo->release(); - glViewport(0, 0, size.width(), size.height()); - - QGLShaderProgram *blitProgram = - QGLEngineSharedShaders::shadersForContext(ctx)->blitProgram(); - blitProgram->bind(); - blitProgram->setUniformValue("imageTexture", 0 /*QT_IMAGE_TEXTURE_UNIT*/); - - // The shader manager's blit program does not multiply the - // vertices by the pmv matrix, so we need to do the effect - // of the orthographic projection here ourselves. - QRectF r; - qreal w = size.width() ? size.width() : 1.0f; - qreal h = size.height() ? size.height() : 1.0f; - r.setLeft((rect.left() / w) * 2.0f - 1.0f); - if (rect.right() == (size.width() - 1)) - r.setRight(1.0f); - else - r.setRight((rect.right() / w) * 2.0f - 1.0f); - r.setBottom((rect.top() / h) * 2.0f - 1.0f); - if (rect.bottom() == (size.height() - 1)) - r.setTop(1.0f); - else - r.setTop((rect.bottom() / w) * 2.0f - 1.0f); - - drawTexture(r, texture, window()->size(), br); + blitTexture(ctx, d_ptr->fbo->texture(), size, window()->size(), rect, br); } #endif @@ -719,7 +740,6 @@ void QGLWindowSurface::updateGeometry() { return; d_ptr->geometry_updated = false; - QRect rect = geometry(); hijackWindow(window()); QGLContext *ctx = reinterpret_cast(window()->d_func()->extraData()->glContext); @@ -740,11 +760,8 @@ void QGLWindowSurface::updateGeometry() { if (d_ptr->ctx) { #ifndef QT_OPENGL_ES_2 - if (d_ptr->destructive_swap_buffers) { - glBindTexture(target, d_ptr->tex_id); - glTexImage2D(target, 0, GL_RGBA, rect.width(), rect.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0); - glBindTexture(target, 0); - } + if (d_ptr->destructive_swap_buffers) + initializeOffscreenTexture(rect.size()); #endif return; } @@ -824,15 +841,8 @@ void QGLWindowSurface::updateGeometry() { ctx->makeCurrent(); #ifndef QT_OPENGL_ES_2 - if (d_ptr->destructive_swap_buffers) { - glGenTextures(1, &d_ptr->tex_id); - glBindTexture(target, d_ptr->tex_id); - glTexImage2D(target, 0, GL_RGBA, rect.width(), rect.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0); - - glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glBindTexture(target, 0); - } + if (d_ptr->destructive_swap_buffers) + initializeOffscreenTexture(rect.size()); #endif qDebug() << "QGLWindowSurface: Using plain widget as window surface" << this;; @@ -840,6 +850,23 @@ void QGLWindowSurface::updateGeometry() { d_ptr->ctx->d_ptr->internal_context = true; } +bool QGLWindowSurface::initializeOffscreenTexture(const QSize &size) +{ + if (size == d_ptr->textureSize) + return false; + + glGenTextures(1, &d_ptr->tex_id); + glBindTexture(GL_TEXTURE_2D, d_ptr->tex_id); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, size.width(), size.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glBindTexture(GL_TEXTURE_2D, 0); + + d_ptr->textureSize = size; + return true; +} + bool QGLWindowSurface::scroll(const QRegion &area, int dx, int dy) { // this code randomly fails currently for unknown reasons diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index ffc2e86..6906f35 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -107,6 +107,7 @@ private slots: private: void hijackWindow(QWidget *widget); + bool initializeOffscreenTexture(const QSize &size); QGLWindowSurfacePrivate *d_ptr; }; -- cgit v0.12 From ccfa6f282fc7a4c258c83844433f04a6380e4055 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Fri, 22 Oct 2010 17:48:03 +0200 Subject: For meego graphics system, use floyd-steinberg dithering when converting to 16bit. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2496 Reviewed-by: Samuel Rødal --- src/plugins/graphicssystems/meego/dithering.cpp | 267 +++++++++++++++++++++ src/plugins/graphicssystems/meego/meego.pro | 2 +- .../graphicssystems/meego/qmeegopixmapdata.cpp | 33 +-- 3 files changed, 278 insertions(+), 24 deletions(-) create mode 100644 src/plugins/graphicssystems/meego/dithering.cpp diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp new file mode 100644 index 0000000..6eeabd3 --- /dev/null +++ b/src/plugins/graphicssystems/meego/dithering.cpp @@ -0,0 +1,267 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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$ +** +****************************************************************************/ + +// This is an implementation of the 32bit => 16bit Floyd-Steinberg dithering. +// The alghorithm used here is not the fastest possible but it's prolly fast enough: +// uses look-up tables, integer-only arthmetics and works in one pass on two lines +// at a time. It's a high-quality dithering using 1/8 diffusion precission. +// Two functions here to look at: +// +// * convertRGBA32_to_RGB565 +// * convertRGBA32_to_RGBA4444 +// +// Each channel (RGBA) is diffused independently and alpha is dithered too. + +#include +#include +#include +#include + +// Gets a component (red = 1, green = 2...) from a RGBA data structure. +// data is unsigned char. stride is the number of bytes per line. +#define GET_RGBA_COMPONENT(data, x, y, stride, c) (data[(y * stride) + (x << 2) + c]) + +// Writes a new pixel with r, g, b to data in 565 16bit format. Data is a short. +#define PUT_565(data, x, y, width, r, g, b) (data[(y * width) + x] = (r << 11) | (g << 5) | b) + +// Writes a new pixel with r, g, b, a to data in 4444 RGBA 16bit format. Data is a short. +#define PUT_4444(data, x, y, width, r, g, b, a) (data[(y * width) + x] = (r << 12) | (g << 8) | (b << 4) | a) + +// Writes(ads) a new value to the diffusion accumulator. accumulator is a short. +// x, y is a position in the accumulation buffer. y can be 0 or 1 -- we operate on two lines at time. +#define ACCUMULATE(accumulator, x, y, width, v) if (x < width && x > 0) accumulator[(y * width) + x] += v + +// Clamps a value to be in 0..255 range. +#define CLAMP_256(v) if (v > 255) v = 255; if (v < 0) v = 0; + +// Converts incoming RGB32 (QImage::Format_RGB32) to RGB565. Returns the newly allocated data. +unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride) +{ + // Will store output + unsigned short *out = (unsigned short *) malloc(width * height * 2); + + // Lookup tables for the 8bit => 6bit and 8bit => 5bit conversion + unsigned char lookup_8bit_to_5bit[256]; + short lookup_8bit_to_5bit_diff[256]; + unsigned char lookup_8bit_to_6bit[256]; + short lookup_8bit_to_6bit_diff[256]; + + // Macros for the conversion using the lookup table. + #define CONVERT_8BIT_TO_5BIT(v) (lookup_8bit_to_5bit[v]) + #define DIFF_8BIT_TO_5BIT(v) (lookup_8bit_to_5bit_diff[v]) + + #define CONVERT_8BIT_TO_6BIT(v) (lookup_8bit_to_6bit[v]) + #define DIFF_8BIT_TO_6BIT(v) (lookup_8bit_to_6bit_diff[v]) + + int i; + int x, y, c; // Pixel we're processing. c is component number (0, 1, 2 for r, b, b) + short component[3]; // Stores the new components (r, g, b) for pixel produced during conversion + short diff; // The difference between the converted value and the original one. To be accumulated. + short accumulator[3][width * 2]; // Three acumulators for r, g, b. Each accumulator is two lines. + + // Produce the conversion lookup tables. + for (i = 0; i < 256; i++) { + lookup_8bit_to_5bit[i] = round(i / 8.0); + if (lookup_8bit_to_5bit[i] > 31) + lookup_8bit_to_5bit[i] -= 1; + + // Before bitshifts: (i * 8) - (... * 8 * 8) + lookup_8bit_to_5bit_diff[i] = (i << 3) - (lookup_8bit_to_5bit[i] << 6); + + lookup_8bit_to_6bit[i] = round(i / 4.0); + if (lookup_8bit_to_6bit[i] > 63) + lookup_8bit_to_6bit[i] -= 1; + + // Before bitshifts: (i * 8) - (... * 4 * 8) + lookup_8bit_to_6bit_diff[i] = (i << 3) - (lookup_8bit_to_6bit[i] << 5); + } + + // Clear the accumulators + memset(accumulator[0], 0, width * 4); + memset(accumulator[1], 0, width * 4); + memset(accumulator[2], 0, width * 4); + + // For each line... + for (y = 0; y < height; y++) { + + // For each accumulator, move the second line (index 1) to replace the first line (index 0). + // Clear the second line (index 1) + memcpy(accumulator[0], accumulator[0] + width, width * 2); + memset(accumulator[0] + width, 0, width * 2); + + memcpy(accumulator[1], accumulator[1] + width, width * 2); + memset(accumulator[1] + width, 0, width * 2); + + memcpy(accumulator[2], accumulator[2] + width, width * 2); + memset(accumulator[2] + width, 0, width * 2); + + // For each column.... + for (x = 0; x < width; x++) { + + // For each component (r, g, b)... + for (c = 0; c < 3; c++) { + + // Get the 8bit value from the original image + component[c] = GET_RGBA_COMPONENT(in, x, y, stride, c); + + // Add the diffusion for this pixel we stored in the accumulator. + // >> 7 because the values in accumulator are stored * 128 + component[c] += accumulator[c][x] >> 7; + + // Make sure we're not over the boundries. + CLAMP_256(component[c]); + + // For green component we use 6 bits. Otherwise 5 bits. + // Store the difference from converting 8bit => 6 bit and the orig pixel. + // Convert 8bit => 6(5) bit. + if (c == 1) { + diff = DIFF_8BIT_TO_6BIT(component[c]); + component[c] = CONVERT_8BIT_TO_6BIT(component[c]); + } else { + diff = DIFF_8BIT_TO_5BIT(component[c]); + component[c] = CONVERT_8BIT_TO_5BIT(component[c]); + } + + // Distribute the difference according to the matrix in the + // accumulation bufffer. + ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 7); + ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 3); + ACCUMULATE(accumulator[c], x, 1, width, diff * 5); + ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 1); + } + + // Write the newly produced pixel + PUT_565(out, x, y, width, component[2], component[1], component[0]); + } + } + + return out; +} + +// Converts incoming RGBA32 (QImage::Format_ARGB32_Premultiplied) to RGB565. Returns the newly allocated data. +// This function is similiar (yet different) to the _565 variant but it makes sense to duplicate it here for simplicity. +unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride) +{ + // Will store output + unsigned short *out = (unsigned short *) malloc(width * height * 2); + + // Lookup tables for the 8bit => 4bit conversion + unsigned char lookup_8bit_to_4bit[256]; + short lookup_8bit_to_4bit_diff[256]; + + // Macros for the conversion using the lookup table. + #define CONVERT_8BIT_TO_4BIT(v) (lookup_8bit_to_4bit[v]) + #define DIFF_8BIT_TO_4BIT(v) (lookup_8bit_to_4bit_diff[v]) + + int i; + int x, y, c; // Pixel we're processing. c is component number (0, 1, 2, 3 for r, b, b, a) + short component[4]; // Stores the new components (r, g, b, a) for pixel produced during conversion + short diff; // The difference between the converted value and the original one. To be accumulated. + short accumulator[4][width * 2]; // Four acumulators for r, g, b, a. Each accumulator is two lines. + + // Produce the conversion lookup tables. + for (i = 0; i < 256; i++) { + lookup_8bit_to_4bit[i] = round(i / 16.0); + if (lookup_8bit_to_4bit[i] > 15) + lookup_8bit_to_4bit[i] -= 1; + + // Before bitshifts: (i * 8) - (... * 16 * 8) + lookup_8bit_to_4bit_diff[i] = (i << 3) - (lookup_8bit_to_4bit[i] << 7); + } + + // Clear the accumulators + memset(accumulator[0], 0, width * 4); + memset(accumulator[1], 0, width * 4); + memset(accumulator[2], 0, width * 4); + memset(accumulator[3], 0, width * 4); + + // For each line... + for (y = 0; y < height; y++) { + + // For each component (r, g, b, a)... + memcpy(accumulator[0], accumulator[0] + width, width * 2); + memset(accumulator[0] + width, 0, width * 2); + + memcpy(accumulator[1], accumulator[1] + width, width * 2); + memset(accumulator[1] + width, 0, width * 2); + + memcpy(accumulator[2], accumulator[2] + width, width * 2); + memset(accumulator[2] + width, 0, width * 2); + + memcpy(accumulator[3], accumulator[3] + width, width * 2); + memset(accumulator[3] + width, 0, width * 2); + + // For each column.... + for (x = 0; x < width; x++) { + + // For each component (r, g, b, a)... + for (c = 0; c < 4; c++) { + + // Get the 8bit value from the original image + component[c] = GET_RGBA_COMPONENT(in, x, y, stride, c); + + // Add the diffusion for this pixel we stored in the accumulator. + // >> 7 because the values in accumulator are stored * 128 + component[c] += accumulator[c][x] >> 7; + + // Make sure we're not over the boundries. + CLAMP_256(component[c]); + + // Store the difference from converting 8bit => 4bit and the orig pixel. + // Convert 8bit => 4bit. + diff = DIFF_8BIT_TO_4BIT(component[c]); + component[c] = CONVERT_8BIT_TO_4BIT(component[c]); + + // Distribute the difference according to the matrix in the + // accumulation bufffer. + ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 7); + ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 3); + ACCUMULATE(accumulator[c], x, 1, width, diff * 5); + ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 1); + } + + // Write the newly produced pixel + PUT_4444(out, x, y, width, component[0], component[1], component[2], component[3]); + } + } + + return out; +} diff --git a/src/plugins/graphicssystems/meego/meego.pro b/src/plugins/graphicssystems/meego/meego.pro index 0b157fa..0d3cce6 100644 --- a/src/plugins/graphicssystems/meego/meego.pro +++ b/src/plugins/graphicssystems/meego/meego.pro @@ -6,7 +6,7 @@ QT += gui opengl QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems HEADERS = qmeegographicssystem.h qmeegopixmapdata.h qmeegoextensions.h qmeegorasterpixmapdata.h qmeegolivepixmapdata.h -SOURCES = qmeegographicssystem.cpp qmeegographicssystem.h qmeegographicssystemplugin.h qmeegographicssystemplugin.cpp qmeegopixmapdata.h qmeegopixmapdata.cpp qmeegoextensions.h qmeegoextensions.cpp qmeegorasterpixmapdata.h qmeegorasterpixmapdata.cpp qmeegolivepixmapdata.cpp qmeegolivepixmapdata.h +SOURCES = qmeegographicssystem.cpp qmeegographicssystem.h qmeegographicssystemplugin.h qmeegographicssystemplugin.cpp qmeegopixmapdata.h qmeegopixmapdata.cpp qmeegoextensions.h qmeegoextensions.cpp qmeegorasterpixmapdata.h qmeegorasterpixmapdata.cpp qmeegolivepixmapdata.cpp qmeegolivepixmapdata.h dithering.cpp target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems INSTALLS += target diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp index 0899f2d..02a4273 100644 --- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp +++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp @@ -48,28 +48,14 @@ #include #include +// from dithering.cpp +extern unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride); +extern unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride); + static EGLint preserved_image_attribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE }; QHash QMeeGoPixmapData::sharedImagesMap; -// This helper method converts (in place) a QImage::Format_ARGB4444_Premultiplied to -// GL-friendly Format_RGBA4444_Premultiplied. Just swaps the bits around really. -static void qARGBA4ToRGBA4(QImage *image) -{ - unsigned char *raw = static_cast (image->data_ptr()->data); - // FIXME image.bytesPerLine() is broken. Returns 512 for 128x128 image while it should - // return 256 - int bytesPerLine = image->width() * 2; - - for (int y = 0; y < image->height(); y++) { - for (int x = 0; x < image->width(); x++) { - unsigned short *target = (unsigned short *) (raw + (y * bytesPerLine + (x * 2))); - // FIXME Oh yeah, that's broken with endianness. - *target = (*target << 4) | (* target >> 12); - } - } -} - /* Public */ QMeeGoPixmapData::QMeeGoPixmapData() : QGLPixmapData(QPixmapData::PixmapType) @@ -160,12 +146,13 @@ Qt::HANDLE QMeeGoPixmapData::imageToEGLSharedImage(const QImage &image) glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); if (image.hasAlphaChannel() && const_cast(image).data_ptr()->checkForAlphaPixels()) { - QImage convertedImage = image.convertToFormat(QImage::Format_ARGB4444_Premultiplied, Qt::DiffuseAlphaDither | Qt::DiffuseDither | Qt::PreferDither); - qARGBA4ToRGBA4(&convertedImage); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, convertedImage.bits()); + void *converted = convertARGB32_to_RGBA4444(image.bits(), image.width(), image.height(), image.bytesPerLine()); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, converted); + free(converted); } else { - QImage convertedImage = image.convertToFormat(QImage::Format_RGB16, Qt::DiffuseAlphaDither | Qt::DiffuseDither | Qt::PreferDither); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, convertedImage.bits()); + void *converted = convertRGB32_to_RGB565(image.bits(), image.width(), image.height(), image.bytesPerLine()); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, converted); + free(converted); } glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); -- cgit v0.12 From 3f744a4e816b8a7850e8c0479b254a8e6bd2e74f Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Fri, 22 Oct 2010 20:11:22 +0000 Subject: QtDFB: Make transparent windows behave better Windows with Qt::WA_NoSystemBackground should clear to transparent in beginPaint. Merge-request: 882 Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbscreen.cpp | 36 ++++++++++++---------- src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 1 + .../gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 9 +++++- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index bf6164d..f2ee6ae 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1554,9 +1554,8 @@ void QDirectFBScreen::exposeRegion(QRegion r, int) : (DSBLIT_BLEND_ALPHACHANNEL|DSBLIT_BLEND_COLORALPHA); } } - if (!region.isEmpty()) { - solidFill(d_ptr->backgroundColor, region); - } + + solidFill(d_ptr->backgroundColor, region); while (idx > 0) { const PaintCommand &cmd = commands[--idx]; @@ -1629,29 +1628,34 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion ®ion) Q_UNUSED(color); Q_UNUSED(region); #else + QDirectFBScreen::solidFill(d_ptr->primarySurface, color, region); +#endif +} + +static inline void clearRect(IDirectFBSurface *surface, const QColor &color, const QRect &rect) +{ + Q_ASSERT(surface); + const DFBRegion region = { rect.left(), rect.top(), rect.right(), rect.bottom() }; + // could just reinterpret_cast this to a DFBRegion + surface->SetClip(surface, ®ion); + surface->Clear(surface, color.red(), color.green(), color.blue(), color.alpha()); +} + +void QDirectFBScreen::solidFill(IDirectFBSurface *surface, const QColor &color, const QRegion ®ion) +{ if (region.isEmpty()) return; - d_ptr->primarySurface->SetColor(d_ptr->primarySurface, - color.red(), color.green(), color.blue(), - color.alpha()); const int n = region.rectCount(); if (n == 1) { - const QRect r = region.boundingRect(); - d_ptr->primarySurface->FillRectangle(d_ptr->primarySurface, r.x(), r.y(), r.width(), r.height()); + clearRect(surface, color, region.boundingRect()); } else { const QVector rects = region.rects(); - QVarLengthArray rectArray(n); for (int i=0; iprimarySurface->FillRectangles(d_ptr->primarySurface, rectArray.constData(), n); } -#endif + surface->SetClip(surface, 0); } QImage::Format QDirectFBScreen::alphaPixmapFormat() const diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index c483020..1085423 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -159,6 +159,7 @@ public: void exposeRegion(QRegion r, int changing); void solidFill(const QColor &color, const QRegion ®ion); + static void solidFill(IDirectFBSurface *surface, const QColor &color, const QRegion ®ion); void setMode(int width, int height, int depth); void blank(bool on); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 51969fc..2eeee24 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -380,11 +380,18 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, flushPending = false; } -void QDirectFBWindowSurface::beginPaint(const QRegion &) +void QDirectFBWindowSurface::beginPaint(const QRegion ®ion) { if (!engine) { engine = new QDirectFBPaintEngine(this); } + + if (dfbSurface) { + const QWidget *win = window(); + if (win && win->testAttribute(Qt::WA_NoSystemBackground)) { + QDirectFBScreen::solidFill(dfbSurface, Qt::transparent, region); + } + } flushPending = true; } -- cgit v0.12 From 0ade09152067324f74678f2de4d447b6e0280600 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Sat, 23 Oct 2010 10:26:16 +0200 Subject: Fixed many spelling errors. --- config.tests/unix/doubleformat/doubleformattest.cpp | 4 ++-- demos/qmediaplayer/mediaplayer.cpp | 2 +- demos/qtdemo/itemcircleanimation.h | 2 +- demos/qtdemo/mainwindow.cpp | 2 +- demos/qtdemo/mainwindow.h | 2 +- demos/qtdemo/qmlShell.qml | 2 +- demos/qtdemo/textbutton.h | 2 +- demos/spectrum/app/engine.h | 2 +- demos/spectrum/app/levelmeter.h | 2 +- demos/spectrum/app/main.cpp | 2 +- demos/spectrum/app/spectrograph.h | 2 +- demos/spectrum/app/spectrumanalyser.cpp | 2 +- demos/spreadsheet/spreadsheet.cpp | 2 +- doc/src/snippets/code/src_qtestlib_qtestcase.cpp | 2 +- examples/webkit/imageanalyzer/imageanalyzer.cpp | 2 +- qmake/generators/symbian/symmake_sbsv2.cpp | 2 +- qmake/generators/win32/msvc_vcproj.cpp | 8 ++++---- qmake/generators/win32/winmakefile.cpp | 2 +- qmake/project.cpp | 4 ++-- src/activeqt/container/qaxwidget.cpp | 2 +- src/corelib/arch/armv6/qatomic_generic_armv6.cpp | 2 +- src/corelib/arch/symbian/heap_hybrid.cpp | 8 ++++---- src/corelib/codecs/qutfcodec.cpp | 2 +- src/corelib/io/qiodevice_p.h | 2 +- src/corelib/io/qsettings.cpp | 2 +- src/corelib/tools/qbytearray.cpp | 4 ++-- src/dbus/qdbusabstractinterface.cpp | 2 +- src/dbus/qdbusargument.h | 2 +- src/dbus/qdbusintegrator.cpp | 2 +- src/dbus/qdbusmarshaller.cpp | 2 +- src/dbus/qdbusmessage.cpp | 6 +++--- src/dbus/qdbusmetatype.cpp | 4 ++-- src/dbus/qdbuspendingreply.h | 2 +- src/dbus/qdbusutil.cpp | 2 +- src/declarative/graphicsitems/qdeclarativemousearea.cpp | 2 +- src/declarative/qml/qdeclarativeengine.cpp | 2 +- src/declarative/util/qdeclarativeanimation_p_p.h | 2 +- src/gui/accessible/qaccessible_mac_p.h | 4 ++-- src/gui/embedded/qcopchannel_qws.cpp | 2 +- src/gui/embedded/qtransportauth_qws.cpp | 4 ++-- src/gui/graphicsview/qgraphicsitem_p.h | 4 ++-- src/gui/inputmethod/qinputcontextfactory.cpp | 4 ++-- src/gui/itemviews/qitemselectionmodel.cpp | 2 +- src/gui/kernel/qapplication_x11.cpp | 2 +- src/gui/kernel/qclipboard_win.cpp | 2 +- src/gui/kernel/qclipboard_x11.cpp | 4 ++-- src/gui/kernel/qkeymapper_mac.cpp | 2 +- src/gui/kernel/qsoftkeymanager_s60.cpp | 2 +- src/gui/kernel/qwidget_s60.cpp | 2 +- src/gui/painting/qgraphicssystem_qws.cpp | 2 +- src/gui/painting/qimagescale.cpp | 2 +- src/gui/painting/qpaintengine_raster.cpp | 2 +- src/gui/painting/qregion.h | 2 +- src/gui/styles/qwindowsxpstyle.cpp | 2 +- src/gui/text/qfontdatabase_x11.cpp | 2 +- src/gui/text/qfontengine_p.h | 2 +- src/gui/text/qfontengine_win.cpp | 2 +- src/gui/text/qfontsubset.cpp | 4 ++-- src/gui/text/qtextdocument_p.cpp | 4 ++-- src/gui/text/qtextlayout.cpp | 2 +- src/gui/widgets/qabstractslider.cpp | 2 +- src/multimedia/audio/qaudioengine.cpp | 4 ++-- src/multimedia/audio/qaudioinput.cpp | 2 +- src/multimedia/audio/qaudiooutput.cpp | 2 +- src/network/ssl/qsslsocket_openssl.cpp | 2 +- src/opengl/gl2paintengineex/qglengineshadermanager_p.h | 2 +- src/opengl/qwindowsurface_gl.cpp | 2 +- src/plugins/bearer/symbian/qnetworksession_impl.cpp | 2 +- src/plugins/bearer/symbian/symbianengine.cpp | 2 +- src/sql/kernel/qsqldriver.cpp | 8 ++++---- tests/manual/bearerex/datatransferer.cpp | 2 +- 71 files changed, 94 insertions(+), 94 deletions(-) diff --git a/config.tests/unix/doubleformat/doubleformattest.cpp b/config.tests/unix/doubleformat/doubleformattest.cpp index 8e83251..2c51d0c 100644 --- a/config.tests/unix/doubleformat/doubleformattest.cpp +++ b/config.tests/unix/doubleformat/doubleformattest.cpp @@ -44,8 +44,8 @@ LE: strings | grep 0123ABCD0123ABCD BE: strings | grep DCBA3210DCBA3210 -LE arm-swaped-dword-order: strings | grep ABCD0123ABCD0123 -BE arm-swaped-dword-order: strings | grep 3210DCBA3210DCBA (untested) +LE arm-swapped-dword-order: strings | grep ABCD0123ABCD0123 +BE arm-swapped-dword-order: strings | grep 3210DCBA3210DCBA (untested) tested on x86, arm-le (gp), aix diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 97a8e35..eb8279d 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -589,7 +589,7 @@ void MediaPlayer::configureEffect() effectDialog.exec(); if (effectDialog.result() != QDialog::Accepted) { - //we need to restore the paramaters values + //we need to restore the parameters values int currentIndex = 0; foreach(Phonon::EffectParameter param, nextEffect->parameters()) { nextEffect->setParameterValue(param, savedParamValues.at(currentIndex++)); diff --git a/demos/qtdemo/itemcircleanimation.h b/demos/qtdemo/itemcircleanimation.h index 425d2f5..7276f7f 100644 --- a/demos/qtdemo/itemcircleanimation.h +++ b/demos/qtdemo/itemcircleanimation.h @@ -61,7 +61,7 @@ public: ItemCircleAnimation(QGraphicsScene *scene = 0, QGraphicsItem *parent = 0); virtual ~ItemCircleAnimation(); - // overidden methods: + // overridden methods: QRectF boundingRect() const; void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0); void hoverEnterEvent(QGraphicsSceneHoverEvent *event); diff --git a/demos/qtdemo/mainwindow.cpp b/demos/qtdemo/mainwindow.cpp index 16c5bf3..e39802a 100644 --- a/demos/qtdemo/mainwindow.cpp +++ b/demos/qtdemo/mainwindow.cpp @@ -388,7 +388,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) s += "\nAdapt: "; s += Colors::noAdapt ? "off" : "on"; - s += "\nAdaption occured: "; + s += "\nAdaption occurred: "; s += Colors::adapted ? "yes" : "no"; s += "\nOpenGL version: "; s += Colors::glVersion; diff --git a/demos/qtdemo/mainwindow.h b/demos/qtdemo/mainwindow.h index b8cfda6..460f941 100644 --- a/demos/qtdemo/mainwindow.h +++ b/demos/qtdemo/mainwindow.h @@ -74,7 +74,7 @@ public: DemoTextItem *fpsLabel; protected: - // Overidden methods: + // Overridden methods: void showEvent(QShowEvent *event); void keyPressEvent(QKeyEvent *event); void resizeEvent(QResizeEvent *event); diff --git a/demos/qtdemo/qmlShell.qml b/demos/qtdemo/qmlShell.qml index 2764865..8ca06f1 100644 --- a/demos/qtdemo/qmlShell.qml +++ b/demos/qtdemo/qmlShell.qml @@ -85,7 +85,7 @@ Item { MouseArea{ anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton - onClicked: loader.focus=true;/* and don't propogate to the 'exit' area*/ + onClicked: loader.focus=true;/* and don't propagate to the 'exit' area*/ } Rectangle{ id: innerFrame diff --git a/demos/qtdemo/textbutton.h b/demos/qtdemo/textbutton.h index 55b4edc..039f923 100644 --- a/demos/qtdemo/textbutton.h +++ b/demos/qtdemo/textbutton.h @@ -61,7 +61,7 @@ public: QGraphicsScene *scene = 0, QGraphicsItem *parent = 0, BUTTONTYPE color = SIDEBAR); virtual ~TextButton(); - // overidden methods: + // overridden methods: virtual QRectF boundingRect() const; virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0){}; virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); diff --git a/demos/spectrum/app/engine.h b/demos/spectrum/app/engine.h index b6fe3ed..e14ac83 100644 --- a/demos/spectrum/app/engine.h +++ b/demos/spectrum/app/engine.h @@ -227,7 +227,7 @@ signals: * Level changed * \param rmsLevel RMS level in range 0.0 - 1.0 * \param peakLevel Peak level in range 0.0 - 1.0 - * \param numSamples Number of audio samples analysed + * \param numSamples Number of audio samples analyzed */ void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples); diff --git a/demos/spectrum/app/levelmeter.h b/demos/spectrum/app/levelmeter.h index 38d13b1..683dba7 100644 --- a/demos/spectrum/app/levelmeter.h +++ b/demos/spectrum/app/levelmeter.h @@ -46,7 +46,7 @@ /** * Widget which displays a vertical audio level meter, indicating the - * RMS and peak levels of the window of audio samples most recently analysed + * RMS and peak levels of the window of audio samples most recently analyzed * by the Engine. */ class LevelMeter : public QWidget { diff --git a/demos/spectrum/app/main.cpp b/demos/spectrum/app/main.cpp index 3bdfb7d..fb5183e 100644 --- a/demos/spectrum/app/main.cpp +++ b/demos/spectrum/app/main.cpp @@ -44,7 +44,7 @@ int main(int argc, char **argv) { QApplication app(argc, argv); - app.setApplicationName("QtMultimedia spectrum analyser"); + app.setApplicationName("QtMultimedia spectrum analyzer"); MainWidget w; #ifdef Q_OS_SYMBIAN diff --git a/demos/spectrum/app/spectrograph.h b/demos/spectrum/app/spectrograph.h index ce59d90..fa4a6cf 100644 --- a/demos/spectrum/app/spectrograph.h +++ b/demos/spectrum/app/spectrograph.h @@ -48,7 +48,7 @@ QT_FORWARD_DECLARE_CLASS(QMouseEvent) /** * Widget which displays a spectrograph showing the frequency spectrum - * of the window of audio samples most recently analysed by the Engine. + * of the window of audio samples most recently analyzed by the Engine. */ class Spectrograph : public QWidget { Q_OBJECT diff --git a/demos/spectrum/app/spectrumanalyser.cpp b/demos/spectrum/app/spectrumanalyser.cpp index c467f61..1cc47a6 100644 --- a/demos/spectrum/app/spectrumanalyser.cpp +++ b/demos/spectrum/app/spectrumanalyser.cpp @@ -124,7 +124,7 @@ void SpectrumAnalyserThread::calculateSpectrum(const QByteArray &buffer, // Calculate the FFT m_fft->calculateFFT(m_output.data(), m_input.data()); - // Analyse output to obtain amplitude and phase for each frequency + // Analyze output to obtain amplitude and phase for each frequency for (int i=2; i<=m_numSamples/2; ++i) { // Calculate frequency of this complex sample m_spectrum[i].frequency = qreal(i * inputFrequency) / (m_numSamples); diff --git a/demos/spreadsheet/spreadsheet.cpp b/demos/spreadsheet/spreadsheet.cpp index f2a1738..519afe9 100644 --- a/demos/spreadsheet/spreadsheet.cpp +++ b/demos/spreadsheet/spreadsheet.cpp @@ -511,7 +511,7 @@ void SpreadSheet::setupContents() // column 2 table->setItem(0, 2, new SpreadSheetItem("Price")); table->item(0, 2)->setBackgroundColor(titleBackground); - table->item(0, 2)->setToolTip("This collumn shows the price of the purchase"); + table->item(0, 2)->setToolTip("This column shows the price of the purchase"); table->item(0, 2)->setFont(titleFont); table->setItem(1, 2, new SpreadSheetItem("150")); diff --git a/doc/src/snippets/code/src_qtestlib_qtestcase.cpp b/doc/src/snippets/code/src_qtestlib_qtestcase.cpp index c9bda61..6ae8939 100644 --- a/doc/src/snippets/code/src_qtestlib_qtestcase.cpp +++ b/doc/src/snippets/code/src_qtestlib_qtestcase.cpp @@ -48,7 +48,7 @@ QVERIFY(1 + 1 == 2); //! [1] -QVERIFY2(1 + 1 == 2, "A breach in basic arithmetic occured."); +QVERIFY2(1 + 1 == 2, "A breach in basic arithmetic occurred."); //! [1] diff --git a/examples/webkit/imageanalyzer/imageanalyzer.cpp b/examples/webkit/imageanalyzer/imageanalyzer.cpp index 1d0ee45..9f49a00 100644 --- a/examples/webkit/imageanalyzer/imageanalyzer.cpp +++ b/examples/webkit/imageanalyzer/imageanalyzer.cpp @@ -49,7 +49,7 @@ * This class operates as follows: * Parent calls the slot startAnalysis which shoves a list of QStrings into URLQueue and then calls fetchURLs. * FetchURLs sends out HTTP GETs for each image it can't get out of the cache. - * As the responses come in, handleReply trys to create an image out of each and pushes those images into imageQueue. + * As the responses come in, handleReply tries to create an image out of each and pushes those images into imageQueue. * On the last (detected by no outstandingFetches and URLQueue.isEmpty()) call to queueImage (from handleReply) * a thread is forked to process all the images. When it finishes, it emits a finished signal that is received * by our JavaScript code. diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 32c31ee..d650e08 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -120,7 +120,7 @@ void SymbianSbsv2MakefileGenerator::findInstalledCompilerVersions(const QString && fileInfo(matcher.cap(matcher.captureCount())).exists()) { // First capture (index 0) is the whole match, which is skipped. // Next n captures are version numbers, which are interesting. - // Final capture is the env var value, which we alrady used, so that is skipped, too. + // Final capture is the env var value, which we already used, so that is skipped, too. int capture = 1; int finalCapture = matcher.captureCount() - 1; QString version = versionPrefix; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index cff7a14..a8ff306 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1587,10 +1587,10 @@ QString VcprojGenerator::fixFilename(QString ofile) const if(slashfind == -1) { ofile = ofile.replace('-', '_'); } else { - int hypenfind = ofile.indexOf('-', slashfind); - while (hypenfind != -1 && slashfind < hypenfind) { - ofile = ofile.replace(hypenfind, 1, '_'); - hypenfind = ofile.indexOf('-', hypenfind + 1); + int hyphenfind = ofile.indexOf('-', slashfind); + while (hyphenfind != -1 && slashfind < hyphenfind) { + ofile = ofile.replace(hyphenfind, 1, '_'); + hyphenfind = ofile.indexOf('-', hyphenfind + 1); } } return ofile; diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index ecb20c7..8d1a803 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -646,7 +646,7 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) t << "DIST = " << varList("DISTFILES") << endl; t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; - // The comment is important to maintain variable compatability with Unix + // The comment is important to maintain variable compatibility with Unix // Makefiles, while not interpreting a trailing-slash as a linebreak t << "DESTDIR = " << escapeFilePath(destDir) << " #avoid trailing-slash linebreak" << endl; t << "TARGET = " << escapeFilePath(target) << endl; diff --git a/qmake/project.cpp b/qmake/project.cpp index cb02923..427bea3 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE -//expand fucntions +//expand functions enum ExpandFunc { E_MEMBER=1, E_FIRST, E_LAST, E_CAT, E_FROMFILE, E_EVAL, E_LIST, E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION, E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND, @@ -1063,7 +1063,7 @@ QMakeProject::parse(const QString &t, QMap &place, int num #undef SKIP_WS doVariableReplace(var, place); - var = varMap(var); //backwards compatability + var = varMap(var); //backwards compatibility if(!var.isEmpty() && Option::mkfile::do_preprocess) { static QString last_file("*none*"); if(parser.file != last_file) { diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index 7afce5b..c2108ba 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -1008,7 +1008,7 @@ HRESULT WINAPI QAxClientSite::TranslateAccelerator(LPMSG lpMsg, DWORD /*grfModif } } // ActiveQt based in-processes-servers will handle the event properly, so - // we dont need to send this key event to the host. + // we don't need to send this key event to the host. return S_OK; } diff --git a/src/corelib/arch/armv6/qatomic_generic_armv6.cpp b/src/corelib/arch/armv6/qatomic_generic_armv6.cpp index 39d966a..444d3d3 100644 --- a/src/corelib/arch/armv6/qatomic_generic_armv6.cpp +++ b/src/corelib/arch/armv6/qatomic_generic_armv6.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** This file implements the generic atomics interface using ARMv6 assembly -** instructions. It is more efficent than the inline versions when Qt is +** instructions. It is more efficient than the inline versions when Qt is ** built for the THUMB instruction set, as the required instructions are ** only available in ARM state. ****************************************************************************/ diff --git a/src/corelib/arch/symbian/heap_hybrid.cpp b/src/corelib/arch/symbian/heap_hybrid.cpp index 91faaed..5d2b2b6 100644 --- a/src/corelib/arch/symbian/heap_hybrid.cpp +++ b/src/corelib/arch/symbian/heap_hybrid.cpp @@ -134,7 +134,7 @@ The constant can be changed at ROM build time using patchdata OBY keyword. @deprecated Patching this constant no longer has any effect. */ -#ifdef __X86GCC__ // For X86GCC we dont use the proper data import attribute +#ifdef __X86GCC__ // For X86GCC we don't use the proper data import attribute #undef IMPORT_D // since the constants are not really imported. GCC doesn't #define IMPORT_D // allow imports from self. #endif @@ -451,7 +451,7 @@ TInt RHybridHeap::ConstructLock(TUint32 aMode) void RHybridHeap::Init(TInt aBitmapSlab, TInt aPagePower) { - /*Moved code which does initilization */ + /*Moved code which does initialization */ iTop = (TUint8*)this + iMinLength; iBase = Ceiling(iBase, ECellAlignment); // Align iBase address @@ -874,7 +874,7 @@ available in the largest free block. Note that this function exists mainly for compatibility reasons. In a modern heap implementation such as that present in Symbian it is not appropriate to concern oneself with details such as the amount of free memory available on a -heap and its largeset free block, because the way that a modern heap implmentation +heap and its largeset free block, because the way that a modern heap implementation works is not simple. The amount of available virtual memory != physical memory and there are multiple allocation strategies used internally, which makes all memory usage figures "fuzzy" at best. @@ -1616,7 +1616,7 @@ void* RHybridHeap::DlMalloc(size_t bytes) void RHybridHeap::DlFree(void* mem) { /* - Consolidate freed chunks with preceeding or succeeding bordering + Consolidate freed chunks with preceding or succeeding bordering free chunks, if they exist, and then place in a bin. Intermixed with special cases for iTop, iDv, mmapped chunks, and usage errors. */ diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp index f747bf7..031baa3 100644 --- a/src/corelib/codecs/qutfcodec.cpp +++ b/src/corelib/codecs/qutfcodec.cpp @@ -195,7 +195,7 @@ QString QUtf8::convertToUnicode(const char *chars, int len, QTextCodec::Converte // utf-8 bom composes into 0xfeff code point bool nonCharacter; if (!headerdone && uc == 0xfeff) { - // dont do anything, just skip the BOM + // don't do anything, just skip the BOM } else if (!(nonCharacter = isUnicodeNonCharacter(uc)) && uc > 0xffff && uc < 0x110000) { // surrogate pair Q_ASSERT((qch - (ushort*)result.unicode()) + 2 < result.length()); diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h index 1dd51ea..8b77da5 100644 --- a/src/corelib/io/qiodevice_p.h +++ b/src/corelib/io/qiodevice_p.h @@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE #define QIODEVICE_BUFFERSIZE Q_INT64_C(16384) #endif -// This is QIODevice's read buffer, optimised for read(), isEmpty() and getChar() +// This is QIODevice's read buffer, optimized for read(), isEmpty() and getChar() class QIODevicePrivateLinearBuffer { public: diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index edd6d2b..53af822 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -3506,7 +3506,7 @@ void QSettings::setPath(Format format, Scope scope, const QString &path) \threadsafe Registers a custom storage format. On success, returns a special - Format value that can then be passed to the QSettings constuctor. + Format value that can then be passed to the QSettings constructor. On failure, returns InvalidFormat. The \a extension is the file diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index b0c784e..fac0f45 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1812,7 +1812,7 @@ QByteArray &QByteArray::replace(int pos, int len, const QByteArray &after) return *this; } else { QByteArray copy(after); - // ### optimise me + // ### optimize me remove(pos, len); return insert(pos, copy); } @@ -1853,7 +1853,7 @@ QByteArray &QByteArray::replace(int pos, int len, const char *after, int alen) } } -// ### optimise all other replace method, by offering +// ### optimize all other replace method, by offering // QByteArray::replace(const char *before, int blen, const char *after, int alen) /*! diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 4e9c1ad..0ea8c8d 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -560,7 +560,7 @@ void QDBusAbstractInterface::connectNotify(const char *signal) if (!d->isValid) return; - // we end up recursing here, so optimise away + // we end up recursing here, so optimize away if (qstrcmp(signal + 1, "destroyed(QObject*)") == 0) return; diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h index 30f2cda..84d0349 100644 --- a/src/dbus/qdbusargument.h +++ b/src/dbus/qdbusargument.h @@ -172,7 +172,7 @@ template inline T qdbus_cast(const QVariant &v return qvariant_cast(v); } -// specialise for QVariant, allowing it to be used in place of QDBusVariant +// specialize for QVariant, allowing it to be used in place of QDBusVariant template<> inline QVariant qdbus_cast(const QDBusArgument &arg, QVariant *) { QDBusVariant item; diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 31588e7..a5d8ada 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -801,7 +801,7 @@ bool QDBusConnectionPrivate::activateCall(QObject* object, int flags, const QDBu ++cacheIt; if (cacheIt == slotCache.hash.constEnd() || cacheIt.key() != cacheKey) { - // not cached, analyse the meta object + // not cached, analyze the meta object const QMetaObject *mo = object->metaObject(); QByteArray memberName = msg.member().toUtf8(); diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp index 8b174a1..e620152 100644 --- a/src/dbus/qdbusmarshaller.cpp +++ b/src/dbus/qdbusmarshaller.cpp @@ -507,7 +507,7 @@ bool QDBusMarshaller::appendCrossMarshalling(QDBusDemarshaller *demarshaller) if (code == DBUS_TYPE_ARRAY) { int element = q_dbus_message_iter_get_element_type(&demarshaller->iterator); if (q_dbus_type_is_fixed(element)) { - // another optimisation: fixed size arrays + // another optimization: fixed size arrays // code is exactly like QDBusDemarshaller::toByteArray DBusMessageIter sub; q_dbus_message_iter_recurse(&demarshaller->iterator, &sub); diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp index d838e37..10b2768 100644 --- a/src/dbus/qdbusmessage.cpp +++ b/src/dbus/qdbusmessage.cpp @@ -292,7 +292,7 @@ QDBusMessage QDBusMessagePrivate::makeLocal(const QDBusConnectionPrivate &conn, } // no complex types seen - // optimise by using the variant list itself + // optimize by using the variant list itself QDBusMessage retval; QDBusMessagePrivate *d = retval.d_ptr; d->arguments = asSent.d_ptr->arguments; @@ -452,7 +452,7 @@ QDBusMessage QDBusMessage::createReply(const QVariantList &arguments) const d_ptr->localReply = new QDBusMessage(reply); // keep an internal copy } - // the reply must have a msg or be a local-loop optimisation + // the reply must have a msg or be a local-loop optimization Q_ASSERT(reply.d_ptr->reply || reply.d_ptr->localMessage); return reply; } @@ -471,7 +471,7 @@ QDBusMessage QDBusMessage::createErrorReply(const QString name, const QString &m d_ptr->localReply = new QDBusMessage(reply); // keep an internal copy } - // the reply must have a msg or be a local-loop optimisation + // the reply must have a msg or be a local-loop optimization Q_ASSERT(reply.d_ptr->reply || reply.d_ptr->localMessage); return reply; } diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp index cb377cb..821a227 100644 --- a/src/dbus/qdbusmetatype.cpp +++ b/src/dbus/qdbusmetatype.cpp @@ -242,7 +242,7 @@ bool QDBusMetaType::marshall(QDBusArgument &arg, int id, const void *data) QReadLocker locker(customTypesLock()); QVector *ct = customTypes(); if (id >= ct->size()) - return false; // non-existant + return false; // non-existent const QDBusCustomTypeInfo &info = (*ct).at(id); if (!info.marshall) { @@ -271,7 +271,7 @@ bool QDBusMetaType::demarshall(const QDBusArgument &arg, int id, void *data) QReadLocker locker(customTypesLock()); QVector *ct = customTypes(); if (id >= ct->size()) - return false; // non-existant + return false; // non-existent const QDBusCustomTypeInfo &info = (*ct).at(id); if (!info.demarshall) { diff --git a/src/dbus/qdbuspendingreply.h b/src/dbus/qdbuspendingreply.h index 61e561e..918a46c 100644 --- a/src/dbus/qdbuspendingreply.h +++ b/src/dbus/qdbuspendingreply.h @@ -85,7 +85,7 @@ namespace QDBusPendingReplyTypes { template inline int metaTypeFor(T1 * = 0) { return qMetaTypeId(); } - // specialise for QVariant, allowing it to be used in place of QDBusVariant + // specialize for QVariant, allowing it to be used in place of QDBusVariant template<> inline int metaTypeFor(QVariant *) { return qMetaTypeId(); } diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp index 2fcdc73..b7b0407 100644 --- a/src/dbus/qdbusutil.cpp +++ b/src/dbus/qdbusutil.cpp @@ -309,7 +309,7 @@ namespace QDBusUtil Returns true if \a connName is a valid unique connection name. Unique connection names start with a colon (":") and are followed by a list of dot-separated - components composed of ASCII letters, digits, the hypen or the underscore ("_") character. + components composed of ASCII letters, digits, the hyphen or the underscore ("_") character. */ bool isValidUniqueConnectionName(const QString &connName) { diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 1533d55..1b7dce0 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -335,7 +335,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() If the \e accepted property of the \l {MouseEvent}{mouse} parameter is set to false in the handler, the onPressed/onReleased/onClicked handlers will be called for the second - click; otherwise they are supressed. The accepted property defaults to true. + click; otherwise they are suppressed. The accepted property defaults to true. */ /*! diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index c3fdf36..0c99ea8 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -878,7 +878,7 @@ void QDeclarativeEngine::setContextForObject(QObject *object, QDeclarativeContex created by calling QDeclarativeCompnent::create() or QDeclarativeComponent::beginCreate() which have CppOwnership by default. The ownership of these root-level objects is considered to - have been transfered to the C++ caller. + have been transferred to the C++ caller. Objects not-created by QML have CppOwnership by default. The exception to this is objects returned from a C++ method call. The diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h index e38580c..6305fbd 100644 --- a/src/declarative/util/qdeclarativeanimation_p_p.h +++ b/src/declarative/util/qdeclarativeanimation_p_p.h @@ -328,7 +328,7 @@ public: QDeclarativeBulkValueAnimator *va; - // for animations that dont use the QDeclarativeBulkValueAnimator + // for animations that don't use the QDeclarativeBulkValueAnimator QDeclarativeStateActions *actions; static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress); diff --git a/src/gui/accessible/qaccessible_mac_p.h b/src/gui/accessible/qaccessible_mac_p.h index 4ee3a2d..e417cb6 100644 --- a/src/gui/accessible/qaccessible_mac_p.h +++ b/src/gui/accessible/qaccessible_mac_p.h @@ -122,7 +122,7 @@ private: QAccessibleInterfaceWrapper wrapper class. It has the same API as QAccessibleInterface, minus the child parameter - in the funcitons. + in the functions. */ class Q_AUTOTEST_EXPORT QAInterface : public QAccessible { @@ -432,7 +432,7 @@ public: /* QAccessibleHierarchyManager bridges the Mac and Qt accessibility hierarchies. There is a one-to-one relationship between QAElements on the Mac side - and QAInterfaces on the Qt side, and this class provies lookup funcitons + and QAInterfaces on the Qt side, and this class provides lookup functions that translates between these to items. The identity of a QAInterface is determined by its QAccessibleInterface and diff --git a/src/gui/embedded/qcopchannel_qws.cpp b/src/gui/embedded/qcopchannel_qws.cpp index 5786866..0d9d9d3 100644 --- a/src/gui/embedded/qcopchannel_qws.cpp +++ b/src/gui/embedded/qcopchannel_qws.cpp @@ -502,7 +502,7 @@ void QCopChannel::answer(QWSClient *cl, const QString& ch, bool known = qcopServerMap && qcopServerMap->contains(c) && !((*qcopServerMap)[c]).isEmpty(); // Yes, it's a typo, it's not user-visible, and we choose not to fix it for compatibility - QLatin1String ans = QLatin1String(known ? "known" : "unkown"); + QLatin1String ans = QLatin1String(known ? "known" : "unknown"); QWSServerPrivate::sendQCopEvent(cl, QLatin1String(""), ans, data, true); return; diff --git a/src/gui/embedded/qtransportauth_qws.cpp b/src/gui/embedded/qtransportauth_qws.cpp index 9a50702..90e90d1 100644 --- a/src/gui/embedded/qtransportauth_qws.cpp +++ b/src/gui/embedded/qtransportauth_qws.cpp @@ -445,7 +445,7 @@ QIODevice *QTransportAuth::passThroughByClient( QWSClient *client ) const /*! \internal Return a QIODevice pointer (to an internal QBuffer) which can be used - to receive data after authorisation on transport \a d. + to receive data after authorization on transport \a d. The return QIODevice will act as a pass-through. @@ -468,7 +468,7 @@ QAuthDevice *QTransportAuth::recvBuf( QTransportAuth::Data *data, QIODevice *iod /*! Return a QIODevice pointer (to an internal QBuffer) which can be used - to write data onto, for authorisation on transport \a d. + to write data onto, for authorization on transport \a d. The return QIODevice will act as a pass-through. diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 8480c19..1b7aa97 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -722,7 +722,7 @@ public: /*! Returns true if \a item1 is on top of \a item2. - The items dont need to be siblings. + The items don't need to be siblings. \internal */ @@ -776,7 +776,7 @@ inline bool qt_closestItemFirst(const QGraphicsItem *item1, const QGraphicsItem /*! Returns true if \a item2 is on top of \a item1. - The items dont need to be siblings. + The items don't need to be siblings. \internal */ diff --git a/src/gui/inputmethod/qinputcontextfactory.cpp b/src/gui/inputmethod/qinputcontextfactory.cpp index 865c1b2..afe5095 100644 --- a/src/gui/inputmethod/qinputcontextfactory.cpp +++ b/src/gui/inputmethod/qinputcontextfactory.cpp @@ -205,7 +205,7 @@ QStringList QInputContextFactory::keys() This function contains pure Symbian exception handling code for getting S60 language list. - Returned object ownership is transfered to caller. + Returned object ownership is transferred to caller. */ static CAknInputLanguageList* s60LangListL() { @@ -224,7 +224,7 @@ static CAknInputLanguageList* s60LangListL() \internal This function utility function return S60 language list. - Returned object ownership is transfered to caller. + Returned object ownership is transferred to caller. */ static CAknInputLanguageList* s60LangList() { diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp index e69cd65..e2a16b1 100644 --- a/src/gui/itemviews/qitemselectionmodel.cpp +++ b/src/gui/itemviews/qitemselectionmodel.cpp @@ -772,7 +772,7 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged() savedPersistentIndexes.clear(); savedPersistentCurrentIndexes.clear(); - // optimisation for when all indexes are selected + // optimization for when all indexes are selected // (only if there is lots of items (1000) because this is not entirely correct) if (ranges.isEmpty() && currentSelection.count() == 1) { QItemSelectionRange range = currentSelection.first(); diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index d8fb74c..a4cc5a3 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -3742,7 +3742,7 @@ int QApplication::x11ProcessEvent(XEvent* event) // toplevel reparented... QWidget *newparent = QWidget::find(event->xreparent.parent); if (! newparent || (newparent->windowType() == Qt::Desktop)) { - // we dont' know about the new parent (or we've been + // we don't know about the new parent (or we've been // reparented to root), perhaps a window manager // has been (re)started? reset the focus model to unknown X11->focus_model = QX11Data::FM_Unknown; diff --git a/src/gui/kernel/qclipboard_win.cpp b/src/gui/kernel/qclipboard_win.cpp index 63ca9e5..c2e29fd 100644 --- a/src/gui/kernel/qclipboard_win.cpp +++ b/src/gui/kernel/qclipboard_win.cpp @@ -141,7 +141,7 @@ public: clipBoardViewer = new QWidget(); clipBoardViewer->createWinId(); clipBoardViewer->setObjectName(QLatin1String("internal clipboard owner")); - // We dont need this internal widget to appear in QApplication::topLevelWidgets() + // We don't need this internal widget to appear in QApplication::topLevelWidgets() if (QWidgetPrivate::allWidgets) QWidgetPrivate::allWidgets->remove(clipBoardViewer); } diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp index 55548ef..62c861d 100644 --- a/src/gui/kernel/qclipboard_x11.cpp +++ b/src/gui/kernel/qclipboard_x11.cpp @@ -132,7 +132,7 @@ void setupOwner() requestor = new QWidget(0); requestor->createWinId(); requestor->setObjectName(QLatin1String("internal clipboard requestor")); - // We dont need this internal widgets to appear in QApplication::topLevelWidgets() + // We don't need this internal widgets to appear in QApplication::topLevelWidgets() if (QWidgetPrivate::allWidgets) { QWidgetPrivate::allWidgets->remove(owner); QWidgetPrivate::allWidgets->remove(requestor); @@ -769,7 +769,7 @@ QByteArray QX11Data::clipboardReadIncrementalProperty(Window win, Atom property, delete requestor; requestor = new QWidget(0); requestor->setObjectName(QLatin1String("internal clipboard requestor")); - // We dont need this internal widget to appear in QApplication::topLevelWidgets() + // We don't need this internal widget to appear in QApplication::topLevelWidgets() if (QWidgetPrivate::allWidgets) QWidgetPrivate::allWidgets->remove(requestor); diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp index 3dc6afc..300e5ca 100644 --- a/src/gui/kernel/qkeymapper_mac.cpp +++ b/src/gui/kernel/qkeymapper_mac.cpp @@ -749,7 +749,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e } return false; } - // Once we process the key down , we dont need to send the saved event again from + // Once we process the key down , we don't need to send the saved event again from // kEventTextInputUnicodeForKeyEvent, so clear it. if (currentContext && ekind == kEventRawKeyDown) { QMacInputContext *context = qobject_cast(currentContext); diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index fee1580..c81d75f 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -265,7 +265,7 @@ bool QSoftKeyManagerPrivateS60::setSoftkeyImage(CEikButtonGroupContainer *cba, CFbsBitmap* nMask = softkeyAlpha.toSymbianCFbsBitmap(); CEikImage* myimage = new (ELeave) CEikImage; - myimage->SetPicture( nBitmap, nMask ); // nBitmap and nMask ownership transfered + myimage->SetPicture( nBitmap, nMask ); // nBitmap and nMask ownership transferred EikSoftkeyImage::SetImage(cba, *myimage, left); // Takes myimage ownership cbaHasImage[position] = true; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 5df5e19..031892d 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -577,7 +577,7 @@ void QWidgetPrivate::hide_sys() QSymbianControl *id = static_cast(q->internalWinId()); if (id) { - //Incorrect optimisation - for popup windows, Qt's focus is moved before + //Incorrect optimization - for popup windows, Qt's focus is moved before //hide_sys is called, resulting in the popup window keeping its elevated //position in the CONE control stack. //This can result in keyboard focus being in an invisible widget in some diff --git a/src/gui/painting/qgraphicssystem_qws.cpp b/src/gui/painting/qgraphicssystem_qws.cpp index f5dab4b..03a0d11 100644 --- a/src/gui/painting/qgraphicssystem_qws.cpp +++ b/src/gui/painting/qgraphicssystem_qws.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE QPixmapData *QWSGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { if (screen->pixmapDataFactory()) - return screen->pixmapDataFactory()->create(type); //### For 4.4 compatability + return screen->pixmapDataFactory()->create(type); //### For 4.4 compatibility else return new QRasterPixmapData(type); } diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp index 8580775..7383308 100644 --- a/src/gui/painting/qimagescale.cpp +++ b/src/gui/painting/qimagescale.cpp @@ -304,7 +304,7 @@ QImageScaleInfo* QImageScale::qimageCalcScaleInfo(const QImage &img, return(isi); } -/* FIXME: NEED to optimise ScaleAARGBA - currently its "ok" but needs work*/ +/* FIXME: NEED to optimize ScaleAARGBA - currently its "ok" but needs work*/ /* scale by area sampling */ static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int *dest, diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index c92d291..8f9d8ba 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1102,7 +1102,7 @@ void QRasterPaintEnginePrivate::updateMatrixData(QSpanData *spanData, const QBru Q_Q(QRasterPaintEngine); bool bilinear = q->state()->flags.bilinear; - if (b.d->transform.type() > QTransform::TxNone) { // FALCON: optimise + if (b.d->transform.type() > QTransform::TxNone) { // FALCON: optimize spanData->setupMatrix(b.transform() * m, bilinear); } else { if (m.type() <= QTransform::TxTranslate) { diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index bc4da28..acb20c1 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -201,7 +201,7 @@ private: Region rgn; void *xrectangles; #elif defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) - mutable RgnHandle unused; // Here for binary compatability reasons. ### Qt 5 remove. + mutable RgnHandle unused; // Here for binary compatibility reasons. ### Qt 5 remove. #endif #if defined(Q_WS_QWS) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) QRegionPrivate *qt_rgn; diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index a5e9c19..da29440 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -302,7 +302,7 @@ HWND QWindowsXPStylePrivate::winId(const QWidget *widget) limboWidget = new QWidget(0); limboWidget->createWinId(); limboWidget->setObjectName(QLatin1String("xp_limbo_widget")); - // We dont need this internal widget to appear in QApplication::topLevelWidgets() + // We don't need this internal widget to appear in QApplication::topLevelWidgets() if (QWidgetPrivate::allWidgets) QWidgetPrivate::allWidgets->remove(limboWidget); } diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index 9bf6cc8..ecc4690 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -2006,7 +2006,7 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) FcFontSet *set = FcConfigGetFonts(config, FcSetApplication); if (!set) { - FcConfigAppFontAddFile(config, (const FcChar8 *)":/non-existant"); + FcConfigAppFontAddFile(config, (const FcChar8 *)":/non-existent"); set = FcConfigGetFonts(config, FcSetApplication); // try again if (!set) return; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 571cf98..fc26eef 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -158,7 +158,7 @@ public: virtual QFixed emSquareSize() const { return ascent(); } - /* returns 0 as glyph index for non existant glyphs */ + /* returns 0 as glyph index for non existent glyphs */ virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const = 0; /** diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 7609ee5..5f25752 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -1209,7 +1209,7 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform) QImage indexed(mask->width(), mask->height(), QImage::Format_Indexed8); - // ### This part is kinda pointless, but we'll crash later if we dont because some + // ### This part is kinda pointless, but we'll crash later if we don't because some // code paths expects there to be colortables for index8-bit... QVector colors(256); for (int i=0; i<256; ++i) diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp index e49f5b4..2283358 100644 --- a/src/gui/text/qfontsubset.cpp +++ b/src/gui/text/qfontsubset.cpp @@ -697,7 +697,7 @@ static QTtfTable generateHead(const qttf_head_table &head) // Bits 5-10: These should be set according to Apple's specification . However, they are not implemented in OpenType. // Bit 11: Font data is 'lossless,' as a result of having been compressed and decompressed with the Agfa MicroType Express engine. // Bit 12: Font converted (produce compatible metrics) -// Bit 13: Font optimised for ClearType +// Bit 13: Font optimized for ClearType // Bit 14: Reserved, set to 0 // Bit 15: Reserved, set to 0 << quint16(0) @@ -1008,7 +1008,7 @@ static void convertPath(const QPainterPath &path, QList *points, QLis np.x = (i1_x + i2_x) >> 1; np.y = (i1_y + i2_y) >> 1; if (try_reduce) { - // see if we can optimise out the last onCurve point + // see if we can optimize out the last onCurve point int mx = (points->at(points->size() - 2).x + base[2].x) >> 1; int my = (points->at(points->size() - 2).y + base[2].y) >> 1; if (qAbs(mx - base[3].x) <= split_limit && qAbs(my = base[3].y) <= split_limit) diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 213db7e..0bdd20d 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -320,7 +320,7 @@ void QTextDocumentPrivate::setLayout(QAbstractTextDocumentLayout *layout) void QTextDocumentPrivate::insert_string(int pos, uint strPos, uint length, int format, QTextUndoCommand::Operation op) { - // ##### optimise when only appending to the fragment! + // ##### optimize when only appending to the fragment! Q_ASSERT(noBlockInString(text.mid(strPos, length))); split(pos); @@ -1446,7 +1446,7 @@ void QTextDocumentPrivate::clearFrame(QTextFrame *f) void QTextDocumentPrivate::scan_frames(int pos, int charsRemoved, int charsAdded) { - // ###### optimise + // ###### optimize Q_UNUSED(pos); Q_UNUSED(charsRemoved); Q_UNUSED(charsAdded); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index f432b7e..f1278b9 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1615,7 +1615,7 @@ void QTextLine::setLineWidth(qreal width) if (line.length && line.textWidth <= line.width && line.from + line.length == eng->layoutData->string.length()) - // no need to do anything if the line is already layouted and the last one. This optimisation helps + // no need to do anything if the line is already layouted and the last one. This optimization helps // when using things in a single line layout. return; line.length = 0; diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index f38bae7..a8b39f4 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -722,7 +722,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb #else // Native UI-elements on Mac can scroll hundreds of lines at a time as // a result of acceleration. So keep the same behaviour in Qt, and - // dont restrict stepsToScroll to certain maximum (pageStep): + // don't restrict stepsToScroll to certain maximum (pageStep): stepsToScroll = int(offset_accumulated); #endif offset_accumulated -= int(offset_accumulated); diff --git a/src/multimedia/audio/qaudioengine.cpp b/src/multimedia/audio/qaudioengine.cpp index 7f1f5d3..c379aff 100644 --- a/src/multimedia/audio/qaudioengine.cpp +++ b/src/multimedia/audio/qaudioengine.cpp @@ -133,7 +133,7 @@ QT_BEGIN_NAMESPACE Uses the \a device as the QIODevice to transfer data. If \a device is null then the class creates an internal QIODevice. Returns a pointer to the QIODevice being used to handle the data transfer. This QIODevice can be used to write() audio data directly. Passing a - QIODevice allows the data to be transfered without any extra code. + QIODevice allows the data to be transferred without any extra code. */ /*! @@ -247,7 +247,7 @@ QT_BEGIN_NAMESPACE Uses the \a device as the QIODevice to transfer data. If \a device is null then the class creates an internal QIODevice. Returns a pointer to the QIODevice being used to handle the data transfer. This QIODevice can be used to - read() audio data directly. Passing a QIODevice allows the data to be transfered + read() audio data directly. Passing a QIODevice allows the data to be transferred without any extra code. */ diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index 3676f64..6660c3f 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -201,7 +201,7 @@ QAudioInput::~QAudioInput() /*! Uses the \a device as the QIODevice to transfer data. - Passing a QIODevice allows the data to be transfered without any extra code. + Passing a QIODevice allows the data to be transferred without any extra code. All that is required is to open the QIODevice. If able to successfully get audio data from the systems audio device the diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index cf3b79c..b71d48c 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -199,7 +199,7 @@ QAudioFormat QAudioOutput::format() const /*! Uses the \a device as the QIODevice to transfer data. - Passing a QIODevice allows the data to be transfered without any extra code. + Passing a QIODevice allows the data to be transferred without any extra code. All that is required is to open the QIODevice. If able to successfully output audio data to the systems audio device the diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index cd224df..2910538 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -647,7 +647,7 @@ TInt CSymbianCertificateRetriever::ThreadEntryPoint(TAny* aParams) if (err) return err; else - return self->iSequenceError; // return any error that occured during the retrieval + return self->iSequenceError; // return any error that occurred during the retrieval } void CSymbianCertificateRetriever::ConstructL() diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 06b96ae..92cf108 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -457,7 +457,7 @@ public: AttributeOpacity }; - // There are optimisations we can do, depending on the brush transform: + // There are optimizations we can do, depending on the brush transform: // 1) May not have to apply perspective-correction // 2) Can use lower precision for matrix void optimiseForBrushTransform(QTransform::TransformationType transformType); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 8157b2a..68d444e 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -194,7 +194,7 @@ public: widget = new QGLWidget(QGLFormat(QGL::SingleBuffer | QGL::NoDepthBuffer | QGL::NoStencilBuffer)); widget->resize(1, 1); - // We dont need this internal widget to appear in QApplication::topLevelWidgets() + // We don't need this internal widget to appear in QApplication::topLevelWidgets() if (QWidgetPrivate::allWidgets) QWidgetPrivate::allWidgets->remove(widget); initializing = false; diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 7f81397..85723ce 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -760,7 +760,7 @@ void QNetworkSessionPrivateImpl::Error(TInt /*aError*/) { #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - " - << "roaming Error() occured, isOpen is: " << isOpen; + << "roaming Error() occurred, isOpen is: " << isOpen; #endif if (isOpen) { isOpen = false; diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index ef273c1..b4dfc4d 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -976,7 +976,7 @@ void SymbianEngine::RunL() QMutexLocker locker(&mutex); if (iStatus != KErrCancel) { - // By default, start relistening notifications. Stop only if interesting event occured. + // By default, start relistening notifications. Stop only if interesting event occurred. iWaitingCommsDatabaseNotifications = true; RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); switch (event) { diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp index 64fd99c..3d753dc 100644 --- a/src/sql/kernel/qsqldriver.cpp +++ b/src/sql/kernel/qsqldriver.cpp @@ -396,7 +396,7 @@ QString QSqlDriver::escapeIdentifier(const QString &identifier, IdentifierType) \a identifier can either be a table name or field name, dependent on \a type. - \warning Because of binary compatability constraints, this function is not virtual. + \warning Because of binary compatibility constraints, this function is not virtual. If you want to provide your own implementation in your QSqlDriver subclass, reimplement the isIdentifierEscapedImplementation() slot in your subclass instead. The isIdentifierEscapedFunction() will dynamically detect the slot and call it. @@ -421,7 +421,7 @@ bool QSqlDriver::isIdentifierEscaped(const QString &identifier, IdentifierType t and trailing delimiter characters, \a identifier is returned without modification. - \warning Because of binary compatability constraints, this function is not virtual, + \warning Because of binary compatibility constraints, this function is not virtual, If you want to provide your own implementation in your QSqlDriver subclass, reimplement the stripDelimitersImplementation() slot in your subclass instead. The stripDelimiters() function will dynamically detect the slot and call it. @@ -871,7 +871,7 @@ QStringList QSqlDriver::subscribedToNotificationsImplementation() const \a identifier can either be a table name or field name, dependent on \a type. - Because of binary compatability constraints, isIdentifierEscaped() function + Because of binary compatibility constraints, isIdentifierEscaped() function (introduced in Qt 4.5) is not virtual. Instead, isIdentifierEscaped() will dynamically detect and call \e this slot. The default implementation assumes the escape/delimiter character is a double quote. Reimplement this @@ -896,7 +896,7 @@ bool QSqlDriver::isIdentifierEscapedImplementation(const QString &identifier, Id If \a identifier does not have leading and trailing delimiter characters, \a identifier is returned without modification. - Because of binary compatability constraints, the stripDelimiters() function + Because of binary compatibility constraints, the stripDelimiters() function (introduced in Qt 4.5) is not virtual. Instead, stripDelimiters() will dynamically detect and call \e this slot. It generally unnecessary to reimplement this slot. diff --git a/tests/manual/bearerex/datatransferer.cpp b/tests/manual/bearerex/datatransferer.cpp index c3c13a8..c449bb1 100644 --- a/tests/manual/bearerex/datatransferer.cpp +++ b/tests/manual/bearerex/datatransferer.cpp @@ -121,7 +121,7 @@ void DataTransfererQTcp::readyRead() qDebug() << "BearerEx DataTransferQTcp data received: " << data; m_dataTransferOngoing = false; - // m_qsocket.error() returns uninitialized value in case no error has occured, + // m_qsocket.error() returns uninitialized value in case no error has occurred, // so emit '0' emit finished(0, bytesAvailable, "QAbstractSocket::SocketError"); } -- cgit v0.12 From eb2b56bc4d6a226058c36233aaf5c13e39fa3dc2 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Mon, 25 Oct 2010 13:44:39 +0200 Subject: Doc: Fixing typo --- src/activeqt/container/qaxwidget.cpp | 2 +- src/activeqt/shared/qaxtypes.cpp | 2 +- src/corelib/arch/symbian/heap_hybrid.cpp | 8 ++++---- src/corelib/io/qfsfileengine_unix.cpp | 2 +- src/plugins/graphicssystems/meego/dithering.cpp | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index 7afce5b..c2108ba 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -1008,7 +1008,7 @@ HRESULT WINAPI QAxClientSite::TranslateAccelerator(LPMSG lpMsg, DWORD /*grfModif } } // ActiveQt based in-processes-servers will handle the event properly, so - // we dont need to send this key event to the host. + // we don't need to send this key event to the host. return S_OK; } diff --git a/src/activeqt/shared/qaxtypes.cpp b/src/activeqt/shared/qaxtypes.cpp index ff21a9f..88f408e 100644 --- a/src/activeqt/shared/qaxtypes.cpp +++ b/src/activeqt/shared/qaxtypes.cpp @@ -547,7 +547,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type SAFEARRAY *array = 0; bool is2D = false; // If the first element in the array is a list the whole list is - // treated as a 2D array. The colum count is taken from the 1st element. + // treated as a 2D array. The column count is taken from the 1st element. if (count) { QVariantList col = list.at(0).toList(); int maxColumns = col.count(); diff --git a/src/corelib/arch/symbian/heap_hybrid.cpp b/src/corelib/arch/symbian/heap_hybrid.cpp index 91faaed..5d2b2b6 100644 --- a/src/corelib/arch/symbian/heap_hybrid.cpp +++ b/src/corelib/arch/symbian/heap_hybrid.cpp @@ -134,7 +134,7 @@ The constant can be changed at ROM build time using patchdata OBY keyword. @deprecated Patching this constant no longer has any effect. */ -#ifdef __X86GCC__ // For X86GCC we dont use the proper data import attribute +#ifdef __X86GCC__ // For X86GCC we don't use the proper data import attribute #undef IMPORT_D // since the constants are not really imported. GCC doesn't #define IMPORT_D // allow imports from self. #endif @@ -451,7 +451,7 @@ TInt RHybridHeap::ConstructLock(TUint32 aMode) void RHybridHeap::Init(TInt aBitmapSlab, TInt aPagePower) { - /*Moved code which does initilization */ + /*Moved code which does initialization */ iTop = (TUint8*)this + iMinLength; iBase = Ceiling(iBase, ECellAlignment); // Align iBase address @@ -874,7 +874,7 @@ available in the largest free block. Note that this function exists mainly for compatibility reasons. In a modern heap implementation such as that present in Symbian it is not appropriate to concern oneself with details such as the amount of free memory available on a -heap and its largeset free block, because the way that a modern heap implmentation +heap and its largeset free block, because the way that a modern heap implementation works is not simple. The amount of available virtual memory != physical memory and there are multiple allocation strategies used internally, which makes all memory usage figures "fuzzy" at best. @@ -1616,7 +1616,7 @@ void* RHybridHeap::DlMalloc(size_t bytes) void RHybridHeap::DlFree(void* mem) { /* - Consolidate freed chunks with preceeding or succeeding bordering + Consolidate freed chunks with preceding or succeeding bordering free chunks, if they exist, and then place in a bin. Intermixed with special cases for iTop, iDv, mmapped chunks, and usage errors. */ diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index d83f7ee..69e9219 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -695,7 +695,7 @@ bool QFSFileEnginePrivate::doStat() const } else if (fd == -1) { // ### actually covers two cases: d->fh and when the file is not open #if defined(Q_OS_SYMBIAN) - // Optimisation for Symbian where fileFlags() calls both doStat() and isSymlink(), but rarely on real links. + // Optimization for Symbian where fileFlags() calls both doStat() and isSymlink(), but rarely on real links. // When the filename is not a link, lstat will return the same info as stat, but this also removes // any need for a further call to lstat to check if the file is a link. need_lstat = false; diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp index 6eeabd3..ba6b99b 100644 --- a/src/plugins/graphicssystems/meego/dithering.cpp +++ b/src/plugins/graphicssystems/meego/dithering.cpp @@ -146,7 +146,7 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h // >> 7 because the values in accumulator are stored * 128 component[c] += accumulator[c][x] >> 7; - // Make sure we're not over the boundries. + // Make sure we're not over the boundaries. CLAMP_256(component[c]); // For green component we use 6 bits. Otherwise 5 bits. @@ -177,7 +177,7 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h } // Converts incoming RGBA32 (QImage::Format_ARGB32_Premultiplied) to RGB565. Returns the newly allocated data. -// This function is similiar (yet different) to the _565 variant but it makes sense to duplicate it here for simplicity. +// This function is similar (yet different) to the _565 variant but it makes sense to duplicate it here for simplicity. unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride) { // Will store output @@ -242,7 +242,7 @@ unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, in // >> 7 because the values in accumulator are stored * 128 component[c] += accumulator[c][x] >> 7; - // Make sure we're not over the boundries. + // Make sure we're not over the boundaries. CLAMP_256(component[c]); // Store the difference from converting 8bit => 4bit and the orig pixel. -- cgit v0.12 From 7eb4eb076531c3190af0452c865b928c60b225bb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Oct 2010 18:25:17 +0200 Subject: add autotest for QString::setRawData() ... and improve the one for fromRawData() marginally Reviewed-by: olivier --- tests/auto/qstring/tst_qstring.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp index ef82769..9df2a4d 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/qstring/tst_qstring.cpp @@ -76,6 +76,7 @@ private slots: void check_QTextStream(); void check_QDataStream(); void fromRawData(); + void setRawData(); void endsWith(); void startsWith(); void setNum(); @@ -2999,7 +3000,9 @@ void tst_QString::fromRawData() { const QChar ptr[] = { 0x1234, 0x0000 }; QString cstr = QString::fromRawData(ptr, 1); + QVERIFY(cstr.isDetached()); QVERIFY(cstr.constData() == ptr); + QVERIFY(cstr == QString(ptr, 1)); cstr.squeeze(); QVERIFY(cstr.constData() == ptr); cstr.detach(); @@ -3010,6 +3013,41 @@ void tst_QString::fromRawData() QVERIFY(cstr.constData()[1] == QChar(0x0000)); } +void tst_QString::setRawData() +{ + const QChar ptr[] = { 0x1234, 0x0000 }; + const QChar ptr2[] = { 0x4321, 0x0000 }; + QString cstr; + + // This just tests the fromRawData() fallback + QVERIFY(!cstr.isDetached()); + cstr.setRawData(ptr, 1); + QVERIFY(cstr.isDetached()); + QVERIFY(cstr.constData() == ptr); + QVERIFY(cstr == QString(ptr, 1)); + + // This actually tests the recycling of the shared data object + QString::DataPtr csd = cstr.data_ptr(); + cstr.setRawData(ptr2, 1); + QVERIFY(cstr.isDetached()); + QVERIFY(cstr.constData() == ptr2); + QVERIFY(cstr == QString(ptr2, 1)); + QVERIFY(cstr.data_ptr() == csd); + + // This tests the discarding of the shared data object + cstr = "foo"; + QVERIFY(cstr.isDetached()); + QVERIFY(cstr.constData() != ptr2); + + // Another test of the fallback + csd = cstr.data_ptr(); + cstr.setRawData(ptr2, 1); + QVERIFY(cstr.isDetached()); + QVERIFY(cstr.constData() == ptr2); + QVERIFY(cstr == QString(ptr2, 1)); + QVERIFY(cstr.data_ptr() != csd); +} + void tst_QString::fromStdString() { #ifdef Q_CC_HPACC -- cgit v0.12 From ee6fa11d3a8eee89646e86bc1f7b43fe87ae0e0c Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 18 Oct 2010 17:18:43 +0100 Subject: qmediaplayer: added command-line switch for initial volume Initial volume can be set using the following switch: -volume where 0.0 <= level <= 1.0 --- demos/qmediaplayer/main.cpp | 52 ++++++++++++++++++++------------------ demos/qmediaplayer/mediaplayer.cpp | 22 ++++++++++------ demos/qmediaplayer/mediaplayer.h | 7 ++--- 3 files changed, 46 insertions(+), 35 deletions(-) diff --git a/demos/qmediaplayer/main.cpp b/demos/qmediaplayer/main.cpp index 02c579b..9f15e43 100644 --- a/demos/qmediaplayer/main.cpp +++ b/demos/qmediaplayer/main.cpp @@ -42,6 +42,8 @@ #include #include "mediaplayer.h" +const qreal DefaultVolume = -1.0; + int main (int argc, char *argv[]) { Q_INIT_RESOURCE(mediaplayer); @@ -50,36 +52,38 @@ int main (int argc, char *argv[]) app.setOrganizationName("Qt"); app.setQuitOnLastWindowClosed(true); - bool hasSmallScreen = + QString fileName; + qreal volume = DefaultVolume; + bool smallScreen = false; #ifdef Q_OS_SYMBIAN - /* On Symbian, we always want fullscreen. One reason is that it's not - * possible to launch any demos from the fluidlauncher due to a - * limitation in the emulator. */ - true -#else - false + smallScreen = true; #endif - ; - - QString fileString; - const QStringList args(app.arguments()); - /* We have a minor problem here, we accept two arguments, both are - * optional: - * - A file name - * - the option "-small-screen", so let's try to cope with that. - */ - for (int i = 0; i < args.count(); ++i) { - const QString &at = args.at(i); - if (at == QLatin1String("-small-screen")) - hasSmallScreen = true; - else if (i > 0) // We don't want the app name. - fileString = at; + QStringList args(app.arguments()); + args.removeFirst(); // remove name of executable + while (!args.empty()) { + const QString &arg = args.first(); + if (QLatin1String("-small-screen") == arg || QLatin1String("--small-screen") == arg) { + smallScreen = true; + } else if (QLatin1String("-volume") == arg || QLatin1String("--volume") == arg) { + if (!args.empty()) { + args.removeFirst(); + volume = qMax(qMin(args.first().toFloat(), float(1.0)), float(0.0)); + } + } else if (fileName.isNull()) { + fileName = arg; + } + args.removeFirst(); } - MediaPlayer player(fileString, hasSmallScreen); + MediaPlayer player; + player.setSmallScreen(smallScreen); + if (DefaultVolume != volume) + player.setVolume(volume); + if (!fileName.isNull()) + player.setFile(fileName); - if (hasSmallScreen) + if (smallScreen) player.showMaximized(); else player.show(); diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 97a8e35..76beb0c 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -152,12 +152,10 @@ void MediaVideoWidget::dragEnterEvent(QDragEnterEvent *e) { } -MediaPlayer::MediaPlayer(const QString &filePath, - const bool hasSmallScreen) : +MediaPlayer::MediaPlayer() : playButton(0), nextEffect(0), settingsDialog(0), ui(0), m_AudioOutput(Phonon::VideoCategory), - m_videoWidget(new MediaVideoWidget(this)), - m_hasSmallScreen(hasSmallScreen) + m_videoWidget(new MediaVideoWidget(this)) { setWindowTitle(tr("Media Player")); setContextMenuPolicy(Qt::CustomContextMenu); @@ -346,8 +344,6 @@ MediaPlayer::MediaPlayer(const QString &filePath, m_audioOutputPath = Phonon::createPath(&m_MediaObject, &m_AudioOutput); Phonon::createPath(&m_MediaObject, m_videoWidget); - if (!filePath.isEmpty()) - setFile(filePath); resize(minimumSizeHint()); } @@ -358,7 +354,7 @@ void MediaPlayer::stateChanged(Phonon::State newstate, Phonon::State oldstate) if (oldstate == Phonon::LoadingState) { QRect videoHintRect = QRect(QPoint(0, 0), m_videoWindow.sizeHint()); QRect newVideoRect = QApplication::desktop()->screenGeometry().intersected(videoHintRect); - if (!m_hasSmallScreen) { + if (!m_smallScreen) { if (m_MediaObject.hasVideo()) { // Flush event que so that sizeHint takes the // recently shown/hidden m_videoWindow into account: @@ -466,6 +462,16 @@ void MediaPlayer::initSettingsDialog() } +void MediaPlayer::setVolume(qreal volume) +{ + m_AudioOutput.setVolume(volume); +} + +void MediaPlayer::setSmallScreen(bool smallScreen) +{ + m_smallScreen = smallScreen; +} + void MediaPlayer::effectChanged() { int currentIndex = ui->audioEffectsCombo->currentIndex(); @@ -685,7 +691,7 @@ bool MediaPlayer::playPauseForDialog() // If we're running on a small screen, we want to pause the video when // popping up dialogs. We neither want to tamper with the state if the // user has paused. - if (m_hasSmallScreen && m_MediaObject.hasVideo()) { + if (m_smallScreen && m_MediaObject.hasVideo()) { if (Phonon::PlayingState == m_MediaObject.state()) { m_MediaObject.pause(); return true; diff --git a/demos/qmediaplayer/mediaplayer.h b/demos/qmediaplayer/mediaplayer.h index d6ae58b..73450fe 100644 --- a/demos/qmediaplayer/mediaplayer.h +++ b/demos/qmediaplayer/mediaplayer.h @@ -104,8 +104,7 @@ class MediaPlayer : { Q_OBJECT public: - MediaPlayer(const QString &, - const bool hasSmallScreen); + MediaPlayer(); void dragEnterEvent(QDragEnterEvent *e); void dragMoveEvent(QDragMoveEvent *e); @@ -115,6 +114,8 @@ public: void setLocation(const QString &location); void initVideoWindow(); void initSettingsDialog(); + void setVolume(qreal volume); + void setSmallScreen(bool smallScreen); public slots: void openFile(); @@ -171,7 +172,7 @@ private: Phonon::AudioOutput m_AudioOutput; MediaVideoWidget *m_videoWidget; Phonon::Path m_audioOutputPath; - const bool m_hasSmallScreen; + bool m_smallScreen; }; #endif //MEDIAPLAYER_H -- cgit v0.12 From 83ca0eda314bcc3938d7cd716c640a1db5911c97 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 20 Oct 2010 10:36:17 +0100 Subject: Phonon MMF backend: removed redundant trace output --- src/3rdparty/phonon/mmf/abstractvideooutput.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractvideooutput.cpp b/src/3rdparty/phonon/mmf/abstractvideooutput.cpp index 2d221ed..068118b 100644 --- a/src/3rdparty/phonon/mmf/abstractvideooutput.cpp +++ b/src/3rdparty/phonon/mmf/abstractvideooutput.cpp @@ -161,24 +161,10 @@ void MMF::AbstractVideoOutput::dump() const { #ifndef QT_NO_DEBUG TRACE_CONTEXT(AbstractVideoOutput::dump, EVideoInternal); - QScopedPointer visitor(new ObjectDump::QVisitor); visitor->setPrefix("Phonon::MMF"); // to aid searchability of logs ObjectDump::addDefaultAnnotators(*visitor); - - if (QWidget *window = QApplication::activeWindow()) { - TRACE("Dumping from root window 0x%08x:", window); - ObjectDump::dumpTreeFromLeaf(*window, *visitor); - } - - TRACE("Dumping tree from leaf 0x%08x:", this); ObjectDump::dumpTreeFromLeaf(*this, *visitor); - - QScopedPointer dumper(new ObjectDump::QDumper); - dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs - ObjectDump::addDefaultAnnotators(*dumper); - TRACE_0("Dumping AbstractVideoOutput:"); - dumper->dumpObject(*this); #endif } -- cgit v0.12 From 4117403ad5170110849b7d0663337b1571304a8e Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 25 Oct 2010 18:32:21 +0200 Subject: Simplify calculation of center point and scale for PinchRecongizer Constructing a QLineF to get at the centerPoint is not precise and can be done simpler. The scale factor can be assigned directly to d->scaleFactor instead of creating a temporary scaleFactor variable. Reviewed-by: Zeno Albisser --- src/gui/kernel/qstandardgestures.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 893ba2b..1821c3d 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -198,25 +198,22 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, d->startPosition[0] = p1.screenPos(); d->startPosition[1] = p2.screenPos(); } - QLineF line(p1.screenPos(), p2.screenPos()); - QLineF lastLine(p1.lastScreenPos(), p2.lastScreenPos()); - QLineF tmp(line); - tmp.setLength(line.length() / 2.); - QPointF centerPoint = tmp.p2(); d->lastCenterPoint = d->centerPoint; - d->centerPoint = centerPoint; - d->changeFlags |= QPinchGesture::CenterPointChanged; + d->centerPoint = (p1.screenPos() + p2.screenPos()) / 2.0; - const qreal scaleFactor = line.length() / lastLine.length(); + d->changeFlags |= QPinchGesture::CenterPointChanged; if (d->isNewSequence) { - d->lastScaleFactor = scaleFactor; + d->scaleFactor = 1.0; + d->lastScaleFactor = 1.0; } else { d->lastScaleFactor = d->scaleFactor; + QLineF line(p1.screenPos(), p2.screenPos()); + QLineF lastLine(p1.lastScreenPos(), p2.lastScreenPos()); + d->scaleFactor = line.length() / lastLine.length(); } - d->scaleFactor = scaleFactor; - d->totalScaleFactor = d->totalScaleFactor * scaleFactor; + d->totalScaleFactor = d->totalScaleFactor * d->scaleFactor; d->changeFlags |= QPinchGesture::ScaleFactorChanged; qreal angle = QLineF(p1.screenPos(), p2.screenPos()).angle(); -- cgit v0.12 From 812945652783f289e6d94fa837184875dd76115a Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 26 Oct 2010 13:33:40 +1000 Subject: Run util/normalize on src/declarative. --- .../graphicsitems/qdeclarativeanchors.cpp | 4 +-- .../graphicsitems/qdeclarativegridview.cpp | 4 +-- .../graphicsitems/qdeclarativelistview.cpp | 4 +-- .../graphicsitems/qdeclarativepathview.cpp | 4 +-- .../graphicsitems/qdeclarativerepeater.cpp | 4 +-- .../graphicsitems/qdeclarativetextinput.cpp | 6 ++-- .../graphicsitems/qdeclarativevisualitemmodel.cpp | 32 +++++++++++----------- src/declarative/util/qdeclarativefontloader.cpp | 8 +++--- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeanchors.cpp b/src/declarative/graphicsitems/qdeclarativeanchors.cpp index 26fb97f..c96ca0e 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanchors.cpp @@ -272,7 +272,7 @@ void QDeclarativeAnchorsPrivate::addDepend(QGraphicsObject *item) } else if(itemPrivate->isWidget) { Q_Q(QDeclarativeAnchors); QGraphicsWidget *widget = static_cast(item); - QObject::connect(widget, SIGNAL(destroyed(QObject *)), q, SLOT(_q_widgetDestroyed(QObject *))); + QObject::connect(widget, SIGNAL(destroyed(QObject*)), q, SLOT(_q_widgetDestroyed(QObject*))); QObject::connect(widget, SIGNAL(geometryChanged()), q, SLOT(_q_widgetGeometryChanged())); } } @@ -289,7 +289,7 @@ void QDeclarativeAnchorsPrivate::remDepend(QGraphicsObject *item) } else if(itemPrivate->isWidget) { Q_Q(QDeclarativeAnchors); QGraphicsWidget *widget = static_cast(item); - QObject::disconnect(widget, SIGNAL(destroyed(QObject *)), q, SLOT(_q_widgetDestroyed(QObject *))); + QObject::disconnect(widget, SIGNAL(destroyed(QObject*)), q, SLOT(_q_widgetDestroyed(QObject*))); QObject::disconnect(widget, SIGNAL(geometryChanged()), q, SLOT(_q_widgetGeometryChanged())); } } diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index bbc03f3..6f38f63 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1217,7 +1217,7 @@ void QDeclarativeGridView::setModel(const QVariant &model) disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); disconnect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); - disconnect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); + disconnect(d->model, SIGNAL(createdItem(int,QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); disconnect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); } d->clear(); @@ -1258,7 +1258,7 @@ void QDeclarativeGridView::setModel(const QVariant &model) connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); - connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); + connect(d->model, SIGNAL(createdItem(int,QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); emit countChanged(); } diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index e29f285..38a4839 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1548,7 +1548,7 @@ void QDeclarativeListView::setModel(const QVariant &model) disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); disconnect(d->model, SIGNAL(itemsChanged(int,int)), this, SLOT(itemsChanged(int,int))); disconnect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); - disconnect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); + disconnect(d->model, SIGNAL(createdItem(int,QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); disconnect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); } d->clear(); @@ -1595,7 +1595,7 @@ void QDeclarativeListView::setModel(const QVariant &model) connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); connect(d->model, SIGNAL(itemsChanged(int,int)), this, SLOT(itemsChanged(int,int))); connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); - connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); + connect(d->model, SIGNAL(createdItem(int,QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); emit countChanged(); } diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 81c84f5..dc3d5ee 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -467,7 +467,7 @@ void QDeclarativePathView::setModel(const QVariant &model) disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); disconnect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); - disconnect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); + disconnect(d->model, SIGNAL(createdItem(int,QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); for (int i=0; iitems.count(); i++){ QDeclarativeItem *p = d->items[i]; d->model->release(p); @@ -498,7 +498,7 @@ void QDeclarativePathView::setModel(const QVariant &model) connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); - connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); + connect(d->model, SIGNAL(createdItem(int,QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); d->modelCount = d->model->count(); if (d->model->count()) d->offset = qmlMod(d->offset, qreal(d->model->count())); diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index cb64212..6f46c7b 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -202,7 +202,7 @@ void QDeclarativeRepeater::setModel(const QVariant &model) disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); disconnect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); /* - disconnect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); + disconnect(d->model, SIGNAL(createdItem(int,QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); disconnect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); */ } @@ -230,7 +230,7 @@ void QDeclarativeRepeater::setModel(const QVariant &model) connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); /* - connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); + connect(d->model, SIGNAL(createdItem(int,QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); */ regenerate(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 0903427..2348478 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -792,7 +792,7 @@ void QDeclarativeTextInput::setCursorDelegate(QDeclarativeComponent* c) d->cursorComponent = c; if(!c){ //note that the components are owned by something else - disconnect(d->control, SIGNAL(cursorPositionChanged(int, int)), + disconnect(d->control, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(moveCursor())); delete d->cursorItem; }else{ @@ -805,7 +805,7 @@ void QDeclarativeTextInput::setCursorDelegate(QDeclarativeComponent* c) void QDeclarativeTextInputPrivate::startCreatingCursor() { Q_Q(QDeclarativeTextInput); - q->connect(control, SIGNAL(cursorPositionChanged(int, int)), + q->connect(control, SIGNAL(cursorPositionChanged(int,int)), q, SLOT(moveCursor())); if(cursorComponent->isReady()){ q->createCursor(); @@ -1446,7 +1446,7 @@ void QDeclarativeTextInputPrivate::init() q, SLOT(cursorPosChanged())); q->connect(control, SIGNAL(selectionChanged()), q, SLOT(selectionChanged())); - q->connect(control, SIGNAL(textChanged(const QString &)), + q->connect(control, SIGNAL(textChanged(QString)), q, SLOT(q_textChanged())); q->connect(control, SIGNAL(accepted()), q, SIGNAL(accepted())); diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index e569dd2..1f01a45 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -714,14 +714,14 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model) this, SLOT(_q_itemsMoved(int,int,int))); d->m_listModelInterface = 0; } else if (d->m_abstractItemModel) { - QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsInserted(const QModelIndex &,int,int)), - this, SLOT(_q_rowsInserted(const QModelIndex &,int,int))); - QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsRemoved(const QModelIndex &,int,int)), - this, SLOT(_q_rowsRemoved(const QModelIndex &,int,int))); - QObject::disconnect(d->m_abstractItemModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)), - this, SLOT(_q_dataChanged(const QModelIndex&,const QModelIndex&))); - QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int)), - this, SLOT(_q_rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int))); + QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(_q_rowsInserted(QModelIndex,int,int))); + QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(_q_rowsRemoved(QModelIndex,int,int))); + QObject::disconnect(d->m_abstractItemModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), + this, SLOT(_q_dataChanged(QModelIndex,QModelIndex))); + QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), + this, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int))); QObject::disconnect(d->m_abstractItemModel, SIGNAL(modelReset()), this, SLOT(_q_modelReset())); QObject::disconnect(d->m_abstractItemModel, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged())); d->m_abstractItemModel = 0; @@ -762,14 +762,14 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model) emit itemsInserted(0, d->m_listModelInterface->count()); return; } else if (object && (d->m_abstractItemModel = qobject_cast(object))) { - QObject::connect(d->m_abstractItemModel, SIGNAL(rowsInserted(const QModelIndex &,int,int)), - this, SLOT(_q_rowsInserted(const QModelIndex &,int,int))); - QObject::connect(d->m_abstractItemModel, SIGNAL(rowsRemoved(const QModelIndex &,int,int)), - this, SLOT(_q_rowsRemoved(const QModelIndex &,int,int))); - QObject::connect(d->m_abstractItemModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)), - this, SLOT(_q_dataChanged(const QModelIndex&,const QModelIndex&))); - QObject::connect(d->m_abstractItemModel, SIGNAL(rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int)), - this, SLOT(_q_rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int))); + QObject::connect(d->m_abstractItemModel, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(_q_rowsInserted(QModelIndex,int,int))); + QObject::connect(d->m_abstractItemModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(_q_rowsRemoved(QModelIndex,int,int))); + QObject::connect(d->m_abstractItemModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), + this, SLOT(_q_dataChanged(QModelIndex,QModelIndex))); + QObject::connect(d->m_abstractItemModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), + this, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int))); QObject::connect(d->m_abstractItemModel, SIGNAL(modelReset()), this, SLOT(_q_modelReset())); QObject::connect(d->m_abstractItemModel, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged())); d->m_metaDataCacheable = true; diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index d2f65ef..9fee257 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -220,15 +220,15 @@ void QDeclarativeFontLoader::setSource(const QUrl &url) fo->download(d->url, qmlEngine(this)->networkAccessManager()); d->status = Loading; emit statusChanged(); - QObject::connect(fo, SIGNAL(fontDownloaded(QString, QDeclarativeFontLoader::Status)), - this, SLOT(updateFontInfo(QString, QDeclarativeFontLoader::Status))); + QObject::connect(fo, SIGNAL(fontDownloaded(QString,QDeclarativeFontLoader::Status)), + this, SLOT(updateFontInfo(QString,QDeclarativeFontLoader::Status))); } else { QDeclarativeFontObject *fo = d->fonts[d->url]; if (fo->id == -1) { d->status = Loading; emit statusChanged(); - QObject::connect(fo, SIGNAL(fontDownloaded(QString, QDeclarativeFontLoader::Status)), - this, SLOT(updateFontInfo(QString, QDeclarativeFontLoader::Status))); + QObject::connect(fo, SIGNAL(fontDownloaded(QString,QDeclarativeFontLoader::Status)), + this, SLOT(updateFontInfo(QString,QDeclarativeFontLoader::Status))); } else updateFontInfo(QFontDatabase::applicationFontFamilies(fo->id).at(0), Ready); -- cgit v0.12 From 7a083cc0b52df31fe9348f7e09eaf6d9e72bdb13 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Mon, 25 Oct 2010 12:17:26 +0300 Subject: Remove qdrawhelper_arm_simd.cpp dependency to u32std.h Reviewed-by: Shane Kearns --- src/gui/painting/qdrawhelper_arm_simd.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper_arm_simd.cpp b/src/gui/painting/qdrawhelper_arm_simd.cpp index 61dac5e..2a5f5e4 100644 --- a/src/gui/painting/qdrawhelper_arm_simd.cpp +++ b/src/gui/painting/qdrawhelper_arm_simd.cpp @@ -47,7 +47,26 @@ #ifdef QT_HAVE_ARM_SIMD #if defined(Q_OS_SYMBIAN) -#include +#if !defined(__SWITCH_TO_ARM) +#ifdef __MARM_THUMB__ +#ifndef __ARMCC__ +#define __SWITCH_TO_ARM asm("push {r0} ");\ + asm("add r0, pc, #4 ");\ + asm("bx r0 ");\ + asm("nop ");\ + asm(".align 2 ");\ + asm(".code 32 ");\ + asm("ldr r0, [sp], #4 ") +#define __END_ARM asm(".code 16 ") +#else +#define __SWITCH_TO_ARM asm(".code 32 "); +#define __END_ARM +#endif // __ARMCC__ +#else +#define __SWITCH_TO_ARM +#define __END_ARM +#endif //__MARM_THUMB__ +#endif #endif #if defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT) -- cgit v0.12 From 86870912cfb1444f2ad0cd6b99c163af43f06bde Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 26 Oct 2010 12:03:32 +0300 Subject: Fix empty mifconv TARGETFILE in some edge cases. Only add ICON for Qt gui application projects that do not explicitly want to suppress it in symbianpkgrules.pri. This logic should match the logic used for setting RSS_RULES.icon_file and thus avoid empty TARGETFILE in bld.inf mifconv extension. Task-number: QT-4193 Reviewed-by: Janne Koskinen --- demos/symbianpkgrules.pri | 4 +++- examples/symbianpkgrules.pri | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/demos/symbianpkgrules.pri b/demos/symbianpkgrules.pri index d42f188..c9cc492 100644 --- a/demos/symbianpkgrules.pri +++ b/demos/symbianpkgrules.pri @@ -13,4 +13,6 @@ vendorinfo = \ demos_deployment.pkg_prerules += vendorinfo DEPLOYMENT += demos_deployment -contains(TEMPLATE,app):isEmpty(ICON):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg +isEmpty(ICON):contains(TEMPLATE, ".*app"):contains(QT, gui):contains(CONFIG, qt):!contains(CONFIG, "no_icon") { + ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg +} diff --git a/examples/symbianpkgrules.pri b/examples/symbianpkgrules.pri index b22ca85..0f615c7 100644 --- a/examples/symbianpkgrules.pri +++ b/examples/symbianpkgrules.pri @@ -13,4 +13,7 @@ vendorinfo = \ examples_deployment.pkg_prerules += vendorinfo DEPLOYMENT += examples_deployment -contains(TEMPLATE,app):isEmpty(ICON):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg +isEmpty(ICON):contains(TEMPLATE, ".*app"):contains(QT, gui):contains(CONFIG, qt):!contains(CONFIG, "no_icon") { + ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg +} + -- cgit v0.12 From fb25d5d1dbc64b764c11e05b72515f74713a498d Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Tue, 26 Oct 2010 12:10:34 +0200 Subject: Doc : Fixing typo. --- tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h | 2 +- tools/qtestlib/wince/cetest/activesyncconnection.cpp | 2 +- tools/qtestlib/wince/cetest/main.cpp | 2 +- tools/qvfb/qvfb.cpp | 2 +- tools/runonphone/symbianutils/tcftrkdevice.h | 2 +- tools/runonphone/symbianutils/tcftrkmessage.h | 2 +- util/normalize/main.cpp | 2 +- util/s60pixelmetrics/pm_mapperapp.cpp | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h index 2bb75eb..2baacbb 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h @@ -147,7 +147,7 @@ public: //! Destroys an EGL shared image. /*! Destroys an EGLSharedImage previously created with an ::imageToEGLSharedImage call. - Returns true if the image was found and the destruction was successfull. Notice that + Returns true if the image was found and the destruction was successful. Notice that this destroys the image for all processes using it. */ static bool destroyEGLSharedImage(Qt::HANDLE handle); diff --git a/tools/qtestlib/wince/cetest/activesyncconnection.cpp b/tools/qtestlib/wince/cetest/activesyncconnection.cpp index 98062ed..812ed47 100644 --- a/tools/qtestlib/wince/cetest/activesyncconnection.cpp +++ b/tools/qtestlib/wince/cetest/activesyncconnection.cpp @@ -247,7 +247,7 @@ bool ActiveSyncConnection::copyFileFromDevice(const QString &deviceSource, const wprintf(L"\n"); if (!readUntilEnd) { - debugOutput(QString::fromLatin1(" an error occured during copy"), 2); + debugOutput(QString::fromLatin1(" an error occurred during copy"), 2); return false; } diff --git a/tools/qtestlib/wince/cetest/main.cpp b/tools/qtestlib/wince/cetest/main.cpp index 4272a83..ec62af1 100644 --- a/tools/qtestlib/wince/cetest/main.cpp +++ b/tools/qtestlib/wince/cetest/main.cpp @@ -283,7 +283,7 @@ int main(int argc, char **argv) cout << "Error: Can only test executables!" << endl; return -1; } - // Check wether the project is still in debug/release mode after reading + // Check whether the project is still in debug/release mode after reading // If .pro specifies to be one mode only, we need to accept this if (project.isActiveConfig("debug") && !project.isActiveConfig("release")) { TestConfiguration::testDebug = true; diff --git a/tools/qvfb/qvfb.cpp b/tools/qvfb/qvfb.cpp index b4ccebc..a3b1964 100644 --- a/tools/qvfb/qvfb.cpp +++ b/tools/qvfb/qvfb.cpp @@ -1038,7 +1038,7 @@ void AnimationSaveWidget::convertToMpeg(QString filename) // ### can't use QProcess, not in Qt 2.3 // ### but it's certainly in Qt 4! use it? - // Execute the ppmtompeg command as a seperate process to do the encoding + // Execute the ppmtompeg command as a separate process to do the encoding pid_t pid = ::fork(); if ( !pid ) { // Child process diff --git a/tools/runonphone/symbianutils/tcftrkdevice.h b/tools/runonphone/symbianutils/tcftrkdevice.h index 67955e5..f56a86e 100644 --- a/tools/runonphone/symbianutils/tcftrkdevice.h +++ b/tools/runonphone/symbianutils/tcftrkdevice.h @@ -65,7 +65,7 @@ struct Breakpoint; /* Command error handling in TCF: * 1) 'Severe' errors (JSON format, parameter format): Trk emits a - * nonstandard message (\3\2 error paramaters) and closes the connection. + * nonstandard message (\3\2 error parameters) and closes the connection. * 2) Protocol errors: 'N' without error message is returned. * 3) Errors in command execution: 'R' with a TCF error hash is returned * (see TcfTrkCommandError). */ diff --git a/tools/runonphone/symbianutils/tcftrkmessage.h b/tools/runonphone/symbianutils/tcftrkmessage.h index 510b485..929a9e6 100644 --- a/tools/runonphone/symbianutils/tcftrkmessage.h +++ b/tools/runonphone/symbianutils/tcftrkmessage.h @@ -123,7 +123,7 @@ struct SYMBIANUTILS_EXPORT RunControlContext { QByteArray parentId; // Parent process id of a thread. }; -// Module load information occuring with 'RunControl contextSuspended' events +// Module load information occurring with 'RunControl contextSuspended' events struct SYMBIANUTILS_EXPORT ModuleLoadEventInfo { ModuleLoadEventInfo(); void clear(); diff --git a/util/normalize/main.cpp b/util/normalize/main.cpp index 4658b5e..65b8d51 100644 --- a/util/normalize/main.cpp +++ b/util/normalize/main.cpp @@ -159,7 +159,7 @@ int main(int argc, char *argv[]) printf("usage: normalize [--modify] \n"); printf(" can be a single file or a directory (default: look for *.cpp recursively)"); printf(" Outputs all filenames that contain non-normalized SIGNALs and SLOTs\n"); - printf(" with --modify: fix all occurences of non-normalized SIGNALs and SLOTs\n"); + printf(" with --modify: fix all occurrences of non-normalized SIGNALs and SLOTs\n"); return 1; } diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp index d68a0b0..b0c4eaf 100644 --- a/util/s60pixelmetrics/pm_mapperapp.cpp +++ b/util/s60pixelmetrics/pm_mapperapp.cpp @@ -299,7 +299,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) TInt height = screenRect.Height(); TInt width = screenRect.Width(); TBuf16<32> tgt; - // HEIGTH + // HEIGHT tgt.Append(_L("height: \t")); tgt.AppendNum(height, EDecimal); // put max height into text file ShowL( tgt, last ); -- cgit v0.12 From f603ce9a960ee387ab10be1916da8ffd09305045 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 26 Oct 2010 13:50:28 +0300 Subject: Fix patch_capabilities.pl script for explicit set of capabilities Elftran command never got executed when explicit set of capabilities was defined. No warning or error was printed either, making it rather confusing for user. Task-number: QTBUG-14730 Reviewed-by: Janne Koskinen --- bin/patch_capabilities.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl index 06ab116..5230480 100755 --- a/bin/patch_capabilities.pl +++ b/bin/patch_capabilities.pl @@ -269,6 +269,9 @@ if (@ARGV) if (@capabilitiesSpecified) { $commandToExecute = sprintf($baseCommandToExecute, join(" ", @capabilitiesSpecified)); + $executeNeeded = 1; + my $capString = join(" ", @capabilitiesSpecified); + print ("Patching: Patching the the Vendor ID to 0 and the capabilities used to: \"$capString\" in \"$binaryBaseName\".\n"); } else { # Test which capabilities are present and then restrict them to the allowed set. # This avoid raising the capabilities of apps that already have none. -- cgit v0.12 From f30bcbd8409efdb48790ec09f603887d5763ea7c Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Tue, 26 Oct 2010 13:46:40 +0200 Subject: Set the location of the closing brace. Reviewed-by: Christian Kamm --- src/declarative/qml/parser/qdeclarativejs.g | 4 ++-- src/declarative/qml/parser/qdeclarativejsparser.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g index 1b66ba0..c84f0b3 100644 --- a/src/declarative/qml/parser/qdeclarativejs.g +++ b/src/declarative/qml/parser/qdeclarativejs.g @@ -1254,7 +1254,7 @@ case $rule_number: { else node = makeAstNode (driver->nodePool()); node->lbraceToken = loc(1); - node->lbraceToken = loc(3); + node->rbraceToken = loc(3); sym(1).Node = node; } break; ./ @@ -1265,7 +1265,7 @@ case $rule_number: { AST::ObjectLiteral *node = makeAstNode (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); node->lbraceToken = loc(1); - node->lbraceToken = loc(4); + node->rbraceToken = loc(4); sym(1).Node = node; } break; ./ diff --git a/src/declarative/qml/parser/qdeclarativejsparser.cpp b/src/declarative/qml/parser/qdeclarativejsparser.cpp index 8afb93d..28ef17d 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser.cpp +++ b/src/declarative/qml/parser/qdeclarativejsparser.cpp @@ -679,7 +679,7 @@ case 85: { else node = makeAstNode (driver->nodePool()); node->lbraceToken = loc(1); - node->lbraceToken = loc(3); + node->rbraceToken = loc(3); sym(1).Node = node; } break; @@ -687,7 +687,7 @@ case 86: { AST::ObjectLiteral *node = makeAstNode (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); node->lbraceToken = loc(1); - node->lbraceToken = loc(4); + node->rbraceToken = loc(4); sym(1).Node = node; } break; -- cgit v0.12 From 586fc2a9ead06a8478bdc380b775f18000741745 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 19 Oct 2010 09:40:25 +0100 Subject: Suppress call to controlVisibilityChanged for null control pointer At this point, old_winid may be null. Passing a null pointer to controlVisibilityChanged is actually a no-op, due to the 'QWidgetPrivate::mapper->contains(control)' check, but suppressing the function call altogether clarifies the intent of the code slightly. Reviewed-by: Jason Barron --- src/gui/kernel/qwidget_s60.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 031892d..cf4bdf1 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -709,7 +709,8 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // old_winid may not have received a 'not visible' visibility // changed event before being destroyed; make sure that it is // removed from the backing store's list of visible windows. - S60->controlVisibilityChanged(old_winid, false); + if (old_winid) + S60->controlVisibilityChanged(old_winid, false); setWinId(0); -- cgit v0.12 From f417a6e7729a506e5a59e7fd38e03166515198b1 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 19 Oct 2010 16:46:18 +0100 Subject: Remove widget subtree from backing store tracker when reparented When a native widget is reparented such that the value of maybeBackingStore() changes, it and all of its native descendents must be removed from the old QWidgetBackingStoreTracker. If this is not done, the backing store may not be deleted when the top-level widget is hidden, thereby consuming memory unnecessarily. Task-number: MOBILITY-1315 Reviewed-by: Jason Barron Reviewed-by: bnilsen --- src/gui/kernel/qwidget.cpp | 20 ++++++++++++++++++++ src/gui/kernel/qwidget_p.h | 1 + tests/auto/qwidget/tst_qwidget.cpp | 24 +++++++++++++++++++++--- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 9b44f15..6c64ffc 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -236,6 +236,17 @@ void QWidgetBackingStoreTracker::unregisterWidget(QWidget *w) } } +/*! + \internal + Recursively remove widget and all of its descendents. + */ +void QWidgetBackingStoreTracker::unregisterWidgetSubtree(QWidget *widget) +{ + unregisterWidget(widget); + foreach (QObject *child, widget->children()) + if (QWidget *childWidget = qobject_cast(child)) + unregisterWidgetSubtree(childWidget); +} QWidgetPrivate::QWidgetPrivate(int version) : QObjectPrivate(version) @@ -10031,7 +10042,16 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) if (newParent && isAncestorOf(focusWidget())) focusWidget()->clearFocus(); + QTLWExtra *oldTopExtra = window()->d_func()->maybeTopData(); + QWidgetBackingStoreTracker *oldBsTracker = oldTopExtra ? &oldTopExtra->backingStore : 0; + d->setParent_sys(parent, f); + + QTLWExtra *topExtra = window()->d_func()->maybeTopData(); + QWidgetBackingStoreTracker *bsTracker = topExtra ? &topExtra->backingStore : 0; + if (oldBsTracker && oldBsTracker != bsTracker) + oldBsTracker->unregisterWidgetSubtree(this); + if (desktopWidget) parent = 0; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 6c89659..ca1e3fc 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -122,6 +122,7 @@ public: void registerWidget(QWidget *w); void unregisterWidget(QWidget *w); + void unregisterWidgetSubtree(QWidget *w); inline QWidgetBackingStore* data() { diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 2f221d2..09af941 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9718,14 +9718,25 @@ void tst_QWidget::destroyBackingStoreWhenHidden() child.setAutoFillBackground(true); child.setPalette(Qt::blue); + QWidget grandChild(&child); + grandChild.setAutoFillBackground(true); + grandChild.setPalette(Qt::yellow); + QVBoxLayout layout(&parent); layout.setContentsMargins(10, 10, 10, 10); layout.addWidget(&child); parent.setLayout(&layout); - child.winId(); + QVBoxLayout childLayout(&child); + childLayout.setContentsMargins(10, 10, 10, 10); + childLayout.addWidget(&grandChild); + child.setLayout(&childLayout); + + // Ensure that this widget and all its ancestors are native + grandChild.winId(); parent.show(); + QTest::qWaitForWindowShown(&parent); // Check that child window does not obscure parent window @@ -9734,18 +9745,24 @@ void tst_QWidget::destroyBackingStoreWhenHidden() // Native child widget should share parent's backing store QVERIFY(0 != backingStore(parent)); QVERIFY(0 == backingStore(child)); + QVERIFY(0 == backingStore(grandChild)); // Make child widget full screen child.setWindowFlags((child.windowFlags() | Qt::Window) ^ Qt::SubWindow); child.setWindowState(child.windowState() | Qt::WindowFullScreen); child.show(); + + // Paint into the child to ensure that it gets a backing store + QPainter painter(&child); + painter.fillRect(QRect(0, 0, 90, 90), Qt::white); + QTest::qWaitForWindowShown(&child); // Ensure that 'window hidden' event is received by parent qApp->processEvents(); // Check that child window obscures parent window - QVERIFY(parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty()); + QVERIFY(parent.visibleRegion().subtracted(child.visibleRegion() + grandChild.visibleRegion()).isEmpty()); // Now that extent of child widget goes beyond parent's extent, // a new backing store should be created for the child widget. @@ -9761,11 +9778,12 @@ void tst_QWidget::destroyBackingStoreWhenHidden() QTest::qWaitForWindowShown(&child); // Check that parent is now visible again - QVERIFY(!parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty()); + QVERIFY(!parent.visibleRegion().subtracted(child.visibleRegion() + grandChild.visibleRegion()).isEmpty()); // Native child widget should once again share parent's backing store QVERIFY(0 != backingStore(parent)); QVERIFY(0 == backingStore(child)); + QVERIFY(0 == backingStore(grandChild)); } // 6. Partial reveal followed by full reveal -- cgit v0.12 From 5d411794d18f33ed8438744216b8ec5095682e20 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 26 Oct 2010 09:18:39 +0100 Subject: Create dummy window surface if if _q_DummyWindowSurface property is set Task-number: MOBILITY-1315 Reviewed-by: Jason Barron Reviewed-by: bnilsen --- src/gui/kernel/qwidget.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 6c64ffc..e22ec55 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -337,15 +337,27 @@ QWidgetPrivate::~QWidgetPrivate() #endif //QT_NO_GRAPHICSEFFECT } +class QDummyWindowSurface : public QWindowSurface +{ +public: + QDummyWindowSurface(QWidget *window) : QWindowSurface(window) {} + QPaintDevice *paintDevice() { return window(); } + void flush(QWidget *, const QRegion &, const QPoint &) {} +}; + QWindowSurface *QWidgetPrivate::createDefaultWindowSurface() { Q_Q(QWidget); QWindowSurface *surface; - if (QApplicationPrivate::graphicsSystem()) - surface = QApplicationPrivate::graphicsSystem()->createWindowSurface(q); - else - surface = createDefaultWindowSurface_sys(); + if (q->property("_q_DummyWindowSurface").toBool()) { + surface = new QDummyWindowSurface(q); + } else { + if (QApplicationPrivate::graphicsSystem()) + surface = QApplicationPrivate::graphicsSystem()->createWindowSurface(q); + else + surface = createDefaultWindowSurface_sys(); + } return surface; } -- cgit v0.12 From 00ab5c0d690f5cbb1f588adf0d469e5e9c54051c Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 25 Oct 2010 15:40:19 +0100 Subject: Phonon MMF backend: set _q_DummyWindowSurface property on VideoWidget This prevents a window surface being created if Phonon::VideoWidget::setFullScreen(true) is called. Since Qt does not ever render any content to the native window in which video is displayed, creation of a surface for that window would consume memory unnecessarily. Task-number: MOBILITY-1315 Reviewed-by: Jason Barron --- src/3rdparty/phonon/mmf/videowidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp index 122094e..d59e82a 100644 --- a/src/3rdparty/phonon/mmf/videowidget.cpp +++ b/src/3rdparty/phonon/mmf/videowidget.cpp @@ -65,6 +65,8 @@ MMF::VideoWidget::VideoWidget(QWidget *parent) TRACE_CONTEXT(VideoWidget::VideoWidget, EVideoApi); TRACE_ENTRY_0(); + parent->setProperty("_q_DummyWindowSurface", true); + TRACE_EXIT_0(); } -- cgit v0.12