From 627ddefd4f2b27ff2f5127bf20356bb302e6ad6d Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 27 Aug 2009 14:50:23 -0700 Subject: Allow setting screen size with connect options Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 8be0355..9c509d5 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1227,6 +1227,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec) "Unable to get screen size!", result); return false; } + ::setIntOption(displayArgs, QLatin1String("width"), &w); + ::setIntOption(displayArgs, QLatin1String("height"), &h); dw = w; dh = h; -- cgit v0.12 From 74136269e834077daa623fe6e1f14adf1b64a7d0 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 31 Aug 2009 09:41:08 -0700 Subject: Remove duplicated code in qdirectfbScreen.cpp Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbscreen.cpp | 32 +--------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 9c509d5..8cc7d8a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1024,36 +1024,6 @@ static inline bool setIntOption(const QStringList &arguments, const QString &var return false; } -static inline int depth(QImage::Format format) -{ - switch (format) { - case QImage::Format_Mono: - case QImage::Format_MonoLSB: - return 1; - case QImage::Format_Indexed8: - return 8; - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - return 32; - case QImage::Format_ARGB8565_Premultiplied: - case QImage::Format_RGB666: - case QImage::Format_ARGB6666_Premultiplied: - case QImage::Format_ARGB8555_Premultiplied: - case QImage::Format_RGB888: - return 24; - case QImage::Format_RGB555: - case QImage::Format_RGB444: - case QImage::Format_RGB16: - case QImage::Format_ARGB4444_Premultiplied: - return 16; - case QImage::Format_Invalid: - case QImage::NImageFormats: - break; - } - return -1; -} - bool QDirectFBScreen::connect(const QString &displaySpec) { DFBResult result = DFB_OK; @@ -1199,7 +1169,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec) break; } setPixelFormat(pixelFormat); - QScreen::d = ::depth(pixelFormat); + QScreen::d = QDirectFBScreen::depth(pixelFormat); data = 0; lstep = 0; size = 0; -- cgit v0.12 From 42540863d4b31b619a22c68391637f091b1c30f4 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 31 Aug 2009 09:42:36 -0700 Subject: Don't use QString(const char *) in QDirectFBScreen Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 8cc7d8a..fab18e4 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1015,7 +1015,7 @@ static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface) static inline bool setIntOption(const QStringList &arguments, const QString &variable, int *value) { Q_ASSERT(value); - QRegExp rx(QString("%1=?(\\d+)").arg(variable)); + QRegExp rx(QString::fromLatin1("%1=?(\\d+)").arg(variable)); rx.setCaseSensitivity(Qt::CaseInsensitive); if (arguments.indexOf(rx) != -1) { *value = rx.cap(1).toInt(); @@ -1224,7 +1224,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec) surface->Release(surface); #endif - QRegExp backgroundColorRegExp("bgcolor=?(.+)"); + QRegExp backgroundColorRegExp(QLatin1String("bgcolor=?(.+)")); backgroundColorRegExp.setCaseSensitivity(Qt::CaseInsensitive); if (displayArgs.indexOf(backgroundColorRegExp) != -1) { d_ptr->backgroundColor.setNamedColor(backgroundColorRegExp.cap(1)); -- cgit v0.12 From c35974f60cab2d74b399c92ece7ceb96c147ef8a Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 31 Aug 2009 10:10:28 -0700 Subject: Fix QT_BEGIN/END_NAMESPACE in DirectFB Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp | 4 ++++ src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h | 4 ++++ src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp | 5 +++++ src/plugins/gfxdrivers/directfb/qdirectfbmouse.h | 4 ++++ src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp | 4 ++++ src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h | 4 ++++ src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 7 +++++++ src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h | 4 ++++ src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 5 +++++ src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h | 4 ++++ src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 9 +++++++-- src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 4 ++++ src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 5 +++++ src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h | 4 ++++ 14 files changed, 65 insertions(+), 2 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp index fe77fd1..44ce72b3 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp @@ -53,6 +53,8 @@ #include #include +QT_BEGIN_NAMESPACE + class KeyMap : public QHash { public: @@ -429,6 +431,8 @@ KeyMap::KeyMap() insert(DIKS_TILDE , Qt::Key_AsciiTilde); } +QT_END_NAMESPACE + #include "qdirectfbkeyboard.moc" #endif // QT_NO_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h index 756892f..14618bb 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h @@ -46,6 +46,8 @@ QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + QT_MODULE(Gui) #ifndef QT_NO_DIRECTFB @@ -62,6 +64,8 @@ private: QDirectFBKeyboardHandlerPrivate *d; }; +QT_END_NAMESPACE + #endif // QT_NO_DIRECTFB QT_END_HEADER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp index 1f2b363..8d30f93 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp @@ -49,6 +49,8 @@ #include #include +QT_BEGIN_NAMESPACE + class QDirectFBMouseHandlerPrivate : public QObject { Q_OBJECT @@ -269,5 +271,8 @@ void QDirectFBMouseHandler::resume() d->setEnabled(true); } +QT_END_NAMESPACE + #include "qdirectfbmouse.moc" + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h index 14026ee..37d0845 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h @@ -46,6 +46,8 @@ QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + QT_MODULE(Gui) #ifndef QT_NO_DIRECTFB @@ -67,6 +69,8 @@ protected: #endif // QT_NO_DIRECTFB +QT_END_NAMESPACE + QT_END_HEADER #endif // QDIRECTFBMOUSE_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp index dec4bdd..e839b47 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp @@ -45,6 +45,8 @@ #include "qdirectfbpaintdevice.h" #include "qdirectfbpaintengine.h" +QT_BEGIN_NAMESPACE + QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr) : QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr), bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0), @@ -169,5 +171,7 @@ QPaintEngine *QDirectFBPaintDevice::paintEngine() const return engine; } +QT_END_NAMESPACE + #endif diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h index ca958c8..5befeab 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h @@ -48,6 +48,8 @@ QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + QT_MODULE(Gui) // Inherited by both window surface and pixmap @@ -94,6 +96,8 @@ private: Q_DISABLE_COPY(QDirectFBPaintDevice); }; +QT_END_NAMESPACE + QT_END_HEADER #endif //QDIRECTFBPAINTDEVICE_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 337e75a..384a76a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -55,6 +55,8 @@ #include #include +QT_BEGIN_NAMESPACE + class SurfaceCache; class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate { @@ -145,7 +147,9 @@ private: #ifdef QT_DIRECTFB_IMAGECACHE +QT_BEGIN_INCLUDE_NAMESPACE #include +QT_END_INCLUDE_NAMESPACE struct CachedImage { IDirectFBSurface *surface; @@ -1246,4 +1250,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * } #endif // QT_DIRECTFB_WARN_ON_RASTERFALLBACKS + +QT_END_NAMESPACE + #endif // QT_NO_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h index 51468ad..ff67d14 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h @@ -47,6 +47,8 @@ QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + QT_MODULE(Gui) class QDirectFBPaintEnginePrivate; @@ -107,6 +109,8 @@ public: static void initImageCache(int size); }; +QT_END_NAMESPACE + QT_END_HEADER #endif // QPAINTENGINE_DIRECTFB_P_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 2e3d32d..e921d24 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -48,6 +48,8 @@ #include #include +QT_BEGIN_NAMESPACE + static int global_ser_no = 0; QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType) @@ -574,3 +576,6 @@ void QDirectFBPixmapData::invalidate() imageFormat = QImage::Format_Invalid; } +QT_END_NAMESPACE + + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h index 8bf1e73..fd59a93 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h @@ -49,6 +49,8 @@ QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + QT_MODULE(Gui) class QDirectFBPaintEngine; @@ -91,6 +93,8 @@ private: bool alpha; }; +QT_END_NAMESPACE + QT_END_HEADER #endif // QDIRECTFBPIXMAP_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index fab18e4..069ec5a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -54,6 +54,8 @@ #include #include +QT_BEGIN_NAMESPACE + class QDirectFBScreenPrivate : public QObject, public QWSGraphicsSystem { Q_OBJECT @@ -94,8 +96,6 @@ public: QDirectFBScreen *q; }; -#include "qdirectfbscreen.moc" - QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr) : QWSGraphicsSystem(qptr), dfb(0), flipFlags(DSFLIP_NONE), directFBFlags(QDirectFBScreen::NoFlags), alphaPixmapFormat(QImage::Format_Invalid), @@ -1562,3 +1562,8 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co return subSurface; } +QT_END_NAMESPACE + +#include "qdirectfbscreen.moc" + + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index df0eea4..3e27ed1 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -48,6 +48,8 @@ QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + QT_MODULE(Gui) #if !defined QT_NO_DIRECTFB_LAYER && !defined QT_DIRECTFB_LAYER @@ -269,6 +271,8 @@ inline bool QDirectFBScreen::hasAlphaChannel(IDirectFBSurface *surface) return QDirectFBScreen::hasAlphaChannel(format); } +QT_END_NAMESPACE + QT_END_HEADER #endif // QDIRECTFBSCREEN_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index a05ad21..421fbc2 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -48,6 +48,8 @@ #include #include +QT_BEGIN_NAMESPACE + QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr) : QDirectFBPaintDevice(scr) #ifndef QT_NO_DIRECTFB_WM @@ -449,3 +451,6 @@ void QDirectFBWindowSurface::updateFormat() { imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid; } + +QT_END_NAMESPACE + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index a2861e5..771b7b5 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -56,6 +56,8 @@ QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + QT_MODULE(Gui) class QDirectFBWindowSurface : public QWSWindowSurface, public QDirectFBPaintDevice @@ -110,6 +112,8 @@ private: #endif }; +QT_END_NAMESPACE + QT_END_HEADER #endif // QDIRECFBWINDOWSURFACE_H -- cgit v0.12 From cef94ba96e4fd45506dff793accd8603765de7f4 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 31 Aug 2009 10:29:51 -0700 Subject: Clean up directfb ifdefs Make sure all files are wrapped in QT_NO_QWS_DIRECTFB Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp | 8 +++----- src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h | 6 +++--- src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp | 4 +++- src/plugins/gfxdrivers/directfb/qdirectfbmouse.h | 8 +++----- src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp | 7 +++---- src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h | 4 +++- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 4 ++-- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h | 4 ++++ src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 5 +++++ src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h | 4 ++++ src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 4 +++- src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 4 ++++ src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp | 3 +++ src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 5 +++++ src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h | 5 ++++- 15 files changed, 52 insertions(+), 23 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp index 44ce72b3..2bf1614 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp @@ -41,8 +41,6 @@ #include "qdirectfbkeyboard.h" -#ifndef QT_NO_DIRECTFB - #include "qdirectfbscreen.h" #include #include @@ -53,6 +51,8 @@ #include #include +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_NAMESPACE class KeyMap : public QHash @@ -432,7 +432,5 @@ KeyMap::KeyMap() } QT_END_NAMESPACE - #include "qdirectfbkeyboard.moc" - -#endif // QT_NO_DIRECTFB +#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h index 14618bb..826de3b 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h @@ -44,14 +44,14 @@ #include +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#ifndef QT_NO_DIRECTFB - class QDirectFBKeyboardHandlerPrivate; class QDirectFBKeyboardHandler : public QWSKeyboardHandler @@ -66,7 +66,7 @@ private: QT_END_NAMESPACE -#endif // QT_NO_DIRECTFB +#endif // QT_NO_QWS_DIRECTFB QT_END_HEADER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp index 8d30f93..074904f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp @@ -49,6 +49,8 @@ #include #include +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_NAMESPACE class QDirectFBMouseHandlerPrivate : public QObject @@ -272,7 +274,7 @@ void QDirectFBMouseHandler::resume() } QT_END_NAMESPACE - #include "qdirectfbmouse.moc" +#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h index 37d0845..fcb995e 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h @@ -44,14 +44,14 @@ #include +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#ifndef QT_NO_DIRECTFB - class QDirectFBMouseHandlerPrivate; class QDirectFBMouseHandler : public QWSMouseHandler @@ -67,10 +67,8 @@ protected: QDirectFBMouseHandlerPrivate *d; }; -#endif // QT_NO_DIRECTFB - QT_END_NAMESPACE QT_END_HEADER - +#endif // QT_NO_QWS_DIRECTFB #endif // QDIRECTFBMOUSE_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp index e839b47..106de0d 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#ifndef QT_NO_DIRECTFB - #include "qdirectfbscreen.h" #include "qdirectfbpaintdevice.h" #include "qdirectfbpaintengine.h" +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_NAMESPACE QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr) @@ -173,5 +173,4 @@ QPaintEngine *QDirectFBPaintDevice::paintEngine() const QT_END_NAMESPACE -#endif - +#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h index 5befeab..aed1cb5 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h @@ -43,9 +43,10 @@ #define QDIRECTFBPAINTDEVICE_H #include -#include #include "qdirectfbscreen.h" +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -100,4 +101,5 @@ QT_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_QWS_DIRECTFB #endif //QDIRECTFBPAINTDEVICE_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 384a76a..9a9553e 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -41,7 +41,7 @@ #include "qdirectfbpaintengine.h" -#ifndef QT_NO_DIRECTFB +#ifndef QT_NO_QWS_DIRECTFB #include "qdirectfbwindowsurface.h" #include "qdirectfbscreen.h" @@ -1253,4 +1253,4 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * QT_END_NAMESPACE -#endif // QT_NO_DIRECTFB +#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h index ff67d14..b4f0b5d 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h @@ -45,6 +45,8 @@ #include #include +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -113,4 +115,6 @@ QT_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_QWS_DIRECTFB + #endif // QPAINTENGINE_DIRECTFB_P_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index e921d24..ee63842 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -48,6 +48,8 @@ #include #include +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_NAMESPACE static int global_ser_no = 0; @@ -578,4 +580,7 @@ void QDirectFBPixmapData::invalidate() QT_END_NAMESPACE +#endif // QT_NO_QWS_DIRECTFB + + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h index fd59a93..77364fd 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h @@ -42,6 +42,8 @@ #ifndef QDIRECTFBPIXMAP_H #define QDIRECTFBPIXMAP_H +#ifndef QT_NO_QWS_DIRECTFB + #include #include #include "qdirectfbpaintdevice.h" @@ -97,4 +99,6 @@ QT_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_QWS_DIRECTFB + #endif // QDIRECTFBPIXMAP_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 069ec5a..664c8a8 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -54,6 +54,8 @@ #include #include +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_NAMESPACE class QDirectFBScreenPrivate : public QObject, public QWSGraphicsSystem @@ -1565,5 +1567,5 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co QT_END_NAMESPACE #include "qdirectfbscreen.moc" - +#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 3e27ed1..14fde86 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -42,6 +42,8 @@ #ifndef QDIRECTFBSCREEN_H #define QDIRECTFBSCREEN_H +#include +#ifndef QT_NO_QWS_DIRECTFB #include #include #include @@ -275,4 +277,6 @@ QT_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_QWS_DIRECTFB #endif // QDIRECTFBSCREEN_H + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp index 4caee414..05fe70f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp @@ -43,6 +43,7 @@ #include #include +#ifndef QT_NO_QWS_DIRECTFB class DirectFBScreenDriverPlugin : public QScreenDriverPlugin { @@ -73,3 +74,5 @@ QScreen* DirectFBScreenDriverPlugin::create(const QString& driver, } Q_EXPORT_PLUGIN2(qdirectfbscreen, DirectFBScreenDriverPlugin) + +#endif diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 421fbc2..82c8a41 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -48,6 +48,8 @@ #include #include +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_NAMESPACE QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr) @@ -454,3 +456,6 @@ void QDirectFBWindowSurface::updateFormat() QT_END_NAMESPACE +#endif // QT_NO_QWS_DIRECTFB + + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index 771b7b5..bb81e1a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -46,9 +46,10 @@ #include "qdirectfbpaintdevice.h" #include "qdirectfbscreen.h" +#ifndef QT_NO_QWS_DIRECTFB + #include #include -#include #ifdef QT_DIRECTFB_TIMING #include @@ -116,4 +117,6 @@ QT_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_QWS_DIRECTFB + #endif // QDIRECFBWINDOWSURFACE_H -- cgit v0.12 From 258b9c5d5b1d88a5c19ed1dcfb5fed446006de0d Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 24 Aug 2009 10:42:48 +0200 Subject: Initialize the line coordinates in the tablet example. For the first tablet events, polyLine contains null points. The first two line painted have an invalid origin. --- examples/widgets/tablet/tabletcanvas.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/widgets/tablet/tabletcanvas.cpp b/examples/widgets/tablet/tabletcanvas.cpp index abb667c..612a635 100644 --- a/examples/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/tablet/tabletcanvas.cpp @@ -98,8 +98,10 @@ void TabletCanvas::tabletEvent(QTabletEvent *event) switch (event->type()) { case QEvent::TabletPress: - if (!deviceDown) + if (!deviceDown) { deviceDown = true; + polyLine[0] = polyLine[1] = polyLine[2] = event->pos(); + } break; case QEvent::TabletRelease: if (deviceDown) -- cgit v0.12 From a2b2fbbbffa4fa04f47cd8b9e6265e2e61c5e5f3 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 31 Aug 2009 19:19:04 +0200 Subject: Disable event compression when the tablet events are accepted Since Qt 4.5, all tablet events are compressed not to overload the widgets with the corresponding mouse event (a mouse event is generated if the tablet event is not accepted). This behavior reduce the precision when drawing on a widget that use the tablet events. All tablet events should be sent to the widget that are accepting the tablet event. With this patch, the tablet event are filtered only if the widget ignore the first tablet event. The mouse events are compressed. There is two special cases for the filtering: First, if a tablet event is for another widget than the one ignoring the tablet, this event should not be filtered. Second, if there is a mouse press event, the mouse move event should be sent to the widget that received the mouse press event. Helped-by: Pierre Rossi Reviewed-by: Thomas Zander Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qapplication_x11.cpp | 111 ++++++------ .../qtabletevent/device_information/main.cpp | 50 ++++++ .../device_information/qtabletevent.pro | 13 ++ .../device_information/tabletwidget.cpp | 191 +++++++++++++++++++++ .../qtabletevent/device_information/tabletwidget.h | 73 ++++++++ .../event_compression/event_compression.pro | 7 + .../manual/qtabletevent/event_compression/main.cpp | 58 +++++++ .../event_compression/mousestatwidget.cpp | 99 +++++++++++ .../event_compression/mousestatwidget.h | 69 ++++++++ tests/manual/qtabletevent/main.cpp | 50 ------ tests/manual/qtabletevent/qtabletevent.pro | 13 -- tests/manual/qtabletevent/tabletwidget.cpp | 191 --------------------- tests/manual/qtabletevent/tabletwidget.h | 73 -------- 13 files changed, 618 insertions(+), 380 deletions(-) create mode 100644 tests/manual/qtabletevent/device_information/main.cpp create mode 100644 tests/manual/qtabletevent/device_information/qtabletevent.pro create mode 100644 tests/manual/qtabletevent/device_information/tabletwidget.cpp create mode 100644 tests/manual/qtabletevent/device_information/tabletwidget.h create mode 100644 tests/manual/qtabletevent/event_compression/event_compression.pro create mode 100644 tests/manual/qtabletevent/event_compression/main.cpp create mode 100644 tests/manual/qtabletevent/event_compression/mousestatwidget.cpp create mode 100644 tests/manual/qtabletevent/event_compression/mousestatwidget.h delete mode 100644 tests/manual/qtabletevent/main.cpp delete mode 100644 tests/manual/qtabletevent/qtabletevent.pro delete mode 100644 tests/manual/qtabletevent/tabletwidget.cpp delete mode 100644 tests/manual/qtabletevent/tabletwidget.h diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 69dba40..0056b9e 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -4510,7 +4510,9 @@ void fetchWacomToolId(int &deviceType, qint64 &serialId) struct qt_tablet_motion_data { - Time timestamp; + bool filterByWidget; + const QWidget *widget; + const QWidget *etWidget; int tabletMotionType; bool error; // found a reason to stop searching }; @@ -4533,15 +4535,20 @@ static Bool qt_tabletMotion_scanner(Display *, XEvent *event, XPointer arg) qt_tablet_motion_data *data = (qt_tablet_motion_data *) arg; if (data->error) return false; - if (event->type == data->tabletMotionType) { - if (data->timestamp > 0) { - if ((reinterpret_cast(event))->time > data->timestamp) { - data->error = true; - return false; + const XDeviceMotionEvent *const motion = reinterpret_cast(event); + if (data->filterByWidget) { + const QPoint curr(motion->x, motion->y); + const QWidget *w = data->etWidget; + const QWidget *const child = w->childAt(curr); + if (child) { + w = child; } + if (w == data->widget) + return true; + } else { + return true; } - return true; } data->error = event->type != MotionNotify; // we stop compression when another event gets in between. @@ -4574,57 +4581,17 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet qreal rotation = 0; int deviceType = QTabletEvent::NoDevice; int pointerType = QTabletEvent::UnknownPointer; - XEvent mouseMotionEvent; - XEvent dummy; const XDeviceMotionEvent *motion = 0; XDeviceButtonEvent *button = 0; const XProximityNotifyEvent *proximity = 0; QEvent::Type t; Qt::KeyboardModifiers modifiers = 0; - bool reinsertMouseEvent = false; - XEvent mouseMotionEventSave; #if !defined (Q_OS_IRIX) XID device_id; #endif if (ev->type == tablet->xinput_motion) { motion = reinterpret_cast(ev); - - // Do event compression. Skip over tablet+mouse move events if there are newer ones. - qt_tablet_motion_data tabletMotionData; - tabletMotionData.tabletMotionType = tablet->xinput_motion; - while (true) { - // Find first mouse event since we expect them in pairs inside Qt - tabletMotionData.error =false; - tabletMotionData.timestamp = 0; - if (XCheckIfEvent(X11->display, &mouseMotionEvent, &qt_mouseMotion_scanner, (XPointer) &tabletMotionData)) { - mouseMotionEventSave = mouseMotionEvent; - reinsertMouseEvent = true; - } else { - break; - } - - // Now discard any duplicate tablet events. - tabletMotionData.error = false; - tabletMotionData.timestamp = mouseMotionEvent.xmotion.time; - while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) { - motion = reinterpret_cast(&dummy); - } - - // now check if there are more recent tablet motion events since we'll compress the current one with - // newer ones in that case - tabletMotionData.error = false; - tabletMotionData.timestamp = 0; - if (! XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) { - break; // done with compression - } - motion = reinterpret_cast(&dummy); - } - - if (reinsertMouseEvent) { - XPutBackEvent(X11->display, &mouseMotionEventSave); - } - t = QEvent::TabletMove; global = QPoint(motion->x_root, motion->y_root); curr = QPoint(motion->x, motion->y); @@ -4777,11 +4744,14 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet } #endif - QWidget *child = w->childAt(curr); - if (child) { - w = child; - curr = w->mapFromGlobal(global); + if (tablet->widgetToGetPress) { + w = tablet->widgetToGetPress; + } else { + QWidget *child = w->childAt(curr); + if (child) + w = child; } + curr = w->mapFromGlobal(global); if (t == QEvent::TabletPress) { tablet->widgetToGetPress = w; @@ -4795,10 +4765,45 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet deviceType, pointerType, qreal(pressure / qreal(tablet->maxPressure - tablet->minPressure)), xTilt, yTilt, tangentialPressure, rotation, z, modifiers, uid); - if (proximity) + if (proximity) { QApplication::sendSpontaneousEvent(qApp, &e); - else + } else { QApplication::sendSpontaneousEvent(w, &e); + const bool accepted = e.isAccepted(); + if (!accepted && ev->type == tablet->xinput_motion) { + // If the widget does not accept tablet events, we drop the next ones from the event queue + // for this widget so it is not overloaded with the numerous tablet events. + qt_tablet_motion_data tabletMotionData; + tabletMotionData.tabletMotionType = tablet->xinput_motion; + tabletMotionData.widget = w; + tabletMotionData.etWidget = this; + // if nothing is pressed, the events are filtered by position + tabletMotionData.filterByWidget = (tablet->widgetToGetPress == 0); + + bool reinsertMouseEvent = false; + XEvent mouseMotionEvent; + while (true) { + // Find first mouse event since we expect them in pairs inside Qt + tabletMotionData.error =false; + if (XCheckIfEvent(X11->display, &mouseMotionEvent, &qt_mouseMotion_scanner, (XPointer) &tabletMotionData)) { + reinsertMouseEvent = true; + } else { + break; + } + + // Now discard any duplicate tablet events. + tabletMotionData.error = false; + XEvent dummy; + while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) { + // just discard the event + } + } + + if (reinsertMouseEvent) { + XPutBackEvent(X11->display, &mouseMotionEvent); + } + } + } return true; } #endif diff --git a/tests/manual/qtabletevent/device_information/main.cpp b/tests/manual/qtabletevent/device_information/main.cpp new file mode 100644 index 0000000..0c2eda3 --- /dev/null +++ b/tests/manual/qtabletevent/device_information/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "tabletwidget.h" + +int main(int argc, char **argv) { + QApplication app(argc, argv); + TabletWidget tabletWidget; + tabletWidget.showMaximized(); + return app.exec(); +} diff --git a/tests/manual/qtabletevent/device_information/qtabletevent.pro b/tests/manual/qtabletevent/device_information/qtabletevent.pro new file mode 100644 index 0000000..e0ed549 --- /dev/null +++ b/tests/manual/qtabletevent/device_information/qtabletevent.pro @@ -0,0 +1,13 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Mon Aug 10 17:02:09 2009 +###################################################################### + +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += main.cpp\ + tabletwidget.cpp +HEADERS += tabletwidget.h diff --git a/tests/manual/qtabletevent/device_information/tabletwidget.cpp b/tests/manual/qtabletevent/device_information/tabletwidget.cpp new file mode 100644 index 0000000..15a3d80 --- /dev/null +++ b/tests/manual/qtabletevent/device_information/tabletwidget.cpp @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "tabletwidget.h" +#include +#include + +TabletWidget::TabletWidget() +{ + QPalette newPalette = palette(); + newPalette.setColor(QPalette::Window, Qt::white); + setPalette(newPalette); + qApp->installEventFilter(this); + resetAttributes(); +} + +bool TabletWidget::eventFilter(QObject *, QEvent *ev) +{ + switch (ev->type()) { + case QEvent::TabletEnterProximity: + case QEvent::TabletLeaveProximity: + case QEvent::TabletMove: + case QEvent::TabletPress: + case QEvent::TabletRelease: + { + QTabletEvent *event = static_cast(ev); + mType = event->type(); + mPos = event->pos(); + mGPos = event->globalPos(); + mHiResGlobalPos = event->hiResGlobalPos(); + mDev = event->device(); + mPointerType = event->pointerType(); + mUnique = event->uniqueId(); + mXT = event->xTilt(); + mYT = event->yTilt(); + mZ = event->z(); + mPress = event->pressure(); + mTangential = event->tangentialPressure(); + mRot = event->rotation(); + if (isVisible()) + update(); + break; + } + case QEvent::MouseMove: + { + resetAttributes(); + QMouseEvent *event = static_cast(ev); + mType = event->type(); + mPos = event->pos(); + mGPos = event->globalPos(); + } + default: + break; + } + return false; +} + +void TabletWidget::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + + QStringList eventInfo; + + QString typeString("Event type: "); + switch (mType) { + case QEvent::TabletEnterProximity: + typeString += "QEvent::TabletEnterProximity"; + break; + case QEvent::TabletLeaveProximity: + typeString += "QEvent::TabletLeaveProximity"; + break; + case QEvent::TabletMove: + typeString += "QEvent::TabletMove"; + break; + case QEvent::TabletPress: + typeString += "QEvent::TabletPress"; + break; + case QEvent::TabletRelease: + typeString += "QEvent::TabletRelease"; + break; + case QEvent::MouseMove: + typeString += "QEvent::MouseMove"; + break; + } + eventInfo << typeString; + + eventInfo << QString("Global position: %1 %2").arg(QString::number(mGPos.x()), QString::number(mGPos.y())); + eventInfo << QString("Local position: %1 %2").arg(QString::number(mPos.x()), QString::number(mPos.y())); + if (mType == QEvent::TabletEnterProximity || mType == QEvent::TabletLeaveProximity + || mType == QEvent::TabletMove || mType == QEvent::TabletPress + || mType == QEvent::TabletRelease) { + + eventInfo << QString("Hight res global position: %1 %2").arg(QString::number(mHiResGlobalPos.x()), QString::number(mHiResGlobalPos.y())); + + QString pointerType("Pointer type: "); + switch (mPointerType) { + case QTabletEvent::UnknownPointer: + pointerType += "QTabletEvent::UnknownPointer"; + break; + case QTabletEvent::Pen: + pointerType += "QTabletEvent::Pen"; + break; + case QTabletEvent::Cursor: + pointerType += "QTabletEvent::Cursor"; + break; + case QTabletEvent::Eraser: + pointerType += "QTabletEvent::Eraser"; + break; + } + eventInfo << pointerType; + + + QString deviceString = "Device type: "; + switch (mDev) { + case QTabletEvent::NoDevice: + deviceString += "QTabletEvent::NoDevice"; + break; + case QTabletEvent::Puck: + deviceString += "QTabletEvent::Puck"; + break; + case QTabletEvent::Stylus: + deviceString += "QTabletEvent::Stylus"; + break; + case QTabletEvent::Airbrush: + deviceString += "QTabletEvent::Airbrush"; + break; + case QTabletEvent::FourDMouse: + deviceString += "QTabletEvent::FourDMouse"; + break; + case QTabletEvent::RotationStylus: + deviceString += "QTabletEvent::RotationStylus"; + break; + } + eventInfo << deviceString; + + eventInfo << QString("Pressure: %1").arg(QString::number(mPress)); + eventInfo << QString("Tangential pressure: %1").arg(QString::number(mTangential)); + eventInfo << QString("Rotation: %1").arg(QString::number(mRot)); + eventInfo << QString("xTilt: %1").arg(QString::number(mXT)); + eventInfo << QString("yTilt: %1").arg(QString::number(mYT)); + eventInfo << QString("z: %1").arg(QString::number(mZ)); + + eventInfo << QString("Unique Id: %1").arg(QString::number(mUnique)); + } + + painter.drawText(rect(), eventInfo.join("\n")); +} + +void TabletWidget::tabletEvent(QTabletEvent *event) +{ + event->accept(); +} + diff --git a/tests/manual/qtabletevent/device_information/tabletwidget.h b/tests/manual/qtabletevent/device_information/tabletwidget.h new file mode 100644 index 0000000..b16e9ed --- /dev/null +++ b/tests/manual/qtabletevent/device_information/tabletwidget.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TABLETWIDGET_H +#define TABLETWIDGET_H + +#include +#include + +// a widget showing the information of the last tablet event +class TabletWidget : public QWidget +{ +public: + TabletWidget(); +protected: + bool eventFilter(QObject *obj, QEvent *ev); + void tabletEvent(QTabletEvent *event); + void paintEvent(QPaintEvent *event); +private: + void resetAttributes() { + mType = mDev = mPointerType = mXT = mYT = mZ = 0; + mPress = mTangential = mRot = 0.0; + mPos = mGPos = QPoint(); + mHiResGlobalPos = QPointF(); + mUnique = 0; + } + int mType; + QPoint mPos, mGPos; + QPointF mHiResGlobalPos; + int mDev, mPointerType, mXT, mYT, mZ; + qreal mPress, mTangential, mRot; + qint64 mUnique; +}; + +#endif // TABLETWIDGET_H diff --git a/tests/manual/qtabletevent/event_compression/event_compression.pro b/tests/manual/qtabletevent/event_compression/event_compression.pro new file mode 100644 index 0000000..273fd6c --- /dev/null +++ b/tests/manual/qtabletevent/event_compression/event_compression.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +QT += testlib + +# Input +SOURCES += main.cpp \ + mousestatwidget.cpp +HEADERS += mousestatwidget.h diff --git a/tests/manual/qtabletevent/event_compression/main.cpp b/tests/manual/qtabletevent/event_compression/main.cpp new file mode 100644 index 0000000..3b869e3 --- /dev/null +++ b/tests/manual/qtabletevent/event_compression/main.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mousestatwidget.h" + +#include +#include +#include + +int main(int argc, char **argv){ + QApplication app(argc, argv); + + QWidget main; + QVBoxLayout *layout = new QVBoxLayout(&main); + layout->addWidget(new MouseStatWidget(true)); + layout->addWidget(new MouseStatWidget(false)); + main.resize(800, 600); + main.show(); + return app.exec(); +} diff --git a/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp b/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp new file mode 100644 index 0000000..024e14a --- /dev/null +++ b/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp @@ -0,0 +1,99 @@ +#include "mousestatwidget.h" + +#include +#include +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +MouseStatWidget::MouseStatWidget(bool acceptTabletEvent):acceptTabletEvent(acceptTabletEvent), + receivedMouseEventCount(0), + receivedMouseEventCountToPaint(0), + receivedTabletEventCount(0), + receivedTabletEventCountToPaint(0) +{ + startTimer(1000); +} + + +void MouseStatWidget::tabletEvent(QTabletEvent *event) +{ + ++receivedTabletEventCount; + if (acceptTabletEvent) + event->accept(); + else + event->ignore(); + // make sure the event loop is slow + QTest::qSleep(15); +} + +void MouseStatWidget::mouseMoveEvent(QMouseEvent *) +{ + ++receivedMouseEventCount; +} + +void MouseStatWidget::timerEvent(QTimerEvent *) +{ + receivedMouseEventCountToPaint = receivedMouseEventCount; + receivedTabletEventCountToPaint = receivedTabletEventCount; + receivedMouseEventCount = 0; + receivedTabletEventCount = 0; + update(); +} + +void MouseStatWidget::paintEvent(QPaintEvent *) +{ + QPainter painter(this); + painter.setPen(Qt::black); + painter.drawRect(rect()); + QStringList text; + text << ((acceptTabletEvent) ? " - tablet events accepted - " : " - tablet events ignored - "); + text << QString("Number of tablet events received in the last second: %1").arg(QString::number(receivedTabletEventCountToPaint)); + text << QString("Number of mouse events received in the last second: %1").arg(QString::number(receivedMouseEventCountToPaint)); + + QTextOption textOption(Qt::AlignCenter); + textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + painter.drawText(rect(), + text.join("\n"), + textOption); +} diff --git a/tests/manual/qtabletevent/event_compression/mousestatwidget.h b/tests/manual/qtabletevent/event_compression/mousestatwidget.h new file mode 100644 index 0000000..22c0dff --- /dev/null +++ b/tests/manual/qtabletevent/event_compression/mousestatwidget.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOUSESTATWIDGET_H +#define MOUSESTATWIDGET_H + +#include + +class QTabletEvent; +class QMouseEvent; +class QTimerEvent; +class QPaintEvent; + +class MouseStatWidget : public QWidget +{ +public: + MouseStatWidget(bool acceptTabletEvent = true); +protected: + void tabletEvent(QTabletEvent *); + void mouseMoveEvent(QMouseEvent *); + void timerEvent(QTimerEvent *); + void paintEvent(QPaintEvent *); +private: + const bool acceptTabletEvent; + int receivedMouseEventCount; + int receivedMouseEventCountToPaint; + int receivedTabletEventCount; + int receivedTabletEventCountToPaint; +}; + +#endif // MOUSESTATWIDGET_H diff --git a/tests/manual/qtabletevent/main.cpp b/tests/manual/qtabletevent/main.cpp deleted file mode 100644 index 44afcaf..0000000 --- a/tests/manual/qtabletevent/main.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "tabletwidget.h" - -int main(int argc, char **argv) { - QApplication app(argc, argv); - TabletWidget tabletWidget; - tabletWidget.showMaximized(); - return app.exec(); -} diff --git a/tests/manual/qtabletevent/qtabletevent.pro b/tests/manual/qtabletevent/qtabletevent.pro deleted file mode 100644 index e0ed549..0000000 --- a/tests/manual/qtabletevent/qtabletevent.pro +++ /dev/null @@ -1,13 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Mon Aug 10 17:02:09 2009 -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp\ - tabletwidget.cpp -HEADERS += tabletwidget.h diff --git a/tests/manual/qtabletevent/tabletwidget.cpp b/tests/manual/qtabletevent/tabletwidget.cpp deleted file mode 100644 index 15a3d80..0000000 --- a/tests/manual/qtabletevent/tabletwidget.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tabletwidget.h" -#include -#include - -TabletWidget::TabletWidget() -{ - QPalette newPalette = palette(); - newPalette.setColor(QPalette::Window, Qt::white); - setPalette(newPalette); - qApp->installEventFilter(this); - resetAttributes(); -} - -bool TabletWidget::eventFilter(QObject *, QEvent *ev) -{ - switch (ev->type()) { - case QEvent::TabletEnterProximity: - case QEvent::TabletLeaveProximity: - case QEvent::TabletMove: - case QEvent::TabletPress: - case QEvent::TabletRelease: - { - QTabletEvent *event = static_cast(ev); - mType = event->type(); - mPos = event->pos(); - mGPos = event->globalPos(); - mHiResGlobalPos = event->hiResGlobalPos(); - mDev = event->device(); - mPointerType = event->pointerType(); - mUnique = event->uniqueId(); - mXT = event->xTilt(); - mYT = event->yTilt(); - mZ = event->z(); - mPress = event->pressure(); - mTangential = event->tangentialPressure(); - mRot = event->rotation(); - if (isVisible()) - update(); - break; - } - case QEvent::MouseMove: - { - resetAttributes(); - QMouseEvent *event = static_cast(ev); - mType = event->type(); - mPos = event->pos(); - mGPos = event->globalPos(); - } - default: - break; - } - return false; -} - -void TabletWidget::paintEvent(QPaintEvent *event) -{ - QPainter painter(this); - - QStringList eventInfo; - - QString typeString("Event type: "); - switch (mType) { - case QEvent::TabletEnterProximity: - typeString += "QEvent::TabletEnterProximity"; - break; - case QEvent::TabletLeaveProximity: - typeString += "QEvent::TabletLeaveProximity"; - break; - case QEvent::TabletMove: - typeString += "QEvent::TabletMove"; - break; - case QEvent::TabletPress: - typeString += "QEvent::TabletPress"; - break; - case QEvent::TabletRelease: - typeString += "QEvent::TabletRelease"; - break; - case QEvent::MouseMove: - typeString += "QEvent::MouseMove"; - break; - } - eventInfo << typeString; - - eventInfo << QString("Global position: %1 %2").arg(QString::number(mGPos.x()), QString::number(mGPos.y())); - eventInfo << QString("Local position: %1 %2").arg(QString::number(mPos.x()), QString::number(mPos.y())); - if (mType == QEvent::TabletEnterProximity || mType == QEvent::TabletLeaveProximity - || mType == QEvent::TabletMove || mType == QEvent::TabletPress - || mType == QEvent::TabletRelease) { - - eventInfo << QString("Hight res global position: %1 %2").arg(QString::number(mHiResGlobalPos.x()), QString::number(mHiResGlobalPos.y())); - - QString pointerType("Pointer type: "); - switch (mPointerType) { - case QTabletEvent::UnknownPointer: - pointerType += "QTabletEvent::UnknownPointer"; - break; - case QTabletEvent::Pen: - pointerType += "QTabletEvent::Pen"; - break; - case QTabletEvent::Cursor: - pointerType += "QTabletEvent::Cursor"; - break; - case QTabletEvent::Eraser: - pointerType += "QTabletEvent::Eraser"; - break; - } - eventInfo << pointerType; - - - QString deviceString = "Device type: "; - switch (mDev) { - case QTabletEvent::NoDevice: - deviceString += "QTabletEvent::NoDevice"; - break; - case QTabletEvent::Puck: - deviceString += "QTabletEvent::Puck"; - break; - case QTabletEvent::Stylus: - deviceString += "QTabletEvent::Stylus"; - break; - case QTabletEvent::Airbrush: - deviceString += "QTabletEvent::Airbrush"; - break; - case QTabletEvent::FourDMouse: - deviceString += "QTabletEvent::FourDMouse"; - break; - case QTabletEvent::RotationStylus: - deviceString += "QTabletEvent::RotationStylus"; - break; - } - eventInfo << deviceString; - - eventInfo << QString("Pressure: %1").arg(QString::number(mPress)); - eventInfo << QString("Tangential pressure: %1").arg(QString::number(mTangential)); - eventInfo << QString("Rotation: %1").arg(QString::number(mRot)); - eventInfo << QString("xTilt: %1").arg(QString::number(mXT)); - eventInfo << QString("yTilt: %1").arg(QString::number(mYT)); - eventInfo << QString("z: %1").arg(QString::number(mZ)); - - eventInfo << QString("Unique Id: %1").arg(QString::number(mUnique)); - } - - painter.drawText(rect(), eventInfo.join("\n")); -} - -void TabletWidget::tabletEvent(QTabletEvent *event) -{ - event->accept(); -} - diff --git a/tests/manual/qtabletevent/tabletwidget.h b/tests/manual/qtabletevent/tabletwidget.h deleted file mode 100644 index d3ccb32..0000000 --- a/tests/manual/qtabletevent/tabletwidget.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TABLETWIDGET_H -#define TABLETWIDGET_H - -#include -#include - -// a widget showing the information of the last tablet event -class TabletWidget : public QWidget -{ -public: - TabletWidget(); -protected: - bool eventFilter(QObject *obj, QEvent *ev); - void tabletEvent(QTabletEvent *event); - void paintEvent(QPaintEvent *event); -private: - void resetAttributes() { - mType = mDev = mPointerType = mXT = mYT = mZ = 0; - mPress = mTangential = mRot = 0.0; - mPos = mGPos = QPoint(); - mHiResGlobalPos = QPointF(); - mUnique = 0; - } - int mType; - QPoint mPos, mGPos; - QPointF mHiResGlobalPos; - int mDev, mPointerType, mXT, mYT, mZ; - qreal mPress, mTangential, mRot; - qint64 mUnique; -}; - -#endif // TABLETWIDGET_H -- cgit v0.12 From 9e652a18780aece1c5a8f12209747274a37bf91c Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 31 Aug 2009 12:21:03 -0700 Subject: Make cursor work in non-windowed mode Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbpaintdevice.h | 2 +- .../gfxdrivers/directfb/qdirectfbscreen.cpp | 34 ++++++++++------------ src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 10 +++++++ .../gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 21 +++++++------ .../gfxdrivers/directfb/qdirectfbwindowsurface.h | 4 ++- 5 files changed, 41 insertions(+), 30 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h index aed1cb5..f5de44b 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h @@ -60,7 +60,7 @@ class QDirectFBPaintDevice : public QCustomRasterPaintDevice public: ~QDirectFBPaintDevice(); - IDirectFBSurface *directFBSurface() const; + virtual IDirectFBSurface *directFBSurface() const; void lockDirectFB(DFBSurfaceLockFlags lock); void unlockDirectFB(); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 664c8a8..59fa191 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -496,14 +496,6 @@ void QDirectFBScreen::setSurfaceColorTable(IDirectFBSurface *surface, #endif // QT_NO_DIRECTFB_PALETTE -#ifndef QT_NO_QWS_CURSOR -#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR -#define QT_DIRECTFB_CURSOR -#elif defined QT_DIRECTFB_LAYER -#define QT_DIRECTFB_CURSOR -#endif -#endif - #if defined QT_DIRECTFB_CURSOR class Q_GUI_EXPORT QDirectFBScreenCursor : public QScreenCursor { @@ -1279,12 +1271,10 @@ bool QDirectFBScreen::initDevice() } #endif -#ifndef QT_NO_QWS_CURSOR -#if defined QT_NO_DIRECTFB_WM || defined QT_NO_DIRECTFB_LAYER - QScreenCursor::initSoftwareCursor(); -#else +#ifdef QT_DIRECTFB_CURSOR qt_screencursor = new QDirectFBScreenCursor; -#endif +#elif !defined QT_NO_QWS_CURSOR + QScreenCursor::initSoftwareCursor(); #endif return true; } @@ -1344,17 +1334,18 @@ QWSWindowSurface *QDirectFBScreen::createSurface(const QString &key) const // window surfaces. Normal, directFB surfaces are handled by DirectFB. void QDirectFBScreen::exposeRegion(QRegion r, int changing) { -#ifdef QT_NO_DIRECTFB_WM +#if defined QT_NO_DIRECTFB_WM const QList windows = QWSServer::instance()->clientWindows(); - if (changing < 0 || changing >= windows.size()) + if (changing < 0 || changing >= windows.size()) { return; - + } QWSWindow *win = windows.at(changing); QWSWindowSurface *s = win->windowSurface(); r &= region(); - if (r.isEmpty()) + if (r.isEmpty()) { return; + } const QRect brect = r.boundingRect(); @@ -1372,15 +1363,18 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing) ? static_cast(s) : 0; if (dfbWindowSurface) { IDirectFBSurface *surface = dfbWindowSurface->directFBSurface(); + Q_ASSERT(surface); const int n = insideWindow.numRects(); if (n == 1 || d_ptr->directFBFlags & BoundingRectFlip) { const QRect source = (insideWindow.boundingRect().intersected(windowGeometry)).translated(-windowGeometry.topLeft()); const DFBRectangle rect = { source.x(), source.y(), source.width(), source.height() }; + d_ptr->primarySurface->Blit(d_ptr->primarySurface, surface, &rect, windowGeometry.x() + source.x(), windowGeometry.y() + source.y()); + } else { const QVector rects = insideWindow.rects(); QVarLengthArray dfbRectangles(n); @@ -1403,6 +1397,7 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing) } } +#ifdef QT_NO_DIRECTFB_CURSOR if (QScreenCursor *cursor = QScreenCursor::instance()) { const QRect cursorRectangle = cursor->boundingRect(); if (cursor->isVisible() && !cursor->isAccelerated() && cursorRectangle.intersects(brect)) { @@ -1416,6 +1411,7 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing) #endif } } +#endif flipSurface(d_ptr->primarySurface, d_ptr->flipFlags, r, QPoint()); #else Q_UNUSED(r); @@ -1433,8 +1429,8 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion ®ion) return; d_ptr->primarySurface->SetColor(d_ptr->primarySurface, - color.red(), color.green(), color.blue(), - color.alpha()); + color.red(), color.green(), color.blue(), + color.alpha()); const int n = region.numRects(); if (n > 1) { const QRect r = region.boundingRect(); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 14fde86..e74adb1 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -87,6 +87,16 @@ QT_MODULE(Gui) #if !defined QT_NO_DIRECTFB_OPAQUE_DETECTION && !defined QT_DIRECTFB_OPAQUE_DETECTION #define QT_DIRECTFB_OPAQUE_DETECTION #endif +#ifndef QT_NO_QWS_CURSOR +#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR +#define QT_DIRECTFB_CURSOR +#elif defined QT_DIRECTFB_LAYER +#define QT_DIRECTFB_CURSOR +#endif +#endif +#ifndef QT_DIRECTFB_CURSOR +#define QT_NO_DIRECTFB_CURSOR +#endif #if defined QT_NO_DIRECTFB_LAYER && defined QT_DIRECTFB_WM #error QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM #endif diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 82c8a41..73a6dd7 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -54,9 +54,9 @@ QT_BEGIN_NAMESPACE QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr) : QDirectFBPaintDevice(scr) + , sibling(0) #ifndef QT_NO_DIRECTFB_WM , dfbWindow(0) - , sibling(0) #endif , flipFlags(flip) , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) @@ -73,9 +73,9 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr, QWidget *widget) : QWSWindowSurface(widget), QDirectFBPaintDevice(scr) + , sibling(0) #ifndef QT_NO_DIRECTFB_WM , dfbWindow(0) - , sibling(0) #endif , flipFlags(flip) , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) @@ -247,23 +247,16 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) QByteArray QDirectFBWindowSurface::permanentState() const { -#ifdef QT_DIRECTFB_WM QByteArray state(sizeof(this), 0); *reinterpret_cast(state.data()) = this; return state; -#endif - return QByteArray(); } void QDirectFBWindowSurface::setPermanentState(const QByteArray &state) { -#ifdef QT_DIRECTFB_WM if (state.size() == sizeof(this)) { sibling = *reinterpret_cast(state.constData()); } -#else - Q_UNUSED(state); -#endif } static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) @@ -385,6 +378,7 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion ®ion, } } +#ifdef QT_NO_DIRECTFB_CURSOR if (QScreenCursor *cursor = QScreenCursor::instance()) { const QRect cursorRectangle = cursor->boundingRect(); if (cursor->isVisible() && !cursor->isAccelerated() @@ -400,6 +394,7 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion ®ion, #endif } } +#endif if (mode == Offscreen) { screen->flipSurface(primarySurface, flipFlags, region, offset + windowGeometry.topLeft()); } else @@ -428,6 +423,14 @@ void QDirectFBWindowSurface::endPaint(const QRegion &) unlockDirectFB(); } +IDirectFBSurface *QDirectFBWindowSurface::directFBSurface() const +{ + if (!dfbSurface && sibling && sibling->dfbSurface) + return sibling->dfbSurface; + return dfbSurface; +} + + IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget, QRect *rect) const { Q_ASSERT(widget); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index bb81e1a..ca76613 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -92,12 +92,14 @@ public: void endPaint(const QRegion &); IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; + IDirectFBSurface *directFBSurface() const; private: void updateFormat(); + QDirectFBWindowSurface *sibling; + #ifdef QT_DIRECTFB_WM void createWindow(); IDirectFBWindow *dfbWindow; - QDirectFBWindowSurface *sibling; #else enum Mode { Primary, -- cgit v0.12 From 709c4df621f637bc81127e7c1a8bd59d0f2f04e4 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 31 Aug 2009 13:59:37 -0700 Subject: More DirectFB ifdef cleanup. Make sure the plugin builds but doesn't do anything when configured without -plugin-gfx-directfb Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp | 4 ++-- src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h | 1 + src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp | 4 ++-- src/plugins/gfxdrivers/directfb/qdirectfbmouse.h | 1 + src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 3 ++- src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h | 2 ++ 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp index 2bf1614..f207ebc 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp @@ -41,6 +41,8 @@ #include "qdirectfbkeyboard.h" +#ifndef QT_NO_QWS_DIRECTFB + #include "qdirectfbscreen.h" #include #include @@ -51,8 +53,6 @@ #include #include -#ifndef QT_NO_QWS_DIRECTFB - QT_BEGIN_NAMESPACE class KeyMap : public QHash diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h index 826de3b..96d73ac 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h @@ -42,6 +42,7 @@ #ifndef QDIRECTFBKEYBOARD_H #define QDIRECTFBKEYBOARD_H +#include #include #ifndef QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp index 074904f..2fb1520 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp @@ -41,6 +41,8 @@ #include "qdirectfbmouse.h" +#ifndef QT_NO_QWS_DIRECTFB + #include "qdirectfbscreen.h" #include @@ -49,8 +51,6 @@ #include #include -#ifndef QT_NO_QWS_DIRECTFB - QT_BEGIN_NAMESPACE class QDirectFBMouseHandlerPrivate : public QObject diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h index fcb995e..5ef229c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h @@ -42,6 +42,7 @@ #ifndef QDIRECTFBMOUSE_H #define QDIRECTFBMOUSE_H +#include #include #ifndef QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index ee63842..0717020 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -41,6 +41,8 @@ #include "qdirectfbpixmap.h" +#ifndef QT_NO_QWS_DIRECTFB + #include "qdirectfbscreen.h" #include "qdirectfbpaintengine.h" @@ -48,7 +50,6 @@ #include #include -#ifndef QT_NO_QWS_DIRECTFB QT_BEGIN_NAMESPACE diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h index 77364fd..7b4ae47 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h @@ -42,6 +42,8 @@ #ifndef QDIRECTFBPIXMAP_H #define QDIRECTFBPIXMAP_H +#include + #ifndef QT_NO_QWS_DIRECTFB #include -- cgit v0.12 From 4f72c6385b8d348611a907e6a8533de055188729 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 1 Sep 2009 09:34:08 +1000 Subject: be51485f missed some instances of qt_get_extension_funcs Reviewed-by: trustme --- src/opengl/qglextensions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp index e1ab6a4..a883c42 100644 --- a/src/opengl/qglextensions.cpp +++ b/src/opengl/qglextensions.cpp @@ -175,10 +175,10 @@ bool qt_resolve_glsl_extensions(QGLContext *ctx) #if defined(QT_OPENGL_ES_2) // The GLSL shader functions are always present in OpenGL/ES 2.0. // The only exceptions are glGetProgramBinaryOES and glProgramBinaryOES. - if (!QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glslResolved) { + if (!QGLContextPrivate::extensionFuncs(ctx).qt_glslResolved) { glGetProgramBinaryOES = (_glGetProgramBinaryOES) ctx->getProcAddress(QLatin1String("glGetProgramBinaryOES")); glProgramBinaryOES = (_glProgramBinaryOES) ctx->getProcAddress(QLatin1String("glProgramBinaryOES")); - QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glslResolved = true; + QGLContextPrivate::extensionFuncs(ctx).qt_glslResolved = true; } return true; #else -- cgit v0.12 From 8ff041dab354609b730849320f4f31659089b37e Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 1 Sep 2009 09:55:11 +1000 Subject: OpenGL/ES 2.0 compilation problem since QGLContextGroup changes Reviewed-by: trustme --- src/opengl/qglshaderprogram.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 61d8b10..c4d9322 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -1094,6 +1094,12 @@ QByteArray QGLShaderProgram::programBinary(int *format) const if (!isLinked()) return QByteArray(); + QGLContextGroup *ctx = d->ctx; +#ifndef QT_NO_DEBUG + if (!qt_check_sharing_with_current_context(ctx)) + qWarning("QGLShaderProgram::programBinary: Program is not associated with current context."); +#endif + // Get the length of the binary data, bailing out if there is none. GLint length = 0; glGetProgramiv(d->program, GL_PROGRAM_BINARY_LENGTH_OES, &length); @@ -1124,6 +1130,12 @@ QByteArray QGLShaderProgram::programBinary(int *format) const bool QGLShaderProgram::setProgramBinary(int format, const QByteArray& binary) { #if defined(QT_OPENGL_ES_2) + QGLContextGroup *ctx = d->ctx; +#ifndef QT_NO_DEBUG + if (!qt_check_sharing_with_current_context(ctx)) + qWarning("QGLShaderProgram::setProgramBinary: Program is not associated with current context."); +#endif + // Load the binary and check that it was linked correctly. glProgramBinaryOES(d->program, (GLenum)format, binary.constData(), binary.size()); -- cgit v0.12 From d1bb06923e825ac7079863d15d0d946d4c5aa19c Mon Sep 17 00:00:00 2001 From: Peter Yard Date: Mon, 31 Aug 2009 13:17:16 +1000 Subject: Added description of visualIndex condition to docs for logicalIndex() Fix for task: 214373 --- src/gui/itemviews/qheaderview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index a1c3e4e..4dbd6dc 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -1047,7 +1047,9 @@ int QHeaderView::visualIndex(int logicalIndex) const /*! Returns the logicalIndex for the section at the given \a visualIndex - position, or -1 otherwise. + position, or -1 if visualIndex < 0 or visualIndex >= QHeaderView::count(). + + Note that the visualIndex is not affected by hidden sections. \sa visualIndex(), sectionPosition() */ -- cgit v0.12 From 397fb3ece0fb556bc158cf1e826145196d2e6e95 Mon Sep 17 00:00:00 2001 From: Peter Yard Date: Tue, 1 Sep 2009 10:02:56 +1000 Subject: Doc for QSslError constructor parameters fixed each cons. --- src/network/ssl/qsslerror.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp index 69d2ccd..d47c91d 100644 --- a/src/network/ssl/qsslerror.cpp +++ b/src/network/ssl/qsslerror.cpp @@ -105,10 +105,8 @@ public: }; /*! - Constructs a QSslError object. The two optional arguments specify the \a - error that occurred, and which \a certificate the error relates to. + Constructs a QSslError object with no error and default certificate. - \sa QSslCertificate */ // RVCT compiler in debug build does not like about default values in const- @@ -120,6 +118,11 @@ QSslError::QSslError() d->certificate = QSslCertificate(); } +/*! + Constructs a QSslError object. The argument specifies the \a + error that occurred. + +*/ QSslError::QSslError(SslError error) : d(new QSslErrorPrivate) { @@ -127,6 +130,12 @@ QSslError::QSslError(SslError error) d->certificate = QSslCertificate(); } +/*! + Constructs a QSslError object. The two arguments specify the \a + error that occurred, and which \a certificate the error relates to. + + \sa QSslCertificate +*/ QSslError::QSslError(SslError error, const QSslCertificate &certificate) : d(new QSslErrorPrivate) { -- cgit v0.12 From 7a5d0d0b9f8b9203aa3921b2eb9fd7c77095c685 Mon Sep 17 00:00:00 2001 From: Keith Isdale Date: Mon, 31 Aug 2009 17:18:10 +1000 Subject: Update the qmake autotest: re MSVC test failure findMocs and findDeps When MSVC is used the default DESTDIR makes use a release/debug suffix. For these tests DESTDIR needs to be "."/ Minor code cleanup was done whilst correcting these effected .pro files Reviewed-by: Lincoln Ramsay --- tests/auto/qmake/testdata/findDeps/findDeps.pro | 7 ++----- tests/auto/qmake/testdata/findMocs/findMocs.pro | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/auto/qmake/testdata/findDeps/findDeps.pro b/tests/auto/qmake/testdata/findDeps/findDeps.pro index e0a2b86..43577b5 100644 --- a/tests/auto/qmake/testdata/findDeps/findDeps.pro +++ b/tests/auto/qmake/testdata/findDeps/findDeps.pro @@ -1,11 +1,8 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Thu Mar 12 11:08:20 2009 -###################################################################### - TEMPLATE = app -TARGET = +TARGET = findDeps DEPENDPATH += . INCLUDEPATH += . +DESTDIR = ./ # Input HEADERS += object1.h \ diff --git a/tests/auto/qmake/testdata/findMocs/findMocs.pro b/tests/auto/qmake/testdata/findMocs/findMocs.pro index daa3c7f..1469b4c 100644 --- a/tests/auto/qmake/testdata/findMocs/findMocs.pro +++ b/tests/auto/qmake/testdata/findMocs/findMocs.pro @@ -1,11 +1,8 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Wed Mar 11 16:11:09 2009 -###################################################################### - TEMPLATE = app -TARGET = +TARGET = findMocs DEPENDPATH += . INCLUDEPATH += . +DESTDIR = ./ # Input HEADERS += object1.h object2.h object3.h object4.h object5.h object6.h object7.h -- cgit v0.12 From d80748df828b92f376ca779ab83776f3c9f53ce1 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 1 Sep 2009 11:21:30 +1000 Subject: Update QML doc style. --- tools/qdoc3/test/classic.css | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css index f97bdbe..c0bc3d47 100644 --- a/tools/qdoc3/test/classic.css +++ b/tools/qdoc3/test/classic.css @@ -251,45 +251,25 @@ span.string,span.char .qmlname { white-space: nowrap; - font-weight: bold; - font-size: 125%; } .qmltype { - font-weight: bold; - font-size: 125%; -} - -.qmlproto, .qmldoc { - // border-top: 1px solid #84b0c7; + text-align: center; + font-size: 160%; } .qmlproto { - padding: 0; - //background-color: #e4e4e4;//#d5e1e8; - //font-weight: bold; - //-webkit-border-top-left-radius: 8px; - //-webkit-border-top-right-radius: 8px; - //-moz-border-radius-topleft: 8px; - //-moz-border-radius-topright: 8px; + background-color: #eee; + border-width: 1px; + border-style: solid; + border-color: #ddd; + font-weight: bold; + padding: 6px 0px 6px 10px; + margin: 42px 0px 0px 0px; } .qmldoc { - border-top: 1px solid #e4e4e4; - //padding: 2px 5px; - //background-color: #eef3f5; - //border-top-width: 0; - //-webkit-border-bottom-left-radius: 8px; - //-webkit-border-bottom-right-radius: 8px; - //-moz-border-radius-bottomleft: 8px; - //-moz-border-radius-bottomright: 8px; -} - -.qmldoc p, .qmldoc dl, .qmldoc ul { - //margin: 6px 0; } *.qmlitem p { - //margin-top: 0px; - //margin-bottom: 0px; } -- cgit v0.12 From 28635d8aeefbd0aa807f333769a0ab9fea9324b0 Mon Sep 17 00:00:00 2001 From: Bill King Date: Tue, 1 Sep 2009 13:08:02 +1000 Subject: Fixes determination of end of odbc string on deficient driver Adds some cleanups (using QVarLengthArray), and reverting to the initial and correct calculation (when the driver doesn't deem fit to return SQL_NO_DATA). --- src/sql/drivers/odbc/qsql_odbc.cpp | 12 ++++---- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 41 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 742d596..2692c96 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -323,12 +323,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni colSize *= 2; // a tiny bit faster, since it saves a SQLGetData() call } } - char* buf = new char[colSize]; + QVarLengthArray buf(colSize); while (true) { r = SQLGetData(hStmt, column+1, unicode ? SQL_C_WCHAR : SQL_C_CHAR, - (SQLPOINTER)buf, + (SQLPOINTER)buf.data(), colSize, &lengthIndicator); if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) { @@ -343,11 +343,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni // colSize-1: remove 0 termination when there is more data to fetch int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-2 : colSize-1) : lengthIndicator; if (unicode) { - fieldVal += QString((QChar*) buf, rSize / 2); + fieldVal += QString((const QChar*) buf.constData(), rSize / 2); } else { - fieldVal += QString::fromAscii(buf, rSize); + fieldVal += QString::fromAscii(buf.constData(), rSize); } - if (lengthIndicator - fieldVal.size() <= 0) { + memset(buf.data(), 0, colSize); + if (lengthIndicator < colSize) { // workaround for Drivermanagers that don't return SQL_NO_DATA break; } @@ -359,7 +360,6 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni break; } } - delete[] buf; return fieldVal; } diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index a6b887a..e9a0670 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -180,6 +180,8 @@ private slots: void odbc_uintfield(); void odbc_bindBoolean_data() { generic_data("QODBC"); } void odbc_bindBoolean(); + void odbc_testqGetString_data() { generic_data("QODBC"); } + void odbc_testqGetString(); void oci_serverDetach_data() { generic_data("QOCI"); } void oci_serverDetach(); // For task 154518 @@ -347,6 +349,7 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db) << qTableName("numericfields") << qTableName("qtest_ibaseblobs") << qTableName("qtestBindBool") + << qTableName("testqGetString") << qTableName("qtest_sqlguid") << qTableName("uint_table") << qTableName("uint_test") @@ -2024,6 +2027,44 @@ void tst_QSqlDatabase::odbc_bindBoolean() QCOMPARE(q.value(1).toBool(), false); } +void tst_QSqlDatabase::odbc_testqGetString() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlQuery q(db); + QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("testqGetString") + "(id int, vcvalue varchar(65538))")); + + QString largeString; + largeString.fill('A', 65536); + + // Bind and insert + QVERIFY_SQL(q, prepare("INSERT INTO " + qTableName("testqGetString") + " VALUES(?, ?)")); + q.bindValue(0, 1); + q.bindValue(1, largeString); + QVERIFY_SQL(q, exec()); + q.bindValue(0, 2); + q.bindValue(1, largeString+QLatin1Char('B')); + QVERIFY_SQL(q, exec()); + q.bindValue(0, 3); + q.bindValue(1, largeString+QLatin1Char('B')+QLatin1Char('C')); + QVERIFY_SQL(q, exec()); + + // Retrive + QVERIFY_SQL(q, exec("SELECT id, vcvalue FROM " + qTableName("testqGetString") + " ORDER BY id")); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 1); + QCOMPARE(q.value(1).toString().length(), 65536); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 2); + QCOMPARE(q.value(1).toString().length(), 65537); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 3); + QCOMPARE(q.value(1).toString().length(), 65538); +} + + void tst_QSqlDatabase::mysql_multiselect() { QFETCH(QString, dbName); -- cgit v0.12 From ec581ee164cbdab1a321d44f0795a79d62faf569 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 1 Sep 2009 13:27:21 +1000 Subject: Update license headers. Reviewed-by: Trust Me --- tests/auto/qmargins/tst_qmargins.cpp | 27 ++++++++++----------- .../qtabletevent/device_information/main.cpp | 28 +++++++++++----------- .../qtabletevent/device_information/tabletwidget.h | 26 ++++++++++---------- .../manual/qtabletevent/event_compression/main.cpp | 28 +++++++++++----------- 4 files changed, 54 insertions(+), 55 deletions(-) diff --git a/tests/auto/qmargins/tst_qmargins.cpp b/tests/auto/qmargins/tst_qmargins.cpp index 070aa19..6ee2495 100644 --- a/tests/auto/qmargins/tst_qmargins.cpp +++ b/tests/auto/qmargins/tst_qmargins.cpp @@ -9,8 +9,8 @@ ** 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 either Technology Preview License Agreement or the -** Beta Release License Agreement. +** 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 @@ -21,25 +21,24 @@ ** 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.0, included in the file LGPL_EXCEPTION.txt in this +** 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. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ - #include #include diff --git a/tests/manual/qtabletevent/device_information/main.cpp b/tests/manual/qtabletevent/device_information/main.cpp index 0c2eda3..69867bc 100644 --- a/tests/manual/qtabletevent/device_information/main.cpp +++ b/tests/manual/qtabletevent/device_information/main.cpp @@ -3,14 +3,14 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the test suite module of the Qt Toolkit. +** This file is part of the test suite 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 either Technology Preview License Agreement or the -** Beta Release License Agreement. +** 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 @@ -21,20 +21,20 @@ ** 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.0, included in the file LGPL_EXCEPTION.txt in this +** 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. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/manual/qtabletevent/device_information/tabletwidget.h b/tests/manual/qtabletevent/device_information/tabletwidget.h index b16e9ed..d3ccb32 100644 --- a/tests/manual/qtabletevent/device_information/tabletwidget.h +++ b/tests/manual/qtabletevent/device_information/tabletwidget.h @@ -9,8 +9,8 @@ ** 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 either Technology Preview License Agreement or the -** Beta Release License Agreement. +** 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 @@ -21,20 +21,20 @@ ** 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.0, included in the file LGPL_EXCEPTION.txt in this +** 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. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/manual/qtabletevent/event_compression/main.cpp b/tests/manual/qtabletevent/event_compression/main.cpp index 3b869e3..26611d3 100644 --- a/tests/manual/qtabletevent/event_compression/main.cpp +++ b/tests/manual/qtabletevent/event_compression/main.cpp @@ -3,14 +3,14 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the test suite module of the Qt Toolkit. +** This file is part of the test suite 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 either Technology Preview License Agreement or the -** Beta Release License Agreement. +** 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 @@ -21,20 +21,20 @@ ** 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.0, included in the file LGPL_EXCEPTION.txt in this +** 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. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ -- cgit v0.12 From b2d9dc8c487a8b87347a7d45a6c4f9dc827ddbfe Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 1 Sep 2009 13:57:30 +1000 Subject: Add #define's for highp/mediump after #version/#extension headers GLSL shaders require that #version and #extension must appear before any other code. The #define's we insert for highp/mediump/etc must therefore be moved down to just after them. Reviewed-by: Gunnar Sletta --- src/opengl/qglshaderprogram.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index c4d9322..56b55d0 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -501,6 +501,25 @@ bool QGLShader::compile(const char *source) return d->compile(this); } else if (d->shader) { QVarLengthArray src; + int headerLen = 0; + while (source && source[headerLen] == '#') { + // Skip #version and #extension directives at the start of + // the shader code. We need to insert the qualifierDefines + // and redefineHighp just after them. + if (qstrncmp(source + headerLen, "#version", 8) != 0 && + qstrncmp(source + headerLen, "#extension", 10) != 0) { + break; + } + while (source[headerLen] != '\0' && source[headerLen] != '\n') + ++headerLen; + if (source[headerLen] == '\n') + ++headerLen; + } + QByteArray header; + if (headerLen > 0) { + header = QByteArray(source, headerLen); + src.append(header.constData()); + } #ifdef QGL_DEFINE_QUALIFIERS src.append(qualifierDefines); #endif @@ -509,7 +528,7 @@ bool QGLShader::compile(const char *source) d->shaderType == PartialFragmentShader) src.append(redefineHighp); #endif - src.append(source); + src.append(source + headerLen); QGLContextGroup *ctx = d->ctx; glShaderSource(d->shader, src.size(), src.data(), 0); return d->compile(this); -- cgit v0.12 From 632c430a70e2aa50d57c80e35e15391f0b859749 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 1 Sep 2009 09:58:30 +0200 Subject: doc: Fixed several qdoc errors. Also removed four function declarations from QMargins that had no definitions. --- src/corelib/tools/qmargins.cpp | 8 +++----- src/corelib/tools/qmargins.h | 5 ----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index df08da1..747ea5e 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE \class QMargins \ingroup painting - \brief The QMargins + \brief The QMargins class defines the four margins of a rectangle. QMargin defines a set of four margins; left, top, right and bottom, that describe the size of the borders surrounding a rectangle. @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE Constructs a margins object with all margins set to 0. - \sa isValid() + \sa isNull() */ /*! @@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE Constructs margins with the given \a left, \a top, \a right, \a bottom - \sa setWidth(), setHeight() + \sa setLeft(), setRight(), setTop(), setBottom() */ /*! @@ -86,8 +86,6 @@ QT_BEGIN_NAMESPACE Returns true if all margins are is 0; otherwise returns false. - - \sa isValid(), isEmpty() */ diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h index be918cc..2691c62 100644 --- a/src/corelib/tools/qmargins.h +++ b/src/corelib/tools/qmargins.h @@ -68,11 +68,6 @@ public: void setRight(int right); void setBottom(int bottom); - int &rleft(); - int &rtop(); - int &rright(); - int &rbottom(); - private: int m_left; int m_top; -- cgit v0.12 From 76d18f5f06f55c7f908ceb9fba4cac41c0c852f8 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 31 Aug 2009 20:27:13 +0200 Subject: QMetaObject::normalizeType: fix out-of-bound access. As reported in merge request 1375 Also use QVarLenghtArray instead of manually allocated char* Reviewed-by: Thierry --- src/corelib/kernel/qmetaobject.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 30f1cc8..c311465 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -943,7 +943,7 @@ QByteArray QMetaObject::normalizedType(const char *type) if (!type || !*type) return result; - QVarLengthArray stackbuf((int)strlen(type)); + QVarLengthArray stackbuf(int(strlen(type)) + 1); qRemoveWhitespace(type, stackbuf.data()); int templdepth = 0; qNormalizeType(stackbuf.data(), templdepth, result); @@ -968,10 +968,9 @@ QByteArray QMetaObject::normalizedSignature(const char *method) if (!method || !*method) return result; int len = int(strlen(method)); - char stackbuf[64]; - char *buf = (len >= 64 ? new char[len+1] : stackbuf); - qRemoveWhitespace(method, buf); - char *d = buf; + QVarLengthArray stackbuf(len + 1); + char *d = stackbuf.data(); + qRemoveWhitespace(method, d); result.reserve(len); @@ -987,8 +986,6 @@ QByteArray QMetaObject::normalizedSignature(const char *method) result += *d++; } - if (buf != stackbuf) - delete [] buf; return result; } -- cgit v0.12 From 16edcd5ff94ecc731146e3703aaf25cd6bb3fb67 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Tue, 1 Sep 2009 10:14:07 +0200 Subject: Implement QSslCertificate::version() and QSslCertificate::serialNumber() Task-number: 251830 Merge-request: 1383 Reviewed-by: Peter Hartmann --- src/network/ssl/qsslcertificate.cpp | 8 ++++++++ src/network/ssl/qsslsocket_openssl_symbols.cpp | 2 ++ src/network/ssl/qsslsocket_openssl_symbols_p.h | 1 + 3 files changed, 11 insertions(+) diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 666770d..5db6d0a 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -250,6 +250,10 @@ void QSslCertificate::clear() */ QByteArray QSslCertificate::version() const { + if (d->versionString.isEmpty() && d->x509) + d->versionString = + QByteArray::number( qlonglong(q_ASN1_INTEGER_get( d->x509->cert_info->version )) ); + return d->versionString; } @@ -258,6 +262,10 @@ QByteArray QSslCertificate::version() const */ QByteArray QSslCertificate::serialNumber() const { + if (d->serialNumberString.isEmpty() && d->x509) + d->serialNumberString = + QByteArray::number( qlonglong(q_ASN1_INTEGER_get( d->x509->cert_info->serialNumber )) ); + return d->serialNumberString; } diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 5b04a57..d3dcd51 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -94,6 +94,7 @@ QT_BEGIN_NAMESPACE #ifdef SSLEAY_MACROS DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, return 0, return) #endif +DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return) DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return) DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return) DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return) @@ -608,6 +609,7 @@ bool q_resolveOpenSslSymbols() #ifdef SSLEAY_MACROS RESOLVEFUNC(ASN1_dup) #endif + RESOLVEFUNC(ASN1_INTEGER_get) RESOLVEFUNC(ASN1_STRING_data) RESOLVEFUNC(ASN1_STRING_length) RESOLVEFUNC(BIO_ctrl) diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index f9c92e5..30762ca 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -201,6 +201,7 @@ QT_BEGIN_NAMESPACE #endif // !defined QT_LINKED_OPENSSL bool q_resolveOpenSslSymbols(); +long q_ASN1_INTEGER_get(ASN1_INTEGER *a); unsigned char * q_ASN1_STRING_data(ASN1_STRING *a); int q_ASN1_STRING_length(ASN1_STRING *a); long q_BIO_ctrl(BIO *a, int b, long c, void *d); -- cgit v0.12 From 8f1596ae9b64870c54958611552c71b0b390038f Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Tue, 1 Sep 2009 10:14:08 +0200 Subject: QSslCertificate: Add + 1 to serialNumber Merge-request: 1383 Reviewed-by: Peter Hartmann --- src/network/ssl/qsslcertificate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 5db6d0a..c128da9 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -252,7 +252,7 @@ QByteArray QSslCertificate::version() const { if (d->versionString.isEmpty() && d->x509) d->versionString = - QByteArray::number( qlonglong(q_ASN1_INTEGER_get( d->x509->cert_info->version )) ); + QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version))); return d->versionString; } @@ -264,7 +264,7 @@ QByteArray QSslCertificate::serialNumber() const { if (d->serialNumberString.isEmpty() && d->x509) d->serialNumberString = - QByteArray::number( qlonglong(q_ASN1_INTEGER_get( d->x509->cert_info->serialNumber )) ); + QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->serialNumber)) + 1); return d->serialNumberString; } -- cgit v0.12