summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-02-16 06:49:44 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-02-16 06:49:44 (GMT)
commit7ff185d25de2a941e78cba72e4ec53913251cfbe (patch)
tree1d79d691e539e8608d426abce39d65de09fc17a7
parent1c486fb2c993c966970caf377498c5d5fb8421a2 (diff)
parenta601e6d71c8f6ae76b8ab820e6a49e29f3a7ba8d (diff)
downloadQt-7ff185d25de2a941e78cba72e4ec53913251cfbe.zip
Qt-7ff185d25de2a941e78cba72e4ec53913251cfbe.tar.gz
Qt-7ff185d25de2a941e78cba72e4ec53913251cfbe.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
-rw-r--r--configure.exebin1180160 -> 1179136 bytes
-rw-r--r--examples/declarative/imageprovider/imageprovider.pro9
-rw-r--r--examples/declarative/imageprovider/imageprovider.qrc5
-rw-r--r--examples/declarative/imageprovider/main.cpp (renamed from tools/qmldebugger/standalone/objecttree.h)91
-rw-r--r--examples/declarative/imageprovider/view.qml22
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/qt/AccessibilityObjectQt.cpp4
-rw-r--r--src/corelib/global/qglobal.h3
-rw-r--r--src/corelib/global/qmalloc.cpp1
-rw-r--r--src/declarative/debugger/qmldebug.cpp8
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h6
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem.cpp4
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp4
-rw-r--r--src/declarative/qml/qml.pri2
-rw-r--r--src/declarative/qml/qmlbinding.cpp6
-rw-r--r--src/declarative/qml/qmlbinding.h3
-rw-r--r--src/declarative/qml/qmlcleanup.cpp4
-rw-r--r--src/declarative/qml/qmlcompiledbindings.cpp302
-rw-r--r--src/declarative/qml/qmlcompositetypedata_p.h2
-rw-r--r--src/declarative/qml/qmlcontext.cpp4
-rw-r--r--src/declarative/qml/qmlengine.cpp89
-rw-r--r--src/declarative/qml/qmlengine.h5
-rw-r--r--src/declarative/qml/qmlengine_p.h8
-rw-r--r--src/declarative/qml/qmlguard_p.h4
-rw-r--r--src/declarative/qml/qmlimageprovider.cpp (renamed from tools/qmldebugger/standalone/main.cpp)53
-rw-r--r--src/declarative/qml/qmlimageprovider.h (renamed from tools/qmldebugger/standalone/canvasframerate.h)51
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp13
-rw-r--r--src/declarative/qml/qmlmetatype.cpp3
-rw-r--r--src/declarative/qml/qmlpropertycache.cpp4
-rw-r--r--src/declarative/qml/qmlscriptstring.h4
-rw-r--r--src/declarative/qml/qmlsqldatabase.cpp3
-rw-r--r--src/declarative/qml/qmlsqldatabase_p.h4
-rw-r--r--src/declarative/qml/qmlstringconverters_p.h4
-rw-r--r--src/declarative/qml/qmlworkerscript.cpp10
-rw-r--r--src/declarative/qml/qmlxmlhttprequest.cpp8
-rw-r--r--src/declarative/qml/qmlxmlhttprequest_p.h4
-rw-r--r--src/declarative/util/qmlpixmapcache.cpp42
-rw-r--r--src/declarative/util/qmlstategroup.cpp4
-rw-r--r--src/declarative/util/qmlstyledtext.cpp4
-rw-r--r--src/declarative/util/qmlstyledtext_p.h5
-rw-r--r--src/declarative/util/qmlxmllistmodel.cpp4
-rw-r--r--src/gui/kernel/qapplication.cpp6
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp4
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp4
-rw-r--r--src/plugins/imageformats/ico/qicohandler.h4
-rw-r--r--tests/auto/declarative/declarative.pro1
-rw-r--r--tests/auto/declarative/qmlimageprovider/data/exists.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qmlimageprovider/data/exists1.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qmlimageprovider/data/exists2.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qmlimageprovider/qmlimageprovider.pro12
-rw-r--r--tests/auto/declarative/qmlimageprovider/tst_qmlimageprovider.cpp164
-rw-r--r--tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp30
-rw-r--r--tools/configure/configureapp.cpp4
-rw-r--r--tools/linguist/lconvert/main.cpp2
-rw-r--r--tools/linguist/lupdate/qscript.cpp41
-rw-r--r--tools/qmldebugger/qmldebugger.pro5
-rw-r--r--tools/qmldebugger/standalone/canvasframerate.cpp581
-rw-r--r--tools/qmldebugger/standalone/engine.cpp219
-rw-r--r--tools/qmldebugger/standalone/engine.h101
-rw-r--r--tools/qmldebugger/standalone/engine.pngbin6394 -> 0 bytes
-rw-r--r--tools/qmldebugger/standalone/engines.qml46
-rw-r--r--tools/qmldebugger/standalone/expressionquerywidget.cpp276
-rw-r--r--tools/qmldebugger/standalone/expressionquerywidget.h105
-rw-r--r--tools/qmldebugger/standalone/objectpropertiesview.cpp274
-rw-r--r--tools/qmldebugger/standalone/objectpropertiesview.h93
-rw-r--r--tools/qmldebugger/standalone/objecttree.cpp231
-rw-r--r--tools/qmldebugger/standalone/qmldebugger.cpp181
-rw-r--r--tools/qmldebugger/standalone/qmldebugger.h90
-rw-r--r--tools/qmldebugger/standalone/qmldebugger.pri18
-rw-r--r--tools/qmldebugger/standalone/qmldebugger.qrc7
-rw-r--r--tools/qmldebugger/standalone/refresh.pngbin6169 -> 0 bytes
-rw-r--r--tools/qmldebugger/standalone/standalone.pro19
-rw-r--r--tools/qmldebugger/standalone/watchtable.cpp366
-rw-r--r--tools/qmldebugger/standalone/watchtable.h154
-rw-r--r--tools/qmlviewer/deviceorientation.cpp2
-rw-r--r--tools/qmlviewer/deviceorientation.h4
-rw-r--r--tools/qmlviewer/main.cpp2
-rw-r--r--tools/qmlviewer/proxysettings.cpp4
-rw-r--r--tools/qmlviewer/proxysettings.h3
-rw-r--r--tools/qmlviewer/qfxtester.h20
-rw-r--r--tools/qmlviewer/qmlfolderlistmodel.cpp2
-rw-r--r--tools/qmlviewer/qmlfolderlistmodel.h4
-rw-r--r--tools/qmlviewer/qmlviewer.cpp6
-rw-r--r--tools/qtestlib/chart/database.cpp3
-rw-r--r--tools/qtestlib/chart/database.h6
-rw-r--r--tools/qtestlib/chart/reportgenerator.cpp2
-rw-r--r--tools/qtestlib/chart/reportgenerator.h5
-rw-r--r--tools/tools.pro2
87 files changed, 804 insertions, 3105 deletions
diff --git a/configure.exe b/configure.exe
index 8913de1..980c190 100644
--- a/configure.exe
+++ b/configure.exe
Binary files differ
diff --git a/examples/declarative/imageprovider/imageprovider.pro b/examples/declarative/imageprovider/imageprovider.pro
new file mode 100644
index 0000000..60423ab
--- /dev/null
+++ b/examples/declarative/imageprovider/imageprovider.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+TARGET = imageprovider
+DEPENDPATH += .
+INCLUDEPATH += .
+QT += declarative
+
+# Input
+SOURCES += main.cpp
+RESOURCES += imageprovider.qrc
diff --git a/examples/declarative/imageprovider/imageprovider.qrc b/examples/declarative/imageprovider/imageprovider.qrc
new file mode 100644
index 0000000..17e9301
--- /dev/null
+++ b/examples/declarative/imageprovider/imageprovider.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>view.qml</file>
+</qresource>
+</RCC>
diff --git a/tools/qmldebugger/standalone/objecttree.h b/examples/declarative/imageprovider/main.cpp
index c8d625c..718e9bb 100644
--- a/tools/qmldebugger/standalone/objecttree.h
+++ b/examples/declarative/imageprovider/main.cpp
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the Qt QML Debugger of the Qt Toolkit.
+** This file is part of the demonstration applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -38,59 +38,62 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef OBJECTTREE_H
-#define OBJECTTREE_H
-#include <QtGui/qtreewidget.h>
+#include <QApplication>
-QT_BEGIN_NAMESPACE
+#include <qmlengine.h>
+#include <qmlcontext.h>
+#include <qml.h>
+#include <qmlgraphicsitem.h>
+#include <qmlimageprovider.h>
+#include <qmlview.h>
+#include <QImage>
+#include <QPainter>
-class QTreeWidgetItem;
+/*
+ This example illustrates using a QmlImageProvider to serve
+ images asynchronously.
+*/
-class QmlEngineDebug;
-class QmlDebugObjectReference;
-class QmlDebugObjectQuery;
-class QmlDebugContextReference;
-class QmlDebugConnection;
-
-
-class ObjectTree : public QTreeWidget
+//![0]
+class ColorImageProvider : public QmlImageProvider
{
- Q_OBJECT
public:
- ObjectTree(QmlEngineDebug *client = 0, QWidget *parent = 0);
-
- void setEngineDebug(QmlEngineDebug *client);
-
-signals:
- void currentObjectChanged(const QmlDebugObjectReference &);
- void activated(const QmlDebugObjectReference &);
- void expressionWatchRequested(const QmlDebugObjectReference &, const QString &);
-
-public slots:
- void reload(int objectDebugId); // set the root object
- void setCurrentObject(int debugId); // select an object in the tree
+ // This is run in a low priority thread.
+ QImage request(const QString &id) {
+ QImage image(100, 50, QImage::Format_RGB32);
+ image.fill(QColor(id).rgba());
+ QPainter p(&image);
+ p.setPen(Qt::black);
+ p.drawText(QRectF(0,0,100,50),Qt::AlignCenter,id);
+ return image;
+ }
+};
-protected:
- virtual void mousePressEvent(QMouseEvent *);
+int main(int argc, char ** argv)
+{
+ QApplication app(argc, argv);
-private slots:
- void objectFetched();
- void currentItemChanged(QTreeWidgetItem *);
- void activated(QTreeWidgetItem *);
+ QmlView view;
+ view.setUrl(QUrl("qrc:view.qml"));
-private:
- QTreeWidgetItem *findItemByObjectId(int debugId) const;
- QTreeWidgetItem *findItem(QTreeWidgetItem *item, int debugId) const;
- void dump(const QmlDebugContextReference &, int);
- void dump(const QmlDebugObjectReference &, int);
- void buildTree(const QmlDebugObjectReference &, QTreeWidgetItem *parent);
+ view.engine()->addImageProvider("colors", new ColorImageProvider);
- QmlEngineDebug *m_client;
- QmlDebugObjectQuery *m_query;
-};
+ QStringList dataList;
+ dataList.append("image://colors/red");
+ dataList.append("image://colors/green");
+ dataList.append("image://colors/blue");
+ dataList.append("image://colors/brown");
+ dataList.append("image://colors/orange");
+ dataList.append("image://colors/purple");
+ dataList.append("image://colors/yellow");
-QT_END_NAMESPACE
+ QmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
+ view.execute();
+ view.show();
-#endif
+ return app.exec();
+}
+//![0]
diff --git a/examples/declarative/imageprovider/view.qml b/examples/declarative/imageprovider/view.qml
new file mode 100644
index 0000000..2ab729d
--- /dev/null
+++ b/examples/declarative/imageprovider/view.qml
@@ -0,0 +1,22 @@
+import Qt 4.6
+//![0]
+ListView {
+ width: 100
+ height: 100
+ anchors.fill: parent
+ model: myModel
+ delegate: Component {
+ Item {
+ width: 100
+ height: 50
+ Text {
+ text: "Loading..."
+ anchors.centerIn: parent
+ }
+ Image {
+ source: modelData
+ }
+ }
+ }
+}
+//![0]
diff --git a/src/3rdparty/webkit/WebCore/accessibility/qt/AccessibilityObjectQt.cpp b/src/3rdparty/webkit/WebCore/accessibility/qt/AccessibilityObjectQt.cpp
index 07f13d4..756ece3 100644
--- a/src/3rdparty/webkit/WebCore/accessibility/qt/AccessibilityObjectQt.cpp
+++ b/src/3rdparty/webkit/WebCore/accessibility/qt/AccessibilityObjectQt.cpp
@@ -20,6 +20,8 @@
#include "config.h"
#include "AccessibilityObject.h"
+QT_BEGIN_NAMESPACE
+
#if HAVE(ACCESSIBILITY)
namespace WebCore {
@@ -37,3 +39,5 @@ AccessibilityObjectPlatformInclusion AccessibilityObject::accessibilityPlatformI
} // namespace WebCore
#endif // HAVE(ACCESSIBILITY)
+
+QT_END_NAMESPACE
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 99bbe42..7e7d7d8 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -864,6 +864,9 @@ typedef quint64 qulonglong;
# endif
#endif
+#define Q_INIT_RESOURCE_EXTERN(name) \
+ extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) ();
+
#define Q_INIT_RESOURCE(name) \
do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \
QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (0)
diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp
index 43e89e3..090998c 100644
--- a/src/corelib/global/qmalloc.cpp
+++ b/src/corelib/global/qmalloc.cpp
@@ -124,3 +124,4 @@ void qFreeAligned(void *ptr)
}
QT_END_NAMESPACE
+
diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp
index dc779ac..41e27bc 100644
--- a/src/declarative/debugger/qmldebug.cpp
+++ b/src/declarative/debugger/qmldebug.cpp
@@ -47,6 +47,8 @@
#include <private/qobject_p.h>
+QT_BEGIN_NAMESPACE
+
class QmlEngineDebugClient : public QmlDebugClient
{
public:
@@ -142,8 +144,6 @@ void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugExpressionQuery *q
}
}
-
-Q_DECLARE_METATYPE(QmlDebugObjectReference);
void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugObjectReference &o,
bool simple)
{
@@ -932,3 +932,7 @@ bool QmlDebugPropertyReference::hasNotifySignal() const
{
return m_hasNotifySignal;
}
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QmlDebugObjectReference);
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h b/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h
index 5b02158..22eabdd 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h
@@ -87,9 +87,6 @@ public:
return item == other.item && anchorLine == other.anchorLine;
}
};
-Q_DECLARE_METATYPE(QmlGraphicsAnchorLine)
-
-
class QmlGraphicsAnchorsPrivate : public QObjectPrivate, public QmlGraphicsItemChangeListener
{
@@ -171,4 +168,7 @@ public:
};
QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QmlGraphicsAnchorLine)
+
#endif
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
index 08c0c2d..2fbf18b 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
@@ -2880,6 +2880,6 @@ int QmlGraphicsItemPrivate::restart(QTime &t)
return n;
}
-#include <moc_qmlgraphicsitem.cpp>
-
QT_END_NAMESPACE
+
+#include <moc_qmlgraphicsitem.cpp>
diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
index b4487a6..cc416d0 100644
--- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
@@ -62,8 +62,6 @@
#include <private/qobject_p.h>
-QML_DECLARE_TYPE(QListModelInterface)
-
QT_BEGIN_NAMESPACE
QHash<QObject*, QmlGraphicsVisualItemModelAttached*> QmlGraphicsVisualItemModelAttached::attachedProperties;
@@ -1110,4 +1108,6 @@ void QmlGraphicsVisualDataModel::_q_destroyingPackage(QmlPackage *package)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QListModelInterface)
+
#include <qmlgraphicsvisualitemmodel.moc>
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index cd2fbff..021ef9e 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -50,6 +50,7 @@ SOURCES += \
$$PWD/qmltypenamescriptclass.cpp \
$$PWD/qmllistscriptclass.cpp \
$$PWD/qmlworkerscript.cpp \
+ $$PWD/qmlimageprovider.cpp \
$$PWD/qmlnetworkaccessmanagerfactory.cpp
HEADERS += \
$$PWD/qmlparser_p.h \
@@ -117,6 +118,7 @@ HEADERS += \
$$PWD/qmlworkerscript_p.h \
$$PWD/qmlscriptclass_p.h \
$$PWD/qmlguard_p.h \
+ $$PWD/qmlimageprovider.h \
$$PWD/qmlnetworkaccessmanagerfactory.h
QT += sql
include(parser/parser.pri)
diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp
index 3e29a3c..a986818 100644
--- a/src/declarative/qml/qmlbinding.cpp
+++ b/src/declarative/qml/qmlbinding.cpp
@@ -291,6 +291,12 @@ void QmlAbstractBinding::removeFromObject()
}
}
+void QmlAbstractBinding::clear()
+{
+ if (m_mePtr)
+ *m_mePtr = 0;
+}
+
QString QmlAbstractBinding::expression() const
{
return QLatin1String("<Unknown>");
diff --git a/src/declarative/qml/qmlbinding.h b/src/declarative/qml/qmlbinding.h
index cefb4fe..bae971d 100644
--- a/src/declarative/qml/qmlbinding.h
+++ b/src/declarative/qml/qmlbinding.h
@@ -75,6 +75,9 @@ public:
void addToObject(QObject *);
void removeFromObject();
+protected:
+ void clear();
+
private:
friend class QmlDeclarativeData;
friend class QmlMetaProperty;
diff --git a/src/declarative/qml/qmlcleanup.cpp b/src/declarative/qml/qmlcleanup.cpp
index 599e4e7..e7767d2 100644
--- a/src/declarative/qml/qmlcleanup.cpp
+++ b/src/declarative/qml/qmlcleanup.cpp
@@ -43,6 +43,8 @@
#include "qmlengine_p.h"
+QT_BEGIN_NAMESPACE
+
/*!
\internal
\class QmlCleanup
@@ -82,4 +84,4 @@ QmlCleanup::~QmlCleanup()
prev = 0;
next = 0;
}
-
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlcompiledbindings.cpp b/src/declarative/qml/qmlcompiledbindings.cpp
index b5fbab9..bc62d9a 100644
--- a/src/declarative/qml/qmlcompiledbindings.cpp
+++ b/src/declarative/qml/qmlcompiledbindings.cpp
@@ -39,6 +39,8 @@
**
****************************************************************************/
+// #define COMPILEDBINDINGS_DEBUG
+
#include "qmlcompiledbindings_p.h"
#include <QtDeclarative/qmlinfo.h>
@@ -275,6 +277,7 @@ void QmlCompiledBindingsPrivate::Binding::destroy()
enabled = false;
removeFromObject();
parent->q_func()->release();
+ clear();
}
int QmlCompiledBindings::qt_metacall(QMetaObject::Call c, int id, void **)
@@ -975,6 +978,147 @@ static void throwException(int id, QmlDelayedError *error,
qWarning() << error->error;
}
+static void dumpInstruction(const Instr *instr)
+{
+ switch (instr->common.type) {
+ case Instr::Noop:
+ qWarning().nospace() << "Noop";
+ break;
+ case Instr::Subscribe:
+ qWarning().nospace() << "Subscribe" << "\t\t" << instr->subscribe.offset << "\t" << instr->subscribe.reg << "\t" << instr->subscribe.index;
+ break;
+ case Instr::SubscribeId:
+ qWarning().nospace() << "SubscribeId" << "\t\t" << instr->subscribe.offset << "\t" << instr->subscribe.reg << "\t" << instr->subscribe.index;
+ break;
+ case Instr::LoadId:
+ qWarning().nospace() << "LoadId" << "\t\t\t" << instr->load.index << "\t" << instr->load.reg;
+ break;
+ case Instr::LoadScope:
+ qWarning().nospace() << "LoadScope" << "\t\t" << instr->load.index << "\t" << instr->load.reg;
+ break;
+ case Instr::LoadRoot:
+ qWarning().nospace() << "LoadRoot" << "\t\t" << instr->load.index << "\t" << instr->load.reg;
+ break;
+ case Instr::LoadAttached:
+ qWarning().nospace() << "LoadAttached" << "\t\t" << instr->attached.output << "\t" << instr->attached.reg << "\t" << instr->attached.index;
+ break;
+ case Instr::ConvertIntToReal:
+ qWarning().nospace() << "ConvertIntToReal" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
+ break;
+ case Instr::ConvertRealToInt:
+ qWarning().nospace() << "ConvertRealToInt" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
+ break;
+ case Instr::Real:
+ qWarning().nospace() << "Real" << "\t\t\t" << instr->real_value.reg << "\t" << instr->real_value.value;
+ break;
+ case Instr::Int:
+ qWarning().nospace() << "Int" << "\t\t\t" << instr->int_value.reg << "\t" << instr->int_value.value;
+ break;
+ case Instr::Bool:
+ qWarning().nospace() << "Bool" << "\t\t\t" << instr->bool_value.reg << "\t" << instr->bool_value.value;
+ break;
+ case Instr::String:
+ qWarning().nospace() << "String" << "\t\t\t" << instr->string_value.reg << "\t" << instr->string_value.offset << "\t" << instr->string_value.length;
+ break;
+ case Instr::AddReal:
+ qWarning().nospace() << "AddReal" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
+ break;
+ case Instr::AddInt:
+ qWarning().nospace() << "AddInt" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
+ break;
+ case Instr::AddString:
+ qWarning().nospace() << "AddString" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
+ break;
+ case Instr::MinusReal:
+ qWarning().nospace() << "MinusReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
+ break;
+ case Instr::MinusInt:
+ qWarning().nospace() << "MinusInt" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
+ break;
+ case Instr::CompareReal:
+ qWarning().nospace() << "CompareReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
+ break;
+ case Instr::CompareString:
+ qWarning().nospace() << "CompareString" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
+ break;
+ case Instr::NotCompareReal:
+ qWarning().nospace() << "NotCompareReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
+ break;
+ case Instr::NotCompareString:
+ qWarning().nospace() << "NotCompareString" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
+ break;
+ case Instr::GreaterThanReal:
+ qWarning().nospace() << "GreaterThanReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
+ break;
+ case Instr::MaxReal:
+ qWarning().nospace() << "MaxReal" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
+ break;
+ case Instr::MinReal:
+ qWarning().nospace() << "MinReal" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
+ break;
+ case Instr::NewString:
+ qWarning().nospace() << "NewString" << "\t\t" << instr->construct.reg;
+ break;
+ case Instr::NewUrl:
+ qWarning().nospace() << "NewUrl" << "\t\t\t" << instr->construct.reg;
+ break;
+ case Instr::CleanupString:
+ qWarning().nospace() << "CleanupString" << "\t\t" << instr->cleanup.reg;
+ break;
+ case Instr::CleanupUrl:
+ qWarning().nospace() << "CleanupUrl" << "\t\t" << instr->cleanup.reg;
+ break;
+ case Instr::Fetch:
+ qWarning().nospace() << "Fetch" << "\t\t\t" << instr->fetch.output << "\t" << instr->fetch.index << "\t" << instr->fetch.objectReg;
+ break;
+ case Instr::Store:
+ qWarning().nospace() << "Store" << "\t\t\t" << instr->store.output << "\t" << instr->store.index << "\t" << instr->store.reg;
+ break;
+ case Instr::Copy:
+ qWarning().nospace() << "Copy" << "\t\t\t" << instr->copy.reg << "\t" << instr->copy.src;
+ break;
+ case Instr::Skip:
+ qWarning().nospace() << "Skip" << "\t\t\t" << instr->skip.reg << "\t" << instr->skip.count;
+ break;
+ case Instr::Done:
+ qWarning().nospace() << "Done";
+ break;
+ case Instr::InitString:
+ qWarning().nospace() << "InitString" << "\t\t" << instr->initstring.offset << "\t" << instr->initstring.dataIdx;
+ break;
+ case Instr::FindGeneric:
+ qWarning().nospace() << "FindGeneric" << "\t\t" << instr->find.reg << "\t" << instr->find.name;
+ break;
+ case Instr::FindGenericTerminal:
+ qWarning().nospace() << "FindGenericTerminal" << "\t" << instr->find.reg << "\t" << instr->find.name;
+ break;
+ case Instr::FindProperty:
+ qWarning().nospace() << "FindProperty" << "\t\t" << instr->find.reg << "\t" << instr->find.src << "\t" << instr->find.name;
+ break;
+ case Instr::FindPropertyTerminal:
+ qWarning().nospace() << "FindPropertyTerminal" << "\t" << instr->find.reg << "\t" << instr->find.src << "\t" << instr->find.name;
+ break;
+ case Instr::CleanupGeneric:
+ qWarning().nospace() << "CleanupGeneric" << "\t\t" << instr->cleanup.reg;
+ break;
+ case Instr::ConvertGenericToReal:
+ qWarning().nospace() << "ConvertGenericToReal" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
+ break;
+ case Instr::ConvertGenericToBool:
+ qWarning().nospace() << "ConvertGenericToBool" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
+ break;
+ case Instr::ConvertGenericToString:
+ qWarning().nospace() << "ConvertGenericToString" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
+ break;
+ case Instr::ConvertGenericToUrl:
+ qWarning().nospace() << "ConvertGenericToUrl" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
+ break;
+ default:
+ qWarning().nospace() << "Unknown";
+ break;
+ }
+}
+
void QmlCompiledBindingsPrivate::run(int instrIndex,
QmlContextPrivate *context, QmlDelayedError *error,
QObject *scope, QObject *output)
@@ -990,7 +1134,14 @@ void QmlCompiledBindingsPrivate::run(int instrIndex,
instr += instrIndex;
const char *data = program->data();
+#ifdef COMPILEDBINDINGS_DEBUG
+ qWarning().nospace() << "Begin binding run";
+#endif
+
while (instr) {
+#ifdef COMPILEDBINDINGS_DEBUG
+ dumpInstruction(instr);
+#endif
switch (instr->common.type) {
case Instr::Noop:
@@ -1403,144 +1554,7 @@ void QmlBindingCompiler::dump(const QByteArray &programData)
while (count--) {
- switch (instr->common.type) {
- case Instr::Noop:
- qWarning().nospace() << "Noop";
- break;
- case Instr::Subscribe:
- qWarning().nospace() << "Subscribe" << "\t\t" << instr->subscribe.offset << "\t" << instr->subscribe.reg << "\t" << instr->subscribe.index;
- break;
- case Instr::SubscribeId:
- qWarning().nospace() << "SubscribeId" << "\t\t" << instr->subscribe.offset << "\t" << instr->subscribe.reg << "\t" << instr->subscribe.index;
- break;
- case Instr::LoadId:
- qWarning().nospace() << "LoadId" << "\t\t\t" << instr->load.index << "\t" << instr->load.reg;
- break;
- case Instr::LoadScope:
- qWarning().nospace() << "LoadScope" << "\t\t" << instr->load.index << "\t" << instr->load.reg;
- break;
- case Instr::LoadRoot:
- qWarning().nospace() << "LoadRoot" << "\t\t" << instr->load.index << "\t" << instr->load.reg;
- break;
- case Instr::LoadAttached:
- qWarning().nospace() << "LoadAttached" << "\t\t" << instr->attached.output << "\t" << instr->attached.reg << "\t" << instr->attached.index;
- break;
- case Instr::ConvertIntToReal:
- qWarning().nospace() << "ConvertIntToReal" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
- break;
- case Instr::ConvertRealToInt:
- qWarning().nospace() << "ConvertRealToInt" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
- break;
- case Instr::Real:
- qWarning().nospace() << "Real" << "\t\t\t" << instr->real_value.reg << "\t" << instr->real_value.value;
- break;
- case Instr::Int:
- qWarning().nospace() << "Int" << "\t\t\t" << instr->int_value.reg << "\t" << instr->int_value.value;
- break;
- case Instr::Bool:
- qWarning().nospace() << "Bool" << "\t\t\t" << instr->bool_value.reg << "\t" << instr->bool_value.value;
- break;
- case Instr::String:
- qWarning().nospace() << "String" << "\t\t\t" << instr->string_value.reg << "\t" << instr->string_value.offset << "\t" << instr->string_value.length;
- break;
- case Instr::AddReal:
- qWarning().nospace() << "AddReal" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
- break;
- case Instr::AddInt:
- qWarning().nospace() << "AddInt" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
- break;
- case Instr::AddString:
- qWarning().nospace() << "AddString" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
- break;
- case Instr::MinusReal:
- qWarning().nospace() << "MinusReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
- break;
- case Instr::MinusInt:
- qWarning().nospace() << "MinusInt" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
- break;
- case Instr::CompareReal:
- qWarning().nospace() << "CompareReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
- break;
- case Instr::CompareString:
- qWarning().nospace() << "CompareString" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
- break;
- case Instr::NotCompareReal:
- qWarning().nospace() << "NotCompareReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
- break;
- case Instr::NotCompareString:
- qWarning().nospace() << "NotCompareString" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
- break;
- case Instr::GreaterThanReal:
- qWarning().nospace() << "GreaterThanReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
- break;
- case Instr::MaxReal:
- qWarning().nospace() << "MaxReal" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
- break;
- case Instr::MinReal:
- qWarning().nospace() << "MinReal" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2;
- break;
- case Instr::NewString:
- qWarning().nospace() << "NewString" << "\t\t" << instr->construct.reg;
- break;
- case Instr::NewUrl:
- qWarning().nospace() << "NewUrl" << "\t\t\t" << instr->construct.reg;
- break;
- case Instr::CleanupString:
- qWarning().nospace() << "CleanupString" << "\t\t" << instr->cleanup.reg;
- break;
- case Instr::CleanupUrl:
- qWarning().nospace() << "CleanupUrl" << "\t\t" << instr->cleanup.reg;
- break;
- case Instr::Fetch:
- qWarning().nospace() << "Fetch" << "\t\t\t" << instr->fetch.output << "\t" << instr->fetch.index << "\t" << instr->fetch.objectReg;
- break;
- case Instr::Store:
- qWarning().nospace() << "Store" << "\t\t\t" << instr->store.output << "\t" << instr->store.index << "\t" << instr->store.reg;
- break;
- case Instr::Copy:
- qWarning().nospace() << "Copy" << "\t\t\t" << instr->copy.reg << "\t" << instr->copy.src;
- break;
- case Instr::Skip:
- qWarning().nospace() << "Skip" << "\t\t\t" << instr->skip.reg << "\t" << instr->skip.count;
- break;
- case Instr::Done:
- qWarning().nospace() << "Done";
- break;
- case Instr::InitString:
- qWarning().nospace() << "InitString" << "\t\t" << instr->initstring.offset << "\t" << instr->initstring.dataIdx;
- break;
- case Instr::FindGeneric:
- qWarning().nospace() << "FindGeneric" << "\t\t" << instr->find.reg << "\t" << instr->find.name;
- break;
- case Instr::FindGenericTerminal:
- qWarning().nospace() << "FindGenericTerminal" << "\t" << instr->find.reg << "\t" << instr->find.name;
- break;
- case Instr::FindProperty:
- qWarning().nospace() << "FindProperty" << "\t\t" << instr->find.reg << "\t" << instr->find.src << "\t" << instr->find.name;
- break;
- case Instr::FindPropertyTerminal:
- qWarning().nospace() << "FindPropertyTerminal" << "\t" << instr->find.reg << "\t" << instr->find.src << "\t" << instr->find.name;
- break;
- case Instr::CleanupGeneric:
- qWarning().nospace() << "CleanupGeneric" << "\t\t" << instr->cleanup.reg;
- break;
- case Instr::ConvertGenericToReal:
- qWarning().nospace() << "ConvertGenericToReal" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
- break;
- case Instr::ConvertGenericToBool:
- qWarning().nospace() << "ConvertGenericToBool" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
- break;
- case Instr::ConvertGenericToString:
- qWarning().nospace() << "ConvertGenericToString" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
- break;
- case Instr::ConvertGenericToUrl:
- qWarning().nospace() << "ConvertGenericToUrl" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src;
- break;
- default:
- qWarning().nospace() << "Unknown";
- break;
- }
-
+ dumpInstruction(instr);
++instr;
}
}
@@ -1585,6 +1599,9 @@ bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node)
{
resetInstanceState();
+ if (destination->type == -1)
+ return false;
+
Result type;
if (!parseExpression(node, type))
@@ -1864,7 +1881,8 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
subscribeName << contextName();
subscribeName << name;
- fetch(type, context->metaObject(), reg, d0Idx, subscribeName, nameNodes.at(ii));
+ if (!fetch(type, context->metaObject(), reg, d0Idx, subscribeName, nameNodes.at(ii)))
+ return false;
} else if(d1Idx != -1) {
Instr instr;
instr.common.type = Instr::LoadRoot;
@@ -1875,7 +1893,8 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
subscribeName << QLatin1String("$$$ROOT");
subscribeName << name;
- fetch(type, component->metaObject(), reg, d1Idx, subscribeName, nameNodes.at(ii));
+ if (!fetch(type, component->metaObject(), reg, d1Idx, subscribeName, nameNodes.at(ii)))
+ return false;
} else {
Instr find;
if (nameParts.count() == 1)
@@ -1935,8 +1954,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
if (absType || (wasAttachedObject && idx != -1) || (mo && mo->property(idx).isFinal())) {
absType = 0;
- fetch(type, mo, reg, idx, subscribeName, nameNodes.at(ii));
- if (type.type == -1)
+ if (!fetch(type, mo, reg, idx, subscribeName, nameNodes.at(ii)))
return false;
} else {
diff --git a/src/declarative/qml/qmlcompositetypedata_p.h b/src/declarative/qml/qmlcompositetypedata_p.h
index c8b9f25..5358963 100644
--- a/src/declarative/qml/qmlcompositetypedata_p.h
+++ b/src/declarative/qml/qmlcompositetypedata_p.h
@@ -146,5 +146,7 @@ public:
QByteArray data;
};
+QT_END_NAMESPACE
+
#endif // QMLCOMPOSITETYPEDATA_P_H
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp
index d9fc76b..3c419b6 100644
--- a/src/declarative/qml/qmlcontext.cpp
+++ b/src/declarative/qml/qmlcontext.cpp
@@ -300,8 +300,6 @@ QmlContext::~QmlContext()
co->prevContextObject = 0;
}
- delete [] d->idValues;
-
if (d->propertyNames)
d->propertyNames->release();
@@ -310,6 +308,8 @@ QmlContext::~QmlContext()
if (d->optimizedBindings)
d->optimizedBindings->release();
+
+ delete [] d->idValues;
}
void QmlContextPrivate::invalidateEngines()
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 35fc3d4..7da24f4 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -65,6 +65,7 @@
#include "qmlcomponent_p.h"
#include "qmlscriptclass_p.h"
#include "qmlnetworkaccessmanagerfactory.h"
+#include "qmlimageprovider.h"
#include <qfxperf_p_p.h>
@@ -85,6 +86,7 @@
#include <QtCore/qthread.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qdir.h>
+#include <QtCore/qmutex.h>
#include <QtGui/qcolor.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qsound.h>
@@ -432,6 +434,7 @@ QmlContext *QmlEngine::rootContext()
void QmlEngine::setNetworkAccessManagerFactory(QmlNetworkAccessManagerFactory *factory)
{
Q_D(QmlEngine);
+ QMutexLocker locker(&d->mutex);
d->networkAccessManagerFactory = factory;
}
@@ -446,17 +449,24 @@ QmlNetworkAccessManagerFactory *QmlEngine::networkAccessManagerFactory() const
return d->networkAccessManagerFactory;
}
+QNetworkAccessManager *QmlEnginePrivate::createNetworkAccessManager(QObject *parent) const
+{
+ QMutexLocker locker(&mutex);
+ QNetworkAccessManager *nam;
+ if (networkAccessManagerFactory) {
+ nam = networkAccessManagerFactory->create(parent);
+ } else {
+ nam = new QNetworkAccessManager(parent);
+ }
+
+ return nam;
+}
+
QNetworkAccessManager *QmlEnginePrivate::getNetworkAccessManager() const
{
Q_Q(const QmlEngine);
-
- if (!networkAccessManager) {
- if (networkAccessManagerFactory) {
- networkAccessManager = networkAccessManagerFactory->create(const_cast<QmlEngine*>(q));
- } else {
- networkAccessManager = new QNetworkAccessManager(const_cast<QmlEngine*>(q));
- }
- }
+ if (!networkAccessManager)
+ networkAccessManager = createNetworkAccessManager(const_cast<QmlEngine*>(q));
return networkAccessManager;
}
@@ -478,6 +488,69 @@ QNetworkAccessManager *QmlEngine::networkAccessManager() const
}
/*!
+ Sets the \a provider to use for images requested via the \e image: url
+ scheme, with host \a providerId.
+
+ QmlImageProvider allows images to be provided to QML asynchronously.
+ The image request will be run in a low priority thread. This allows
+ potentially costly image loading to be done in the background, without
+ affecting the performance of the UI.
+
+ Note that images loaded from a QmlImageProvider are cached by
+ QPixmapCache, similar to any image loaded by QML.
+
+ The QmlEngine assumes ownership of the provider.
+
+ This example creates a provider with id \e colors:
+
+ \snippet examples/declarative/imageprovider/main.cpp 0
+
+ \snippet examples/declarative/imageprovider/view.qml 0
+
+ \sa removeImageProvider()
+*/
+void QmlEngine::addImageProvider(const QString &providerId, QmlImageProvider *provider)
+{
+ Q_D(QmlEngine);
+ QMutexLocker locker(&d->mutex);
+ d->imageProviders.insert(providerId, provider);
+}
+
+/*!
+ Returns the QmlImageProvider set for \a providerId.
+*/
+QmlImageProvider *QmlEngine::imageProvider(const QString &providerId) const
+{
+ Q_D(const QmlEngine);
+ QMutexLocker locker(&d->mutex);
+ return d->imageProviders.value(providerId);
+}
+
+/*!
+ Removes the QmlImageProvider for \a providerId.
+
+ Returns the provider if it was found; otherwise returns 0.
+
+ \sa addImageProvider()
+*/
+void QmlEngine::removeImageProvider(const QString &providerId)
+{
+ Q_D(QmlEngine);
+ QMutexLocker locker(&d->mutex);
+ delete d->imageProviders.take(providerId);
+}
+
+QImage QmlEnginePrivate::getImageFromProvider(const QUrl &url)
+{
+ QMutexLocker locker(&mutex);
+ QImage image;
+ QmlImageProvider *provider = imageProviders.value(url.host());
+ if (provider)
+ image = provider->request(url.path().mid(1));
+ return image;
+}
+
+/*!
Return the base URL for this engine. The base URL is only used to resolve
components when a relative URL is passed to the QmlComponent constructor.
diff --git a/src/declarative/qml/qmlengine.h b/src/declarative/qml/qmlengine.h
index 7ee014a..a59a1ba 100644
--- a/src/declarative/qml/qmlengine.h
+++ b/src/declarative/qml/qmlengine.h
@@ -62,6 +62,7 @@ class QmlType;
class QUrl;
class QScriptEngine;
class QScriptContext;
+class QmlImageProvider;
class QNetworkAccessManager;
class QmlNetworkAccessManagerFactory;
class Q_DECLARATIVE_EXPORT QmlEngine : public QObject
@@ -83,6 +84,10 @@ public:
QNetworkAccessManager *networkAccessManager() const;
+ void addImageProvider(const QString &id, QmlImageProvider *);
+ QmlImageProvider *imageProvider(const QString &id) const;
+ void removeImageProvider(const QString &id);
+
void setOfflineStoragePath(const QString& dir);
QString offlineStoragePath() const;
diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h
index 13ed5ef..5586311 100644
--- a/src/declarative/qml/qmlengine_p.h
+++ b/src/declarative/qml/qmlengine_p.h
@@ -75,6 +75,7 @@
#include <QtCore/qlist.h>
#include <QtCore/qpair.h>
#include <QtCore/qstack.h>
+#include <QtCore/qmutex.h>
#include <QtScript/qscriptengine.h>
#include <private/qobject_p.h>
@@ -211,10 +212,16 @@ public:
bool inBeginCreate;
+ QNetworkAccessManager *createNetworkAccessManager(QObject *parent) const;
QNetworkAccessManager *getNetworkAccessManager() const;
mutable QNetworkAccessManager *networkAccessManager;
mutable QmlNetworkAccessManagerFactory *networkAccessManagerFactory;
+ QHash<QString,QmlImageProvider*> imageProviders;
+ QImage getImageFromProvider(const QUrl &url);
+
+ mutable QMutex mutex;
+
QmlCompositeTypeManager typeManager;
QStringList fileImportPath;
QString offlineStoragePath;
@@ -309,6 +316,7 @@ public:
static QScriptEngine *getScriptEngine(QmlEngine *e) { return &e->d_func()->scriptEngine; }
static QmlEngine *getEngine(QScriptEngine *e) { return static_cast<QmlScriptEngine*>(e)->p->q_func(); }
static QmlEnginePrivate *get(QmlEngine *e) { return e->d_func(); }
+ static QmlEnginePrivate *get(QmlContext *c) { return (c && c->engine()) ? QmlEnginePrivate::get(c->engine()) : 0; }
static QmlEnginePrivate *get(QScriptEngine *e) { return static_cast<QmlScriptEngine*>(e)->p; }
static QmlEngine *get(QmlEnginePrivate *p) { return p->q_func(); }
QmlContext *getContext(QScriptContext *);
diff --git a/src/declarative/qml/qmlguard_p.h b/src/declarative/qml/qmlguard_p.h
index 1e55bcb..ad8dd84 100644
--- a/src/declarative/qml/qmlguard_p.h
+++ b/src/declarative/qml/qmlguard_p.h
@@ -94,10 +94,10 @@ private:
inline void remGuard();
};
-Q_DECLARE_METATYPE(QmlGuard<QObject>);
-
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QmlGuard<QObject>);
+
#include "qmldeclarativedata_p.h"
QT_BEGIN_NAMESPACE
diff --git a/tools/qmldebugger/standalone/main.cpp b/src/declarative/qml/qmlimageprovider.cpp
index 715837e..ebb8656 100644
--- a/tools/qmldebugger/standalone/main.cpp
+++ b/src/declarative/qml/qmlimageprovider.cpp
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the Qt QML Debugger of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -38,40 +38,31 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <QtGui/qapplication.h>
-#include "qmldebugger.h"
+#include "qmlimageprovider.h"
-int main(int argc, char ** argv)
-{
- QApplication app(argc, argv);
- app.setApplicationName("QtQmlDebugger");
- app.setOrganizationName("Nokia");
- app.setOrganizationDomain("nokia.com");
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QmlImageProvider
+ \brief The QmlImageProvider class provides an interface for threaded image requests.
+
+ Note: the request() method may be called by multiple threads, so ensure the
+ implementation of this method is reentrant.
- QStringList args = app.arguments();
+ \sa QmlEngine::addImageProvider()
+*/
+QmlImageProvider::~QmlImageProvider()
+{
+}
- QmlDebugger win;
- if (args.contains("--engine"))
- win.showEngineTab();
+/*!
+ \fn QImage QmlImageProvider::request(const QString &id)
- for (int i=0; i<args.count(); i++) {
- if (!args[i].contains(':'))
- continue;
- QStringList hostAndPort = args[i].split(':');
- bool ok = false;
- quint16 port = hostAndPort.value(1).toInt(&ok);
- if (ok) {
- qWarning() << "qmldebugger connecting to"
- << hostAndPort[0] << port << "...";
- win.setHost(hostAndPort[0]);
- win.setPort(port);
- win.connectToHost();
- break;
- }
- }
+ Implement this method to return the image with \a id.
- win.show();
+ Note: this method may be called by multiple threads, so ensure the
+ implementation of this method is reentrant.
+*/
- return app.exec();
-}
+QT_END_NAMESPACE
diff --git a/tools/qmldebugger/standalone/canvasframerate.h b/src/declarative/qml/qmlimageprovider.h
index f8eec59..9804815 100644
--- a/tools/qmldebugger/standalone/canvasframerate.h
+++ b/src/declarative/qml/qmlimageprovider.h
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the Qt QML Debugger of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -38,54 +38,27 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef CANVASFRAMERATE_H
-#define CANVASFRAMERATE_H
-#include <QtCore/qpointer.h>
-#include <QtGui/qwidget.h>
+#ifndef QMLIMAGEPROVIDER_H
+#define QMLIMAGEPROVIDER_H
-#include <private/qmldebugclient_p.h>
+#include <QtGui/qimage.h>
-QT_BEGIN_NAMESPACE
+QT_BEGIN_HEADER
-class QTabWidget;
-class QSlider;
-class QGroupBox;
-class QLabel;
-class QSpinBox;
-class QPushButton;
+QT_BEGIN_NAMESPACE
-class CanvasFrameRatePlugin;
+QT_MODULE(Declarative)
-class CanvasFrameRate : public QWidget
+class Q_DECLARATIVE_EXPORT QmlImageProvider
{
- Q_OBJECT
public:
- CanvasFrameRate(QWidget *parent = 0);
-
- void reset(QmlDebugConnection *conn);
-
- void setSizeHint(const QSize &);
- virtual QSize sizeHint() const;
-
-private slots:
- void clearGraph();
- void newTab();
- void enabledToggled(bool);
- void connectionStateChanged(QAbstractSocket::SocketState state);
-
-private:
- void handleConnected(QmlDebugConnection *conn);
-
- QGroupBox *m_group;
- QTabWidget *m_tabs;
- QSpinBox *m_res;
- QPushButton *m_clearButton;
- CanvasFrameRatePlugin *m_plugin;
- QSize m_sizeHint;
+ virtual ~QmlImageProvider();
+ virtual QImage request(const QString &id) = 0;
};
QT_END_NAMESPACE
-#endif // CANVASFRAMERATE_H
+QT_END_HEADER
+#endif // QMLIMAGEPROVIDER
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index f23a50a..70f9ad3 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -276,7 +276,7 @@ const char *QmlMetaProperty::propertyTypeName() const
{
if (type() & ValueTypeProperty) {
- QmlEnginePrivate *ep = d->context?QmlEnginePrivate::get(d->context->engine()):0;
+ QmlEnginePrivate *ep = QmlEnginePrivate::get(d->context);
QmlValueType *valueType = 0;
if (ep) valueType = ep->valueTypes[d->core.propType];
else valueType = QmlValueTypeFactory::valueType(d->core.propType);
@@ -689,7 +689,7 @@ QVariant QmlMetaPropertyPrivate::readValueProperty()
} else if(type & QmlMetaProperty::ValueTypeProperty) {
- QmlEnginePrivate *ep = context?QmlEnginePrivate::get(context->engine()):0;
+ QmlEnginePrivate *ep = QmlEnginePrivate::get(context);
QmlValueType *valueType = 0;
if (ep) valueType = ep->valueTypes[core.propType];
else valueType = QmlValueTypeFactory::valueType(core.propType);
@@ -754,14 +754,15 @@ bool QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value,
QmlMetaProperty::WriteFlags flags)
{
// Remove any existing bindings on this property
- if (!(flags & QmlMetaProperty::DontRemoveBinding))
- delete q->setBinding(0);
+ if (!(flags & QmlMetaProperty::DontRemoveBinding)) {
+ QmlAbstractBinding *binding = q->setBinding(0);
+ if (binding) binding->destroy();
+ }
bool rv = false;
uint type = q->type();
if (type & QmlMetaProperty::ValueTypeProperty) {
- QmlEnginePrivate *ep =
- context?static_cast<QmlEnginePrivate *>(QObjectPrivate::get(context->engine())):0;
+ QmlEnginePrivate *ep = QmlEnginePrivate::get(context);
QmlValueType *writeBack = 0;
if (ep) {
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index e66f600..7dfc48d 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -840,6 +840,8 @@ QList<QmlType*> QmlMetaType::qmlTypes()
return data->nameToType.values();
}
+QT_END_NAMESPACE
+
#include <QtGui/qfont.h>
#include <QtGui/qpixmap.h>
#include <QtGui/qbrush.h>
@@ -867,6 +869,7 @@ QList<QmlType*> QmlMetaType::qmlTypes()
Q_DECLARE_METATYPE(QScriptValue);
+QT_BEGIN_NAMESPACE
/*!
Copies \a copy into \a data, assuming they both are of type \a type. If
\a copy is zero, a default type is copied. Returns true if the copy was
diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp
index 04cffe1..a0a7cea 100644
--- a/src/declarative/qml/qmlpropertycache.cpp
+++ b/src/declarative/qml/qmlpropertycache.cpp
@@ -45,10 +45,10 @@
#include "qmlbinding.h"
#include "qdebug.h"
-QT_BEGIN_NAMESPACE
-
Q_DECLARE_METATYPE(QScriptValue);
+QT_BEGIN_NAMESPACE
+
void QmlPropertyCache::Data::load(const QMetaProperty &p, QmlEngine *engine)
{
propType = p.userType();
diff --git a/src/declarative/qml/qmlscriptstring.h b/src/declarative/qml/qmlscriptstring.h
index 73a473f..d07137e 100644
--- a/src/declarative/qml/qmlscriptstring.h
+++ b/src/declarative/qml/qmlscriptstring.h
@@ -77,10 +77,10 @@ private:
QSharedDataPointer<QmlScriptStringPrivate> d;
};
-Q_DECLARE_METATYPE(QmlScriptString);
-
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QmlScriptString);
+
QT_END_HEADER
#endif // QMLSCRIPTSTRING_H
diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp
index 684caa2..9c951fc 100644
--- a/src/declarative/qml/qmlsqldatabase.cpp
+++ b/src/declarative/qml/qmlsqldatabase.cpp
@@ -65,6 +65,8 @@
Q_DECLARE_METATYPE(QSqlDatabase)
Q_DECLARE_METATYPE(QSqlQuery)
+QT_BEGIN_NAMESPACE
+
class QmlSqlQueryScriptClass: public QScriptClass {
public:
QmlSqlQueryScriptClass(QScriptEngine *engine) : QScriptClass(engine)
@@ -423,3 +425,4 @@ We add a "forwardOnly" property that stops Qt caching results (code promises to
through the data.
*/
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlsqldatabase_p.h b/src/declarative/qml/qmlsqldatabase_p.h
index 5a38bf0..9965a2b 100644
--- a/src/declarative/qml/qmlsqldatabase_p.h
+++ b/src/declarative/qml/qmlsqldatabase_p.h
@@ -42,6 +42,7 @@
#ifndef QMLSQLDATABASE_P_H
#define QMLSQLDATABASE_P_H
+#include <QtScript/qscriptengine.h>
//
// W A R N I N G
// -------------
@@ -52,9 +53,12 @@
//
// We mean it.
//
+QT_BEGIN_NAMESPACE
class QScriptEngine;
void qt_add_qmlsqldatabase(QScriptEngine *engine);
+QT_END_NAMESPACE
+
#endif // QMLSQLDATABASE_P_H
diff --git a/src/declarative/qml/qmlstringconverters_p.h b/src/declarative/qml/qmlstringconverters_p.h
index dfc59ce..46b2de6 100644
--- a/src/declarative/qml/qmlstringconverters_p.h
+++ b/src/declarative/qml/qmlstringconverters_p.h
@@ -56,6 +56,8 @@
#include <QtCore/qglobal.h>
#include <QtCore/qvariant.h>
+QT_BEGIN_NAMESPACE
+
class QColor;
class QPointF;
class QSizeF;
@@ -64,8 +66,6 @@ class QString;
class QByteArray;
class QVector3D;
-QT_BEGIN_NAMESPACE
-
// XXX - Bauhaus currently uses these methods which is why they're exported
namespace QmlStringConverters
{
diff --git a/src/declarative/qml/qmlworkerscript.cpp b/src/declarative/qml/qmlworkerscript.cpp
index 5e39eaf..ec790ca 100644
--- a/src/declarative/qml/qmlworkerscript.cpp
+++ b/src/declarative/qml/qmlworkerscript.cpp
@@ -55,6 +55,7 @@
#include <QtDeclarative/qmlinfo.h>
#include "qmlnetworkaccessmanagerfactory.h"
+
QT_BEGIN_NAMESPACE
class WorkerDataEvent : public QEvent
@@ -238,8 +239,13 @@ private:
QAtomicInt m_ref;
QmlWorkerListModel *m_model;
};
+
+QT_END_NAMESPACE
+
Q_DECLARE_METATYPE(QmlWorkerListModelAgent::VariantRef);
+QT_BEGIN_NAMESPACE
+
QmlWorkerScriptEnginePrivate::QmlWorkerScriptEnginePrivate(QmlEngine *engine)
: workerEngine(0), qmlengine(engine), m_nextId(0)
{
@@ -1030,8 +1036,10 @@ QVariant QmlWorkerListModel::data(int index, int role) const
return m_values.at(index).value(role);
}
+QT_END_NAMESPACE
+
QML_DEFINE_TYPE(Qt,4,6,WorkerListModel,QmlWorkerListModel)
#include "qmlworkerscript.moc"
-QT_END_NAMESPACE
+
diff --git a/src/declarative/qml/qmlxmlhttprequest.cpp b/src/declarative/qml/qmlxmlhttprequest.cpp
index 1883d1b..54e26df 100644
--- a/src/declarative/qml/qmlxmlhttprequest.cpp
+++ b/src/declarative/qml/qmlxmlhttprequest.cpp
@@ -91,7 +91,7 @@
#define D(arg) (arg)->release()
#define A(arg) (arg)->addref()
-namespace {
+QT_BEGIN_NAMESPACE
class DocumentImpl;
class NodeImpl
@@ -315,12 +315,14 @@ public:
static QScriptValue load(QScriptEngine *engine, const QString &data);
};
-}; // namespace
+QT_END_NAMESPACE
Q_DECLARE_METATYPE(Node);
Q_DECLARE_METATYPE(NodeList);
Q_DECLARE_METATYPE(NamedNodeMap);
+QT_BEGIN_NAMESPACE
+
void NodeImpl::addref()
{
A(document);
@@ -1624,4 +1626,6 @@ void qt_add_qmlxmlhttprequest(QScriptEngine *engine)
engine->globalObject().setProperty(QLatin1String("DOMException"), domExceptionPrototype);
}
+QT_END_NAMESPACE
+
#include <qmlxmlhttprequest.moc>
diff --git a/src/declarative/qml/qmlxmlhttprequest_p.h b/src/declarative/qml/qmlxmlhttprequest_p.h
index dfed5d2..3a81278 100644
--- a/src/declarative/qml/qmlxmlhttprequest_p.h
+++ b/src/declarative/qml/qmlxmlhttprequest_p.h
@@ -42,6 +42,7 @@
#ifndef QMLXMLHTTPREQUEST_P_H
#define QMLXMLHTTPREQUEST_P_H
+#include <QtScript/qscriptengine.h>
//
// W A R N I N G
// -------------
@@ -52,9 +53,12 @@
//
// We mean it.
//
+QT_BEGIN_NAMESPACE
class QScriptEngine;
void qt_add_qmlxmlhttprequest(QScriptEngine *engine);
+QT_END_NAMESPACE
+
#endif // QMLXMLHTTPREQUEST_P_H
diff --git a/src/declarative/util/qmlpixmapcache.cpp b/src/declarative/util/qmlpixmapcache.cpp
index c03b5df..4e581bd 100644
--- a/src/declarative/util/qmlpixmapcache.cpp
+++ b/src/declarative/util/qmlpixmapcache.cpp
@@ -41,11 +41,13 @@
#include "qmlpixmapcache_p.h"
#include "qmlnetworkaccessmanagerfactory.h"
+#include "qmlimageprovider.h"
#include "qfxperf_p_p.h"
#include <qmlengine.h>
#include <private/qmlglobal_p.h>
+#include <private/qmlengine_p.h>
#include <QCoreApplication>
#include <QImageReader>
@@ -82,7 +84,7 @@ class QmlImageReaderEvent : public QEvent
public:
enum ReadError { NoError, Loading, Decoding };
- QmlImageReaderEvent(QmlImageReaderEvent::ReadError err, const QString &errStr, QImage &img)
+ QmlImageReaderEvent(QmlImageReaderEvent::ReadError err, const QString &errStr, const QImage &img)
: QEvent(QEvent::User), error(err), errorString(errStr), image(img) {}
ReadError error;
@@ -143,13 +145,8 @@ private slots:
private:
QNetworkAccessManager *networkAccessManager() {
- if (!accessManager) {
- if (engine && engine->networkAccessManagerFactory()) {
- accessManager = engine->networkAccessManagerFactory()->create(this);
- } else {
- accessManager = new QNetworkAccessManager(this);
- }
- }
+ if (!accessManager)
+ accessManager = QmlEnginePrivate::get(engine)->createNetworkAccessManager(this);
return accessManager;
}
@@ -197,21 +194,32 @@ bool QmlImageRequestHandler::event(QEvent *event)
break;
}
- QmlPixmapReply *runningJob = reader->jobs.takeFirst();
+ QmlPixmapReply *runningJob = reader->jobs.takeLast();
runningJob->addRef();
runningJob->setLoading();
QUrl url = runningJob->url();
reader->mutex.unlock();
// fetch
- QNetworkRequest req(url);
- req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
- QNetworkReply *reply = networkAccessManager()->get(req);
+ if (url.scheme() == QLatin1String("image")) {
+ QImage image = QmlEnginePrivate::get(engine)->getImageFromProvider(url);
+ QmlImageReaderEvent::ReadError errorCode = QmlImageReaderEvent::NoError;
+ QString errorStr;
+ if (image.isNull()) {
+ errorCode = QmlImageReaderEvent::Loading;
+ errorStr = QLatin1String("Failed to get image from provider: ") + url.toString();
+ }
+ QCoreApplication::postEvent(runningJob, new QmlImageReaderEvent(errorCode, errorStr, image));
+ } else {
+ QNetworkRequest req(url);
+ req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
+ QNetworkReply *reply = networkAccessManager()->get(req);
- QMetaObject::connect(reply, replyDownloadProgress, runningJob, downloadProgress);
- QMetaObject::connect(reply, replyFinished, this, thisNetworkRequestDone);
+ QMetaObject::connect(reply, replyDownloadProgress, runningJob, downloadProgress);
+ QMetaObject::connect(reply, replyFinished, this, thisNetworkRequestDone);
- replies.insert(reply, runningJob);
+ replies.insert(reply, runningJob);
+ }
}
return true;
}
@@ -600,6 +608,6 @@ int QmlPixmapCache::pendingRequests()
return qmlActivePixmapReplies()->count();
}
-#include <qmlpixmapcache.moc>
-
QT_END_NAMESPACE
+
+#include <qmlpixmapcache.moc>
diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp
index d4db2b9..aad19d9 100644
--- a/src/declarative/util/qmlstategroup.cpp
+++ b/src/declarative/util/qmlstategroup.cpp
@@ -55,8 +55,6 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG);
-QML_DEFINE_TYPE(Qt,4,6,StateGroup,QmlStateGroup)
-
class QmlStateGroupPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QmlStateGroup)
@@ -421,3 +419,5 @@ void QmlStateGroup::removeState(QmlState *state)
}
QT_END_NAMESPACE
+
+QML_DEFINE_TYPE(Qt,4,6,StateGroup,QmlStateGroup)
diff --git a/src/declarative/util/qmlstyledtext.cpp b/src/declarative/util/qmlstyledtext.cpp
index 36b5e49..63f341e 100644
--- a/src/declarative/util/qmlstyledtext.cpp
+++ b/src/declarative/util/qmlstyledtext.cpp
@@ -58,6 +58,8 @@
The opening and closing tags must be correctly nested.
*/
+QT_BEGIN_NAMESPACE
+
class QmlStyledTextPrivate
{
public:
@@ -341,3 +343,5 @@ QStringRef QmlStyledTextPrivate::parseValue(const QChar *&ch, const QString &tex
return QStringRef(&textIn, valStart, valLength);
}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlstyledtext_p.h b/src/declarative/util/qmlstyledtext_p.h
index 0cfb43e..502a4b5 100644
--- a/src/declarative/util/qmlstyledtext_p.h
+++ b/src/declarative/util/qmlstyledtext_p.h
@@ -44,10 +44,13 @@
#include <QSizeF>
+QT_BEGIN_NAMESPACE
+
class QPainter;
class QPointF;
class QString;
class QmlStyledTextPrivate;
+
class Q_DECLARATIVE_EXPORT QmlStyledText
{
public:
@@ -60,4 +63,6 @@ private:
QmlStyledTextPrivate *d;
};
+QT_END_NAMESPACE
+
#endif
diff --git a/src/declarative/util/qmlxmllistmodel.cpp b/src/declarative/util/qmlxmllistmodel.cpp
index d31fadf..b2c2e61 100644
--- a/src/declarative/util/qmlxmllistmodel.cpp
+++ b/src/declarative/util/qmlxmllistmodel.cpp
@@ -126,8 +126,6 @@ private:
QString m_query;
};
-QML_DECLARE_TYPE(QmlXmlListModelRole)
-
class QmlXmlListModelPrivate;
struct QmlXmlRoleList : public QmlConcreteList<QmlXmlListModelRole *>
{
@@ -725,4 +723,6 @@ void QmlXmlListModel::queryCompleted(int id, int size)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlXmlListModelRole)
+
#include <qmlxmllistmodel.moc>
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 336be91..4ec2ae2 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -122,15 +122,19 @@ extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp
static void initResources()
{
#if defined(Q_WS_WINCE)
+ Q_INIT_RESOURCE_EXTERN(qstyle_wince)
Q_INIT_RESOURCE(qstyle_wince);
#elif defined(Q_OS_SYMBIAN)
+ Q_INIT_RESOURCE_EXTERN(qstyle_s60)
Q_INIT_RESOURCE(qstyle_s60);
#else
+ Q_INIT_RESOURCE_EXTERN(qstyle)
Q_INIT_RESOURCE(qstyle);
#endif
-
+ Q_INIT_RESOURCE_EXTERN(qmessagebox)
Q_INIT_RESOURCE(qmessagebox);
#if !defined(QT_NO_PRINTDIALOG)
+ Q_INIT_RESOURCE_EXTERN(qprintdialog)
Q_INIT_RESOURCE(qprintdialog);
#endif
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index d2fb925..e39d385 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -90,6 +90,9 @@
QT_BEGIN_NAMESPACE
//#define QT_GL_NO_SCISSOR_TEST
+#ifdef Q_WS_WIN
+extern Q_GUI_EXPORT bool qt_cleartype_enabled;
+#endif
extern QImage qt_imageForBrush(int brushStyle, bool invert);
@@ -1673,7 +1676,6 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
#if !defined(QT_OPENGL_ES_2)
#if defined(Q_WS_WIN)
- extern Q_GUI_EXPORT bool qt_cleartype_enabled;
if (qt_cleartype_enabled)
#endif
d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask;
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp
index 4edb87a..032ff85 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -54,6 +54,9 @@
#include <QtCore/QFile>
#include <QtCore/QBuffer>
#include <qvariant.h>
+
+QT_BEGIN_NAMESPACE
+
// These next two structs represent how the icon information is stored
// in an ICO file.
typedef struct
@@ -891,3 +894,4 @@ bool QtIcoHandler::jumpToNextImage()
return jumpToImage(m_currentIconIndex + 1);
}
+QT_END_NAMESPACE
diff --git a/src/plugins/imageformats/ico/qicohandler.h b/src/plugins/imageformats/ico/qicohandler.h
index 394a5eb..4334ad9 100644
--- a/src/plugins/imageformats/ico/qicohandler.h
+++ b/src/plugins/imageformats/ico/qicohandler.h
@@ -43,6 +43,8 @@
#include <QtGui/QImageIOHandler>
+QT_BEGIN_NAMESPACE
+
class ICOReader;
class QtIcoHandler: public QImageIOHandler
{
@@ -71,5 +73,7 @@ private:
};
+QT_END_NAMESPACE
+
#endif /* QTICOHANDLER_H */
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index c0e807e..9ef10b0 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -56,6 +56,7 @@ SUBDIRS += \
qmlgraphicsrepeater \ # Cover
qmlvaluetypes \ # Cover
qmlxmlhttprequest \ # Cover
+ qmlimageprovider \ # Cover
sql # Cover
contains(QT_CONFIG, webkit) {
diff --git a/tests/auto/declarative/qmlimageprovider/data/exists.png b/tests/auto/declarative/qmlimageprovider/data/exists.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/qmlimageprovider/data/exists.png
Binary files differ
diff --git a/tests/auto/declarative/qmlimageprovider/data/exists1.png b/tests/auto/declarative/qmlimageprovider/data/exists1.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/qmlimageprovider/data/exists1.png
Binary files differ
diff --git a/tests/auto/declarative/qmlimageprovider/data/exists2.png b/tests/auto/declarative/qmlimageprovider/data/exists2.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/qmlimageprovider/data/exists2.png
Binary files differ
diff --git a/tests/auto/declarative/qmlimageprovider/qmlimageprovider.pro b/tests/auto/declarative/qmlimageprovider/qmlimageprovider.pro
new file mode 100644
index 0000000..0ef7739
--- /dev/null
+++ b/tests/auto/declarative/qmlimageprovider/qmlimageprovider.pro
@@ -0,0 +1,12 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+QT += network
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qmlimageprovider.cpp
+
+# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
+# LIBS += -lgcov
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qmlimageprovider/tst_qmlimageprovider.cpp b/tests/auto/declarative/qmlimageprovider/tst_qmlimageprovider.cpp
new file mode 100644
index 0000000..475cb7a
--- /dev/null
+++ b/tests/auto/declarative/qmlimageprovider/tst_qmlimageprovider.cpp
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** 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 test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlimageprovider.h>
+#include <private/qmlgraphicsimage_p.h>
+
+#define TRY_WAIT(expr) \
+ do { \
+ for (int ii = 0; ii < 6; ++ii) { \
+ if ((expr)) break; \
+ QTest::qWait(50); \
+ } \
+ QVERIFY((expr)); \
+ } while (false)
+
+
+class tst_qmlimageprovider : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmlimageprovider()
+ {
+ }
+
+private slots:
+ void imageSource();
+ void imageSource_data();
+ void removeProvider();
+
+private:
+ QmlEngine engine;
+};
+
+class TestProvider : public QmlImageProvider
+{
+public:
+ QImage request(const QString &id) {
+ QImage image;
+ image.load(SRCDIR "/data/" + id);
+ return image;
+ }
+};
+
+void tst_qmlimageprovider::imageSource_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("exists") << "image://test/exists.png" << "";
+ QTest::newRow("missing") << "image://test/no-such-file.png"
+ << "\"Failed to get image from provider: image://test/no-such-file.png\" ";
+ QTest::newRow("unknown provider") << "image://bogus/exists.png"
+ << "\"Failed to get image from provider: image://bogus/exists.png\" ";
+}
+
+void tst_qmlimageprovider::imageSource()
+{
+ QFETCH(QString, source);
+ QFETCH(QString, error);
+
+ if (!error.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
+
+ engine.addImageProvider("test", new TestProvider);
+ QVERIFY(engine.imageProvider("test") != 0);
+
+ QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\" }";
+ QmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create());
+ QVERIFY(obj != 0);
+
+ TRY_WAIT(obj->status() == QmlGraphicsImage::Loading);
+
+ QCOMPARE(obj->source(), QUrl(source));
+
+ if (error.isEmpty()) {
+ TRY_WAIT(obj->status() == QmlGraphicsImage::Ready);
+ QCOMPARE(obj->width(), 100.);
+ QCOMPARE(obj->height(), 100.);
+ QCOMPARE(obj->fillMode(), QmlGraphicsImage::Stretch);
+ QCOMPARE(obj->progress(), 1.0);
+ } else {
+ TRY_WAIT(obj->status() == QmlGraphicsImage::Error);
+ }
+
+ delete obj;
+}
+
+void tst_qmlimageprovider::removeProvider()
+{
+ engine.addImageProvider("test2", new TestProvider);
+ QVERIFY(engine.imageProvider("test2") != 0);
+
+ // add provider, confirm it works
+ QString componentStr = "import Qt 4.6\nImage { source: \"image://test2/exists1.png\" }";
+ QmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create());
+ QVERIFY(obj != 0);
+
+ TRY_WAIT(obj->status() == QmlGraphicsImage::Loading);
+ TRY_WAIT(obj->status() == QmlGraphicsImage::Ready);
+
+ QCOMPARE(obj->width(), 100.0);
+
+ // remove the provider and confirm
+ QString error("\"Failed to get image from provider: image://test2/exists2.png\" ");
+ QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
+
+ engine.removeImageProvider("test2");
+
+ obj->setSource(QUrl("image://test2/exists2.png"));
+
+ TRY_WAIT(obj->status() == QmlGraphicsImage::Loading);
+ TRY_WAIT(obj->status() == QmlGraphicsImage::Error);
+
+ delete obj;
+}
+
+
+QTEST_MAIN(tst_qmlimageprovider)
+
+#include "tst_qmlimageprovider.moc"
diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
index ec6b87f..5c8178f 100644
--- a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
+++ b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
@@ -122,6 +122,9 @@ private slots:
//writeToReadOnly();
+ // Bugs
+ void crashOnValueProperty();
+
private:
QmlEngine engine;
};
@@ -208,6 +211,9 @@ private:
QUrl m_url;
};
+QML_DECLARE_TYPE(PropertyObject);
+QML_DEFINE_TYPE(Test,1,0,PropertyObject,PropertyObject);
+
void tst_qmlmetaproperty::qmlmetaproperty_object()
{
QObject object; // Has no default property
@@ -1118,6 +1124,30 @@ void tst_qmlmetaproperty::writeObjectToQmlList()
QCOMPARE(container->qmlChildren()->at(1), object);
}
+void tst_qmlmetaproperty::crashOnValueProperty()
+{
+ QmlEngine *engine = new QmlEngine;
+ QmlComponent component(engine);
+
+ component.setData("import Test 1.0\nPropertyObject { wrectProperty.x: 10 }", QUrl());
+ PropertyObject *obj = qobject_cast<PropertyObject*>(component.create());
+ QVERIFY(obj != 0);
+
+ QmlMetaProperty p = QmlMetaProperty::createProperty(obj, "wrectProperty.x", qmlContext(obj));
+ QCOMPARE(p.name(), QString("wrectProperty.x"));
+
+ QCOMPARE(p.read(), QVariant(10));
+
+ //don't crash once the engine is deleted
+ delete engine;
+ engine = 0;
+
+ QCOMPARE(p.propertyTypeName(), "int");
+ QCOMPARE(p.read(), QVariant(10));
+ p.write(QVariant(20));
+ QCOMPARE(p.read(), QVariant(20));
+}
+
QTEST_MAIN(tst_qmlmetaproperty)
#include "tst_qmlmetaproperty.moc"
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 7154fd4..77b2f66 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -961,6 +961,7 @@ void Configure::parseCmdLine()
if(i==argCount)
break;
qmakeDefines += "QT_NAMESPACE="+configCmdLine.at(i);
+ dictionary[ "QT_NAMESPACE" ] = configCmdLine.at(i);
} else if( configCmdLine.at(i) == "-qtlibinfix" ) {
++i;
if(i==argCount)
@@ -2792,6 +2793,9 @@ void Configure::generateCachefile()
if(!dictionary["ARM_FPU_TYPE"].isEmpty()) {
configStream<<"MMP_RULES += \"ARMFPU "<< dictionary["ARM_FPU_TYPE"]<< "\"";
}
+ if (!dictionary["QT_NAMESPACE"].isEmpty()) {
+ configStream << "#namespaces" << endl << "QT_NAMESPACE = " << dictionary["QT_NAMESPACE"] << endl;
+ }
configStream.flush();
configFile.close();
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp
index 3a30027..543c405 100644
--- a/tools/linguist/lconvert/main.cpp
+++ b/tools/linguist/lconvert/main.cpp
@@ -48,6 +48,8 @@
#include <iostream>
+QT_USE_NAMESPACE
+
static int usage(const QStringList &args)
{
Q_UNUSED(args);
diff --git a/tools/linguist/lupdate/qscript.cpp b/tools/linguist/lupdate/qscript.cpp
index 6f34c2b..33276e6 100644
--- a/tools/linguist/lupdate/qscript.cpp
+++ b/tools/linguist/lupdate/qscript.cpp
@@ -40,6 +40,26 @@
**
****************************************************************************/
+
+#define Q_SCRIPT_REGEXPLITERAL_RULE1 7
+
+#define Q_SCRIPT_REGEXPLITERAL_RULE2 8
+
+#include <translator.h>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qnumeric.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qtextcodec.h>
+#include <QtCore/qvariant.h>
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+QT_BEGIN_NAMESPACE
+
class QScriptGrammar
{
public:
@@ -174,7 +194,6 @@ public:
}
};
-
const char *const QScriptGrammar::spell [] = {
"end of file", "&", "&&", "&=", "break", "case", "catch", ":", ";", "continue",
"default", "delete", "/", "/=", "do", ".", "else", "=", "==", "===",
@@ -747,26 +766,6 @@ const int QScriptGrammar::action_check [] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1};
-
-#define Q_SCRIPT_REGEXPLITERAL_RULE1 7
-
-#define Q_SCRIPT_REGEXPLITERAL_RULE2 8
-
-#include <translator.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qnumeric.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qtextcodec.h>
-#include <QtCore/qvariant.h>
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-QT_BEGIN_NAMESPACE
-
static void recordMessage(
Translator *tor, const QString &context, const QString &text, const QString &comment,
const QString &extracomment, bool plural, const QString &fileName, int lineNo)
diff --git a/tools/qmldebugger/qmldebugger.pro b/tools/qmldebugger/qmldebugger.pro
deleted file mode 100644
index 679cae6..0000000
--- a/tools/qmldebugger/qmldebugger.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-TEMPLATE = subdirs
-CONFIG += ordered
-
-SUBDIRS = standalone
-
diff --git a/tools/qmldebugger/standalone/canvasframerate.cpp b/tools/qmldebugger/standalone/canvasframerate.cpp
deleted file mode 100644
index d956029..0000000
--- a/tools/qmldebugger/standalone/canvasframerate.cpp
+++ /dev/null
@@ -1,581 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt QML Debugger 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 <QtCore/qdebug.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qdatastream.h>
-#include <QtCore/qmargins.h>
-
-#include <QtGui/qapplication.h>
-#include <QtGui/qpainter.h>
-#include <QtGui/qtooltip.h>
-#include <QtGui/qslider.h>
-#include <QtGui/qscrollbar.h>
-#include <QtGui/qspinbox.h>
-#include <QtGui/qgroupbox.h>
-#include <QtGui/qboxlayout.h>
-#include <QtGui/qlabel.h>
-#include <QtGui/qlineedit.h>
-#include <QtGui/qpushbutton.h>
-#include <QtGui/qtabwidget.h>
-
-#include <QResizeEvent>
-#include <QShowEvent>
-
-#include <private/qmldebugclient_p.h>
-#include "canvasframerate.h"
-
-QT_BEGIN_NAMESPACE
-
-class QLineGraph : public QWidget
-{
-Q_OBJECT
-public:
- QLineGraph(QAbstractSlider *slider, QWidget * = 0);
-
- void setPosition(int);
-
-public slots:
- void addSample(int, int, int, bool);
- void setResolutionForHeight(int);
- void clear();
-
-protected:
- virtual void paintEvent(QPaintEvent *);
- virtual void mouseMoveEvent(QMouseEvent *);
- virtual void leaveEvent(QEvent *);
- virtual void wheelEvent(QWheelEvent *event);
-
-private slots:
- void sliderChanged(int);
-
-private:
- void updateSlider();
- void drawSample(QPainter *, int, const QRect &, QList<QRect> *);
- void drawTime(QPainter *, const QRect &);
- QRect findContainingRect(const QList<QRect> &rects, const QPoint &pos) const;
- struct Sample {
- int sample[3];
- bool isBreak;
- };
- QList<Sample> _samples;
-
- QAbstractSlider *slider;
- int position;
- int samplesPerWidth;
- int resolutionForHeight;
- bool ignoreScroll;
- QMargins graphMargins;
-
- QList<QRect> rectsPaintTime; // time to do a paintEvent()
- QList<QRect> rectsTimeBetween; // time between frames
- QRect highlightedBar;
-};
-
-QLineGraph::QLineGraph(QAbstractSlider *slider, QWidget *parent)
-: QWidget(parent), slider(slider), position(-1), samplesPerWidth(99), resolutionForHeight(50),
- ignoreScroll(false), graphMargins(65, 10, 71, 35)
-{
- setMouseTracking(true);
-
- slider->setMaximum(0);
- slider->setMinimum(0);
- slider->setSingleStep(1);
-
- connect(slider, SIGNAL(valueChanged(int)), this, SLOT(sliderChanged(int)));
-}
-
-void QLineGraph::sliderChanged(int v)
-{
- if(ignoreScroll)
- return;
-
- if (v == slider->maximum())
- position = -1;
- else
- position = v;
-
- update();
-
- // update highlightedRect
- QPoint pos = mapFromGlobal(QCursor::pos());
- if (geometry().contains(pos)) {
- QMouseEvent *me = new QMouseEvent(QEvent::MouseMove, pos,
- Qt::NoButton, Qt::NoButton, Qt::NoModifier);
- QApplication::postEvent(this, me);
- }
-}
-
-void QLineGraph::clear()
-{
- _samples.clear();
- rectsPaintTime.clear();
- rectsTimeBetween.clear();
- highlightedBar = QRect();
- position = -1;
-
- updateSlider();
- update();
-}
-
-void QLineGraph::updateSlider()
-{
- ignoreScroll = true;
- slider->setMaximum(qMax(0, _samples.count() - samplesPerWidth - 1));
-
- if(position == -1) {
- slider->setValue(slider->maximum());
- } else {
- slider->setValue(position);
- }
- ignoreScroll = false;
-}
-
-void QLineGraph::addSample(int a, int b, int d, bool isBreak)
-{
- Sample s;
- s.isBreak = isBreak;
- s.sample[0] = a;
- s.sample[1] = b;
- s.sample[2] = d;
- _samples << s;
- updateSlider();
- update();
-}
-
-void QLineGraph::setPosition(int p)
-{
- sliderChanged(p);
-}
-
-void QLineGraph::drawTime(QPainter *p, const QRect &rect)
-{
- if(_samples.isEmpty())
- return;
-
- int first = position;
- if(first == -1)
- first = qMax(0, _samples.count() - samplesPerWidth - 1);
- int last = qMin(_samples.count() - 1, first + samplesPerWidth);
-
- qreal scaleX = qreal(rect.width()) / qreal(samplesPerWidth);
-
- int t = 0;
-
- for(int ii = first; ii <= last; ++ii) {
- int sampleTime = _samples.at(ii).sample[2] / 1000;
- if(sampleTime != t) {
-
- int xEnd = rect.left() + scaleX * (ii - first);
- p->drawLine(xEnd, rect.bottom(), xEnd, rect.bottom() + 7);
-
- QRect text(xEnd - 30, rect.bottom() + 10, 60, 30);
-
- p->drawText(text, Qt::AlignHCenter | Qt::AlignTop, QString::number(_samples.at(ii).sample[2]));
-
- t = sampleTime;
- }
- }
-
-}
-
-void QLineGraph::drawSample(QPainter *p, int s, const QRect &rect, QList<QRect> *record)
-{
- if(_samples.isEmpty())
- return;
-
- int first = position;
- if(first == -1)
- first = qMax(0, _samples.count() - samplesPerWidth - 1);
- int last = qMin(_samples.count() - 1, first + samplesPerWidth);
-
- qreal scaleY = qreal(rect.height()) / resolutionForHeight;
- qreal scaleX = qreal(rect.width()) / qreal(samplesPerWidth);
-
- int xEnd;
- int lastXEnd = rect.left();
-
- p->save();
- p->setPen(Qt::NoPen);
- for(int ii = first + 1; ii <= last; ++ii) {
-
- xEnd = rect.left() + scaleX * (ii - first);
- int yEnd = rect.bottom() - _samples.at(ii).sample[s] * scaleY;
-
- if (!(s == 0 && _samples.at(ii).isBreak)) {
- QRect bar(lastXEnd, yEnd, scaleX, _samples.at(ii).sample[s] * scaleY);
- record->append(bar);
- p->drawRect(bar);
- }
-
- lastXEnd = xEnd;
- }
- p->restore();
-}
-
-void QLineGraph::paintEvent(QPaintEvent *)
-{
- QPainter p(this);
- p.setRenderHint(QPainter::Antialiasing);
-
- QRect r(graphMargins.left(), graphMargins.top(),
- width() - graphMargins.right(), height() - graphMargins.bottom());
-
- p.save();
- p.rotate(-90);
- p.translate(-r.height()/2 - r.width()/2 - graphMargins.right(), -r.height()/2);
- p.drawText(r, Qt::AlignCenter, tr("Frame rate"));
- p.restore();
-
- p.setBrush(QColor("lightsteelblue"));
- rectsTimeBetween.clear();
- drawSample(&p, 0, r, &rectsTimeBetween);
-
- p.setBrush(QColor("pink"));
- rectsPaintTime.clear();
- drawSample(&p, 1, r, &rectsPaintTime);
-
- if (!highlightedBar.isNull()) {
- p.setBrush(Qt::darkGreen);
- p.drawRect(highlightedBar);
- }
-
- p.setBrush(Qt::NoBrush);
- p.drawRect(r);
-
- slider->setGeometry(x() + r.x(), slider->y(), r.width(), slider->height());
-
- for(int ii = 0; ii <= resolutionForHeight; ++ii) {
- int y = 1 + r.bottom() - ii * r.height() / resolutionForHeight;
-
- if((ii % 10) == 0) {
- p.drawLine(r.left() - 20, y, r.left(), y);
- QRect text(r.left() - 20 - 53, y - 10, 50, 20);
- p.drawText(text, Qt::AlignRight | Qt::AlignVCenter, QString::number(ii));
- } else {
- p.drawLine(r.left() - 7, y, r.left(), y);
- }
- }
-
- drawTime(&p, r);
-}
-
-void QLineGraph::mouseMoveEvent(QMouseEvent *event)
-{
- QPoint pos = event->pos();
-
- QRect rect = findContainingRect(rectsPaintTime, pos);
- if (rect.isNull())
- rect = findContainingRect(rectsTimeBetween, pos);
-
- if (!highlightedBar.isNull())
- update(highlightedBar.adjusted(-1, -1, 1, 1));
- highlightedBar = rect;
-
- if (!rect.isNull()) {
- QRect graph(graphMargins.left(), graphMargins.top(),
- width() - graphMargins.right(), height() - graphMargins.bottom());
- qreal scaleY = qreal(graph.height()) / resolutionForHeight;
- QToolTip::showText(event->globalPos(), QString::number(qRound(rect.height() / scaleY)), this, rect);
- update(rect.adjusted(-1, -1, 1, 1));
- }
-}
-
-void QLineGraph::leaveEvent(QEvent *)
-{
- if (!highlightedBar.isNull()) {
- QRect bar = highlightedBar.adjusted(-1, -1, 1, 1);
- highlightedBar = QRect();
- update(bar);
- }
-}
-
-void QLineGraph::wheelEvent(QWheelEvent *event)
-{
- QWheelEvent we(QPoint(0,0), event->delta(), event->buttons(), event->modifiers(), event->orientation());
- QApplication::sendEvent(slider, &we);
-}
-
-void QLineGraph::setResolutionForHeight(int resolution)
-{
- resolutionForHeight = resolution;
- update();
-}
-
-QRect QLineGraph::findContainingRect(const QList<QRect> &rects, const QPoint &pos) const
-{
- for (int i=0; i<rects.count(); i++) {
- if (rects[i].contains(pos))
- return rects[i];
- }
- return QRect();
-}
-
-
-class GraphWindow : public QWidget
-{
- Q_OBJECT
-public:
- GraphWindow(QWidget *parent = 0);
-
- virtual QSize sizeHint() const;
-
-public slots:
- void addSample(int, int, int, bool);
- void setResolutionForHeight(int);
- void clear();
-
-private:
- QLineGraph *m_graph;
-};
-
-GraphWindow::GraphWindow(QWidget *parent)
- : QWidget(parent)
-{
- QSlider *scroll = new QSlider(Qt::Horizontal);
- scroll->setFocusPolicy(Qt::WheelFocus);
- m_graph = new QLineGraph(scroll);
-
- setFocusPolicy(Qt::WheelFocus);
- setFocusProxy(scroll);
-
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->setContentsMargins(0, 0, 5, 0);
- layout->setSpacing(0);
- layout->addWidget(m_graph, 2);
- layout->addWidget(new QLabel(tr("Total time elapsed (ms)")), 0, Qt::AlignHCenter);
- layout->addWidget(scroll);
-}
-
-void GraphWindow::addSample(int a, int b, int d, bool isBreak)
-{
- m_graph->addSample(a, b, d, isBreak);
-}
-
-void GraphWindow::setResolutionForHeight(int res)
-{
- m_graph->setResolutionForHeight(res);
-}
-
-void GraphWindow::clear()
-{
- m_graph->clear();
-}
-
-QSize GraphWindow::sizeHint() const
-{
- return QSize(400, 220);
-}
-
-
-class CanvasFrameRatePlugin : public QmlDebugClient
-{
- Q_OBJECT
-public:
- CanvasFrameRatePlugin(QmlDebugConnection *client);
-
-signals:
- void sample(int, int, int, bool);
-
-protected:
- virtual void messageReceived(const QByteArray &);
-
-private:
- int lb;
- int ld;
-};
-
-CanvasFrameRatePlugin::CanvasFrameRatePlugin(QmlDebugConnection *client)
-: QmlDebugClient(QLatin1String("CanvasFrameRate"), client), lb(-1)
-{
-}
-
-void CanvasFrameRatePlugin::messageReceived(const QByteArray &data)
-{
- QByteArray rwData = data;
- QDataStream stream(&rwData, QIODevice::ReadOnly);
-
- int b; int c; int d; bool isBreak;
- stream >> b >> c >> d >> isBreak;
-
- if (lb != -1)
- emit sample(c, lb, ld, isBreak);
-
- lb = b;
- ld = d;
-}
-
-CanvasFrameRate::CanvasFrameRate(QWidget *parent)
-: QWidget(parent),
- m_plugin(0)
-{
- m_tabs = new QTabWidget(this);
-
- QHBoxLayout *bottom = new QHBoxLayout;
- bottom->setMargin(0);
- bottom->setSpacing(10);
-
- m_res = new QSpinBox;
- m_res->setRange(30, 200);
- m_res->setValue(m_res->minimum());
- m_res->setSingleStep(10);
- m_res->setSuffix(QLatin1String("ms"));
- bottom->addWidget(new QLabel(tr("Resolution:")));
- bottom->addWidget(m_res);
-
- bottom->addStretch();
-
- m_clearButton = new QPushButton(tr("Clear"));
- connect(m_clearButton, SIGNAL(clicked()), SLOT(clearGraph()));
- bottom->addWidget(m_clearButton);
-
- QPushButton *pb = new QPushButton(tr("New Graph"), this);
- connect(pb, SIGNAL(clicked()), this, SLOT(newTab()));
- bottom->addWidget(pb);
-
- m_group = new QGroupBox(tr("Enabled"));
- m_group->setCheckable(true);
- m_group->setChecked(false);
- connect(m_group, SIGNAL(toggled(bool)), SLOT(enabledToggled(bool)));
-
- QVBoxLayout *groupLayout = new QVBoxLayout(m_group);
- groupLayout->setContentsMargins(5, 0, 5, 0);
- groupLayout->setSpacing(2);
- groupLayout->addWidget(m_tabs);
- groupLayout->addLayout(bottom);
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->setContentsMargins(0, 10, 0, 0);
- layout->setSpacing(0);
- layout->addWidget(m_group);
- setLayout(layout);
-}
-
-void CanvasFrameRate::reset(QmlDebugConnection *conn)
-{
- delete m_plugin;
- m_plugin = 0;
-
- QWidget *w;
- for (int i=0; i<m_tabs->count(); i++) {
- w = m_tabs->widget(i);
- m_tabs->removeTab(i);
- delete w;
- }
-
- if (conn) {
- connect(conn, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
- SLOT(connectionStateChanged(QAbstractSocket::SocketState)));
- if (conn->state() == QAbstractSocket::ConnectedState)
- handleConnected(conn);
- }
-}
-
-void CanvasFrameRate::connectionStateChanged(QAbstractSocket::SocketState state)
-{
- if (state == QAbstractSocket::UnconnectedState) {
- delete m_plugin;
- m_plugin = 0;
- } else if (state == QAbstractSocket::ConnectedState) {
- handleConnected(qobject_cast<QmlDebugConnection*>(sender()));
- }
-}
-
-void CanvasFrameRate::handleConnected(QmlDebugConnection *conn)
-{
- delete m_plugin;
- m_plugin = new CanvasFrameRatePlugin(conn);
- enabledToggled(m_group->isChecked());
- newTab();
-}
-
-void CanvasFrameRate::setSizeHint(const QSize &size)
-{
- m_sizeHint = size;
-}
-
-QSize CanvasFrameRate::sizeHint() const
-{
- return m_sizeHint;
-}
-
-void CanvasFrameRate::clearGraph()
-{
- if (m_tabs->count()) {
- GraphWindow *w = qobject_cast<GraphWindow*>(m_tabs->currentWidget());
- if (w)
- w->clear();
- }
-}
-
-void CanvasFrameRate::newTab()
-{
- if (!m_plugin)
- return;
-
- if (m_tabs->count()) {
- QWidget *w = m_tabs->widget(m_tabs->count() - 1);
- QObject::disconnect(m_plugin, SIGNAL(sample(int,int,int,bool)),
- w, SLOT(addSample(int,int,int,bool)));
- }
-
- int count = m_tabs->count();
-
- GraphWindow *graph = new GraphWindow;
- graph->setResolutionForHeight(m_res->value());
- connect(m_plugin, SIGNAL(sample(int,int,int,bool)),
- graph, SLOT(addSample(int,int,int,bool)));
- connect(m_res, SIGNAL(valueChanged(int)),
- graph, SLOT(setResolutionForHeight(int)));
-
- QString name = QLatin1String("Graph ") + QString::number(count + 1);
- m_tabs->addTab(graph, name);
- m_tabs->setCurrentIndex(count);
-}
-
-void CanvasFrameRate::enabledToggled(bool checked)
-{
- if (m_plugin)
- static_cast<QmlDebugClient *>(m_plugin)->setEnabled(checked);
-}
-
-QT_END_NAMESPACE
-
-#include "canvasframerate.moc"
diff --git a/tools/qmldebugger/standalone/engine.cpp b/tools/qmldebugger/standalone/engine.cpp
deleted file mode 100644
index 6cfd82b..0000000
--- a/tools/qmldebugger/standalone/engine.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt QML Debugger 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 <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QSplitter>
-#include <QTabWidget>
-#include <QFile>
-
-#include <private/qmlenginedebug_p.h>
-#include <private/qmldebugclient_p.h>
-#include <QtDeclarative/qmlcomponent.h>
-#include <QtDeclarative/qmlgraphicsitem.h>
-#include <private/qmldebugservice_p.h>
-
-#include "engine.h"
-#include "objectpropertiesview.h"
-#include "expressionquerywidget.h"
-#include "objecttree.h"
-#include "watchtable.h"
-
-QT_BEGIN_NAMESPACE
-
-
-class DebuggerEngineItem : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString name READ name CONSTANT);
- Q_PROPERTY(int engineId READ engineId CONSTANT);
-
-public:
- DebuggerEngineItem(const QString &name, int id)
- : m_name(name), m_engineId(id) {}
-
- QString name() const { return m_name; }
- int engineId() const { return m_engineId; }
-
-private:
- QString m_name;
- int m_engineId;
-};
-
-EnginePane::EnginePane(QmlDebugConnection *conn, QWidget *parent)
-: QWidget(parent), m_client(new QmlEngineDebug(conn, this)), m_engines(0), m_context(0), m_watchTableModel(0), m_exprQueryWidget(0)
-{
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->setContentsMargins(0, 0, 0, 0);
-
- QFile enginesFile(":/engines.qml");
- enginesFile.open(QFile::ReadOnly);
- Q_ASSERT(enginesFile.isOpen());
-
- m_engineView = new QmlView(this);
- m_engineView->rootContext()->setContextProperty("engines", qVariantFromValue(&m_engineItems));
- m_engineView->setContentResizable(true);
- m_engineView->setQml(enginesFile.readAll());
- m_engineView->execute();
- m_engineView->setFixedHeight(100);
- QObject::connect(m_engineView->root(), SIGNAL(engineClicked(int)),
- this, SLOT(engineSelected(int)));
- QObject::connect(m_engineView->root(), SIGNAL(refreshEngines()),
- this, SLOT(refreshEngines()));
-
- m_engineView->setVisible(false);
- layout->addWidget(m_engineView);
-
- QSplitter *splitter = new QSplitter;
-
- m_objTree = new ObjectTree(m_client, this);
- m_propertiesView = new ObjectPropertiesView(m_client);
- m_watchTableModel = new WatchTableModel(m_client, this);
-
- m_watchTableView = new WatchTableView(m_watchTableModel);
- m_watchTableView->setModel(m_watchTableModel);
- WatchTableHeaderView *header = new WatchTableHeaderView(m_watchTableModel);
- m_watchTableView->setHorizontalHeader(header);
-
- connect(m_objTree, SIGNAL(currentObjectChanged(QmlDebugObjectReference)),
- m_propertiesView, SLOT(reload(QmlDebugObjectReference)));
- connect(m_objTree, SIGNAL(expressionWatchRequested(QmlDebugObjectReference,QString)),
- m_watchTableModel, SLOT(expressionWatchRequested(QmlDebugObjectReference,QString)));
-
- connect(m_propertiesView, SIGNAL(activated(QmlDebugObjectReference,QmlDebugPropertyReference)),
- m_watchTableModel, SLOT(togglePropertyWatch(QmlDebugObjectReference,QmlDebugPropertyReference)));
-
- connect(m_watchTableModel, SIGNAL(watchCreated(QmlDebugWatch*)),
- m_propertiesView, SLOT(watchCreated(QmlDebugWatch*)));
-
- connect(m_watchTableView, SIGNAL(objectActivated(int)),
- m_objTree, SLOT(setCurrentObject(int)));
-
- m_exprQueryWidget = new ExpressionQueryWidget(ExpressionQueryWidget::SeparateEntryMode, m_client);
- connect(m_objTree, SIGNAL(currentObjectChanged(QmlDebugObjectReference)),
- m_exprQueryWidget, SLOT(setCurrentObject(QmlDebugObjectReference)));
-
- QSplitter *propertiesTab = new QSplitter(Qt::Vertical);
- propertiesTab->addWidget(m_propertiesView);
- propertiesTab->addWidget(m_exprQueryWidget);
- propertiesTab->setStretchFactor(0, 2);
- propertiesTab->setStretchFactor(1, 1);
-
- m_tabs = new QTabWidget(this);
- m_tabs->addTab(propertiesTab, tr("Properties"));
- m_tabs->addTab(m_watchTableView, tr("Watched"));
-
- splitter->addWidget(m_objTree);
- splitter->addWidget(m_tabs);
- splitter->setStretchFactor(1, 2);
- layout->addWidget(splitter);
-}
-
-void EnginePane::engineSelected(int id)
-{
- qWarning() << "Engine selected" << id;
- queryContext(id);
-}
-
-void EnginePane::queryContext(int id)
-{
- if (m_context) {
- delete m_context;
- m_context = 0;
- }
-
- m_context = m_client->queryRootContexts(QmlDebugEngineReference(id), this);
- if (!m_context->isWaiting())
- contextChanged();
- else
- QObject::connect(m_context, SIGNAL(stateChanged(QmlDebugQuery::State)),
- this, SLOT(contextChanged()));
-}
-
-void EnginePane::contextChanged()
-{
- //dump(m_context->rootContext(), 0);
-
- foreach (const QmlDebugObjectReference &object, m_context->rootContext().objects())
- m_objTree->reload(object.debugId());
-
- delete m_context; m_context = 0;
-}
-
-void EnginePane::refreshEngines()
-{
- if (m_engines)
- return;
-
- m_engines = m_client->queryAvailableEngines(this);
- if (!m_engines->isWaiting())
- enginesChanged();
- else
- QObject::connect(m_engines, SIGNAL(stateChanged(QmlDebugQuery::State)),
- this, SLOT(enginesChanged()));
-}
-
-void EnginePane::enginesChanged()
-{
- qDeleteAll(m_engineItems);
- m_engineItems.clear();
-
- QList<QmlDebugEngineReference> engines = m_engines->engines();
- delete m_engines; m_engines = 0;
-
- if (engines.isEmpty())
- qWarning("qmldebugger: no engines found!");
-
- for (int ii = 0; ii < engines.count(); ++ii)
- m_engineItems << new DebuggerEngineItem(engines.at(ii).name(),
- engines.at(ii).debugId());
-
- m_engineView->rootContext()->setContextProperty("engines", qVariantFromValue(&m_engineItems));
-
- m_engineView->setVisible(m_engineItems.count() > 1);
- if (m_engineItems.count() == 1)
- engineSelected(qobject_cast<DebuggerEngineItem*>(m_engineItems.at(0))->engineId());
-}
-
-
-#include "engine.moc"
-
-QT_END_NAMESPACE
-
diff --git a/tools/qmldebugger/standalone/engine.h b/tools/qmldebugger/standalone/engine.h
deleted file mode 100644
index f4c4275..0000000
--- a/tools/qmldebugger/standalone/engine.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt QML Debugger 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 ENGINE_H
-#define ENGINE_H
-
-#include <QWidget>
-#include <QtCore/qpointer.h>
-#include <QtDeclarative/qmlengine.h>
-#include <QtDeclarative/qmlcontext.h>
-#include <QtDeclarative/qmlview.h>
-#include <private/qmldebug_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class ObjectPropertiesView;
-class QmlDebugConnection;
-class QmlDebugPropertyReference;
-class QmlDebugWatch;
-class ObjectTree;
-class WatchTableModel;
-class WatchTableView;
-class ExpressionQueryWidget;
-
-class QTabWidget;
-
-class EnginePane : public QWidget
-{
-Q_OBJECT
-public:
- EnginePane(QmlDebugConnection *, QWidget *parent = 0);
-
-public slots:
- void refreshEngines();
-
-private slots:
- void enginesChanged();
-
- void queryContext(int);
- void contextChanged();
-
- void engineSelected(int);
-
-private:
- QmlEngineDebug *m_client;
- QmlDebugEnginesQuery *m_engines;
- QmlDebugRootContextQuery *m_context;
-
- ObjectTree *m_objTree;
- QTabWidget *m_tabs;
- WatchTableView *m_watchTableView;
- WatchTableModel *m_watchTableModel;
- ExpressionQueryWidget *m_exprQueryWidget;
-
- QmlView *m_engineView;
- QList<QObject *> m_engineItems;
-
- ObjectPropertiesView *m_propertiesView;
-};
-
-QT_END_NAMESPACE
-
-#endif // ENGINE_H
-
diff --git a/tools/qmldebugger/standalone/engine.png b/tools/qmldebugger/standalone/engine.png
deleted file mode 100644
index a0a8a04..0000000
--- a/tools/qmldebugger/standalone/engine.png
+++ /dev/null
Binary files differ
diff --git a/tools/qmldebugger/standalone/engines.qml b/tools/qmldebugger/standalone/engines.qml
deleted file mode 100644
index 0b2b7ac..0000000
--- a/tools/qmldebugger/standalone/engines.qml
+++ /dev/null
@@ -1,46 +0,0 @@
-import Qt 4.6
-
-Item {
- height: 100
- id: root
- signal engineClicked(int id)
- signal refreshEngines()
-
- Row {
- anchors.fill: parent
- Repeater {
- model: engines
- Item {
- width: 100; height: 100;
- Image {
- id: engineIcon;
- source: "qrc:/engine.png"
- anchors.horizontalCenter: parent.horizontalCenter
- }
- Text {
- anchors.top: engineIcon.bottom;
- text: modelData.name + "(" + modelData.engineId + ")"
- anchors.horizontalCenter: parent.horizontalCenter
- }
- MouseRegion {
- anchors.fill: parent
- onClicked: root.engineClicked(modelData.engineId);
- }
- }
- }
- }
-
-
- Image {
- y: 15
- source: "qrc:/refresh.png";
- width: 75;
- height: 63;
- smooth: true
- anchors.right: parent.right
- MouseRegion {
- anchors.fill: parent
- onClicked: root.refreshEngines()
- }
- }
-}
diff --git a/tools/qmldebugger/standalone/expressionquerywidget.cpp b/tools/qmldebugger/standalone/expressionquerywidget.cpp
deleted file mode 100644
index cd59871..0000000
--- a/tools/qmldebugger/standalone/expressionquerywidget.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt QML Debugger 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 <QtCore/qdebug.h>
-
-#include <QtGui/qlabel.h>
-#include <QtGui/qtextedit.h>
-#include <QtGui/qlineedit.h>
-#include <QtGui/qpushbutton.h>
-#include <QtGui/qevent.h>
-#include <QtGui/qgroupbox.h>
-#include <QtGui/qtextobject.h>
-#include <QtGui/qlayout.h>
-
-#include "expressionquerywidget.h"
-
-ExpressionQueryWidget::ExpressionQueryWidget(Mode mode, QmlEngineDebug *client, QWidget *parent)
- : QWidget(parent),
- m_mode(mode),
- m_client(client),
- m_query(0),
- m_textEdit(new QTextEdit),
- m_lineEdit(0)
-{
- m_prompt = QLatin1String(">> ");
-
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->setMargin(0);
- layout->setSpacing(0);
- layout->addWidget(m_textEdit);
-
- updateTitle();
-
- if (m_mode == SeparateEntryMode) {
- m_lineEdit = new QLineEdit;
- connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(executeExpression()));
- QHBoxLayout *hbox = new QHBoxLayout;
- hbox->setMargin(5);
- hbox->setSpacing(5);
- hbox->addWidget(new QLabel(tr("Expression:")));
- hbox->addWidget(m_lineEdit);
- layout->addLayout(hbox);
-
- m_textEdit->setReadOnly(true);
- m_lineEdit->installEventFilter(this);
- } else {
- m_textEdit->installEventFilter(this);
- appendPrompt();
- }
-}
-
-void ExpressionQueryWidget::setEngineDebug(QmlEngineDebug *client)
-{
- m_client = client;
-}
-
-void ExpressionQueryWidget::clear()
-{
- m_textEdit->clear();
- if (m_lineEdit)
- m_lineEdit->clear();
- if (m_mode == ShellMode)
- appendPrompt();
-}
-
-void ExpressionQueryWidget::updateTitle()
-{
- if (m_currObject.debugId() < 0) {
- m_title = tr("Expression queries");
- } else {
- QString desc = QLatin1String("<")
- + m_currObject.className() + QLatin1String(": ")
- + (m_currObject.name().isEmpty() ? QLatin1String("<unnamed>") : m_currObject.name())
- + QLatin1String(">");
- m_title = tr("Expression queries (using context for %1)" , "Selected object").arg(desc);
- }
-}
-
-void ExpressionQueryWidget::appendPrompt()
-{
- m_textEdit->moveCursor(QTextCursor::End);
-
- if (m_mode == SeparateEntryMode) {
- m_textEdit->insertPlainText("\n");
- } else {
- m_textEdit->setTextColor(Qt::gray);
- m_textEdit->append(m_prompt);
- }
-}
-
-void ExpressionQueryWidget::setCurrentObject(const QmlDebugObjectReference &obj)
-{
- m_currObject = obj;
- updateTitle();
-}
-
-void ExpressionQueryWidget::checkCurrentContext()
-{
- m_textEdit->moveCursor(QTextCursor::End);
-
- if (m_currObject.debugId() != -1 && m_currObject.debugId() != m_objectAtLastFocus.debugId())
- showCurrentContext();
- m_objectAtLastFocus = m_currObject;
-}
-
-void ExpressionQueryWidget::showCurrentContext()
-{
- if (m_mode == ShellMode) {
- // clear the initial prompt
- if (m_textEdit->document()->lineCount() == 1)
- m_textEdit->clear();
- }
-
- m_textEdit->moveCursor(QTextCursor::End);
- m_textEdit->setTextColor(Qt::darkGreen);
- m_textEdit->append(m_currObject.className()
- + QLatin1String(": ")
- + (m_currObject.name().isEmpty() ? QLatin1String("<unnamed object>") : m_currObject.name()));
- appendPrompt();
-}
-
-void ExpressionQueryWidget::executeExpression()
-{
- if (!m_client)
- return;
-
- if (m_mode == SeparateEntryMode)
- m_expr = m_lineEdit->text().trimmed();
- else
- m_expr = m_expr.trimmed();
-
- if (!m_expr.isEmpty() && m_currObject.debugId() != -1) {
- if (m_query)
- delete m_query;
- m_query = m_client->queryExpressionResult(m_currObject.debugId(), m_expr, this);
- if (!m_query->isWaiting())
- showResult();
- else
- QObject::connect(m_query, SIGNAL(stateChanged(QmlDebugQuery::State)),
- this, SLOT(showResult()));
-
- m_lastExpr = m_expr;
- if (m_lineEdit)
- m_lineEdit->clear();
- }
-}
-
-void ExpressionQueryWidget::showResult()
-{
- if (m_query) {
- m_textEdit->moveCursor(QTextCursor::End);
- QVariant value = m_query->result();
- QString result;
-
- if (value.type() == QVariant::List || value.type() == QVariant::StringList) {
- result = tr("<%1 items>", "%1 = number of items").arg(value.toList().count());
- } else if (value.isNull()) {
- result = QLatin1String("<no value>");
- } else {
- result = value.toString();
- }
-
- if (m_mode == SeparateEntryMode) {
- m_textEdit->setTextColor(Qt::black);
- m_textEdit->setFontWeight(QFont::Bold);
- m_textEdit->insertPlainText(m_expr + " : ");
- m_textEdit->setFontWeight(QFont::Normal);
- m_textEdit->insertPlainText(result);
- } else {
- m_textEdit->setTextColor(Qt::darkGreen);
- m_textEdit->insertPlainText(" => ");
- m_textEdit->setTextColor(Qt::black);
- m_textEdit->insertPlainText(result);
- }
- appendPrompt();
- m_expr.clear();
- }
-}
-
-bool ExpressionQueryWidget::eventFilter(QObject *obj, QEvent *event)
-{
- if (obj == m_textEdit) {
- switch (event->type()) {
- case QEvent::KeyPress:
- {
- QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
- int key = keyEvent->key();
- if (key == Qt::Key_Return || key == Qt::Key_Enter) {
- executeExpression();
- return true;
- } else if (key == Qt::Key_Backspace) {
- // ensure m_expr doesn't contain backspace characters
- QTextCursor cursor = m_textEdit->textCursor();
- bool atLastLine = !(cursor.block().next().isValid());
- if (!atLastLine)
- return true;
- if (cursor.columnNumber() <= m_prompt.count())
- return true;
- cursor.deletePreviousChar();
- m_expr = cursor.block().text().mid(m_prompt.count());
- return true;
- } else {
- m_textEdit->moveCursor(QTextCursor::End);
- m_textEdit->setTextColor(Qt::black);
- m_expr += keyEvent->text();
- }
- break;
- }
- case QEvent::FocusIn:
- checkCurrentContext();
- m_textEdit->moveCursor(QTextCursor::End);
- break;
- default:
- break;
- }
- } else if (obj == m_lineEdit) {
- switch (event->type()) {
- case QEvent::KeyPress:
- {
- QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
- int key = keyEvent->key();
- if (key == Qt::Key_Up && m_lineEdit->text() != m_lastExpr) {
- m_expr = m_lineEdit->text();
- if (!m_lastExpr.isEmpty())
- m_lineEdit->setText(m_lastExpr);
- } else if (key == Qt::Key_Down) {
- m_lineEdit->setText(m_expr);
- }
- break;
- }
- case QEvent::FocusIn:
- checkCurrentContext();
- break;
- default:
- break;
- }
- }
- return QWidget::eventFilter(obj, event);
-}
diff --git a/tools/qmldebugger/standalone/expressionquerywidget.h b/tools/qmldebugger/standalone/expressionquerywidget.h
deleted file mode 100644
index 8c224f8..0000000
--- a/tools/qmldebugger/standalone/expressionquerywidget.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt QML Debugger 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 EXPRESSIONQUERYWIDGET_H
-#define EXPRESSIONQUERYWIDGET_H
-
-#include <QWidget>
-
-#include <private/qmldebug_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGroupBox;
-class QTextEdit;
-class QLineEdit;
-class QPushButton;
-
-class ExpressionQueryWidget : public QWidget
-{
- Q_OBJECT
-public:
- enum Mode {
- SeparateEntryMode,
- ShellMode
- };
-
- ExpressionQueryWidget(Mode mode = SeparateEntryMode, QmlEngineDebug *client = 0, QWidget *parent = 0);
-
- void setEngineDebug(QmlEngineDebug *client);
- void clear();
-
-protected:
- bool eventFilter(QObject *obj, QEvent *event);
-
-public slots:
- void setCurrentObject(const QmlDebugObjectReference &obj);
-
-private slots:
- void executeExpression();
- void showResult();
-
-private:
- void appendPrompt();
- void checkCurrentContext();
- void showCurrentContext();
- void updateTitle();
-
- Mode m_mode;
-
- QmlEngineDebug *m_client;
- QmlDebugExpressionQuery *m_query;
- QTextEdit *m_textEdit;
- QLineEdit *m_lineEdit;
- QPushButton *m_button;
- QString m_prompt;
- QString m_expr;
- QString m_lastExpr;
-
- QString m_title;
-
- QmlDebugObjectReference m_currObject;
- QmlDebugObjectReference m_objectAtLastFocus;
-};
-
-QT_END_NAMESPACE
-
-#endif
-
diff --git a/tools/qmldebugger/standalone/objectpropertiesview.cpp b/tools/qmldebugger/standalone/objectpropertiesview.cpp
deleted file mode 100644
index 3a8d8c8..0000000
--- a/tools/qmldebugger/standalone/objectpropertiesview.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt QML Debugger 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 <QtCore/qdebug.h>
-
-#include <QtGui/qtreewidget.h>
-#include <QtGui/qlayout.h>
-#include <QtGui/qheaderview.h>
-
-#include <private/qmldebugservice_p.h>
-#include <private/qmldebug_p.h>
-#include <private/qmldebugclient_p.h>
-
-#include "objectpropertiesview.h"
-
-QT_BEGIN_NAMESPACE
-
-class PropertiesViewItem : public QObject, public QTreeWidgetItem
-{
- Q_OBJECT
-public:
- enum Type {
- BindingType,
- OtherType
- };
-
- PropertiesViewItem(QTreeWidget *widget, Type type = OtherType);
- PropertiesViewItem(QTreeWidgetItem *parent, Type type = OtherType);
-
- QmlDebugPropertyReference property;
- Type type;
-};
-
-PropertiesViewItem::PropertiesViewItem(QTreeWidget *widget, Type type)
- : QTreeWidgetItem(widget), type(type)
-{
-}
-
-PropertiesViewItem::PropertiesViewItem(QTreeWidgetItem *parent, Type type)
- : QTreeWidgetItem(parent), type(type)
-{
-}
-
-ObjectPropertiesView::ObjectPropertiesView(QmlEngineDebug *client, QWidget *parent)
- : QWidget(parent),
- m_client(client),
- m_query(0),
- m_watch(0)
-{
- QVBoxLayout *layout = new QVBoxLayout;
- layout->setContentsMargins(0, 0, 0, 0);
- layout->setSpacing(0);
- setLayout(layout);
-
- m_tree = new QTreeWidget(this);
- m_tree->setAlternatingRowColors(true);
- m_tree->setExpandsOnDoubleClick(false);
- m_tree->setHeaderLabels(QStringList()
- << tr("Name") << tr("Value") << tr("Type"));
- QObject::connect(m_tree, SIGNAL(itemActivated(QTreeWidgetItem *, int)),
- this, SLOT(itemActivated(QTreeWidgetItem *)));
-
- m_tree->setColumnCount(3);
- m_tree->header()->setDefaultSectionSize(150);
-
- layout->addWidget(m_tree);
-}
-
-void ObjectPropertiesView::setEngineDebug(QmlEngineDebug *client)
-{
- m_client = client;
-}
-
-void ObjectPropertiesView::clear()
-{
- setObject(QmlDebugObjectReference());
-}
-
-void ObjectPropertiesView::reload(const QmlDebugObjectReference &obj)
-{
- if (!m_client)
- return;
- if (m_query)
- delete m_query;
-
- m_query = m_client->queryObjectRecursive(obj, this);
- if (!m_query->isWaiting())
- queryFinished();
- else
- QObject::connect(m_query, SIGNAL(stateChanged(QmlDebugQuery::State)),
- this, SLOT(queryFinished()));
-}
-
-void ObjectPropertiesView::queryFinished()
-{
- if (!m_client || !m_query)
- return;
-
- QmlDebugObjectReference obj = m_query->object();
-
- QmlDebugWatch *watch = m_client->addWatch(obj, this);
- if (watch->state() == QmlDebugWatch::Dead) {
- delete watch;
- watch = 0;
- } else {
- if (m_watch) {
- m_client->removeWatch(m_watch);
- delete m_watch;
- }
- m_watch = watch;
- QObject::connect(watch, SIGNAL(valueChanged(QByteArray,QVariant)),
- this, SLOT(valueChanged(QByteArray,QVariant)));
- }
-
- delete m_query;
- m_query = 0;
-
- setObject(obj);
-}
-
-void ObjectPropertiesView::setPropertyValue(PropertiesViewItem *item, const QVariant &value, bool makeGray)
-{
- if (value.type() == QVariant::List || value.type() == QVariant::StringList) {
- PropertiesViewItem *bindingItem = static_cast<PropertiesViewItem*>(item->takeChild(item->childCount() - 1));
- if (bindingItem && bindingItem->type != PropertiesViewItem::BindingType) {
- delete bindingItem;
- bindingItem = 0;
- }
-
- qDeleteAll(item->takeChildren());
-
- QVariantList variants = value.toList();
- item->setText(1, tr("<%1 items>", "%1 = number of items").arg(variants.count()));
- item->setText(2, QString::fromUtf8(value.typeName()));
-
- PropertiesViewItem *child;
- for (int i=0; i<variants.count(); i++) {
- child = new PropertiesViewItem(item);
- setPropertyValue(child, variants[i], makeGray);
- }
-
- if (bindingItem)
- item->addChild(bindingItem);
-
- item->setExpanded(false);
- } else {
- item->setText(1, (value.isNull() ? QLatin1String("<no value>") : value.toString()));
- item->setExpanded(true);
- }
-
- if (makeGray) {
- for (int i=0; i<m_tree->columnCount(); i++)
- item->setForeground(i, Qt::gray);
- }
-}
-
-void ObjectPropertiesView::setObject(const QmlDebugObjectReference &object)
-{
- m_object = object;
- m_tree->clear();
-
- QList<QmlDebugPropertyReference> properties = object.properties();
- for (int i=0; i<properties.count(); i++) {
- const QmlDebugPropertyReference &p = properties[i];
-
- PropertiesViewItem *item = new PropertiesViewItem(m_tree);
- item->property = p;
-
- item->setText(0, p.name());
- item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-
- setPropertyValue(item, p.value(), !p.hasNotifySignal());
- item->setText(2, p.valueTypeName());
-
- // binding is set after property value to ensure it is added to the end of the
- // list, if the value is a list
- if (!p.binding().isEmpty()) {
- PropertiesViewItem *binding = new PropertiesViewItem(item, PropertiesViewItem::BindingType);
- binding->setText(1, p.binding());
- binding->setForeground(1, Qt::darkGreen);
- }
- }
-}
-
-void ObjectPropertiesView::watchCreated(QmlDebugWatch *watch)
-{
- if (watch->objectDebugId() == m_object.debugId()
- && qobject_cast<QmlDebugPropertyWatch*>(watch)) {
- connect(watch, SIGNAL(stateChanged(QmlDebugWatch::State)), SLOT(watchStateChanged()));
- setWatched(qobject_cast<QmlDebugPropertyWatch*>(watch)->name(), true);
- }
-}
-
-void ObjectPropertiesView::watchStateChanged()
-{
- QmlDebugWatch *watch = qobject_cast<QmlDebugWatch*>(sender());
-
- if (watch->objectDebugId() == m_object.debugId()
- && qobject_cast<QmlDebugPropertyWatch*>(watch)
- && watch->state() == QmlDebugWatch::Inactive) {
- setWatched(qobject_cast<QmlDebugPropertyWatch*>(watch)->name(), false);
- }
-}
-
-void ObjectPropertiesView::setWatched(const QString &property, bool watched)
-{
- for (int i=0; i<m_tree->topLevelItemCount(); i++) {
- PropertiesViewItem *item = static_cast<PropertiesViewItem *>(m_tree->topLevelItem(i));
- if (item->property.name() == property && item->property.hasNotifySignal()) {
- QFont font = m_tree->font();
- font.setBold(watched);
- item->setFont(0, font);
- }
- }
-}
-
-void ObjectPropertiesView::valueChanged(const QByteArray &name, const QVariant &value)
-{
- for (int i=0; i<m_tree->topLevelItemCount(); i++) {
- PropertiesViewItem *item = static_cast<PropertiesViewItem *>(m_tree->topLevelItem(i));
- if (item->property.name() == name) {
- setPropertyValue(item, value, !item->property.hasNotifySignal());
- return;
- }
- }
-}
-
-void ObjectPropertiesView::itemActivated(QTreeWidgetItem *i)
-{
- PropertiesViewItem *item = static_cast<PropertiesViewItem *>(i);
- if (!item->property.name().isEmpty())
- emit activated(m_object, item->property);
-}
-
-QT_END_NAMESPACE
-
-#include "objectpropertiesview.moc"
diff --git a/tools/qmldebugger/standalone/objectpropertiesview.h b/tools/qmldebugger/standalone/objectpropertiesview.h
deleted file mode 100644
index 43413dc..0000000
--- a/tools/qmldebugger/standalone/objectpropertiesview.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt QML Debugger 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 PROPERTIESTABLEMODEL_H
-#define PROPERTIESTABLEMODEL_H
-
-#include <private/qmldebug_p.h>
-
-#include <QtGui/qwidget.h>
-
-QT_BEGIN_NAMESPACE
-
-class QTreeWidget;
-class QTreeWidgetItem;
-class QmlDebugConnection;
-class PropertiesViewItem;
-
-class ObjectPropertiesView : public QWidget
-{
- Q_OBJECT
-public:
- ObjectPropertiesView(QmlEngineDebug *client = 0, QWidget *parent = 0);
-
- void setEngineDebug(QmlEngineDebug *client);
- void clear();
-
-signals:
- void activated(const QmlDebugObjectReference &, const QmlDebugPropertyReference &);
-
-public slots:
- void reload(const QmlDebugObjectReference &);
- void watchCreated(QmlDebugWatch *);
-
-private slots:
- void queryFinished();
- void watchStateChanged();
- void valueChanged(const QByteArray &name, const QVariant &value);
- void itemActivated(QTreeWidgetItem *i);
-
-private:
- void setObject(const QmlDebugObjectReference &object);
- void setWatched(const QString &property, bool watched);
- void setPropertyValue(PropertiesViewItem *item, const QVariant &value, bool makeGray);
-
- QmlEngineDebug *m_client;
- QmlDebugObjectQuery *m_query;
- QmlDebugWatch *m_watch;
-
- QTreeWidget *m_tree;
- QmlDebugObjectReference m_object;
-};
-
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/tools/qmldebugger/standalone/objecttree.cpp b/tools/qmldebugger/standalone/objecttree.cpp
deleted file mode 100644
index cf467f2..0000000
--- a/tools/qmldebugger/standalone/objecttree.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt QML Debugger 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 <QtGui/qevent.h>
-#include <QtGui/qmenu.h>
-#include <QtGui/qaction.h>
-
-#include <QInputDialog>
-
-#include <private/qmldebugservice_p.h>
-#include <private/qmldebug_p.h>
-#include <private/qmldebugclient_p.h>
-
-#include "objecttree.h"
-
-Q_DECLARE_METATYPE(QmlDebugObjectReference)
-
-ObjectTree::ObjectTree(QmlEngineDebug *client, QWidget *parent)
- : QTreeWidget(parent),
- m_client(client),
- m_query(0)
-{
- setHeaderHidden(true);
- setMinimumWidth(250);
- setExpandsOnDoubleClick(false);
-
- connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
- SLOT(currentItemChanged(QTreeWidgetItem *)));
- connect(this, SIGNAL(itemActivated(QTreeWidgetItem *, int)),
- SLOT(activated(QTreeWidgetItem *)));
-}
-
-void ObjectTree::setEngineDebug(QmlEngineDebug *client)
-{
- m_client = client;
-}
-
-void ObjectTree::reload(int objectDebugId)
-{
- if (!m_client)
- return;
-
- if (m_query) {
- delete m_query;
- m_query = 0;
- }
-
- m_query = m_client->queryObjectRecursive(QmlDebugObjectReference(objectDebugId), this);
- if (!m_query->isWaiting())
- objectFetched();
- else
- QObject::connect(m_query, SIGNAL(stateChanged(QmlDebugQuery::State)),
- this, SLOT(objectFetched()));
-}
-
-void ObjectTree::setCurrentObject(int debugId)
-{
- QTreeWidgetItem *item = findItemByObjectId(debugId);
- if (item) {
- setCurrentItem(item);
- scrollToItem(item);
- item->setExpanded(true);
- }
-}
-
-void ObjectTree::objectFetched()
-{
- dump(m_query->object(), 0);
- buildTree(m_query->object(), 0);
- setCurrentItem(topLevelItem(0));
-
- delete m_query;
- m_query = 0;
-}
-
-void ObjectTree::currentItemChanged(QTreeWidgetItem *item)
-{
- if (!item)
- return;
-
- QmlDebugObjectReference obj = item->data(0, Qt::UserRole).value<QmlDebugObjectReference>();
- if (obj.debugId() >= 0)
- emit currentObjectChanged(obj);
-}
-
-void ObjectTree::activated(QTreeWidgetItem *item)
-{
- if (!item)
- return;
-
- QmlDebugObjectReference obj = item->data(0, Qt::UserRole).value<QmlDebugObjectReference>();
- if (obj.debugId() >= 0)
- emit activated(obj);
-}
-
-void ObjectTree::buildTree(const QmlDebugObjectReference &obj, QTreeWidgetItem *parent)
-{
- if (!parent)
- clear();
-
- QTreeWidgetItem *item = parent ? new QTreeWidgetItem(parent) : new QTreeWidgetItem(this);
- item->setText(0, obj.className());
- item->setData(0, Qt::UserRole, qVariantFromValue(obj));
-
- if (parent && obj.contextDebugId() >= 0
- && obj.contextDebugId() != parent->data(0, Qt::UserRole
- ).value<QmlDebugObjectReference>().contextDebugId()) {
- QmlDebugFileReference source = obj.source();
- if (!source.url().isEmpty()) {
- QString toolTipString = QLatin1String("URL: ") + source.url().toString();
- item->setToolTip(0, toolTipString);
- }
- item->setForeground(0, QColor("orange"));
- } else {
- item->setExpanded(true);
- }
-
- if (obj.contextDebugId() < 0)
- item->setForeground(0, Qt::lightGray);
-
- for (int ii = 0; ii < obj.children().count(); ++ii)
- buildTree(obj.children().at(ii), item);
-}
-
-void ObjectTree::dump(const QmlDebugContextReference &ctxt, int ind)
-{
- QByteArray indent(ind * 4, ' ');
- qWarning().nospace() << indent.constData() << ctxt.debugId() << " "
- << qPrintable(ctxt.name());
-
- for (int ii = 0; ii < ctxt.contexts().count(); ++ii)
- dump(ctxt.contexts().at(ii), ind + 1);
-
- for (int ii = 0; ii < ctxt.objects().count(); ++ii)
- dump(ctxt.objects().at(ii), ind);
-}
-
-void ObjectTree::dump(const QmlDebugObjectReference &obj, int ind)
-{
- QByteArray indent(ind * 4, ' ');
- qWarning().nospace() << indent.constData() << qPrintable(obj.className())
- << " " << qPrintable(obj.name()) << " "
- << obj.debugId();
-
- for (int ii = 0; ii < obj.children().count(); ++ii)
- dump(obj.children().at(ii), ind + 1);
-}
-
-QTreeWidgetItem *ObjectTree::findItemByObjectId(int debugId) const
-{
- for (int i=0; i<topLevelItemCount(); i++) {
- QTreeWidgetItem *item = findItem(topLevelItem(i), debugId);
- if (item)
- return item;
- }
-
- return 0;
-}
-
-QTreeWidgetItem *ObjectTree::findItem(QTreeWidgetItem *item, int debugId) const
-{
- if (item->data(0, Qt::UserRole).value<QmlDebugObjectReference>().debugId() == debugId)
- return item;
-
- QTreeWidgetItem *child;
- for (int i=0; i<item->childCount(); i++) {
- child = findItem(item->child(i), debugId);
- if (child)
- return child;
- }
-
- return 0;
-}
-
-void ObjectTree::mousePressEvent(QMouseEvent *me)
-{
- QTreeWidget::mousePressEvent(me);
- if (!currentItem())
- return;
- if(me->button() == Qt::RightButton && me->type() == QEvent::MouseButtonPress) {
- QAction action(tr("Add watch..."), 0);
- QList<QAction *> actions;
- actions << &action;
- QmlDebugObjectReference obj =
- currentItem()->data(0, Qt::UserRole).value<QmlDebugObjectReference>();
- if (QMenu::exec(actions, me->globalPos())) {
- bool ok = false;
- QString watch = QInputDialog::getText(this, tr("Watch expression"),
- tr("Expression:"), QLineEdit::Normal, QString(), &ok);
- if (ok && !watch.isEmpty())
- emit expressionWatchRequested(obj, watch);
- }
- }
-}
diff --git a/tools/qmldebugger/standalone/qmldebugger.cpp b/tools/qmldebugger/standalone/qmldebugger.cpp
deleted file mode 100644
index 4d86377..0000000
--- a/tools/qmldebugger/standalone/qmldebugger.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt QML Debugger 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 <QtCore/qtimer.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qsettings.h>
-
-#include <QtGui/qlayout.h>
-#include <QtGui/qpushbutton.h>
-#include <QtGui/qlineedit.h>
-#include <QtGui/qtabwidget.h>
-#include <QtGui/qspinbox.h>
-#include <QtGui/qlabel.h>
-
-#include "canvasframerate.h"
-#include "engine.h"
-#include "qmldebugger.h"
-
-QmlDebugger::QmlDebugger(QWidget *parent)
-: QWidget(parent)
-{
- QVBoxLayout *layout = new QVBoxLayout;
- setLayout(layout);
-
- QHBoxLayout *connectLayout = new QHBoxLayout;
- layout->addLayout(connectLayout);
- connectLayout->addStretch(2);
-
- m_connectionState = new QLabel(this);
- connectLayout->addWidget(m_connectionState);
- m_host = new QLineEdit(this);
- connectLayout->addWidget(m_host);
- m_port = new QSpinBox(this);
- m_port->setMinimum(1024);
- m_port->setMaximum(20000);
- connectLayout->addWidget(m_port);
- m_connectButton = new QPushButton(tr("Connect"), this);
- QObject::connect(m_connectButton, SIGNAL(clicked()),
- this, SLOT(connectToHost()));
- connectLayout->addWidget(m_connectButton);
- m_disconnectButton = new QPushButton(tr("Disconnect"), this);
- QObject::connect(m_disconnectButton, SIGNAL(clicked()),
- this, SLOT(disconnectFromHost()));
- m_disconnectButton->setEnabled(false);
- connectLayout->addWidget(m_disconnectButton);
-
- m_tabs = new QTabWidget(this);
- layout->addWidget(m_tabs);
-
- CanvasFrameRate *cfr = new CanvasFrameRate(this);
- cfr->reset(&client);
- cfr->setSizeHint(QSize(800, 600));
- m_tabs->addTab(cfr, tr("Frame Rate"));
-
- m_enginePane = new EnginePane(&client, this);
- m_tabs->addTab(m_enginePane, tr("QML Engine"));
-
- QObject::connect(&client, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
- this, SLOT(connectionStateChanged()));
- connectionStateChanged();
-
- QObject::connect(&client, SIGNAL(error(QAbstractSocket::SocketError)),
- this, SLOT(connectionError(QAbstractSocket::SocketError)));
-
- QSettings settings;
- m_host->setText(settings.value("Host", "127.0.0.1").toString());
- m_port->setValue(settings.value("Port", 3768).toInt());
-
- connectToHost();
-}
-
-void QmlDebugger::setHost(const QString &host)
-{
- m_host->setText(host);
-}
-
-void QmlDebugger::setPort(quint16 port)
-{
- m_port->setValue(port);
-}
-
-void QmlDebugger::showEngineTab()
-{
- m_tabs->setCurrentWidget(m_enginePane);
-}
-
-void QmlDebugger::closeEvent(QCloseEvent *event)
-{
- QSettings settings;
- settings.setValue("Host", m_host->text());
- settings.setValue("Port", m_port->value());
-
- QWidget::closeEvent(event);
-}
-
-void QmlDebugger::connectionStateChanged()
-{
- switch (client.state()) {
- default:
- case QAbstractSocket::UnconnectedState:
- m_connectionState->setText(tr("Disconnected"));
- m_connectButton->setEnabled(true);
- m_disconnectButton->setEnabled(false);
- break;
- case QAbstractSocket::HostLookupState:
- m_connectionState->setText(tr("Resolving"));
- m_connectButton->setEnabled(false);
- m_disconnectButton->setEnabled(true);
- break;
- case QAbstractSocket::ConnectingState:
- m_connectionState->setText(tr("Connecting"));
- m_connectButton->setEnabled(false);
- m_disconnectButton->setEnabled(true);
- break;
- case QAbstractSocket::ConnectedState:
- m_connectionState->setText(tr("Connected"));
- m_connectButton->setEnabled(false);
- m_disconnectButton->setEnabled(true);
-
- QTimer::singleShot(0, m_enginePane, SLOT(refreshEngines()));
- break;
- case QAbstractSocket::ClosingState:
- m_connectionState->setText(tr("Closing"));
- m_connectButton->setEnabled(false);
- m_disconnectButton->setEnabled(false);
- break;
- }
-}
-
-void QmlDebugger::connectionError(QAbstractSocket::SocketError socketError)
-{
- qWarning() << "qmldebugger cannot connect:" << socketError
- << client.errorString();
-}
-
-void QmlDebugger::connectToHost()
-{
- client.connectToHost(m_host->text(), m_port->value());
-}
-
-void QmlDebugger::disconnectFromHost()
-{
- client.disconnectFromHost();
-}
diff --git a/tools/qmldebugger/standalone/qmldebugger.h b/tools/qmldebugger/standalone/qmldebugger.h
deleted file mode 100644
index da95ef9..0000000
--- a/tools/qmldebugger/standalone/qmldebugger.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt QML Debugger 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 QMLDEBUGGER_H
-#define QMLDEBUGGER_H
-
-#include <private/qmldebugclient_p.h>
-#include <QtNetwork/qtcpsocket.h>
-#include <QtGui/qwidget.h>
-
-class QLabel;
-class QLineEdit;
-class QSpinBox;
-class QPushButton;
-class QTabWidget;
-
-class EnginePane;
-
-class QmlDebugger : public QWidget
-{
- Q_OBJECT
-public:
- QmlDebugger(QWidget * = 0);
-
- void setHost(const QString &host);
- void setPort(quint16 port);
- void showEngineTab();
-
-public slots:
- void connectToHost();
- void disconnectFromHost();
-
-protected:
- void closeEvent(QCloseEvent *);
-
-private slots:
- void connectionStateChanged();
- void connectionError(QAbstractSocket::SocketError socketError);
-
-private:
- QmlDebugConnection client;
-
- QLabel *m_connectionState;
- QLineEdit *m_host;
- QSpinBox *m_port;
- QPushButton *m_connectButton;
- QPushButton *m_disconnectButton;
-
- EnginePane *m_enginePane;
- QTabWidget *m_tabs;
-};
-
-#endif
diff --git a/tools/qmldebugger/standalone/qmldebugger.pri b/tools/qmldebugger/standalone/qmldebugger.pri
deleted file mode 100644
index ede7d31..0000000
--- a/tools/qmldebugger/standalone/qmldebugger.pri
+++ /dev/null
@@ -1,18 +0,0 @@
-QT += network declarative
-contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, opengles1): QT += opengl
-
-INCLUDEPATH += ../../../src/declarative/debugger
-
-# Input
-HEADERS += $$PWD/canvasframerate.h \
- $$PWD/watchtable.h \
- $$PWD/objecttree.h \
- $$PWD/objectpropertiesview.h \
- $$PWD/expressionquerywidget.h
-
-SOURCES += $$PWD/canvasframerate.cpp \
- $$PWD/watchtable.cpp \
- $$PWD/objecttree.cpp \
- $$PWD/objectpropertiesview.cpp \
- $$PWD/expressionquerywidget.cpp
-
diff --git a/tools/qmldebugger/standalone/qmldebugger.qrc b/tools/qmldebugger/standalone/qmldebugger.qrc
deleted file mode 100644
index cb53ad5..0000000
--- a/tools/qmldebugger/standalone/qmldebugger.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>engines.qml</file>
- <file>engine.png</file>
- <file>refresh.png</file>
- </qresource>
-</RCC>
diff --git a/tools/qmldebugger/standalone/refresh.png b/tools/qmldebugger/standalone/refresh.png
deleted file mode 100644
index 8befc80..0000000
--- a/tools/qmldebugger/standalone/refresh.png
+++ /dev/null
Binary files differ
diff --git a/tools/qmldebugger/standalone/standalone.pro b/tools/qmldebugger/standalone/standalone.pro
deleted file mode 100644
index 72d051f..0000000
--- a/tools/qmldebugger/standalone/standalone.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-DESTDIR = ../../../bin
-TARGET = qmldebugger
-
-include(qmldebugger.pri)
-
-HEADERS += $$PWD/qmldebugger.h \
- $$PWD/engine.h
-
-SOURCES += $$PWD/qmldebugger.cpp \
- $$PWD/engine.cpp \
- $$PWD/main.cpp
-
-RESOURCES += $$PWD/qmldebugger.qrc
-OTHER_FILES += $$PWD/engines.qml
-
-target.path=$$[QT_INSTALL_BINS]
-INSTALLS += target
-
-CONFIG += console
diff --git a/tools/qmldebugger/standalone/watchtable.cpp b/tools/qmldebugger/standalone/watchtable.cpp
deleted file mode 100644
index 6f9f99a..0000000
--- a/tools/qmldebugger/standalone/watchtable.cpp
+++ /dev/null
@@ -1,366 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt QML Debugger 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 "watchtable.h"
-
-#include <QtCore/qdebug.h>
-#include <QtGui/qevent.h>
-#include <QtGui/qaction.h>
-#include <QtGui/qmenu.h>
-
-#include <private/qmldebug_p.h>
-#include <QtDeclarative/qmlmetatype.h>
-
-QT_BEGIN_NAMESPACE
-
-
-WatchTableModel::WatchTableModel(QmlEngineDebug *client, QObject *parent)
- : QAbstractTableModel(parent),
- m_client(client)
-{
-}
-
-WatchTableModel::~WatchTableModel()
-{
- for (int i=0; i<m_columns.count(); i++)
- delete m_columns[i].watch;
-}
-
-void WatchTableModel::setEngineDebug(QmlEngineDebug *client)
-{
- m_client = client;
-}
-
-void WatchTableModel::addWatch(QmlDebugWatch *watch, const QString &title)
-{
- QString property;
- if (qobject_cast<QmlDebugPropertyWatch *>(watch))
- property = qobject_cast<QmlDebugPropertyWatch *>(watch)->name();
-
- connect(watch, SIGNAL(valueChanged(QByteArray,QVariant)),
- SLOT(watchedValueChanged(QByteArray,QVariant)));
-
- connect(watch, SIGNAL(stateChanged(QmlDebugWatch::State)), SLOT(watchStateChanged()));
-
- int col = columnCount(QModelIndex());
- beginInsertColumns(QModelIndex(), col, col);
-
- WatchedEntity e;
- e.title = title;
- e.hasFirstValue = false;
- e.property = property;
- e.watch = watch;
- m_columns.append(e);
-
- endInsertColumns();
-}
-
-void WatchTableModel::removeWatch(QmlDebugWatch *watch)
-{
- int column = columnForWatch(watch);
- if (column == -1)
- return;
-
- WatchedEntity entity = m_columns.takeAt(column);
-
- for (QList<Value>::Iterator iter = m_values.begin(); iter != m_values.end();) {
- if (iter->column == column) {
- iter = m_values.erase(iter);
- } else {
- if(iter->column > column)
- --iter->column;
- ++iter;
- }
- }
-
- reset();
-}
-
-void WatchTableModel::updateWatch(QmlDebugWatch *watch, const QVariant &value)
-{
- int column = columnForWatch(watch);
- if (column == -1)
- return;
-
- addValue(column, value);
-
- if (!m_columns[column].hasFirstValue) {
- m_columns[column].hasFirstValue = true;
- m_values[m_values.count() - 1].first = true;
- }
-}
-
-QmlDebugWatch *WatchTableModel::findWatch(int column) const
-{
- if (column < m_columns.count())
- return m_columns.at(column).watch;
- return 0;
-}
-
-QmlDebugWatch *WatchTableModel::findWatch(int objectDebugId, const QString &property) const
-{
- for (int i=0; i<m_columns.count(); i++) {
- if (m_columns[i].watch->objectDebugId() == objectDebugId
- && m_columns[i].property == property) {
- return m_columns[i].watch;
- }
- }
- return 0;
-}
-
-int WatchTableModel::rowCount(const QModelIndex &) const
-{
- return m_values.count();
-}
-
-int WatchTableModel::columnCount(const QModelIndex &) const
-{
- return m_columns.count();
-}
-
-QVariant WatchTableModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if (orientation == Qt::Horizontal) {
- if (section < m_columns.count() && role == Qt::DisplayRole)
- return m_columns.at(section).title;
- } else {
- if (role == Qt::DisplayRole)
- return section + 1;
- }
- return QVariant();
-}
-
-QVariant WatchTableModel::data(const QModelIndex &idx, int role) const
-{
- if (m_values.at(idx.row()).column == idx.column()) {
- if (role == Qt::DisplayRole) {
- const QVariant &value = m_values.at(idx.row()).variant;
- QString str = value.toString();
-
- if (str.isEmpty() && QmlMetaType::isQObject(value.userType())) {
- QObject *o = QmlMetaType::toQObject(value);
- if(o) {
- QString objectName = o->objectName();
- if(objectName.isEmpty())
- objectName = QLatin1String("<unnamed>");
- str = QLatin1String(o->metaObject()->className()) +
- QLatin1String(": ") + objectName;
- }
- }
-
- if(str.isEmpty()) {
- QDebug d(&str);
- d << value;
- }
- return QVariant(str);
- } else if(role == Qt::BackgroundRole) {
- if(m_values.at(idx.row()).first)
- return QColor(Qt::green);
- else
- return QVariant();
- } else {
- return QVariant();
- }
- } else {
- return QVariant();
- }
-}
-
-void WatchTableModel::watchStateChanged()
-{
- QmlDebugWatch *watch = qobject_cast<QmlDebugWatch*>(sender());
-
- if (watch && watch->state() == QmlDebugWatch::Inactive) {
- removeWatch(watch);
- watch->deleteLater();
- }
-}
-
-int WatchTableModel::columnForWatch(QmlDebugWatch *watch) const
-{
- for (int i=0; i<m_columns.count(); i++) {
- if (m_columns.at(i).watch == watch)
- return i;
- }
- return -1;
-}
-
-void WatchTableModel::addValue(int column, const QVariant &value)
-{
- int row = columnCount(QModelIndex());
- beginInsertRows(QModelIndex(), row, row);
-
- Value v;
- v.column = column;
- v.variant = value;
- v.first = false;
- m_values.append(v);
-
- endInsertRows();
-}
-
-void WatchTableModel::togglePropertyWatch(const QmlDebugObjectReference &object, const QmlDebugPropertyReference &property)
-{
- if (!m_client || !property.hasNotifySignal())
- return;
-
- QmlDebugWatch *watch = findWatch(object.debugId(), property.name());
- if (watch) {
- // watch will be deleted in watchStateChanged()
- m_client->removeWatch(watch);
- return;
- }
-
- watch = m_client->addWatch(property, this);
- if (watch->state() == QmlDebugWatch::Dead) {
- delete watch;
- watch = 0;
- } else {
- QString desc = property.name()
- + QLatin1String(" on\n")
- + object.className()
- + QLatin1String(":\n")
- + (object.name().isEmpty() ? QLatin1String("<unnamed object>") : object.name());
- addWatch(watch, desc);
- emit watchCreated(watch);
- }
-}
-
-void WatchTableModel::watchedValueChanged(const QByteArray &propertyName, const QVariant &value)
-{
- Q_UNUSED(propertyName);
- QmlDebugWatch *watch = qobject_cast<QmlDebugWatch*>(sender());
- if (watch)
- updateWatch(watch, value);
-}
-
-void WatchTableModel::expressionWatchRequested(const QmlDebugObjectReference &obj, const QString &expr)
-{
- if (!m_client)
- return;
-
- QmlDebugWatch *watch = m_client->addWatch(obj, expr, this);
-
- if (watch->state() == QmlDebugWatch::Dead) {
- delete watch;
- watch = 0;
- } else {
- addWatch(watch, expr);
- emit watchCreated(watch);
- }
-}
-
-void WatchTableModel::removeWatchAt(int column)
-{
- if (!m_client)
- return;
-
- QmlDebugWatch *watch = findWatch(column);
- if (watch) {
- m_client->removeWatch(watch);
- delete watch;
- watch = 0;
- }
-}
-
-void WatchTableModel::removeAllWatches()
-{
- for (int i=0; i<m_columns.count(); i++) {
- if (m_client)
- m_client->removeWatch(m_columns[i].watch);
- else
- delete m_columns[i].watch;
- }
- m_columns.clear();
- m_values.clear();
- reset();
-}
-
-//----------------------------------------------
-
-WatchTableHeaderView::WatchTableHeaderView(WatchTableModel *model, QWidget *parent)
- : QHeaderView(Qt::Horizontal, parent),
- m_model(model)
-{
- setClickable(true);
-}
-
-void WatchTableHeaderView::mousePressEvent(QMouseEvent *me)
-{
- QHeaderView::mousePressEvent(me);
-
- if (me->button() == Qt::RightButton && me->type() == QEvent::MouseButtonPress) {
- int col = logicalIndexAt(me->pos());
- if (col >= 0) {
- QAction action(tr("Stop watching"), 0);
- QList<QAction *> actions;
- actions << &action;
- if (QMenu::exec(actions, me->globalPos()))
- m_model->removeWatchAt(col);
- }
- }
-}
-
-
-//----------------------------------------------
-
-WatchTableView::WatchTableView(WatchTableModel *model, QWidget *parent)
- : QTableView(parent),
- m_model(model)
-{
- setAlternatingRowColors(true);
- connect(model, SIGNAL(watchCreated(QmlDebugWatch*)), SLOT(watchCreated(QmlDebugWatch*)));
- connect(this, SIGNAL(activated(QModelIndex)), SLOT(indexActivated(QModelIndex)));
-}
-
-void WatchTableView::indexActivated(const QModelIndex &index)
-{
- QmlDebugWatch *watch = m_model->findWatch(index.column());
- if (watch)
- emit objectActivated(watch->objectDebugId());
-}
-
-void WatchTableView::watchCreated(QmlDebugWatch *watch)
-{
- int column = m_model->columnForWatch(watch);
- resizeColumnToContents(column);
-}
-
-QT_END_NAMESPACE
diff --git a/tools/qmldebugger/standalone/watchtable.h b/tools/qmldebugger/standalone/watchtable.h
deleted file mode 100644
index fd12d3d..0000000
--- a/tools/qmldebugger/standalone/watchtable.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt QML Debugger 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 WATCHTABLEMODEL_H
-#define WATCHTABLEMODEL_H
-
-#include <QtCore/qpointer.h>
-#include <QtCore/qlist.h>
-
-#include <QWidget>
-#include <QHeaderView>
-#include <QAbstractTableModel>
-#include <QTableView>
-
-QT_BEGIN_NAMESPACE
-
-class QmlDebugWatch;
-class QmlEngineDebug;
-class QmlDebugConnection;
-class QmlDebugPropertyReference;
-class QmlDebugObjectReference;
-
-class WatchTableModel : public QAbstractTableModel
-{
- Q_OBJECT
-public:
- WatchTableModel(QmlEngineDebug *client = 0, QObject *parent = 0);
- ~WatchTableModel();
-
- void setEngineDebug(QmlEngineDebug *client);
-
- QmlDebugWatch *findWatch(int column) const;
- int columnForWatch(QmlDebugWatch *watch) const;
-
- void removeWatchAt(int column);
- void removeAllWatches();
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
-signals:
- void watchCreated(QmlDebugWatch *watch);
-
-public slots:
- void togglePropertyWatch(const QmlDebugObjectReference &obj, const QmlDebugPropertyReference &prop);
- void expressionWatchRequested(const QmlDebugObjectReference &, const QString &);
-
-private slots:
- void watchStateChanged();
- void watchedValueChanged(const QByteArray &propertyName, const QVariant &value);
-
-private:
- void addWatch(QmlDebugWatch *watch, const QString &title);
- void removeWatch(QmlDebugWatch *watch);
- void updateWatch(QmlDebugWatch *watch, const QVariant &value);
-
- QmlDebugWatch *findWatch(int objectDebugId, const QString &property) const;
-
- void addValue(int column, const QVariant &value);
-
- struct WatchedEntity
- {
- QString title;
- bool hasFirstValue;
- QString property;
- QPointer<QmlDebugWatch> watch;
- };
-
- struct Value {
- int column;
- QVariant variant;
- bool first;
- };
-
- QmlEngineDebug *m_client;
- QList<WatchedEntity> m_columns;
- QList<Value> m_values;
-};
-
-
-class WatchTableHeaderView : public QHeaderView
-{
- Q_OBJECT
-public:
- WatchTableHeaderView(WatchTableModel *model, QWidget *parent = 0);
-
-protected:
- void mousePressEvent(QMouseEvent *me);
-
-private:
- WatchTableModel *m_model;
-};
-
-
-class WatchTableView : public QTableView
-{
- Q_OBJECT
-public:
- WatchTableView(WatchTableModel *model, QWidget *parent = 0);
-
-signals:
- void objectActivated(int objectDebugId);
-
-private slots:
- void indexActivated(const QModelIndex &index);
- void watchCreated(QmlDebugWatch *watch);
-
-private:
- WatchTableModel *m_model;
-};
-
-
-QT_END_NAMESPACE
-
-#endif // WATCHTABLEMODEL_H
diff --git a/tools/qmlviewer/deviceorientation.cpp b/tools/qmlviewer/deviceorientation.cpp
index c507479..0fb4a5a 100644
--- a/tools/qmlviewer/deviceorientation.cpp
+++ b/tools/qmlviewer/deviceorientation.cpp
@@ -41,6 +41,8 @@
#include "deviceorientation.h"
+QT_USE_NAMESPACE
+
class DefaultDeviceOrientation : public DeviceOrientation
{
Q_OBJECT
diff --git a/tools/qmlviewer/deviceorientation.h b/tools/qmlviewer/deviceorientation.h
index fa7758f..efd45b3 100644
--- a/tools/qmlviewer/deviceorientation.h
+++ b/tools/qmlviewer/deviceorientation.h
@@ -44,6 +44,8 @@
#include <QObject>
+QT_BEGIN_NAMESPACE
+
class DeviceOrientationPrivate;
class DeviceOrientation : public QObject
{
@@ -66,4 +68,6 @@ private:
friend class DeviceOrientationPrivate;
};
+QT_END_NAMESPACE
+
#endif
diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp
index b7a3f1a..14a4735 100644
--- a/tools/qmlviewer/main.cpp
+++ b/tools/qmlviewer/main.cpp
@@ -47,6 +47,8 @@
#include <QTranslator>
#include <QDebug>
+QT_USE_NAMESPACE
+
#if defined (Q_OS_SYMBIAN)
#include <unistd.h>
#include <sys/types.h>
diff --git a/tools/qmlviewer/proxysettings.cpp b/tools/qmlviewer/proxysettings.cpp
index 52fa74f..c3ec32e 100644
--- a/tools/qmlviewer/proxysettings.cpp
+++ b/tools/qmlviewer/proxysettings.cpp
@@ -45,6 +45,8 @@
#include "proxysettings.h"
+QT_BEGIN_NAMESPACE
+
ProxySettings::ProxySettings (QWidget * parent)
: QDialog (parent), Ui::ProxySettings()
{
@@ -104,3 +106,5 @@ bool ProxySettings::httpProxyInUse()
QSettings settings;
return settings.value ("http_proxy/use", 0).toBool ();
}
+
+QT_END_NAMESPACE
diff --git a/tools/qmlviewer/proxysettings.h b/tools/qmlviewer/proxysettings.h
index b2f3e25..2392127 100644
--- a/tools/qmlviewer/proxysettings.h
+++ b/tools/qmlviewer/proxysettings.h
@@ -46,6 +46,7 @@
#include <QNetworkProxy>
#include "ui_proxysettings.h"
+QT_BEGIN_NAMESPACE
/**
*/
class ProxySettings : public QDialog, public Ui::ProxySettings
@@ -65,4 +66,6 @@ public slots:
virtual void accept ();
};
+QT_END_NAMESPACE
+
#endif // PROXYSETTINGS_H
diff --git a/tools/qmlviewer/qfxtester.h b/tools/qmlviewer/qfxtester.h
index 303ac3a..0a10763 100644
--- a/tools/qmlviewer/qfxtester.h
+++ b/tools/qmlviewer/qfxtester.h
@@ -65,8 +65,13 @@ public:
private:
QList<QObject *> m_events;
};
+
+QT_END_NAMESPACE
+
QML_DECLARE_TYPE(QmlGraphicsVisualTest)
+QT_BEGIN_NAMESPACE
+
class QmlGraphicsVisualTestFrame : public QObject
{
Q_OBJECT
@@ -90,8 +95,13 @@ private:
QString m_hash;
QUrl m_image;
};
+
+QT_END_NAMESPACE
+
QML_DECLARE_TYPE(QmlGraphicsVisualTestFrame)
+QT_BEGIN_NAMESPACE
+
class QmlGraphicsVisualTestMouse : public QObject
{
Q_OBJECT
@@ -134,8 +144,13 @@ private:
int m_modifiers;
bool m_viewport;
};
+
+QT_END_NAMESPACE
+
QML_DECLARE_TYPE(QmlGraphicsVisualTestMouse)
+QT_BEGIN_NAMESPACE
+
class QmlGraphicsVisualTestKey : public QObject
{
Q_OBJECT
@@ -178,8 +193,13 @@ private:
int m_count;
bool m_viewport;
};
+
+QT_END_NAMESPACE
+
QML_DECLARE_TYPE(QmlGraphicsVisualTestKey)
+QT_BEGIN_NAMESPACE
+
class QmlGraphicsTester : public QAbstractAnimation
{
public:
diff --git a/tools/qmlviewer/qmlfolderlistmodel.cpp b/tools/qmlviewer/qmlfolderlistmodel.cpp
index 35c672d..cf63fec 100644
--- a/tools/qmlviewer/qmlfolderlistmodel.cpp
+++ b/tools/qmlviewer/qmlfolderlistmodel.cpp
@@ -44,6 +44,8 @@
#include <QDebug>
#include <qmlcontext.h>
+QT_BEGIN_NAMESPACE
+
class QmlFolderListModelPrivate
{
public:
diff --git a/tools/qmlviewer/qmlfolderlistmodel.h b/tools/qmlviewer/qmlfolderlistmodel.h
index 7357954..188ac27 100644
--- a/tools/qmlviewer/qmlfolderlistmodel.h
+++ b/tools/qmlviewer/qmlfolderlistmodel.h
@@ -45,6 +45,8 @@
#include <qml.h>
#include "../../src/declarative/3rdparty/qlistmodelinterface_p.h"
+QT_BEGIN_NAMESPACE
+
class QmlContext;
class QModelIndex;
@@ -114,6 +116,8 @@ private:
QmlFolderListModelPrivate *d;
};
+QT_END_NAMESPACE
+
QML_DECLARE_TYPE(QmlFolderListModel)
#endif // QMLFOLDERLISTMODEL_H
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp
index 8b3b7aa..7c620ef 100644
--- a/tools/qmlviewer/qmlviewer.cpp
+++ b/tools/qmlviewer/qmlviewer.cpp
@@ -108,7 +108,6 @@
QT_BEGIN_NAMESPACE
-
class Screen : public QObject
{
Q_OBJECT
@@ -131,7 +130,12 @@ signals:
void orientationChanged();
};
+QT_END_NAMESPACE
+
QML_DECLARE_TYPE(Screen)
+
+QT_BEGIN_NAMESPACE
+
QML_DEFINE_TYPE(QmlViewer, 1, 0, Screen, Screen)
class SizedMenuBar : public QMenuBar
diff --git a/tools/qtestlib/chart/database.cpp b/tools/qtestlib/chart/database.cpp
index dfc0fc5..1f1f7da 100644
--- a/tools/qtestlib/chart/database.cpp
+++ b/tools/qtestlib/chart/database.cpp
@@ -42,6 +42,7 @@
#include <QtGui>
#include <QtXml>
+QT_BEGIN_NAMESPACE
// Database schema definition and open/create functions
QString resultsTable = QString("(TestName varchar, TestCaseName varchar, Series varchar, Idx varchar, ") +
@@ -319,3 +320,5 @@ void DataBaseWriter::addResult(const QString &series, const QString &index, cons
query.bindValue(":ChartType", "BarChart");
execQuery(query);
}
+
+QT_END_NAMESPACE
diff --git a/tools/qtestlib/chart/database.h b/tools/qtestlib/chart/database.h
index d9861ad..9a67490 100644
--- a/tools/qtestlib/chart/database.h
+++ b/tools/qtestlib/chart/database.h
@@ -43,6 +43,9 @@
#include <QtCore>
#include <QtSql>
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
extern QString resultsTable;
QSqlDatabase openDataBase(const QString &databaseFile = "database");
@@ -57,6 +60,7 @@ void execQuery(const QString &spec, bool warnOnFail = true);
void printDataBase();
void displayTable(const QString &table);
+
class TempTable
{
public:
@@ -95,5 +99,7 @@ public:
QSqlDatabase db;
};
+QT_END_NAMESPACE
#endif
+
diff --git a/tools/qtestlib/chart/reportgenerator.cpp b/tools/qtestlib/chart/reportgenerator.cpp
index 1ce362c..c3b42a0 100644
--- a/tools/qtestlib/chart/reportgenerator.cpp
+++ b/tools/qtestlib/chart/reportgenerator.cpp
@@ -41,6 +41,7 @@
#include "reportgenerator.h"
// Report generator file utility functions
+QT_BEGIN_NAMESPACE
QList<QByteArray> readLines(const QString &fileName)
{
@@ -559,3 +560,4 @@ QByteArray ReportGenerator::printColors(const QString &tableName, const QString
return colors;
}
+QT_END_NAMESPACE
diff --git a/tools/qtestlib/chart/reportgenerator.h b/tools/qtestlib/chart/reportgenerator.h
index d44aea9..1f075bd 100644
--- a/tools/qtestlib/chart/reportgenerator.h
+++ b/tools/qtestlib/chart/reportgenerator.h
@@ -42,6 +42,9 @@
#define REPORTGENERATOR_H
#include "database.h"
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
class ReportGenerator
{
@@ -59,5 +62,7 @@ private:
void printTestCaseResults(const QString &testCaseName);
+QT_END_NAMESPACE
+
#endif
diff --git a/tools/tools.pro b/tools/tools.pro
index 4cff507..d5569b6 100644
--- a/tools/tools.pro
+++ b/tools/tools.pro
@@ -26,7 +26,7 @@ mac {
embedded:SUBDIRS += kmap2qmap
-contains(QT_CONFIG, declarative):SUBDIRS += qmlviewer qmldebugger
+contains(QT_CONFIG, declarative):SUBDIRS += qmlviewer
contains(QT_CONFIG, dbus):SUBDIRS += qdbus
!wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns xmlpatternsvalidator
embedded: SUBDIRS += makeqpf