Merge branch 'master' into refactor
authorGunnar Sletta <gunnar.sletta@nokia.com>
Wed, 31 Aug 2011 06:55:16 +0000 (08:55 +0200)
committerGunnar Sletta <gunnar.sletta@nokia.com>
Wed, 31 Aug 2011 06:55:16 +0000 (08:55 +0200)
Conflicts:
src/3rdparty/v8
src/declarative/declarative.pro
src/declarative/items/qsgcanvas.cpp
src/declarative/items/qsgshadereffectsource_p.h
src/declarative/items/qsgview.cpp
src/declarative/particles/qsgcustomparticle.cpp
src/imports/gestures/gestures.pro
src/imports/particles/particles.pro
src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro
src/qtquick1/qtquick1.pro
tests/auto/declarative/examples/examples.pro
tests/auto/declarative/qsglistview/qsglistview.pro
tests/auto/qtquick1/qdeclarativeviewer/qdeclarativeviewer.pro

Change-Id: I423344f83e1835116cad531b877fde6e68a8849a

27 files changed:
1  2 
src/declarative/declarative.pro
src/declarative/items/qsgborderimage.cpp
src/declarative/items/qsgcanvas.cpp
src/declarative/items/qsgshadereffect.cpp
src/declarative/items/qsgshadereffectsource.cpp
src/declarative/items/qsgshadereffectsource_p.h
src/declarative/items/qsgview.cpp
src/declarative/items/qsgview_p.h
src/declarative/particles/qsgcustomparticle.cpp
src/declarative/particles/qsgimageparticle.cpp
src/declarative/qml/parser/qdeclarativejsparser.cpp
src/declarative/qml/qdeclarativeengine.cpp
src/declarative/qml/qdeclarativemetatype.cpp
src/declarative/util/qdeclarativestateoperations.cpp
src/imports/gestures/gestures.pro
src/imports/particles/particles.pro
src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp
src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro
src/qmltest/quicktest.cpp
src/qtquick1/graphicsitems/qdeclarativeitem.cpp
src/qtquick1/qtquick1.pro
tests/auto/declarative/examples/examples.pro
tests/auto/declarative/qsglistview/qsglistview.pro
tests/auto/declarative/qsglistview/tst_qsglistview.cpp
tests/auto/qtquick1/qdeclarativeviewer/qdeclarativeviewer.pro
tools/qmlplugindump/main.cpp
tools/qmlscene/main.cpp

@@@ -6,8 -6,7 +6,8 @@@ QPRO_PWD   = $$PW
  CONFIG += module
  MODULE_PRI += ../../modules/qt_declarative.pri
  
- QT = core-private gui gui-private network widgets-private sql
 -QT         = core-private gui-private network opengl-private v8-private
++QT = core-private gui gui-private network widgets-private sql v8-private
 +
  contains(QT_CONFIG, svg): QT += svg
  DEFINES   += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING
  win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
@@@ -153,17 -72,17 +153,17 @@@ public
  Focus behavior
  ==============
  
--Prior to being added to a valid canvas items can set and clear focus with no 
++Prior to being added to a valid canvas items can set and clear focus with no
  effect.  Only once items are added to a canvas (by way of having a parent set that
--already belongs to a canvas) do the focus rules apply.  Focus goes back to 
++already belongs to a canvas) do the focus rules apply.  Focus goes back to
  having no effect if an item is removed from a canvas.
  
  When an item is moved into a new focus scope (either being added to a canvas
--for the first time, or having its parent changed), if the focus scope already has 
++for the first time, or having its parent changed), if the focus scope already has
  a scope focused item that takes precedence over the item being added.  Otherwise,
--the focus of the added tree is used.  In the case of of a tree of items being 
++the focus of the added tree is used.  In the case of of a tree of items being
  added to a canvas for the first time, which may have a conflicted focus state (two
--or more items in one scope having focus set), the same rule is applied item by item - 
++or more items in one scope having focus set), the same rule is applied item by item -
  thus the first item that has focus will get it (assuming the scope doesn't already
  have a scope focused item), and the other items will have their focus cleared.
  */
@@@ -478,7 -478,7 +478,7 @@@ void QSGCanvasPrivate::sceneMouseEventF
      sceneEvent.setLastPos(transform.map(sceneEvent.lastScenePos()));
      for (int ii = 0; ii < 5; ++ii) {
          if (sceneEvent.buttons() & (1 << ii)) {
--            sceneEvent.setButtonDownPos((Qt::MouseButton)(1 << ii), 
++            sceneEvent.setButtonDownPos((Qt::MouseButton)(1 << ii),
                                          transform.map(sceneEvent.buttonDownScenePos((Qt::MouseButton)(1 << ii))));
          }
      }
@@@ -692,7 -695,7 +692,7 @@@ void QSGCanvasPrivate::setFocusInScope(
          updateInputMethodData();
  
          QFocusEvent event(QEvent::FocusIn, Qt::OtherFocusReason);
--        q->sendEvent(newActiveFocusItem, &event); 
++        q->sendEvent(newActiveFocusItem, &event);
      } else {
          updateInputMethodData();
      }
@@@ -778,12 -782,12 +778,12 @@@ void QSGCanvasPrivate::clearFocusInScop
          updateInputMethodData();
  
          QFocusEvent event(QEvent::FocusIn, Qt::OtherFocusReason);
--        q->sendEvent(newActiveFocusItem, &event); 
++        q->sendEvent(newActiveFocusItem, &event);
      } else {
          updateInputMethodData();
      }
  
--    if (!changed.isEmpty()) 
++    if (!changed.isEmpty())
          notifyFocusChangesRecur(changed.data(), changed.count() - 1);
  }
  
@@@ -807,7 -811,7 +807,7 @@@ void QSGCanvasPrivate::notifyFocusChang
              itemPrivate->itemChange(QSGItem::ItemActiveFocusHasChanged, itemPrivate->activeFocus);
              emit item->activeFocusChanged(itemPrivate->activeFocus);
          }
--    } 
++    }
  }
  
  void QSGCanvasPrivate::updateInputMethodData()
@@@ -891,21 -933,21 +891,21 @@@ QSGCanvas::~QSGCanvas(
  QSGItem *QSGCanvas::rootItem() const
  {
      Q_D(const QSGCanvas);
--    
++
      return d->rootItem;
  }
  
  QSGItem *QSGCanvas::activeFocusItem() const
  {
      Q_D(const QSGCanvas);
--    
++
      return d->activeFocusItem;
  }
  
  QSGItem *QSGCanvas::mouseGrabberItem() const
  {
      Q_D(const QSGCanvas);
--    
++
      return d->mouseGrabberItem;
  }
  
@@@ -1016,7 -1081,7 +1016,7 @@@ bool QSGCanvasPrivate::deliverInitialMo
              event->accept();
              mouseGrabberItem = item;
              q->sendEvent(item, event);
--            if (event->isAccepted()) 
++            if (event->isAccepted())
                  return true;
              mouseGrabberItem->ungrabMouse();
              mouseGrabberItem = 0;
@@@ -1030,10 -1095,10 +1030,10 @@@ bool QSGCanvasPrivate::deliverMouseEven
  {
      Q_Q(QSGCanvas);
  
--    if (!mouseGrabberItem && 
++    if (!mouseGrabberItem &&
           sceneEvent->type() == QEvent::GraphicsSceneMousePress &&
           (sceneEvent->button() & sceneEvent->buttons()) == sceneEvent->buttons()) {
--        
++
          return deliverInitialMousePressEvent(rootItem, sceneEvent);
      }
  
  void QSGCanvas::mousePressEvent(QMouseEvent *event)
  {
      Q_D(QSGCanvas);
--    
++
  #ifdef MOUSE_DEBUG
      qWarning() << "QSGCanvas::mousePressEvent()" << event->pos() << event->button() << event->buttons();
  #endif
  void QSGCanvas::mouseReleaseEvent(QMouseEvent *event)
  {
      Q_D(QSGCanvas);
--    
++
  #ifdef MOUSE_DEBUG
      qWarning() << "QSGCanvas::mouseReleaseEvent()" << event->pos() << event->button() << event->buttons();
  #endif
  void QSGCanvas::mouseDoubleClickEvent(QMouseEvent *event)
  {
      Q_D(QSGCanvas);
--    
++
  #ifdef MOUSE_DEBUG
      qWarning() << "QSGCanvas::mouseDoubleClickEvent()" << event->pos() << event->button() << event->buttons();
  #endif
          else
              event->ignore();
          return;
--    } 
++    }
  
      d->deliverMouseEvent(&sceneEvent);
      event->setAccepted(sceneEvent.isAccepted());
@@@ -1129,7 -1194,7 +1129,7 @@@ bool QSGCanvasPrivate::sendHoverEvent(Q
  void QSGCanvas::mouseMoveEvent(QMouseEvent *event)
  {
      Q_D(QSGCanvas);
--    
++
  #ifdef MOUSE_DEBUG
      qWarning() << "QSGCanvas::mouseMoveEvent()" << event->pos() << event->button() << event->buttons();
  #endif
@@@ -1505,17 -1568,17 +1503,17 @@@ bool QSGCanvasPrivate::sendFilteredMous
          return true;
  
      QSGItemPrivate *targetPrivate = QSGItemPrivate::get(target);
--    if (targetPrivate->filtersChildMouseEvents) 
++    if (targetPrivate->filtersChildMouseEvents)
          if (target->childMouseEventFilter(item, event))
              return true;
  
      return false;
  }
  
--bool QSGCanvas::sendEvent(QSGItem *item, QEvent *e) 
--{ 
++bool QSGCanvas::sendEvent(QSGItem *item, QEvent *e)
++{
      Q_D(QSGCanvas);
--    
++
      if (!item) {
          qWarning("QSGCanvas::sendEvent: Cannot send event to a null item");
          return false;
      case QEvent::GraphicsSceneMouseRelease:
      case QEvent::GraphicsSceneMouseDoubleClick:
      case QEvent::GraphicsSceneMouseMove:
--        // XXX todo - should sendEvent be doing this?  how does it relate to forwarded events? 
++        // XXX todo - should sendEvent be doing this?  how does it relate to forwarded events?
          {
              QGraphicsSceneMouseEvent *se = static_cast<QGraphicsSceneMouseEvent *>(e);
              if (!d->sendFilteredMouseEvent(item->parentItem(), item, se)) {
          break;
      }
  
--    return false; 
++    return false;
  }
  
  void QSGCanvasPrivate::cleanupNodes()
@@@ -1626,12 -1689,12 +1624,12 @@@ void QSGCanvasPrivate::updateDirtyNode(
      itemPriv->dirtyAttributes = 0;
  
      if ((dirty & QSGItemPrivate::TransformUpdateMask) ||
--        (dirty & QSGItemPrivate::Size && itemPriv->origin != QSGItem::TopLeft && 
++        (dirty & QSGItemPrivate::Size && itemPriv->origin != QSGItem::TopLeft &&
           (itemPriv->scale != 1. || itemPriv->rotation != 0.))) {
  
          QMatrix4x4 matrix;
  
--        if (itemPriv->x != 0. || itemPriv->y != 0.) 
++        if (itemPriv->x != 0. || itemPriv->y != 0.)
              matrix.translate(itemPriv->x, itemPriv->y);
  
          for (int ii = itemPriv->transforms.count() - 1; ii >= 0; --ii)
      if (dirty & QSGItemPrivate::ContentUpdateMask) {
  
          if (itemPriv->flags & QSGItem::ItemHasContents) {
--            updatePaintNodeData.transformNode = itemPriv->itemNode(); 
++            updatePaintNodeData.transformNode = itemPriv->itemNode();
              itemPriv->paintNode = item->updatePaintNode(itemPriv->paintNode, &updatePaintNodeData);
  
--            Q_ASSERT(itemPriv->paintNode == 0 || 
++            Q_ASSERT(itemPriv->paintNode == 0 ||
                       itemPriv->paintNode->parent() == 0 ||
                       itemPriv->paintNode->parent() == itemPriv->childContainerNode());
  
@@@ -1950,14 -2029,12 +1948,14 @@@ void QSGCanvasRenderThread::run(
      qDebug("QML Rendering Thread Started");
  #endif
  
 -    renderer->makeCurrent();
 -
 -    if (!d->context->isReady())
 -        d->initializeSceneGraph();
 +    if (!glContext()) {
 +        createGLContext();
 +        makeCurrent();
 +        initializeSceneGraph();
 +    } else {
 +        makeCurrent();
 +    }
-     
 -    
      while (!shouldExit) {
          lock();
  
@@@ -116,7 -114,7 +116,8 @@@ public
  
      void scheduleUpdate();
  
 +    void scheduleForCleanup();
+     QImage toImage() const;
  
  Q_SIGNALS:
      void textureChanged();
  #include <private/qdeclarativeengine_p.h>
  #include <QtCore/qbasictimer.h>
  
- // XXX todo - This whole class should probably be merged with QDeclarativeView for 
 -// XXX todo - This whole class should probably be merged with QDeclarativeView for 
++// XXX todo - This whole class should probably be merged with QDeclarativeView for
  // maximum seamlessness
  QT_BEGIN_NAMESPACE
  
  DEFINE_BOOL_CONFIG_OPTION(frameRateDebug, QML_SHOW_FRAMERATE)
  
- class QSGViewPrivate : public QSGCanvasPrivate, 
-                        public QSGItemChangeListener
- {
-     Q_DECLARE_PUBLIC(QSGView)
- public:
-     QSGViewPrivate();
-     ~QSGViewPrivate();
-     void execute();
-     void itemGeometryChanged(QSGItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
-     void initResize();
-     void updateSize();
-     void setRootObject(QObject *);
-     void init();
-     QSize rootObjectSize() const;
-     QPointer<QSGItem> root;
-     QUrl source;
-     QDeclarativeEngine engine;
-     QDeclarativeComponent *component;
-     QBasicTimer resizetimer;
-     QSGView::ResizeMode resizeMode;
-     QSize initialSize;
-     QElapsedTimer frameTimer;
-     bool resized;
- };
  void QSGViewPrivate::init()
  {
 -    q_func()->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
      QDeclarativeEnginePrivate::get(&engine)->sgContext = QSGCanvasPrivate::context;
  
      QDeclarativeInspectorService::instance()->addView(q_func());
@@@ -103,8 -73,8 +72,8 @@@ QSGViewPrivate::QSGViewPrivate(
  {
  }
  
--QSGViewPrivate::~QSGViewPrivate() 
--{ 
++QSGViewPrivate::~QSGViewPrivate()
++{
      QDeclarativeInspectorService::instance()->removeView(q_func());
  
      delete root;
@@@ -126,7 -96,7 +95,7 @@@ void QSGViewPrivate::execute(
          if (!component->isLoading()) {
              q->continueExecute();
          } else {
--            QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), 
++            QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
                               q, SLOT(continueExecute()));
          }
      }
@@@ -397,10 -381,26 +366,10 @@@ QSGItem *QSGView::rootObject() cons
  void QSGView::resizeEvent(QResizeEvent *e)
  {
      Q_D(QSGView);
--    if (d->resizeMode == SizeRootObjectToView) 
++    if (d->resizeMode == SizeRootObjectToView)
          d->updateSize();
--    
 -    QSGCanvas::resizeEvent(e);
 -}
 -/*!
 -    \internal
 -*/
 -void QSGView::paintEvent(QPaintEvent *event)
 -{
 -    Q_D(QSGView);
 -    int time = 0;
 -    if (frameRateDebug()) 
 -        time = d->frameTimer.restart();
 -
 -    QSGCanvas::paintEvent(event);
 -
 -    if (frameRateDebug())
 -        qDebug() << "paintEvent:" << d->frameTimer.elapsed() << "time since last frame:" << time;
 +    QSGCanvas::resizeEvent(e);
  }
  
  void QSGView::keyPressEvent(QKeyEvent *e)
@@@ -48,20 -58,45 +58,47 @@@ QT_BEGIN_HEADE
  
  QT_BEGIN_NAMESPACE
  
- class QJSEngine;
- class QDeclarativeEngine;
+ QT_MODULE(Declarative)
+ class QDeclarativeContext;
+ class QDeclarativeError;
+ class QSGItem;
+ class QDeclarativeComponent;
  
- // Helper methods to access private API through a stable interface
- // This is used in the qmljsdebugger library of QtCreator.
- class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper
+ class QSGViewPrivate : public QSGCanvasPrivate,
+                        public QSGItemChangeListener
  {
+     Q_DECLARE_PUBLIC(QSGView)
  public:
-     static QJSEngine *getScriptEngine(QDeclarativeEngine *engine);
-     static void setAnimationSlowDownFactor(qreal factor);
+     static QSGViewPrivate* get(QSGView *view) { return view->d_func(); }
+     static const QSGViewPrivate* get(const QSGView *view) { return view->d_func(); }
+     QSGViewPrivate();
+     ~QSGViewPrivate();
+     void execute();
+     void itemGeometryChanged(QSGItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
+     void initResize();
+     void updateSize();
+     void setRootObject(QObject *);
+     void init();
+     QSize rootObjectSize() const;
+     QPointer<QSGItem> root;
+     QUrl source;
+     QDeclarativeEngine engine;
+     QDeclarativeComponent *component;
+     QBasicTimer resizetimer;
+     QSGView::ResizeMode resizeMode;
+     QSize initialSize;
+     QElapsedTimer frameTimer;
 +
-     // Enables remote debugging functionality
-     // Only use this for debugging in a safe environment!
-     static void enableDebugging();
++    bool resized;
  };
  
  QT_END_NAMESPACE
@@@ -438,12 -457,8 +465,14 @@@ QSGShaderEffectNode* QSGCustomParticle:
          s.fragmentCode = qt_particles_default_fragment_code;
      if (s.vertexCode.isEmpty())
          s.vertexCode = qt_particles_default_vertex_code;
 +
 +    if (!m_material) {
 +        m_material = new QSGShaderEffectMaterialObject;
 +    }
 +
+     s.vertexCode = qt_particles_template_vertex_code + s.vertexCode;
 -    m_material.setProgramSource(s);
 +    m_material->setProgramSource(s);
++
      foreach (const QString &str, m_particles){
          int gIdx = m_system->m_groupIds[str];
          int count = m_system->m_groupData[gIdx]->size();
@@@ -2,7 -2,7 +2,7 @@@ TARGET  = qmlgesturesplugi
  TARGETPATH = Qt/labs/gestures
  include(../qimportbase.pri)
  
- QT += core-private gui-private declarative-private qtquick1 qtquick1-private widgets-private
 -QT += core-private gui-private v8-private declarative-private qtquick1 qtquick1-private
++QT += core-private gui-private declarative-private qtquick1 qtquick1-private widgets-private v8-private
  
  SOURCES += qdeclarativegesturearea.cpp plugin.cpp
  HEADERS += qdeclarativegesturearea_p.h
@@@ -9,7 -9,7 +9,7 @@@ SOURCES += 
      particles.cpp \
      V1/qdeclarativeparticles.cpp 
  
- QT += declarative opengl core gui declarative-private core-private gui-private qtquick1 qtquick1-private widgets-private
 -QT += declarative opengl core gui v8-private declarative-private core-private gui-private qtquick1 qtquick1-private
++QT += declarative opengl core gui declarative-private core-private gui-private qtquick1 qtquick1-private widgets-private v8-private
  
  OTHER_FILES += \
      qmldir
  
  #include <QtDeclarative/QDeclarativeEngine>
  #include <QtDeclarative/QDeclarativeComponent>
- #include <QtDeclarative/private/qdeclarativedebughelper_p.h>
+ #include <QtCore/private/qabstractanimation_p.h>
  #include "QtDeclarative/private/qdeclarativeinspectorservice_p.h"
  
 -#include <QtGui/QVBoxLayout>
 +#include <QtWidgets/QVBoxLayout>
  #include <QtGui/QMouseEvent>
  #include <QtCore/QSettings>
  
@@@ -1,7 -1,7 +1,7 @@@
  load(qt_module)
  
  TARGET = qmldbg_inspector
- QT       += declarative-private core-private gui-private opengl-private qtquick1 widgets widgets-private
 -QT       += declarative-private core-private gui-private v8-private opengl-private qtquick1
++QT       += declarative-private core-private gui-private opengl-private qtquick1 widgets widgets-private v8-private
  
  load(qt_plugin)
  
Simple merge
@@@ -7,7 -7,8 +7,8 @@@ CONFIG += modul
  CONFIG += dll warn_on
  MODULE_PRI += ../../modules/qt_qtquick1.pri
  
- QT += testlib-private declarative testlib declarative-private core-private gui-private network widgets-private
 -QT += testlib-private declarative testlib declarative-private core-private gui-private network v8-private
++QT += testlib-private declarative testlib declarative-private core-private gui-private network widgets-private v8-private
+ DEFINES += QT_NO_URL_CAST_FROM_STRING
  
  load(qt_module_config)
  
@@@ -18,6 -18,6 +18,6 @@@ symbian: 
  
  CONFIG += parallel_test
  
- QT += core-private gui-private declarative-private qtquick1-private widgets-private
 -QT += core-private gui-private v8-private declarative-private qtquick1-private
++QT += core-private gui-private declarative-private qtquick1-private widgets-private v8-private
  
  qpa:CONFIG+=insignificant_test  # QTBUG-20990, aborts
@@@ -14,5 -14,5 +14,5 @@@ symbian: 
  }
  
  CONFIG += parallel_test
- QT += core-private gui-private declarative-private widgets widgets-private
 -QT += core-private gui-private v8-private declarative-private
++QT += core-private gui-private declarative-private widgets widgets-private v8-private
  QT += opengl-private
@@@ -17,4 -17,4 +17,4 @@@ symbian: 
  }
  
  CONFIG += parallel_test
- QT += core-private gui-private declarative-private qtquick1-private widgets-private
 -QT += core-private gui-private v8-private declarative-private qtquick1-private
++QT += core-private gui-private declarative-private qtquick1-private widgets-private v8-private
Simple merge
Simple merge