From 21e2cde622078333cedb650d62cb17b2f91d02c7 Mon Sep 17 00:00:00 2001 From: Peter Yard Date: Tue, 27 Oct 2009 12:49:43 +1000 Subject: Add documentation on RPATH defines. --- doc/src/development/qmake-manual.qdoc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index d040d3d991..6c53242d29 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -2341,6 +2341,11 @@ For example: of this variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \section1 QMAKE_LFLAGS_RPATH + + Library paths in this definition are added to the executable at link + time so that the added paths will be preferentially searched at runtime. + \section1 QMAKE_LFLAGS_QT_DLL This variable contains link flags when building programs that @@ -2667,6 +2672,16 @@ For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 45 + \section1 QMAKE_RPATH + + Is equivalent to \l QMAKE_LFLAGS_RPATH. + + \section1 QMAKE_RPATHDIR + + A list of library directory paths, these paths are added to the + executable at link time so that the paths will be preferentially + searched at runtime. + \section1 QMAKE_RUN_CC This variable specifies the individual rule needed to build an object. -- cgit v1.2.3 From ea139224d49a543cbd09fff450df101720095307 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Tue, 27 Oct 2009 14:50:57 +0100 Subject: Fix for Gtk+ toolbuttons and sliders. Maemo5 looks very weird without these patches. Reviewed-By: jbache --- src/gui/styles/gtksymbols.cpp | 3 +++ src/gui/styles/gtksymbols_p.h | 2 ++ src/gui/styles/qgtkstyle.cpp | 36 +++++++++++++++++++++++++++++------- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index 6ec5796ca0..32fde628d5 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -98,6 +98,7 @@ Ptr_gtk_check_menu_item_new QGtk::gtk_check_menu_item_new = 0; Ptr_gtk_menu_bar_new QGtk::gtk_menu_bar_new = 0; Ptr_gtk_menu_new QGtk::gtk_menu_new = 0; Ptr_gtk_button_new QGtk::gtk_button_new = 0; +Ptr_gtk_tool_button_new QGtk::gtk_tool_button_new = 0; Ptr_gtk_hbutton_box_new QGtk::gtk_hbutton_box_new = 0; Ptr_gtk_check_button_new QGtk::gtk_check_button_new = 0; Ptr_gtk_radio_button_new QGtk::gtk_radio_button_new = 0; @@ -266,6 +267,7 @@ static void resolveGtk() QGtk::gtk_separator_tool_item_new = (Ptr_gtk_separator_tool_item_new)libgtk.resolve("gtk_separator_tool_item_new"); QGtk::gtk_toolbar_insert = (Ptr_gtk_toolbar_insert)libgtk.resolve("gtk_toolbar_insert"); QGtk::gtk_button_new = (Ptr_gtk_button_new)libgtk.resolve("gtk_button_new"); + QGtk::gtk_tool_button_new = (Ptr_gtk_tool_button_new)libgtk.resolve("gtk_tool_button_new"); QGtk::gtk_hbutton_box_new = (Ptr_gtk_hbutton_box_new)libgtk.resolve("gtk_hbutton_box_new"); QGtk::gtk_check_button_new = (Ptr_gtk_check_button_new)libgtk.resolve("gtk_check_button_new"); QGtk::gtk_radio_button_new = (Ptr_gtk_radio_button_new)libgtk.resolve("gtk_radio_button_new"); @@ -717,6 +719,7 @@ void QGtk::initGtkWidgets() GtkWidget *gtkButton = QGtk::gtk_button_new(); add_widget(gtkButton); g_signal_connect(gtkButton, "style-set", G_CALLBACK(gtkStyleSetCallback), NULL); + add_widget(QGtk::gtk_tool_button_new(NULL, NULL)); add_widget(QGtk::gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE)); add_widget(QGtk::gtk_hbutton_box_new()); add_widget(QGtk::gtk_check_button_new()); diff --git a/src/gui/styles/gtksymbols_p.h b/src/gui/styles/gtksymbols_p.h index 313d948805..2cf21ce8cc 100644 --- a/src/gui/styles/gtksymbols_p.h +++ b/src/gui/styles/gtksymbols_p.h @@ -96,6 +96,7 @@ typedef GtkWidget* (*Ptr_gtk_combo_box_entry_new)(void); typedef GtkWidget* (*Ptr_gtk_toolbar_new)(void); typedef GtkWidget* (*Ptr_gtk_spin_button_new)(GtkAdjustment*, double, int); typedef GtkWidget* (*Ptr_gtk_button_new)(void); +typedef GtkWidget* (*Ptr_gtk_tool_button_new)(GtkWidget *, const gchar *); typedef GtkWidget* (*Ptr_gtk_hbutton_box_new)(void); typedef GtkWidget* (*Ptr_gtk_check_button_new)(void); typedef GtkWidget* (*Ptr_gtk_radio_button_new)(GSList *); @@ -261,6 +262,7 @@ public: static Ptr_gtk_menu_new gtk_menu_new; static Ptr_gtk_expander_new gtk_expander_new; static Ptr_gtk_button_new gtk_button_new; + static Ptr_gtk_tool_button_new gtk_tool_button_new; static Ptr_gtk_hbutton_box_new gtk_hbutton_box_new; static Ptr_gtk_check_button_new gtk_check_button_new; static Ptr_gtk_radio_button_new gtk_radio_button_new; diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 414580e874..d315c9846c 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -1035,15 +1035,24 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, } break; - case PE_PanelButtonCommand: { + case PE_PanelButtonCommand: + case PE_PanelButtonTool: { bool isDefault = false; + bool isTool = (element == PE_PanelButtonTool); if (const QStyleOptionButton *btn = qstyleoption_cast(option)) isDefault = btn->features & QStyleOptionButton::DefaultButton; + // don't draw a frame for tool buttons that have the autoRaise flag and are not enabled or on + if (isTool && !(option->state & State_Enabled || option->state & State_On) && (option->state & State_AutoRaise)) + break; + // don't draw a frame for dock widget buttons, unless we are hovering + if (widget && widget->inherits("QDockWidgetTitleButton") && !(option->state & State_MouseOver)) + break; + GtkStateType state = gtkPainter.gtkState(option); if (option->state & State_On || option->state & State_Sunken) state = GTK_STATE_ACTIVE; - GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = QGtk::gtkWidget(isTool ? QLS("GtkToolButton.GtkButton") : QLS("GtkButton")); gint focusWidth, focusPad; gboolean interiorFocus = false; QGtk::gtk_widget_style_get (gtkButton, @@ -1555,7 +1564,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QStyleOptionToolButton label = *toolbutton; label.state = bflags; - GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkToolButton.GtkButton")); QPalette pal = toolbutton->palette; if (option->state & State_Enabled && option->state & State_MouseOver && !(widget && widget->testAttribute(Qt::WA_SetPalette))) { @@ -1931,13 +1940,26 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if (!QGtk::gtk_check_version(2, 10, 0)) QGtk::gtk_widget_style_get((GtkWidget*)(scaleWidget), "trough-side-details", &trough_side_details, NULL); - if (trough_side_details && horizontal) { //### Vertical sliders look broken with this for some reason + if (!trough_side_details) { + gtkPainter.paintBox( scaleWidget, "trough", grooveRect, state, + GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition)); + } else { + QRect upperGroove = grooveRect; QRect lowerGroove = grooveRect; - lowerGroove.setRight(handle.center().x()); + + if (horizontal) { + upperGroove.setLeft(handle.center().x()); + lowerGroove.setRight(handle.center().x()); + } else { + upperGroove.setBottom(handle.center().y()); + lowerGroove.setTop(handle.center().y()); + } + + gtkPainter.paintBox( scaleWidget, "trough-upper", upperGroove, state, + GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition)); gtkPainter.paintBox( scaleWidget, "trough-lower", lowerGroove, state, GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition)); } - } if (option->subControls & SC_SliderTickmarks) { @@ -3116,7 +3138,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, case CT_ToolButton: if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast(option)) { - GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkToolButton.GtkButton")); newSize = size + QSize(2 * gtkButton->style->xthickness, 1 + 2 * gtkButton->style->ythickness); if (widget && qobject_cast(widget->parentWidget())) { QSize minSize(0, 25); -- cgit v1.2.3 From 27d5b8764980cbccab29cb86e10751a4e5937d01 Mon Sep 17 00:00:00 2001 From: Donald Carr Date: Tue, 27 Oct 2009 17:25:58 +0000 Subject: Guard shadow builds against stale qconfig.cpp qconfig.cpp is generated immediately after accepting the licensing agreement, and contains all the fixed paths qt uses. If this file is present in a source dir used by shadow builds, this qconfig.cpp will take precedence over the shadow builds qconfig.cpp and hence impose its paths throughout the shadow built Qt. This change adds qconfig.cpp to the list of generated files to guard against existing in the source directory when performing a shadow build. Reviewed-by: Thiago Macieira --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 035bd4a303..08ec524c39 100755 --- a/configure +++ b/configure @@ -2140,7 +2140,7 @@ if [ "$OPT_SHADOW" = "maybe" ]; then fi fi if [ "$OPT_SHADOW" = "yes" ]; then - if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" ]; then + if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then echo >&2 "You cannot make a shadow build from a source tree containing a previous build." echo >&2 "Cannot proceed." exit 1 -- cgit v1.2.3 From a8487d7cc197540ba08eeb249bd50defb70aab99 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 27 Oct 2009 20:35:53 +0100 Subject: Doc: Remove unused file. Reviewed-by: Trust Me --- tools/qdoc3/test/qt-inc.qdocconf | 149 --------------------------------------- 1 file changed, 149 deletions(-) delete mode 100644 tools/qdoc3/test/qt-inc.qdocconf diff --git a/tools/qdoc3/test/qt-inc.qdocconf b/tools/qdoc3/test/qt-inc.qdocconf deleted file mode 100644 index 2ff56822fc..0000000000 --- a/tools/qdoc3/test/qt-inc.qdocconf +++ /dev/null @@ -1,149 +0,0 @@ -include(compat.qdocconf) -include(macros.qdocconf) - -project = Qt -description = Qt Reference Documentation -url = http://qt.nokia.com/doc/4.6 - -edition.Desktop = QtCore QtGui QtNetwork QtOpenGL QtSql QtSvg QtXml QtScript \ - QtDesigner QtAssistant Qt3Support QAxContainer \ - QAxServer QtUiTools QtTest QtDBus -edition.DesktopLight = QtCore QtGui Qt3SupportLight QtTest - -language = Cpp - -norecursion = true -sources.fileextensions = "*.cpp *.qdoc" -sourcedirs = $QDOC_CURRENT_DIR -headerdirs = $QDOC_CURRENT_DIR -exampledirs = $QTDIR/doc/src \ - $QTDIR/examples \ - $QTDIR \ - $QTDIR/qmake/examples \ - $QTDIR/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QTDIR/doc/src/images \ - $QTDIR/examples -outputdir = $QTDIR/doc/html -indexdir = $QTDIR/doc/indexes -indexes = $QDOC_INPUT_INDEXES -outputindex = $QDOC_OUTPUT_INDEX -base = file:$QTDIR/doc/html -versionsym = QT_VERSION_STR -defines = Q_QDOC \ - QT_.*_SUPPORT \ - QT_.*_LIB \ - QT_COMPAT \ - QT_KEYPAD_NAVIGATION \ - QT3_SUPPORT \ - Q_WS_.* \ - Q_OS_.* \ - Q_BYTE_ORDER \ - __cplusplus - -codeindent = 1 -extraimages.HTML = qt-logo \ - trolltech-logo - -Cpp.ignoretokens = QAXFACTORY_EXPORT \ - QDESIGNER_COMPONENTS_LIBRARY \ - QDESIGNER_EXTENSION_LIBRARY \ - QDESIGNER_SDK_LIBRARY \ - QDESIGNER_SHARED_LIBRARY \ - QDESIGNER_UILIB_LIBRARY \ - QM_EXPORT_CANVAS \ - QM_EXPORT_DNS \ - QM_EXPORT_DOM \ - QM_EXPORT_FTP \ - QM_EXPORT_HTTP \ - QM_EXPORT_ICONVIEW \ - QM_EXPORT_NETWORK \ - QM_EXPORT_OPENGL \ - QM_EXPORT_SQL \ - QM_EXPORT_TABLE \ - QM_EXPORT_WORKSPACE \ - QM_EXPORT_XML \ - QT_ASCII_CAST_WARN \ - QT_BEGIN_HEADER \ - QT_DESIGNER_STATIC \ - QT_END_HEADER \ - QT_WIDGET_PLUGIN_EXPORT \ - Q_COMPAT_EXPORT \ - Q_CORE_EXPORT \ - Q_EXPLICIT \ - Q_EXPORT \ - Q_EXPORT_CODECS_CN \ - Q_EXPORT_CODECS_JP \ - Q_EXPORT_CODECS_KR \ - Q_EXPORT_PLUGIN \ - Q_GFX_INLINE \ - Q_GUI_EXPORT \ - Q_GUI_EXPORT_INLINE \ - Q_GUI_EXPORT_STYLE_CDE \ - Q_GUI_EXPORT_STYLE_COMPACT \ - Q_GUI_EXPORT_STYLE_MAC \ - Q_GUI_EXPORT_STYLE_MOTIF \ - Q_GUI_EXPORT_STYLE_MOTIFPLUS \ - Q_GUI_EXPORT_STYLE_PLATINUM \ - Q_GUI_EXPORT_STYLE_POCKETPC \ - Q_GUI_EXPORT_STYLE_SGI \ - Q_GUI_EXPORT_STYLE_WINDOWS \ - Q_GUI_EXPORT_STYLE_WINDOWSXP \ - Q_INLINE_TEMPLATE \ - Q_NETWORK_EXPORT \ - Q_OPENGL_EXPORT \ - Q_OUTOFLINE_TEMPLATE \ - Q_SQL_EXPORT \ - Q_SVG_EXPORT \ - Q_SCRIPT_EXPORT \ - Q_TESTLIB_EXPORT \ - Q_TYPENAME \ - Q_XML_EXPORT \ - QDBUS_EXPORT \ - Q_GADGET \ - QWEBKIT_EXPORT -Cpp.ignoredirectives = Q_DECLARE_HANDLE \ - Q_DECLARE_INTERFACE \ - Q_DECLARE_METATYPE \ - Q_DECLARE_OPERATORS_FOR_FLAGS \ - Q_DECLARE_PRIVATE \ - Q_DECLARE_PUBLIC \ - Q_DECLARE_SHARED \ - Q_DECLARE_TR_FUNCTIONS \ - Q_DECLARE_TYPEINFO \ - Q_DISABLE_COPY \ - Q_DUMMY_COMPARISON_OPERATOR \ - Q_ENUMS \ - Q_FLAGS \ - Q_INTERFACES \ - Q_OS_SYMBIAN \ - __attribute__ - -HTML.stylesheets = $QTDIR/util/qdoc3/test/classic.css -HTML.postheader = "\n" \ - "\n" \ - "\n" \ - "" \ - "\n" \ - "
" \ - "" \ - "  " \ - "" \ - "Home ·" \ - " " \ - "All Classes ·" \ - " " \ - "Main Classes ·" \ - " " \ - "Grouped Classes ·" \ - " " \ - "Modules ·" \ - " " \ - "Functions" \ - "
" - -HTML.footer = "


\n" \ - "\n" \ - "\n" \ - "\n" \ - "\n" \ - "
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt \\version
" -- cgit v1.2.3 From 1fafb913bfb1e8657598e7c9ce0b52e08d044732 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 27 Oct 2009 20:39:56 +0100 Subject: Doc: Fixed qdoc warning. Reviewed-by: Trust Me --- src/gui/graphicsview/qgraphicsitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index edd2d7c72d..2685b86e2f 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1228,7 +1228,7 @@ void QGraphicsItemCache::purge() } /*! - Constructs a QGraphicsItem, passing \a item to QGraphicsItem's constructor. + Constructs a QGraphicsItem with the given \a parent item. It does not modify the parent object returned by QObject::parent(). If \a parent is 0, you can add the item to a scene by calling -- cgit v1.2.3 From cb96099e126f50aaa9c8806c58892d0a62ded2b9 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 28 Oct 2009 11:31:32 +1000 Subject: Add 800x480 to the qvfb configuration dialog 800x480 is an increasingly common screen size on embedded devices, and specifying it via Custom sizes is annoying. Reviewed-by: Sarah Smith --- tools/qvfb/config.ui | 9 ++++++++- tools/qvfb/qvfb.cpp | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/qvfb/config.ui b/tools/qvfb/config.ui index ad9c39eaaf..b74bef7bbc 100644 --- a/tools/qvfb/config.ui +++ b/tools/qvfb/config.ui @@ -47,7 +47,7 @@ 0 0 600 - 665 + 690 @@ -117,6 +117,13 @@ + + + + 800x480 + + + diff --git a/tools/qvfb/qvfb.cpp b/tools/qvfb/qvfb.cpp index 59e8dae726..09692b7be9 100644 --- a/tools/qvfb/qvfb.cpp +++ b/tools/qvfb/qvfb.cpp @@ -669,6 +669,8 @@ void QVFb::configure() w=320; h=240; } else if ( config->size_640_480->isChecked() ) { w=640; h=480; + } else if ( config->size_800_480->isChecked() ) { + w=800; h=480; } else if ( config->size_800_600->isChecked() ) { w=800; h=600; } else if ( config->size_1024_768->isChecked() ) { @@ -748,6 +750,7 @@ void QVFb::chooseSize(const QSize& sz) config->size_240_320->setChecked(sz == QSize(240,320)); config->size_320_240->setChecked(sz == QSize(320,240)); config->size_640_480->setChecked(sz == QSize(640,480)); + config->size_800_480->setChecked(sz == QSize(800,480)); config->size_800_600->setChecked(sz == QSize(800,600)); config->size_1024_768->setChecked(sz == QSize(1024,768)); } -- cgit v1.2.3 From 1583d643285641bf71e6a107331d788acca9850c Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 28 Oct 2009 16:08:13 +1000 Subject: qdoc: Update QGraphicsTransform docs after changes to QGraphicsRotation Reviewed-by: Michael Brasser --- src/gui/graphicsview/qgraphicstransform.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp index 93dc1961e0..e2a3f08475 100644 --- a/src/gui/graphicsview/qgraphicstransform.cpp +++ b/src/gui/graphicsview/qgraphicstransform.cpp @@ -69,6 +69,9 @@ objects are applied to a QGraphicsItem, all of the transformations are computed in true 3D space, with the projection back to 2D only occurring after the last QGraphicsTransform is applied. + The exception to this is QGraphicsRotation, which projects back to + 2D after each rotation to preserve the perspective effect around + the X and Y axes. If you want to create your own configurable transformation, you can create a subclass of QGraphicsTransform (or any or the existing subclasses), and -- cgit v1.2.3 From 928bb6dfe9b3d5db9c7d669979ae6ccdf661df38 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 28 Oct 2009 08:41:31 +0100 Subject: Fix namespace build. At least Qt fails building with a namespace on Mac without this change. What happends is that inserting a namespace before the includes, will add the namespace twize if the included files also inserts the namespace. Rev-By: Alexis --- src/gui/kernel/qdesktopwidget.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qdesktopwidget.cpp b/src/gui/kernel/qdesktopwidget.cpp index b1e100879b..c6d500050a 100644 --- a/src/gui/kernel/qdesktopwidget.cpp +++ b/src/gui/kernel/qdesktopwidget.cpp @@ -40,12 +40,11 @@ ****************************************************************************/ #include "qglobal.h" - -QT_BEGIN_NAMESPACE - #include "qdesktopwidget.h" #include "qwidget_p.h" +QT_BEGIN_NAMESPACE + const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const { QRect rect = QWidgetPrivate::screenGeometry(widget); -- cgit v1.2.3 From 8cda1c6fef8bd9c4635743fae05158306c2ab09f Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 28 Oct 2009 09:38:21 +0100 Subject: Fix namespace build Looks like a couple of files missed the namespace macro... Rev-By: gunnar --- src/opengl/gl2paintengineex/qtriangulatingstroker.cpp | 4 ++++ src/opengl/gl2paintengineex/qtriangulatingstroker_p.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp index a3c8266e86..ec05020d4c 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp @@ -42,6 +42,7 @@ #include "qtriangulatingstroker_p.h" #include +QT_BEGIN_NAMESPACE #define CURVE_FLATNESS Q_PI / 8 @@ -338,3 +339,6 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen) m_dash_stroker.end(); } + +QT_END_NAMESPACE + diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h index b7354db5b3..483cea98d8 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h @@ -48,6 +48,7 @@ #include #include +QT_BEGIN_NAMESPACE class QTriangulatingStroker { @@ -295,5 +296,6 @@ void QTriangulatingStroker::join(const qreal *pts) emitLineSegment(m_cx, m_cy, m_nvx, m_nvy); } +QT_END_NAMESPACE #endif -- cgit v1.2.3 From 0533c709188d07be0c165838b503124cb6b271e1 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 26 Oct 2009 13:21:27 +0100 Subject: Say hello to QScriptProgram :-) QScriptProgram encapsulates a Qt Script program (AKA a script). It retains the compiled representation of the script, so that repeated evaluation of the same script becomes faster. An overload of QScriptEngine::evaluate() that takes a QScriptProgram has been added. Reviewed-by: Olivier Goffart --- src/script/api/api.pri | 3 + src/script/api/qscriptengine.cpp | 151 ++++++++------ src/script/api/qscriptengine.h | 3 + src/script/api/qscriptengine_p.h | 5 + src/script/api/qscriptprogram.cpp | 225 +++++++++++++++++++++ src/script/api/qscriptprogram.h | 86 ++++++++ src/script/api/qscriptprogram_p.h | 95 +++++++++ tests/auto/qscriptengine/tst_qscriptengine.cpp | 149 ++++++++++++++ .../qscriptengineagent/tst_qscriptengineagent.cpp | 86 ++++++++ .../benchmarks/qscriptengine/tst_qscriptengine.cpp | 19 +- 10 files changed, 763 insertions(+), 59 deletions(-) create mode 100644 src/script/api/qscriptprogram.cpp create mode 100644 src/script/api/qscriptprogram.h create mode 100644 src/script/api/qscriptprogram_p.h diff --git a/src/script/api/api.pri b/src/script/api/api.pri index 17ec9b6e08..aebadd5b1c 100644 --- a/src/script/api/api.pri +++ b/src/script/api/api.pri @@ -6,6 +6,7 @@ SOURCES += \ $$PWD/qscriptengine.cpp \ $$PWD/qscriptengineagent.cpp \ $$PWD/qscriptextensionplugin.cpp \ + $$PWD/qscriptprogram.cpp \ $$PWD/qscriptstring.cpp \ $$PWD/qscriptvalue.cpp \ $$PWD/qscriptvalueiterator.cpp \ @@ -23,6 +24,8 @@ HEADERS += \ $$PWD/qscriptengineagent_p.h \ $$PWD/qscriptextensioninterface.h \ $$PWD/qscriptextensionplugin.h \ + $$PWD/qscriptprogram.h \ + $$PWD/qscriptprogram_p.h \ $$PWD/qscriptstring.h \ $$PWD/qscriptstring_p.h \ $$PWD/qscriptvalue.h \ diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 928872333e..2b60a46a89 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -51,6 +51,8 @@ #include "qscriptvalue_p.h" #include "qscriptvalueiterator.h" #include "qscriptclass.h" +#include "qscriptprogram.h" +#include "qscriptprogram_p.h" #include "qdebug.h" #include @@ -1155,6 +1157,73 @@ void QScriptEnginePrivate::agentDeleted(QScriptEngineAgent *agent) } } +JSC::JSValue QScriptEnginePrivate::evaluateHelper(JSC::ExecState *exec, intptr_t sourceId, + JSC::EvalExecutable *executable, + bool &compile) +{ + Q_Q(QScriptEngine); + JSC::JSLock lock(false); // ### hmmm + QBoolBlocker inEvalBlocker(inEval, true); + q->currentContext()->activationObject(); //force the creation of a context for native function; + + JSC::Debugger* debugger = originalGlobalObject()->debugger(); + if (debugger) + debugger->evaluateStart(sourceId); + + q->clearExceptions(); + JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject()); + + if (compile) { + JSC::JSObject* error = executable->compile(exec, exec->scopeChain()); + if (error) { + compile = false; + exec->setException(error); + + if (debugger) { + debugger->exceptionThrow(JSC::DebuggerCallFrame(exec, error), sourceId, false); + debugger->evaluateStop(error, sourceId); + } + + return error; + } + } + + JSC::JSValue thisValue = thisForContext(exec); + JSC::JSObject* thisObject = (!thisValue || thisValue.isUndefinedOrNull()) + ? exec->dynamicGlobalObject() : thisValue.toObject(exec); + JSC::JSValue exceptionValue; + timeoutChecker()->setShouldAbort(false); + if (processEventsInterval > 0) + timeoutChecker()->reset(); + + JSC::JSValue result = exec->interpreter()->execute(executable, exec, thisObject, exec->scopeChain(), &exceptionValue); + + if (timeoutChecker()->shouldAbort()) { + if (abortResult.isError()) + exec->setException(scriptValueToJSCValue(abortResult)); + + if (debugger) + debugger->evaluateStop(scriptValueToJSCValue(abortResult), sourceId); + + return scriptValueToJSCValue(abortResult); + } + + if (exceptionValue) { + exec->setException(exceptionValue); + + if (debugger) + debugger->evaluateStop(exceptionValue, sourceId); + + return exceptionValue; + } + + if (debugger) + debugger->evaluateStop(result, sourceId); + + Q_ASSERT(!exec->hadException()); + return result; +} + #ifndef QT_NO_QOBJECT JSC::JSValue QScriptEnginePrivate::newQObject( @@ -2115,75 +2184,41 @@ QScriptSyntaxCheckResult QScriptEnginePrivate::checkSyntax(const QString &progra QScriptValue QScriptEngine::evaluate(const QString &program, const QString &fileName, int lineNumber) { Q_D(QScriptEngine); - - JSC::JSLock lock(false); // ### hmmm - QBoolBlocker inEval(d->inEval, true); - currentContext()->activationObject(); //force the creation of a context for native function; - - JSC::Debugger* debugger = d->originalGlobalObject()->debugger(); - - JSC::UString jscProgram = program; - JSC::UString jscFileName = fileName; - JSC::ExecState* exec = d->currentFrame; WTF::PassRefPtr provider - = QScript::UStringSourceProviderWithFeedback::create(jscProgram, jscFileName, lineNumber, d); + = QScript::UStringSourceProviderWithFeedback::create(program, fileName, lineNumber, d); intptr_t sourceId = provider->asID(); JSC::SourceCode source(provider, lineNumber); //after construction of SourceCode provider variable will be null. - if (debugger) - debugger->evaluateStart(sourceId); - - clearExceptions(); - JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject()); - + JSC::ExecState* exec = d->currentFrame; JSC::EvalExecutable executable(exec, source); - JSC::JSObject* error = executable.compile(exec, exec->scopeChain()); - if (error) { - exec->setException(error); - - if (debugger) { - debugger->exceptionThrow(JSC::DebuggerCallFrame(exec, error), sourceId, false); - debugger->evaluateStop(error, sourceId); - } - - return d->scriptValueFromJSCValue(error); - } - - JSC::JSValue thisValue = d->thisForContext(exec); - JSC::JSObject* thisObject = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec); - JSC::JSValue exceptionValue; - d->timeoutChecker()->setShouldAbort(false); - if (d->processEventsInterval > 0) - d->timeoutChecker()->reset(); - JSC::JSValue result = exec->interpreter()->execute(&executable, exec, thisObject, exec->scopeChain(), &exceptionValue); - - if (d->timeoutChecker()->shouldAbort()) { - if (d->abortResult.isError()) - exec->setException(d->scriptValueToJSCValue(d->abortResult)); - - if (debugger) - debugger->evaluateStop(d->scriptValueToJSCValue(d->abortResult), sourceId); - - return d->abortResult; - } - - if (exceptionValue) { - exec->setException(exceptionValue); - - if (debugger) - debugger->evaluateStop(exceptionValue, sourceId); + bool compile = true; + return d->scriptValueFromJSCValue(d->evaluateHelper(exec, sourceId, &executable, compile)); +} - return d->scriptValueFromJSCValue(exceptionValue); - } +/*! + \internal + \since 4.6 - if (debugger) - debugger->evaluateStop(result, sourceId); + Evaluates the given \a program and returns the result of the + evaluation. +*/ +QScriptValue QScriptEngine::evaluate(const QScriptProgram &program) +{ + Q_D(QScriptEngine); + QScriptProgramPrivate *program_d = QScriptProgramPrivate::get(program); + if (!program_d) + return QScriptValue(); - Q_ASSERT(!exec->hadException()); + JSC::ExecState* exec = d->currentFrame; + JSC::EvalExecutable *executable = program_d->executable(exec, d); + bool compile = !program_d->isCompiled; + JSC::JSValue result = d->evaluateHelper(exec, program_d->sourceId, + executable, compile); + if (compile) + program_d->isCompiled = true; return d->scriptValueFromJSCValue(result); } - /*! Returns the current context. diff --git a/src/script/api/qscriptengine.h b/src/script/api/qscriptengine.h index 701f9c69f3..3f438da142 100644 --- a/src/script/api/qscriptengine.h +++ b/src/script/api/qscriptengine.h @@ -67,6 +67,7 @@ class QDateTime; class QScriptClass; class QScriptEngineAgent; class QScriptEnginePrivate; +class QScriptProgram; #ifndef QT_NO_QOBJECT @@ -166,6 +167,8 @@ public: QScriptValue evaluate(const QString &program, const QString &fileName = QString(), int lineNumber = 1); + QScriptValue evaluate(const QScriptProgram &program); + bool isEvaluating() const; void abortEvaluation(const QScriptValue &result = QScriptValue()); diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index ec7c144016..d12b0f4a59 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -70,6 +70,7 @@ namespace JSC { + class EvalExecutable; class ExecState; typedef ExecState CallFrame; class JSCell; @@ -211,6 +212,10 @@ public: const QByteArray &targetType, void **result); + JSC::JSValue evaluateHelper(JSC::ExecState *exec, intptr_t sourceId, + JSC::EvalExecutable *executable, + bool &compile); + QScript::QObjectData *qobjectData(QObject *object); void disposeQObject(QObject *object); void emitSignalHandlerException(); diff --git a/src/script/api/qscriptprogram.cpp b/src/script/api/qscriptprogram.cpp new file mode 100644 index 0000000000..c30f381d86 --- /dev/null +++ b/src/script/api/qscriptprogram.cpp @@ -0,0 +1,225 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript 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 "config.h" +#include "qscriptprogram.h" +#include "qscriptprogram_p.h" +#include "qscriptengine.h" +#include "qscriptengine_p.h" + +#include "Executable.h" + +QT_BEGIN_NAMESPACE + +/*! + \internal + + \since 4.6 + \class QScriptProgram + + \brief The QScriptProgram class encapsulates a Qt Script program. + + \ingroup script + + QScriptProgram retains the compiled representation of the script if + possible. Thus, QScriptProgram can be used to evaluate the same + script multiple times more efficiently. + + \code + QScriptEngine engine; + QScriptProgram program("1 + 2"); + QScriptValue result = engine.evaluate(program); + \endcode +*/ + +QScriptProgramPrivate::QScriptProgramPrivate(const QString &src, + const QString &fn, + int ln) + : sourceCode(src), fileName(fn), firstLineNumber(ln), + engine(0), _executable(0), sourceId(-1), isCompiled(false) +{ + ref = 0; +} + +QScriptProgramPrivate::~QScriptProgramPrivate() +{ + delete _executable; +} + +QScriptProgramPrivate *QScriptProgramPrivate::get(const QScriptProgram &q) +{ + return const_cast(q.d_func()); +} + +JSC::EvalExecutable *QScriptProgramPrivate::executable(JSC::ExecState *exec, + QScriptEnginePrivate *eng) +{ + if (_executable) { + if (eng == engine) + return _executable; + delete _executable; + } + WTF::PassRefPtr provider + = QScript::UStringSourceProviderWithFeedback::create(sourceCode, fileName, firstLineNumber, eng); + sourceId = provider->asID(); + JSC::SourceCode source(provider, firstLineNumber); //after construction of SourceCode provider variable will be null. + _executable = new JSC::EvalExecutable(exec, source); + engine = eng; + isCompiled = false; + return _executable; +} + +/*! + Constructs a null QScriptProgram. +*/ +QScriptProgram::QScriptProgram() + : d_ptr(0) +{ +} + +/*! + Constructs a new QScriptProgram with the given \a sourceCode, \a + fileName and \a firstLineNumber. +*/ +QScriptProgram::QScriptProgram(const QString &sourceCode, + const QString fileName, + int firstLineNumber) + : d_ptr(new QScriptProgramPrivate(sourceCode, fileName, firstLineNumber)) +{ +} + +/*! + Constructs a new QScriptProgram that is a copy of \a other. +*/ +QScriptProgram::QScriptProgram(const QScriptProgram &other) + : d_ptr(other.d_ptr) +{ +} + +/*! + Destroys this QScriptProgram. +*/ +QScriptProgram::~QScriptProgram() +{ + Q_D(QScriptProgram); + // if (d->engine && (d->ref == 1)) + // d->engine->unregisterScriptProgram(d); +} + +/*! + Assigns the \a other value to this QScriptProgram. +*/ +QScriptProgram &QScriptProgram::operator=(const QScriptProgram &other) +{ + // if (d_func() && d_func()->engine && (d_func()->ref == 1)) + // d_func()->engine->unregisterScriptProgram(d_func()); + // } + d_ptr = other.d_ptr; + return *this; +} + +/*! + Returns true if this QScriptProgram is null; otherwise + returns false. +*/ +bool QScriptProgram::isNull() const +{ + Q_D(const QScriptProgram); + return (d == 0); +} + +/*! + Returns the source code of this program. +*/ +QString QScriptProgram::sourceCode() const +{ + Q_D(const QScriptProgram); + if (!d) + return QString(); + return d->sourceCode; +} + +/*! + Returns the filename associated with this program. +*/ +QString QScriptProgram::fileName() const +{ + Q_D(const QScriptProgram); + if (!d) + return QString(); + return d->fileName; +} + +/*! + Returns the line number associated with this program. +*/ +int QScriptProgram::firstLineNumber() const +{ + Q_D(const QScriptProgram); + if (!d) + return -1; + return d->firstLineNumber; +} + +/*! + Returns true if this QScriptProgram is equal to \a other; + otherwise returns false. +*/ +bool QScriptProgram::operator==(const QScriptProgram &other) const +{ + Q_D(const QScriptProgram); + if (d == other.d_func()) + return true; + return (sourceCode() == other.sourceCode()) + && (fileName() == other.fileName()) + && (firstLineNumber() == other.firstLineNumber()); +} + +/*! + Returns true if this QScriptProgram is not equal to \a other; + otherwise returns false. +*/ +bool QScriptProgram::operator!=(const QScriptProgram &other) const +{ + return !operator==(other); +} + +QT_END_NAMESPACE diff --git a/src/script/api/qscriptprogram.h b/src/script/api/qscriptprogram.h new file mode 100644 index 0000000000..de891cdbb3 --- /dev/null +++ b/src/script/api/qscriptprogram.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript 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 QSCRIPTPROGRAM_H +#define QSCRIPTPROGRAM_H + +#include + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QScriptProgramPrivate; +class Q_SCRIPT_EXPORT QScriptProgram +{ +public: + QScriptProgram(); + QScriptProgram(const QString &sourceCode, + const QString fileName = QString(), + int firstLineNumber = 1); + QScriptProgram(const QScriptProgram &other); + ~QScriptProgram(); + + QScriptProgram &operator=(const QScriptProgram &other); + + bool isNull() const; + + QString sourceCode() const; + QString fileName() const; + int firstLineNumber() const; + + bool operator==(const QScriptProgram &other) const; + bool operator!=(const QScriptProgram &other) const; + +private: + QExplicitlySharedDataPointer d_ptr; + Q_DECLARE_PRIVATE(QScriptProgram) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCRIPTPROGRAM_H diff --git a/src/script/api/qscriptprogram_p.h b/src/script/api/qscriptprogram_p.h new file mode 100644 index 0000000000..5175079d4e --- /dev/null +++ b/src/script/api/qscriptprogram_p.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript 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 QSCRIPTPROGRAM_P_H +#define QSCRIPTPROGRAM_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +namespace JSC +{ + class EvalExecutable; + class ExecState; +} + +QT_BEGIN_NAMESPACE + +class QScriptEnginePrivate; + +class QScriptProgramPrivate +{ +public: + QScriptProgramPrivate(const QString &sourceCode, + const QString &fileName, + int firstLineNumber); + ~QScriptProgramPrivate(); + + static QScriptProgramPrivate *get(const QScriptProgram &q); + + JSC::EvalExecutable *executable(JSC::ExecState *exec, + QScriptEnginePrivate *engine); + + QBasicAtomicInt ref; + + QString sourceCode; + QString fileName; + int firstLineNumber; + + QScriptEnginePrivate *engine; + JSC::EvalExecutable *_executable; + intptr_t sourceId; + bool isCompiled; +}; + +QT_END_NAMESPACE + +#endif diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 25ee00f5ef..804534fe47 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -52,6 +53,7 @@ Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QObjectList) +Q_DECLARE_METATYPE(QScriptProgram) //TESTED_CLASS= //TESTED_FILES= @@ -151,6 +153,7 @@ private slots: void installTranslatorFunctions(); void functionScopes(); void nativeFunctionScopes(); + void evaluateProgram(); void qRegExpInport_data(); void qRegExpInport(); @@ -4289,6 +4292,152 @@ void tst_QScriptEngine::nativeFunctionScopes() } } +static QScriptValue createProgram(QScriptContext *ctx, QScriptEngine *eng) +{ + QString code = ctx->argument(0).toString(); + QScriptProgram result(code); + return qScriptValueFromValue(eng, result); +} + +void tst_QScriptEngine::evaluateProgram() +{ + QScriptEngine eng; + + { + QString code("1 + 2"); + QString fileName("hello.js"); + int lineNumber(123); + QScriptProgram program(code, fileName, lineNumber); + QVERIFY(!program.isNull()); + QCOMPARE(program.sourceCode(), code); + QCOMPARE(program.fileName(), fileName); + QCOMPARE(program.firstLineNumber(), lineNumber); + + QScriptValue expected = eng.evaluate(code); + for (int x = 0; x < 10; ++x) { + QScriptValue ret = eng.evaluate(program); + QVERIFY(ret.equals(expected)); + } + + // operator= + QScriptProgram sameProgram = program; + QVERIFY(sameProgram == program); + QVERIFY(eng.evaluate(sameProgram).equals(expected)); + + // copy constructor + QScriptProgram sameProgram2(program); + QVERIFY(sameProgram2 == program); + QVERIFY(eng.evaluate(sameProgram2).equals(expected)); + + QScriptProgram differentProgram("2 + 3"); + QVERIFY(differentProgram != program); + QVERIFY(!eng.evaluate(differentProgram).equals(expected)); + } + + // Program that accesses variable in the scope + { + QScriptProgram program("a"); + QVERIFY(!program.isNull()); + { + QScriptValue ret = eng.evaluate(program); + QVERIFY(ret.isError()); + QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: a")); + } + + QScriptValue obj = eng.newObject(); + obj.setProperty("a", 123); + QScriptContext *ctx = eng.currentContext(); + ctx->pushScope(obj); + { + QScriptValue ret = eng.evaluate(program); + QVERIFY(!ret.isError()); + QVERIFY(ret.equals(obj.property("a"))); + } + + obj.setProperty("a", QScriptValue()); + { + QScriptValue ret = eng.evaluate(program); + QVERIFY(ret.isError()); + } + + QScriptValue obj2 = eng.newObject(); + obj2.setProperty("a", 456); + ctx->pushScope(obj2); + { + QScriptValue ret = eng.evaluate(program); + QVERIFY(!ret.isError()); + QVERIFY(ret.equals(obj2.property("a"))); + } + + ctx->popScope(); + } + + // Program that creates closure + { + QScriptProgram program("(function() { var count = 0; return function() { return count++; }; })"); + QVERIFY(!program.isNull()); + QScriptValue createCounter = eng.evaluate(program); + QVERIFY(createCounter.isFunction()); + QScriptValue counter = createCounter.call(); + QVERIFY(counter.isFunction()); + { + QScriptValue ret = counter.call(); + QVERIFY(ret.isNumber()); + } + QScriptValue counter2 = createCounter.call(); + QVERIFY(counter2.isFunction()); + QVERIFY(!counter2.equals(counter)); + { + QScriptValue ret = counter2.call(); + QVERIFY(ret.isNumber()); + } + } + + // Program created in a function call, then executed later + { + QScriptValue fun = eng.newFunction(createProgram); + QScriptProgram program = qscriptvalue_cast( + fun.call(QScriptValue(), QScriptValueList() << "a + 1")); + QVERIFY(!program.isNull()); + eng.globalObject().setProperty("a", QScriptValue()); + { + QScriptValue ret = eng.evaluate(program); + QVERIFY(ret.isError()); + QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: a")); + } + eng.globalObject().setProperty("a", 122); + { + QScriptValue ret = eng.evaluate(program); + QVERIFY(!ret.isError()); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toInt32(), 123); + } + } + + // Same program run in different engines + { + QString code("1 + 2"); + QScriptProgram program(code); + QVERIFY(!program.isNull()); + double expected = eng.evaluate(program).toNumber(); + for (int x = 0; x < 2; ++x) { + QScriptEngine eng2; + for (int y = 0; y < 2; ++y) { + double ret = eng2.evaluate(program).toNumber(); + QCOMPARE(ret, expected); + } + } + } + + // No program + { + QScriptProgram program; + QVERIFY(program.isNull()); + QScriptValue ret = eng.evaluate(program); + QVERIFY(!ret.isValid()); + } +} + static QRegExp minimal(QRegExp r) { r.setMinimal(true); return r; } void tst_QScriptEngine::qRegExpInport_data() diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 82c8ccd1ae..032c34b298 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -44,6 +44,7 @@ #include #include +#include #include //TESTED_CLASS= @@ -110,6 +111,9 @@ private slots: void extension(); void isEvaluatingInExtension(); void hasUncaughtException(); + void evaluateProgram(); + void evaluateProgram_SyntaxError(); + void evaluateNullProgram(); private: double m_testProperty; @@ -2219,6 +2223,88 @@ void tst_QScriptEngineAgent::hasUncaughtException() QVERIFY2(spy->isPass(), "At least one of a functionExit event should set hasUncaughtException flag."); } +void tst_QScriptEngineAgent::evaluateProgram() +{ + QScriptEngine eng; + QScriptProgram program("1 + 2", "foo.js", 123); + ScriptEngineSpy *spy = new ScriptEngineSpy(&eng); + qint64 scriptId = -1; + for (int x = 0; x < 10; ++x) { + spy->clear(); + (void)eng.evaluate(program); + QCOMPARE(spy->count(), (x == 0) ? 4 : 3); + + if (x == 0) { + // script is only loaded on first execution + QCOMPARE(spy->at(0).type, ScriptEngineEvent::ScriptLoad); + scriptId = spy->at(0).scriptId; + QVERIFY(scriptId != -1); + QCOMPARE(spy->at(0).script, program.sourceCode()); + QCOMPARE(spy->at(0).fileName, program.fileName()); + QCOMPARE(spy->at(0).lineNumber, program.firstLineNumber()); + spy->removeFirst(); + } + + QCOMPARE(spy->at(0).type, ScriptEngineEvent::FunctionEntry); // evaluate() + QCOMPARE(spy->at(0).scriptId, scriptId); + + QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange); + QCOMPARE(spy->at(1).scriptId, scriptId); + QCOMPARE(spy->at(1).lineNumber, program.firstLineNumber()); + + QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit); // evaluate() + QCOMPARE(spy->at(2).scriptId, scriptId); + QVERIFY(spy->at(2).value.isNumber()); + QCOMPARE(spy->at(2).value.toNumber(), qsreal(3)); + } +} + +void tst_QScriptEngineAgent::evaluateProgram_SyntaxError() +{ + QScriptEngine eng; + QScriptProgram program("this is not valid syntax", "foo.js", 123); + ScriptEngineSpy *spy = new ScriptEngineSpy(&eng); + qint64 scriptId = -1; + for (int x = 0; x < 10; ++x) { + spy->clear(); + (void)eng.evaluate(program); + QCOMPARE(spy->count(), (x == 0) ? 8 : 7); + + if (x == 0) { + // script is only loaded on first execution + QCOMPARE(spy->at(0).type, ScriptEngineEvent::ScriptLoad); + scriptId = spy->at(0).scriptId; + QVERIFY(scriptId != -1); + QCOMPARE(spy->at(0).script, program.sourceCode()); + QCOMPARE(spy->at(0).fileName, program.fileName()); + QCOMPARE(spy->at(0).lineNumber, program.firstLineNumber()); + spy->removeFirst(); + } + + QCOMPARE(spy->at(0).type, ScriptEngineEvent::FunctionEntry); // evaluate() + QCOMPARE(spy->at(0).scriptId, scriptId); + + QCOMPARE(spy->at(1).type, ScriptEngineEvent::ContextPush); // SyntaxError constructor + QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionEntry); // SyntaxError constructor + QCOMPARE(spy->at(3).type, ScriptEngineEvent::FunctionExit); // SyntaxError constructor + QCOMPARE(spy->at(4).type, ScriptEngineEvent::ContextPop); // SyntaxError constructor + + QCOMPARE(spy->at(5).type, ScriptEngineEvent::ExceptionThrow); + QVERIFY(spy->at(5).value.isError()); + QCOMPARE(spy->at(5).value.toString(), QString::fromLatin1("SyntaxError: Parse error")); + + QCOMPARE(spy->at(6).type, ScriptEngineEvent::FunctionExit); // evaluate() + QCOMPARE(spy->at(6).scriptId, scriptId); + } +} + +void tst_QScriptEngineAgent::evaluateNullProgram() +{ + QScriptEngine eng; + ScriptEngineSpy *spy = new ScriptEngineSpy(&eng); + (void)eng.evaluate(QScriptProgram()); + QCOMPARE(spy->count(), 0); +} QTEST_MAIN(tst_QScriptEngineAgent) #include "tst_qscriptengineagent.moc" diff --git a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp index 4f011c4261..8d5f6e6ef6 100644 --- a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp +++ b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp @@ -60,6 +60,8 @@ private slots: void constructor(); void evaluate_data(); void evaluate(); + void evaluateProgram_data(); + void evaluateProgram(); void connectAndDisconnect(); void newObject(); void newQObject(); @@ -153,6 +155,22 @@ void tst_QScriptEngine::connectAndDisconnect() } } +void tst_QScriptEngine::evaluateProgram_data() +{ + evaluate_data(); +} + +void tst_QScriptEngine::evaluateProgram() +{ + QFETCH(QString, code); + QScriptEngine engine; + QScriptProgram program(code); + + QBENCHMARK { + (void)engine.evaluate(program); + } +} + void tst_QScriptEngine::newObject() { QScriptEngine engine; @@ -241,6 +259,5 @@ void tst_QScriptEngine::nativeCall() } } - QTEST_MAIN(tst_QScriptEngine) #include "tst_qscriptengine.moc" -- cgit v1.2.3 From 36e362cffe74d8f7fb3eb6b6a67fbab2ebda1a21 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 28 Oct 2009 15:15:46 +0100 Subject: Make Qt on QNX compile again Fix a typo, update the tmp path to match current qws behavior. --- mkspecs/unsupported/qnx-g++/qplatformdefs.h | 2 +- mkspecs/unsupported/qws/qnx-i386-g++/qmake.conf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mkspecs/unsupported/qnx-g++/qplatformdefs.h b/mkspecs/unsupported/qnx-g++/qplatformdefs.h index f309f81f04..1bf9ffcb3e 100644 --- a/mkspecs/unsupported/qnx-g++/qplatformdefs.h +++ b/mkspecs/unsupported/qnx-g++/qplatformdefs.h @@ -167,6 +167,6 @@ inline float strtof(const char *b, char **e) return float(strtod(b, e)); } -#define QT_QWS_TEMP_DIR qgetenv("TMP"); +#define QT_QWS_TEMP_DIR QString::fromLatin1(qgetenv("TMP")) #endif // QPLATFORMDEFS_H diff --git a/mkspecs/unsupported/qws/qnx-i386-g++/qmake.conf b/mkspecs/unsupported/qws/qnx-i386-g++/qmake.conf index 3f24cd9b4f..fffb80fa67 100644 --- a/mkspecs/unsupported/qws/qnx-i386-g++/qmake.conf +++ b/mkspecs/unsupported/qws/qnx-i386-g++/qmake.conf @@ -56,10 +56,10 @@ QMAKE_PCH_OUTPUT_EXT = .gch QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list, -include(../../common/unix.conf) +include(../../../common/unix.conf) QMAKE_CFLAGS_THREAD = -D_REENTRANT -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CLFAGS_THREAD +QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD QMAKE_INCDIR = QMAKE_LIBDIR = -- cgit v1.2.3 From 5d8dcd57cd13fdd9c8643fa3bdda9f197a4351ff Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 28 Oct 2009 15:09:47 +0100 Subject: Greatly improve the performance of obtaining a state's transitions Transitions are children of their source state. We use QObject::children() and qobject_cast() each child to a QAbstractTransition to see if it is indeed a transition. However, calling qobject_cast() is very expensive. This commit introduces a cached list of transitions. The list is invalidated after a child object has been added or removed. In the typical case we expect the object hierarchy to remain fairly constant once the state machine has been started (states, child states and transitions are usually "static"), in other words the cached list is not likely to be invalidated much. Obtaining a state's transitions needs to be as fast as possible because it's in the critical path of the state machine algorithm. Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/corelib/statemachine/qstate.cpp | 23 +++++++++++++++-------- src/corelib/statemachine/qstate_p.h | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index a6e4a57469..9abf20b32d 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -124,7 +124,8 @@ QT_BEGIN_NAMESPACE */ QStatePrivate::QStatePrivate() - : errorState(0), initialState(0), childMode(QState::ExclusiveStates) + : errorState(0), initialState(0), childMode(QState::ExclusiveStates), + transitionsListNeedsRefresh(true) { } @@ -205,14 +206,17 @@ QList QStatePrivate::historyStates() const QList QStatePrivate::transitions() const { - QList result; - QList::const_iterator it; - for (it = children.constBegin(); it != children.constEnd(); ++it) { - QAbstractTransition *t = qobject_cast(*it); - if (t) - result.append(t); + if (transitionsListNeedsRefresh) { + transitionsList.clear(); + QList::const_iterator it; + for (it = children.constBegin(); it != children.constEnd(); ++it) { + QAbstractTransition *t = qobject_cast(*it); + if (t) + transitionsList.append(t); + } + transitionsListNeedsRefresh = false; } - return result; + return transitionsList; } #ifndef QT_NO_PROPERTIES @@ -468,6 +472,9 @@ void QState::setChildMode(ChildMode mode) */ bool QState::event(QEvent *e) { + Q_D(QState); + if ((e->type() == QEvent::ChildAdded) || (e->type() == QEvent::ChildRemoved)) + d->transitionsListNeedsRefresh = true; return QAbstractState::event(e); } diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h index 20cda29cab..3b5f416436 100644 --- a/src/corelib/statemachine/qstate_p.h +++ b/src/corelib/statemachine/qstate_p.h @@ -99,6 +99,8 @@ public: QAbstractState *errorState; QAbstractState *initialState; QState::ChildMode childMode; + mutable bool transitionsListNeedsRefresh; + mutable QList transitionsList; QList propertyAssignments; }; -- cgit v1.2.3 From 71913d435213188959441a89454de6308fd76484 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Wed, 28 Oct 2009 15:38:33 +0100 Subject: Delete the tst_QWebFrame::setHtmlWithBaseURL test until its fixed upstream. Reviewed-by: TrustMe --- .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 23 ---------------------- 1 file changed, 23 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 80c9d72bf9..100f2725d7 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -586,7 +586,6 @@ private slots: void javaScriptWindowObjectClearedOnEvaluate(); void setHtml(); void setHtmlWithResource(); - void setHtmlWithBaseURL(); void ipv6HostEncoding(); void metaData(); void popupFocus(); @@ -2372,28 +2371,6 @@ void tst_QWebFrame::setHtmlWithResource() QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("red")); } -void tst_QWebFrame::setHtmlWithBaseURL() -{ - QString html("

hello world

"); - - QWebPage page; - QWebFrame* frame = page.mainFrame(); - - // in few seconds, the image should be completey loaded - QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); - - frame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); - QTest::qWait(200); - QCOMPARE(spy.count(), 1); - - QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1); - QCOMPARE(frame->evaluateJavaScript("document.images[0].width").toInt(), 128); - QCOMPARE(frame->evaluateJavaScript("document.images[0].height").toInt(), 128); - - // no history item has to be added. - QCOMPARE(m_view->page()->history()->count(), 0); -} - class TestNetworkManager : public QNetworkAccessManager { public: -- cgit v1.2.3 From ee52cd0bb8ec4f5f74efc9c26be81dd93f1881c8 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 28 Oct 2009 11:41:52 +0100 Subject: QNativeSocketEngine: Actually use translations Task-number: QTBUG-4984 Reviewed-by: Thiago --- src/network/socket/qnativesocketengine.cpp | 52 +++++++++++++++--------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index e7f8401836..8de821bc43 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -194,82 +194,82 @@ void QNativeSocketEnginePrivate::setError(QAbstractSocket::SocketError error, Er switch (errorString) { case NonBlockingInitFailedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to initialize non-blocking socket")); + socketErrorString = QNativeSocketEngine::tr("Unable to initialize non-blocking socket"); break; case BroadcastingInitFailedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to initialize broadcast socket")); + socketErrorString = QNativeSocketEngine::tr("Unable to initialize broadcast socket"); break; case NoIpV6ErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Attempt to use IPv6 socket on a platform with no IPv6 support")); + socketErrorString = QNativeSocketEngine::tr("Attempt to use IPv6 socket on a platform with no IPv6 support"); break; case RemoteHostClosedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The remote host closed the connection")); + socketErrorString = QNativeSocketEngine::tr("The remote host closed the connection"); break; case TimeOutErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Network operation timed out")); + socketErrorString = QNativeSocketEngine::tr("Network operation timed out"); break; case ResourceErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Out of resources")); + socketErrorString = QNativeSocketEngine::tr("Out of resources"); break; case OperationUnsupportedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unsupported socket operation")); + socketErrorString = QNativeSocketEngine::tr("Unsupported socket operation"); break; case ProtocolUnsupportedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Protocol type not supported")); + socketErrorString = QNativeSocketEngine::tr("Protocol type not supported"); break; case InvalidSocketErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Invalid socket descriptor")); + socketErrorString = QNativeSocketEngine::tr("Invalid socket descriptor"); break; case HostUnreachableErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Host unreachable")); + socketErrorString = QNativeSocketEngine::tr("Host unreachable"); break; case NetworkUnreachableErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Network unreachable")); + socketErrorString = QNativeSocketEngine::tr("Network unreachable"); break; case AccessErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Permission denied")); + socketErrorString = QNativeSocketEngine::tr("Permission denied"); break; case ConnectionTimeOutErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Connection timed out")); + socketErrorString = QNativeSocketEngine::tr("Connection timed out"); break; case ConnectionRefusedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Connection refused")); + socketErrorString = QNativeSocketEngine::tr("Connection refused"); break; case AddressInuseErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The bound address is already in use")); + socketErrorString = QNativeSocketEngine::tr("The bound address is already in use"); break; case AddressNotAvailableErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The address is not available")); + socketErrorString = QNativeSocketEngine::tr("The address is not available"); break; case AddressProtectedErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The address is protected")); + socketErrorString = QNativeSocketEngine::tr("The address is protected"); break; case DatagramTooLargeErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Datagram was too large to send")); + socketErrorString = QNativeSocketEngine::tr("Datagram was too large to send"); break; case SendDatagramErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to send a message")); + socketErrorString = QNativeSocketEngine::tr("Unable to send a message"); break; case ReceiveDatagramErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to receive a message")); + socketErrorString = QNativeSocketEngine::tr("Unable to receive a message"); break; case WriteErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unable to write")); + socketErrorString = QNativeSocketEngine::tr("Unable to write"); break; case ReadErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Network error")); + socketErrorString = QNativeSocketEngine::tr("Network error"); break; case PortInuseErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Another socket is already listening on the same port")); + socketErrorString = QNativeSocketEngine::tr("Another socket is already listening on the same port"); break; case NotSocketErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Operation on non-socket")); + socketErrorString = QNativeSocketEngine::tr("Operation on non-socket"); break; case InvalidProxyTypeString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "The proxy type is invalid for this operation")); + socketErrorString = QNativeSocketEngine::tr("The proxy type is invalid for this operation"); break; case UnknownSocketErrorString: - socketErrorString = QLatin1String(QT_TRANSLATE_NOOP("QNativeSocketEngine", "Unknown error")); + socketErrorString = QNativeSocketEngine::tr("Unknown error"); break; } } -- cgit v1.2.3 From da1519020a53dbdc717fb3bffeaad07c5142a6e3 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 28 Oct 2009 15:01:44 +0100 Subject: QSslError: Actually make strings show up in the ts file I suspect because of missing quotation marks those strings were not showing up. Also, wrapping QT_TRANSLATE_NOOP inside a tr() call makes no sense. Also changed the class from QObject to QSslSocket. Task-number: QTBUG-5059 Reviewed-by: ossi --- src/network/ssl/qsslerror.cpp | 57 +++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp index 62fcd4ce8a..4bb58b1ecb 100644 --- a/src/network/ssl/qsslerror.cpp +++ b/src/network/ssl/qsslerror.cpp @@ -91,6 +91,7 @@ */ #include "qsslerror.h" +#include "qsslsocket.h" #ifndef QT_NO_DEBUG_STREAM #include @@ -209,81 +210,79 @@ QString QSslError::errorString() const QString errStr; switch (d->error) { case NoError: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "No error")); + errStr = QSslSocket::tr("No error"); break; case UnableToGetIssuerCertificate: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The issuer certificate could not be found")); + errStr = QSslSocket::tr("The issuer certificate could not be found"); break; case UnableToDecryptCertificateSignature: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The certificate signature could not be decrypted")); + errStr = QSslSocket::tr("The certificate signature could not be decrypted"); break; case UnableToDecodeIssuerPublicKey: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The public key in the certificate could not be read")); + errStr = QSslSocket::tr("The public key in the certificate could not be read"); break; case CertificateSignatureFailed: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The signature of the certificate is invalid")); + errStr = QSslSocket::tr("The signature of the certificate is invalid"); break; case CertificateNotYetValid: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The certificate is not yet valid")); + errStr = QSslSocket::tr("The certificate is not yet valid"); break; case CertificateExpired: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The certificate has expired")); + errStr = QSslSocket::tr("The certificate has expired"); break; case InvalidNotBeforeField: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The certificate's notBefore field contains an invalid time")); + errStr = QSslSocket::tr("The certificate's notBefore field contains an invalid time"); break; case InvalidNotAfterField: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The certificate's notAfter field contains an invalid time")); + errStr = QSslSocket::tr("The certificate's notAfter field contains an invalid time"); break; case SelfSignedCertificate: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The certificate is self-signed, and untrusted")); + errStr = QSslSocket::tr("The certificate is self-signed, and untrusted"); break; case SelfSignedCertificateInChain: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The root certificate of the certificate chain is self-signed, and untrusted")); + errStr = QSslSocket::tr("The root certificate of the certificate chain is self-signed, and untrusted"); break; case UnableToGetLocalIssuerCertificate: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The issuer certificate of a locally looked up certificate could not be found")); + errStr = QSslSocket::tr("The issuer certificate of a locally looked up certificate could not be found"); break; case UnableToVerifyFirstCertificate: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "No certificates could be verified")); + errStr = QSslSocket::tr("No certificates could be verified"); break; case InvalidCaCertificate: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "One of the CA certificates is invalid")); + errStr = QSslSocket::tr("One of the CA certificates is invalid"); break; case PathLengthExceeded: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The basicConstraints pathlength parameter has been exceeded")); + errStr = QSslSocket::tr("The basicConstraints pathlength parameter has been exceeded"); break; case InvalidPurpose: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The supplied certificate is unsuited for this purpose")); + errStr = QSslSocket::tr("The supplied certificate is unsuited for this purpose"); break; case CertificateUntrusted: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The root CA certificate is not trusted for this purpose")); + errStr = QSslSocket::tr("The root CA certificate is not trusted for this purpose"); break; case CertificateRejected: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The root CA certificate is marked to reject the specified purpose")); + errStr = QSslSocket::tr("The root CA certificate is marked to reject the specified purpose"); break; case SubjectIssuerMismatch: // hostname mismatch - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, - "The current candidate issuer certificate was rejected because its" - " subject name did not match the issuer name of the current certificate")); + errStr = QSslSocket::tr("The current candidate issuer certificate was rejected because its" + " subject name did not match the issuer name of the current certificate"); break; case AuthorityIssuerSerialNumberMismatch: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The current candidate issuer certificate was rejected because" - " its issuer name and serial number was present and did not match the" - " authority key identifier of the current certificate")); + errStr = QSslSocket::tr("The current candidate issuer certificate was rejected because" + " its issuer name and serial number was present and did not match the" + " authority key identifier of the current certificate"); break; case NoPeerCertificate: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "The peer did not present any certificate")); + errStr = QSslSocket::tr("The peer did not present any certificate"); break; case HostNameMismatch: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, - "The host name did not match any of the valid hosts" - " for this certificate")); + errStr = QSslSocket::tr("The host name did not match any of the valid hosts" + " for this certificate"); break; case NoSslSupport: break; default: - errStr = QObject::tr(QT_TRANSLATE_NOOP(QSslError, "Unknown error")); + errStr = QSslSocket::tr("Unknown error"); break; } -- cgit v1.2.3 From d9b009bfed86ac273da4fc589daa34d852437254 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 28 Oct 2009 17:46:14 +0100 Subject: make magic comment parsing stricter there must be a space after the //: and similar comments, otherwise harmless comments of the sort of //====== foo here ===== will be parsed as message ids, etc. --- tools/linguist/lupdate/cpp.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 7a616e3d0b..63749122eb 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1899,25 +1899,25 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) case Tok_Comment: if (!tor) goto case_default; - if (yyWord.startsWith(QLatin1Char(':'))) { - yyWord.remove(0, 1); + if (yyWord.at(0) == QLatin1Char(':') && yyWord.at(1).isSpace()) { + yyWord.remove(0, 2); extracomment += yyWord; extracomment.detach(); - } else if (yyWord.startsWith(QLatin1Char('='))) { - yyWord.remove(0, 1); + } else if (yyWord.at(0) == QLatin1Char('=') && yyWord.at(1).isSpace()) { + yyWord.remove(0, 2); msgid = yyWord.simplified(); msgid.detach(); - } else if (yyWord.startsWith(QLatin1Char('~'))) { - yyWord.remove(0, 1); + } else if (yyWord.at(0) == QLatin1Char('~') && yyWord.at(1).isSpace()) { + yyWord.remove(0, 2); text = yyWord.trimmed(); int k = text.indexOf(QLatin1Char(' ')); if (k > -1) extra.insert(text.left(k), text.mid(k + 1).trimmed()); text.clear(); - } else if (yyWord.startsWith(QLatin1Char('%'))) { - sourcetext.reserve(sourcetext.length() + yyWord.length()); + } else if (yyWord.at(0) == QLatin1Char('%') && yyWord.at(1).isSpace()) { + sourcetext.reserve(sourcetext.length() + yyWord.length() - 2); ushort *ptr = (ushort *)sourcetext.data() + sourcetext.length(); - int p = 1, c; + int p = 2, c; forever { if (p >= yyWord.length()) break; -- cgit v1.2.3 From 9fbece67bacee0f88261c3cd07c443fdf6385f81 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 29 Oct 2009 08:03:27 +1000 Subject: Remove QVGEGLWindowSurfaceQImage from QtOpenVG Rendering into a QImage as a window backing store isn't very efficient and isn't needed by any of our current platforms. If a specific graphics system needs it in the future, it can implement it directly. Reviewed-by: trustme --- src/openvg/qwindowsurface_vg.cpp | 4 +-- src/openvg/qwindowsurface_vgegl.cpp | 59 ------------------------------------- src/openvg/qwindowsurface_vgegl_p.h | 19 ------------ 3 files changed, 2 insertions(+), 80 deletions(-) diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp index 661e06acca..f8486a6dd8 100644 --- a/src/openvg/qwindowsurface_vg.cpp +++ b/src/openvg/qwindowsurface_vg.cpp @@ -54,8 +54,8 @@ QT_BEGIN_NAMESPACE QVGWindowSurface::QVGWindowSurface(QWidget *window) : QWindowSurface(window) { - d_ptr = QVGEGLWindowSurfacePrivate::create - (QVGEGLWindowSurfacePrivate::WindowSurface, this); + // Create the default type of EGL window surface for windows. + d_ptr = new QVGEGLWindowSurfaceDirect(this); } QVGWindowSurface::QVGWindowSurface diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index d622c1fca5..103f84d2aa 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -101,18 +101,6 @@ QImage::Format qt_vg_config_to_image_format(QEglContext *context) return argbFormat; // XXX } -static void copySubImage(QImage *image, VGImage vgImage, const QRect& rect) -{ - vgGetImageSubData - (vgImage, - image->bits() + rect.bottom() * image->bytesPerLine() + - rect.x() * (image->depth() / 8), - -(image->bytesPerLine()), - qt_vg_image_to_vg_format(image->format()), - rect.x(), (image->height() - 1) - rect.bottom(), - rect.width(), rect.height()); -} - #if !defined(QVG_NO_SINGLE_CONTEXT) class QVGSharedContext @@ -336,20 +324,6 @@ QVGEGLWindowSurfacePrivate::~QVGEGLWindowSurfacePrivate() destroyPaintEngine(); } -QVGEGLWindowSurfacePrivate *QVGEGLWindowSurfacePrivate::create - (SurfaceType type, QWindowSurface *win) -{ -#if defined(QVG_VGIMAGE_BACKBUFFERS) - if (type == VGImageSurface) - return new QVGEGLWindowSurfaceVGImage(win); - else if (type == QImageSurface) - return new QVGEGLWindowSurfaceQImage(win); -#endif - if (type == WindowSurface) - return new QVGEGLWindowSurfaceDirect(win); - return 0; -} - QVGPaintEngine *QVGEGLWindowSurfacePrivate::paintEngine() { if (!engine) @@ -514,39 +488,6 @@ EGLSurface QVGEGLWindowSurfaceVGImage::mainSurface() const return qt_vg_shared_surface(); } -QVGEGLWindowSurfaceQImage::QVGEGLWindowSurfaceQImage(QWindowSurface *win) - : QVGEGLWindowSurfaceVGImage(win) -{ -} - -QVGEGLWindowSurfaceQImage::~QVGEGLWindowSurfaceQImage() -{ -} - -void QVGEGLWindowSurfaceQImage::endPaint - (QWidget *widget, const QRegion& region, QImage *image) -{ - QEglContext *context = ensureContext(widget); - if (context) { - if (backBufferSurface != EGL_NO_SURFACE) { - if (isPaintingActive) - vgFlush(); - context->makeCurrent(mainSurface()); - QRegion rgn = region.intersected - (QRect(0, 0, image->width(), image->height())); - if (rgn.numRects() == 1) { - copySubImage(image, backBuffer, rgn.boundingRect()); - } else { - QVector rects = rgn.rects(); - for (int index = 0; index < rects.size(); ++index) - copySubImage(image, backBuffer, rects[index]); - } - context->lazyDoneCurrent(); - } - isPaintingActive = false; - } -} - #endif // QVG_VGIMAGE_BACKBUFFERS QVGEGLWindowSurfaceDirect::QVGEGLWindowSurfaceDirect(QWindowSurface *win) diff --git a/src/openvg/qwindowsurface_vgegl_p.h b/src/openvg/qwindowsurface_vgegl_p.h index fa36b9454a..7fa60ea432 100644 --- a/src/openvg/qwindowsurface_vgegl_p.h +++ b/src/openvg/qwindowsurface_vgegl_p.h @@ -70,16 +70,6 @@ public: QVGEGLWindowSurfacePrivate(QWindowSurface *win); virtual ~QVGEGLWindowSurfacePrivate(); - enum SurfaceType - { - WindowSurface, - VGImageSurface, - QImageSurface - }; - - static QVGEGLWindowSurfacePrivate *create - (SurfaceType type, QWindowSurface *win); - QVGPaintEngine *paintEngine(); virtual QEglContext *ensureContext(QWidget *widget) = 0; virtual void beginPaint(QWidget *widget) = 0; @@ -126,15 +116,6 @@ protected: EGLSurface mainSurface() const; }; -class Q_OPENVG_EXPORT QVGEGLWindowSurfaceQImage : public QVGEGLWindowSurfaceVGImage -{ -public: - QVGEGLWindowSurfaceQImage(QWindowSurface *win); - virtual ~QVGEGLWindowSurfaceQImage(); - - void endPaint(QWidget *widget, const QRegion& region, QImage *image); -}; - #endif // EGL_OPENVG_IMAGE class Q_OPENVG_EXPORT QVGEGLWindowSurfaceDirect : public QVGEGLWindowSurfacePrivate -- cgit v1.2.3 From cabfa68f3e37e79a18775a9970f6d166e75ece07 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 29 Oct 2009 08:29:23 +1000 Subject: Remove shader/program binary support for now After API review discussions, it was decided to remove shader binary support until we have a better handle on what we need. Applications can directly load shader binaries on the shaderId() using glShaderBinary() directly so they aren't prevented from using the feature. Reviewed-by: trustme --- src/opengl/qglshaderprogram.cpp | 213 ---------------------------------------- src/opengl/qglshaderprogram.h | 9 -- 2 files changed, 222 deletions(-) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index d028522429..90b496e405 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -611,95 +611,6 @@ bool QGLShader::compileFile(const QString& fileName) return compile(contents.constData()); } -/*! - Sets the binary code for this shader to the \a length bytes from - the array \a binary. The \a format specifies how the binary data - should be interpreted by the OpenGL engine. Returns true if the - binary was set on the shader; false otherwise. - - This function cannot be used with PartialVertexShader or - PartialFragmentShader. - - If this function succeeds, then the shader will be considered compiled. - - \sa shaderBinaryFormats() -*/ -bool QGLShader::setShaderBinary(GLenum format, const void *binary, int length) -{ - Q_D(QGLShader); -#if !defined(QT_OPENGL_ES_2) - if (!glShaderBinary) - return false; -#endif - GLuint shader = d->shaderGuard.id(); - if (d->isPartial || !shader) - return false; - glGetError(); // Clear error state. - glShaderBinary(1, &shader, format, binary, length); - d->compiled = (glGetError() == GL_NO_ERROR); - return d->compiled; -} - -/*! - Sets the binary code for this shader to the \a length bytes from - the array \a binary. The \a format specifies how the binary data - should be interpreted by the OpenGL engine. Returns true if the - binary was set on the shader; false otherwise. - - The \a otherShader will also have binary code set on it. This is - for the case where \a binary contains both vertex and fragment - shader code. - - This function cannot be used with PartialVertexShader or - PartialFragmentShader. - - If this function succeeds, then the shader will be considered compiled. - - \sa shaderBinaryFormats() -*/ -bool QGLShader::setShaderBinary - (QGLShader& otherShader, GLenum format, const void *binary, int length) -{ - Q_D(QGLShader); -#if !defined(QT_OPENGL_ES_2) - if (!glShaderBinary) - return false; -#endif - if (d->isPartial || !d->shaderGuard.id()) - return false; - if (otherShader.d_func()->isPartial || !otherShader.d_func()->shaderGuard.id()) - return false; - glGetError(); // Clear error state. - GLuint shaders[2]; - shaders[0] = d->shaderGuard.id(); - shaders[1] = otherShader.d_func()->shaderGuard.id(); - glShaderBinary(2, shaders, format, binary, length); - d->compiled = (glGetError() == GL_NO_ERROR); - otherShader.d_func()->compiled = d->compiled; - return d->compiled; -} - -/*! - Returns a list of all binary formats that are supported by - setShaderBinary() on this system. - - \sa setShaderBinary() -*/ -QList QGLShader::shaderBinaryFormats() -{ - GLint num; - QList list; - glGetError(); // Clear error state. - glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &num); - if (glGetError() != GL_NO_ERROR || num <= 0) - return list; - QVarLengthArray formats(num); - glGetIntegerv(GL_SHADER_BINARY_FORMATS, formats.data()); - for (GLint i = 0; i < num; ++i) - list += (GLenum)(formats[i]); - return list; -} - /*! Returns the source code for this shader. @@ -1068,130 +979,6 @@ void QGLShaderProgram::removeAllShaders() d->removingShaders = false; } -#if defined(QT_OPENGL_ES_2) - -#ifndef GL_PROGRAM_BINARY_LENGTH_OES -#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 -#endif -#ifndef GL_NUM_PROGRAM_BINARY_FORMATS_OES -#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE -#endif -#ifndef GL_PROGRAM_BINARY_FORMATS_OES -#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF -#endif - -#endif - -/*! - Returns the program binary associated with this shader program. - The numeric identifier of the program binary format is returned - in \a format. The \c OES_get_program_binary extension will need - to be supported by the system for binary retrieval to succeed. - - Returns an empty QByteArray if the program binary cannot be - retrieved on this system, or the shader program has not yet - been linked. - - The returned binary can be supplied to setProgramBinary() on the - same machine at some future point to reload the program. It contains - the compiled code of all of the shaders that were attached to the - program at the time programBinary() is called. - - \sa setProgramBinary(), programBinaryFormats() -*/ -QByteArray QGLShaderProgram::programBinary(int *format) const -{ -#if defined(QT_OPENGL_ES_2) - Q_D(const QGLShaderProgram); - if (!isLinked()) - return QByteArray(); - - // Get the length of the binary data, bailing out if there is none. - GLint length = 0; - GLuint program = d->programGuard.id(); - glGetProgramiv(program, GL_PROGRAM_BINARY_LENGTH_OES, &length); - if (length <= 0) - return QByteArray(); - - // Retrieve the binary data. - QByteArray binary(length, 0); - GLenum binaryFormat; - glGetProgramBinaryOES(program, length, 0, &binaryFormat, binary.data()); - if (format) - *format = (int)binaryFormat; - return binary; -#else - Q_UNUSED(format); - return QByteArray(); -#endif -} - -/*! - Sets the \a binary for this shader program according to \a format. - Returns true if the binary was set, or false if the binary format - is not supported or this system does not support program binaries. - The program will be linked if the load succeeds. - - \sa programBinary(), programBinaryFormats(), isLinked() -*/ -bool QGLShaderProgram::setProgramBinary(int format, const QByteArray& binary) -{ -#if defined(QT_OPENGL_ES_2) - // Load the binary and check that it was linked correctly. - Q_D(QGLShaderProgram); - GLuint program = d->programGuard.id(); - if (!program) - return false; - glProgramBinaryOES(program, (GLenum)format, - binary.constData(), binary.size()); - GLint value = 0; - glGetProgramiv(program, GL_LINK_STATUS, &value); - d->linked = (value != 0); - value = 0; - glGetProgramiv(program, GL_INFO_LOG_LENGTH, &value); - d->log = QString(); - if (value > 1) { - char *logbuf = new char [value]; - GLint len; - glGetProgramInfoLog(program, value, &len, logbuf); - d->log = QString::fromLatin1(logbuf); - QString name = objectName(); - if (name.isEmpty()) - qWarning() << "QGLShader::setProgramBinary:" << d->log; - else - qWarning() << "QGLShader::setProgramBinary[" << name << "]:" << d->log; - delete [] logbuf; - } - return d->linked; -#else - Q_UNUSED(format); - Q_UNUSED(binary); - return false; -#endif -} - -/*! - Returns the list of program binary formats that are accepted by - this system for use with setProgramBinary(). - - \sa programBinary(), setProgramBinary() -*/ -QList QGLShaderProgram::programBinaryFormats() -{ -#if defined(QT_OPENGL_ES_2) - GLint count = 0; - glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES, &count); - if (count <= 0) - return QList(); - QVector list; - list.resize(count); - glGetIntegerv(GL_PROGRAM_BINARY_FORMATS_OES, list.data()); - return list.toList(); -#else - return QList(); -#endif -} - /*! Links together the shaders that were added to this program with addShader(). Returns true if the link was successful or diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index d8b9a0c99a..708cf0940e 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -88,11 +88,6 @@ public: bool compile(const QString& source); bool compileFile(const QString& fileName); - bool setShaderBinary(GLenum format, const void *binary, int length); - bool setShaderBinary(QGLShader& otherShader, GLenum format, const void *binary, int length); - - static QList shaderBinaryFormats(); - QByteArray sourceCode() const; bool isCompiled() const; @@ -133,10 +128,6 @@ public: void removeAllShaders(); - QByteArray programBinary(int *format) const; - bool setProgramBinary(int format, const QByteArray& binary); - static QList programBinaryFormats(); - virtual bool link(); bool isLinked() const; QString log() const; -- cgit v1.2.3 From 526fdcafdba2b2984924b09b68c473b5160443a1 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 28 Oct 2009 10:19:24 +1000 Subject: Change all valid Task-Tracker references to bugreports.qt.nokia.com reference. --- tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp | 2 +- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 2 +- tests/auto/qsound/tst_qsound.cpp | 2 +- tests/auto/qwidget/tst_qwidget.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp index 002aeb760b..dedc0cbc5f 100644 --- a/tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp +++ b/tests/auto/qdatawidgetmapper/tst_qdatawidgetmapper.cpp @@ -379,7 +379,7 @@ void tst_QDataWidgetMapper::comboBox() model->setData(model->index(0, 1), QString("read write item z"), Qt::EditRole); QCOMPARE(readOnlyBox.currentIndex(), 2); - QEXPECT_FAIL("", "See tasks 125493 and 147153", Abort); + QEXPECT_FAIL("", "See task 125493 and QTBUG-428", Abort); QCOMPARE(readWriteBox.currentText(), QString("read write item z")); } diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index dc08d0e948..9b5e114c45 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -3735,7 +3735,7 @@ void tst_QGraphicsView::task259503_scrollingArtifacts() { // qDebug() << event->region(); // qDebug() << updateRegion; - QEXPECT_FAIL("", "The event region doesn't include the original item position region. See task #259503.", Continue); + QEXPECT_FAIL("", "The event region doesn't include the original item position region. See QTBUG-4416", Continue); QCOMPARE(event->region(), updateRegion); } } diff --git a/tests/auto/qsound/tst_qsound.cpp b/tests/auto/qsound/tst_qsound.cpp index fdbf6a26b1..56a330b590 100644 --- a/tests/auto/qsound/tst_qsound.cpp +++ b/tests/auto/qsound/tst_qsound.cpp @@ -66,7 +66,7 @@ void tst_QSound::checkFinished() QTest::qWait(5000); #if defined(Q_WS_QWS) - QEXPECT_FAIL("", "QSound buggy on embedded (task 122221)", Abort); + QEXPECT_FAIL("", "QSound buggy on embedded (task QTBUG-157)", Abort); #endif QVERIFY(sound.isFinished() ); } diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 050d1c516f..5630370fc5 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -2982,7 +2982,7 @@ void tst_QWidget::stackUnder() qApp->processEvents(); #endif #ifndef Q_WS_MAC - QEXPECT_FAIL(0, "Task 153869", Continue); + QEXPECT_FAIL(0, "See QTBUG-493", Continue); #endif QCOMPARE(child->numPaintEvents, 0); } else { -- cgit v1.2.3 From f425c08d4f2e7f061a0ee8e4a1eee2b17fa64962 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 29 Oct 2009 13:20:50 +1000 Subject: doc typo --- doc/src/frameworks-technologies/eventsandfilters.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/frameworks-technologies/eventsandfilters.qdoc b/doc/src/frameworks-technologies/eventsandfilters.qdoc index c769884779..52d596a162 100644 --- a/doc/src/frameworks-technologies/eventsandfilters.qdoc +++ b/doc/src/frameworks-technologies/eventsandfilters.qdoc @@ -215,7 +215,7 @@ \l{QCoreApplication::}{postEvent()} posts the event on a queue for later dispatch. The next time Qt's main event loop runs, it dispatches all posted events, with some optimization. For example, if there are - several resize events, they are are compressed into one. The same + several resize events, they are compressed into one. The same applies to paint events: QWidget::update() calls \l{QCoreApplication::}{postEvent()}, which eliminates flickering and increases speed by avoiding multiple repaints. -- cgit v1.2.3