summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-04-15 07:59:55 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-04-15 07:59:55 (GMT)
commit4bcd23c4a9d5a596d0c90dbb1569385f30fadbac (patch)
tree528b256b294db80e54d44bd7c95b1881eeed5d1f /src/declarative
parent2980c4534b231c38584f88699d356ea26bb5266b (diff)
parent81044282befaa5af7247804c7875df83c89c6459 (diff)
downloadQt-4bcd23c4a9d5a596d0c90dbb1569385f30fadbac.zip
Qt-4bcd23c4a9d5a596d0c90dbb1569385f30fadbac.tar.gz
Qt-4bcd23c4a9d5a596d0c90dbb1569385f30fadbac.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: QmlDebug: Fix license headers in new ost plugin Fixed autotest after b4b85257ccff6ba21bcbcbd46a9f7f09884abe79 Resolve unqualified attached properties correctly Adding plugin qmltooling/qmlostplugin for QML debugging over OST (USB) on Symbian. QmlDebug: Rename 'tcpserver' library to 'qmldbg_tcp' QDeclarativeDebug: Don't crash when connection is closed Fix so concurrent jobs produce the correct model results Fix uninitialized variable.
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/debugger/qdeclarativedebugserver.cpp18
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecontextscriptclass.cpp16
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp67
4 files changed, 50 insertions, 53 deletions
diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp
index 14e7187..18258f5 100644
--- a/src/declarative/debugger/qdeclarativedebugserver.cpp
+++ b/src/declarative/debugger/qdeclarativedebugserver.cpp
@@ -91,7 +91,7 @@ public:
QStringList clientPlugins;
bool gotHello;
- static QDeclarativeDebugServerConnection *loadConnectionPlugin();
+ static QDeclarativeDebugServerConnection *loadConnectionPlugin(const QString &pluginName);
};
QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() :
@@ -113,7 +113,8 @@ void QDeclarativeDebugServerPrivate::advertisePlugins()
connection->send(message);
}
-QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectionPlugin()
+QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectionPlugin(
+ const QString &pluginName)
{
QStringList pluginCandidates;
const QStringList paths = QCoreApplication::libraryPaths();
@@ -122,7 +123,8 @@ QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectio
if (dir.exists()) {
QStringList plugins(dir.entryList(QDir::Files));
foreach (const QString &pluginPath, plugins) {
- pluginCandidates << dir.absoluteFilePath(pluginPath);
+ if (QFileInfo(pluginPath).fileName().contains(pluginName))
+ pluginCandidates << dir.absoluteFilePath(pluginPath);
}
}
}
@@ -166,7 +168,7 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
bool block = false;
bool ok = false;
- // format: qmljsdebugger=port:3768[,block]
+ // format: qmljsdebugger=port:3768[,block] OR qmljsdebugger=ost[,block]
if (!appD->qmljsDebugArgumentsString().isEmpty()) {
if (!QDeclarativeEnginePrivate::qml_debugging_enabled) {
const QString message =
@@ -177,17 +179,23 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
return 0;
}
+ QString pluginName;
if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) {
int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(','));
port = appD->qmljsDebugArgumentsString().mid(5, separatorIndex - 5).toInt(&ok);
+ pluginName = QLatin1String("qmldbg_tcp");
+ } else if (appD->qmljsDebugArgumentsString().contains("ost")) {
+ pluginName = QLatin1String("qmldbg_ost");
+ ok = true;
}
+
block = appD->qmljsDebugArgumentsString().contains(QLatin1String("block"));
if (ok) {
server = new QDeclarativeDebugServer();
QDeclarativeDebugServerConnection *connection
- = QDeclarativeDebugServerPrivate::loadConnectionPlugin();
+ = QDeclarativeDebugServerPrivate::loadConnectionPlugin(pluginName);
if (connection) {
server->d_func()->connection = connection;
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index c2d8ad0..05e64b9 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -2250,7 +2250,7 @@ qreal QDeclarativeGridView::maxXExtent() const
qreal extent;
qreal highlightStart;
qreal highlightEnd;
- qreal lastItemPosition;
+ qreal lastItemPosition = 0;
if (d->isRightToLeftTopToBottom()){
highlightStart = d->highlightRangeStartValid ? d->highlightRangeEnd : d->size();
highlightEnd = d->highlightRangeEndValid ? d->highlightRangeStart : d->size();
diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
index bb4ece4..3abd787 100644
--- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
@@ -227,6 +227,7 @@ QDeclarativeContextScriptClass::queryProperty(QDeclarativeContextData *bindConte
if (data) {
lastData = data;
lastContext = bindContext;
+ lastScopeObject = scopeObject;
return QScriptClass::HandlesReadAccess;
}
}
@@ -268,17 +269,12 @@ QDeclarativeContextScriptClass::property(Object *object, const Identifier &name)
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
- if (lastScopeObject) {
-
- return ep->objectClass->property(lastScopeObject, name);
-
- } else if (lastData) {
+ if (lastData) {
if (lastData->type) {
- return Value(scriptEngine, ep->typeNameClass->newObject(bindContext->contextObject, lastData->type));
+ return Value(scriptEngine, ep->typeNameClass->newObject(lastScopeObject, lastData->type));
} else if (lastData->typeNamespace) {
- return Value(scriptEngine, ep->typeNameClass->newObject(bindContext->contextObject,
- lastData->typeNamespace));
+ return Value(scriptEngine, ep->typeNameClass->newObject(lastScopeObject, lastData->typeNamespace));
} else {
int index = lastData->importedScriptIndex;
if (index < bindContext->importedScripts.count()) {
@@ -288,6 +284,10 @@ QDeclarativeContextScriptClass::property(Object *object, const Identifier &name)
}
}
+ } else if (lastScopeObject) {
+
+ return ep->objectClass->property(lastScopeObject, name);
+
} else if (lastPropertyIndex != -1) {
QScriptValue rv;
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index c79baa4..a61ac06 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -144,6 +144,7 @@ struct XmlQueryJob
QList<void*> roleQueryErrorId; // the ptr to send back if there is an error
QStringList keyRoleQueries;
QStringList keyRoleResultsCache;
+ QString prefix;
};
class QDeclarativeXmlQuery : public QObject
@@ -172,6 +173,12 @@ public:
}
int doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache) {
+ {
+ QMutexLocker m1(&m_mutex);
+ m_queryIds.ref();
+ if (m_queryIds <= 0)
+ m_queryIds = 1;
+ }
XmlQueryJob job;
job.queryId = m_queryIds;
@@ -194,9 +201,6 @@ public:
{
QMutexLocker ml(&m_mutex);
m_jobs.insert(m_queryIds, job);
- m_queryIds++;
- if (m_queryIds <= 0)
- m_queryIds = 1;
}
QMetaObject::invokeMethod(this, "processQuery", Qt::QueuedConnection, Q_ARG(int, job.queryId));
@@ -214,20 +218,15 @@ private slots:
job = m_jobs.value(queryId);
}
- QDeclarativeXmlQueryResult r;
- doQueryJob(&job);
- doSubQueryJob(&job);
- r.queryId = job.queryId;
- r.size = m_size;
- r.data = m_modelData;
- r.inserted = m_insertedItemRanges;
- r.removed = m_removedItemRanges;
- r.keyRoleResultsCache = job.keyRoleResultsCache;
+ QDeclarativeXmlQueryResult result;
+ result.queryId = job.queryId;
+ doQueryJob(&job, &result);
+ doSubQueryJob(&job, &result);
{
QMutexLocker ml(&m_mutex);
if (m_jobs.contains(queryId)) {
- emit queryCompleted(r);
+ emit queryCompleted(result);
m_jobs.remove(queryId);
}
}
@@ -241,8 +240,8 @@ protected:
private:
- void doQueryJob(XmlQueryJob* job);
- void doSubQueryJob(XmlQueryJob* job);
+ void doQueryJob(XmlQueryJob *job, QDeclarativeXmlQueryResult *currentResult);
+ void doSubQueryJob(XmlQueryJob *job, QDeclarativeXmlQueryResult *currentResult);
void getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const;
void addIndexToRangeList(QList<QDeclarativeXmlListRange> *ranges, int index) const;
@@ -250,17 +249,12 @@ private:
QMutex m_mutex;
QThread m_thread;
QMap<int, XmlQueryJob> m_jobs;
- int m_queryIds;
- QString m_prefix;
- int m_size;
- QList<QList<QVariant> > m_modelData;
- QList<QDeclarativeXmlListRange> m_insertedItemRanges;
- QList<QDeclarativeXmlListRange> m_removedItemRanges;
+ QAtomicInt m_queryIds;
};
Q_GLOBAL_STATIC(QDeclarativeXmlQuery, globalXmlQuery)
-void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob* currentJob)
+void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
{
Q_ASSERT(currentJob->queryId != -1);
@@ -295,10 +289,8 @@ void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob* currentJob)
}
currentJob->data = xml;
- m_prefix = namespaces + prefix + QLatin1Char('/');
- m_size = 0;
- if (count > 0)
- m_size = count;
+ currentJob->prefix = namespaces + prefix + QLatin1Char('/');
+ currentResult->size = (count > 0 ? count : 0);
}
void QDeclarativeXmlQuery::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const
@@ -306,9 +298,9 @@ void QDeclarativeXmlQuery::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QS
const QStringList &keysQueries = currentJob.keyRoleQueries;
QString keysQuery;
if (keysQueries.count() == 1)
- keysQuery = m_prefix + keysQueries[0];
+ keysQuery = currentJob.prefix + keysQueries[0];
else if (keysQueries.count() > 1)
- keysQuery = m_prefix + QLatin1String("concat(") + keysQueries.join(QLatin1String(",")) + QLatin1String(")");
+ keysQuery = currentJob.prefix + QLatin1String("concat(") + keysQueries.join(QLatin1String(",")) + QLatin1String(")");
if (!keysQuery.isEmpty()) {
query->setQuery(keysQuery);
@@ -331,10 +323,9 @@ void QDeclarativeXmlQuery::addIndexToRangeList(QList<QDeclarativeXmlListRange> *
ranges->append(qMakePair(index, 1));
}
-void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob)
+void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
{
Q_ASSERT(currentJob->queryId != -1);
- m_modelData.clear();
QBuffer b(&currentJob->data);
b.open(QIODevice::ReadOnly);
@@ -347,16 +338,14 @@ void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob)
// See if any values of key roles have been inserted or removed.
- m_insertedItemRanges.clear();
- m_removedItemRanges.clear();
if (currentJob->keyRoleResultsCache.isEmpty()) {
- m_insertedItemRanges << qMakePair(0, m_size);
+ currentResult->inserted << qMakePair(0, currentResult->size);
} else {
if (keyRoleResults != currentJob->keyRoleResultsCache) {
QStringList temp;
for (int i=0; i<currentJob->keyRoleResultsCache.count(); i++) {
if (!keyRoleResults.contains(currentJob->keyRoleResultsCache[i]))
- addIndexToRangeList(&m_removedItemRanges, i);
+ addIndexToRangeList(&currentResult->removed, i);
else
temp << currentJob->keyRoleResultsCache[i];
}
@@ -364,12 +353,12 @@ void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob)
for (int i=0; i<keyRoleResults.count(); i++) {
if (temp.count() == i || keyRoleResults[i] != temp[i]) {
temp.insert(i, keyRoleResults[i]);
- addIndexToRangeList(&m_insertedItemRanges, i);
+ addIndexToRangeList(&currentResult->inserted, i);
}
}
}
}
- currentJob->keyRoleResultsCache = keyRoleResults;
+ currentResult->keyRoleResultsCache = keyRoleResults;
// Get the new values for each role.
//### we might be able to condense even further (query for everything in one go)
@@ -377,7 +366,7 @@ void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob)
for (int i = 0; i < queries.size(); ++i) {
QList<QVariant> resultList;
if (!queries[i].isEmpty()) {
- subquery.setQuery(m_prefix + QLatin1String("(let $v := string(") + queries[i] + QLatin1String(") return if ($v) then ") + queries[i] + QLatin1String(" else \"\")"));
+ subquery.setQuery(currentJob->prefix + QLatin1String("(let $v := string(") + queries[i] + QLatin1String(") return if ($v) then ") + queries[i] + QLatin1String(" else \"\")"));
if (subquery.isValid()) {
QXmlResultItems resultItems;
subquery.evaluateTo(&resultItems);
@@ -391,9 +380,9 @@ void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob)
}
}
//### should warn here if things have gone wrong.
- while (resultList.count() < m_size)
+ while (resultList.count() < currentResult->size)
resultList << QVariant();
- m_modelData << resultList;
+ currentResult->data << resultList;
b.seek(0);
}