diff options
Diffstat (limited to 'src')
61 files changed, 480 insertions, 212 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp index 1268d3d..d7fbce8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp @@ -233,7 +233,9 @@ void Heap::destroy() template <HeapType heapType> static NEVER_INLINE CollectorBlock* allocateBlock() { -#if PLATFORM(DARWIN) + // Disable the use of vm_map for the Qt build on Darwin, because when compiled on 10.4 + // it crashes on 10.5 +#if PLATFORM(DARWIN) && !PLATFORM(QT) vm_address_t address = 0; // FIXME: tag the region as a JavaScriptCore heap when we get a registered VM tag: <rdar://problem/6054788>. vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE | VM_TAG_FOR_COLLECTOR_MEMORY, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT); @@ -285,7 +287,9 @@ static NEVER_INLINE CollectorBlock* allocateBlock() static void freeBlock(CollectorBlock* block) { -#if PLATFORM(DARWIN) + // Disable the use of vm_deallocate for the Qt build on Darwin, because when compiled on 10.4 + // it crashes on 10.5 +#if PLATFORM(DARWIN) && !PLATFORM(QT) vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(block), BLOCK_SIZE); #elif PLATFORM(SYMBIAN) userChunk->Free(reinterpret_cast<TAny*>(block)); diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc index e3c904b..09dfae5 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc @@ -139,15 +139,18 @@ \section1 Netscape Plugin Support + \note Netscape plugin support is only available on desktop platforms. + Since WebKit supports the Netscape Plugin API, Qt applications can display - Web pages that embed common plugins, as long as the user has the appropriate + Web pages that embed common plugins on platforms for which those plugins + are available. To enable plugin support, the user must have the appropriate binary files for those plugins installed and the \l{QWebSettings::PluginsEnabled} - attribute is enabled for the application. + attribute must be enabled for the application. The following locations are searched for plugins: \table - \header \o Linux/Unix \o Windows + \header \o Linux/Unix (X11) \o Windows \row \o{1,3} \list \o \c{.mozilla/plugins} in the user's home directory diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h index b52780d..f65c845 100644 --- a/src/corelib/io/qfile.h +++ b/src/corelib/io/qfile.h @@ -116,7 +116,7 @@ public: static QByteArray encodeName(const QString &fileName); static QString decodeName(const QByteArray &localFileName); inline static QString decodeName(const char *localFileName) - { return decodeName(QByteArray(localFileName)); }; + { return decodeName(QByteArray(localFileName)); } static void setEncodingFunction(EncoderFn); static void setDecodingFunction(DecoderFn); diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index b779aa3..fb096a7 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -157,7 +157,15 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) #endif separatorPos = tmpPath.indexOf(slash, separatorPos + 1); QString prefix = separatorPos == -1 ? tmpPath : tmpPath.left(separatorPos); - if (!nonSymlinks.contains(prefix)) { + if ( +#ifdef Q_OS_SYMBIAN + // Symbian doesn't support directory symlinks, so do not check for link unless we + // are handling the last path element. This not only slightly improves performance, + // but also saves us from lot of unnecessary platform security check failures + // when dealing with files under *:/private directories. + separatorPos == -1 && +#endif + !nonSymlinks.contains(prefix)) { fi.setFile(prefix); if (fi.isSymLink()) { QString target = fi.symLinkTarget(); diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 763589a..898447c 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -1954,7 +1954,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, #endif if (handle == INVALID_HANDLE_VALUE) { - q->setError(QFile::UnspecifiedError, QLatin1String("No handle on file")); + q->setError(QFile::PermissionsError, qt_error_string(ERROR_ACCESS_DENIED)); return 0; } diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 3dbde3f..51e8d00 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1806,18 +1806,35 @@ QString QCoreApplication::applicationDirPath() RProcess proc; TInt err = proc.Open(proc.Id()); if (err == KErrNone) { + QChar driveChar; #if defined(Q_CC_NOKIAX86) // In emulator, always resolve the private dir on C-drive - appPath.append(QChar('C')); + driveChar = QLatin1Char('C'); #else - appPath.append(QChar((proc.FileName())[0])); + driveChar = QLatin1Char((proc.FileName())[0]); #endif - appPath.append(QLatin1String(":\\private\\")); - QString sid; - sid.setNum(proc.SecureId().iId, 16); - appPath.append(sid); - appPath.append(QLatin1Char('\\')); proc.Close(); + + driveChar = driveChar.toUpper(); + + TFileName privatePath; + RFs& fs = qt_s60GetRFs(); + fs.PrivatePath(privatePath); + appPath = qt_TDesC2QString(privatePath); + appPath.prepend(QLatin1Char(':')).prepend(driveChar); + + // Create the appPath if it doesn't exist. Non-existing appPath will cause + // Platform Security violations later on if the app doesn't have AllFiles capability. + // Can't create appPath for ROM unfortunately, so applications meant for + // ROM should always deploy something to their private dir to ensure appPath exists, + // if the PlatSec violations are an issue. + char driveDiff = QLatin1Char('Z').toLatin1() - driveChar.toLatin1(); + TInt driveId = EDriveZ - static_cast<TInt>(driveDiff); + if (driveId != EDriveZ) { + TInt err = fs.CreatePrivatePath(driveId); + if (err != KErrNone) + qWarning("QCoreApplication::applicationDirPath: Failed to create private path."); + } } QFileInfo fi(appPath); diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h index c05c4ef..622e9b6 100644 --- a/src/corelib/kernel/qtimer.h +++ b/src/corelib/kernel/qtimer.h @@ -84,7 +84,7 @@ public Q_SLOTS: void stop(); #ifdef QT3_SUPPORT - inline QT_MOC_COMPAT void changeInterval(int msec) { start(msec); }; + inline QT_MOC_COMPAT void changeInterval(int msec) { start(msec); } QT_MOC_COMPAT int start(int msec, bool sshot); #endif diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index b71c8b5..23bb07c 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -48,6 +48,11 @@ #include "qdebug.h" #include "qdir.h" +#if defined(Q_OS_SYMBIAN) +# include <f32file.h> +# include "private/qcore_symbian_p.h" +#endif + #ifndef QT_NO_LIBRARY QT_BEGIN_NAMESPACE @@ -309,10 +314,18 @@ void QPluginLoader::setFileName(const QString &fileName) if (stubPath.at(1).toAscii() == ':') stubPath.remove(0,2); QFileInfoList driveList(QDir::drives()); + RFs rfs = qt_s60GetRFs(); foreach(const QFileInfo& drive, driveList) { QString testFilePath(drive.absolutePath() + stubPath); testFilePath = QDir::cleanPath(testFilePath); - if (QFile::exists(testFilePath)) { + // Use native Symbian code to check for file existence, because checking + // for file from under non-existent protected dir like E:/private/<uid> using + // QFile::exists causes platform security violations on most apps. + QString nativePath = QDir::toNativeSeparators(testFilePath); + TPtrC ptr(qt_QString2TPtrC(nativePath)); + TUint attributes; + TInt err = rfs.Att(ptr, attributes); + if (err == KErrNone) { fn = testFilePath; break; } diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index 2150ccb..f5441a3 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE /*! \class QMargins \ingroup painting + \since 4.6 \brief The QMargins class defines the four margins of a rectangle. diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri index 75a3d91..22c8bd7 100644 --- a/src/gui/egl/egl.pri +++ b/src/gui/egl/egl.pri @@ -21,7 +21,7 @@ unix { } for(p, QMAKE_LIBDIR_EGL) { - exists($$p):LIBS += -L$$p + exists($$p):LIBS_PRIVATE += -L$$p } !isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL diff --git a/src/gui/embedded/qwssharedmemory_p.h b/src/gui/embedded/qwssharedmemory_p.h index fabd2dd..1d0d090 100644 --- a/src/gui/embedded/qwssharedmemory_p.h +++ b/src/gui/embedded/qwssharedmemory_p.h @@ -68,7 +68,7 @@ public: void setPermissions(mode_t mode); int size() const; - void *address() { return shmBase; }; + void *address() { return shmBase; } int id() const { return shmId; } @@ -82,7 +82,7 @@ public: // old API QWSSharedMemory(int, const QString &, char c = 'Q'); - void * base() { return address(); }; + void * base() { return address(); } bool create(); void destroy(); diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index d67011b..9c0c649 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -335,10 +335,6 @@ it's parent if it's z-value is negative. This flag enables setZValue() to toggle ItemStacksBehindParent. - \value ItemAutoDetectsFocusProxy The item will assign any child that - gains input focus as its focus proxy. See also focusProxy(). - This flag was introduced in Qt 4.6. - \value ItemIsPanel. The item is a panel. A panel provides activation and contained focus handling. Only one panel can be active at a time (see QGraphicsItem::isActive()). When no panel is active, QGraphicsScene @@ -954,17 +950,6 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) parent->itemChange(QGraphicsItem::ItemChildRemovedChange, thisPointerVariant); } - // Auto-update focus proxy. Any ancestor that has this as focus proxy - //needs to be nulled. - QGraphicsItem *p = parent; - while (p) { - if ((p->d_ptr->flags & QGraphicsItem::ItemAutoDetectsFocusProxy) && - (p->focusProxy() == q)) { - p->setFocusProxy(0); - } - p = p->d_ptr->parent; - } - // Update toplevelitem list. If this item is being deleted, its parent // will be 0 but we don't want to register/unregister it in the TLI list. if (scene && !inDestructor) { @@ -1041,18 +1026,11 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) dirtySceneTransform = 1; // Restore the sub focus chain. - if (lastSubFocusItem) - lastSubFocusItem->d_ptr->setSubFocus(); - - // Auto-update focus proxy. The closest parent that detects - // focus proxies is updated as the proxy gains or loses focus. - p = newParent; - while (p) { - if (p->d_ptr->flags & QGraphicsItem::ItemAutoDetectsFocusProxy) { - p->setFocusProxy(q); - break; - } - p = p->d_ptr->parent; + if (lastSubFocusItem) { + if (parent && parent->isActive()) + lastSubFocusItem->setFocus(); + else + lastSubFocusItem->d_ptr->setSubFocus(); } // Deliver post-change notification @@ -1220,6 +1198,7 @@ QGraphicsItem::~QGraphicsItem() d_ptr->removeExtraItemCache(); clearFocus(); + if (!d_ptr->children.isEmpty()) { QList<QGraphicsItem *> oldChildren = d_ptr->children; qDeleteAll(oldChildren); @@ -2772,7 +2751,7 @@ void QGraphicsItem::setFocus(Qt::FocusReason focusReason) // Update the scene's focus item. if (d_ptr->scene) { QGraphicsItem *p = panel(); - if (!p || p->isActive()) { + if ((!p && d_ptr->scene->isActive()) || (p && p->isActive())) { // Visible items immediately gain focus from scene. d_ptr->scene->d_func()->setFocusItemHelper(f, focusReason); } @@ -2792,10 +2771,9 @@ void QGraphicsItem::setFocus(Qt::FocusReason focusReason) */ void QGraphicsItem::clearFocus() { - if (!d_ptr->scene) - return; // Invisible items with focus must explicitly clear subfocus. d_ptr->clearSubFocus(); + if (hasFocus()) { // If this item has the scene's input focus, clear it. d_ptr->scene->setFocusItem(0); @@ -2808,7 +2786,7 @@ void QGraphicsItem::clearFocus() Returns this item's focus proxy, or 0 if this item has no focus proxy. - \sa setFocusProxy(), ItemAutoDetectsFocusProxy, setFocus(), hasFocus() + \sa setFocusProxy(), setFocus(), hasFocus() */ QGraphicsItem *QGraphicsItem::focusProxy() const { @@ -2832,7 +2810,7 @@ QGraphicsItem *QGraphicsItem::focusProxy() const The focus proxy \a item must belong to the same scene as this item. - \sa focusProxy(), ItemAutoDetectsFocusProxy, setFocus(), hasFocus() + \sa focusProxy(), setFocus(), hasFocus() */ void QGraphicsItem::setFocusProxy(QGraphicsItem *item) { @@ -4876,13 +4854,21 @@ void QGraphicsItemPrivate::ensureSceneTransform() */ void QGraphicsItemPrivate::setSubFocus() { - // Update focus child chain. - QGraphicsItem *item = q_ptr; - QGraphicsItem *parent = item; - bool hidden = !visible; + // Update focus child chain. Stop at panels, or if this item + // is hidden, stop at the first item with a visible parent. + QGraphicsItem *parent = q_ptr; do { - parent->d_func()->subFocusItem = item; - } while (!parent->isPanel() && (parent = parent->d_ptr->parent) && (!hidden || !parent->d_func()->visible)); + // Clear any existing ancestor's subFocusItem. + if (parent != q_ptr && parent->d_ptr->subFocusItem) { + if (parent->d_ptr->subFocusItem == q_ptr) + break; + parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(); + } + parent->d_ptr->subFocusItem = q_ptr; + } while (!parent->isPanel() && (parent = parent->d_ptr->parent) && (visible || !parent->d_ptr->visible)); + + if (!parent && scene && !scene->isActive()) + scene->d_func()->lastFocusItem = q_ptr; } /*! @@ -4890,7 +4876,7 @@ void QGraphicsItemPrivate::setSubFocus() */ void QGraphicsItemPrivate::clearSubFocus() { - // Reset focus child chain. + // Reset sub focus chain. QGraphicsItem *parent = q_ptr; do { if (parent->d_ptr->subFocusItem != q_ptr) @@ -10568,9 +10554,6 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemNegativeZStacksBehindParent: str = "ItemNegativeZStacksBehindParent"; break; - case QGraphicsItem::ItemAutoDetectsFocusProxy: - str = "ItemAutoDetectsFocusProxy"; - break; case QGraphicsItem::ItemIsPanel: str = "ItemIsPanel"; break; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 1b65700..1c969ba 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -103,9 +103,8 @@ public: ItemHasNoContents = 0x400, ItemSendsGeometryChanges = 0x800, ItemAcceptsInputMethod = 0x1000, - ItemAutoDetectsFocusProxy = 0x2000, - ItemNegativeZStacksBehindParent = 0x4000, - ItemIsPanel = 0x8000 + ItemNegativeZStacksBehindParent = 0x2000, + ItemIsPanel = 0x4000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index ee4cfe0..0fd1647 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -653,19 +653,6 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, return; } - // Auto-update focus proxy. The closest parent that detects - // focus proxies is updated as the proxy gains or loses focus. - if (item) { - QGraphicsItem *p = item->d_ptr->parent; - while (p) { - if (p->d_ptr->flags & QGraphicsItem::ItemAutoDetectsFocusProxy) { - p->setFocusProxy(item); - break; - } - p = p->d_ptr->parent; - } - } - if (focusItem) { QFocusEvent event(QEvent::FocusOut, focusReason); lastFocusItem = focusItem; @@ -678,9 +665,14 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, QInputMethodEvent imEvent; sendEvent(lastFocusItem, &imEvent); - // Close any external input method panel - for (int i = 0; i < views.size(); ++i) - views.at(i)->inputContext()->reset(); + // Close any external input method panel. This happens + // automatically by removing WA_InputMethodEnabled on + // the views, but if we are changing focus, we have to + // do it ourselves. + if (item) { + for (int i = 0; i < views.size(); ++i) + views.at(i)->inputContext()->reset(); + } } } @@ -1398,6 +1390,7 @@ QGraphicsScene::QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObj QGraphicsScene::~QGraphicsScene() { Q_D(QGraphicsScene); + // Remove this scene from qApp's global scene list. qApp->d_func()->scene_list.removeAll(this); @@ -2438,7 +2431,7 @@ void QGraphicsScene::addItem(QGraphicsItem *item) // Ensure that newly added items that have subfocus set, gain // focus automatically if there isn't a focus item already. - if (!d->focusItem && item->focusItem()) + if (!d->focusItem && item->focusItem() && item->isActive()) item->focusItem()->setFocus(); d->updateInputMethodSensitivityInViews(); diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 908b8a1..adc2967 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -68,41 +68,42 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance) +static QString fallbackTheme() +{ + QString defaultTheme; +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_GNOME) + defaultTheme = QLatin1String("gnome"); + else if (X11->desktopEnvironment == DE_KDE) + defaultTheme = X11->desktopVersion >= 4 ? + QString::fromLatin1("oxygen") : + QString::fromLatin1("crystalsvg"); +#endif + return defaultTheme; +} + static QString systemThemeName() { - QString result; + QString result = fallbackTheme(); #ifdef Q_WS_X11 if (X11->desktopEnvironment == DE_GNOME) { -#if defined(QT_NO_STYLE_GTK) - result = QLatin1String("gnome"); -#else +#ifndef QT_NO_STYLE_GTK result = QGtk::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"), - QLatin1String("gnome")); + result); #endif } else if (X11->desktopEnvironment == DE_KDE) { - QString kdeDefault = X11->desktopVersion >= 4 ? - QString::fromLatin1("oxygen") : - QString::fromLatin1("crystalsvg"); - QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); settings.beginGroup(QLatin1String("Icons")); - result = settings.value(QLatin1String("Theme"), kdeDefault).toString(); + result = settings.value(QLatin1String("Theme"), result).toString(); } #endif return result; } -static QString fallbackTheme() -{ - QString defaultTheme = systemThemeName(); - if (defaultTheme.isEmpty()) - defaultTheme = QLatin1String("hicolor"); - return defaultTheme; -} QIconLoader::QIconLoader() : m_themeKey(1), m_supportsSvg(false) @@ -269,7 +270,7 @@ QIconTheme::QIconTheme(const QString &themeName) m_parents.append(fallbackTheme()); // Ensure that all themes fall back to hicolor - if (!m_parents.isEmpty()) + if (!m_parents.contains(QLatin1String("hicolor"))) m_parents.append(QLatin1String("hicolor")); } } diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 86c7a50..216cfff 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -337,7 +337,7 @@ public: static inline QT3_SUPPORT const QColor &winStyleHighlightColor() { return palette().color(QPalette::Active, QPalette::Highlight); } static inline QT3_SUPPORT void setPalette(const QPalette &pal, bool, const char* className = 0) - { setPalette(pal, className); }; + { setPalette(pal, className); } static inline QT3_SUPPORT void setFont(const QFont &font, bool, const char* className = 0) { setFont(font, className); } diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index c899313..697b93a 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -685,7 +685,7 @@ public: QClipboardEvent(QEventPrivate *data); ~QClipboardEvent(); - QEventPrivate *data() { return d; }; + QEventPrivate *data() { return d; } }; #endif diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index af2b640..d85023b 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -138,7 +138,7 @@ public: #endif TTypeUid::Ptr MopSupplyObject(TTypeUid id); - inline QWidget* widget() const { return qwidget; }; + inline QWidget* widget() const { return qwidget; } void setWidget(QWidget *w); void sendInputEvent(QWidget *widget, QInputEvent *inputEvent); void setIgnoreFocusChanged(bool enabled) { m_ignoreFocusChanged = enabled; } diff --git a/src/gui/painting/qprintengine_ps_p.h b/src/gui/painting/qprintengine_ps_p.h index 827e4d9..704617e 100644 --- a/src/gui/painting/qprintengine_ps_p.h +++ b/src/gui/painting/qprintengine_ps_p.h @@ -95,7 +95,7 @@ public: virtual QPrinter::PrinterState printerState() const; - virtual Qt::HANDLE handle() const { return 0; }; + virtual Qt::HANDLE handle() const { return 0; } private: Q_DISABLE_COPY(QPSPrintEngine) diff --git a/src/gui/painting/qwindowsurface_qws_p.h b/src/gui/painting/qwindowsurface_qws_p.h index 2c45120..6c65db3 100644 --- a/src/gui/painting/qwindowsurface_qws_p.h +++ b/src/gui/painting/qwindowsurface_qws_p.h @@ -173,7 +173,7 @@ public: QPaintDevice *paintDevice() { return &img; } bool scroll(const QRegion &area, int dx, int dy); - QImage image() const { return img; }; + QImage image() const { return img; } QPoint painterOffset() const; bool lock(int timeout = -1); diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index f450d94..0aed71a 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -334,7 +334,7 @@ QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, bool create) else high = pos; pos = (high + low) / 2; - }; + } pos = low; } if (!create) @@ -693,7 +693,7 @@ QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create) else low = pos; pos = (high + low) / 2; - }; + } if (!res) return families[pos]; } diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 7cae784..ab2506c 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -74,7 +74,7 @@ QByteArray QFontEngineS60Extensions::getSfntTable(uint tag) const Q_ASSERT(m_trueTypeExtension->HasTrueTypeTable(tag)); TInt error = KErrNone; TInt tableByteLength = 0; - TAny *table = m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength); + TAny *table = q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength)); QByteArray result(static_cast<const char*>(table), tableByteLength); m_trueTypeExtension->ReleaseTrueTypeTable(table); return result; diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index 4e367c9..8b85d2d 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -1328,6 +1328,8 @@ void QTextCursor::insertText(const QString &text, const QTextCharFormat &_format if (ch == QLatin1Char('\n') || ch == QChar::ParagraphSeparator + || ch == QTextBeginningOfFrame + || ch == QTextEndOfFrame || ch == QLatin1Char('\r')) { if (!hasEditBlock) { diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index c9b6c38..88837ca 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1594,11 +1594,13 @@ glyph_metrics_t QTextEngine::boundingBox(int from, int len) const for (int i = 0; i < layoutData->items.size(); i++) { const QScriptItem *si = layoutData->items.constData() + i; + QFontEngine *fe = fontEngine(*si); + int pos = si->position; int ilen = length(i); if (pos > from + len) break; - if (pos + len > from) { + if (pos + ilen > from) { if (!si->num_glyphs) shape(i); @@ -1631,7 +1633,6 @@ glyph_metrics_t QTextEngine::boundingBox(int from, int len) const charEnd++; glyphEnd = (charEnd == ilen) ? si->num_glyphs : logClusters[charEnd]; if (glyphStart <= glyphEnd ) { - QFontEngine *fe = fontEngine(*si); glyph_metrics_t m = fe->boundingBox(glyphs.mid(glyphStart, glyphEnd - glyphStart)); gm.x = qMin(gm.x, m.x + gm.xoff); gm.y = qMin(gm.y, m.y + gm.yoff); @@ -1641,6 +1642,10 @@ glyph_metrics_t QTextEngine::boundingBox(int from, int len) const gm.yoff += m.yoff; } } + + glyph_t glyph = glyphs.glyphs[logClusters[pos + ilen - 1]]; + glyph_metrics_t gi = fe->boundingBox(glyph); + gm.width -= qRound(gi.xoff - gi.x - gi.width); } } return gm; diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 4674a01..00ceb98 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the S60 port of the Qt toolkit. +** This file is part of the S60 port of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 720bd62..d5a7982 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -1094,6 +1094,8 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) if(e->button() != Qt::LeftButton) return; + d->mouseDown = true; + QAction *action = d->actionAt(e->pos()); if (!action || !d->isVisible(action)) { d->setCurrentAction(0); @@ -1104,8 +1106,6 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) return; } - d->mouseDown = true; - if(d->currentAction == action && d->popupState) { if(QMenu *menu = d->activeMenu) { d->activeMenu = 0; @@ -1252,10 +1252,11 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) void QMenuBar::mouseMoveEvent(QMouseEvent *e) { Q_D(QMenuBar); - d->mouseDown = e->buttons() & Qt::LeftButton; + bool popupState = d->popupState || e->buttons() & Qt::LeftButton; + if (!d->mouseDown || !popupState) + return; QAction *action = d->actionAt(e->pos()); - bool popupState = d->popupState || d->mouseDown; - if ((action && d->isVisible(action)) || !popupState) + if (action && d->isVisible(action)) d->setCurrentAction(action, popupState); } diff --git a/src/gui/widgets/qslider.h b/src/gui/widgets/qslider.h index 289c5b7..7b27582 100644 --- a/src/gui/widgets/qslider.h +++ b/src/gui/widgets/qslider.h @@ -114,8 +114,8 @@ public: inline QT3_SUPPORT void setTickmarks(TickPosition position) { setTickPosition(position); } inline QT3_SUPPORT TickPosition tickmarks() const { return tickPosition(); } public Q_SLOTS: - inline QT_MOC_COMPAT void addStep() { triggerAction(SliderSingleStepAdd); }; - inline QT_MOC_COMPAT void subtractStep() { triggerAction(SliderSingleStepSub); }; + inline QT_MOC_COMPAT void addStep() { triggerAction(SliderSingleStepAdd); } + inline QT_MOC_COMPAT void subtractStep() { triggerAction(SliderSingleStepSub); } #endif private: diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index cd5c131..de11625 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -776,7 +776,8 @@ void QToolBarAreaLayout::deleteAllLayoutItems() for (int k = 0; k < line.toolBarItems.count(); ++k) { QToolBarAreaLayoutItem &item = line.toolBarItems[k]; - delete item.widgetItem; + if (!item.gap) + delete item.widgetItem; item.widgetItem = 0; } } diff --git a/src/gui/widgets/qvalidator.cpp b/src/gui/widgets/qvalidator.cpp index 416c0cd..405bf04 100644 --- a/src/gui/widgets/qvalidator.cpp +++ b/src/gui/widgets/qvalidator.cpp @@ -636,7 +636,7 @@ QValidator::State QDoubleValidator::validate(QString & input, int &) const case ScientificNotation: numMode = QLocalePrivate::DoubleScientificMode; break; - }; + } QByteArray buff; if (!locale().d()->validateChars(input, numMode, &buff, dec)) { diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 4a62c32..315a59b 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -73,6 +73,7 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFor audioSource = 0; pullMode = true; resuming = false; + finished = false; connect(this,SIGNAL(processMore()),SLOT(deviceReady())); @@ -81,7 +82,7 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFor QAudioInputPrivate::~QAudioInputPrivate() { - close(); + stop(); DeleteCriticalSection(&waveInCriticalSection); } @@ -104,10 +105,13 @@ void CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg, EnterCriticalSection(&waveInCriticalSection); if(qAudio->waveFreeBlockCount > 0) qAudio->waveFreeBlockCount--; - LeaveCriticalSection(&waveInCriticalSection); qAudio->feedback(); + LeaveCriticalSection(&waveInCriticalSection); break; case WIM_CLOSE: + EnterCriticalSection(&waveInCriticalSection); + qAudio->finished = true; + LeaveCriticalSection(&waveInCriticalSection); break; default: return; @@ -198,8 +202,6 @@ void QAudioInputPrivate::stop() if(deviceState == QAudio::StopState) return; - deviceState = QAudio::StopState; - close(); emit stateChanged(deviceState); } @@ -218,6 +220,11 @@ bool QAudioInputPrivate::open() } else { period_size = buffer_size/5; } +#ifdef Q_OS_WINCE + // For wince reduce size to 40ms for buffer size and 20ms period + buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.04; + period_size = buffer_size/2; +#endif timeStamp.restart(); wfx.nSamplesPerSec = settings.frequency(); wfx.wBitsPerSample = settings.sampleSize(); @@ -256,7 +263,19 @@ bool QAudioInputPrivate::open() return false; } waveBlocks = allocateBlocks(period_size, buffer_size/period_size); + + if(waveBlocks == 0) { + errorState = QAudio::OpenError; + deviceState = QAudio::StopState; + emit stateChanged(deviceState); + qWarning("QAudioInput: failed to allocate blocks. open failed"); + return false; + } + + EnterCriticalSection(&waveInCriticalSection); waveFreeBlockCount = buffer_size/period_size; + LeaveCriticalSection(&waveInCriticalSection); + waveCurrentBlock = 0; for(int i=0; i<buffer_size/period_size; i++) { @@ -286,18 +305,26 @@ bool QAudioInputPrivate::open() void QAudioInputPrivate::close() { - deviceState = QAudio::StopState; - int delay = (buffer_size-bytesReady())*1000/(settings.frequency() - *settings.channels()*(settings.sampleSize()/8)); + if(deviceState == QAudio::StopState) + return; + waveInReset(hWaveIn); - Sleep(delay+10); + waveInClose(hWaveIn); + deviceState = QAudio::StopState; + + int count = 0; + while(!finished && count < 100) { + count++; + Sleep(10); + } + EnterCriticalSection(&waveInCriticalSection); for(int i=0; i<waveFreeBlockCount; i++) { if(waveBlocks[i].dwFlags & WHDR_PREPARED) waveInUnprepareHeader(hWaveIn,&waveBlocks[i],sizeof(WAVEHDR)); } + LeaveCriticalSection(&waveInCriticalSection); freeBlocks(waveBlocks); - waveInClose(hWaveIn); } int QAudioInputPrivate::bytesReady() const @@ -384,6 +411,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) header = 0; p+=l; + EnterCriticalSection(&waveInCriticalSection); if(!pullMode) { if(l+period_size > len && waveFreeBlockCount == buffer_size/period_size) done = true; @@ -391,6 +419,8 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) if(waveFreeBlockCount == buffer_size/period_size) done = true; } + LeaveCriticalSection(&waveInCriticalSection); + written+=l; } #ifdef DEBUG_AUDIO @@ -413,7 +443,10 @@ void QAudioInputPrivate::resume() return; } } + EnterCriticalSection(&waveInCriticalSection); waveFreeBlockCount = buffer_size/period_size; + LeaveCriticalSection(&waveInCriticalSection); + waveCurrentBlock = 0; header = 0; resuming = true; @@ -466,7 +499,7 @@ void QAudioInputPrivate::feedback() { #ifdef DEBUG_AUDIO QTime now(QTime::currentTime()); - qDebug()<<now.second()<<"s "<<now.msec()<<"ms :feedback() INPUT"; + qDebug()<<now.second()<<"s "<<now.msec()<<"ms :feedback() INPUT "<<this; #endif bytesAvailable = bytesReady(); diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h index da0df24..3363b6a 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.h +++ b/src/multimedia/audio/qaudioinput_win32_p.h @@ -117,6 +117,7 @@ private: HWAVEIN hWaveIn; MMRESULT result; WAVEHDR* waveBlocks; + volatile bool finished; volatile int waveFreeBlockCount; int waveCurrentBlock; diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index de4981d..fae680c 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -72,11 +72,16 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioF deviceState = QAudio::StopState; audioSource = 0; pullMode = true; + finished = false; InitializeCriticalSection(&waveOutCriticalSection); } QAudioOutputPrivate::~QAudioOutputPrivate() { + EnterCriticalSection(&waveOutCriticalSection); + finished = true; + LeaveCriticalSection(&waveOutCriticalSection); + close(); DeleteCriticalSection(&waveOutCriticalSection); } @@ -101,11 +106,15 @@ void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, return; case WOM_DONE: EnterCriticalSection(&waveOutCriticalSection); + if(qAudio->finished || qAudio->buffer_size == 0 || qAudio->period_size == 0) { + LeaveCriticalSection(&waveOutCriticalSection); + return; + } qAudio->waveFreeBlockCount++; if(qAudio->waveFreeBlockCount >= qAudio->buffer_size/qAudio->period_size) qAudio->waveFreeBlockCount = qAudio->buffer_size/qAudio->period_size; - LeaveCriticalSection(&waveOutCriticalSection); qAudio->feedback(); + LeaveCriticalSection(&waveOutCriticalSection); break; default: return; @@ -201,7 +210,11 @@ bool QAudioOutputPrivate::open() period_size = buffer_size/5; } waveBlocks = allocateBlocks(period_size, buffer_size/period_size); + + EnterCriticalSection(&waveOutCriticalSection); waveFreeBlockCount = buffer_size/period_size; + LeaveCriticalSection(&waveOutCriticalSection); + waveCurrentBlock = 0; if(audioBuffer == 0) @@ -281,6 +294,7 @@ int QAudioOutputPrivate::bytesFree() const { int buf; buf = waveFreeBlockCount*period_size; + return buf; } @@ -326,8 +340,12 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) int remain; current = &waveBlocks[waveCurrentBlock]; while(l > 0) { - if(waveFreeBlockCount==0) + EnterCriticalSection(&waveOutCriticalSection); + if(waveFreeBlockCount==0) { + LeaveCriticalSection(&waveOutCriticalSection); break; + } + LeaveCriticalSection(&waveOutCriticalSection); if(current->dwFlags & WHDR_PREPARED) waveOutUnprepareHeader(hWaveOut, current, sizeof(WAVEHDR)); @@ -348,8 +366,10 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) waveFreeBlockCount--; LeaveCriticalSection(&waveOutCriticalSection); #ifdef DEBUG_AUDIO + EnterCriticalSection(&waveOutCriticalSection); qDebug("write out l=%d, waveFreeBlockCount=%d", current->dwBufferLength,waveFreeBlockCount); + LeaveCriticalSection(&waveOutCriticalSection); #endif totalTimeValue += current->dwBufferLength /(settings.channels()*(settings.sampleSize()/8)) @@ -422,11 +442,14 @@ bool QAudioOutputPrivate::deviceReady() waveOutRestart(hWaveOut); } else if(l == 0) { bytesAvailable = bytesFree(); + + EnterCriticalSection(&waveOutCriticalSection); if(waveFreeBlockCount == buffer_size/period_size) { errorState = QAudio::UnderrunError; deviceState = QAudio::IdleState; emit stateChanged(deviceState); } + LeaveCriticalSection(&waveOutCriticalSection); } else if(i < 0) { bytesAvailable = bytesFree(); diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h index 16c71dd..68f418e 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.h +++ b/src/multimedia/audio/qaudiooutput_win32_p.h @@ -132,6 +132,7 @@ private: MMRESULT result; WAVEHDR header; WAVEHDR* waveBlocks; + volatile bool finished; volatile int waveFreeBlockCount; int waveCurrentBlock; char* audioBuffer; diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 5fdaa4c..a5179cc 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -157,7 +157,7 @@ public: // return true if the QNonContiguousByteDevice of the upload // data needs to support reset(). Currently needed for HTTP. // This will possibly enable buffering of the upload data. - virtual bool needsResetableUploadData() {return false;}; + virtual bool needsResetableUploadData() { return false; } protected: // Create the device used for reading the upload data diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h index d01cc5a..55aadac 100644 --- a/src/network/access/qnetworkaccesshttpbackend_p.h +++ b/src/network/access/qnetworkaccesshttpbackend_p.h @@ -95,7 +95,7 @@ public: qint64 deviceReadData(char *buffer, qint64 maxlen); // we return true since HTTP needs to send PUT/POST data again after having authenticated - bool needsResetableUploadData() {return true;}; + bool needsResetableUploadData() { return true; } private slots: void replyReadyRead(); diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 2d5ebcf..821d7c6 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -395,7 +395,11 @@ QMultiMap<QSsl::AlternateNameEntryType, QString> QSslCertificate::alternateSubje else if (genName->type == GEN_EMAIL) result.insert(QSsl::EmailEntry, altName); } +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + q_sk_pop_free((STACK*)altNames, reinterpret_cast<void(*)(void*)>(q_sk_free)); +#else q_sk_pop_free((STACK*)altNames, q_sk_free); +#endif } return result; diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 641f921..0762752 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -143,12 +143,14 @@ DEFINEFUNC2(int, PEM_write_bio_RSA_PUBKEY, BIO *a, a, RSA *b, b, return 0, retur DEFINEFUNC2(void, RAND_seed, const void *a, a, int b, b, return, DUMMYARG) DEFINEFUNC(int, RAND_status, void, DUMMYARG, return -1, return) DEFINEFUNC(void, RSA_free, RSA *a, a, return, DUMMYARG) -DEFINEFUNC(void, sk_free, STACK *a, a, return, DUMMYARG) DEFINEFUNC(int, sk_num, STACK *a, a, return -1, return) -DEFINEFUNC2(void, sk_pop_free, STACK *a, a, void (*b)(STACK*), b, return, DUMMYARG) #if OPENSSL_VERSION_NUMBER >= 0x10000000L +DEFINEFUNC(void, sk_free, _STACK *a, a, return, DUMMYARG) +DEFINEFUNC2(void, sk_pop_free, STACK *a, a, void (*b)(void*), b, return, DUMMYARG) DEFINEFUNC2(void *, sk_value, STACK *a, a, int b, b, return 0, return) #else +DEFINEFUNC(void, sk_free, STACK *a, a, return, DUMMYARG) +DEFINEFUNC2(void, sk_pop_free, STACK *a, a, void (*b)(STACK*), b, return, DUMMYARG) DEFINEFUNC2(char *, sk_value, STACK *a, a, int b, b, return 0, return) #endif DEFINEFUNC(int, SSL_accept, SSL *a, a, return -1, return) @@ -489,6 +491,7 @@ bool q_resolveOpenSslSymbols() #ifdef SSLEAY_MACROS RESOLVEFUNC(ASN1_dup, 125, libs.second ) #endif + RESOLVEFUNC(ASN1_INTEGER_get, 48, libs.second ) RESOLVEFUNC(ASN1_STRING_data, 71, libs.second ) RESOLVEFUNC(ASN1_STRING_length, 76, libs.second ) RESOLVEFUNC(BIO_ctrl, 184, libs.second ) @@ -532,6 +535,7 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(RSA_free, 1450, libs.second ) RESOLVEFUNC(sk_free, 2571, libs.second ) RESOLVEFUNC(sk_num, 2576, libs.second ) + RESOLVEFUNC(sk_pop_free, 2578, libs.second ) RESOLVEFUNC(sk_value, 2585, libs.second ) RESOLVEFUNC(SSL_CIPHER_description, 11, libs.first ) RESOLVEFUNC(SSL_CTX_check_private_key, 21, libs.first ) diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index b739a42..8d71caa 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -255,12 +255,14 @@ int q_PEM_write_bio_RSA_PUBKEY(BIO *a, RSA *b); void q_RAND_seed(const void *a, int b); int q_RAND_status(); void q_RSA_free(RSA *a); -void q_sk_free(STACK *a); int q_sk_num(STACK *a); -void q_sk_pop_free(STACK *a, void (*b)(STACK *)); #if OPENSSL_VERSION_NUMBER >= 0x10000000L +void q_sk_free(_STACK *a); +void q_sk_pop_free(STACK *a, void (*b)(void *)); void * q_sk_value(STACK *a, int b); #else +void q_sk_free(STACK *a); +void q_sk_pop_free(STACK *a, void (*b)(STACK *)); char * q_sk_value(STACK *a, int b); #endif int q_SSL_accept(SSL *a); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 78d184f..c87941b 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -423,8 +423,9 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() const QPixmap& texPixmap = currentBrush->texture(); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); + QGLTexture *tex = ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); + textureInvertedY = tex->options & QGLContext::InvertedYBindOption ? -1 : 1; } brushTextureDirty = false; } @@ -517,7 +518,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); } - QSizeF invertedTextureSize( 1.0 / texPixmap.width(), 1.0 / texPixmap.height() ); + QSizeF invertedTextureSize(1.0 / texPixmap.width(), 1.0 * textureInvertedY / texPixmap.height()); shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::InvertedTextureSize), invertedTextureSize); QVector2D halfViewportSize(width*0.5, height*0.5); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index da16e47..34f4eb8 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -262,6 +262,8 @@ public: bool needsSync; bool inRenderText; + + float textureInvertedY; }; QT_END_NAMESPACE diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index d479c2e..da30e3d 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -13,9 +13,17 @@ include(../qbase.pri) !win32:!embedded:!mac:CONFIG += x11 contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengles1):CONFIG += opengles1 -contains(QT_CONFIG, opengles1):CONFIG += opengles1cl +contains(QT_CONFIG, opengles1cl):CONFIG += opengles1cl contains(QT_CONFIG, opengles2):CONFIG += opengles2 +contains(QT_CONFIG, opengles.*) { + for(p, QMAKE_LIBDIR_EGL) { + exists($$p):LIBS_PRIVATE += -L$$p + } + !isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL + !isEmpty(QMAKE_LIBS_EGL): LIBS_PRIVATE += $$QMAKE_LIBS_EGL +} + HEADERS += qgl.h \ qgl_p.h \ qglcolormap.h \ diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 799c749..65d6f99 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1910,8 +1910,8 @@ static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum textu int sbpl = img.bytesPerLine(); int dbpl = dst.bytesPerLine(); - int ix = 0x00010000 / sx; - int iy = 0x00010000 / sy; + int ix = int(0x00010000 / sx); + int iy = int(0x00010000 / sy); quint32 basex = int(0.5 * ix); quint32 srcy = int(0.5 * iy); @@ -2217,6 +2217,9 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, return data->texture(); } } +#else + Q_UNUSED(pd); + Q_UNUSED(q); #endif const qint64 key = pixmap.cacheKey(); @@ -4913,8 +4916,13 @@ QGLContextResource::QGLContextResource(FreeFunc f, QObject *parent) QGLContextResource::~QGLContextResource() { - while (!m_resources.empty()) - removeGroup(m_resources.begin().key()); +#ifndef QT_NO_DEBUG + if (m_resources.size()) { + qWarning("QtOpenGL: Resources are still available at program shutdown.\n" + " This is possibly caused by a leaked QGLWidget, \n" + " QGLFrameBufferObject or QGLPixelBuffer."); + } +#endif } void QGLContextResource::insert(const QGLContext *key, void *value) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 094f675..f15aa01 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -299,10 +299,21 @@ bool QGLFramebufferObjectFormat::operator!=(const QGLFramebufferObjectFormat& ot return !(*this == other); } -void QGLFBOGLPaintDevice::setFBO(QGLFramebufferObject* f) +void QGLFBOGLPaintDevice::setFBO(QGLFramebufferObject* f, + QGLFramebufferObject::Attachment attachment) { fbo = f; m_thisFBO = fbo->d_func()->fbo; // This shouldn't be needed + + // The context that the fbo was created in may not have depth + // and stencil buffers, but the fbo itself might. + fboFormat = QGLContext::currentContext()->format(); + if (attachment == QGLFramebufferObject::CombinedDepthStencil) { + fboFormat.setDepth(true); + fboFormat.setStencil(true); + } else if (attachment == QGLFramebufferObject::Depth) { + fboFormat.setDepth(true); + } } void QGLFBOGLPaintDevice::ensureActiveTarget() @@ -395,7 +406,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER_EXT, fbo); - glDevice.setFBO(q); + glDevice.setFBO(q, attachment); QT_CHECK_GLERROR(); // init texture diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index c11c496..f80209d 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -110,15 +110,18 @@ public: virtual QPaintEngine* paintEngine() const {return fbo->paintEngine();} virtual QSize size() const {return fbo->size();} virtual QGLContext* context() const {return const_cast<QGLContext *>(QGLContext::currentContext());} + virtual QGLFormat format() const {return fboFormat;} virtual void ensureActiveTarget(); virtual void beginPaint(); virtual void endPaint(); - void setFBO(QGLFramebufferObject* f); + void setFBO(QGLFramebufferObject* f, + QGLFramebufferObject::Attachment attachment); private: bool wasBound; QGLFramebufferObject* fbo; + QGLFormat fboFormat; }; class QGLFramebufferObjectPrivate diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp index c0f1813..e68a4b9 100644 --- a/src/opengl/qglpaintdevice.cpp +++ b/src/opengl/qglpaintdevice.cpp @@ -44,7 +44,14 @@ #include <private/qglpixelbuffer_p.h> #include <private/qglframebufferobject_p.h> #include <private/qwindowsurface_gl_p.h> + +#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) #include <private/qpixmapdata_gl_p.h> +#endif + +#if defined(QT_OPENGL_ES_1_CL) +#include "qgl_cl_p.h" +#endif QT_BEGIN_NAMESPACE @@ -67,6 +74,12 @@ void QGLPaintDevice::beginPaint() // Record the currently bound FBO so we can restore it again // in endPaint() and bind this device's FBO + // + // Note: m_thisFBO could be zero if the paint device is not + // backed by an FBO (e.g. window back buffer). But there could + // be a previous FBO bound to the context which we need to + // explicitly unbind. Otherwise the painting will go into + // the previous FBO instead of to the window. m_previousFBO = ctx->d_func()->current_fbo; if (m_previousFBO != m_thisFBO) { ctx->d_ptr->current_fbo = m_thisFBO; @@ -171,9 +184,13 @@ QGLPaintDevice* QGLPaintDevice::getDevice(QPaintDevice* pd) glpd = &(static_cast<QGLFramebufferObject*>(pd)->d_func()->glDevice); break; case QInternal::Pixmap: { +#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) QPixmapData* pmd = static_cast<QPixmap*>(pd)->pixmapData(); Q_ASSERT(pmd->classId() == QPixmapData::OpenGLClass); glpd = static_cast<QGLPixmapData*>(pmd)->glDevice(); +#else + qWarning("Pixmap render targets not supported on OpenGL ES 1.x"); +#endif break; } default: diff --git a/src/opengl/qglpaintdevice_p.h b/src/opengl/qglpaintdevice_p.h index 66b24a9..1e7ba8d 100644 --- a/src/opengl/qglpaintdevice_p.h +++ b/src/opengl/qglpaintdevice_p.h @@ -73,7 +73,7 @@ public: virtual void endPaint(); virtual QGLContext* context() const = 0; - QGLFormat format() const; + virtual QGLFormat format() const; virtual QSize size() const = 0; // returns the QGLPaintDevice for the given QPaintDevice diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index f1169fd..ff00f29 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -2116,7 +2116,7 @@ void QOpenGLPaintEngine::updatePen(const QPen &pen) Qt::PenStyle pen_style = pen.style(); d->pen_brush_style = pen.brush().style(); d->cpen = pen; - d->has_pen = (pen_style != Qt::NoPen); + d->has_pen = (pen_style != Qt::NoPen) && (d->pen_brush_style != Qt::NoBrush); d->updateUseEmulation(); if (pen.isCosmetic()) { @@ -4300,8 +4300,10 @@ void QOpenGLPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QR else { GLenum target = qt_gl_preferredTextureTarget(); d->flushDrawQueue(); - d->device->context()->bindTexture(pm, target); - drawTextureRect(pm.width(), pm.height(), r, sr, target); + QGLTexture *tex = + d->device->context()->d_func()->bindTexture(pm, target, GL_RGBA, + QGLContext::InternalBindOption); + drawTextureRect(pm.width(), pm.height(), r, sr, target, tex); } } @@ -4333,10 +4335,13 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con } else { d->flushDrawQueue(); + QGLTexture *tex; if (scaled.isNull()) - d->device->context()->bindTexture(pm); + tex = d->device->context()->d_func()->bindTexture(pm, GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption); else - d->device->context()->bindTexture(scaled); + tex = d->device->context()->d_func()->bindTexture(scaled, GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, d->use_smooth_pixmap_transform); #ifndef QT_OPENGL_ES @@ -4349,6 +4354,15 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con GLdouble tc_w = r.width()/pm.width(); GLdouble tc_h = r.height()/pm.height(); + // Rotate the texture so that it is aligned correctly and the + // wrapping is done correctly + if (tex->options & QGLContext::InvertedYBindOption) { + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glRotatef(180.0, 0.0, 1.0, 0.0); + glRotatef(180.0, 0.0, 0.0, 1.0); + } + q_vertexType vertexArray[4*2]; q_vertexType texCoordArray[4*2]; @@ -4367,6 +4381,8 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); + if (tex->options & QGLContext::InvertedYBindOption) + glPopMatrix(); glDisable(GL_TEXTURE_2D); #ifndef QT_OPENGL_ES @@ -4402,13 +4418,15 @@ void QOpenGLPaintEngine::drawImage(const QRectF &r, const QImage &image, const Q else { GLenum target = qt_gl_preferredTextureTarget(); d->flushDrawQueue(); - d->device->context()->bindTexture(image, target); - drawTextureRect(image.width(), image.height(), r, sr, target); + QGLTexture *tex = + d->device->context()->d_func()->bindTexture(image, target, GL_RGBA, + QGLContext::InternalBindOption); + drawTextureRect(image.width(), image.height(), r, sr, target, tex); } } void QOpenGLPaintEngine::drawTextureRect(int tx_width, int tx_height, const QRectF &r, - const QRectF &sr, GLenum target) + const QRectF &sr, GLenum target, QGLTexture *tex) { Q_D(QOpenGLPaintEngine); #ifndef QT_OPENGL_ES @@ -4423,8 +4441,13 @@ void QOpenGLPaintEngine::drawTextureRect(int tx_width, int tx_height, const QRec if (target == GL_TEXTURE_2D) { x1 = sr.x() / tx_width; x2 = x1 + sr.width() / tx_width; - y1 = 1 - (sr.bottom() / tx_height); - y2 = 1 - (sr.y() / tx_height); + if (tex->options & QGLContext::InvertedYBindOption) { + y1 = 1 - (sr.bottom() / tx_height); + y2 = 1 - (sr.y() / tx_height); + } else { + y1 = sr.bottom() / tx_height; + y2 = sr.y() / tx_height; + } } else { x1 = sr.x(); x2 = sr.right(); @@ -4767,7 +4790,24 @@ void QGLGlyphCache::cacheGlyphs(QGLContext *context, const QTextItemInt &ti, } } - QImage glyph_im(ti.fontEngine->alphaMapForGlyph(glyphs[i]).convertToFormat(QImage::Format_Indexed8)); + QImage glyph_im(ti.fontEngine->alphaMapForGlyph(glyphs[i])); + + // The QPF implementation of alphaMapForGlyph() uses the color + // RGBA = (value, value, value, 255) instead of the color + // RGBA = (0, 0, 0, value) that the other font engines use. + // We modify the image colors to rectify this situation. + QFontEngine::Type type = ti.fontEngine->type(); + if (type == QFontEngine::QPF1 || type == QFontEngine::QPF2) { + if (glyph_im.format() == QImage::Format_Indexed8) { + for (int i = 0; i < 256; ++i) + glyph_im.setColor(i, qRgba(0, 0, 0, i)); + } else if (glyph_im.format() == QImage::Format_Mono) { + glyph_im.setColor(0, qRgba(0, 0, 0, 0)); + glyph_im.setColor(1, qRgba(0, 0, 0, 255)); + } + } + + glyph_im = glyph_im.convertToFormat(QImage::Format_Indexed8); glyph_width = glyph_im.width(); Q_ASSERT(glyph_width >= 0); // pad the glyph width to an even number @@ -5179,9 +5219,12 @@ void QOpenGLPaintEnginePrivate::composite(GLuint primitive, const q_vertexType * glActiveTexture(GL_TEXTURE0 + brush_texture_location); if (current_style == Qt::TexturePattern) - device->context()->bindTexture(cbrush.textureImage()); + device->context()->d_func()->bindTexture(cbrush.textureImage(), GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption); else - device->context()->bindTexture(qt_imageForBrush(current_style, true)); + device->context()->d_func()->bindTexture(qt_imageForBrush(current_style, true), + GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, use_smooth_pixmap_transform); } @@ -5588,8 +5631,11 @@ QPixmapFilter *QOpenGLPaintEngine::createPixmapFilter(int type) const if (QGLContext::currentContext()) return QGLContext::currentContext()->d_func()->createPixmapFilter(type); else -#endif return 0; +#else + Q_UNUSED(type); + return 0; +#endif } diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h index 1cac3ad..c8f460a 100644 --- a/src/opengl/qpaintengine_opengl_p.h +++ b/src/opengl/qpaintengine_opengl_p.h @@ -58,6 +58,7 @@ QT_BEGIN_NAMESPACE class QOpenGLPaintEnginePrivate; +class QGLTexture; class QOpenGLPaintEngineState : public QPainterState { @@ -146,7 +147,8 @@ public: private: void drawPolyInternal(const QPolygonF &pa, bool close = true); - void drawTextureRect(int tx_width, int tx_height, const QRectF &r, const QRectF &sr, GLenum target); + void drawTextureRect(int tx_width, int tx_height, const QRectF &r, const QRectF &sr, + GLenum target, QGLTexture *tex); Q_DISABLE_COPY(QOpenGLPaintEngine) }; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp index 0ad4071..8662df6 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp @@ -207,6 +207,7 @@ void QDirectFBMouseHandlerPrivate::readMouseData() int wheel = 0; if (input.type == DIET_AXISMOTION) { +#ifdef QT_NO_DIRECTFB_LAYER if (input.flags & DIEF_AXISABS) { switch (input.axis) { case DIAI_X: x = input.axisabs; break; @@ -226,6 +227,19 @@ void QDirectFBMouseHandlerPrivate::readMouseData() "unknown axis (releative) %d", input.axis); } } +#else + if (input.axis == DIAI_X || input.axis == DIAI_Y) { + DFBResult result = layer->GetCursorPosition(layer, &x, &y); + if (result != DFB_OK) { + DirectFBError("QDirectFBMouseHandler::readMouseData", + result); + } + } else if (input.axis == DIAI_Z) { + Q_ASSERT(input.flags & DIEF_AXISREL); + wheel = input.axisrel; + wheel *= -120; + } +#endif } Qt::MouseButtons buttons = Qt::NoButton; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index c2ae2fb..4413858 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -591,12 +591,15 @@ bool QDirectFBScreenCursor::createWindow() Q_ASSERT(!cursor.isNull()); DFBWindowDescription description; memset(&description, 0, sizeof(DFBWindowDescription)); - description.flags = DWDESC_POSX|DWDESC_POSY|DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_CAPS|DWDESC_OPTIONS|DWDESC_PIXELFORMAT|DWDESC_SURFACE_CAPS; + description.flags = DWDESC_POSX|DWDESC_POSY|DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_CAPS|DWDESC_PIXELFORMAT|DWDESC_SURFACE_CAPS; description.width = cursor.width(); description.height = cursor.height(); description.posx = pos.x() - hotspot.x(); description.posy = pos.y() - hotspot.y(); +#if (Q_DIRECTFB_VERSION >= 0x010100) + description.flags |= DWDESC_OPTIONS; description.options = DWOP_GHOST|DWOP_ALPHACHANNEL; +#endif description.caps = DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER; const QImage::Format format = QDirectFBScreen::instance()->alphaPixmapFormat(); description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format); @@ -1202,7 +1205,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec) "Unable to get screen!", result); return false; } - const QString qws_size = qgetenv("QWS_SIZE"); + const QString qws_size = QString::fromLatin1(qgetenv("QWS_SIZE")); if (!qws_size.isEmpty()) { QRegExp rx(QLatin1String("(\\d+)x(\\d+)")); if (!rx.exactMatch(qws_size)) { diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index eec70e1..79a01d3 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -110,7 +110,7 @@ QT_MODULE(Gui) #error QT_DIRECTFB_WINDOW_AS_CURSOR requires QT_DIRECTFB_WM to be defined #endif -#define Q_DIRECTFB_VERSION ((DIRECTFB_MAJOR_VERSION << 16) | (DIRECTFB_MINOR_VERION << 8) | DIRECTFB_MICRO_VERSION) +#define Q_DIRECTFB_VERSION ((DIRECTFB_MAJOR_VERSION << 16) | (DIRECTFB_MINOR_VERSION << 8) | DIRECTFB_MICRO_VERSION) #define DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(F) \ static inline F operator~(F f) { return F(~int(f)); } \ diff --git a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp index 1cbc1d7..a86a3a4 100644 --- a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp +++ b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp @@ -74,7 +74,7 @@ public: + QString::number((((((size.width()<<11)|size.height())<<11)|mode)<<4)|state, 16); } void stepSerialNum() - { serialNum = lastSerialNum.fetchAndAddRelaxed(1); }; + { serialNum = lastSerialNum.fetchAndAddRelaxed(1); } void loadDataForModeAndState(QSvgRenderer *renderer, QIcon::Mode mode, QIcon::State state); diff --git a/src/script/script.pro b/src/script/script.pro index a03b652..1a793b2 100644 --- a/src/script/script.pro +++ b/src/script/script.pro @@ -24,7 +24,17 @@ isEmpty(WEBKITDIR) { # FIXME: not needed once JSCBISON works # TODO: or leave it like this since the generated file is available anyway? SOURCES += $$WEBKITDIR/JavaScriptCore/generated/Grammar.cpp + + # avoid warnings when parsing JavaScriptCore.pri + # (we don't care about generating files, we already have them generated) + defineTest(addExtraCompiler) { + return(true) + } + defineTest(addExtraCompilerWithHeader) { + return(true) + } } else { + message(using external WebKit from $$WEBKITDIR) CONFIG += building-libs CONFIG -= QTDIR_build include($$WEBKITDIR/WebKit.pri) @@ -38,15 +48,6 @@ wince* { LIBS += -lmmtimer } -# avoid warnings when parsing JavaScriptCore.pri -# (we don't care about generating files, we already have them generated) -defineTest(addExtraCompiler) { - return(true) -} -defineTest(addExtraCompilerWithHeader) { - return(true) -} - include($$WEBKITDIR/JavaScriptCore/JavaScriptCore.pri) INCLUDEPATH += $$WEBKITDIR/JavaScriptCore diff --git a/src/svg/qgraphicssvgitem.cpp b/src/svg/qgraphicssvgitem.cpp index 7176f37..ea26c78 100644 --- a/src/svg/qgraphicssvgitem.cpp +++ b/src/svg/qgraphicssvgitem.cpp @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE -class QGraphicsSvgItemPrivate : public QObjectPrivate +class QGraphicsSvgItemPrivate : public QGraphicsItemPrivate { public: Q_DECLARE_PUBLIC(QGraphicsSvgItem) @@ -62,9 +62,10 @@ public: { } - void init() + void init(QGraphicsItem *parent) { Q_Q(QGraphicsSvgItem); + q->setParentItem(parent); renderer = new QSvgRenderer(q); QObject::connect(renderer, SIGNAL(repaintNeeded()), q, SLOT(_q_repaintItem())); @@ -137,10 +138,10 @@ public: Constructs a new SVG item with the given \a parent. */ QGraphicsSvgItem::QGraphicsSvgItem(QGraphicsItem *parent) - : QObject(*new QGraphicsSvgItemPrivate(), 0), QGraphicsItem(parent) + : QGraphicsObject(*new QGraphicsSvgItemPrivate(), 0, 0) { Q_D(QGraphicsSvgItem); - d->init(); + d->init(parent); } /*! @@ -148,10 +149,10 @@ QGraphicsSvgItem::QGraphicsSvgItem(QGraphicsItem *parent) SVG file with the specified \a fileName. */ QGraphicsSvgItem::QGraphicsSvgItem(const QString &fileName, QGraphicsItem *parent) - : QObject(*new QGraphicsSvgItemPrivate(), 0), QGraphicsItem(parent) + : QGraphicsObject(*new QGraphicsSvgItemPrivate(), 0, 0) { Q_D(QGraphicsSvgItem); - d->init(); + d->init(parent); d->renderer->load(fileName); d->updateDefaultSize(); } diff --git a/src/svg/qgraphicssvgitem.h b/src/svg/qgraphicssvgitem.h index 2d0e20b..e304c0c 100644 --- a/src/svg/qgraphicssvgitem.h +++ b/src/svg/qgraphicssvgitem.h @@ -41,7 +41,6 @@ #ifndef QGRAPHICSSVGITEM_H #define QGRAPHICSSVGITEM_H -#include <QtCore/qobject.h> #include <QtGui/qgraphicsitem.h> #ifndef QT_NO_GRAPHICSSVGITEM @@ -55,10 +54,12 @@ QT_MODULE(Svg) class QSvgRenderer; class QGraphicsSvgItemPrivate; -class Q_SVG_EXPORT QGraphicsSvgItem : public QObject, public QGraphicsItem +class Q_SVG_EXPORT QGraphicsSvgItem : public QGraphicsObject { Q_OBJECT Q_INTERFACES(QGraphicsItem) + Q_PROPERTY(QString elementId READ elementId WRITE setElementId) + Q_PROPERTY(QSize maximumCacheSize READ maximumCacheSize WRITE setMaximumCacheSize) public: QGraphicsSvgItem(QGraphicsItem *parentItem=0); @@ -87,13 +88,7 @@ public: private: Q_DISABLE_COPY(QGraphicsSvgItem) - - // Q_DECLARE_PRIVATE_WITH_BASE(QGraphicsSvgItem, QObject) - inline QGraphicsSvgItemPrivate *d_func() - { return reinterpret_cast<QGraphicsSvgItemPrivate *>(QObject::d_ptr.data()); } - inline const QGraphicsSvgItemPrivate *d_func() const - { return reinterpret_cast<const QGraphicsSvgItemPrivate *>(QObject::d_ptr.data()); } - friend class QGraphicsSvgItemPrivate; + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsSvgItem) Q_PRIVATE_SLOT(d_func(), void _q_repaintItem()) }; diff --git a/src/svg/qsvggraphics.cpp b/src/svg/qsvggraphics.cpp index fda8ad1..6552b69 100644 --- a/src/svg/qsvggraphics.cpp +++ b/src/svg/qsvggraphics.cpp @@ -434,7 +434,7 @@ void QSvgText::draw(QPainter *p, QSvgExtraStates &states) text.append(QLatin1Char('\n')); text.append(paragraphs[i]); } - states.svgFont->draw(p, m_coord, text, p->font().pointSizeF() * scale, states.textAnchor); + states.svgFont->draw(p, m_coord * scale, text, p->font().pointSizeF() * scale, states.textAnchor); } else { for (int i = 0; i < paragraphs.size(); ++i) { QTextLayout tl(paragraphs[i]); diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 06a49d8..98fa26f 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -968,6 +968,7 @@ static void parseColor(QSvgNode *, { QColor color; if (constructColor(attributes.color, attributes.colorOpacity, color, handler)) { + handler->popColor(); handler->pushColor(color); } } @@ -2728,6 +2729,14 @@ static void parseBaseGradient(QSvgNode *node, QStringRef trans = attributes.value(QLatin1String("gradientTransform")); QString spread = attributes.value(QLatin1String("spreadMethod")).toString(); QString units = attributes.value(QLatin1String("gradientUnits")).toString(); + QStringRef colorStr = attributes.value(QLatin1String("color")); + QStringRef colorOpacityStr = attributes.value(QLatin1String("color-opacity")); + + QColor color; + if (constructColor(colorStr, colorOpacityStr, color, handler)) { + handler->popColor(); + handler->pushColor(color); + } QMatrix matrix; QGradient *grad = gradProp->qgradient(); @@ -3558,11 +3567,7 @@ bool QSvgHandler::startElement(const QString &localName, { QSvgNode *node = 0; - if (m_colorTagCount.count()) { - int top = m_colorTagCount.pop(); - ++top; - m_colorTagCount.push(top); - } + pushColorCopy(); /* The xml:space attribute may appear on any element. We do * a lookup by the qualified name here, but this is namespace aware, since @@ -3696,15 +3701,7 @@ bool QSvgHandler::endElement(const QStringRef &localName) m_skipNodes.pop(); m_whitespaceMode.pop(); - if (m_colorTagCount.count()) { - int top = m_colorTagCount.pop(); - --top; - if (!top) { - m_colorStack.pop(); - } else { - m_colorTagCount.push(top); - } - } + popColor(); if (node == Unknown) { return true; @@ -3801,6 +3798,24 @@ void QSvgHandler::pushColor(const QColor &color) m_colorTagCount.push(1); } +void QSvgHandler::pushColorCopy() +{ + if (m_colorTagCount.count()) + ++m_colorTagCount.top(); + else + pushColor(Qt::black); +} + +void QSvgHandler::popColor() +{ + if (m_colorTagCount.count()) { + if (!--m_colorTagCount.top()) { + m_colorStack.pop(); + m_colorTagCount.pop(); + } + } +} + QColor QSvgHandler::currentColor() const { if (!m_colorStack.isEmpty()) diff --git a/src/svg/qsvghandler_p.h b/src/svg/qsvghandler_p.h index 1b31677..aff6f1d 100644 --- a/src/svg/qsvghandler_p.h +++ b/src/svg/qsvghandler_p.h @@ -111,6 +111,8 @@ public: LengthType defaultCoordinateSystem() const; void pushColor(const QColor &color); + void pushColorCopy(); + void popColor(); QColor currentColor() const; void setInStyle(bool b); diff --git a/src/testlib/qtestspontaneevent.h b/src/testlib/qtestspontaneevent.h index 0c670f8..2f00414 100644 --- a/src/testlib/qtestspontaneevent.h +++ b/src/testlib/qtestspontaneevent.h @@ -74,9 +74,9 @@ public: class QSpontaneKeyEvent { public: - void setSpontaneous() { spont = 1; }; - bool spontaneous() { return spont; }; - virtual void dummyFunc() { }; + void setSpontaneous() { spont = 1; } + bool spontaneous() { return spont; } + virtual void dummyFunc() {} virtual ~QSpontaneKeyEvent() {} #ifndef QTEST_NO_SIZEOF_CHECK diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 6b3227a..51f850a 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -709,6 +709,46 @@ bool RCCResourceLibrary::writeHeader() { if (m_format == C_Code) { writeString("/****************************************************************************\n"); + writeString("**\n"); + writeString("** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).\n"); + writeString("** All rights reserved.\n"); + writeString("** Contact: Nokia Corporation (qt-info@nokia.com)\n"); + writeString("**\n"); + writeString("** This file is part of the tools applications of the Qt Toolkit.\n"); + writeString("**\n"); + writeString("** $QT_BEGIN_LICENSE:LGPL$\n"); + writeString("** No Commercial Usage\n"); + writeString("** This file contains pre-release code and may not be distributed.\n"); + writeString("** You may use this file in accordance with the terms and conditions\n"); + writeString("** contained in the Technology Preview License Agreement accompanying\n"); + writeString("** this package.\n"); + writeString("**\n"); + writeString("** GNU Lesser General Public License Usage\n"); + writeString("** Alternatively, this file may be used under the terms of the GNU Lesser\n"); + writeString("** General Public License version 2.1 as published by the Free Software\n"); + writeString("** Foundation and appearing in the file LICENSE.LGPL included in the\n"); + writeString("** packaging of this file. Please review the following information to\n"); + writeString("** ensure the GNU Lesser General Public License version 2.1 requirements\n"); + writeString("** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\n"); + writeString("**\n"); + writeString("** In addition, as a special exception, Nokia gives you certain additional\n"); + writeString("** rights. These rights are described in the Nokia Qt LGPL Exception\n"); + writeString("** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.\n"); + writeString("**\n"); + writeString("** If you have questions regarding the use of this file, please contact\n"); + writeString("** Nokia at qt-info@nokia.com.\n"); + writeString("**\n"); + writeString("**\n"); + writeString("**\n"); + writeString("**\n"); + writeString("**\n"); + writeString("**\n"); + writeString("**\n"); + writeString("**\n"); + writeString("** $QT_END_LICENSE$\n"); + writeString("**\n"); + writeString("****************************************************************************/\n"); + writeString("/****************************************************************************\n"); writeString("** Resource object code\n"); writeString("**\n"); writeString("** Created: "); diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index cf2d8ba..3ae91d3 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -514,8 +514,8 @@ public: bool setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg, int *errorLine, int *errorColumn); // Attributes - QDomDocumentTypePrivate* doctype() { return type.data(); }; - QDomImplementationPrivate* implementation() { return impl.data(); }; + QDomDocumentTypePrivate* doctype() { return type.data(); } + QDomImplementationPrivate* implementation() { return impl.data(); } QDomElementPrivate* documentElement(); // Factories |