summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-06-21 23:16:08 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-06-21 23:16:08 (GMT)
commit511d86e88b33380116f27d5f6a2a0754e8f62fa0 (patch)
tree6fdcb11b5270984112bc2563738c24d2891595d4 /src/declarative
parentaae3c899b10bee2dd64bb00bb2832620a47cff87 (diff)
parentfbf9db1fc6b500bfe05fdfca121986687d73d5c6 (diff)
downloadQt-511d86e88b33380116f27d5f6a2a0754e8f62fa0.zip
Qt-511d86e88b33380116f27d5f6a2a0754e8f62fa0.tar.gz
Qt-511d86e88b33380116f27d5f6a2a0754e8f62fa0.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/extra/qmlsqlconnection.cpp2
-rw-r--r--src/declarative/extra/qmlsqlquery.cpp142
-rw-r--r--src/declarative/extra/qmlsqlquery.h3
-rw-r--r--src/declarative/extra/qmlxmllistmodel.cpp31
-rw-r--r--src/declarative/extra/qmlxmllistmodel.h12
-rw-r--r--src/declarative/fx/fx.pri2
-rw-r--r--src/declarative/fx/qfxanchors.cpp14
-rw-r--r--src/declarative/fx/qfxanimatedimageitem.cpp2
-rw-r--r--src/declarative/fx/qfxanimatedimageitem.h2
-rw-r--r--src/declarative/fx/qfxblendedimage.cpp11
-rw-r--r--src/declarative/fx/qfxblendedimage.h1
-rw-r--r--src/declarative/fx/qfxflowview.cpp380
-rw-r--r--src/declarative/fx/qfxflowview.h106
-rw-r--r--src/declarative/fx/qfxhighlightfilter.cpp9
-rw-r--r--src/declarative/fx/qfximage.cpp17
-rw-r--r--src/declarative/fx/qfxitem.cpp6
-rw-r--r--src/declarative/fx/qfxparticles.cpp3
-rw-r--r--src/declarative/fx/qfxrect.cpp2
-rw-r--r--src/declarative/fx/qfxrect_p.h2
-rw-r--r--src/declarative/fx/qfxtextedit.cpp6
-rw-r--r--src/declarative/fx/qfxwebview.cpp2
-rw-r--r--src/declarative/qml/parser/parser.pri34
-rw-r--r--src/declarative/qml/parser/qmljs.g (renamed from src/declarative/qml/parser/javascript.g)47
-rw-r--r--src/declarative/qml/parser/qmljsast.cpp (renamed from src/declarative/qml/parser/javascriptast.cpp)8
-rw-r--r--src/declarative/qml/parser/qmljsast_p.h (renamed from src/declarative/qml/parser/javascriptast_p.h)190
-rw-r--r--src/declarative/qml/parser/qmljsastfwd_p.h (renamed from src/declarative/qml/parser/javascriptastfwd_p.h)6
-rw-r--r--src/declarative/qml/parser/qmljsastvisitor.cpp (renamed from src/declarative/qml/parser/javascriptastvisitor.cpp)6
-rw-r--r--src/declarative/qml/parser/qmljsastvisitor_p.h (renamed from src/declarative/qml/parser/javascriptastvisitor_p.h)12
-rw-r--r--src/declarative/qml/parser/qmljsengine_p.cpp (renamed from src/declarative/qml/parser/javascriptengine_p.cpp)10
-rw-r--r--src/declarative/qml/parser/qmljsengine_p.h (renamed from src/declarative/qml/parser/javascriptengine_p.h)22
-rw-r--r--src/declarative/qml/parser/qmljsgrammar.cpp (renamed from src/declarative/qml/parser/javascriptgrammar.cpp)18
-rw-r--r--src/declarative/qml/parser/qmljsgrammar_p.h (renamed from src/declarative/qml/parser/javascriptgrammar_p.h)8
-rw-r--r--src/declarative/qml/parser/qmljslexer.cpp (renamed from src/declarative/qml/parser/javascriptlexer.cpp)264
-rw-r--r--src/declarative/qml/parser/qmljslexer_p.h (renamed from src/declarative/qml/parser/javascriptlexer_p.h)8
-rw-r--r--src/declarative/qml/parser/qmljsmemorypool_p.h (renamed from src/declarative/qml/parser/javascriptmemorypool_p.h)8
-rw-r--r--src/declarative/qml/parser/qmljsnodepool_p.h (renamed from src/declarative/qml/parser/javascriptnodepool_p.h)10
-rw-r--r--src/declarative/qml/parser/qmljsparser.cpp (renamed from src/declarative/qml/parser/javascriptparser.cpp)20
-rw-r--r--src/declarative/qml/parser/qmljsparser_p.h (renamed from src/declarative/qml/parser/javascriptparser_p.h)20
-rw-r--r--src/declarative/qml/parser/qmljsprettypretty.cpp (renamed from src/declarative/qml/parser/javascriptprettypretty.cpp)14
-rw-r--r--src/declarative/qml/parser/qmljsprettypretty_p.h (renamed from src/declarative/qml/parser/javascriptprettypretty_p.h)10
-rw-r--r--src/declarative/qml/qml.h1
-rw-r--r--src/declarative/qml/qmlbasicscript.cpp40
-rw-r--r--src/declarative/qml/qmlbindablevalue.cpp9
-rw-r--r--src/declarative/qml/qmlcompiler.cpp72
-rw-r--r--src/declarative/qml/qmlcompiler_p.h1
-rw-r--r--src/declarative/qml/qmlcompositetypemanager.cpp4
-rw-r--r--src/declarative/qml/qmldeclarativedata_p.h94
-rw-r--r--src/declarative/qml/qmlengine.cpp55
-rw-r--r--src/declarative/qml/qmlinstruction_p.h8
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp10
-rw-r--r--src/declarative/qml/qmlmetatype.cpp5
-rw-r--r--src/declarative/qml/qmlparser.cpp4
-rw-r--r--src/declarative/qml/qmlparser_p.h8
-rw-r--r--src/declarative/qml/qmlprivate.h60
-rw-r--r--src/declarative/qml/qmlproxymetaobject.cpp28
-rw-r--r--src/declarative/qml/qmlproxymetaobject_p.h1
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp18
-rw-r--r--src/declarative/qml/qmlvme.cpp69
-rw-r--r--src/declarative/qml/qmlvme_p.h4
-rw-r--r--src/declarative/qml/qmlvmemetaobject.cpp16
-rw-r--r--src/declarative/qml/qmlvmemetaobject_p.h1
-rw-r--r--src/declarative/qml/rewriter/rewriter.cpp8
-rw-r--r--src/declarative/qml/rewriter/rewriter_p.h6
-rw-r--r--src/declarative/qml/rewriter/textwriter.cpp2
-rw-r--r--src/declarative/qml/rewriter/textwriter_p.h4
-rw-r--r--src/declarative/timeline/qmltimeline.h2
-rw-r--r--src/declarative/util/qmlanimation.cpp26
-rw-r--r--src/declarative/util/qmlanimation.h7
-rw-r--r--src/declarative/util/qmlbehaviour.cpp32
-rw-r--r--src/declarative/util/qmlbehaviour.h6
-rw-r--r--src/declarative/util/qmlbind.h2
-rw-r--r--src/declarative/util/qmlconnection.h6
-rw-r--r--src/declarative/util/qmldatetimeformatter.h3
-rw-r--r--src/declarative/util/qmlfollow.h8
-rw-r--r--src/declarative/util/qmlfont.h4
-rw-r--r--src/declarative/util/qmllistaccessor.h4
-rw-r--r--src/declarative/util/qmlopenmetaobject.h3
-rw-r--r--src/declarative/util/qmlpackage.h7
-rw-r--r--src/declarative/util/qmlscript.cpp10
-rw-r--r--src/declarative/util/qmlstategroup.h9
80 files changed, 1541 insertions, 586 deletions
diff --git a/src/declarative/extra/qmlsqlconnection.cpp b/src/declarative/extra/qmlsqlconnection.cpp
index b65fe35..a329f3c 100644
--- a/src/declarative/extra/qmlsqlconnection.cpp
+++ b/src/declarative/extra/qmlsqlconnection.cpp
@@ -415,7 +415,7 @@ QSqlDatabase QmlSqlConnection::database() const
qmlContext(this)) {
// SQLITE uses files for databases, hence use relative pathing
// if possible.
- QUrl url = qmlContext(this)->resolvedUrl(d->databaseName);
+ QUrl url = qmlContext(this)->resolvedUrl(QUrl(d->databaseName));
if (url.isRelative() || url.scheme() == QLatin1String("file"))
db.setDatabaseName(url.toLocalFile());
else
diff --git a/src/declarative/extra/qmlsqlquery.cpp b/src/declarative/extra/qmlsqlquery.cpp
index 0e2e91b..82ac50062 100644
--- a/src/declarative/extra/qmlsqlquery.cpp
+++ b/src/declarative/extra/qmlsqlquery.cpp
@@ -51,6 +51,9 @@
#include <QSqlDatabase>
#include <QSqlDriver>
+#include <QContiguousCache>
+#include <QTimerEvent>
+
QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(QmlSqlBind, SqlBind)
QML_DEFINE_TYPE(QmlSqlQuery, SqlQuery)
@@ -192,12 +195,21 @@ class QmlSqlQueryPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QmlSqlQuery)
public:
- QmlSqlQueryPrivate(QmlSqlQuery *owner) : isSel(false), query(NULL), requireCache(false), count(-1), binds(owner) {}
+ QmlSqlQueryPrivate(QmlSqlQuery *owner)
+ : isSel(false), query(NULL), requireCache(false), count(-1),
+ cacheNear(100), cacheRetain(100), cacheSize(1000),
+ cacheInterval(250), scheduledRow(-1), cacheTimer(-1),
+ binds(owner) {}
void prepareQuery() const;
void bindQuery() const;
- void cacheQuery() const;
void grabRoles() const;
+ void clearCache();
+ void initCache() const;
+ void hitCache(int row) const;
+
+ void enactShift(int row) const;
+
QString queryText;
bool isSel;
QVariant connectionVariant;
@@ -206,7 +218,14 @@ public:
mutable int count;
mutable QList<int> roles;
mutable QStringList roleNames;
- mutable QVector< QVector< QVariant > > cache;
+
+ typedef QContiguousCache<QVariant> Column;
+ mutable QVector< Column * > cache;
+
+ int cacheNear, cacheRetain, cacheSize, cacheInterval;
+
+ mutable int scheduledRow;
+ mutable int cacheTimer;
class QmlSqlBindList : public QmlList<QmlSqlBind *>
{
@@ -408,12 +427,13 @@ QHash<int,QVariant> QmlSqlQuery::data(int row, const QList<int> &roles) const
if (!d->requireCache)
d->query->seek(row);
+ else
+ d->hitCache(row);
for (int i = 0; i < roles.count(); ++i) {
int column = roles[i];
- Q_ASSERT(column >= 0 && column < d->cache.size());
if (d->requireCache)
- result.insert(column, d->cache[column].at(row));
+ result.insert(column, d->cache[column]->at(row));
else
result.insert(column, d->query->value(column));
}
@@ -511,7 +531,7 @@ void QmlSqlQuery::resetBinds()
if (!d->query)
return;
int oldcount = d->count;
- d->cache.resize(0);
+ d->clearCache();
d->roles.clear();
d->roleNames.clear();
d->bindQuery();
@@ -520,7 +540,7 @@ void QmlSqlQuery::resetBinds()
if (!d->query->exec())
qWarning() << "failed to execute query" << d->query->lastQuery() << d->query->boundValues() << d->query->lastError().text();
}
- d->cacheQuery(); // may finish query
+ d->initCache(); // may finish query
emitChanges(oldcount);
}
}
@@ -540,12 +560,12 @@ void QmlSqlQuery::exec()
if (d->isSel) {
int oldcount = d->count;
- d->cache.resize(0);
+ d->clearCache();
d->roles.clear();
d->roleNames.clear();
if (!d->query->exec())
qWarning() << "failed to execute query" << d->query->lastQuery() << d->query->boundValues() << d->query->lastError().text();
- d->cacheQuery(); // may finish query
+ d->initCache(); // may finish query
emitChanges(oldcount);
} else {
if (!d->query->exec())
@@ -565,7 +585,7 @@ void QmlSqlQuery::resetQuery()
Q_ASSERT(d->query != 0);
delete d->query;
d->query = 0;
- d->cache.resize(0);
+ d->clearCache();
d->roles.clear();
d->roleNames.clear();
int oldcount = d->count;
@@ -591,6 +611,22 @@ void QmlSqlQuery::emitChanges(int oldcount)
}
/*
+ \internal
+
+ Handles delayed caching of the query.
+*/
+void QmlSqlQuery::timerEvent(QTimerEvent *event)
+{
+ Q_D(QmlSqlQuery);
+ if (event->timerId() == d->cacheTimer) {
+ killTimer(d->cacheTimer);
+ d->cacheTimer = -1;
+ d->enactShift(d->scheduledRow);
+ d->scheduledRow = -1;
+ }
+}
+
+/*
Prepares the query. If the query starts with SELECT it is assumed to
be a SELECT statement and the query is also executed.
*/
@@ -625,7 +661,7 @@ void QmlSqlQueryPrivate::prepareQuery() const
if (isSel) {
if (!query->exec())
qWarning() << "failed to execute query" << query->lastQuery() << query->boundValues() << query->lastError().text();
- cacheQuery();
+ initCache();
}
}
@@ -645,26 +681,39 @@ void QmlSqlQueryPrivate::bindQuery() const
}
/*
- If the query is connected to a database with simple locking or
- that cannot ask for the count of a result set, caches the required
- data of the query and finishes the query to release locks.
+ Clears cached query results
+*/
+void QmlSqlQueryPrivate::clearCache()
+{
+ for (int i = 0; i < cache.size(); ++i)
+ delete cache[i];
+ cache.resize(0);
+}
+
+/*
+ If caching is required, initializes the cache with
+ column definitions and initial rows.
- Otherwise just caches the count of the query.
+ Otherwise caches the count for the query.
*/
-void QmlSqlQueryPrivate::cacheQuery() const
+void QmlSqlQueryPrivate::initCache() const
{
if (requireCache) {
int row = 0;
- while (query->next()) {
+ if (query->next()) {
if (roleNames.isEmpty()) {
grabRoles();
cache.resize(roleNames.count());
+ for (int i = 0; i < cache.size(); ++i)
+ cache[i] = new Column(cacheSize);
}
Q_ASSERT(cache.size() > 0);
- for (int i = 0; i < cache.size(); ++i) {
- cache[i].append(query->value(i));
- }
- row++;
+ do {
+ for (int i = 0; i < cache.size(); ++i)
+ cache[i]->insert(row, query->value(i));
+ row++;
+ } while (!cache[0]->isFull() && query->next());
+ while(query->next()) row++;
}
count = row;
query->finish();
@@ -674,6 +723,57 @@ void QmlSqlQueryPrivate::cacheQuery() const
}
/*
+ Schedules future background cache loading based of
+ the given row.
+
+ Should only be called if caching is active.
+*/
+void QmlSqlQueryPrivate::hitCache(int row) const
+{
+ Q_Q(const QmlSqlQuery);
+
+ Q_ASSERT(cache.size() > 0 && requireCache);
+ if (cache[0]->containsIndex(row)) {
+ int fi = cache[0]->firstIndex();
+ int li = cache[0]->lastIndex();
+ if (fi > 0 && row < fi + cacheNear)
+ scheduledRow = qMax(0, row + cacheRetain - cacheSize);
+ else if (li < count-1 && row > li - cacheNear)
+ scheduledRow = qMax(0, row - cacheRetain);
+
+ if (scheduledRow != -1 && cacheTimer == -1)
+ cacheTimer = ((QmlSqlQuery *)q)->startTimer(cacheInterval);
+ } else {
+ if (cacheTimer != -1) {
+ ((QmlSqlQuery *)q)->killTimer(cacheTimer);
+ cacheTimer = -1;
+ }
+ scheduledRow = -1;
+ qDebug() << "cache miss for row:" << row << "count:" << count;
+ enactShift(row);
+ }
+}
+
+/*
+ Load items from sql centered around row.
+*/
+void QmlSqlQueryPrivate::enactShift(int targetRow) const
+{
+ Q_ASSERT(query && cache.size());
+ query->exec();
+ int row = targetRow < cache[0]->firstIndex() ? targetRow : qMax(targetRow, cache[0]->lastIndex()+1);
+
+ if (query->seek(row)) {
+ do {
+ for (int i = 0; i < cache.size(); ++i) {
+ cache[i]->insert(row, query->value(i));
+ }
+ row++;
+ } while(row < targetRow + cacheSize && query->next());
+ }
+}
+
+/*
Gets the column names for the roles of the SqlQuery element.
The query must be active and on a valid row.
diff --git a/src/declarative/extra/qmlsqlquery.h b/src/declarative/extra/qmlsqlquery.h
index dca3596..7aa0709 100644
--- a/src/declarative/extra/qmlsqlquery.h
+++ b/src/declarative/extra/qmlsqlquery.h
@@ -123,6 +123,9 @@ public:
public slots:
void exec();
+protected:
+ void timerEvent(QTimerEvent *);
+
private slots:
void resetBinds();
void resetQuery();
diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp
index 62ede80..51905fa 100644
--- a/src/declarative/extra/qmlxmllistmodel.cpp
+++ b/src/declarative/extra/qmlxmllistmodel.cpp
@@ -202,11 +202,10 @@ void QmlXmlQuery::doQueryJob()
QXmlItem item(result.next());
if (item.isAtomicValue())
count = item.toAtomicValue().toInt();
- prefix += QLatin1String("[%1]/");
}
//qDebug() << count;
- m_prefix = namespaces + prefix;
+ m_prefix = namespaces + prefix + QLatin1String("/");
m_data = xml;
if (count > 0)
m_size = count;
@@ -222,8 +221,24 @@ void QmlXmlQuery::doSubQueryJob()
QXmlQuery subquery;
subquery.bindVariable(QLatin1String("inputDocument"), &b);
- //XXX should we use an array of objects or something else rather than a table?
- for (int j = 0; j < m_size; ++j) {
+ //### we might be able to condense even further (query for everything in one go)
+ for (int i = 0; i < m_roleObjects->size(); ++i) {
+ XmlListModelRole *role = m_roleObjects->at(i);
+ subquery.setQuery(m_prefix + QLatin1String("(let $v := ") + role->query() + QLatin1String(" return if ($v) then ") + role->query() + QLatin1String(" else \"\")"));
+ QXmlResultItems output3;
+ subquery.evaluateTo(&output3);
+ QXmlItem item(output3.next());
+ QList<QVariant> resultList;
+ while (!item.isNull()) {
+ resultList << item.toAtomicValue(); //### we used to trim strings
+ item = output3.next();
+ }
+ m_modelData << resultList;
+ b.seek(0);
+ }
+
+ //XXX this method is much slower, but would work better for incremental loading
+ /*for (int j = 0; j < m_size; ++j) {
QList<QVariant> resultList;
for (int i = 0; i < m_roleObjects->size(); ++i) {
XmlListModelRole *role = m_roleObjects->at(i);
@@ -248,7 +263,7 @@ void QmlXmlQuery::doSubQueryJob()
b.seek(0);
}
m_modelData << resultList;
- }
+ }*/
}
@@ -331,7 +346,7 @@ void QmlXmlRoleList::insert(int i, XmlListModelRole *role)
query: "doc($src)/rss/channel/item"
Role { name: "title"; query: "title/string()" }
Role { name: "link"; query: "link/string()" }
- Role { name: "description"; query: "description/string()"; isCData: true }
+ Role { name: "description"; query: "description/string()" }
}
\endqml
\note The model is currently static, so the above is really just a snapshot of an RSS feed.
@@ -362,7 +377,7 @@ QHash<int,QVariant> QmlXmlListModel::data(int index, const QList<int> &roles) co
for (int i = 0; i < roles.size(); ++i) {
int role = roles.at(i);
int roleIndex = d->roles.indexOf(role);
- rv.insert(role, d->data.at(index).at(roleIndex));
+ rv.insert(role, d->data.at(roleIndex).at(index));
}
return rv;
}
@@ -462,8 +477,8 @@ void QmlXmlListModel::reload()
d->queryId = -1;
//clear existing data
+ int count = d->size;
d->size = 0;
- int count = d->data.count();
d->data.clear();
if (count > 0)
emit itemsRemoved(0, count);
diff --git a/src/declarative/extra/qmlxmllistmodel.h b/src/declarative/extra/qmlxmllistmodel.h
index bdbba47..c6aae4a 100644
--- a/src/declarative/extra/qmlxmllistmodel.h
+++ b/src/declarative/extra/qmlxmllistmodel.h
@@ -57,11 +57,9 @@ class Q_DECLARATIVE_EXPORT XmlListModelRole : public QObject
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(QString query READ query WRITE setQuery)
- Q_PROPERTY(bool isCData READ isCData WRITE setIsCData)
- Q_PROPERTY(bool isStringList READ isStringList WRITE setIsStringList)
public:
- XmlListModelRole() : m_isList(false), m_isCData(false) {}
+ XmlListModelRole() {}
~XmlListModelRole() {}
QString name() const { return m_name; }
@@ -70,17 +68,9 @@ public:
QString query() const { return m_query; }
void setQuery(const QString &query) { m_query = query; }
- bool isStringList() const { return m_isList; }
- void setIsStringList(bool b) { m_isList = b; }
-
- bool isCData() const { return m_isCData; }
- void setIsCData(bool b) { m_isCData = b; }
-
private:
QString m_name;
QString m_query;
- bool m_isList;
- bool m_isCData;
};
QML_DECLARE_TYPE(XmlListModelRole)
diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri
index 90820fa..1c819e7 100644
--- a/src/declarative/fx/fx.pri
+++ b/src/declarative/fx/fx.pri
@@ -15,6 +15,7 @@ HEADERS += \
fx/qfxfocuspanel.h \
fx/qfxfocusrealm.h \
fx/qfxgridview.h \
+ fx/qfxflowview.h \
fx/qfxhighlightfilter.h \
fx/qfximage.h \
fx/qfxpainteditem.h \
@@ -63,6 +64,7 @@ SOURCES += \
fx/qfxfocuspanel.cpp \
fx/qfxfocusrealm.cpp \
fx/qfxgridview.cpp \
+ fx/qfxflowview.cpp \
fx/qfxhighlightfilter.cpp \
fx/qfximage.cpp \
fx/qfxpainteditem.cpp \
diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp
index bd5520a..09d6178 100644
--- a/src/declarative/fx/qfxanchors.cpp
+++ b/src/declarative/fx/qfxanchors.cpp
@@ -325,6 +325,10 @@ QFxItem *QFxAnchors::fill() const
void QFxAnchors::setFill(QFxItem *f)
{
Q_D(QFxAnchors);
+ if (f != d->item->itemParent() && f->itemParent() != d->item->itemParent()){
+ qmlInfo(d->item) << "Can't anchor to an item that isn't a parent or sibling.";
+ return;
+ }
d->remDepend(d->fill);
d->fill = f;
d->addDepend(d->fill);
@@ -847,7 +851,10 @@ bool QFxAnchorsPrivate::checkHAnchorValid(QFxAnchorLine anchor) const
if (anchor.anchorLine & QFxAnchorLine::Vertical_Mask) {
qmlInfo(item) << "Can't anchor a horizontal edge to a vertical edge.";
return false;
- }else if (anchor.item == item){
+ } else if (anchor.item != item->itemParent() && anchor.item->itemParent() != item->itemParent()){
+ qmlInfo(item) << "Can't anchor to an item that isn't a parent or sibling.";
+ return false;
+ } else if (anchor.item == item){
qmlInfo(item) << "Can't anchor item to self.";
return false;
}
@@ -878,7 +885,10 @@ bool QFxAnchorsPrivate::checkVAnchorValid(QFxAnchorLine anchor) const
if (anchor.anchorLine & QFxAnchorLine::Horizontal_Mask) {
qmlInfo(item) << "Can't anchor a vertical edge to a horizontal edge.";
return false;
- }else if (anchor.item == item){
+ } else if (anchor.item != item->itemParent() && anchor.item->itemParent() != item->itemParent()){
+ qmlInfo(item) << "Can't anchor to an item that isn't a parent or sibling.";
+ return false;
+ } else if (anchor.item == item){
qmlInfo(item) << "Can't anchor item to self.";
return false;
}
diff --git a/src/declarative/fx/qfxanimatedimageitem.cpp b/src/declarative/fx/qfxanimatedimageitem.cpp
index 604481c..d22959a 100644
--- a/src/declarative/fx/qfxanimatedimageitem.cpp
+++ b/src/declarative/fx/qfxanimatedimageitem.cpp
@@ -152,7 +152,7 @@ int QFxAnimatedImageItem::frameCount() const
return d->_movie->frameCount();
}
-void QFxAnimatedImageItem::setSource(const QString &url)
+void QFxAnimatedImageItem::setSource(const QUrl &url)
{
Q_D(QFxAnimatedImageItem);
if (url == d->url)
diff --git a/src/declarative/fx/qfxanimatedimageitem.h b/src/declarative/fx/qfxanimatedimageitem.h
index a0d14c4..5d115d7 100644
--- a/src/declarative/fx/qfxanimatedimageitem.h
+++ b/src/declarative/fx/qfxanimatedimageitem.h
@@ -73,7 +73,7 @@ public:
int frameCount() const;
// Extends QFxImage's src property*/
- virtual void setSource(const QString&);
+ virtual void setSource(const QUrl&);
Q_SIGNALS:
void playingChanged();
diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp
index e216196..0c93fef 100644
--- a/src/declarative/fx/qfxblendedimage.cpp
+++ b/src/declarative/fx/qfxblendedimage.cpp
@@ -81,6 +81,17 @@ QFxBlendedImage::QFxBlendedImage(QFxItem *parent)
}
/*!
+ Cancels any pending image loads and destroys the image.
+*/
+QFxBlendedImage::~QFxBlendedImage()
+{
+ if (!primUrl.isEmpty())
+ QFxPixmap::cancelGet(primUrl,this);
+ if (!secUrl.isEmpty())
+ QFxPixmap::cancelGet(secUrl,this);
+}
+
+/*!
\qmlproperty string BlendedImage::primaryUrl
The URL of the first image to be displayed in this item.
*/
diff --git a/src/declarative/fx/qfxblendedimage.h b/src/declarative/fx/qfxblendedimage.h
index 7169b92..248cc9d 100644
--- a/src/declarative/fx/qfxblendedimage.h
+++ b/src/declarative/fx/qfxblendedimage.h
@@ -63,6 +63,7 @@ class Q_DECLARATIVE_EXPORT QFxBlendedImage : public QFxItem
Q_PROPERTY(bool smooth READ smoothTransform WRITE setSmoothTransform)
public:
QFxBlendedImage(QFxItem *parent=0);
+ ~QFxBlendedImage();
QUrl primaryUrl() const;
void setPrimaryUrl(const QUrl &);
diff --git a/src/declarative/fx/qfxflowview.cpp b/src/declarative/fx/qfxflowview.cpp
new file mode 100644
index 0000000..e02e186
--- /dev/null
+++ b/src/declarative/fx/qfxflowview.cpp
@@ -0,0 +1,380 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qfxvisualitemmodel.h"
+#include "qfxflowview.h"
+
+QT_BEGIN_NAMESPACE
+
+class QFxFlowViewAttached : public QObject
+{
+Q_OBJECT
+Q_PROPERTY(int row READ row NOTIFY posChanged);
+Q_PROPERTY(int column READ column NOTIFY posChanged);
+public:
+ QFxFlowViewAttached(QObject *parent);
+
+ int row() const;
+ int column() const;
+
+signals:
+ void posChanged();
+
+private:
+ friend class QFxFlowView;
+ int m_row;
+ int m_column;
+};
+
+
+QFxFlowView::QFxFlowView()
+: m_columns(0), m_model(0), m_vertical(false), m_dragItem(0), m_dragIdx(-1)
+{
+ setAcceptedMouseButtons(Qt::LeftButton);
+ setOptions(MouseEvents);
+}
+
+QFxVisualItemModel *QFxFlowView::model() const
+{
+ return m_model;
+}
+
+void QFxFlowView::setModel(QFxVisualItemModel *m)
+{
+ m_model = m;
+ refresh();
+}
+
+int QFxFlowView::columns() const
+{
+ return m_columns;
+}
+
+void QFxFlowView::setColumns(int c)
+{
+ m_columns = c;
+ refresh();
+}
+
+bool QFxFlowView::vertical() const
+{
+ return m_vertical;
+}
+
+void QFxFlowView::setVertical(bool v)
+{
+ m_vertical = v;
+}
+
+class QFxFlowViewValue : public QmlTimeLineValue
+{
+public:
+ enum Property { xProperty, yProperty };
+
+ QFxFlowViewValue(QFxItem *item, Property p)
+ : m_item(item), m_property(p) {}
+
+ qreal value() const {
+ return (m_property == xProperty)?m_item->x():m_item->y();
+ }
+ void setValue(qreal v) {
+ if (m_property == xProperty) m_item->setX(v);
+ else m_item->setY(v);
+ }
+private:
+ QFxItem *m_item;
+ Property m_property;
+};
+
+void QFxFlowView::refresh()
+{
+ if (m_model && m_columns >= 1) {
+ for (int ii = 0; ii < m_model->count(); ++ii) {
+ QFxItem *item = m_model->item(ii);
+ item->setParent(this);
+ item->setZ(0);
+ m_items << item;
+ }
+
+ reflow();
+ }
+}
+
+void QFxFlowView::reflow(bool animate)
+{
+ qreal y = 0;
+ qreal maxY = 0;
+ qreal x = 0;
+ int row = 0;
+ int column = -1;
+ if (animate)
+ clearTimeLine();
+
+ for (int ii = 0; ii < m_items.count(); ++ii) {
+ if (0 == (ii % m_columns)) {
+ y += maxY;
+ maxY = 0;
+ x = 0;
+ row = 0;
+ column++;
+ }
+
+ QFxItem *item = m_items.at(ii);
+ QFxFlowViewAttached *att =
+ (QFxFlowViewAttached *)qmlAttachedPropertiesObject<QFxFlowView>(item);
+ att->m_row = row;
+ att->m_column = column;
+ emit att->posChanged();
+
+
+ if (animate) {
+ if (vertical())
+ moveItem(item, QPointF(y, x));
+ else
+ moveItem(item, QPointF(x, y));
+ } else {
+ if (vertical()) {
+ item->setX(y);
+ item->setY(x);
+ } else {
+ item->setX(x);
+ item->setY(y);
+ }
+ }
+ if (vertical()) {
+ x += item->height();
+ maxY = qMax(maxY, item->width());
+ } else {
+ x += item->width();
+ maxY = qMax(maxY, item->height());
+ }
+ ++row;
+ }
+}
+
+void QFxFlowView::reflowDrag(const QPointF &dp)
+{
+ qreal y = 0;
+ qreal maxY = 0;
+ qreal x = 0;
+
+ int flowedItems = 0;
+
+ clearTimeLine();
+
+ QList<QFxItem *> items;
+
+ bool dragUsed = false;
+ bool dragSeen = false;
+ for (int ii = 0; ii < m_items.count(); ++ii) {
+ if (0 == (ii % m_columns)) {
+ y += maxY;
+ maxY = 0;
+ x = 0;
+ }
+
+ QFxItem *item = m_items.at(ii);
+ if (item == m_dragItem)
+ dragSeen = true;
+ if (item == m_dragItem && dragUsed)
+ continue;
+ QRectF r;
+ if (vertical())
+ r = QRectF(y, x, item->width(), item->height());
+ else
+ r = QRectF(x, y, item->width(), item->height());
+ if (r.contains(dp)) {
+ dragUsed = true;
+ if (dragSeen)
+ m_dragIdx = items.count() + 1;
+ else
+ m_dragIdx = items.count();
+
+ items.append(m_dragItem);
+ if (m_dragItem != item) {
+ if (dragSeen)
+ items.insert(items.count() - 1, item);
+ else
+ items.append(item);
+ }
+ } else {
+ if (m_dragItem != item)
+ items.append(item);
+ }
+
+ if (vertical()) {
+ x += item->height();
+ maxY = qMax(maxY, item->width());
+ } else {
+ x += item->width();
+ maxY = qMax(maxY, item->height());
+ }
+ }
+
+ y = 0;
+ maxY = 0;
+ x = 0;
+ clearTimeLine();
+ for (int ii = 0; ii < items.count(); ++ii) {
+ if (0 == (ii % m_columns)) {
+ y += maxY;
+ maxY = 0;
+ x = 0;
+ }
+
+ QFxItem *item = items.at(ii);
+ if (item != m_dragItem) {
+ if (vertical())
+ moveItem(item, QPointF(y, x));
+ else
+ moveItem(item, QPointF(x, y));
+ }
+ if (vertical()) {
+ x += item->height();
+ maxY = qMax(maxY, item->width());
+ } else {
+ x += item->width();
+ maxY = qMax(maxY, item->height());
+ }
+ }
+
+}
+
+void QFxFlowView::moveItem(QFxItem *item, const QPointF &p)
+{
+ QFxFlowViewValue *xv = new QFxFlowViewValue(item, QFxFlowViewValue::xProperty);
+ QFxFlowViewValue *yv = new QFxFlowViewValue(item, QFxFlowViewValue::yProperty);
+ m_values << xv << yv;
+ m_timeline.move(*xv, p.x(), 100);
+ m_timeline.move(*yv, p.y(), 100);
+}
+
+#include <QGraphicsSceneMouseEvent>
+
+void QFxFlowView::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ for (int ii = 0; ii < m_items.count(); ++ii) {
+ QFxItem *item = m_items.at(ii);
+ QRectF r = rectForItem(ii);
+
+ if (r.contains(event->pos())) {
+ m_dragItem = item;
+ m_dragItem->setZ(1);
+ m_dragOffset = r.topLeft() - event->pos();
+ event->accept();
+ return;
+ }
+ }
+ event->ignore();
+}
+
+QRectF QFxFlowView::rectForItem(int idx) const
+{
+ QFxItem *item = m_items.at(idx);
+ QRectF r(item->x(), item->y(), item->width(), item->height());
+ return r;
+}
+
+void QFxFlowView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (m_dragItem) {
+ m_dragItem->setZ(0);
+
+ clearTimeLine();
+
+ if (m_dragIdx != -1) {
+ m_items.removeAll(m_dragItem);
+ m_items.insert(m_dragIdx, m_dragItem);
+ }
+
+ reflow(true);
+ m_dragItem = 0;
+ m_dragIdx = -1;
+ }
+}
+
+QFxFlowViewAttached::QFxFlowViewAttached(QObject *parent)
+: QObject(parent), m_row(0), m_column(0)
+{
+}
+
+int QFxFlowViewAttached::row() const
+{
+ return m_row;
+}
+
+int QFxFlowViewAttached::column() const
+{
+ return m_column;
+}
+
+QFxFlowViewAttached *QFxFlowView::qmlAttachedProperties(QObject *obj)
+{
+ return new QFxFlowViewAttached(obj);
+}
+
+void QFxFlowView::clearTimeLine()
+{
+ m_timeline.clear();
+ qDeleteAll(m_values);
+ m_values.clear();
+}
+
+void QFxFlowView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (m_dragItem) {
+ QPointF p = event->pos() + m_dragOffset;
+ m_dragItem->setX(p.x());
+ m_dragItem->setY(p.y());
+
+ for (int ii = 0; ii < m_items.count(); ++ii) {
+ if (m_items.at(ii) != m_dragItem && rectForItem(ii).contains(event->pos())) {
+ reflowDrag(event->pos());
+ }
+ }
+ }
+}
+
+QML_DEFINE_TYPE(QFxFlowView,FlowView);
+
+#include "qfxflowview.moc"
+
+QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxflowview.h b/src/declarative/fx/qfxflowview.h
new file mode 100644
index 0000000..0e7c2d3
--- /dev/null
+++ b/src/declarative/fx/qfxflowview.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QFXFLOWVIEW_H
+#define QFXFLOWVIEW_H
+
+#include <QtDeclarative/QmlTimeLine>
+#include <QtDeclarative/qfxitem.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+class QFxVisualItemModel;
+class QFxFlowViewValue;
+class QFxFlowViewAttached;
+class Q_DECLARATIVE_EXPORT QFxFlowView : public QFxItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QFxVisualItemModel *model READ model WRITE setModel)
+ Q_PROPERTY(int column READ columns WRITE setColumns);
+ Q_PROPERTY(bool vertical READ vertical WRITE setVertical);
+
+public:
+ QFxFlowView();
+
+ QFxVisualItemModel *model() const;
+ void setModel(QFxVisualItemModel *);
+
+ int columns() const;
+ void setColumns(int);
+
+ bool vertical() const;
+ void setVertical(bool);
+
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+ virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+
+ static QFxFlowViewAttached *qmlAttachedProperties(QObject *);
+
+private:
+ QRectF rectForItem(int idx) const;
+ void refresh();
+ void reflow(bool animate = false);
+ void reflowDrag(const QPointF &);
+ void clearTimeLine();
+ int m_columns;
+ QFxVisualItemModel *m_model;
+ QList<QFxItem *> m_items;
+ bool m_vertical;
+ void moveItem(QFxItem *item, const QPointF &);
+
+ QPointF m_dragOffset;
+ QFxItem *m_dragItem;
+
+ QmlTimeLine m_timeline;
+ QList<QFxFlowViewValue *> m_values;
+ int m_dragIdx;
+};
+QML_DECLARE_TYPE(QFxFlowView);
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QFXFLOWVIEW_H
diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp
index 3d5f413..1671fc6 100644
--- a/src/declarative/fx/qfxhighlightfilter.cpp
+++ b/src/declarative/fx/qfxhighlightfilter.cpp
@@ -58,7 +58,6 @@ public:
QFxHighlightFilterPrivate()
: xOffset(0), yOffset(0), tiled(false) {}
- QString source;
QUrl url;
int xOffset;
int yOffset;
@@ -115,6 +114,8 @@ QFxHighlightFilter::QFxHighlightFilter(QObject *parent)
QFxHighlightFilter::~QFxHighlightFilter()
{
+ if (!d->url.isEmpty())
+ QFxPixmap::cancelGet(d->url, this);
delete d;
d = 0;
}
@@ -130,7 +131,7 @@ QFxHighlightFilter::~QFxHighlightFilter()
*/
QUrl QFxHighlightFilter::source() const
{
- return d->source;
+ return d->url;
}
void QFxHighlightFilter::imageLoaded()
@@ -140,7 +141,7 @@ void QFxHighlightFilter::imageLoaded()
if (!img.isNull())
d->tex.setImage(img.toImage());
#endif
- emit sourceChanged(d->source);
+ emit sourceChanged(d->url);
update();
}
@@ -158,7 +159,7 @@ void QFxHighlightFilter::setSource(const QUrl &f)
if (!f.isEmpty())
QFxPixmap::get(qmlEngine(this), d->url, this, SLOT(imageLoaded()));
else
- emit sourceChanged(d->source);
+ emit sourceChanged(d->url);
}
/*!
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index 05738e3..40389c4 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -127,6 +127,10 @@ QFxImage::~QFxImage()
Q_D(QFxImage);
if (d->sciReply)
d->sciReply->deleteLater();
+ if (!d->url.isEmpty())
+ QFxPixmap::cancelGet(d->url, this);
+ if (!d->sciurl.isEmpty())
+ QFxPixmap::cancelGet(d->sciurl, this);
#if defined(QFX_RENDER_OPENGL)
if (d->tex) {
d->tex->release();
@@ -972,6 +976,13 @@ void QFxImage::setGridScaledImage(const QFxGridScaledImage& sci)
d->status = Error;
emit statusChanged(d->status);
} else {
+ QFxScaleGrid *sg = scaleGrid();
+ sg->setTop(sci.gridTop());
+ sg->setBottom(sci.gridBottom());
+ sg->setLeft(sci.gridLeft());
+ sg->setRight(sci.gridRight());
+ setOptions(QFxImage::SimpleItem, false);
+
d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl()));
d->reply = QFxPixmap::get(qmlEngine(this), d->sciurl, this, SLOT(requestFinished()));
if (d->reply) {
@@ -981,12 +992,6 @@ void QFxImage::setGridScaledImage(const QFxGridScaledImage& sci)
d->progress = 1.0;
emit progressChanged(d->progress);
}
- QFxScaleGrid *sg = scaleGrid();
- sg->setTop(sci.gridTop());
- sg->setBottom(sci.gridBottom());
- sg->setLeft(sci.gridLeft());
- sg->setRight(sci.gridRight());
- setOptions(QFxImage::SimpleItem, false);
}
}
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 648b0fb..079d691 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -901,11 +901,11 @@ void QFxItem::qmlLoaded()
QFxItem *qmlChild = qobject_cast<QFxItem *>(obj);
if (qmlChild) {
qmlChild->setItemParent(this);
- d->_qmlChildren.insert(d->_qml, qmlChild);
+ d->_qmlChildren.insert(d->_qml.toString(), qmlChild);
d->qmlItem = qmlChild;
} else {
delete qmlChild;
- d->_qml = QString();
+ d->_qml = QUrl();
}
delete d->_qmlcomp;
d->_qmlcomp = 0;
@@ -1962,7 +1962,7 @@ void QFxItem::newChild(const QString &type)
{
Q_D(QFxItem);
- QUrl url = qmlContext(this)->resolvedUri(type);
+ QUrl url = qmlContext(this)->resolvedUri(QUrl(type));
if (url.isEmpty())
return;
diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp
index 25e359d..4cd34c4 100644
--- a/src/declarative/fx/qfxparticles.cpp
+++ b/src/declarative/fx/qfxparticles.cpp
@@ -630,6 +630,9 @@ QFxParticles::QFxParticles(QFxParticlesPrivate &dd, QFxItem *parent)
QFxParticles::~QFxParticles()
{
+ Q_D(QFxParticles);
+ if (!d->url.isEmpty())
+ QFxPixmap::cancelGet(d->url, this);
}
/*!
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index f55357f..fd8d9ca 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -391,6 +391,8 @@ void QFxRect::dump(int depth)
// steelblue rect using SVG color name
Rect { color: "steelblue" }
\endqml
+
+ The default color is white.
*/
/*!
diff --git a/src/declarative/fx/qfxrect_p.h b/src/declarative/fx/qfxrect_p.h
index f662fac..23bb944 100644
--- a/src/declarative/fx/qfxrect_p.h
+++ b/src/declarative/fx/qfxrect_p.h
@@ -72,7 +72,7 @@ public:
#if defined(QFX_RENDER_OPENGL)
rectTexture(0),
#endif //QFX_RENDER_OPENGL
- gradient(0), pen(0), radius(0)
+ color(Qt::white), gradient(0), pen(0), radius(0)
{
}
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index 5492aaa..5f2f36c 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -682,7 +682,9 @@ void QFxTextEdit::keyPressEvent(QKeyEvent *event)
if (event->isAccepted())
return;
- QTextCursor c = textCursor();
+ //### this causes non-standard cursor behavior in some cases.
+ // is it still needed?
+ /*QTextCursor c = textCursor();
QTextCursor::MoveOperation op = QTextCursor::NoMove;
if (event == QKeySequence::MoveToNextChar) {
op = QTextCursor::Right;
@@ -700,7 +702,7 @@ void QFxTextEdit::keyPressEvent(QKeyEvent *event)
if (op != QTextCursor::NoMove && !c.movePosition(op))
event->ignore();
- else
+ else*/
d->control->processEvent(event, QPointF(0, 0));
}
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index d15502b..dc7f60e 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -1065,7 +1065,7 @@ QFxWebView *QFxWebPage::view()
QObject *QFxWebPage::createPlugin(const QString &, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues)
{
- QUrl comp = qmlContext(view())->resolvedUri(url.toString());
+ QUrl comp = qmlContext(view())->resolvedUri(url);
return new QWidget_Dummy_Plugin(comp,view(),paramNames,paramValues);
}
diff --git a/src/declarative/qml/parser/parser.pri b/src/declarative/qml/parser/parser.pri
index 72bd46c..610b2aa 100644
--- a/src/declarative/qml/parser/parser.pri
+++ b/src/declarative/qml/parser/parser.pri
@@ -1,22 +1,22 @@
INCLUDEPATH += $$PWD
-HEADERS += $$PWD/javascriptast_p.h \
- $$PWD/javascriptastfwd_p.h \
- $$PWD/javascriptastvisitor_p.h \
- $$PWD/javascriptengine_p.h \
- $$PWD/javascriptgrammar_p.h \
- $$PWD/javascriptlexer_p.h \
- $$PWD/javascriptmemorypool_p.h \
- $$PWD/javascriptnodepool_p.h \
- $$PWD/javascriptparser_p.h \
- $$PWD/javascriptprettypretty_p.h
+HEADERS += $$PWD/qmljsast_p.h \
+ $$PWD/qmljsastfwd_p.h \
+ $$PWD/qmljsastvisitor_p.h \
+ $$PWD/qmljsengine_p.h \
+ $$PWD/qmljsgrammar_p.h \
+ $$PWD/qmljslexer_p.h \
+ $$PWD/qmljsmemorypool_p.h \
+ $$PWD/qmljsnodepool_p.h \
+ $$PWD/qmljsparser_p.h \
+ $$PWD/qmljsprettypretty_p.h
-SOURCES += $$PWD/javascriptast.cpp \
- $$PWD/javascriptastvisitor.cpp \
- $$PWD/javascriptengine_p.cpp \
- $$PWD/javascriptgrammar.cpp \
- $$PWD/javascriptlexer.cpp \
- $$PWD/javascriptprettypretty.cpp \
- $$PWD/javascriptparser.cpp
+SOURCES += $$PWD/qmljsast.cpp \
+ $$PWD/qmljsastvisitor.cpp \
+ $$PWD/qmljsengine_p.cpp \
+ $$PWD/qmljsgrammar.cpp \
+ $$PWD/qmljslexer.cpp \
+ $$PWD/qmljsprettypretty.cpp \
+ $$PWD/qmljsparser.cpp
diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/qmljs.g
index 884d814..907ca52 100644
--- a/src/declarative/qml/parser/javascript.g
+++ b/src/declarative/qml/parser/qmljs.g
@@ -42,11 +42,11 @@
--
----------------------------------------------------------------------------
-%parser JavaScriptGrammar
-%decl javascriptparser_p.h
-%impl javascriptparser.cpp
+%parser QmlJSGrammar
+%decl qmljsparser_p.h
+%impl qmljsparser.cpp
%expect 2
-%expect-rr 2
+%expect-rr 3
%token T_AND "&" T_AND_AND "&&" T_AND_EQ "&="
%token T_BREAK "break" T_CASE "case" T_CATCH "catch"
@@ -137,10 +137,10 @@
#include <string.h>
-#include "javascriptengine_p.h"
-#include "javascriptlexer_p.h"
-#include "javascriptast_p.h"
-#include "javascriptnodepool_p.h"
+#include "qmljsengine_p.h"
+#include "qmljslexer_p.h"
+#include "qmljsast_p.h"
+#include "qmljsnodepool_p.h"
./
@@ -198,16 +198,16 @@
//
//
-// This file is automatically generated from javascript.g.
+// This file is automatically generated from qmljs.g.
// Changes will be lost.
//
-#ifndef JAVASCRIPTPARSER_P_H
-#define JAVASCRIPTPARSER_P_H
+#ifndef QMLJSPARSER_P_H
+#define QMLJSPARSER_P_H
-#include "javascriptgrammar_p.h"
-#include "javascriptast_p.h"
-#include "javascriptengine_p.h"
+#include "qmljsgrammar_p.h"
+#include "qmljsast_p.h"
+#include "qmljsengine_p.h"
#include <QtCore/QList>
@@ -215,7 +215,7 @@ QT_BEGIN_NAMESPACE
class QString;
-namespace JavaScript {
+namespace QmlJS {
class Engine;
class NameId;
@@ -262,6 +262,7 @@ public:
AST::UiArrayBinding *UiArrayBinding;
AST::UiObjectMember *UiObjectMember;
AST::UiObjectMemberList *UiObjectMemberList;
+ AST::UiArrayMemberList *UiArrayMemberList;
AST::UiQualifiedId *UiQualifiedId;
};
@@ -337,7 +338,7 @@ protected:
QList<DiagnosticMessage> diagnostic_messages;
};
-} // end of namespace JavaScript
+} // end of namespace QmlJS
:/
@@ -345,15 +346,15 @@ protected:
/.
-#include "javascriptparser_p.h"
+#include "qmljsparser_p.h"
#include <QVarLengthArray>
//
-// This file is automatically generated from javascript.g.
+// This file is automatically generated from qmljs.g.
// Changes will be lost.
//
-using namespace JavaScript;
+using namespace QmlJS;
QT_BEGIN_NAMESPACE
@@ -809,7 +810,7 @@ JsIdentifier: T_IDENTIFIER;
JsIdentifier: T_PROPERTY ;
/.
case $rule_number: {
- QString s = QLatin1String(JavaScriptGrammar::spell[T_PROPERTY]);
+ QString s = QLatin1String(QmlJSGrammar::spell[T_PROPERTY]);
sym(1).sval = driver->intern(s.constData(), s.length());
break;
}
@@ -818,7 +819,7 @@ case $rule_number: {
JsIdentifier: T_SIGNAL ;
/.
case $rule_number: {
- QString s = QLatin1String(JavaScriptGrammar::spell[T_SIGNAL]);
+ QString s = QLatin1String(QmlJSGrammar::spell[T_SIGNAL]);
sym(1).sval = driver->intern(s.constData(), s.length());
break;
}
@@ -2697,7 +2698,7 @@ case $rule_number: {
} break;
./
---JavaScriptProgram: SourceElements ;
+--QmlJSProgram: SourceElements ;
--/.
--case $rule_number: {
-- sym(1).Node = makeAstNode<AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ());
@@ -2876,5 +2877,5 @@ QT_END_NAMESPACE
-#endif // JAVASCRIPTPARSER_P_H
+#endif // QMLJSPARSER_P_H
:/
diff --git a/src/declarative/qml/parser/javascriptast.cpp b/src/declarative/qml/parser/qmljsast.cpp
index ada19d5..d10c071 100644
--- a/src/declarative/qml/parser/javascriptast.cpp
+++ b/src/declarative/qml/parser/qmljsast.cpp
@@ -39,15 +39,15 @@
**
****************************************************************************/
-#include "javascriptast_p.h"
+#include "qmljsast_p.h"
-#include "javascriptastvisitor_p.h"
+#include "qmljsastvisitor_p.h"
QT_BEGIN_NAMESPACE
-namespace JavaScript { namespace AST {
+namespace QmlJS { namespace AST {
int NumericLiteral::suffixLength[] = {
0, // noSuffix
@@ -955,7 +955,7 @@ void UiSourceElement::accept0(Visitor *visitor)
visitor->endVisit(this);
}
-} } // namespace JavaScript::AST
+} } // namespace QmlJS::AST
QT_END_NAMESPACE
diff --git a/src/declarative/qml/parser/javascriptast_p.h b/src/declarative/qml/parser/qmljsast_p.h
index 8c1e2bc..8dc32ed 100644
--- a/src/declarative/qml/parser/javascriptast_p.h
+++ b/src/declarative/qml/parser/qmljsast_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef JAVASCRIPTAST_P_H
-#define JAVASCRIPTAST_P_H
+#ifndef QMLJSAST_P_H
+#define QMLJSAST_P_H
//
// W A R N I N G
@@ -53,12 +53,12 @@
// We mean it.
//
-#include "javascriptastvisitor_p.h"
+#include "qmljsastvisitor_p.h"
#include <QtCore/QString>
QT_BEGIN_NAMESPACE
-#define JAVASCRIPT_DECLARE_AST_NODE(name) \
+#define QMLJS_DECLARE_AST_NODE(name) \
enum { K = Kind_##name };
namespace QSOperator // ### rename
@@ -104,7 +104,7 @@ enum Op {
} // namespace QSOperator
-namespace JavaScript {
+namespace QmlJS {
class NameId;
namespace AST {
@@ -271,7 +271,7 @@ public:
class NestedExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(NestedExpression)
+ QMLJS_DECLARE_AST_NODE(NestedExpression)
NestedExpression(ExpressionNode *expression)
: expression(expression)
@@ -294,7 +294,7 @@ public:
class ThisExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ThisExpression)
+ QMLJS_DECLARE_AST_NODE(ThisExpression)
ThisExpression() { kind = K; }
virtual ~ThisExpression() {}
@@ -314,7 +314,7 @@ public:
class IdentifierExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(IdentifierExpression)
+ QMLJS_DECLARE_AST_NODE(IdentifierExpression)
IdentifierExpression(NameId *n):
name (n) { kind = K; }
@@ -337,7 +337,7 @@ public:
class NullExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(NullExpression)
+ QMLJS_DECLARE_AST_NODE(NullExpression)
NullExpression() { kind = K; }
virtual ~NullExpression() {}
@@ -357,7 +357,7 @@ public:
class TrueLiteral: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(TrueLiteral)
+ QMLJS_DECLARE_AST_NODE(TrueLiteral)
TrueLiteral() { kind = K; }
virtual ~TrueLiteral() {}
@@ -377,7 +377,7 @@ public:
class FalseLiteral: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(FalseLiteral)
+ QMLJS_DECLARE_AST_NODE(FalseLiteral)
FalseLiteral() { kind = K; }
virtual ~FalseLiteral() {}
@@ -397,9 +397,9 @@ public:
class NumericLiteral: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(NumericLiteral)
+ QMLJS_DECLARE_AST_NODE(NumericLiteral)
- enum Suffix { // ### keep it in sync with the Suffix enum in javascriptlexer_p.h
+ enum Suffix { // ### keep it in sync with the Suffix enum in qmljslexer_p.h
noSuffix,
emSuffix,
exSuffix,
@@ -442,7 +442,7 @@ public:
class StringLiteral: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(StringLiteral)
+ QMLJS_DECLARE_AST_NODE(StringLiteral)
StringLiteral(NameId *v):
value (v) { kind = K; }
@@ -465,7 +465,7 @@ public:
class RegExpLiteral: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(RegExpLiteral)
+ QMLJS_DECLARE_AST_NODE(RegExpLiteral)
RegExpLiteral(NameId *p, int f):
pattern (p), flags (f) { kind = K; }
@@ -489,7 +489,7 @@ public:
class ArrayLiteral: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ArrayLiteral)
+ QMLJS_DECLARE_AST_NODE(ArrayLiteral)
ArrayLiteral(Elision *e):
elements (0), elision (e)
@@ -524,7 +524,7 @@ public:
class ObjectLiteral: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ObjectLiteral)
+ QMLJS_DECLARE_AST_NODE(ObjectLiteral)
ObjectLiteral():
properties (0) { kind = K; }
@@ -551,7 +551,7 @@ public:
class ElementList: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ElementList)
+ QMLJS_DECLARE_AST_NODE(ElementList)
ElementList(Elision *e, ExpressionNode *expr):
elision (e), expression (expr), next (this)
@@ -586,7 +586,7 @@ public:
class Elision: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(Elision)
+ QMLJS_DECLARE_AST_NODE(Elision)
Elision():
next (this) { kind = K; }
@@ -617,7 +617,7 @@ public:
class PropertyNameAndValueList: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(PropertyNameAndValueList)
+ QMLJS_DECLARE_AST_NODE(PropertyNameAndValueList)
PropertyNameAndValueList(PropertyName *n, ExpressionNode *v):
name (n), value (v), next (this)
@@ -653,7 +653,7 @@ public:
class PropertyName: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(PropertyName)
+ QMLJS_DECLARE_AST_NODE(PropertyName)
PropertyName() { kind = K; }
virtual ~PropertyName() {}
@@ -665,7 +665,7 @@ public:
class IdentifierPropertyName: public PropertyName
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(IdentifierPropertyName)
+ QMLJS_DECLARE_AST_NODE(IdentifierPropertyName)
IdentifierPropertyName(NameId *n):
id (n) { kind = K; }
@@ -681,7 +681,7 @@ public:
class StringLiteralPropertyName: public PropertyName
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(StringLiteralPropertyName)
+ QMLJS_DECLARE_AST_NODE(StringLiteralPropertyName)
StringLiteralPropertyName(NameId *n):
id (n) { kind = K; }
@@ -696,7 +696,7 @@ public:
class NumericLiteralPropertyName: public PropertyName
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(NumericLiteralPropertyName)
+ QMLJS_DECLARE_AST_NODE(NumericLiteralPropertyName)
NumericLiteralPropertyName(double n):
id (n) { kind = K; }
@@ -711,7 +711,7 @@ public:
class ArrayMemberExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ArrayMemberExpression)
+ QMLJS_DECLARE_AST_NODE(ArrayMemberExpression)
ArrayMemberExpression(ExpressionNode *b, ExpressionNode *e):
base (b), expression (e)
@@ -737,7 +737,7 @@ public:
class FieldMemberExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(FieldMemberExpression)
+ QMLJS_DECLARE_AST_NODE(FieldMemberExpression)
FieldMemberExpression(ExpressionNode *b, NameId *n):
base (b), name (n)
@@ -763,7 +763,7 @@ public:
class NewMemberExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(NewMemberExpression)
+ QMLJS_DECLARE_AST_NODE(NewMemberExpression)
NewMemberExpression(ExpressionNode *b, ArgumentList *a):
base (b), arguments (a)
@@ -790,7 +790,7 @@ public:
class NewExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(NewExpression)
+ QMLJS_DECLARE_AST_NODE(NewExpression)
NewExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -813,7 +813,7 @@ public:
class CallExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(CallExpression)
+ QMLJS_DECLARE_AST_NODE(CallExpression)
CallExpression(ExpressionNode *b, ArgumentList *a):
base (b), arguments (a)
@@ -839,7 +839,7 @@ public:
class ArgumentList: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ArgumentList)
+ QMLJS_DECLARE_AST_NODE(ArgumentList)
ArgumentList(ExpressionNode *e):
expression (e), next (this)
@@ -873,7 +873,7 @@ public:
class PostIncrementExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(PostIncrementExpression)
+ QMLJS_DECLARE_AST_NODE(PostIncrementExpression)
PostIncrementExpression(ExpressionNode *b):
base (b) { kind = K; }
@@ -896,7 +896,7 @@ public:
class PostDecrementExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(PostDecrementExpression)
+ QMLJS_DECLARE_AST_NODE(PostDecrementExpression)
PostDecrementExpression(ExpressionNode *b):
base (b) { kind = K; }
@@ -919,7 +919,7 @@ public:
class DeleteExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(DeleteExpression)
+ QMLJS_DECLARE_AST_NODE(DeleteExpression)
DeleteExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -941,7 +941,7 @@ public:
class VoidExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(VoidExpression)
+ QMLJS_DECLARE_AST_NODE(VoidExpression)
VoidExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -964,7 +964,7 @@ public:
class TypeOfExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(TypeOfExpression)
+ QMLJS_DECLARE_AST_NODE(TypeOfExpression)
TypeOfExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -987,7 +987,7 @@ public:
class PreIncrementExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(PreIncrementExpression)
+ QMLJS_DECLARE_AST_NODE(PreIncrementExpression)
PreIncrementExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1010,7 +1010,7 @@ public:
class PreDecrementExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(PreDecrementExpression)
+ QMLJS_DECLARE_AST_NODE(PreDecrementExpression)
PreDecrementExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1033,7 +1033,7 @@ public:
class UnaryPlusExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UnaryPlusExpression)
+ QMLJS_DECLARE_AST_NODE(UnaryPlusExpression)
UnaryPlusExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1056,7 +1056,7 @@ public:
class UnaryMinusExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UnaryMinusExpression)
+ QMLJS_DECLARE_AST_NODE(UnaryMinusExpression)
UnaryMinusExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1079,7 +1079,7 @@ public:
class TildeExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(TildeExpression)
+ QMLJS_DECLARE_AST_NODE(TildeExpression)
TildeExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1102,7 +1102,7 @@ public:
class NotExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(NotExpression)
+ QMLJS_DECLARE_AST_NODE(NotExpression)
NotExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1125,7 +1125,7 @@ public:
class BinaryExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(BinaryExpression)
+ QMLJS_DECLARE_AST_NODE(BinaryExpression)
BinaryExpression(ExpressionNode *l, int o, ExpressionNode *r):
left (l), op (o), right (r)
@@ -1153,7 +1153,7 @@ public:
class ConditionalExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ConditionalExpression)
+ QMLJS_DECLARE_AST_NODE(ConditionalExpression)
ConditionalExpression(ExpressionNode *e, ExpressionNode *t, ExpressionNode *f):
expression (e), ok (t), ko (f)
@@ -1180,7 +1180,7 @@ public:
class Expression: public ExpressionNode // ### rename
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(Expression)
+ QMLJS_DECLARE_AST_NODE(Expression)
Expression(ExpressionNode *l, ExpressionNode *r):
left (l), right (r) { kind = K; }
@@ -1204,7 +1204,7 @@ public:
class Block: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(Block)
+ QMLJS_DECLARE_AST_NODE(Block)
Block(StatementList *slist):
statements (slist) { kind = K; }
@@ -1228,7 +1228,7 @@ public:
class StatementList: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(StatementList)
+ QMLJS_DECLARE_AST_NODE(StatementList)
StatementList(Statement *stmt):
statement (stmt), next (this)
@@ -1261,7 +1261,7 @@ public:
class VariableStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(VariableStatement)
+ QMLJS_DECLARE_AST_NODE(VariableStatement)
VariableStatement(VariableDeclarationList *vlist):
declarations (vlist)
@@ -1286,7 +1286,7 @@ public:
class VariableDeclaration: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(VariableDeclaration)
+ QMLJS_DECLARE_AST_NODE(VariableDeclaration)
VariableDeclaration(NameId *n, ExpressionNode *e):
name (n), expression (e), readOnly(false)
@@ -1306,7 +1306,7 @@ public:
class VariableDeclarationList: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(VariableDeclarationList)
+ QMLJS_DECLARE_AST_NODE(VariableDeclarationList)
VariableDeclarationList(VariableDeclaration *decl):
declaration (decl), next (this)
@@ -1345,7 +1345,7 @@ public:
class EmptyStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(EmptyStatement)
+ QMLJS_DECLARE_AST_NODE(EmptyStatement)
EmptyStatement() { kind = K; }
virtual ~EmptyStatement() {}
@@ -1365,7 +1365,7 @@ public:
class ExpressionStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ExpressionStatement)
+ QMLJS_DECLARE_AST_NODE(ExpressionStatement)
ExpressionStatement(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1388,7 +1388,7 @@ public:
class IfStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(IfStatement)
+ QMLJS_DECLARE_AST_NODE(IfStatement)
IfStatement(ExpressionNode *e, Statement *t, Statement *f = 0):
expression (e), ok (t), ko (f)
@@ -1422,7 +1422,7 @@ public:
class DoWhileStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(DoWhileStatement)
+ QMLJS_DECLARE_AST_NODE(DoWhileStatement)
DoWhileStatement(Statement *stmt, ExpressionNode *e):
statement (stmt), expression (e)
@@ -1451,7 +1451,7 @@ public:
class WhileStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(WhileStatement)
+ QMLJS_DECLARE_AST_NODE(WhileStatement)
WhileStatement(ExpressionNode *e, Statement *stmt):
expression (e), statement (stmt)
@@ -1478,7 +1478,7 @@ public:
class ForStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ForStatement)
+ QMLJS_DECLARE_AST_NODE(ForStatement)
ForStatement(ExpressionNode *i, ExpressionNode *c, ExpressionNode *e, Statement *stmt):
initialiser (i), condition (c), expression (e), statement (stmt)
@@ -1509,7 +1509,7 @@ public:
class LocalForStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(LocalForStatement)
+ QMLJS_DECLARE_AST_NODE(LocalForStatement)
LocalForStatement(VariableDeclarationList *vlist, ExpressionNode *c, ExpressionNode *e, Statement *stmt):
declarations (vlist), condition (c), expression (e), statement (stmt)
@@ -1541,7 +1541,7 @@ public:
class ForEachStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ForEachStatement)
+ QMLJS_DECLARE_AST_NODE(ForEachStatement)
ForEachStatement(ExpressionNode *i, ExpressionNode *e, Statement *stmt):
initialiser (i), expression (e), statement (stmt)
@@ -1570,7 +1570,7 @@ public:
class LocalForEachStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(LocalForEachStatement)
+ QMLJS_DECLARE_AST_NODE(LocalForEachStatement)
LocalForEachStatement(VariableDeclaration *v, ExpressionNode *e, Statement *stmt):
declaration (v), expression (e), statement (stmt)
@@ -1600,7 +1600,7 @@ public:
class ContinueStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ContinueStatement)
+ QMLJS_DECLARE_AST_NODE(ContinueStatement)
ContinueStatement(NameId *l = 0):
label (l) { kind = K; }
@@ -1625,7 +1625,7 @@ public:
class BreakStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(BreakStatement)
+ QMLJS_DECLARE_AST_NODE(BreakStatement)
BreakStatement(NameId *l = 0):
label (l) { kind = K; }
@@ -1650,7 +1650,7 @@ public:
class ReturnStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ReturnStatement)
+ QMLJS_DECLARE_AST_NODE(ReturnStatement)
ReturnStatement(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1674,7 +1674,7 @@ public:
class WithStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(WithStatement)
+ QMLJS_DECLARE_AST_NODE(WithStatement)
WithStatement(ExpressionNode *e, Statement *stmt):
expression (e), statement (stmt)
@@ -1701,7 +1701,7 @@ public:
class CaseBlock: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(CaseBlock)
+ QMLJS_DECLARE_AST_NODE(CaseBlock)
CaseBlock(CaseClauses *c, DefaultClause *d = 0, CaseClauses *r = 0):
clauses (c), defaultClause (d), moreClauses (r)
@@ -1722,7 +1722,7 @@ public:
class SwitchStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(SwitchStatement)
+ QMLJS_DECLARE_AST_NODE(SwitchStatement)
SwitchStatement(ExpressionNode *e, CaseBlock *b):
expression (e), block (b)
@@ -1749,7 +1749,7 @@ public:
class CaseClauses: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(CaseClauses)
+ QMLJS_DECLARE_AST_NODE(CaseClauses)
CaseClauses(CaseClause *c):
clause (c), next (this)
@@ -1782,7 +1782,7 @@ public:
class CaseClause: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(CaseClause)
+ QMLJS_DECLARE_AST_NODE(CaseClause)
CaseClause(ExpressionNode *e, StatementList *slist):
expression (e), statements (slist)
@@ -1802,7 +1802,7 @@ public:
class DefaultClause: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(DefaultClause)
+ QMLJS_DECLARE_AST_NODE(DefaultClause)
DefaultClause(StatementList *slist):
statements (slist)
@@ -1821,7 +1821,7 @@ public:
class LabelledStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(LabelledStatement)
+ QMLJS_DECLARE_AST_NODE(LabelledStatement)
LabelledStatement(NameId *l, Statement *stmt):
label (l), statement (stmt)
@@ -1847,7 +1847,7 @@ public:
class ThrowStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(ThrowStatement)
+ QMLJS_DECLARE_AST_NODE(ThrowStatement)
ThrowStatement(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1871,7 +1871,7 @@ public:
class Catch: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(Catch)
+ QMLJS_DECLARE_AST_NODE(Catch)
Catch(NameId *n, Block *stmt):
name (n), statement (stmt)
@@ -1893,7 +1893,7 @@ public:
class Finally: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(Finally)
+ QMLJS_DECLARE_AST_NODE(Finally)
Finally(Block *stmt):
statement (stmt)
@@ -1911,7 +1911,7 @@ public:
class TryStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(TryStatement)
+ QMLJS_DECLARE_AST_NODE(TryStatement)
TryStatement(Statement *stmt, Catch *c, Finally *f):
statement (stmt), catchExpression (c), finallyExpression (f)
@@ -1952,7 +1952,7 @@ public:
class FunctionExpression: public ExpressionNode
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(FunctionExpression)
+ QMLJS_DECLARE_AST_NODE(FunctionExpression)
FunctionExpression(NameId *n, FormalParameterList *f, FunctionBody *b):
name (n), formals (f), body (b)
@@ -1983,7 +1983,7 @@ public:
class FunctionDeclaration: public FunctionExpression
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(FunctionDeclaration)
+ QMLJS_DECLARE_AST_NODE(FunctionDeclaration)
FunctionDeclaration(NameId *n, FormalParameterList *f, FunctionBody *b):
FunctionExpression(n, f, b)
@@ -1997,7 +1997,7 @@ public:
class FormalParameterList: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(FormalParameterList)
+ QMLJS_DECLARE_AST_NODE(FormalParameterList)
FormalParameterList(NameId *n):
name (n), next (this)
@@ -2032,7 +2032,7 @@ public:
class FunctionBody: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(FunctionBody)
+ QMLJS_DECLARE_AST_NODE(FunctionBody)
FunctionBody(SourceElements *elts):
elements (elts)
@@ -2049,7 +2049,7 @@ public:
class Program: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(Program)
+ QMLJS_DECLARE_AST_NODE(Program)
Program(SourceElements *elts):
elements (elts)
@@ -2066,7 +2066,7 @@ public:
class SourceElements: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(SourceElements)
+ QMLJS_DECLARE_AST_NODE(SourceElements)
SourceElements(SourceElement *elt):
element (elt), next (this)
@@ -2099,7 +2099,7 @@ public:
class SourceElement: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(SourceElement)
+ QMLJS_DECLARE_AST_NODE(SourceElement)
inline SourceElement()
{ kind = K; }
@@ -2110,7 +2110,7 @@ public:
class FunctionSourceElement: public SourceElement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(FunctionSourceElement)
+ QMLJS_DECLARE_AST_NODE(FunctionSourceElement)
FunctionSourceElement(FunctionDeclaration *f):
declaration (f)
@@ -2127,7 +2127,7 @@ public:
class StatementSourceElement: public SourceElement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(StatementSourceElement)
+ QMLJS_DECLARE_AST_NODE(StatementSourceElement)
StatementSourceElement(Statement *stmt):
statement (stmt)
@@ -2144,7 +2144,7 @@ public:
class DebuggerStatement: public Statement
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(DebuggerStatement)
+ QMLJS_DECLARE_AST_NODE(DebuggerStatement)
DebuggerStatement()
{ kind = K; }
@@ -2167,7 +2167,7 @@ public:
class UiProgram: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiProgram)
+ QMLJS_DECLARE_AST_NODE(UiProgram)
UiProgram(UiImportList *imports, UiObjectMemberList *members)
: imports(imports), members(members)
@@ -2183,7 +2183,7 @@ public:
class UiQualifiedId: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiQualifiedId)
+ QMLJS_DECLARE_AST_NODE(UiQualifiedId)
UiQualifiedId(NameId *name)
: next(this), name(name)
@@ -2217,7 +2217,7 @@ public:
class UiImport: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiImport)
+ QMLJS_DECLARE_AST_NODE(UiImport)
UiImport(NameId *fileName)
: fileName(fileName)
@@ -2235,7 +2235,7 @@ public:
class UiImportList: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiImportList)
+ QMLJS_DECLARE_AST_NODE(UiImportList)
UiImportList(UiImport *import)
: import(import),
@@ -2274,7 +2274,7 @@ public:
class UiObjectMemberList: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiObjectMemberList)
+ QMLJS_DECLARE_AST_NODE(UiObjectMemberList)
UiObjectMemberList(UiObjectMember *member)
: next(this), member(member)
@@ -2305,7 +2305,7 @@ public:
class UiArrayMemberList: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiArrayMemberList)
+ QMLJS_DECLARE_AST_NODE(UiArrayMemberList)
UiArrayMemberList(UiObjectMember *member)
: next(this), member(member)
@@ -2337,7 +2337,7 @@ public:
class UiObjectInitializer: public Node
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiObjectInitializer)
+ QMLJS_DECLARE_AST_NODE(UiObjectInitializer)
UiObjectInitializer(UiObjectMemberList *members)
: members(members)
@@ -2354,7 +2354,7 @@ public:
class UiPublicMember: public UiObjectMember
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiPublicMember)
+ QMLJS_DECLARE_AST_NODE(UiPublicMember)
UiPublicMember(NameId *memberType,
NameId *name)
@@ -2399,7 +2399,7 @@ public:
class UiObjectDefinition: public UiObjectMember
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiObjectDefinition)
+ QMLJS_DECLARE_AST_NODE(UiObjectDefinition)
UiObjectDefinition(UiQualifiedId *qualifiedTypeNameId,
UiObjectInitializer *initializer)
@@ -2422,7 +2422,7 @@ public:
class UiSourceElement: public UiObjectMember
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiSourceElement)
+ QMLJS_DECLARE_AST_NODE(UiSourceElement)
UiSourceElement(Node *sourceElement)
: sourceElement(sourceElement)
@@ -2458,7 +2458,7 @@ public:
class UiObjectBinding: public UiObjectMember
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiObjectBinding)
+ QMLJS_DECLARE_AST_NODE(UiObjectBinding)
UiObjectBinding(UiQualifiedId *qualifiedId,
UiQualifiedId *qualifiedTypeNameId,
@@ -2486,7 +2486,7 @@ public:
class UiScriptBinding: public UiObjectMember
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiScriptBinding)
+ QMLJS_DECLARE_AST_NODE(UiScriptBinding)
UiScriptBinding(UiQualifiedId *qualifiedId,
Statement *statement)
@@ -2511,7 +2511,7 @@ public:
class UiArrayBinding: public UiObjectMember
{
public:
- JAVASCRIPT_DECLARE_AST_NODE(UiArrayBinding)
+ QMLJS_DECLARE_AST_NODE(UiArrayBinding)
UiArrayBinding(UiQualifiedId *qualifiedId,
UiArrayMemberList *members)
diff --git a/src/declarative/qml/parser/javascriptastfwd_p.h b/src/declarative/qml/parser/qmljsastfwd_p.h
index 23270e5..339bea4 100644
--- a/src/declarative/qml/parser/javascriptastfwd_p.h
+++ b/src/declarative/qml/parser/qmljsastfwd_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef JAVASCRIPTAST_FWD_P_H
-#define JAVASCRIPTAST_FWD_P_H
+#ifndef QMLJSAST_FWD_P_H
+#define QMLJSAST_FWD_P_H
#include <QtCore/qglobal.h>
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-namespace JavaScript { namespace AST {
+namespace QmlJS { namespace AST {
class SourceLocation
{
diff --git a/src/declarative/qml/parser/javascriptastvisitor.cpp b/src/declarative/qml/parser/qmljsastvisitor.cpp
index eac291d..642bcee 100644
--- a/src/declarative/qml/parser/javascriptastvisitor.cpp
+++ b/src/declarative/qml/parser/qmljsastvisitor.cpp
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#include "javascriptastvisitor_p.h"
+#include "qmljsastvisitor_p.h"
QT_BEGIN_NAMESPACE
-namespace JavaScript { namespace AST {
+namespace QmlJS { namespace AST {
Visitor::Visitor()
{
@@ -53,6 +53,6 @@ Visitor::~Visitor()
{
}
-} } // namespace JavaScript::AST
+} } // namespace QmlJS::AST
QT_END_NAMESPACE
diff --git a/src/declarative/qml/parser/javascriptastvisitor_p.h b/src/declarative/qml/parser/qmljsastvisitor_p.h
index 7c73e43..3677b1a 100644
--- a/src/declarative/qml/parser/javascriptastvisitor_p.h
+++ b/src/declarative/qml/parser/qmljsastvisitor_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef JAVASCRIPTASTVISITOR_P_H
-#define JAVASCRIPTASTVISITOR_P_H
+#ifndef QMLJSASTVISITOR_P_H
+#define QMLJSASTVISITOR_P_H
//
// W A R N I N G
@@ -53,11 +53,11 @@
// We mean it.
//
-#include "javascriptastfwd_p.h"
+#include "qmljsastfwd_p.h"
QT_BEGIN_NAMESPACE
-namespace JavaScript { namespace AST {
+namespace QmlJS { namespace AST {
class Visitor
{
@@ -97,7 +97,7 @@ public:
virtual void endVisit(UiArrayMemberList *) {}
virtual void endVisit(UiQualifiedId *) {}
- // JavaScript
+ // QmlJS
virtual bool visit(ThisExpression *) { return true; }
virtual void endVisit(ThisExpression *) {}
@@ -325,4 +325,4 @@ public:
QT_END_NAMESPACE
-#endif // JAVASCRIPTASTVISITOR_P_H
+#endif // QMLJSASTVISITOR_P_H
diff --git a/src/declarative/qml/parser/javascriptengine_p.cpp b/src/declarative/qml/parser/qmljsengine_p.cpp
index d893a90..42885d8 100644
--- a/src/declarative/qml/parser/javascriptengine_p.cpp
+++ b/src/declarative/qml/parser/qmljsengine_p.cpp
@@ -27,16 +27,16 @@
**
**************************************************************************/
-#include "javascriptengine_p.h"
-#include "javascriptnodepool_p.h"
+#include "qmljsengine_p.h"
+#include "qmljsnodepool_p.h"
#include <qnumeric.h>
#include <QHash>
QT_BEGIN_NAMESPACE
-namespace JavaScript {
+namespace QmlJS {
-uint qHash(const JavaScript::NameId &id)
+uint qHash(const QmlJS::NameId &id)
{ return qHash(id.asString()); }
QString numberToString(double value)
@@ -186,6 +186,6 @@ void Engine::setNodePool(NodePool *nodePool)
-} // end of namespace JavaScript
+} // end of namespace QmlJS
QT_END_NAMESPACE
diff --git a/src/declarative/qml/parser/javascriptengine_p.h b/src/declarative/qml/parser/qmljsengine_p.h
index 3bd924a..b9ff042 100644
--- a/src/declarative/qml/parser/javascriptengine_p.h
+++ b/src/declarative/qml/parser/qmljsengine_p.h
@@ -27,17 +27,17 @@
**
**************************************************************************/
-#ifndef JAVASCRIPTENGINE_P_H
-#define JAVASCRIPTENGINE_P_H
+#ifndef QMLJSENGINE_P_H
+#define QMLJSENGINE_P_H
#include <QString>
#include <QSet>
-#include "javascriptastfwd_p.h"
+#include "qmljsastfwd_p.h"
QT_BEGIN_NAMESPACE
-namespace JavaScript {
+namespace QmlJS {
class NameId
{
QString _text;
@@ -60,17 +60,17 @@ public:
{ return _text < other._text; }
};
-uint qHash(const JavaScript::NameId &id);
+uint qHash(const QmlJS::NameId &id);
-} // end of namespace JavaScript
+} // end of namespace QmlJS
#if defined(Q_CC_MSVC) && _MSC_VER <= 1300
-//this ensures that code outside JavaScript can use the hash function
+//this ensures that code outside QmlJS can use the hash function
//it also a workaround for some compilers
-inline uint qHash(const JavaScript::NameId &nameId) { return JavaScript::qHash(nameId); }
+inline uint qHash(const QmlJS::NameId &nameId) { return QmlJS::qHash(nameId); }
#endif
-namespace JavaScript {
+namespace QmlJS {
class Lexer;
class NodePool;
@@ -138,8 +138,8 @@ public:
void setNodePool(NodePool *nodePool);
};
-} // end of namespace JavaScript
+} // end of namespace QmlJS
QT_END_NAMESPACE
-#endif // JAVASCRIPTENGINE_P_H
+#endif // QMLJSENGINE_P_H
diff --git a/src/declarative/qml/parser/javascriptgrammar.cpp b/src/declarative/qml/parser/qmljsgrammar.cpp
index a879bfe..835ee44 100644
--- a/src/declarative/qml/parser/javascriptgrammar.cpp
+++ b/src/declarative/qml/parser/qmljsgrammar.cpp
@@ -40,9 +40,9 @@
**
****************************************************************************/
-#include "javascriptgrammar_p.h"
+#include "qmljsgrammar_p.h"
-const char *const JavaScriptGrammar::spell [] = {
+const char *const QmlJSGrammar::spell [] = {
"end of file", "&", "&&", "&=", "break", "case", "catch", ":", ";", "continue",
"default", "delete", "/", "/=", "do", ".", "else", "=", "==", "===",
"finally", "for", "function", ">=", ">", ">>", ">>=", ">>>", ">>>=", "identifier",
@@ -54,7 +54,7 @@ const char *const JavaScriptGrammar::spell [] = {
"null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "public", "import", 0,
0};
-const int JavaScriptGrammar::lhs [] = {
+const int QmlJSGrammar::lhs [] = {
91, 92, 92, 95, 95, 96, 96, 94, 93, 98,
98, 100, 100, 101, 101, 97, 99, 99, 103, 104,
104, 99, 99, 99, 99, 99, 99, 99, 111, 111,
@@ -89,7 +89,7 @@ const int JavaScriptGrammar::lhs [] = {
185, 186, 186, 189, 190, 190, 191, 191, 187, 187,
118, 118, 192};
-const int JavaScriptGrammar:: rhs[] = {
+const int QmlJSGrammar:: rhs[] = {
2, 1, 1, 1, 2, 3, 3, 0, 1, 1,
2, 1, 3, 2, 3, 2, 1, 5, 1, 2,
2, 4, 3, 3, 3, 3, 3, 3, 1, 1,
@@ -124,7 +124,7 @@ const int JavaScriptGrammar:: rhs[] = {
1, 0, 1, 1, 1, 2, 1, 1, 0, 1,
0, 1, 2};
-const int JavaScriptGrammar::action_default [] = {
+const int QmlJSGrammar::action_default [] = {
8, 2, 0, 4, 3, 0, 0, 0, 6, 7,
5, 65, 45, 46, 43, 44, 47, 9, 0, 1,
0, 0, 16, 66, 41, 248, 0, 0, 46, 14,
@@ -185,7 +185,7 @@ const int JavaScriptGrammar::action_default [] = {
0, 12, 0, 18, 13, 20, 21, 257, 250, 0,
258, 254, 0, 256, 246, 0, 247, 251, 323};
-const int JavaScriptGrammar::goto_default [] = {
+const int QmlJSGrammar::goto_default [] = {
6, 5, 19, 1, 4, 3, 32, 34, 33, 570,
22, 18, 538, 539, 231, 226, 230, 232, 229, 236,
517, 235, 264, 57, 65, 495, 494, 388, 387, 48,
@@ -198,7 +198,7 @@ const int JavaScriptGrammar::goto_default [] = {
454, 453, 473, 474, 220, 234, 216, 219, 233, 241,
240, 0};
-const int JavaScriptGrammar::action_index [] = {
+const int QmlJSGrammar::action_index [] = {
8, -91, 14, -91, -15, 296, 67, 94, -91, -91,
-91, -91, -91, -91, -91, -91, -91, -91, 109, -91,
184, 408, -91, -91, -91, -91, 45, 125, 170, -91,
@@ -319,7 +319,7 @@ const int JavaScriptGrammar::action_index [] = {
-102, -102, 128, -102, -102, -102, -102, -102, -102, -102,
-102, -102, -6, -102, -102, 58, -102, -102, -102};
-const int JavaScriptGrammar::action_info [] = {
+const int QmlJSGrammar::action_info [] = {
338, 174, 289, 485, 472, 472, -89, 480, -105, 380,
43, 472, -79, -78, -100, 448, -97, 435, -102, 134,
304, 326, 132, 104, 478, 375, 489, 372, 374, 456,
@@ -573,7 +573,7 @@ const int JavaScriptGrammar::action_info [] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0};
-const int JavaScriptGrammar::action_check [] = {
+const int QmlJSGrammar::action_check [] = {
60, 8, 36, 36, 33, 33, 7, 60, 7, 36,
29, 33, 7, 7, 7, 36, 7, 55, 7, 78,
1, 78, 48, 1, 36, 33, 36, 36, 60, 5,
diff --git a/src/declarative/qml/parser/javascriptgrammar_p.h b/src/declarative/qml/parser/qmljsgrammar_p.h
index 830f533..c514485 100644
--- a/src/declarative/qml/parser/javascriptgrammar_p.h
+++ b/src/declarative/qml/parser/qmljsgrammar_p.h
@@ -51,10 +51,10 @@
// We mean it.
//
-#ifndef JAVASCRIPTGRAMMAR_P_H
-#define JAVASCRIPTGRAMMAR_P_H
+#ifndef QMLJSGRAMMAR_P_H
+#define QMLJSGRAMMAR_P_H
-class JavaScriptGrammar
+class QmlJSGrammar
{
public:
enum {
@@ -196,5 +196,5 @@ public:
};
-#endif // JAVASCRIPTGRAMMAR_P_H
+#endif // QMLJSGRAMMAR_P_H
diff --git a/src/declarative/qml/parser/javascriptlexer.cpp b/src/declarative/qml/parser/qmljslexer.cpp
index ea36a7a..843f6ae 100644
--- a/src/declarative/qml/parser/javascriptlexer.cpp
+++ b/src/declarative/qml/parser/qmljslexer.cpp
@@ -43,9 +43,9 @@
#include "config.h"
#endif
-#include "javascriptengine_p.h"
-#include "javascriptlexer_p.h"
-#include "javascriptgrammar_p.h"
+#include "qmljsengine_p.h"
+#include "qmljslexer_p.h"
+#include "qmljsgrammar_p.h"
#include <ctype.h>
#include <stdlib.h>
@@ -65,11 +65,11 @@ extern double qstrtod(const char *s00, char const **se, bool *ok);
} \
while (0)
-namespace JavaScript {
+namespace QmlJS {
extern double integerFromString(const char *buf, int size, int radix);
}
-using namespace JavaScript;
+using namespace QmlJS;
Lexer::Lexer(Engine *eng)
: driver(eng),
@@ -154,66 +154,66 @@ int Lexer::findReservedWord(const QChar *c, int size) const
switch (size) {
case 2: {
if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('o'))
- return JavaScriptGrammar::T_DO;
+ return QmlJSGrammar::T_DO;
else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('f'))
- return JavaScriptGrammar::T_IF;
+ return QmlJSGrammar::T_IF;
else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n'))
- return JavaScriptGrammar::T_IN;
+ return QmlJSGrammar::T_IN;
} break;
case 3: {
if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('o') && c[2] == QLatin1Char('r'))
- return JavaScriptGrammar::T_FOR;
+ return QmlJSGrammar::T_FOR;
else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('e') && c[2] == QLatin1Char('w'))
- return JavaScriptGrammar::T_NEW;
+ return QmlJSGrammar::T_NEW;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r') && c[2] == QLatin1Char('y'))
- return JavaScriptGrammar::T_TRY;
+ return QmlJSGrammar::T_TRY;
else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('a') && c[2] == QLatin1Char('r'))
- return JavaScriptGrammar::T_VAR;
+ return QmlJSGrammar::T_VAR;
else if (check_reserved) {
if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n') && c[2] == QLatin1Char('t'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
}
} break;
case 4: {
if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('a')
&& c[2] == QLatin1Char('s') && c[3] == QLatin1Char('e'))
- return JavaScriptGrammar::T_CASE;
+ return QmlJSGrammar::T_CASE;
else if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('l')
&& c[2] == QLatin1Char('s') && c[3] == QLatin1Char('e'))
- return JavaScriptGrammar::T_ELSE;
+ return QmlJSGrammar::T_ELSE;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h')
&& c[2] == QLatin1Char('i') && c[3] == QLatin1Char('s'))
- return JavaScriptGrammar::T_THIS;
+ return QmlJSGrammar::T_THIS;
else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('i') && c[3] == QLatin1Char('d'))
- return JavaScriptGrammar::T_VOID;
+ return QmlJSGrammar::T_VOID;
else if (c[0] == QLatin1Char('w') && c[1] == QLatin1Char('i')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('h'))
- return JavaScriptGrammar::T_WITH;
+ return QmlJSGrammar::T_WITH;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r')
&& c[2] == QLatin1Char('u') && c[3] == QLatin1Char('e'))
- return JavaScriptGrammar::T_TRUE;
+ return QmlJSGrammar::T_TRUE;
else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('u')
&& c[2] == QLatin1Char('l') && c[3] == QLatin1Char('l'))
- return JavaScriptGrammar::T_NULL;
+ return QmlJSGrammar::T_NULL;
else if (check_reserved) {
if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('n')
&& c[2] == QLatin1Char('u') && c[3] == QLatin1Char('m'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('y')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('l') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('n') && c[3] == QLatin1Char('g'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('h')
&& c[2] == QLatin1Char('a') && c[3] == QLatin1Char('r'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('g') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('o'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -221,48 +221,48 @@ int Lexer::findReservedWord(const QChar *c, int size) const
if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('r')
&& c[2] == QLatin1Char('e') && c[3] == QLatin1Char('a')
&& c[4] == QLatin1Char('k'))
- return JavaScriptGrammar::T_BREAK;
+ return QmlJSGrammar::T_BREAK;
else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('a')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('c')
&& c[4] == QLatin1Char('h'))
- return JavaScriptGrammar::T_CATCH;
+ return QmlJSGrammar::T_CATCH;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h')
&& c[2] == QLatin1Char('r') && c[3] == QLatin1Char('o')
&& c[4] == QLatin1Char('w'))
- return JavaScriptGrammar::T_THROW;
+ return QmlJSGrammar::T_THROW;
else if (c[0] == QLatin1Char('w') && c[1] == QLatin1Char('h')
&& c[2] == QLatin1Char('i') && c[3] == QLatin1Char('l')
&& c[4] == QLatin1Char('e'))
- return JavaScriptGrammar::T_WHILE;
+ return QmlJSGrammar::T_WHILE;
else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('n') && c[3] == QLatin1Char('s')
&& c[4] == QLatin1Char('t'))
- return JavaScriptGrammar::T_CONST;
+ return QmlJSGrammar::T_CONST;
else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('a')
&& c[2] == QLatin1Char('l') && c[3] == QLatin1Char('s')
&& c[4] == QLatin1Char('e'))
- return JavaScriptGrammar::T_FALSE;
+ return QmlJSGrammar::T_FALSE;
else if (check_reserved) {
if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('h')
&& c[2] == QLatin1Char('o') && c[3] == QLatin1Char('r')
&& c[4] == QLatin1Char('t'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('u')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('e')
&& c[4] == QLatin1Char('r'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('i')
&& c[2] == QLatin1Char('n') && c[3] == QLatin1Char('a')
&& c[4] == QLatin1Char('l'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('l')
&& c[2] == QLatin1Char('a') && c[3] == QLatin1Char('s')
&& c[4] == QLatin1Char('s'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('l')
&& c[2] == QLatin1Char('o') && c[3] == QLatin1Char('a')
&& c[4] == QLatin1Char('t'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -270,56 +270,56 @@ int Lexer::findReservedWord(const QChar *c, int size) const
if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e')
&& c[2] == QLatin1Char('l') && c[3] == QLatin1Char('e')
&& c[4] == QLatin1Char('t') && c[5] == QLatin1Char('e'))
- return JavaScriptGrammar::T_DELETE;
+ return QmlJSGrammar::T_DELETE;
else if (c[0] == QLatin1Char('r') && c[1] == QLatin1Char('e')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('u')
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('n'))
- return JavaScriptGrammar::T_RETURN;
+ return QmlJSGrammar::T_RETURN;
else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('w')
&& c[2] == QLatin1Char('i') && c[3] == QLatin1Char('t')
&& c[4] == QLatin1Char('c') && c[5] == QLatin1Char('h'))
- return JavaScriptGrammar::T_SWITCH;
+ return QmlJSGrammar::T_SWITCH;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('y')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('e')
&& c[4] == QLatin1Char('o') && c[5] == QLatin1Char('f'))
- return JavaScriptGrammar::T_TYPEOF;
+ return QmlJSGrammar::T_TYPEOF;
else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
- return JavaScriptGrammar::T_IMPORT;
+ return QmlJSGrammar::T_IMPORT;
else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('i')
&& c[2] == QLatin1Char('g') && c[3] == QLatin1Char('n')
&& c[4] == QLatin1Char('a') && c[5] == QLatin1Char('l'))
- return JavaScriptGrammar::T_SIGNAL;
+ return QmlJSGrammar::T_SIGNAL;
else if (check_reserved) {
if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('x')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('t')
&& c[2] == QLatin1Char('a') && c[3] == QLatin1Char('t')
&& c[4] == QLatin1Char('i') && c[5] == QLatin1Char('c'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('u') && c[3] == QLatin1Char('b')
&& c[4] == QLatin1Char('l') && c[5] == QLatin1Char('e'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('u')
&& c[2] == QLatin1Char('b') && c[3] == QLatin1Char('l')
&& c[4] == QLatin1Char('i') && c[5] == QLatin1Char('c'))
- return JavaScriptGrammar::T_PUBLIC;
+ return QmlJSGrammar::T_PUBLIC;
else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('a')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('i')
&& c[4] == QLatin1Char('v') && c[5] == QLatin1Char('e'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h')
&& c[2] == QLatin1Char('r') && c[3] == QLatin1Char('o')
&& c[4] == QLatin1Char('w') && c[5] == QLatin1Char('s'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -328,33 +328,33 @@ int Lexer::findReservedWord(const QChar *c, int size) const
&& c[2] == QLatin1Char('f') && c[3] == QLatin1Char('a')
&& c[4] == QLatin1Char('u') && c[5] == QLatin1Char('l')
&& c[6] == QLatin1Char('t'))
- return JavaScriptGrammar::T_DEFAULT;
+ return QmlJSGrammar::T_DEFAULT;
else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('i')
&& c[2] == QLatin1Char('n') && c[3] == QLatin1Char('a')
&& c[4] == QLatin1Char('l') && c[5] == QLatin1Char('l')
&& c[6] == QLatin1Char('y'))
- return JavaScriptGrammar::T_FINALLY;
+ return QmlJSGrammar::T_FINALLY;
else if (check_reserved) {
if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('o') && c[3] == QLatin1Char('l')
&& c[4] == QLatin1Char('e') && c[5] == QLatin1Char('a')
&& c[6] == QLatin1Char('n'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('x')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e')
&& c[4] == QLatin1Char('n') && c[5] == QLatin1Char('d')
&& c[6] == QLatin1Char('s'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('a')
&& c[2] == QLatin1Char('c') && c[3] == QLatin1Char('k')
&& c[4] == QLatin1Char('a') && c[5] == QLatin1Char('g')
&& c[6] == QLatin1Char('e'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r')
&& c[2] == QLatin1Char('i') && c[3] == QLatin1Char('v')
&& c[4] == QLatin1Char('a') && c[5] == QLatin1Char('t')
&& c[6] == QLatin1Char('e'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -363,33 +363,33 @@ int Lexer::findReservedWord(const QChar *c, int size) const
&& c[2] == QLatin1Char('n') && c[3] == QLatin1Char('t')
&& c[4] == QLatin1Char('i') && c[5] == QLatin1Char('n')
&& c[6] == QLatin1Char('u') && c[7] == QLatin1Char('e'))
- return JavaScriptGrammar::T_CONTINUE;
+ return QmlJSGrammar::T_CONTINUE;
else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('u')
&& c[2] == QLatin1Char('n') && c[3] == QLatin1Char('c')
&& c[4] == QLatin1Char('t') && c[5] == QLatin1Char('i')
&& c[6] == QLatin1Char('o') && c[7] == QLatin1Char('n'))
- return JavaScriptGrammar::T_FUNCTION;
+ return QmlJSGrammar::T_FUNCTION;
else if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e')
&& c[2] == QLatin1Char('b') && c[3] == QLatin1Char('u')
&& c[4] == QLatin1Char('g') && c[5] == QLatin1Char('g')
&& c[6] == QLatin1Char('e') && c[7] == QLatin1Char('r'))
- return JavaScriptGrammar::T_DEBUGGER;
+ return QmlJSGrammar::T_DEBUGGER;
else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r')
&& c[2] == QLatin1Char('o') && c[3] == QLatin1Char('p')
&& c[4] == QLatin1Char('e') && c[5] == QLatin1Char('r')
&& c[6] == QLatin1Char('t') && c[7] == QLatin1Char('y'))
- return JavaScriptGrammar::T_PROPERTY;
+ return QmlJSGrammar::T_PROPERTY;
else if (check_reserved) {
if (c[0] == QLatin1Char('a') && c[1] == QLatin1Char('b')
&& c[2] == QLatin1Char('s') && c[3] == QLatin1Char('t')
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('a')
&& c[6] == QLatin1Char('c') && c[7] == QLatin1Char('t'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('l') && c[3] == QLatin1Char('a')
&& c[4] == QLatin1Char('t') && c[5] == QLatin1Char('i')
&& c[6] == QLatin1Char('l') && c[7] == QLatin1Char('e'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -400,19 +400,19 @@ int Lexer::findReservedWord(const QChar *c, int size) const
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('f')
&& c[6] == QLatin1Char('a') && c[7] == QLatin1Char('c')
&& c[8] == QLatin1Char('e'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r')
&& c[2] == QLatin1Char('a') && c[3] == QLatin1Char('n')
&& c[4] == QLatin1Char('s') && c[5] == QLatin1Char('i')
&& c[6] == QLatin1Char('e') && c[7] == QLatin1Char('n')
&& c[8] == QLatin1Char('t'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r')
&& c[2] == QLatin1Char('o') && c[3] == QLatin1Char('t')
&& c[4] == QLatin1Char('e') && c[5] == QLatin1Char('c')
&& c[6] == QLatin1Char('t') && c[7] == QLatin1Char('e')
&& c[8] == QLatin1Char('d'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -422,14 +422,14 @@ int Lexer::findReservedWord(const QChar *c, int size) const
&& c[4] == QLatin1Char('a') && c[5] == QLatin1Char('n')
&& c[6] == QLatin1Char('c') && c[7] == QLatin1Char('e')
&& c[8] == QLatin1Char('o') && c[9] == QLatin1Char('f'))
- return JavaScriptGrammar::T_INSTANCEOF;
+ return QmlJSGrammar::T_INSTANCEOF;
else if (check_reserved) {
if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('l')
&& c[4] == QLatin1Char('e') && c[5] == QLatin1Char('m')
&& c[6] == QLatin1Char('e') && c[7] == QLatin1Char('n')
&& c[8] == QLatin1Char('t') && c[9] == QLatin1Char('s'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -441,7 +441,7 @@ int Lexer::findReservedWord(const QChar *c, int size) const
&& c[6] == QLatin1Char('o') && c[7] == QLatin1Char('n')
&& c[8] == QLatin1Char('i') && c[9] == QLatin1Char('z')
&& c[10] == QLatin1Char('e') && c[11] == QLatin1Char('d'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return QmlJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -485,7 +485,7 @@ int Lexer::lex()
syncProhibitAutomaticSemicolon();
if (!terminator && !delimited && !prohibitAutomaticSemicolon) {
// automatic semicolon insertion if program incomplete
- token = JavaScriptGrammar::T_SEMICOLON;
+ token = QmlJSGrammar::T_SEMICOLON;
stackToken = 0;
setDone(Other);
} else {
@@ -499,7 +499,7 @@ int Lexer::lex()
terminator = true;
syncProhibitAutomaticSemicolon();
if (restrKeyword) {
- token = JavaScriptGrammar::T_SEMICOLON;
+ token = QmlJSGrammar::T_SEMICOLON;
setDone(Other);
}
} else if (current == '"' || current == '\'') {
@@ -528,11 +528,11 @@ int Lexer::lex()
token = matchPunctuator(current, next1, next2, next3);
if (token != -1) {
if (terminator && !delimited && !prohibitAutomaticSemicolon
- && (token == JavaScriptGrammar::T_PLUS_PLUS
- || token == JavaScriptGrammar::T_MINUS_MINUS)) {
+ && (token == QmlJSGrammar::T_PLUS_PLUS
+ || token == QmlJSGrammar::T_MINUS_MINUS)) {
// automatic semicolon insertion
stackToken = token;
- token = JavaScriptGrammar::T_SEMICOLON;
+ token = QmlJSGrammar::T_SEMICOLON;
}
setDone(Other);
}
@@ -636,7 +636,7 @@ int Lexer::lex()
terminator = true;
bol = true;
if (restrKeyword) {
- token = JavaScriptGrammar::T_SEMICOLON;
+ token = QmlJSGrammar::T_SEMICOLON;
setDone(Other);
} else
state = Start;
@@ -840,11 +840,11 @@ int Lexer::lex()
case IgnoreParentheses:
break;
case CountParentheses:
- if (token == JavaScriptGrammar::T_RPAREN) {
+ if (token == QmlJSGrammar::T_RPAREN) {
--parenthesesCount;
if (parenthesesCount == 0)
parenthesesState = BalancedParentheses;
- } else if (token == JavaScriptGrammar::T_LPAREN) {
+ } else if (token == QmlJSGrammar::T_LPAREN) {
++parenthesesCount;
}
break;
@@ -857,7 +857,7 @@ int Lexer::lex()
case Eof:
return 0;
case Other:
- if (token == JavaScriptGrammar::T_RBRACE || token == JavaScriptGrammar::T_SEMICOLON)
+ if (token == QmlJSGrammar::T_RBRACE || token == QmlJSGrammar::T_SEMICOLON)
delimited = true;
return token;
case Identifier:
@@ -867,16 +867,16 @@ int Lexer::lex()
qsyylval.ustr = driver->intern(buffer16, pos16);
else
qsyylval.ustr = 0;
- return JavaScriptGrammar::T_IDENTIFIER;
+ return QmlJSGrammar::T_IDENTIFIER;
}
- if (token == JavaScriptGrammar::T_CONTINUE || token == JavaScriptGrammar::T_BREAK
- || token == JavaScriptGrammar::T_RETURN || token == JavaScriptGrammar::T_THROW) {
+ if (token == QmlJSGrammar::T_CONTINUE || token == QmlJSGrammar::T_BREAK
+ || token == QmlJSGrammar::T_RETURN || token == QmlJSGrammar::T_THROW) {
restrKeyword = true;
- } else if (token == JavaScriptGrammar::T_IF || token == JavaScriptGrammar::T_FOR
- || token == JavaScriptGrammar::T_WHILE || token == JavaScriptGrammar::T_WITH) {
+ } else if (token == QmlJSGrammar::T_IF || token == QmlJSGrammar::T_FOR
+ || token == QmlJSGrammar::T_WHILE || token == QmlJSGrammar::T_WITH) {
parenthesesState = CountParentheses;
parenthesesCount = 0;
- } else if (token == JavaScriptGrammar::T_DO) {
+ } else if (token == QmlJSGrammar::T_DO) {
parenthesesState = BalancedParentheses;
}
return token;
@@ -885,10 +885,10 @@ int Lexer::lex()
qsyylval.ustr = driver->intern(buffer16, pos16);
else
qsyylval.ustr = 0;
- return multiLineString?JavaScriptGrammar::T_MULTILINE_STRING_LITERAL:JavaScriptGrammar::T_STRING_LITERAL;
+ return multiLineString?QmlJSGrammar::T_MULTILINE_STRING_LITERAL:QmlJSGrammar::T_STRING_LITERAL;
case Number:
qsyylval.dval = dval;
- return JavaScriptGrammar::T_NUMERIC_LITERAL;
+ return QmlJSGrammar::T_NUMERIC_LITERAL;
case Bad:
return -1;
default:
@@ -939,103 +939,103 @@ int Lexer::matchPunctuator(ushort c1, ushort c2,
{
if (c1 == '>' && c2 == '>' && c3 == '>' && c4 == '=') {
shift(4);
- return JavaScriptGrammar::T_GT_GT_GT_EQ;
+ return QmlJSGrammar::T_GT_GT_GT_EQ;
} else if (c1 == '=' && c2 == '=' && c3 == '=') {
shift(3);
- return JavaScriptGrammar::T_EQ_EQ_EQ;
+ return QmlJSGrammar::T_EQ_EQ_EQ;
} else if (c1 == '!' && c2 == '=' && c3 == '=') {
shift(3);
- return JavaScriptGrammar::T_NOT_EQ_EQ;
+ return QmlJSGrammar::T_NOT_EQ_EQ;
} else if (c1 == '>' && c2 == '>' && c3 == '>') {
shift(3);
- return JavaScriptGrammar::T_GT_GT_GT;
+ return QmlJSGrammar::T_GT_GT_GT;
} else if (c1 == '<' && c2 == '<' && c3 == '=') {
shift(3);
- return JavaScriptGrammar::T_LT_LT_EQ;
+ return QmlJSGrammar::T_LT_LT_EQ;
} else if (c1 == '>' && c2 == '>' && c3 == '=') {
shift(3);
- return JavaScriptGrammar::T_GT_GT_EQ;
+ return QmlJSGrammar::T_GT_GT_EQ;
} else if (c1 == '<' && c2 == '=') {
shift(2);
- return JavaScriptGrammar::T_LE;
+ return QmlJSGrammar::T_LE;
} else if (c1 == '>' && c2 == '=') {
shift(2);
- return JavaScriptGrammar::T_GE;
+ return QmlJSGrammar::T_GE;
} else if (c1 == '!' && c2 == '=') {
shift(2);
- return JavaScriptGrammar::T_NOT_EQ;
+ return QmlJSGrammar::T_NOT_EQ;
} else if (c1 == '+' && c2 == '+') {
shift(2);
- return JavaScriptGrammar::T_PLUS_PLUS;
+ return QmlJSGrammar::T_PLUS_PLUS;
} else if (c1 == '-' && c2 == '-') {
shift(2);
- return JavaScriptGrammar::T_MINUS_MINUS;
+ return QmlJSGrammar::T_MINUS_MINUS;
} else if (c1 == '=' && c2 == '=') {
shift(2);
- return JavaScriptGrammar::T_EQ_EQ;
+ return QmlJSGrammar::T_EQ_EQ;
} else if (c1 == '+' && c2 == '=') {
shift(2);
- return JavaScriptGrammar::T_PLUS_EQ;
+ return QmlJSGrammar::T_PLUS_EQ;
} else if (c1 == '-' && c2 == '=') {
shift(2);
- return JavaScriptGrammar::T_MINUS_EQ;
+ return QmlJSGrammar::T_MINUS_EQ;
} else if (c1 == '*' && c2 == '=') {
shift(2);
- return JavaScriptGrammar::T_STAR_EQ;
+ return QmlJSGrammar::T_STAR_EQ;
} else if (c1 == '/' && c2 == '=') {
shift(2);
- return JavaScriptGrammar::T_DIVIDE_EQ;
+ return QmlJSGrammar::T_DIVIDE_EQ;
} else if (c1 == '&' && c2 == '=') {
shift(2);
- return JavaScriptGrammar::T_AND_EQ;
+ return QmlJSGrammar::T_AND_EQ;
} else if (c1 == '^' && c2 == '=') {
shift(2);
- return JavaScriptGrammar::T_XOR_EQ;
+ return QmlJSGrammar::T_XOR_EQ;
} else if (c1 == '%' && c2 == '=') {
shift(2);
- return JavaScriptGrammar::T_REMAINDER_EQ;
+ return QmlJSGrammar::T_REMAINDER_EQ;
} else if (c1 == '|' && c2 == '=') {
shift(2);
- return JavaScriptGrammar::T_OR_EQ;
+ return QmlJSGrammar::T_OR_EQ;
} else if (c1 == '<' && c2 == '<') {
shift(2);
- return JavaScriptGrammar::T_LT_LT;
+ return QmlJSGrammar::T_LT_LT;
} else if (c1 == '>' && c2 == '>') {
shift(2);
- return JavaScriptGrammar::T_GT_GT;
+ return QmlJSGrammar::T_GT_GT;
} else if (c1 == '&' && c2 == '&') {
shift(2);
- return JavaScriptGrammar::T_AND_AND;
+ return QmlJSGrammar::T_AND_AND;
} else if (c1 == '|' && c2 == '|') {
shift(2);
- return JavaScriptGrammar::T_OR_OR;
+ return QmlJSGrammar::T_OR_OR;
}
switch(c1) {
- case '=': shift(1); return JavaScriptGrammar::T_EQ;
- case '>': shift(1); return JavaScriptGrammar::T_GT;
- case '<': shift(1); return JavaScriptGrammar::T_LT;
- case ',': shift(1); return JavaScriptGrammar::T_COMMA;
- case '!': shift(1); return JavaScriptGrammar::T_NOT;
- case '~': shift(1); return JavaScriptGrammar::T_TILDE;
- case '?': shift(1); return JavaScriptGrammar::T_QUESTION;
- case ':': shift(1); return JavaScriptGrammar::T_COLON;
- case '.': shift(1); return JavaScriptGrammar::T_DOT;
- case '+': shift(1); return JavaScriptGrammar::T_PLUS;
- case '-': shift(1); return JavaScriptGrammar::T_MINUS;
- case '*': shift(1); return JavaScriptGrammar::T_STAR;
- case '/': shift(1); return JavaScriptGrammar::T_DIVIDE_;
- case '&': shift(1); return JavaScriptGrammar::T_AND;
- case '|': shift(1); return JavaScriptGrammar::T_OR;
- case '^': shift(1); return JavaScriptGrammar::T_XOR;
- case '%': shift(1); return JavaScriptGrammar::T_REMAINDER;
- case '(': shift(1); return JavaScriptGrammar::T_LPAREN;
- case ')': shift(1); return JavaScriptGrammar::T_RPAREN;
- case '{': shift(1); return JavaScriptGrammar::T_LBRACE;
- case '}': shift(1); return JavaScriptGrammar::T_RBRACE;
- case '[': shift(1); return JavaScriptGrammar::T_LBRACKET;
- case ']': shift(1); return JavaScriptGrammar::T_RBRACKET;
- case ';': shift(1); return JavaScriptGrammar::T_SEMICOLON;
+ case '=': shift(1); return QmlJSGrammar::T_EQ;
+ case '>': shift(1); return QmlJSGrammar::T_GT;
+ case '<': shift(1); return QmlJSGrammar::T_LT;
+ case ',': shift(1); return QmlJSGrammar::T_COMMA;
+ case '!': shift(1); return QmlJSGrammar::T_NOT;
+ case '~': shift(1); return QmlJSGrammar::T_TILDE;
+ case '?': shift(1); return QmlJSGrammar::T_QUESTION;
+ case ':': shift(1); return QmlJSGrammar::T_COLON;
+ case '.': shift(1); return QmlJSGrammar::T_DOT;
+ case '+': shift(1); return QmlJSGrammar::T_PLUS;
+ case '-': shift(1); return QmlJSGrammar::T_MINUS;
+ case '*': shift(1); return QmlJSGrammar::T_STAR;
+ case '/': shift(1); return QmlJSGrammar::T_DIVIDE_;
+ case '&': shift(1); return QmlJSGrammar::T_AND;
+ case '|': shift(1); return QmlJSGrammar::T_OR;
+ case '^': shift(1); return QmlJSGrammar::T_XOR;
+ case '%': shift(1); return QmlJSGrammar::T_REMAINDER;
+ case '(': shift(1); return QmlJSGrammar::T_LPAREN;
+ case ')': shift(1); return QmlJSGrammar::T_RPAREN;
+ case '{': shift(1); return QmlJSGrammar::T_LBRACE;
+ case '}': shift(1); return QmlJSGrammar::T_RBRACE;
+ case '[': shift(1); return QmlJSGrammar::T_LBRACKET;
+ case ']': shift(1); return QmlJSGrammar::T_RBRACKET;
+ case ';': shift(1); return QmlJSGrammar::T_SEMICOLON;
default: return -1;
}
diff --git a/src/declarative/qml/parser/javascriptlexer_p.h b/src/declarative/qml/parser/qmljslexer_p.h
index a47c1ae..e1ff23e 100644
--- a/src/declarative/qml/parser/javascriptlexer_p.h
+++ b/src/declarative/qml/parser/qmljslexer_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef JAVASCRIPTLEXER_P_H
-#define JAVASCRIPTLEXER_P_H
+#ifndef QMLJSLEXER_P_H
+#define QMLJSLEXER_P_H
//
// W A R N I N G
@@ -59,7 +59,7 @@
QT_BEGIN_NAMESPACE
-namespace JavaScript {
+namespace QmlJS {
class Engine;
class NameId;
@@ -260,7 +260,7 @@ private:
bool prohibitAutomaticSemicolon;
};
-} // namespace JavaScript
+} // namespace QmlJS
QT_END_NAMESPACE
diff --git a/src/declarative/qml/parser/javascriptmemorypool_p.h b/src/declarative/qml/parser/qmljsmemorypool_p.h
index cff7677..d7506be 100644
--- a/src/declarative/qml/parser/javascriptmemorypool_p.h
+++ b/src/declarative/qml/parser/qmljsmemorypool_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef JAVASCRIPTMEMORYPOOL_P_H
-#define JAVASCRIPTMEMORYPOOL_P_H
+#ifndef QMLJSMEMORYPOOL_P_H
+#define QMLJSMEMORYPOOL_P_H
//
// W A R N I N G
@@ -59,7 +59,7 @@
QT_BEGIN_NAMESPACE
-namespace JavaScript {
+namespace QmlJS {
class MemoryPool : public QSharedData
{
@@ -123,7 +123,7 @@ private:
Q_DISABLE_COPY(MemoryPool)
};
-} // namespace JavaScript
+} // namespace QmlJS
QT_END_NAMESPACE
diff --git a/src/declarative/qml/parser/javascriptnodepool_p.h b/src/declarative/qml/parser/qmljsnodepool_p.h
index cb56fbb..1a5b7f6 100644
--- a/src/declarative/qml/parser/javascriptnodepool_p.h
+++ b/src/declarative/qml/parser/qmljsnodepool_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef JAVASCRIPTNODEPOOL_P_H
-#define JAVASCRIPTNODEPOOL_P_H
+#ifndef QMLJSNODEPOOL_P_H
+#define QMLJSNODEPOOL_P_H
//
// W A R N I N G
@@ -56,11 +56,11 @@
#include <QtCore/QHash>
#include <QtCore/QString>
-#include "javascriptmemorypool_p.h"
+#include "qmljsmemorypool_p.h"
QT_BEGIN_NAMESPACE
-namespace JavaScript {
+namespace QmlJS {
namespace AST {
class Node;
@@ -131,7 +131,7 @@ private:
Q_DISABLE_COPY(NodePool)
};
-} // namespace JavaScript
+} // namespace QmlJS
QT_END_NAMESPACE
diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/qmljsparser.cpp
index bbffc4f..6ecff3d 100644
--- a/src/declarative/qml/parser/javascriptparser.cpp
+++ b/src/declarative/qml/parser/qmljsparser.cpp
@@ -45,22 +45,22 @@
#include <string.h>
-#include "javascriptengine_p.h"
-#include "javascriptlexer_p.h"
-#include "javascriptast_p.h"
-#include "javascriptnodepool_p.h"
+#include "qmljsengine_p.h"
+#include "qmljslexer_p.h"
+#include "qmljsast_p.h"
+#include "qmljsnodepool_p.h"
-#include "javascriptparser_p.h"
+#include "qmljsparser_p.h"
#include <QVarLengthArray>
//
-// This file is automatically generated from javascript.g.
+// This file is automatically generated from qmljs.g.
// Changes will be lost.
//
-using namespace JavaScript;
+using namespace QmlJS;
QT_BEGIN_NAMESPACE
@@ -78,7 +78,7 @@ void Parser::reallocateStack()
inline static bool automatic(Engine *driver, int token)
{
- return token == JavaScriptGrammar::T_RBRACE
+ return token == QmlJSGrammar::T_RBRACE
|| token == 0
|| driver->lexer()->prevTerminator();
}
@@ -389,13 +389,13 @@ case 43:
} break;
case 45: {
- QString s = QLatin1String(JavaScriptGrammar::spell[T_PROPERTY]);
+ QString s = QLatin1String(QmlJSGrammar::spell[T_PROPERTY]);
sym(1).sval = driver->intern(s.constData(), s.length());
break;
}
case 46: {
- QString s = QLatin1String(JavaScriptGrammar::spell[T_SIGNAL]);
+ QString s = QLatin1String(QmlJSGrammar::spell[T_SIGNAL]);
sym(1).sval = driver->intern(s.constData(), s.length());
break;
}
diff --git a/src/declarative/qml/parser/javascriptparser_p.h b/src/declarative/qml/parser/qmljsparser_p.h
index b6a2432..cd2c7f5 100644
--- a/src/declarative/qml/parser/javascriptparser_p.h
+++ b/src/declarative/qml/parser/qmljsparser_p.h
@@ -53,16 +53,16 @@
//
//
-// This file is automatically generated from javascript.g.
+// This file is automatically generated from qmljs.g.
// Changes will be lost.
//
-#ifndef JAVASCRIPTPARSER_P_H
-#define JAVASCRIPTPARSER_P_H
+#ifndef QMLJSPARSER_P_H
+#define QMLJSPARSER_P_H
-#include "javascriptgrammar_p.h"
-#include "javascriptast_p.h"
-#include "javascriptengine_p.h"
+#include "qmljsgrammar_p.h"
+#include "qmljsast_p.h"
+#include "qmljsengine_p.h"
#include <QtCore/QList>
@@ -70,12 +70,12 @@ QT_BEGIN_NAMESPACE
class QString;
-namespace JavaScript {
+namespace QmlJS {
class Engine;
class NameId;
-class Parser: protected JavaScriptGrammar
+class Parser: protected QmlJSGrammar
{
public:
union Value {
@@ -193,7 +193,7 @@ protected:
QList<DiagnosticMessage> diagnostic_messages;
};
-} // end of namespace JavaScript
+} // end of namespace QmlJS
@@ -205,4 +205,4 @@ QT_END_NAMESPACE
-#endif // JAVASCRIPTPARSER_P_H
+#endif // QMLJSPARSER_P_H
diff --git a/src/declarative/qml/parser/javascriptprettypretty.cpp b/src/declarative/qml/parser/qmljsprettypretty.cpp
index 0342b39..1045792 100644
--- a/src/declarative/qml/parser/javascriptprettypretty.cpp
+++ b/src/declarative/qml/parser/qmljsprettypretty.cpp
@@ -39,16 +39,16 @@
**
****************************************************************************/
-#include "javascriptprettypretty_p.h"
+#include "qmljsprettypretty_p.h"
-#include "javascriptengine_p.h"
+#include "qmljsengine_p.h"
-#include "javascriptast_p.h"
+#include "qmljsast_p.h"
#include <QtCore/QString>
#include <QtCore/QTextStream>
@@ -56,11 +56,11 @@
QT_BEGIN_NAMESPACE
-namespace JavaScript {
+namespace QmlJS {
QString numberToString(double value);
}
-using namespace JavaScript;
+using namespace QmlJS;
PrettyPretty::PrettyPretty(QTextStream &o):
out(o), m_indentLevel(0)
@@ -242,7 +242,7 @@ void PrettyPretty::endVisit(AST::StringLiteral *node)
bool PrettyPretty::visit(AST::NumericLiteral *node)
{
- out << JavaScript::numberToString(node->value);
+ out << QmlJS::numberToString(node->value);
return true;
}
@@ -255,7 +255,7 @@ bool PrettyPretty::visit(AST::RegExpLiteral *node)
{
out << "/" << Engine::toString(node->pattern) << "/";
if (node->flags)
- out << JavaScript::Ecma::RegExp::flagsToString(node->flags);
+ out << QmlJS::Ecma::RegExp::flagsToString(node->flags);
return true;
}
diff --git a/src/declarative/qml/parser/javascriptprettypretty_p.h b/src/declarative/qml/parser/qmljsprettypretty_p.h
index c692da5..fe82ca2 100644
--- a/src/declarative/qml/parser/javascriptprettypretty_p.h
+++ b/src/declarative/qml/parser/qmljsprettypretty_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef JAVASCRIPTPRETTYPRETTY_P_H
-#define JAVASCRIPTPRETTYPRETTY_P_H
+#ifndef QMLJSPRETTYPRETTY_P_H
+#define QMLJSPRETTYPRETTY_P_H
//
// W A R N I N G
@@ -55,13 +55,13 @@
#include <QtCore/qglobal.h>
-#include "javascriptastvisitor_p.h"
+#include "qmljsastvisitor_p.h"
QT_BEGIN_NAMESPACE
class QTextStream;
-namespace JavaScript {
+namespace QmlJS {
class PrettyPretty: protected AST::Visitor
{
@@ -322,7 +322,7 @@ private:
Q_DISABLE_COPY(PrettyPretty)
};
-} // namespace JavaScript
+} // namespace QmlJS
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h
index 370bb58..51ca612 100644
--- a/src/declarative/qml/qml.h
+++ b/src/declarative/qml/qml.h
@@ -90,6 +90,7 @@ QT_MODULE(Declarative)
class QmlContext;
class QmlEngine;
+Q_DECLARATIVE_EXPORT void qmlExecuteDeferred(QObject *);
Q_DECLARATIVE_EXPORT QmlContext *qmlContext(const QObject *);
Q_DECLARATIVE_EXPORT QmlEngine *qmlEngine(const QObject *);
Q_DECLARATIVE_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *);
diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp
index d8e65bf..a679532 100644
--- a/src/declarative/qml/qmlbasicscript.cpp
+++ b/src/declarative/qml/qmlbasicscript.cpp
@@ -17,12 +17,12 @@
#include <QStack>
#include <qfxperf.h>
#include <private/qmlrefcount_p.h>
-#include <private/javascriptast_p.h>
-#include <private/javascriptengine_p.h>
+#include <private/qmljsast_p.h>
+#include <private/qmljsengine_p.h>
QT_BEGIN_NAMESPACE
-using namespace JavaScript;
+using namespace QmlJS;
struct ScriptInstruction {
enum {
@@ -270,16 +270,16 @@ struct QmlBasicScriptCompiler
QmlParser::Object *component;
QHash<QString, QPair<QmlParser::Object *, int> > ids;
- bool compile(JavaScript::AST::Node *);
+ bool compile(QmlJS::AST::Node *);
- bool compileExpression(JavaScript::AST::Node *);
+ bool compileExpression(QmlJS::AST::Node *);
- bool tryConstant(JavaScript::AST::Node *);
- bool parseConstant(JavaScript::AST::Node *);
- bool tryName(JavaScript::AST::Node *);
- bool parseName(JavaScript::AST::Node *, QmlParser::Object ** = 0);
- bool tryBinaryExpression(JavaScript::AST::Node *);
- bool compileBinaryExpression(JavaScript::AST::Node *);
+ bool tryConstant(QmlJS::AST::Node *);
+ bool parseConstant(QmlJS::AST::Node *);
+ bool tryName(QmlJS::AST::Node *);
+ bool parseName(QmlJS::AST::Node *, QmlParser::Object ** = 0);
+ bool tryBinaryExpression(QmlJS::AST::Node *);
+ bool compileBinaryExpression(QmlJS::AST::Node *);
QByteArray data;
QList<ScriptInstruction> bytecode;
@@ -288,10 +288,10 @@ struct QmlBasicScriptCompiler
/*!
\internal
\class QmlBasicScript
- \brief The QmlBasicScript class provides a fast implementation of a limited subset of JavaScript bindings.
+ \brief The QmlBasicScript class provides a fast implementation of a limited subset of QmlJS bindings.
QmlBasicScript instances are used to accelerate binding. Instead of using
- the slower, fully fledged JavaScript engine, many simple bindings can be
+ the slower, fully fledged QmlJS engine, many simple bindings can be
evaluated using the QmlBasicScript engine.
To see if the QmlBasicScript engine can handle a binding, call compile()
@@ -495,12 +495,12 @@ bool QmlBasicScript::compile(const Expression &expression)
return d != 0;
}
-bool QmlBasicScriptCompiler::compile(JavaScript::AST::Node *node)
+bool QmlBasicScriptCompiler::compile(QmlJS::AST::Node *node)
{
return compileExpression(node);
}
-bool QmlBasicScriptCompiler::tryConstant(JavaScript::AST::Node *node)
+bool QmlBasicScriptCompiler::tryConstant(QmlJS::AST::Node *node)
{
if (node->kind == AST::Node::Kind_TrueLiteral ||
node->kind == AST::Node::Kind_FalseLiteral)
@@ -516,7 +516,7 @@ bool QmlBasicScriptCompiler::tryConstant(JavaScript::AST::Node *node)
return false;
}
-bool QmlBasicScriptCompiler::parseConstant(JavaScript::AST::Node *node)
+bool QmlBasicScriptCompiler::parseConstant(QmlJS::AST::Node *node)
{
ScriptInstruction instr;
@@ -534,7 +534,7 @@ bool QmlBasicScriptCompiler::parseConstant(JavaScript::AST::Node *node)
return true;
}
-bool QmlBasicScriptCompiler::tryName(JavaScript::AST::Node *node)
+bool QmlBasicScriptCompiler::tryName(QmlJS::AST::Node *node)
{
return node->kind == AST::Node::Kind_IdentifierExpression ||
node->kind == AST::Node::Kind_FieldMemberExpression;
@@ -629,7 +629,7 @@ bool QmlBasicScriptCompiler::parseName(AST::Node *node,
return true;
}
-bool QmlBasicScriptCompiler::compileExpression(JavaScript::AST::Node *node)
+bool QmlBasicScriptCompiler::compileExpression(QmlJS::AST::Node *node)
{
if (tryBinaryExpression(node))
return compileBinaryExpression(node);
@@ -828,7 +828,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
if (instr.type == ScriptInstruction::Load) {
- if (n.type == QmlBasicScriptNodeCache::Invalid) {
+ if (n.type == QmlBasicScriptNodeCache::Invalid || state == Reset) {
context->engine()->d_func()->loadCache(n, QLatin1String(id), static_cast<QmlContextPrivate*>(context->d_ptr));
state = Incremental;
}
@@ -852,7 +852,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
CacheState dummy;
return run(context, voidCache, &dummy);
}
- } else if (n.type == QmlBasicScriptNodeCache::Invalid) {
+ } else if (n.type == QmlBasicScriptNodeCache::Invalid || state == Reset) {
context->engine()->d_func()->fetchCache(n, QLatin1String(id), obj);
guard(n);
state = Incremental;
diff --git a/src/declarative/qml/qmlbindablevalue.cpp b/src/declarative/qml/qmlbindablevalue.cpp
index e1b6961..d1835cf 100644
--- a/src/declarative/qml/qmlbindablevalue.cpp
+++ b/src/declarative/qml/qmlbindablevalue.cpp
@@ -134,9 +134,16 @@ void QmlBindableValue::update()
} else {
QVariant value = this->value();
+ if ((uint)d->property.propertyType() >= QVariant::UserType &&
+ value.type() == QVariant::String) {
+ QmlMetaType::StringConverter con = QmlMetaType::customStringConverter(d->property.propertyType());
+ if (con)
+ value = con(value.toString());
+ }
+
if (d->property.propertyType() == QVariant::Url &&
value.canConvert(QVariant::String) && !value.isNull())
- value.setValue(context()->resolvedUrl(value.toString()));
+ value.setValue(context()->resolvedUrl(QUrl(value.toString())));
d->property.write(value);
}
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index d29ac1f..8297ac4 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -62,7 +62,7 @@
#include "private/qmlcustomparser_p_p.h"
#include <private/qmlcontext_p.h>
#include <private/qmlcomponent_p.h>
-#include "parser/javascriptast_p.h"
+#include "parser/qmljsast_p.h"
#include "qmlscriptparser_p.h"
@@ -281,7 +281,7 @@ bool QmlCompiler::compileStoreInstruction(QmlInstruction &instr,
case QVariant::Url:
{
instr.type = QmlInstruction::StoreUrl;
- QUrl u = output->url.resolved(string);
+ QUrl u = output->url.resolved(QUrl(string));
instr.storeUrl.propertyIndex = prop.propertyIndex();
instr.storeUrl.value = output->indexForString(u.toString());
}
@@ -621,13 +621,19 @@ bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt)
output->types.at(obj->type).type->customParser() != 0;
QList<QmlCustomParserProperty> customProps;
+ QStringList deferred = deferredProperties(obj);
+ QList<Property *> deferredProps;
+
// Compile all explicit properties specified
foreach(Property *prop, obj->properties) {
if (isCustomParser) {
// Custom parser types don't support signal properties
if (testProperty(prop, obj)) {
- COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
+ if (deferred.contains(prop->name))
+ deferredProps << prop;
+ else
+ COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
} else {
customProps << QmlCustomParserNodePrivate::fromProperty(prop);
}
@@ -635,7 +641,10 @@ bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt)
if (isSignalPropertyName(prop->name)) {
COMPILE_CHECK(compileSignal(prop,obj));
} else {
- COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
+ if (deferred.contains(prop->name))
+ deferredProps << prop;
+ else
+ COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
}
}
@@ -647,12 +656,20 @@ bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt)
if (isCustomParser) {
if (testProperty(prop, obj)) {
- COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
+ QMetaProperty p = deferred.isEmpty()?QMetaProperty():QmlMetaType::defaultProperty(obj->metaObject());
+ if (deferred.contains(p.name()))
+ deferredProps << prop;
+ else
+ COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
} else {
customProps << QmlCustomParserNodePrivate::fromProperty(prop);
}
} else {
- COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
+ QMetaProperty p = deferred.isEmpty()?QMetaProperty():QmlMetaType::defaultProperty(obj->metaObject());
+ if (deferred.contains(p.name()))
+ deferredProps << prop;
+ else
+ COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
}
}
@@ -670,6 +687,26 @@ bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt)
output->indexForByteArray(customData);
}
+ // Build the deferred block
+ if (!deferredProps.isEmpty()) {
+ QmlInstruction defer;
+ defer.type = QmlInstruction::Defer;
+ defer.line = 0;
+ defer.defer.deferCount = 0;
+ int deferIdx = output->bytecode.count();
+ output->bytecode << defer;
+
+ // ### This is lame, we should check if individual properties have
+ // ids defined within them
+ int idCount = compileState.ids.count();
+ foreach (Property *prop, deferredProps) {
+ COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
+ }
+ if (idCount == compileState.ids.count())
+ output->bytecode[deferIdx].defer.deferCount =
+ output->bytecode.count() - deferIdx - 1;
+ }
+
// If the type support the QmlParserStatusInterface we need to invoke
// classComplete()
if (parserStatusCast != -1) {
@@ -1484,7 +1521,7 @@ bool QmlCompiler::compileBinding(QmlParser::Value *value,
////////////////////////////////////////////////////////////////////////////////
// AST Dump
////////////////////////////////////////////////////////////////////////////////
-class Dump: protected JavaScript::AST::Visitor
+class Dump: protected QmlJS::AST::Visitor
{
std::ostream &out;
int depth;
@@ -1494,11 +1531,11 @@ public:
: out(out), depth(-1)
{ }
- void operator()(JavaScript::AST::Node *node)
- { JavaScript::AST::Node::acceptChild(node, this); }
+ void operator()(QmlJS::AST::Node *node)
+ { QmlJS::AST::Node::acceptChild(node, this); }
protected:
- virtual bool preVisit(JavaScript::AST::Node *node)
+ virtual bool preVisit(QmlJS::AST::Node *node)
{
const char *name = typeid(*node).name();
#ifdef Q_CC_GNU
@@ -1508,7 +1545,7 @@ protected:
return true;
}
- virtual void postVisit(JavaScript::AST::Node *)
+ virtual void postVisit(QmlJS::AST::Node *)
{
--depth;
}
@@ -1634,6 +1671,19 @@ bool QmlCompiler::canConvert(int convertType, QmlParser::Object *object)
return false;
}
+QStringList QmlCompiler::deferredProperties(QmlParser::Object *obj)
+{
+ const QMetaObject *mo = obj->metatype;
+
+ int idx = mo->indexOfClassInfo("DeferredPropertyNames");
+ if (idx == -1)
+ return QStringList();
+
+ QMetaClassInfo classInfo = mo->classInfo(idx);
+ QStringList rv = QString(QLatin1String(classInfo.value())).split(',');
+ return rv;
+}
+
QmlCompiledData::QmlCompiledData()
{
}
diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h
index 3b1a496..2559b14 100644
--- a/src/declarative/qml/qmlcompiler_p.h
+++ b/src/declarative/qml/qmlcompiler_p.h
@@ -180,6 +180,7 @@ private:
void finalizeBinding(const BindingReference &);
bool canConvert(int, QmlParser::Object *);
+ QStringList deferredProperties(QmlParser::Object *);
struct IdReference {
QString id;
diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp
index a5e302c..9950b48 100644
--- a/src/declarative/qml/qmlcompositetypemanager.cpp
+++ b/src/declarative/qml/qmlcompositetypemanager.cpp
@@ -109,7 +109,7 @@ QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine)
status = Error;
errors = compiler.errors();
for(int ii = 0; ii < errors.count(); ++ii)
- errors[ii].setUrl(url);
+ errors[ii].setUrl(compiledComponent->url);
compiledComponent->release();
compiledComponent = 0;
}
@@ -336,7 +336,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
unit->status = QmlCompositeTypeData::Error;
{
QmlError error;
- error.setUrl(unit->url);
+ error.setUrl(QUrl(unit->url));
error.setDescription(tr("Type %1 unavailable").arg(QLatin1String(type)));
unit->errors << error;
}
diff --git a/src/declarative/qml/qmldeclarativedata_p.h b/src/declarative/qml/qmldeclarativedata_p.h
index fb7a015..85a80fa 100644
--- a/src/declarative/qml/qmldeclarativedata_p.h
+++ b/src/declarative/qml/qmldeclarativedata_p.h
@@ -52,20 +52,108 @@ public:
QmlSimpleDeclarativeData() : flags(0), context(0) {}
virtual void destroyed(QObject *);
- enum Flag { Extended = 0x00000001 };
+ enum Flag { Instance = 0x00000001, Extended = 0x00000002 };
quint32 flags;
QmlContext *context;
+
+ static inline QmlSimpleDeclarativeData *get(QObject *object,
+ bool create = false);
};
-class QmlExtendedDeclarativeData : public QmlSimpleDeclarativeData
+class QmlCompiledComponent;
+class QmlInstanceDeclarativeData : public QmlSimpleDeclarativeData
{
public:
- QmlExtendedDeclarativeData() { flags = Extended; }
+ QmlInstanceDeclarativeData() : deferredComponent(0) { flags |= Instance; }
virtual void destroyed(QObject *);
+
+ QmlCompiledComponent *deferredComponent;
+ unsigned int deferredIdx;
+
+ static inline QmlInstanceDeclarativeData *get(QObject *object,
+ bool create = false);
+};
+
+class QmlExtendedDeclarativeData : public QmlInstanceDeclarativeData
+{
+public:
+ QmlExtendedDeclarativeData() { flags |= Extended; }
+
QHash<int, QObject *> attachedProperties;
+
+ static inline QmlExtendedDeclarativeData *get(QObject *object,
+ bool create = false);
};
+QmlSimpleDeclarativeData *
+QmlSimpleDeclarativeData::get(QObject *object, bool create)
+{
+ QObjectPrivate *priv = QObjectPrivate::get(object);
+
+ if (create && !priv->declarativeData)
+ priv->declarativeData = new QmlInstanceDeclarativeData;
+
+ return static_cast<QmlSimpleDeclarativeData *>(priv->declarativeData);
+}
+
+QmlInstanceDeclarativeData *
+QmlInstanceDeclarativeData::get(QObject *object, bool create)
+{
+ QObjectPrivate *priv = QObjectPrivate::get(object);
+
+ QmlSimpleDeclarativeData *simple =
+ static_cast<QmlSimpleDeclarativeData *>(priv->declarativeData);
+
+ if (simple && (simple->flags & Instance)) {
+ return static_cast<QmlInstanceDeclarativeData *>(simple);
+ } else if (create && simple) {
+ QmlInstanceDeclarativeData *rv = new QmlInstanceDeclarativeData;
+ rv->context = simple->context;
+ simple->destroyed(object);
+ priv->declarativeData = rv;
+ return rv;
+ } else if (create) {
+ QmlInstanceDeclarativeData *rv = new QmlInstanceDeclarativeData;
+ priv->declarativeData = rv;
+ return rv;
+ }
+ return 0;
+}
+
+QmlExtendedDeclarativeData *
+QmlExtendedDeclarativeData::get(QObject *object, bool create)
+{
+ QObjectPrivate *priv = QObjectPrivate::get(object);
+
+ QmlSimpleDeclarativeData *simple =
+ static_cast<QmlSimpleDeclarativeData *>(priv->declarativeData);
+
+ if (simple && (simple->flags & Extended)) {
+ return static_cast<QmlExtendedDeclarativeData *>(simple);
+ } else if (create && simple) {
+ QmlExtendedDeclarativeData *rv = new QmlExtendedDeclarativeData;
+ rv->context = simple->context;
+
+ if (simple->flags & Instance) {
+ QmlInstanceDeclarativeData *instance =
+ static_cast<QmlInstanceDeclarativeData *>(priv->declarativeData);
+ rv->deferredComponent = instance->deferredComponent;
+ rv->deferredIdx = instance->deferredIdx;
+ delete simple;
+ } else {
+ simple->destroyed(object);
+ }
+ priv->declarativeData = rv;
+ return rv;
+ } else if (create) {
+ QmlExtendedDeclarativeData *rv = new QmlExtendedDeclarativeData;
+ priv->declarativeData = rv;
+ return rv;
+ }
+ return 0;
+}
+
QT_END_NAMESPACE
#endif // QMLDECLARATIVEDATA_P_H
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 66781ce..36b6424 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -71,7 +71,7 @@
#include <qmlcomponent.h>
#include "private/qmlmetaproperty_p.h"
#include <private/qmlbindablevalue_p.h>
-
+#include <private/qmlvme_p.h>
QT_BEGIN_NAMESPACE
@@ -706,6 +706,19 @@ void QmlEngine::setContextForObject(QObject *object, QmlContext *context)
context->d_func()->contextObjects.append(object);
}
+void qmlExecuteDeferred(QObject *object)
+{
+ QmlInstanceDeclarativeData *data = QmlInstanceDeclarativeData::get(object);
+
+ if (data && data->deferredComponent) {
+ QmlVME vme;
+ vme.runDeferred(object);
+
+ data->deferredComponent->release();
+ data->deferredComponent = 0;
+ }
+}
+
QmlContext *qmlContext(const QObject *obj)
{
return QmlEngine::contextForObject(obj);
@@ -719,36 +732,21 @@ QmlEngine *qmlEngine(const QObject *obj)
QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object)
{
- QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
-
-
- QmlSimpleDeclarativeData *data = static_cast<QmlSimpleDeclarativeData *>(priv->declarativeData);
+ QmlExtendedDeclarativeData *edata =
+ QmlExtendedDeclarativeData::get(const_cast<QObject *>(object), true);
- QmlExtendedDeclarativeData *edata = (data && data->flags & QmlSimpleDeclarativeData::Extended)?static_cast<QmlExtendedDeclarativeData *>(data):0;
-
- if (edata) {
- QObject *rv = edata->attachedProperties.value(id);
- if (rv)
- return rv;
- }
+ QObject *rv = edata->attachedProperties.value(id);
+ if (rv)
+ return rv;
QmlAttachedPropertiesFunc pf = QmlMetaType::attachedPropertiesFuncById(id);
if (!pf)
return 0;
- QObject *rv = pf(const_cast<QObject *>(object));
-
- if (rv) {
- if (!edata) {
-
- edata = new QmlExtendedDeclarativeData;
- if (data) edata->context = data->context;
- priv->declarativeData = edata;
-
- }
+ rv = pf(const_cast<QObject *>(object));
+ if (rv)
edata->attachedProperties.insert(id, rv);
- }
return rv;
}
@@ -759,9 +757,11 @@ void QmlSimpleDeclarativeData::destroyed(QObject *object)
context->d_func()->contextObjects.removeAll(object);
}
-void QmlExtendedDeclarativeData::destroyed(QObject *object)
+void QmlInstanceDeclarativeData::destroyed(QObject *object)
{
QmlSimpleDeclarativeData::destroyed(object);
+ if (deferredComponent)
+ deferredComponent->release();
delete this;
}
@@ -808,7 +808,7 @@ QmlEngine *QmlEngine::activeEngine()
dynamically creates and returns objects when called from QtScript,
and these objects are visual items in the QML tree.
- \sa QmlEngine::newQObject()
+ \sa QScriptEngine::newQObject()
*/
QScriptValue QmlEngine::qmlScriptObject(QObject* object, QmlEngine* engine)
{
@@ -823,7 +823,7 @@ QScriptValue QmlEngine::qmlScriptObject(QObject* object, QmlEngine* engine)
This function takes the URL of a QML file as its only argument. It returns
a component object which can be used to create and load that QML file.
- Example JavaScript is below, remember that QML files that might be loaded
+ Example QmlJS is below, remember that QML files that might be loaded
over the network cannot be expected to be ready immediately.
\code
var component;
@@ -865,6 +865,7 @@ QScriptValue QmlEngine::qmlScriptObject(QObject* object, QmlEngine* engine)
}
\endcode
+ \sa QmlComponent::createObject()
*/
QScriptValue QmlEngine::createComponent(QScriptContext *ctxt, QScriptEngine *engine)
{
@@ -1128,7 +1129,7 @@ QVariant QmlExpression::value()
for (int i = context()->d_func()->scopeChain.size() - 1; i > -1; --i) {
scriptEngine->currentContext()->pushScope(context()->d_func()->scopeChain.at(i));
}
- QScriptValue svalue = scriptEngine->evaluate(expression(), d->fileName, d->line);
+ QScriptValue svalue = scriptEngine->evaluate(expression(), d->fileName.toString(), d->line);
if (scriptEngine->hasUncaughtException()) {
if (scriptEngine->uncaughtException().isError()){
QScriptValue exception = scriptEngine->uncaughtException();
diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h
index 0f1f697..e3b0dfe 100644
--- a/src/declarative/qml/qmlinstruction_p.h
+++ b/src/declarative/qml/qmlinstruction_p.h
@@ -139,6 +139,11 @@ public:
PopFetchedObject,
PopQList,
+ //
+ // Deferred creation
+ //
+ Defer, /* defer */
+
//
// Expression optimizations
//
@@ -270,6 +275,9 @@ public:
int property;
int object;
} assignStackObject;
+ struct {
+ int deferCount;
+ } defer;
};
void dump(QmlCompiledComponent *);
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index a152807..52036c2 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -814,6 +814,16 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
default:
+ {
+ if ((uint)t >= QVariant::UserType && vt == QVariant::String) {
+ QmlMetaType::StringConverter con = QmlMetaType::customStringConverter(t);
+ if (con) {
+ QVariant v = con(value.toString());
+ prop.write(object, v);
+ return;
+ }
+ }
+ }
break;
}
prop.write(object, value);
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index 3e25ae0..8ce8571 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -214,9 +214,12 @@ void QmlTypePrivate::init() const
mo = mo->d.superdata;
}
- for (int ii = 0; ii < m_metaObjects.count(); ++ii)
+ for (int ii = 0; ii < m_metaObjects.count(); ++ii) {
m_metaObjects[ii].propertyOffset =
m_metaObjects.at(ii).metaObject->propertyOffset();
+ m_metaObjects[ii].methodOffset =
+ m_metaObjects.at(ii).metaObject->methodOffset();
+ }
// Calculate hash
QByteArray hashData;
diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp
index fadfbb1..5ad4a6e 100644
--- a/src/declarative/qml/qmlparser.cpp
+++ b/src/declarative/qml/qmlparser.cpp
@@ -290,7 +290,7 @@ QmlParser::Variant::Variant(const QString &v)
{
}
-QmlParser::Variant::Variant(const QString &v, JavaScript::AST::Node *n)
+QmlParser::Variant::Variant(const QString &v, QmlJS::AST::Node *n)
: t(Script), n(n), s(v)
{
}
@@ -342,7 +342,7 @@ QString QmlParser::Variant::asScript() const
}
}
-JavaScript::AST::Node *QmlParser::Variant::asAST() const
+QmlJS::AST::Node *QmlParser::Variant::asAST() const
{
if (type() == Script)
return n;
diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h
index 1481391..a38ce69 100644
--- a/src/declarative/qml/qmlparser_p.h
+++ b/src/declarative/qml/qmlparser_p.h
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-namespace JavaScript { namespace AST { class Node; } }
+namespace QmlJS { namespace AST { class Node; } }
/*
XXX
@@ -178,7 +178,7 @@ namespace QmlParser
Variant(bool);
Variant(double, const QString &asWritten=QString());
Variant(const QString &);
- Variant(const QString &, JavaScript::AST::Node *);
+ Variant(const QString &, QmlJS::AST::Node *);
Variant &operator=(const Variant &);
Type type() const;
@@ -192,14 +192,14 @@ namespace QmlParser
QString asString() const;
double asNumber() const;
QString asScript() const;
- JavaScript::AST::Node *asAST() const;
+ QmlJS::AST::Node *asAST() const;
private:
Type t;
union {
bool b;
double d;
- JavaScript::AST::Node *n;
+ QmlJS::AST::Node *n;
};
QString s;
};
diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h
index 25e60e0..ed1304a 100644
--- a/src/declarative/qml/qmlprivate.h
+++ b/src/declarative/qml/qmlprivate.h
@@ -123,13 +123,57 @@ namespace QmlPrivate
}
};
- template<typename T, typename Sign = T *(*)(QObject *)>
- struct has_qmlAttachedProperties
+#if defined(Q_CC_MSVC)
+ template <typename T>
+ class has_attachedPropertiesMember
{
- template <typename U, U> struct type_check;
- template <typename _1> static char check(type_check<Sign, &_1::qmlAttachedProperties> *);
- template <typename > static int check(...);
- static bool const value = sizeof(check<T>(0)) == sizeof(char);
+ public:
+ __if_exists(T::qmlAttachedProperties) {
+ static bool const value = true;
+ }
+ __if_not_exists(T::qmlAttachedProperties) {
+ static bool const value = false;
+ }
+ };
+#else
+ template <typename T>
+ class has_attachedPropertiesMember
+ {
+ typedef int yes_type;
+ typedef char no_type;
+ template <int>
+ struct Selector {};
+
+ template <typename S>
+ static yes_type test(Selector<sizeof(&S::qmlAttachedProperties)>*);
+
+ template <typename S>
+ static no_type test(...);
+
+ public:
+ static bool const value = sizeof(test<T>(0)) == sizeof(yes_type);
+ };
+#endif
+
+ template <typename T, bool hasMember>
+ class has_attachedPropertiesMethod
+ {
+ typedef int yes_type;
+ typedef char no_type;
+
+ template<typename ReturnType>
+ static yes_type check(ReturnType *(*)(QObject *));
+ static no_type check(...);
+
+ public:
+ static bool const value = sizeof(check(&T::qmlAttachedProperties)) == sizeof(yes_type);
+ };
+
+ template <typename T>
+ class has_attachedPropertiesMethod<T, false>
+ {
+ public:
+ static bool const value = false;
};
template<typename T, int N>
@@ -161,13 +205,13 @@ namespace QmlPrivate
template<typename T>
inline QmlAttachedPropertiesFunc attachedPropertiesFunc()
{
- return AttachedPropertySelector<T, has_qmlAttachedProperties<T>::value >::func();
+ return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::func();
}
template<typename T>
inline const QMetaObject *attachedPropertiesMetaObject()
{
- return AttachedPropertySelector<T, has_qmlAttachedProperties<T>::value >::metaObject();
+ return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::metaObject();
}
struct MetaTypeIds {
diff --git a/src/declarative/qml/qmlproxymetaobject.cpp b/src/declarative/qml/qmlproxymetaobject.cpp
index 686c6d7..06d8a50 100644
--- a/src/declarative/qml/qmlproxymetaobject.cpp
+++ b/src/declarative/qml/qmlproxymetaobject.cpp
@@ -78,6 +78,7 @@ QmlProxyMetaObject::~QmlProxyMetaObject()
proxies = 0;
}
+#include <QDebug>
int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
if ((c == QMetaObject::ReadProperty ||
@@ -93,8 +94,24 @@ int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
sizeof(QObject *) * metaObjects->count());
}
- if (!proxies[ii])
- proxies[ii] = data.createFunc(object);
+ if (!proxies[ii]) {
+ QObject *proxy = data.createFunc(object);
+ const QMetaObject *metaObject = proxy->metaObject();
+ proxies[ii] = proxy;
+
+ int localOffset = data.metaObject->methodOffset();
+ int methodOffset = metaObject->methodOffset();
+ int methods = metaObject->methodCount() - methodOffset;
+
+ // ### - Can this be done more optimally?
+ for (int jj = 0; jj < methods; ++jj) {
+ QMetaMethod method =
+ metaObject->method(jj + methodOffset);
+ if (method.methodType() == QMetaMethod::Signal)
+ QMetaObject::connect(proxy, methodOffset + jj,
+ object, localOffset + jj);
+ }
+ }
int proxyOffset = proxies[ii]->metaObject()->propertyOffset();
int proxyId = id - data.propertyOffset + proxyOffset;
@@ -102,6 +119,13 @@ int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
return proxies[ii]->qt_metacall(c, proxyId, a);
}
}
+ } else if (c == QMetaObject::InvokeMetaMethod &&
+ id >= metaObjects->last().methodOffset) {
+ QMetaMethod m = object->metaObject()->method(id);
+ if (m.methodType() == QMetaMethod::Signal) {
+ QMetaObject::activate(object, id, a);
+ return -1;
+ }
}
if (parent)
diff --git a/src/declarative/qml/qmlproxymetaobject_p.h b/src/declarative/qml/qmlproxymetaobject_p.h
index 0ffa365..c0ce36e 100644
--- a/src/declarative/qml/qmlproxymetaobject_p.h
+++ b/src/declarative/qml/qmlproxymetaobject_p.h
@@ -61,6 +61,7 @@ public:
QMetaObject *metaObject;
CreateFunc createFunc;
int propertyOffset;
+ int methodOffset;
};
QmlProxyMetaObject(QObject *, QList<ProxyData> *);
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index ee2981e..fb7492d 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -42,12 +42,12 @@
#include "qmlscriptparser_p.h"
#include "qmlparser_p.h"
-#include "parser/javascriptengine_p.h"
-#include "parser/javascriptparser_p.h"
-#include "parser/javascriptlexer_p.h"
-#include "parser/javascriptnodepool_p.h"
-#include "parser/javascriptastvisitor_p.h"
-#include "parser/javascriptast_p.h"
+#include "parser/qmljsengine_p.h"
+#include "parser/qmljsparser_p.h"
+#include "parser/qmljslexer_p.h"
+#include "parser/qmljsnodepool_p.h"
+#include "parser/qmljsastvisitor_p.h"
+#include "parser/qmljsast_p.h"
#include "rewriter/textwriter_p.h"
@@ -59,7 +59,7 @@
QT_BEGIN_NAMESPACE
-using namespace JavaScript;
+using namespace QmlJS;
using namespace QmlParser;
namespace {
@@ -628,6 +628,8 @@ bool ProcessAST::visit(AST::UiScriptBinding *node)
node->statement);
}
+ prop->location.range.length = prop->location.range.offset + prop->location.range.length - node->qualifiedId->identifierToken.offset;
+ prop->location.range.offset = node->qualifiedId->identifierToken.offset;
Value *v = new Value;
v->value = primitive;
v->location = location(node->statement->firstSourceLocation(),
@@ -715,7 +717,7 @@ bool ProcessAST::visit(AST::UiSourceElement *node)
obj->dynamicSlots << slot;
} else {
QmlError error;
- error.setDescription(QCoreApplication::translate("QmlParser","JavaScript declaration outside Script element"));
+ error.setDescription(QCoreApplication::translate("QmlParser","QmlJS declaration outside Script element"));
error.setLine(node->firstSourceLocation().startLine);
error.setColumn(node->firstSourceLocation().startColumn);
_parser->_errors << error;
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index 3a66c69..a3ee4e5 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -44,6 +44,7 @@
#include <private/qmlboundsignal_p.h>
#include <private/qmlstringconverters_p.h>
#include "private/qmetaobjectbuilder_p.h"
+#include "private/qmldeclarativedata_p.h"
#include <qml.h>
#include <private/qmlcustomparser_p.h>
#include <qperformancelog.h>
@@ -88,16 +89,11 @@ QmlVME::QmlVME()
struct ListInstance
{
ListInstance() {}
- /*
- ListInstance(const QVariant &l, int t)
- : list(l), type(t), qmlListInterface(0) {}
- */
ListInstance(QList<void *> *q, int t)
- : type(t), qListInterface(q) {}
+ : type(t), qListInterface(q), qmlListInterface(0) {}
ListInstance(QmlPrivate::ListInterface *q, int t)
- : type(t), qmlListInterface(q) {}
+ : type(t), qListInterface(0), qmlListInterface(q) {}
- //QVariant list;
int type;
QList<void *> *qListInterface;
QmlPrivate::ListInterface *qmlListInterface;
@@ -105,6 +101,35 @@ struct ListInstance
QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, int count)
{
+ QStack<QObject *> stack;
+
+ if (start == -1) start = 0;
+ if (count == -1) count = comp->bytecode.count();
+
+ return run(stack, ctxt, comp, start, count);
+}
+
+void QmlVME::runDeferred(QObject *object)
+{
+ QmlInstanceDeclarativeData *data = QmlInstanceDeclarativeData::get(object);
+
+ if (!data || !data->context || !data->deferredComponent)
+ return;
+
+ QmlContext *ctxt = data->context;
+ ctxt->activate();
+ QmlCompiledComponent *comp = data->deferredComponent;
+ int start = data->deferredIdx + 1;
+ int count = data->deferredComponent->bytecode.at(data->deferredIdx).defer.deferCount;
+ QStack<QObject *> stack;
+ stack.push(object);
+
+ run(stack, ctxt, comp, start, count);
+ ctxt->deactivate();
+}
+
+QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledComponent *comp, int start, int count)
+{
// XXX - All instances of QmlContext::activeContext() here should be
// replaced with the use of ctxt. However, this cannot be done until
// behaviours stop modifying the active context and expecting the
@@ -125,7 +150,6 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlEnginePrivate::SimpleList<QmlBindableValue> bindValues;
QmlEnginePrivate::SimpleList<QmlParserStatus> parserStatus;
- QStack<QObject *> stack;
QStack<ListInstance> qliststack;
QStack<QmlMetaProperty> pushedProperties;
@@ -133,9 +157,6 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
vmeErrors.clear();
- if (start == -1) start = 0;
- if (count == -1) count = comp->bytecode.count();
-
for (int ii = start; !isError() && ii < (start + count); ++ii) {
QmlInstruction &instr = comp->bytecode[ii];
@@ -172,7 +193,17 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
if (!stack.isEmpty()) {
QObject *parent = stack.top();
- o->setParent(parent);
+ if (o->isWidgetType()) {
+ QWidget *widget = static_cast<QWidget*>(o);
+ if (parent->isWidgetType()) {
+ QWidget *parentWidget = static_cast<QWidget*>(parent);
+ widget->setParent(parentWidget);
+ } else {
+ // TODO: parent might be a layout
+ }
+ } else {
+ o->setParent(parent);
+ }
}
stack.push(o);
}
@@ -745,6 +776,20 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
break;
+ case QmlInstruction::Defer:
+ {
+ if (instr.defer.deferCount) {
+ QObject *target = stack.top();
+ QmlInstanceDeclarativeData *data =
+ QmlInstanceDeclarativeData::get(target, true);
+ comp->addref();
+ data->deferredComponent = comp;
+ data->deferredIdx = ii;
+ ii += instr.defer.deferCount;
+ }
+ }
+ break;
+
case QmlInstruction::PopFetchedObject:
{
stack.pop();
diff --git a/src/declarative/qml/qmlvme_p.h b/src/declarative/qml/qmlvme_p.h
index f2ed576..149c82c 100644
--- a/src/declarative/qml/qmlvme_p.h
+++ b/src/declarative/qml/qmlvme_p.h
@@ -58,12 +58,14 @@ class QmlVME
public:
QmlVME();
- QObject *run(QmlContext *, QmlCompiledComponent *, int start = -1, int end = -1);
+ QObject *run(QmlContext *, QmlCompiledComponent *, int start = -1, int count = -1);
+ void runDeferred(QObject *);
bool isError() const;
QList<QmlError> errors() const;
private:
+ QObject *run(QStack<QObject *> &, QmlContext *, QmlCompiledComponent *, int start, int count);
QList<QmlError> vmeErrors;
};
diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp
index 0117448..4b2c64c 100644
--- a/src/declarative/qml/qmlvmemetaobject.cpp
+++ b/src/declarative/qml/qmlvmemetaobject.cpp
@@ -55,14 +55,18 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
QList<QString> *strData,
int slotData,
QmlRefCount *rc)
-: object(obj), ref(rc), slotData(strData), slotDataIdx(slotData)
+: object(obj), ref(rc), slotData(strData), slotDataIdx(slotData), parent(0)
{
if (ref)
ref->addref();
*static_cast<QMetaObject *>(this) = *other;
this->d.superdata = obj->metaObject();
- QObjectPrivate::get(obj)->metaObject = this;
+
+ QObjectPrivate *op = QObjectPrivate::get(obj);
+ if (op->metaObject)
+ parent = static_cast<QAbstractDynamicMetaObject*>(op->metaObject);
+ op->metaObject = this;
baseProp = propertyOffset();
baseSig = methodOffset();
@@ -101,6 +105,8 @@ QmlVMEMetaObject::~QmlVMEMetaObject()
{
if (ref)
ref->release();
+ if (parent)
+ delete parent;
delete [] data;
}
@@ -172,6 +178,10 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
}
}
- return object->qt_metacall(c, id, a);
+ if (parent)
+ return parent->metaCall(c, id, a);
+ else
+ return object->qt_metacall(c, id, a);
}
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlvmemetaobject_p.h b/src/declarative/qml/qmlvmemetaobject_p.h
index 6f1e31b..17140ef 100644
--- a/src/declarative/qml/qmlvmemetaobject_p.h
+++ b/src/declarative/qml/qmlvmemetaobject_p.h
@@ -69,6 +69,7 @@ private:
QBitArray vTypes;
QList<QString> *slotData;
int slotDataIdx;
+ QAbstractDynamicMetaObject *parent;
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/rewriter/rewriter.cpp b/src/declarative/qml/rewriter/rewriter.cpp
index fce4fdf..2ce927c 100644
--- a/src/declarative/qml/rewriter/rewriter.cpp
+++ b/src/declarative/qml/rewriter/rewriter.cpp
@@ -40,11 +40,11 @@
****************************************************************************/
#include "rewriter_p.h"
-#include "javascriptast_p.h"
+#include "qmljsast_p.h"
QT_BEGIN_NAMESPACE
-using namespace JavaScript;
+using namespace QmlJS;
void Rewriter::replace(const AST::SourceLocation &loc, const QString &text)
{ replace(loc.offset, loc.length, text); }
@@ -76,8 +76,8 @@ QString Rewriter::textAt(const AST::SourceLocation &loc) const
QString Rewriter::textAt(const AST::SourceLocation &firstLoc, const AST::SourceLocation &lastLoc) const
{ return _code.mid(firstLoc.offset, lastLoc.offset + lastLoc.length - firstLoc.offset); }
-void Rewriter::accept(JavaScript::AST::Node *node)
-{ JavaScript::AST::Node::acceptChild(node, this); }
+void Rewriter::accept(QmlJS::AST::Node *node)
+{ QmlJS::AST::Node::acceptChild(node, this); }
void Rewriter::moveTextBefore(const AST::SourceLocation &firstLoc,
const AST::SourceLocation &lastLoc,
diff --git a/src/declarative/qml/rewriter/rewriter_p.h b/src/declarative/qml/rewriter/rewriter_p.h
index 02b4ee4..fcb9ca5 100644
--- a/src/declarative/qml/rewriter/rewriter_p.h
+++ b/src/declarative/qml/rewriter/rewriter_p.h
@@ -46,12 +46,12 @@
#include <QtCore/QString>
#include "textwriter_p.h"
-#include "javascriptastvisitor_p.h"
+#include "qmljsastvisitor_p.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-namespace JavaScript {
+namespace QmlJS {
////////////////////////////////////////////////////////////////////////////////
// Replacement
@@ -143,7 +143,7 @@ private:
QList<Replacement> _replacementList;
};
-} // end of namespace JavaScript
+} // end of namespace QmlJS
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/declarative/qml/rewriter/textwriter.cpp b/src/declarative/qml/rewriter/textwriter.cpp
index 21122ff..fbbdb2bbab 100644
--- a/src/declarative/qml/rewriter/textwriter.cpp
+++ b/src/declarative/qml/rewriter/textwriter.cpp
@@ -43,7 +43,7 @@
QT_BEGIN_NAMESPACE
-using namespace JavaScript;
+using namespace QmlJS;
TextWriter::TextWriter()
:string(0), cursor(0)
diff --git a/src/declarative/qml/rewriter/textwriter_p.h b/src/declarative/qml/rewriter/textwriter_p.h
index 57800bf..3041e04 100644
--- a/src/declarative/qml/rewriter/textwriter_p.h
+++ b/src/declarative/qml/rewriter/textwriter_p.h
@@ -49,7 +49,7 @@
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-namespace JavaScript {
+namespace QmlJS {
class TextWriter
{
@@ -91,7 +91,7 @@ public:
};
-} // end of namespace JavaScript
+} // end of namespace QmlJS
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/declarative/timeline/qmltimeline.h b/src/declarative/timeline/qmltimeline.h
index 23bdd64..627ec79 100644
--- a/src/declarative/timeline/qmltimeline.h
+++ b/src/declarative/timeline/qmltimeline.h
@@ -128,7 +128,7 @@ class Q_DECLARATIVE_EXPORT QmlTimeLineValue : public QmlTimeLineObject
public:
QmlTimeLineValue(qreal v = 0.) : _v(v) {}
- qreal value() const { return _v; }
+ virtual qreal value() const { return _v; }
virtual void setValue(qreal v) { _v = v; }
QmlTimeLine *timeLine() const { return _t; }
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index d4aea81..7df249e 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -1168,12 +1168,17 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
}
};
- QStringList props = d->properties.split(QLatin1Char(','));
+ QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(','));
for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
+ if (d->userProperty.isValid() && props.isEmpty() && !target()) {
+ props.append(d->userProperty.value.name());
+ d->target = d->userProperty.value.object();
+ }
+
QmlSetPropertyAnimationAction *data = new QmlSetPropertyAnimationAction;
QSet<QObject *> objs;
@@ -1649,12 +1654,17 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
}
};
- QStringList props = d->properties.split(QLatin1Char(','));
+ QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(','));
for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
+ if (d->userProperty.isValid() && props.isEmpty() && !target()) {
+ props.append(d->userProperty.value.name());
+ d->target = d->userProperty.value.object();
+ }
+
NTransitionData *data = new NTransitionData;
QSet<QObject *> objs;
@@ -1785,6 +1795,12 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions,
inc = -1;
from = d->animations.count() - 1;
}
+
+ //### needed for Behavior
+ if (d->userProperty.isValid() && d->propertyName.isEmpty() && !target()) {
+ for (int i = 0; i < d->animations.count(); ++i)
+ d->animations.at(i)->setTarget(d->userProperty);
+ }
//XXX removing and readding isn't ideal; we do it to get around the problem mentioned below.
for (int i = d->ag->animationCount()-1; i >= 0; --i)
@@ -1870,6 +1886,12 @@ void QmlParallelAnimation::transition(QmlStateActions &actions,
{
Q_D(QmlAnimationGroup);
+ //### needed for Behavior
+ if (d->userProperty.isValid() && d->propertyName.isEmpty() && !target()) {
+ for (int i = 0; i < d->animations.count(); ++i)
+ d->animations.at(i)->setTarget(d->userProperty);
+ }
+
for (int ii = 0; ii < d->animations.count(); ++ii) {
d->animations.at(ii)->transition(actions, modified, direction);
}
diff --git a/src/declarative/util/qmlanimation.h b/src/declarative/util/qmlanimation.h
index 8b9ecc2..5ab9dda 100644
--- a/src/declarative/util/qmlanimation.h
+++ b/src/declarative/util/qmlanimation.h
@@ -91,6 +91,8 @@ public:
QString property() const;
void setProperty(const QString &);
+ virtual void setTarget(const QmlMetaProperty &);
+
void classBegin();
void componentComplete();
@@ -109,7 +111,6 @@ public Q_SLOTS:
void complete();
protected:
- virtual void setTarget(const QmlMetaProperty &);
QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObject *parent);
public:
@@ -446,8 +447,8 @@ Q_SIGNALS:
};
QML_DECLARE_TYPE(QmlVariantAnimation)
-#endif // QMLANIMATION_H
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // QMLANIMATION_H
diff --git a/src/declarative/util/qmlbehaviour.cpp b/src/declarative/util/qmlbehaviour.cpp
index 077f666..3617541 100644
--- a/src/declarative/util/qmlbehaviour.cpp
+++ b/src/declarative/util/qmlbehaviour.cpp
@@ -44,11 +44,11 @@
#include "qmltransition.h"
#include "qmlbehaviour.h"
#include <QtDeclarative/qmlcontext.h>
-
+#include <QtCore/qparallelanimationgroup.h>
QT_BEGIN_NAMESPACE
-QML_DEFINE_TYPE(QmlBehaviour,Behaviour)
+QML_DEFINE_TYPE(QmlBehaviour,Behavior)
class QmlBehaviourData : public QObject
{
@@ -92,18 +92,21 @@ public:
{
QmlConcreteList<QmlAbstractAnimation *>::append(a);
_parent->group->addAnimation(a->qtAnimation());
+ if (_parent->property.isValid()) {
+ a->setTarget(_parent->property);
+ }
}
virtual void clear() { QmlConcreteList<QmlAbstractAnimation *>::clear(); } //###
private:
QmlBehaviourPrivate *_parent;
};
AnimationList operations;
- QSequentialAnimationGroup *group;
+ QParallelAnimationGroup *group;
};
/*!
- \qmlclass Behaviour QmlBehaviour
- \brief The Behaviour element allows you to specify a default animation for a property change.
+ \qmlclass Behavior QmlBehaviour
+ \brief The Behavior element allows you to specify a default animation for a property change.
In example below, the rect will use a bounce easing curve over 200 millisecond for any changes to its y property:
\code
@@ -111,7 +114,7 @@ public:
width: 20; height: 20
color: "#00ff00"
y: 200 //initial value
- y: Behaviour {
+ y: Behavior {
NumericAnimation {
easing: "easeOutBounce(amplitude:100)"
duration: 200
@@ -126,14 +129,14 @@ QmlBehaviour::QmlBehaviour(QObject *parent)
{
Q_D(QmlBehaviour);
d->valueData = new QmlBehaviourData(this);
- d->group = new QSequentialAnimationGroup(this);
+ d->group = new QParallelAnimationGroup(this);
}
/*!
- \qmlproperty QVariant Behaviour::fromValue
- This property holds a selector specifying a starting value for the behaviour
+ \qmlproperty QVariant Behavior::fromValue
+ This property holds a selector specifying a starting value for the behavior
- If you only want the behaviour to apply when the change starts at a
+ If you only want the behavior to apply when the change starts at a
specific value you can specify fromValue. This selector is used in conjunction
with the toValue selector.
*/
@@ -151,10 +154,10 @@ void QmlBehaviour::setFromValue(const QVariant &v)
}
/*!
- \qmlproperty QVariant Behaviour::toValue
- This property holds a selector specifying a ending value for the behaviour
+ \qmlproperty QVariant Behavior::toValue
+ This property holds a selector specifying a ending value for the behavior
- If you only want the behaviour to apply when the change ends at a
+ If you only want the behavior to apply when the change ends at a
specific value you can specify toValue. This selector is used in conjunction
with the fromValue selector.
*/
@@ -230,6 +233,9 @@ void QmlBehaviour::setTarget(const QmlMetaProperty &property)
d->property = property;
d->currentValue = property.read();
d->property.connectNotifier(this, SLOT(propertyValueChanged()));
+ for (int ii = 0; ii < d->operations.count(); ++ii) {
+ d->operations.at(ii)->setTarget(property);
+ }
}
void QmlBehaviour::classBegin()
diff --git a/src/declarative/util/qmlbehaviour.h b/src/declarative/util/qmlbehaviour.h
index aef53a3..7cc83b2 100644
--- a/src/declarative/util/qmlbehaviour.h
+++ b/src/declarative/util/qmlbehaviour.h
@@ -88,10 +88,8 @@ private Q_SLOTS:
};
QML_DECLARE_TYPE(QmlBehaviour)
-
-#endif // QMLBEHAVIOUR_H
-
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // QMLBEHAVIOUR_H
diff --git a/src/declarative/util/qmlbind.h b/src/declarative/util/qmlbind.h
index 706e202..b7b77f2 100644
--- a/src/declarative/util/qmlbind.h
+++ b/src/declarative/util/qmlbind.h
@@ -51,6 +51,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QmlBindPrivate;
class Q_DECLARATIVE_EXPORT QmlBind : public QObject
{
@@ -86,4 +87,5 @@ QML_DECLARE_TYPE(QmlBind)
QT_END_NAMESPACE
QT_END_HEADER
+
#endif
diff --git a/src/declarative/util/qmlconnection.h b/src/declarative/util/qmlconnection.h
index 57a406b..4350123 100644
--- a/src/declarative/util/qmlconnection.h
+++ b/src/declarative/util/qmlconnection.h
@@ -51,6 +51,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QmlBoundSignal;
class QmlContext;
class QmlConnectionPrivate;
@@ -83,9 +84,8 @@ private:
};
QML_DECLARE_TYPE(QmlConnection)
-#endif
-
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif
diff --git a/src/declarative/util/qmldatetimeformatter.h b/src/declarative/util/qmldatetimeformatter.h
index 5d11dab..84b27e3 100644
--- a/src/declarative/util/qmldatetimeformatter.h
+++ b/src/declarative/util/qmldatetimeformatter.h
@@ -45,7 +45,6 @@
#include <QtCore/qdatetime.h>
#include <QtDeclarative/qml.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -109,8 +108,8 @@ private:
QML_DECLARE_TYPE(QmlDateTimeFormatter)
-
QT_END_NAMESPACE
QT_END_HEADER
+
#endif
diff --git a/src/declarative/util/qmlfollow.h b/src/declarative/util/qmlfollow.h
index d210592..72d6df5 100644
--- a/src/declarative/util/qmlfollow.h
+++ b/src/declarative/util/qmlfollow.h
@@ -45,12 +45,12 @@
#include <QtDeclarative/qmlpropertyvaluesource.h>
#include <QtDeclarative/qml.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QmlFollowPrivate;
class Q_DECLARATIVE_EXPORT QmlFollow : public QmlPropertyValueSource,
public QmlParserStatus
@@ -94,10 +94,8 @@ Q_SIGNALS:
QML_DECLARE_TYPE(QmlFollow)
-
-#endif // QFXFOLLOW_H
-
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // QFXFOLLOW_H
diff --git a/src/declarative/util/qmlfont.h b/src/declarative/util/qmlfont.h
index 1fee6cb..c4c86e2 100644
--- a/src/declarative/util/qmlfont.h
+++ b/src/declarative/util/qmlfont.h
@@ -45,12 +45,12 @@
#include <QtCore/qobject.h>
#include <QtDeclarative/qml.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QmlFontPrivate;
class Q_DECLARATIVE_EXPORT QmlFont : public QObject
{
@@ -85,8 +85,8 @@ Q_SIGNALS:
};
QML_DECLARE_TYPE(QmlFont)
-
QT_END_NAMESPACE
QT_END_HEADER
+
#endif // QMLFONT_H
diff --git a/src/declarative/util/qmllistaccessor.h b/src/declarative/util/qmllistaccessor.h
index dd766b2..27a77a0 100644
--- a/src/declarative/util/qmllistaccessor.h
+++ b/src/declarative/util/qmllistaccessor.h
@@ -75,8 +75,8 @@ private:
QVariant d;
};
-#endif // QMLLISTACCESSOR_H
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // QMLLISTACCESSOR_H
diff --git a/src/declarative/util/qmlopenmetaobject.h b/src/declarative/util/qmlopenmetaobject.h
index 239276d..f65660d 100644
--- a/src/declarative/util/qmlopenmetaobject.h
+++ b/src/declarative/util/qmlopenmetaobject.h
@@ -51,6 +51,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QmlOpenMetaObjectPrivate;
class QMetaPropertyBuilder;
class Q_DECLARATIVE_EXPORT QmlOpenMetaObject : public QAbstractDynamicMetaObject
@@ -82,8 +83,8 @@ private:
QmlOpenMetaObjectPrivate *d;
};
-
QT_END_NAMESPACE
QT_END_HEADER
+
#endif // QMLOPENMETAOBJECT_H
diff --git a/src/declarative/util/qmlpackage.h b/src/declarative/util/qmlpackage.h
index cc77b6c..9f1d94f 100644
--- a/src/declarative/util/qmlpackage.h
+++ b/src/declarative/util/qmlpackage.h
@@ -44,12 +44,12 @@
#include <QtDeclarative/qml.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
/*****************************************************************************
*****************************************************************************
XXX Experimental
@@ -79,9 +79,8 @@ public:
};
QML_DECLARE_TYPE(QmlPackage)
-#endif // QMLPACKAGE_H
-
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // QMLPACKAGE_H
diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp
index e422f37..ab095b1 100644
--- a/src/declarative/util/qmlscript.cpp
+++ b/src/declarative/util/qmlscript.cpp
@@ -66,7 +66,7 @@ class QmlScriptPrivate : public QObjectPrivate
public:
QmlScriptPrivate() : reply(0) {}
- void addScriptToEngine(const QString &, const QString &fileName=QString());
+ void addScriptToEngine(const QString &, const QString &source=QString());
QString script;
QNetworkReply *reply;
@@ -156,7 +156,7 @@ void QmlScript::setSource(const QUrl &source)
QFile file(d->url.toLocalFile());
file.open(QIODevice::ReadOnly);
QByteArray ba = file.readAll();
- d->addScriptToEngine(QString::fromUtf8(ba), d->url);
+ d->addScriptToEngine(QString::fromUtf8(ba), file.fileName());
} else
#endif
{
@@ -173,13 +173,13 @@ void QmlScript::replyFinished()
Q_D(QmlScript);
if (!d->reply->error()) {
QByteArray ba = d->reply->readAll();
- d->addScriptToEngine(QString::fromUtf8(ba), d->url);
+ d->addScriptToEngine(QString::fromUtf8(ba), d->url.toString());
}
d->reply->deleteLater();
d->reply = 0;
}
-void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &fileName)
+void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &source)
{
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::AddScript> pt;
@@ -202,7 +202,7 @@ void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &f
currentContext->setActivationObject(context->d_func()->scopeChain.at(0));
- QScriptValue val = scriptEngine->evaluate(script, fileName);
+ QScriptValue val = scriptEngine->evaluate(script, source);
if (scriptEngine->hasUncaughtException()) {
if (scriptEngine->uncaughtException().isError()){
QScriptValue exception = scriptEngine->uncaughtException();
diff --git a/src/declarative/util/qmlstategroup.h b/src/declarative/util/qmlstategroup.h
index ac1d917..237b60e 100644
--- a/src/declarative/util/qmlstategroup.h
+++ b/src/declarative/util/qmlstategroup.h
@@ -44,14 +44,14 @@
#include <QtDeclarative/qmlstate.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QmlStateGroupPrivate;
-class QmlStateGroup : public QObject, public QmlParserStatus
+class Q_DECLARATIVE_EXPORT QmlStateGroup : public QObject, public QmlParserStatus
{
Q_OBJECT
Q_INTERFACES(QmlParserStatus)
@@ -87,9 +87,8 @@ private:
};
QML_DECLARE_TYPE(QmlStateGroup)
-#endif // QMLSTATEGROUP_H
-
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // QMLSTATEGROUP_H