diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-01-25 14:43:07 +1000 |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2012-01-25 14:43:07 +1000 |
commit | c3601a8db91bc777ea859d6a796dfab6a218675e (patch) | |
tree | d2a4f6c83bec3cddcce020966cccac72be3aa04a /src/declarative/qml | |
parent | 35794301d188b731a7b596d92fc632fff58586c0 (diff) | |
parent | 149f6afe321ce59aebe4ce2f9dddd1881d0ac22b (diff) |
Merge branch 'master' into animation-refactorwip/animation-refactor
Conflicts:
tests/auto/declarative/declarative.pro
Change-Id: Ie339be2989fac553d351f3077869f1847367b504
Diffstat (limited to 'src/declarative/qml')
223 files changed, 1098 insertions, 513 deletions
diff --git a/src/declarative/qml/ftw/qbitfield_p.h b/src/declarative/qml/ftw/qbitfield_p.h index fb5efe0ea1..28a0297f68 100644 --- a/src/declarative/qml/ftw/qbitfield_p.h +++ b/src/declarative/qml/ftw/qbitfield_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qdeclarativepool.cpp b/src/declarative/qml/ftw/qdeclarativepool.cpp index 5d864ea0cd..897882e818 100644 --- a/src/declarative/qml/ftw/qdeclarativepool.cpp +++ b/src/declarative/qml/ftw/qdeclarativepool.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qdeclarativepool_p.h b/src/declarative/qml/ftw/qdeclarativepool_p.h index 3bf6187851..b5e4f18aeb 100644 --- a/src/declarative/qml/ftw/qdeclarativepool_p.h +++ b/src/declarative/qml/ftw/qdeclarativepool_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qdeclarativerefcount_p.h b/src/declarative/qml/ftw/qdeclarativerefcount_p.h index afee77ba2c..5d287e07f2 100644 --- a/src/declarative/qml/ftw/qdeclarativerefcount_p.h +++ b/src/declarative/qml/ftw/qdeclarativerefcount_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -60,7 +60,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeRefCount { diff --git a/src/declarative/qml/ftw/qdeclarativethread.cpp b/src/declarative/qml/ftw/qdeclarativethread.cpp index ecfbe5c7e2..9883e53e93 100644 --- a/src/declarative/qml/ftw/qdeclarativethread.cpp +++ b/src/declarative/qml/ftw/qdeclarativethread.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qdeclarativethread_p.h b/src/declarative/qml/ftw/qdeclarativethread_p.h index 20385b54ee..5206de1eab 100644 --- a/src/declarative/qml/ftw/qdeclarativethread_p.h +++ b/src/declarative/qml/ftw/qdeclarativethread_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qdeclarativetrace.cpp b/src/declarative/qml/ftw/qdeclarativetrace.cpp index 44c3d4c537..1497750b35 100644 --- a/src/declarative/qml/ftw/qdeclarativetrace.cpp +++ b/src/declarative/qml/ftw/qdeclarativetrace.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qdeclarativetrace_p.h b/src/declarative/qml/ftw/qdeclarativetrace_p.h index 957de6ba52..83fa145f91 100644 --- a/src/declarative/qml/ftw/qdeclarativetrace_p.h +++ b/src/declarative/qml/ftw/qdeclarativetrace_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qdeletewatcher_p.h b/src/declarative/qml/ftw/qdeletewatcher_p.h index e04fdea955..194fbddac6 100644 --- a/src/declarative/qml/ftw/qdeletewatcher_p.h +++ b/src/declarative/qml/ftw/qdeletewatcher_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qfastmetabuilder.cpp b/src/declarative/qml/ftw/qfastmetabuilder.cpp index 95de0837b8..e1cedefe46 100644 --- a/src/declarative/qml/ftw/qfastmetabuilder.cpp +++ b/src/declarative/qml/ftw/qfastmetabuilder.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qfastmetabuilder_p.h b/src/declarative/qml/ftw/qfastmetabuilder_p.h index defb4b9bde..ec2423b296 100644 --- a/src/declarative/qml/ftw/qfastmetabuilder_p.h +++ b/src/declarative/qml/ftw/qfastmetabuilder_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qfieldlist_p.h b/src/declarative/qml/ftw/qfieldlist_p.h index b77616d219..801d55748d 100644 --- a/src/declarative/qml/ftw/qfieldlist_p.h +++ b/src/declarative/qml/ftw/qfieldlist_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qfinitestack_p.h b/src/declarative/qml/ftw/qfinitestack_p.h index 84ec6c0180..6d0e9170c5 100644 --- a/src/declarative/qml/ftw/qfinitestack_p.h +++ b/src/declarative/qml/ftw/qfinitestack_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qflagpointer_p.h b/src/declarative/qml/ftw/qflagpointer_p.h index 19f6761c9d..28c4c18369 100644 --- a/src/declarative/qml/ftw/qflagpointer_p.h +++ b/src/declarative/qml/ftw/qflagpointer_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qhashedstring.cpp b/src/declarative/qml/ftw/qhashedstring.cpp index 1380e0efc6..cd9191c526 100644 --- a/src/declarative/qml/ftw/qhashedstring.cpp +++ b/src/declarative/qml/ftw/qhashedstring.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qhashedstring_p.h b/src/declarative/qml/ftw/qhashedstring_p.h index 2fddf24b5c..f4dd6ee87f 100644 --- a/src/declarative/qml/ftw/qhashedstring_p.h +++ b/src/declarative/qml/ftw/qhashedstring_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -104,6 +104,8 @@ public: inline v8::Handle<v8::String> string() const; + inline QString toString() const; + private: v8::String::CompleteHashData m_hash; v8::Handle<v8::String> m_string; @@ -917,6 +919,17 @@ v8::Handle<v8::String> QHashedV8String::string() const return m_string; } +QString QHashedV8String::toString() const +{ + QString result; + result.reserve(m_hash.length); + + for (int i = 0; i < m_hash.length; ++i) + result.append(m_string->GetCharacter(i)); + + return result; +} + QHashedStringRef::QHashedStringRef() : m_data(0), m_length(0), m_utf8length(-1), m_hash(0) { diff --git a/src/declarative/qml/ftw/qhashfield_p.h b/src/declarative/qml/ftw/qhashfield_p.h index df308fae27..44668676e2 100644 --- a/src/declarative/qml/ftw/qhashfield_p.h +++ b/src/declarative/qml/ftw/qhashfield_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qintrusivelist.cpp b/src/declarative/qml/ftw/qintrusivelist.cpp index 542d35d676..3c26c39b46 100644 --- a/src/declarative/qml/ftw/qintrusivelist.cpp +++ b/src/declarative/qml/ftw/qintrusivelist.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qintrusivelist_p.h b/src/declarative/qml/ftw/qintrusivelist_p.h index 7315224c5f..f1691b3151 100644 --- a/src/declarative/qml/ftw/qintrusivelist_p.h +++ b/src/declarative/qml/ftw/qintrusivelist_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qpodvector_p.h b/src/declarative/qml/ftw/qpodvector_p.h index 59bb53d6d4..e1acdc02aa 100644 --- a/src/declarative/qml/ftw/qpodvector_p.h +++ b/src/declarative/qml/ftw/qpodvector_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qrecursionwatcher_p.h b/src/declarative/qml/ftw/qrecursionwatcher_p.h index 3ce95b59c7..f99edc834d 100644 --- a/src/declarative/qml/ftw/qrecursionwatcher_p.h +++ b/src/declarative/qml/ftw/qrecursionwatcher_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/ftw/qrecyclepool_p.h b/src/declarative/qml/ftw/qrecyclepool_p.h index a9bbc14a54..8e16d5cbf0 100644 --- a/src/declarative/qml/ftw/qrecyclepool_p.h +++ b/src/declarative/qml/ftw/qrecyclepool_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g index 9ed2e86744..fa73238044 100644 --- a/src/declarative/qml/parser/qdeclarativejs.g +++ b/src/declarative/qml/parser/qdeclarativejs.g @@ -2,7 +2,7 @@ -- -- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -- All rights reserved. --- Contact: Nokia Corporation (qt-info@nokia.com) +-- Contact: http://www.qt-project.org/ -- -- This file is part of the QtDeclarative module of the Qt Toolkit. -- @@ -16,7 +16,7 @@ -- will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -- -- If you have questions regarding the use of this file, please contact --- Nokia at qt-info@nokia.com. +-- us via http://www.qt-project.org/. -- $QT_END_LICENSE$ -- ---------------------------------------------------------------------------- @@ -87,7 +87,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -140,7 +140,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsast.cpp b/src/declarative/qml/parser/qdeclarativejsast.cpp index 5331430332..5d6ca676a6 100644 --- a/src/declarative/qml/parser/qdeclarativejsast.cpp +++ b/src/declarative/qml/parser/qdeclarativejsast.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsast_p.h b/src/declarative/qml/parser/qdeclarativejsast_p.h index ac463c7d88..5d2430a2e9 100644 --- a/src/declarative/qml/parser/qdeclarativejsast_p.h +++ b/src/declarative/qml/parser/qdeclarativejsast_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsastfwd_p.h b/src/declarative/qml/parser/qdeclarativejsastfwd_p.h index 6f60ea7572..f1241bc393 100644 --- a/src/declarative/qml/parser/qdeclarativejsastfwd_p.h +++ b/src/declarative/qml/parser/qdeclarativejsastfwd_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsastvisitor.cpp b/src/declarative/qml/parser/qdeclarativejsastvisitor.cpp index 207467fdf8..d3a37b8352 100644 --- a/src/declarative/qml/parser/qdeclarativejsastvisitor.cpp +++ b/src/declarative/qml/parser/qdeclarativejsastvisitor.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsastvisitor_p.h b/src/declarative/qml/parser/qdeclarativejsastvisitor_p.h index 7d75670daa..9cfe778316 100644 --- a/src/declarative/qml/parser/qdeclarativejsastvisitor_p.h +++ b/src/declarative/qml/parser/qdeclarativejsastvisitor_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsengine_p.cpp b/src/declarative/qml/parser/qdeclarativejsengine_p.cpp index 8f4572ee10..cb5667cd31 100644 --- a/src/declarative/qml/parser/qdeclarativejsengine_p.cpp +++ b/src/declarative/qml/parser/qdeclarativejsengine_p.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsengine_p.h b/src/declarative/qml/parser/qdeclarativejsengine_p.h index a7365a9e1d..1044b167bd 100644 --- a/src/declarative/qml/parser/qdeclarativejsengine_p.h +++ b/src/declarative/qml/parser/qdeclarativejsengine_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsglobal_p.h b/src/declarative/qml/parser/qdeclarativejsglobal_p.h index 19aae59b9d..96f915a68d 100644 --- a/src/declarative/qml/parser/qdeclarativejsglobal_p.h +++ b/src/declarative/qml/parser/qdeclarativejsglobal_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp index a0bbd5ee6b..2f86d75ae3 100644 --- a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp +++ b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar_p.h b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h index d0dfcc5630..b4c8a25673 100644 --- a/src/declarative/qml/parser/qdeclarativejsgrammar_p.h +++ b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejskeywords_p.h b/src/declarative/qml/parser/qdeclarativejskeywords_p.h index d9c23e81e8..b6e006ac6c 100644 --- a/src/declarative/qml/parser/qdeclarativejskeywords_p.h +++ b/src/declarative/qml/parser/qdeclarativejskeywords_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp index 4603a12b42..8ab273b72e 100644 --- a/src/declarative/qml/parser/qdeclarativejslexer.cpp +++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejslexer_p.h b/src/declarative/qml/parser/qdeclarativejslexer_p.h index de328866c5..174ce0a8c5 100644 --- a/src/declarative/qml/parser/qdeclarativejslexer_p.h +++ b/src/declarative/qml/parser/qdeclarativejslexer_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsmemorypool_p.h b/src/declarative/qml/parser/qdeclarativejsmemorypool_p.h index 45f5752e3e..6a769004a9 100644 --- a/src/declarative/qml/parser/qdeclarativejsmemorypool_p.h +++ b/src/declarative/qml/parser/qdeclarativejsmemorypool_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsparser.cpp b/src/declarative/qml/parser/qdeclarativejsparser.cpp index 1639900338..9bec256ce5 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser.cpp +++ b/src/declarative/qml/parser/qdeclarativejsparser.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/parser/qdeclarativejsparser_p.h b/src/declarative/qml/parser/qdeclarativejsparser_p.h index 20915659bf..6bb317460f 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser_p.h +++ b/src/declarative/qml/parser/qdeclarativejsparser_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h index c2efecdb0c..adec9a09f6 100644 --- a/src/declarative/qml/qdeclarative.h +++ b/src/declarative/qml/qdeclarative.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -86,7 +86,6 @@ QT_END_NAMESPACE QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativePropertyValueInterceptor; diff --git a/src/declarative/qml/qdeclarativeaccessors.cpp b/src/declarative/qml/qdeclarativeaccessors.cpp index 887b7dcd9a..c771e0c534 100644 --- a/src/declarative/qml/qdeclarativeaccessors.cpp +++ b/src/declarative/qml/qdeclarativeaccessors.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeaccessors_p.h b/src/declarative/qml/qdeclarativeaccessors_p.h index 99b5371704..01afc6a5b0 100644 --- a/src/declarative/qml/qdeclarativeaccessors_p.h +++ b/src/declarative/qml/qdeclarativeaccessors_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeapplication.cpp b/src/declarative/qml/qdeclarativeapplication.cpp index 05e8a6c9f9..afc37ee301 100644 --- a/src/declarative/qml/qdeclarativeapplication.cpp +++ b/src/declarative/qml/qdeclarativeapplication.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeapplication_p.h b/src/declarative/qml/qdeclarativeapplication_p.h index 4d86e93866..bcb66b8851 100644 --- a/src/declarative/qml/qdeclarativeapplication_p.h +++ b/src/declarative/qml/qdeclarativeapplication_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -50,7 +50,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeApplicationPrivate; class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeApplication : public QObject diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 552b5988bf..5e2f655cdb 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -216,7 +216,7 @@ void QDeclarativeBindingPrivate::refresh() } QDeclarativeBindingPrivate::QDeclarativeBindingPrivate() -: updating(false), enabled(false), columnNumber(0) +: updating(false), enabled(false) { } @@ -268,13 +268,12 @@ QDeclarativeBinding::QDeclarativeBinding(const QString &str, bool isRewritten, Q QDeclarativeContextData *ctxt, const QString &url, int lineNumber, int columnNumber, QObject *parent) -: QDeclarativeExpression(ctxt, obj, str, isRewritten, url, lineNumber, *new QDeclarativeBindingPrivate) +: QDeclarativeExpression(ctxt, obj, str, isRewritten, url, lineNumber, columnNumber, *new QDeclarativeBindingPrivate) { Q_D(QDeclarativeBinding); setParent(parent); setNotifyOnValueChanged(true); - d->columnNumber = columnNumber; } /*! @@ -340,7 +339,7 @@ public: { QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Binding); QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Binding, bind->expression()); - QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::Binding, bind->sourceFile(), bind->lineNumber()); + QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::Binding, bind->sourceFile(), bind->lineNumber(), bind->columnNumber()); } ~QDeclarativeBindingProfiler() diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h index eaba03a38d..a58a9f0516 100644 --- a/src/declarative/qml/qdeclarativebinding_p.h +++ b/src/declarative/qml/qdeclarativebinding_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativebinding_p_p.h b/src/declarative/qml/qdeclarativebinding_p_p.h index 60f5ef1c12..48a9a379f9 100644 --- a/src/declarative/qml/qdeclarativebinding_p_p.h +++ b/src/declarative/qml/qdeclarativebinding_p_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp index 51691ca6bd..c3a2ed15c7 100644 --- a/src/declarative/qml/qdeclarativeboundsignal.cpp +++ b/src/declarative/qml/qdeclarativeboundsignal.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -173,7 +173,7 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) if (QDeclarativeDebugService::isDebuggingEnabled()) { QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::HandlingSignal); QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::HandlingSignal, QLatin1String(m_signal.signature()) % QLatin1String(": ") % m_expression->expression()); - QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::HandlingSignal, m_expression->sourceFile(), m_expression->lineNumber()); + QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::HandlingSignal, m_expression->sourceFile(), m_expression->lineNumber(), m_expression->columnNumber()); QV8DebugService::instance()->signalEmitted(QString::fromAscii(m_signal.signature())); } m_isEvaluating = true; diff --git a/src/declarative/qml/qdeclarativeboundsignal_p.h b/src/declarative/qml/qdeclarativeboundsignal_p.h index 1dbcc071b8..1654e36cf6 100644 --- a/src/declarative/qml/qdeclarativeboundsignal_p.h +++ b/src/declarative/qml/qdeclarativeboundsignal_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativecleanup.cpp b/src/declarative/qml/qdeclarativecleanup.cpp index 9a17000c05..44b0bdb18d 100644 --- a/src/declarative/qml/qdeclarativecleanup.cpp +++ b/src/declarative/qml/qdeclarativecleanup.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativecleanup_p.h b/src/declarative/qml/qdeclarativecleanup_p.h index cef30f7f82..06f9d2f391 100644 --- a/src/declarative/qml/qdeclarativecleanup_p.h +++ b/src/declarative/qml/qdeclarativecleanup_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativecompileddata.cpp b/src/declarative/qml/qdeclarativecompileddata.cpp index 9a0b9f0209..42d38e553d 100644 --- a/src/declarative/qml/qdeclarativecompileddata.cpp +++ b/src/declarative/qml/qdeclarativecompileddata.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 3a7a6013e6..07e381c18f 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -404,6 +404,14 @@ bool QDeclarativeCompiler::testLiteralAssignment(QDeclarativeScript::Property *p return true; } +static QUrl urlFromUserString(const QString &data) +{ + QUrl u; + // Preserve any valid percent-encoded octets supplied by the source + u.setEncodedUrl(data.toUtf8(), QUrl::TolerantMode); + return u; +} + /*! Generate a store instruction for assigning literal \a v to property \a prop. @@ -511,7 +519,7 @@ void QDeclarativeCompiler::genLiteralAssignment(QDeclarativeScript::Property *pr { Instruction::StoreUrl instr; QString string = v->value.asString(); - QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(QUrl(string)); + QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(urlFromUserString(string)); instr.propertyIndex = prop->index; instr.value = output->indexForUrl(u); output->addInstruction(instr); @@ -720,7 +728,7 @@ void QDeclarativeCompiler::genLiteralAssignment(QDeclarativeScript::Property *pr } else if (type == qMetaTypeId<QList<QUrl> >()) { Instruction::StoreUrlQList instr; QString string = v->value.asString(); - QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(QUrl(string)); + QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(urlFromUserString(string)); instr.propertyIndex = prop->index; instr.value = output->indexForUrl(u); output->addInstruction(instr); @@ -851,19 +859,28 @@ void QDeclarativeCompiler::compileTree(QDeclarativeScript::Object *tree) if (componentStats) componentStats->componentStat.lineNumber = tree->location.start.line; - // Build global import scripts - QStringList importedScriptIndexes; - - foreach (const QDeclarativeTypeData::ScriptReference &script, unit->resolvedScripts()) { - importedScriptIndexes.append(script.qualifier); - } - // We generate the importCache before we build the tree so that // it can be used in the binding compiler. Given we "expect" the // QML compilation to succeed, this isn't a waste. output->importCache = new QDeclarativeTypeNameCache(); - for (int ii = 0; ii < importedScriptIndexes.count(); ++ii) - output->importCache->add(importedScriptIndexes.at(ii), ii); + foreach (const QString &ns, unit->namespaces()) { + output->importCache->add(ns); + } + + int scriptIndex = 0; + foreach (const QDeclarativeTypeData::ScriptReference &script, unit->resolvedScripts()) { + QString qualifier = script.qualifier; + QString enclosingNamespace; + + const int lastDotIndex = qualifier.lastIndexOf(QLatin1Char('.')); + if (lastDotIndex != -1) { + enclosingNamespace = qualifier.left(lastDotIndex); + qualifier = qualifier.mid(lastDotIndex+1); + } + + output->importCache->add(qualifier, scriptIndex++, enclosingNamespace); + } + unit->imports().populateCache(output->importCache, engine); if (!buildObject(tree, BindingContext()) || !completeComponentBuild()) @@ -1270,6 +1287,7 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeScript::Object *obj) // ss.bindingId = rewriteBinding(script, prop->name()); ss.bindingId = rewriteBinding(prop->values.first()->value, QString()); // XXX ss.line = prop->location.start.line; + ss.column = prop->location.start.column; output->addInstruction(ss); } @@ -1331,6 +1349,7 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeScript::Object *obj) store.value = output->indexForString(rewrite); store.context = v->signalExpressionContextStack; store.line = v->location.start.line; + store.column = v->location.start.column; output->addInstruction(store); } diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index d6e0b5023c..e181f1f1f9 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 5e9938dc39..2f224ea1f1 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -768,7 +768,7 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context) QDeclarativeData *data = QDeclarativeData::get(rv); Q_ASSERT(data); QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::Creating, - cc->url, data->lineNumber); + cc->url, data->lineNumber, data->columnNumber); } } diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h index 2e33bf8aec..89be2635a5 100644 --- a/src/declarative/qml/qdeclarativecomponent.h +++ b/src/declarative/qml/qdeclarativecomponent.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -53,7 +53,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QByteArray; class QDeclarativeEngine; diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h index ed6d27903e..85f072aaff 100644 --- a/src/declarative/qml/qdeclarativecomponent_p.h +++ b/src/declarative/qml/qdeclarativecomponent_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativecomponentattached_p.h b/src/declarative/qml/qdeclarativecomponentattached_p.h index bbded8eb5e..4b2b624816 100644 --- a/src/declarative/qml/qdeclarativecomponentattached_p.h +++ b/src/declarative/qml/qdeclarativecomponentattached_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -49,7 +49,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class Q_AUTOTEST_EXPORT QDeclarativeComponentAttached : public QObject { diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 6b4f97520a..992fa7f46a 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativecontext.h b/src/declarative/qml/qdeclarativecontext.h index 9a068c979e..bc5b156705 100644 --- a/src/declarative/qml/qdeclarativecontext.h +++ b/src/declarative/qml/qdeclarativecontext.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -52,7 +52,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QString; class QDeclarativeEngine; diff --git a/src/declarative/qml/qdeclarativecontext_p.h b/src/declarative/qml/qdeclarativecontext_p.h index 88304a8423..ee56eb9025 100644 --- a/src/declarative/qml/qdeclarativecontext_p.h +++ b/src/declarative/qml/qdeclarativecontext_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativecustomparser.cpp b/src/declarative/qml/qdeclarativecustomparser.cpp index 59d2b11159..694493703c 100644 --- a/src/declarative/qml/qdeclarativecustomparser.cpp +++ b/src/declarative/qml/qdeclarativecustomparser.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativecustomparser_p.h b/src/declarative/qml/qdeclarativecustomparser_p.h index 01f02d035e..a4d87b2290 100644 --- a/src/declarative/qml/qdeclarativecustomparser_p.h +++ b/src/declarative/qml/qdeclarativecustomparser_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -65,7 +65,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeCompiler; diff --git a/src/declarative/qml/qdeclarativecustomparser_p_p.h b/src/declarative/qml/qdeclarativecustomparser_p_p.h index 27df9e7097..ecd84afcfb 100644 --- a/src/declarative/qml/qdeclarativecustomparser_p_p.h +++ b/src/declarative/qml/qdeclarativecustomparser_p_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h index 48790d78bc..d9f3d1b163 100644 --- a/src/declarative/qml/qdeclarativedata_p.h +++ b/src/declarative/qml/qdeclarativedata_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativedirparser.cpp b/src/declarative/qml/qdeclarativedirparser.cpp index 256157f5b5..c4a11a9a43 100644 --- a/src/declarative/qml/qdeclarativedirparser.cpp +++ b/src/declarative/qml/qdeclarativedirparser.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -103,6 +103,7 @@ bool QDeclarativeDirParser::parse() _errors.clear(); _plugins.clear(); _components.clear(); + _scripts.clear(); if (_source.isEmpty() && !_filePathSouce.isEmpty()) { QFile file(_filePathSouce); @@ -220,9 +221,16 @@ bool QDeclarativeDirParser::parse() const int minorVersion = version.mid(dotIndex + 1).toInt(&validVersionNumber); if (validVersionNumber) { - const Component entry(sections[0], sections[2], majorVersion, minorVersion); - - _components.append(entry); + const QString &fileName = sections[2]; + + if (fileName.endsWith(QLatin1String(".js"))) { + // A 'js' extension indicates a namespaced script import + const Script entry(sections[0], fileName, majorVersion, minorVersion); + _scripts.append(entry); + } else { + const Component entry(sections[0], fileName, majorVersion, minorVersion); + _components.append(entry); + } } } } @@ -275,6 +283,11 @@ QList<QDeclarativeDirParser::Component> QDeclarativeDirParser::components() cons return _components; } +QList<QDeclarativeDirParser::Script> QDeclarativeDirParser::scripts() const +{ + return _scripts; +} + #ifdef QT_CREATOR QList<QDeclarativeDirParser::TypeInfo> QDeclarativeDirParser::typeInfos() const { diff --git a/src/declarative/qml/qdeclarativedirparser_p.h b/src/declarative/qml/qdeclarativedirparser_p.h index ddc3c9f5cb..0f726b7060 100644 --- a/src/declarative/qml/qdeclarativedirparser_p.h +++ b/src/declarative/qml/qdeclarativedirparser_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -109,7 +109,22 @@ public: bool internal; }; + struct Script + { + Script() + : majorVersion(0), minorVersion(0) {} + + Script(const QString &nameSpace, const QString &fileName, int majorVersion, int minorVersion) + : nameSpace(nameSpace), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) {} + + QString nameSpace; + QString fileName; + int majorVersion; + int minorVersion; + }; + QList<Component> components() const; + QList<Script> scripts() const; QList<Plugin> plugins() const; #ifdef QT_CREATOR @@ -134,6 +149,7 @@ private: QString _source; QString _filePathSouce; QList<Component> _components; + QList<Script> _scripts; QList<Plugin> _plugins; #ifdef QT_CREATOR QList<TypeInfo> _typeInfos; @@ -142,6 +158,7 @@ private: }; typedef QList<QDeclarativeDirParser::Component> QDeclarativeDirComponents; +typedef QList<QDeclarativeDirParser::Script> QDeclarativeDirScripts; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 1d613ccc26..54f17ca48d 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -964,7 +964,7 @@ Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object) QString typeName = type ? type->qmlTypeName() : QString::fromUtf8(object->metaObject()->className()); QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Creating, typeName); if (data->outerContext) - QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::Creating, data->outerContext->url, data->lineNumber); + QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::Creating, data->outerContext->url, data->lineNumber, data->columnNumber); } QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(data->context->engine); diff --git a/src/declarative/qml/qdeclarativeengine.h b/src/declarative/qml/qdeclarativeengine.h index 00cd2c257e..e466863c20 100644 --- a/src/declarative/qml/qdeclarativeengine.h +++ b/src/declarative/qml/qdeclarativeengine.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -53,7 +53,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeComponent; class QDeclarativeEnginePrivate; diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 61a1464087..c48ba3c35d 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeerror.cpp b/src/declarative/qml/qdeclarativeerror.cpp index a538c75151..2addd68f7c 100644 --- a/src/declarative/qml/qdeclarativeerror.cpp +++ b/src/declarative/qml/qdeclarativeerror.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeerror.h b/src/declarative/qml/qdeclarativeerror.h index 0de1628b82..f66186f41f 100644 --- a/src/declarative/qml/qdeclarativeerror.h +++ b/src/declarative/qml/qdeclarativeerror.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -49,7 +49,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDebug; class QDeclarativeErrorPrivate; diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index f375716de6..e616d0a6d1 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -120,10 +120,11 @@ void QDeclarativeExpressionPrivate::init(QDeclarativeContextData *ctxt, v8::Hand void QDeclarativeExpressionPrivate::init(QDeclarativeContextData *ctxt, const QString &expr, bool isRewritten, QObject *me, const QString &srcUrl, - int lineNumber) + int lineNumber, int columnNumber) { url = srcUrl; line = lineNumber; + column = columnNumber; expression = expr; @@ -159,9 +160,9 @@ QDeclarativeExpressionPrivate::evalFunction(QDeclarativeContextData *ctxt, QObje } QDeclarativeExpression *QDeclarativeExpressionPrivate::create(QDeclarativeContextData *ctxt, QObject *object, const QString &expr, bool isRewritten, - const QString &url, int lineNumber) + const QString &url, int lineNumber, int columnNumber) { - return new QDeclarativeExpression(ctxt, object, expr, isRewritten, url, lineNumber, *new QDeclarativeExpressionPrivate); + return new QDeclarativeExpression(ctxt, object, expr, isRewritten, url, lineNumber, columnNumber, *new QDeclarativeExpressionPrivate); } /*! @@ -206,12 +207,12 @@ QDeclarativeExpression::QDeclarativeExpression() /*! \internal */ QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContextData *ctxt, QObject *object, const QString &expr, bool isRewritten, - const QString &url, int lineNumber, + const QString &url, int lineNumber, int columnNumber, QDeclarativeExpressionPrivate &dd) : QObject(dd, 0) { Q_D(QDeclarativeExpression); - d->init(ctxt, expr, isRewritten, object, url, lineNumber); + d->init(ctxt, expr, isRewritten, object, url, lineNumber, columnNumber); } /*! @@ -250,7 +251,7 @@ QDeclarativeExpression::QDeclarativeExpression(const QDeclarativeScriptString &s if (cdata) d->init(ctxtdata, cdata->primitives.at(id), true, script.scopeObject(), - cdata->name, script.d.data()->lineNumber); + cdata->name, script.d.data()->lineNumber, script.d.data()->columnNumber); else defaultConstruction = true; @@ -695,14 +696,25 @@ int QDeclarativeExpression::lineNumber() const } /*! + Returns the source file column number for this expression. The source location + must have been previously set by calling setSourceLocation(). +*/ +int QDeclarativeExpression::columnNumber() const +{ + Q_D(const QDeclarativeExpression); + return d->column; +} + +/*! Set the location of this expression to \a line of \a url. This information is used by the script engine. */ -void QDeclarativeExpression::setSourceLocation(const QString &url, int line) +void QDeclarativeExpression::setSourceLocation(const QString &url, int line, int column) { Q_D(QDeclarativeExpression); d->url = url; d->line = line; + d->column = column; } /*! diff --git a/src/declarative/qml/qdeclarativeexpression.h b/src/declarative/qml/qdeclarativeexpression.h index dca0692002..4ccc6ca87f 100644 --- a/src/declarative/qml/qdeclarativeexpression.h +++ b/src/declarative/qml/qdeclarativeexpression.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -52,7 +52,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QString; class QDeclarativeRefCount; @@ -80,7 +79,8 @@ public: QString sourceFile() const; int lineNumber() const; - void setSourceLocation(const QString &fileName, int line); + int columnNumber() const; + void setSourceLocation(const QString &fileName, int line, int column = 0); QObject *scopeObject() const; @@ -99,7 +99,7 @@ protected: QDeclarativeExpression(QDeclarativeContextData *, QObject *, void *, QDeclarativeExpressionPrivate &dd); QDeclarativeExpression(QDeclarativeContextData *, QObject *, const QString &, bool, - const QString &, int, QDeclarativeExpressionPrivate &dd); + const QString &, int, int, QDeclarativeExpressionPrivate &dd); private: QDeclarativeExpression(QDeclarativeContextData *, QObject *, const QString &); diff --git a/src/declarative/qml/qdeclarativeexpression_p.h b/src/declarative/qml/qdeclarativeexpression_p.h index 772f448174..b4c9f1a4be 100644 --- a/src/declarative/qml/qdeclarativeexpression_p.h +++ b/src/declarative/qml/qdeclarativeexpression_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -177,7 +177,7 @@ public: void init(QDeclarativeContextData *, const QString &, QObject *); void init(QDeclarativeContextData *, v8::Handle<v8::Function>, QObject *); - void init(QDeclarativeContextData *, const QString &, bool, QObject *, const QString &, int); + void init(QDeclarativeContextData *, const QString &, bool, QObject *, const QString &, int, int); QVariant value(QObject *secondaryScope = 0, bool *isUndefined = 0); @@ -194,7 +194,7 @@ public: const QString &code, const QString &filename, int line, v8::Persistent<v8::Object> *qmlscope = 0); static QDeclarativeExpression *create(QDeclarativeContextData *, QObject *, const QString &, bool, - const QString &, int); + const QString &, int, int); bool expressionFunctionValid:1; bool expressionFunctionRewritten:1; @@ -209,6 +209,7 @@ public: QString url; // This is a QString for a reason. QUrls are slooooooow... int line; + int column; QString name; //function name, hint for the debugger QDeclarativeRefCount *dataRef; diff --git a/src/declarative/qml/qdeclarativeextensioninterface.h b/src/declarative/qml/qdeclarativeextensioninterface.h index a4a931d27d..5675dd568b 100644 --- a/src/declarative/qml/qdeclarativeextensioninterface.h +++ b/src/declarative/qml/qdeclarativeextensioninterface.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -48,7 +48,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeEngine; diff --git a/src/declarative/qml/qdeclarativeextensionplugin.cpp b/src/declarative/qml/qdeclarativeextensionplugin.cpp index c93e4db66c..abdc65239f 100644 --- a/src/declarative/qml/qdeclarativeextensionplugin.cpp +++ b/src/declarative/qml/qdeclarativeextensionplugin.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeextensionplugin.h b/src/declarative/qml/qdeclarativeextensionplugin.h index 52ef13eb5e..cd2b462caa 100644 --- a/src/declarative/qml/qdeclarativeextensionplugin.h +++ b/src/declarative/qml/qdeclarativeextensionplugin.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -50,7 +50,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeEngine; diff --git a/src/declarative/qml/qdeclarativeglobal_p.h b/src/declarative/qml/qdeclarativeglobal_p.h index 63a8fed6c8..9a1f633c94 100644 --- a/src/declarative/qml/qdeclarativeglobal_p.h +++ b/src/declarative/qml/qdeclarativeglobal_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -49,7 +49,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) #define DEFINE_BOOL_CONFIG_OPTION(name, var) \ static bool name() \ diff --git a/src/declarative/qml/qdeclarativeguard_p.h b/src/declarative/qml/qdeclarativeguard_p.h index 35d369609e..ef965a91bb 100644 --- a/src/declarative/qml/qdeclarativeguard_p.h +++ b/src/declarative/qml/qdeclarativeguard_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp index 87a1c5fe01..53f5bd3e2d 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.cpp +++ b/src/declarative/qml/qdeclarativeimageprovider.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeimageprovider.h b/src/declarative/qml/qdeclarativeimageprovider.h index 70305258d5..eb304a2ca4 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.h +++ b/src/declarative/qml/qdeclarativeimageprovider.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -49,7 +49,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeImageProviderPrivate; class QSGTexture; diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index cb634c995b..34527e6414 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -94,6 +94,7 @@ public: int minversion; bool isLibrary; QDeclarativeDirComponents qmlDirComponents; + QDeclarativeDirScripts qmlDirScripts; }; QList<Data> imports; @@ -112,6 +113,7 @@ public: bool importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeImportDatabase *database, QDeclarativeDirComponents* components, + QDeclarativeDirScripts *scripts, QList<QDeclarativeError> *errors); QString resolvedUri(const QString &dir_arg, QDeclarativeImportDatabase *database); @@ -199,15 +201,17 @@ void QDeclarativeImports::populateCache(QDeclarativeTypeNameCache *cache, QDecla ++iter) { const QDeclarativeImportedNamespace &set = *iter.value(); - QDeclarativeTypeNameCache::Import &import = cache->m_namedImports[iter.key()]; for (int ii = set.imports.count() - 1; ii >= 0; --ii) { const QDeclarativeImportedNamespace::Data &data = set.imports.at(ii); QDeclarativeTypeModule *module = QDeclarativeMetaType::typeModule(data.uri, data.majversion); - if (module) + if (module) { + QDeclarativeTypeNameCache::Import &import = cache->m_namedImports[iter.key()]; import.modules.append(QDeclarativeTypeModuleVersion(module, data.minversion)); + } QDeclarativeMetaType::ModuleApi moduleApi = QDeclarativeMetaType::moduleApi(data.uri, data.majversion, data.minversion); if (moduleApi.script || moduleApi.qobject) { + QDeclarativeTypeNameCache::Import &import = cache->m_namedImports[iter.key()]; QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); import.moduleApi = ep->moduleApiInstance(moduleApi); } @@ -215,6 +219,44 @@ void QDeclarativeImports::populateCache(QDeclarativeTypeNameCache *cache, QDecla } } +QList<QDeclarativeImports::ScriptReference> QDeclarativeImports::resolvedScripts() const +{ + QList<QDeclarativeImports::ScriptReference> scripts; + + const QDeclarativeImportedNamespace &set = d->unqualifiedset; + + for (int ii = set.imports.count() - 1; ii >= 0; --ii) { + const QDeclarativeImportedNamespace::Data &data = set.imports.at(ii); + + foreach (const QDeclarativeDirParser::Script &script, data.qmlDirScripts) { + ScriptReference ref; + ref.nameSpace = script.nameSpace; + ref.location = QUrl(data.url).resolved(QUrl(script.fileName)); + scripts.append(ref); + } + } + + for (QHash<QString,QDeclarativeImportedNamespace* >::ConstIterator iter = d->set.constBegin(); + iter != d->set.constEnd(); + ++iter) { + const QDeclarativeImportedNamespace &set = *iter.value(); + + for (int ii = set.imports.count() - 1; ii >= 0; --ii) { + const QDeclarativeImportedNamespace::Data &data = set.imports.at(ii); + + foreach (const QDeclarativeDirParser::Script &script, data.qmlDirScripts) { + ScriptReference ref; + ref.nameSpace = script.nameSpace; + ref.qualifier = iter.key(); + ref.location = QUrl(data.url).resolved(QUrl(script.fileName)); + scripts.append(ref); + } + } + } + + return scripts; +} + /*! \internal @@ -350,9 +392,11 @@ QDeclarativeImportsPrivate::~QDeclarativeImportsPrivate() delete s; } -bool QDeclarativeImportsPrivate::importExtension(const QString &absoluteFilePath, const QString &uri, - QDeclarativeImportDatabase *database, - QDeclarativeDirComponents* components, QList<QDeclarativeError> *errors) +bool QDeclarativeImportsPrivate::importExtension(const QString &absoluteFilePath, const QString &uri, + QDeclarativeImportDatabase *database, + QDeclarativeDirComponents* components, + QDeclarativeDirScripts* scripts, + QList<QDeclarativeError> *errors) { const QDeclarativeDirParser *qmldirParser = typeLoader->qmlDirParser(absoluteFilePath); if (qmldirParser->hasError()) { @@ -406,6 +450,8 @@ bool QDeclarativeImportsPrivate::importExtension(const QString &absoluteFilePath if (components) *components = qmldirParser->components(); + if (scripts) + *scripts = qmldirParser->scripts(); return true; } @@ -450,6 +496,7 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp static QLatin1Char Slash('/'); QDeclarativeDirComponents qmldircomponents = qmldircomponentsnetwork; + QDeclarativeDirScripts qmldirscripts; QString uri = uri_arg; QDeclarativeImportedNamespace *s; if (prefix.isEmpty()) { @@ -486,12 +533,14 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp else url = QUrl::fromLocalFile(fi.absolutePath()).toString(); uri = resolvedUri(dir, database); - if (!importExtension(absoluteFilePath, uri, database, &qmldircomponents, errors)) + if (!importExtension(absoluteFilePath, uri, database, &qmldircomponents, &qmldirscripts, errors)) return false; break; } } + // TODO: Should this search be omitted if found == true? + // step 2: search for extension with encoded version major foreach (const QString &p, database->fileImportPath) { dir = p+Slash+url; @@ -508,7 +557,7 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp else url = QUrl::fromLocalFile(fi.absolutePath()).toString(); uri = resolvedUri(dir, database); - if (!importExtension(absoluteFilePath, uri, database, &qmldircomponents, errors)) + if (!importExtension(absoluteFilePath, uri, database, &qmldircomponents, &qmldirscripts, errors)) return false; break; } @@ -530,7 +579,7 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp else url = QUrl::fromLocalFile(absolutePath).toString(); uri = resolvedUri(dir, database); - if (!importExtension(absoluteFilePath, uri, database, &qmldircomponents, errors)) + if (!importExtension(absoluteFilePath, uri, database, &qmldircomponents, &qmldirscripts, errors)) return false; break; } @@ -540,7 +589,7 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp if (QDeclarativeMetaType::isModule(uri, vmaj, vmin)) versionFound = true; - if (!versionFound && qmldircomponents.isEmpty()) { + if (!versionFound && qmldircomponents.isEmpty() && qmldirscripts.isEmpty()) { if (errors) { QDeclarativeError error; // we don't set the url or line or column as these will be set by the loader. if (QDeclarativeMetaType::isAnyModule(uri)) @@ -570,7 +619,7 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp if (uri.endsWith(Slash)) uri.chop(1); if (!typeLoader->absoluteFilePath(localFileOrQrc).isEmpty()) { - if (!importExtension(localFileOrQrc,uri,database,&qmldircomponents,errors)) + if (!importExtension(localFileOrQrc,uri,database,&qmldircomponents,&qmldirscripts,errors)) return false; } } else { @@ -596,16 +645,18 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp url = resolveLocalUrl(base, url); } - if (!versionFound && vmaj > -1 && vmin > -1 && !qmldircomponents.isEmpty()) { - QList<QDeclarativeDirParser::Component>::ConstIterator it = qmldircomponents.begin(); + if (!versionFound && (vmaj > -1) && (vmin > -1) && !qmldircomponents.isEmpty()) { int lowest_min = INT_MAX; int highest_min = INT_MIN; - for (; it != qmldircomponents.end(); ++it) { - if (it->majorVersion == vmaj) { - lowest_min = qMin(lowest_min, it->minorVersion); - highest_min = qMax(highest_min, it->minorVersion); + + QList<QDeclarativeDirParser::Component>::const_iterator cend = qmldircomponents.constEnd(); + for (QList<QDeclarativeDirParser::Component>::const_iterator cit = qmldircomponents.constBegin(); cit != cend; ++cit) { + if (cit->majorVersion == vmaj) { + lowest_min = qMin(lowest_min, cit->minorVersion); + highest_min = qMax(highest_min, cit->minorVersion); } } + if (lowest_min > vmin || highest_min < vmin) { if (errors) { QDeclarativeError error; // we don't set the url or line or column information, as these will be set by the loader. @@ -619,6 +670,35 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp if (!url.endsWith(Slash)) url += Slash; + QMap<QString, QDeclarativeDirParser::Script> scripts; + + if (!qmldirscripts.isEmpty()) { + // Verify that we haven't imported these scripts already + QList<QDeclarativeImportedNamespace::Data>::const_iterator end = s->imports.constEnd(); + for (QList<QDeclarativeImportedNamespace::Data>::const_iterator it = s->imports.constBegin(); it != end; ++it) { + if (it->uri == uri) { + QDeclarativeError error; + error.setDescription(QDeclarativeImportDatabase::tr("\"%1\" is ambiguous. Found in %2 and in %3").arg(uri).arg(url).arg(it->url)); + errors->prepend(error); + return false; + } + } + + QList<QDeclarativeDirParser::Script>::const_iterator send = qmldirscripts.constEnd(); + for (QList<QDeclarativeDirParser::Script>::const_iterator sit = qmldirscripts.constBegin(); sit != send; ++sit) { + // Only include scripts that match our requested version + if (((vmaj == -1) || (sit->majorVersion == vmaj)) && + ((vmin == -1) || (sit->minorVersion <= vmin))) { + + // Load the highest version that matches + QMap<QString, QDeclarativeDirParser::Script>::iterator it = scripts.find(sit->nameSpace); + if (it == scripts.end() || (it->minorVersion < sit->minorVersion)) { + scripts.insert(sit->nameSpace, *sit); + } + } + } + } + QDeclarativeImportedNamespace::Data data; data.uri = uri; data.url = url; @@ -626,6 +706,8 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp data.minversion = vmin; data.isLibrary = importType == QDeclarativeScript::Import::Library; data.qmlDirComponents = qmldircomponents; + data.qmlDirScripts = scripts.values(); + s->imports.prepend(data); return true; diff --git a/src/declarative/qml/qdeclarativeimport_p.h b/src/declarative/qml/qdeclarativeimport_p.h index a71ccbeb30..a9648c0413 100644 --- a/src/declarative/qml/qdeclarativeimport_p.h +++ b/src/declarative/qml/qdeclarativeimport_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -101,6 +101,15 @@ public: void populateCache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *) const; + struct ScriptReference + { + QString nameSpace; + QString qualifier; + QUrl location; + }; + + QList<ScriptReference> resolvedScripts() const; + private: friend class QDeclarativeImportDatabase; QDeclarativeImportsPrivate *d; diff --git a/src/declarative/qml/qdeclarativeincubator.cpp b/src/declarative/qml/qdeclarativeincubator.cpp index 194c1e1214..6262d2eed0 100644 --- a/src/declarative/qml/qdeclarativeincubator.cpp +++ b/src/declarative/qml/qdeclarativeincubator.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeincubator.h b/src/declarative/qml/qdeclarativeincubator.h index 1699688274..2e281ad9de 100644 --- a/src/declarative/qml/qdeclarativeincubator.h +++ b/src/declarative/qml/qdeclarativeincubator.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -48,7 +48,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeEngine; diff --git a/src/declarative/qml/qdeclarativeincubator_p.h b/src/declarative/qml/qdeclarativeincubator_p.h index 6730fc7bb6..0084107453 100644 --- a/src/declarative/qml/qdeclarativeincubator_p.h +++ b/src/declarative/qml/qdeclarativeincubator_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeinfo.cpp b/src/declarative/qml/qdeclarativeinfo.cpp index e2b20b0f2b..b71739cc93 100644 --- a/src/declarative/qml/qdeclarativeinfo.cpp +++ b/src/declarative/qml/qdeclarativeinfo.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeinfo.h b/src/declarative/qml/qdeclarativeinfo.h index e97d841217..43dd359e6c 100644 --- a/src/declarative/qml/qdeclarativeinfo.h +++ b/src/declarative/qml/qdeclarativeinfo.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -50,7 +50,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeInfoPrivate; class Q_DECLARATIVE_EXPORT QDeclarativeInfo : public QDebug @@ -60,7 +59,6 @@ public: ~QDeclarativeInfo(); inline QDeclarativeInfo &operator<<(QChar t) { QDebug::operator<<(t); return *this; } - inline QDeclarativeInfo &operator<<(QBool t) { QDebug::operator<<(t); return *this; } inline QDeclarativeInfo &operator<<(bool t) { QDebug::operator<<(t); return *this; } inline QDeclarativeInfo &operator<<(char t) { QDebug::operator<<(t); return *this; } inline QDeclarativeInfo &operator<<(signed short t) { QDebug::operator<<(t); return *this; } diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp index 6d3457ad11..10b7940fe3 100644 --- a/src/declarative/qml/qdeclarativeinstruction.cpp +++ b/src/declarative/qml/qdeclarativeinstruction.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h index 08cf7c28b8..155bcf8eca 100644 --- a/src/declarative/qml/qdeclarativeinstruction_p.h +++ b/src/declarative/qml/qdeclarativeinstruction_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -326,6 +326,7 @@ union QDeclarativeInstruction int scope; int bindingId; ushort line; + ushort column; }; struct instr_storeScript { QML_INSTR_HEADER @@ -366,17 +367,10 @@ union QDeclarativeInstruction QML_INSTR_HEADER int propertyIndex; struct QRect { -#if defined(Q_OS_MAC) - int y1; - int x1; - int y2; - int x2; -#else int x1; int y1; int x2; int y2; -#endif } rect; }; struct instr_storeRectF { @@ -407,6 +401,7 @@ union QDeclarativeInstruction int value; short context; ushort line; + ushort column; }; struct instr_assignSignalObject { QML_INSTR_HEADER diff --git a/src/declarative/qml/qdeclarativeintegercache.cpp b/src/declarative/qml/qdeclarativeintegercache.cpp index f4a8f8c6de..6dd2f48e2f 100644 --- a/src/declarative/qml/qdeclarativeintegercache.cpp +++ b/src/declarative/qml/qdeclarativeintegercache.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeintegercache_p.h b/src/declarative/qml/qdeclarativeintegercache_p.h index 64061b43c5..fbedb2f3c7 100644 --- a/src/declarative/qml/qdeclarativeintegercache_p.h +++ b/src/declarative/qml/qdeclarativeintegercache_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativelist.cpp b/src/declarative/qml/qdeclarativelist.cpp index c717ed0509..924d9b13f1 100644 --- a/src/declarative/qml/qdeclarativelist.cpp +++ b/src/declarative/qml/qdeclarativelist.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativelist.h b/src/declarative/qml/qdeclarativelist.h index 5b2d5b4e3b..b3e66eaf9e 100644 --- a/src/declarative/qml/qdeclarativelist.h +++ b/src/declarative/qml/qdeclarativelist.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -50,7 +50,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QObject; struct QMetaObject; diff --git a/src/declarative/qml/qdeclarativelist_p.h b/src/declarative/qml/qdeclarativelist_p.h index 10495e990c..2c33c8200c 100644 --- a/src/declarative/qml/qdeclarativelist_p.h +++ b/src/declarative/qml/qdeclarativelist_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativelistmodel.cpp b/src/declarative/qml/qdeclarativelistmodel.cpp index 5dc546f90e..172511e1a1 100644 --- a/src/declarative/qml/qdeclarativelistmodel.cpp +++ b/src/declarative/qml/qdeclarativelistmodel.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativelistmodel_p.h b/src/declarative/qml/qdeclarativelistmodel_p.h index 256cdf1bd2..e2e55e5028 100644 --- a/src/declarative/qml/qdeclarativelistmodel_p.h +++ b/src/declarative/qml/qdeclarativelistmodel_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -59,7 +59,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeListModelWorkerAgent; class ListModel; diff --git a/src/declarative/qml/qdeclarativelistmodel_p_p.h b/src/declarative/qml/qdeclarativelistmodel_p_p.h index 6b7a3478c7..982667b80b 100644 --- a/src/declarative/qml/qdeclarativelistmodel_p_p.h +++ b/src/declarative/qml/qdeclarativelistmodel_p_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -62,7 +62,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class DynamicRoleModelNode; diff --git a/src/declarative/qml/qdeclarativelistmodelworkeragent.cpp b/src/declarative/qml/qdeclarativelistmodelworkeragent.cpp index dd27f26137..91c0a6c031 100644 --- a/src/declarative/qml/qdeclarativelistmodelworkeragent.cpp +++ b/src/declarative/qml/qdeclarativelistmodelworkeragent.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -92,6 +92,13 @@ QDeclarativeListModelWorkerAgent::QDeclarativeListModelWorkerAgent(QDeclarativeL { } +QDeclarativeListModelWorkerAgent::~QDeclarativeListModelWorkerAgent() +{ + mutex.lock(); + syncDone.wakeAll(); + mutex.unlock(); +} + void QDeclarativeListModelWorkerAgent::setV8Engine(QV8Engine *eng) { m_copy->m_engine = eng; diff --git a/src/declarative/qml/qdeclarativelistmodelworkeragent_p.h b/src/declarative/qml/qdeclarativelistmodelworkeragent_p.h index 9945cad787..6c97fc54b4 100644 --- a/src/declarative/qml/qdeclarativelistmodelworkeragent_p.h +++ b/src/declarative/qml/qdeclarativelistmodelworkeragent_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -65,7 +65,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeListModel; @@ -76,7 +75,7 @@ class QDeclarativeListModelWorkerAgent : public QObject public: QDeclarativeListModelWorkerAgent(QDeclarativeListModel *); - + ~QDeclarativeListModelWorkerAgent(); void setV8Engine(QV8Engine *eng); void addref(); diff --git a/src/declarative/qml/qdeclarativelocale.cpp b/src/declarative/qml/qdeclarativelocale.cpp index 88259c5dbf..b61934d96d 100644 --- a/src/declarative/qml/qdeclarativelocale.cpp +++ b/src/declarative/qml/qdeclarativelocale.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -990,9 +990,9 @@ v8::Handle<v8::Value> QDeclarativeLocale::locale(QV8Engine *v8engine, const QStr */ /*! - \qmlproperty Array<int> QtQuick2::Locale::weekdays + \qmlproperty Array<int> QtQuick2::Locale::weekDays - Holds an array of days that are considered weekdays according to the current locale, + Holds an array of days that are considered week days according to the current locale, where Sunday is 0 and Saturday is 6. \sa firstDayOfWeek diff --git a/src/declarative/qml/qdeclarativelocale_p.h b/src/declarative/qml/qdeclarativelocale_p.h index f4d551b749..0bdf2cea5c 100644 --- a/src/declarative/qml/qdeclarativelocale_p.h +++ b/src/declarative/qml/qdeclarativelocale_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -53,7 +53,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeDateExtension { diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index 6fa71d06fd..c4b5ffe45f 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h index c1853f0033..4e797a121a 100644 --- a/src/declarative/qml/qdeclarativemetatype_p.h +++ b/src/declarative/qml/qdeclarativemetatype_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp index fd08baddf1..e5d12179fe 100644 --- a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp +++ b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.h b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.h index c55f8e30bf..d4889dfcfd 100644 --- a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.h +++ b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -48,7 +48,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QNetworkAccessManager; class Q_DECLARATIVE_EXPORT QDeclarativeNetworkAccessManagerFactory diff --git a/src/declarative/qml/qdeclarativenotifier.cpp b/src/declarative/qml/qdeclarativenotifier.cpp index 8c605fa0fa..f204933014 100644 --- a/src/declarative/qml/qdeclarativenotifier.cpp +++ b/src/declarative/qml/qdeclarativenotifier.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativenotifier_p.h b/src/declarative/qml/qdeclarativenotifier_p.h index f6e1bfc861..b6cfdf7be7 100644 --- a/src/declarative/qml/qdeclarativenotifier_p.h +++ b/src/declarative/qml/qdeclarativenotifier_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativenullablevalue_p_p.h b/src/declarative/qml/qdeclarativenullablevalue_p_p.h index 5d04f53b09..f4da89d6ca 100644 --- a/src/declarative/qml/qdeclarativenullablevalue_p_p.h +++ b/src/declarative/qml/qdeclarativenullablevalue_p_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeopenmetaobject.cpp b/src/declarative/qml/qdeclarativeopenmetaobject.cpp index 6dbd254421..c9eb1511b4 100644 --- a/src/declarative/qml/qdeclarativeopenmetaobject.cpp +++ b/src/declarative/qml/qdeclarativeopenmetaobject.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeopenmetaobject_p.h b/src/declarative/qml/qdeclarativeopenmetaobject_p.h index a3f3bf710d..c2f537ce7f 100644 --- a/src/declarative/qml/qdeclarativeopenmetaobject_p.h +++ b/src/declarative/qml/qdeclarativeopenmetaobject_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -54,7 +54,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeEngine; class QMetaPropertyBuilder; diff --git a/src/declarative/qml/qdeclarativeparserstatus.cpp b/src/declarative/qml/qdeclarativeparserstatus.cpp index ebf4715223..e6ad673ada 100644 --- a/src/declarative/qml/qdeclarativeparserstatus.cpp +++ b/src/declarative/qml/qdeclarativeparserstatus.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeparserstatus.h b/src/declarative/qml/qdeclarativeparserstatus.h index 460600af75..6f628fa3c8 100644 --- a/src/declarative/qml/qdeclarativeparserstatus.h +++ b/src/declarative/qml/qdeclarativeparserstatus.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -48,7 +48,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class Q_DECLARATIVE_EXPORT QDeclarativeParserStatus { diff --git a/src/declarative/qml/qdeclarativeprivate.h b/src/declarative/qml/qdeclarativeprivate.h index 396e9dfc19..8329f6b927 100644 --- a/src/declarative/qml/qdeclarativeprivate.h +++ b/src/declarative/qml/qdeclarativeprivate.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -60,7 +60,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) typedef QObject *(*QDeclarativeAttachedPropertiesFunc)(QObject *); diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index b393b77b5f..ff03018f00 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -1052,6 +1052,22 @@ QVariant QDeclarativePropertyPrivate::readValueProperty() } } +static QUrl urlFromUserString(const QByteArray &data) +{ + QUrl u; + if (!data.isEmpty()) + { + // Preserve any valid percent-encoded octets supplied by the source + u.setEncodedUrl(data, QUrl::TolerantMode); + } + return u; +} + +static QUrl urlFromUserString(const QString &data) +{ + return urlFromUserString(data.toUtf8()); +} + // helper function to allow assignment / binding to QList<QUrl> properties. static QVariant resolvedUrlSequence(const QVariant &value, QDeclarativeContextData *context) { @@ -1059,19 +1075,19 @@ static QVariant resolvedUrlSequence(const QVariant &value, QDeclarativeContextDa if (value.userType() == qMetaTypeId<QUrl>()) { urls.append(value.toUrl()); } else if (value.userType() == qMetaTypeId<QString>()) { - urls.append(QUrl(value.toString())); + urls.append(urlFromUserString(value.toString())); } else if (value.userType() == qMetaTypeId<QByteArray>()) { - urls.append(QUrl(QString::fromUtf8(value.toByteArray()))); + urls.append(urlFromUserString(value.toByteArray())); } else if (value.userType() == qMetaTypeId<QList<QUrl> >()) { urls = value.value<QList<QUrl> >(); } else if (value.userType() == qMetaTypeId<QStringList>()) { QStringList urlStrings = value.value<QStringList>(); for (int i = 0; i < urlStrings.size(); ++i) - urls.append(QUrl(urlStrings.at(i))); + urls.append(urlFromUserString(urlStrings.at(i))); } else if (value.userType() == qMetaTypeId<QList<QString> >()) { QList<QString> urlStrings = value.value<QList<QString> >(); for (int i = 0; i < urlStrings.size(); ++i) - urls.append(QUrl(urlStrings.at(i))); + urls.append(urlFromUserString(urlStrings.at(i))); } // note: QList<QByteArray> is not currently supported. QList<QUrl> resolvedUrls; @@ -1211,10 +1227,10 @@ bool QDeclarativePropertyPrivate::write(QObject *object, u = value.toUrl(); found = true; } else if (variantType == QVariant::ByteArray) { - u = QUrl(QString::fromUtf8(value.toByteArray())); + u = urlFromUserString(value.toByteArray()); found = true; } else if (variantType == QVariant::String) { - u = QUrl(value.toString()); + u = urlFromUserString(value.toString()); found = true; } diff --git a/src/declarative/qml/qdeclarativeproperty.h b/src/declarative/qml/qdeclarativeproperty.h index b58d780050..5b26eacdcd 100644 --- a/src/declarative/qml/qdeclarativeproperty.h +++ b/src/declarative/qml/qdeclarativeproperty.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -48,7 +48,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QObject; class QVariant; diff --git a/src/declarative/qml/qdeclarativeproperty_p.h b/src/declarative/qml/qdeclarativeproperty_p.h index ecb67b8f74..1edd611711 100644 --- a/src/declarative/qml/qdeclarativeproperty_p.h +++ b/src/declarative/qml/qdeclarativeproperty_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index c3f197d941..30f207bede 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h index 9d3ccf82aa..be32075e30 100644 --- a/src/declarative/qml/qdeclarativepropertycache_p.h +++ b/src/declarative/qml/qdeclarativepropertycache_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativepropertyvalueinterceptor.cpp b/src/declarative/qml/qdeclarativepropertyvalueinterceptor.cpp index 891db32005..6bdabe0354 100644 --- a/src/declarative/qml/qdeclarativepropertyvalueinterceptor.cpp +++ b/src/declarative/qml/qdeclarativepropertyvalueinterceptor.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativepropertyvalueinterceptor_p.h b/src/declarative/qml/qdeclarativepropertyvalueinterceptor_p.h index 1142989895..2d77648e43 100644 --- a/src/declarative/qml/qdeclarativepropertyvalueinterceptor_p.h +++ b/src/declarative/qml/qdeclarativepropertyvalueinterceptor_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativepropertyvaluesource.cpp b/src/declarative/qml/qdeclarativepropertyvaluesource.cpp index ee6269d0cd..e6bfe5500b 100644 --- a/src/declarative/qml/qdeclarativepropertyvaluesource.cpp +++ b/src/declarative/qml/qdeclarativepropertyvaluesource.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativepropertyvaluesource.h b/src/declarative/qml/qdeclarativepropertyvaluesource.h index deb01912f3..7bf89214cf 100644 --- a/src/declarative/qml/qdeclarativepropertyvaluesource.h +++ b/src/declarative/qml/qdeclarativepropertyvaluesource.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -48,7 +48,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeProperty; class Q_DECLARATIVE_EXPORT QDeclarativePropertyValueSource diff --git a/src/declarative/qml/qdeclarativeproxymetaobject.cpp b/src/declarative/qml/qdeclarativeproxymetaobject.cpp index 57f5c3a543..eeb4e86114 100644 --- a/src/declarative/qml/qdeclarativeproxymetaobject.cpp +++ b/src/declarative/qml/qdeclarativeproxymetaobject.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeproxymetaobject_p.h b/src/declarative/qml/qdeclarativeproxymetaobject_p.h index 315983caf1..ad6947f240 100644 --- a/src/declarative/qml/qdeclarativeproxymetaobject_p.h +++ b/src/declarative/qml/qdeclarativeproxymetaobject_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -65,7 +65,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeProxyMetaObject : public QAbstractDynamicMetaObject { diff --git a/src/declarative/qml/qdeclarativerewrite.cpp b/src/declarative/qml/qdeclarativerewrite.cpp index 7749925d8b..fd072ec3f5 100644 --- a/src/declarative/qml/qdeclarativerewrite.cpp +++ b/src/declarative/qml/qdeclarativerewrite.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativerewrite_p.h b/src/declarative/qml/qdeclarativerewrite_p.h index cbce79028c..33a415d614 100644 --- a/src/declarative/qml/qdeclarativerewrite_p.h +++ b/src/declarative/qml/qdeclarativerewrite_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativescript.cpp b/src/declarative/qml/qdeclarativescript.cpp index cbb2bc2cac..f699fed8ba 100644 --- a/src/declarative/qml/qdeclarativescript.cpp +++ b/src/declarative/qml/qdeclarativescript.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -679,9 +679,9 @@ ProcessAST::defineObjectBinding(AST::UiQualifiedId *propertyName, AST::UiObjectInitializer *initializer) { int lastTypeDot = objectType.lastIndexOf(QLatin1Char('.')); - bool isType = !objectType.isEmpty() && - (objectType.at(0).isUpper() || - (lastTypeDot >= 0 && objectType.at(lastTypeDot+1).isUpper())); + + // With no preceding qualification, first char is at (-1 + 1) == 0 + bool isType = !objectType.isEmpty() && objectType.at(lastTypeDot+1).isUpper(); int propertyCount = 0; for (AST::UiQualifiedId *name = propertyName; name; name = name->next){ @@ -701,11 +701,26 @@ ProcessAST::defineObjectBinding(AST::UiQualifiedId *propertyName, if (!isType) { - if(propertyCount || !currentObject()) { + // Is the identifier qualified by a namespace? + int namespaceLength = 0; + if (lastTypeDot > 0) { + const QString qualifier(objectType.left(lastTypeDot)); + + for (int ii = 0; ii < _parser->_imports.count(); ++ii) { + const QDeclarativeScript::Import &import = _parser->_imports.at(ii); + if (import.qualifier == qualifier) { + // The qualifier is a namespace - expect a type here + namespaceLength = qualifier.length() + 1; + break; + } + } + } + + if (propertyCount || !currentObject() || namespaceLength) { QDeclarativeError error; error.setDescription(QCoreApplication::translate("QDeclarativeParser","Expected type name")); error.setLine(typeLocation.startLine); - error.setColumn(typeLocation.startColumn); + error.setColumn(typeLocation.startColumn + namespaceLength); _parser->_errors << error; return 0; } diff --git a/src/declarative/qml/qdeclarativescript_p.h b/src/declarative/qml/qdeclarativescript_p.h index 4063c3ba95..d76f788021 100644 --- a/src/declarative/qml/qdeclarativescript_p.h +++ b/src/declarative/qml/qdeclarativescript_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -67,7 +67,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QByteArray; class QDeclarativePropertyCache; diff --git a/src/declarative/qml/qdeclarativescriptstring.cpp b/src/declarative/qml/qdeclarativescriptstring.cpp index 666e187889..1142c026c3 100644 --- a/src/declarative/qml/qdeclarativescriptstring.cpp +++ b/src/declarative/qml/qdeclarativescriptstring.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativescriptstring.h b/src/declarative/qml/qdeclarativescriptstring.h index 20bbc1bcf7..074d91df59 100644 --- a/src/declarative/qml/qdeclarativescriptstring.h +++ b/src/declarative/qml/qdeclarativescriptstring.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -50,7 +50,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QObject; class QDeclarativeContext; diff --git a/src/declarative/qml/qdeclarativescriptstring_p.h b/src/declarative/qml/qdeclarativescriptstring_p.h index 1c5bd29987..8ec880a96a 100644 --- a/src/declarative/qml/qdeclarativescriptstring_p.h +++ b/src/declarative/qml/qdeclarativescriptstring_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -49,13 +49,14 @@ QT_BEGIN_NAMESPACE class QDeclarativeScriptStringPrivate : public QSharedData { public: - QDeclarativeScriptStringPrivate() : context(0), scope(0), bindingId(-1), lineNumber(-1) {} + QDeclarativeScriptStringPrivate() : context(0), scope(0), bindingId(-1), lineNumber(-1), columnNumber(-1) {} QDeclarativeContext *context; QObject *scope; QString script; int bindingId; int lineNumber; + int columnNumber; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativesqldatabase.cpp b/src/declarative/qml/qdeclarativesqldatabase.cpp index c21d47234f..5f7100e49b 100644 --- a/src/declarative/qml/qdeclarativesqldatabase.cpp +++ b/src/declarative/qml/qdeclarativesqldatabase.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativesqldatabase_p.h b/src/declarative/qml/qdeclarativesqldatabase_p.h index 605e5d527b..cf093eefad 100644 --- a/src/declarative/qml/qdeclarativesqldatabase_p.h +++ b/src/declarative/qml/qdeclarativesqldatabase_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativestringconverters.cpp b/src/declarative/qml/qdeclarativestringconverters.cpp index 40a3801423..2753fca455 100644 --- a/src/declarative/qml/qdeclarativestringconverters.cpp +++ b/src/declarative/qml/qdeclarativestringconverters.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativestringconverters_p.h b/src/declarative/qml/qdeclarativestringconverters_p.h index eb3f6076e9..b8efc803e6 100644 --- a/src/declarative/qml/qdeclarativestringconverters_p.h +++ b/src/declarative/qml/qdeclarativestringconverters_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp index cbc075dac3..bf319e5387 100644 --- a/src/declarative/qml/qdeclarativetypeloader.cpp +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -1427,6 +1427,11 @@ const QList<QDeclarativeTypeData::ScriptReference> &QDeclarativeTypeData::resolv return m_scripts; } +const QSet<QString> &QDeclarativeTypeData::namespaces() const +{ + return m_namespaces; +} + QDeclarativeCompiledData *QDeclarativeTypeData::compiledData() const { if (m_compiledData) @@ -1648,6 +1653,27 @@ void QDeclarativeTypeData::resolveTypes() } } + // Add any imported scripts to our resolved set + foreach (const QDeclarativeImports::ScriptReference &script, m_imports.resolvedScripts()) + { + QDeclarativeScriptBlob *blob = typeLoader()->getScript(script.location); + addDependency(blob); + + ScriptReference ref; + //ref.location = ... + ref.qualifier = script.nameSpace; + if (!script.qualifier.isEmpty()) + { + ref.qualifier.prepend(script.qualifier + QLatin1Char('.')); + + // Add a reference to the enclosing namespace + m_namespaces.insert(script.qualifier); + } + + ref.script = blob; + m_scripts << ref; + } + foreach (QDeclarativeScript::TypeReference *parserRef, scriptParser.referencedTypes()) { TypeReference ref; diff --git a/src/declarative/qml/qdeclarativetypeloader_p.h b/src/declarative/qml/qdeclarativetypeloader_p.h index 7a4db21939..7b29f4b233 100644 --- a/src/declarative/qml/qdeclarativetypeloader_p.h +++ b/src/declarative/qml/qdeclarativetypeloader_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -294,6 +294,7 @@ public: const QList<TypeReference> &resolvedTypes() const; const QList<ScriptReference> &resolvedScripts() const; + const QSet<QString> &namespaces() const; QDeclarativeCompiledData *compiledData() const; @@ -327,6 +328,8 @@ private: QList<ScriptReference> m_scripts; QList<QDeclarativeQmldirData *> m_qmldirs; + QSet<QString> m_namespaces; + QList<TypeReference> m_types; bool m_typesResolved:1; diff --git a/src/declarative/qml/qdeclarativetypenamecache.cpp b/src/declarative/qml/qdeclarativetypenamecache.cpp index 2499f1d0c7..58ab1998c6 100644 --- a/src/declarative/qml/qdeclarativetypenamecache.cpp +++ b/src/declarative/qml/qdeclarativetypenamecache.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -53,85 +53,71 @@ QDeclarativeTypeNameCache::~QDeclarativeTypeNameCache() { } -void QDeclarativeTypeNameCache::add(const QHashedString &name, int importedScriptIndex) +void QDeclarativeTypeNameCache::add(const QHashedString &name, int importedScriptIndex, const QHashedString &nameSpace) { + Import import; + import.scriptIndex = importedScriptIndex; + + if (nameSpace.length() != 0) { + Import *i = m_namedImports.value(nameSpace); + Q_ASSERT(i != 0); + m_namespacedImports[i].insert(name, import); + return; + } + if (m_namedImports.contains(name)) return; - Import import; - import.scriptIndex = importedScriptIndex; m_namedImports.insert(name, import); } QDeclarativeTypeNameCache::Result QDeclarativeTypeNameCache::query(const QHashedStringRef &name) { - Import *i = m_namedImports.value(name); - if (i) { - if (i->scriptIndex != -1) - return Result(i->scriptIndex); - else - return Result((const void *)i); - } + Result result = query(m_namedImports, name); - for (int ii = 0; ii < m_anonymousImports.count(); ++ii) { - if (QDeclarativeType *type = m_anonymousImports.at(ii).type(name)) - return Result(type); - } + if (!result.isValid()) + result = typeSearch(m_anonymousImports, name); - return Result(); + return result; } QDeclarativeTypeNameCache::Result QDeclarativeTypeNameCache::query(const QHashedStringRef &name, const void *importNamespace) { Q_ASSERT(importNamespace); - Import *i = (Import *)importNamespace; + const Import *i = static_cast<const Import *>(importNamespace); Q_ASSERT(i->scriptIndex == -1); - for (int ii = 0; ii < i->modules.count(); ++ii) { - if (QDeclarativeType *type = i->modules.at(ii).type(name)) - return Result(type); - } - - return Result(); + return typeSearch(i->modules, name); } QDeclarativeTypeNameCache::Result QDeclarativeTypeNameCache::query(const QHashedV8String &name) { - Import *i = m_namedImports.value(name); - if (i) { - if (i->scriptIndex != -1) - return Result(i->scriptIndex); - else - return Result((const void *)i); - } + Result result = query(m_namedImports, name); - for (int ii = 0; ii < m_anonymousImports.count(); ++ii) { - if (QDeclarativeType *type = m_anonymousImports.at(ii).type(name)) - return Result(type); - } + if (!result.isValid()) + result = typeSearch(m_anonymousImports, name); - return Result(); + return result; } QDeclarativeTypeNameCache::Result QDeclarativeTypeNameCache::query(const QHashedV8String &name, const void *importNamespace) { Q_ASSERT(importNamespace); - Import *i = (Import *)importNamespace; + const Import *i = static_cast<const Import *>(importNamespace); Q_ASSERT(i->scriptIndex == -1); - for (int ii = 0; ii < i->modules.count(); ++ii) { - if (QDeclarativeType *type = i->modules.at(ii).type(name)) - return Result(type); - } - - return Result(); + QMap<const Import *, QStringHash<Import> >::const_iterator it = m_namespacedImports.find(i); + if (it != m_namespacedImports.constEnd()) + return query(*it, name); + + return typeSearch(i->modules, name); } QDeclarativeMetaType::ModuleApiInstance *QDeclarativeTypeNameCache::moduleApi(const void *importNamespace) { Q_ASSERT(importNamespace); - Import *i = (Import *)importNamespace; + const Import *i = static_cast<const Import *>(importNamespace); Q_ASSERT(i->scriptIndex == -1); return i->moduleApi; diff --git a/src/declarative/qml/qdeclarativetypenamecache_p.h b/src/declarative/qml/qdeclarativetypenamecache_p.h index 188e293830..8edc34d293 100644 --- a/src/declarative/qml/qdeclarativetypenamecache_p.h +++ b/src/declarative/qml/qdeclarativetypenamecache_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -73,7 +73,7 @@ public: inline bool isEmpty() const; - void add(const QHashedString &, int); + void add(const QHashedString &name, int sciptIndex = -1, const QHashedString &nameSpace = QHashedString()); struct Result { inline Result(); @@ -107,7 +107,35 @@ private: int scriptIndex; }; + template<typename Key> + Result query(const QStringHash<Import> &imports, Key key) + { + Import *i = imports.value(key); + if (i) { + if (i->scriptIndex != -1) { + return Result(i->scriptIndex); + } else { + return Result(static_cast<const void *>(i)); + } + } + + return Result(); + } + + template<typename Key> + Result typeSearch(const QVector<QDeclarativeTypeModuleVersion> &modules, Key key) + { + QVector<QDeclarativeTypeModuleVersion>::const_iterator end = modules.constEnd(); + for (QVector<QDeclarativeTypeModuleVersion>::const_iterator it = modules.constBegin(); it != end; ++it) { + if (QDeclarativeType *type = it->type(key)) + return Result(type); + } + + return Result(); + } + QStringHash<Import> m_namedImports; + QMap<const Import *, QStringHash<Import> > m_namespacedImports; QVector<QDeclarativeTypeModuleVersion> m_anonymousImports; QDeclarativeEngine *engine; @@ -144,7 +172,7 @@ bool QDeclarativeTypeNameCache::Result::isValid() const } QDeclarativeTypeNameCache::Import::Import() -: scriptIndex(-1) +: moduleApi(0), scriptIndex(-1) { } diff --git a/src/declarative/qml/qdeclarativetypenotavailable.cpp b/src/declarative/qml/qdeclarativetypenotavailable.cpp index 273de1bfb0..a2121f45cf 100644 --- a/src/declarative/qml/qdeclarativetypenotavailable.cpp +++ b/src/declarative/qml/qdeclarativetypenotavailable.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativetypenotavailable_p.h b/src/declarative/qml/qdeclarativetypenotavailable_p.h index 7adce6c98d..5faf242cf1 100644 --- a/src/declarative/qml/qdeclarativetypenotavailable_p.h +++ b/src/declarative/qml/qdeclarativetypenotavailable_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -48,7 +48,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeTypeNotAvailable : public QObject { Q_OBJECT diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp index 8ba9482cea..9e5dc9040a 100644 --- a/src/declarative/qml/qdeclarativevaluetype.cpp +++ b/src/declarative/qml/qdeclarativevaluetype.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h index 207b80921b..145a8e3302 100644 --- a/src/declarative/qml/qdeclarativevaluetype_p.h +++ b/src/declarative/qml/qdeclarativevaluetype_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 5067bcf95e..25a62d862a 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -711,7 +711,7 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors, QDeclarativeBoundSignal *bs = new QDeclarativeBoundSignal(target, signal, target); QDeclarativeExpression *expr = - new QDeclarativeExpression(CTXT, context, PRIMITIVES.at(instr.value), true, COMP->name, instr.line, *new QDeclarativeExpressionPrivate); + new QDeclarativeExpression(CTXT, context, PRIMITIVES.at(instr.value), true, COMP->name, instr.line, instr.column, *new QDeclarativeExpressionPrivate); bs->setExpression(expr); QML_END_INSTR(StoreSignal) @@ -728,6 +728,7 @@ QObject *QDeclarativeVME::run(QList<QDeclarativeError> *errors, ss.setScript(PRIMITIVES.at(instr.value)); ss.d.data()->bindingId = instr.bindingId; ss.d.data()->lineNumber = instr.line; + ss.d.data()->columnNumber = instr.column; void *a[] = { &ss, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, diff --git a/src/declarative/qml/qdeclarativevme_p.h b/src/declarative/qml/qdeclarativevme_p.h index 941381e90d..3797862ffe 100644 --- a/src/declarative/qml/qdeclarativevme_p.h +++ b/src/declarative/qml/qdeclarativevme_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp index 0955fc0689..f33d2f3cad 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject.cpp +++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativevmemetaobject_p.h b/src/declarative/qml/qdeclarativevmemetaobject_p.h index c349546b72..5c5599b31d 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject_p.h +++ b/src/declarative/qml/qdeclarativevmemetaobject_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativewatcher.cpp b/src/declarative/qml/qdeclarativewatcher.cpp index 3fca66b1a6..9ab967b0e5 100644 --- a/src/declarative/qml/qdeclarativewatcher.cpp +++ b/src/declarative/qml/qdeclarativewatcher.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativewatcher_p.h b/src/declarative/qml/qdeclarativewatcher_p.h index c8b31424b1..eebaede117 100644 --- a/src/declarative/qml/qdeclarativewatcher_p.h +++ b/src/declarative/qml/qdeclarativewatcher_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index 253bff5b36..bc7e645bec 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -478,6 +478,10 @@ QDeclarativeWorkerScriptEngine::~QDeclarativeWorkerScriptEngine() QCoreApplication::postEvent(d, new QEvent((QEvent::Type)QDeclarativeWorkerScriptEnginePrivate::WorkerDestroyEvent)); d->m_lock.unlock(); + //We have to force to cleanup the main thread's event queue here + //to make sure the main GUI release all pending locks/wait conditions which + //some worker script/agent are waiting for (QDeclarativeListModelWorkerAgent::sync() for example). + QCoreApplication::processEvents(); wait(); d->deleteLater(); } diff --git a/src/declarative/qml/qdeclarativeworkerscript_p.h b/src/declarative/qml/qdeclarativeworkerscript_p.h index a3e04a88d8..1993ee04fb 100644 --- a/src/declarative/qml/qdeclarativeworkerscript_p.h +++ b/src/declarative/qml/qdeclarativeworkerscript_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -64,7 +64,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDeclarativeWorkerScript; class QDeclarativeWorkerScriptEnginePrivate; diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp index e72f61b52d..b4577a8fcd 100644 --- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp +++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qdeclarativexmlhttprequest_p.h b/src/declarative/qml/qdeclarativexmlhttprequest_p.h index 3014295561..7bfac68e97 100644 --- a/src/declarative/qml/qdeclarativexmlhttprequest_p.h +++ b/src/declarative/qml/qdeclarativexmlhttprequest_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qlistmodelinterface.cpp b/src/declarative/qml/qlistmodelinterface.cpp index b322727b0e..8ab0f59647 100644 --- a/src/declarative/qml/qlistmodelinterface.cpp +++ b/src/declarative/qml/qlistmodelinterface.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclaractive module of the Qt Toolkit. ** diff --git a/src/declarative/qml/qlistmodelinterface_p.h b/src/declarative/qml/qlistmodelinterface_p.h index ea68b12ea8..c94f1116ac 100644 --- a/src/declarative/qml/qlistmodelinterface_p.h +++ b/src/declarative/qml/qlistmodelinterface_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -51,7 +51,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class Q_DECLARATIVE_PRIVATE_EXPORT QListModelInterface : public QObject { diff --git a/src/declarative/qml/rewriter/textwriter.cpp b/src/declarative/qml/rewriter/textwriter.cpp index eee5d70dbd..20c0c19cbf 100644 --- a/src/declarative/qml/rewriter/textwriter.cpp +++ b/src/declarative/qml/rewriter/textwriter.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/rewriter/textwriter_p.h b/src/declarative/qml/rewriter/textwriter_p.h index 1f70a48fe3..0def353f71 100644 --- a/src/declarative/qml/rewriter/textwriter_p.h +++ b/src/declarative/qml/rewriter/textwriter_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v4/qv4bindings.cpp b/src/declarative/qml/v4/qv4bindings.cpp index 4e0c1821a5..fb9f8920dd 100644 --- a/src/declarative/qml/v4/qv4bindings.cpp +++ b/src/declarative/qml/v4/qv4bindings.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -245,7 +245,7 @@ void QV4Bindings::Binding::update(QDeclarativePropertyPrivate::WriteFlags flags) QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Binding); if (parent->context()) QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::Binding, - parent->context()->url, line); + parent->context()->url, line, column); parent->run(this, flags); QDeclarativeDebugTrace::endRange(QDeclarativeDebugTrace::Binding); } @@ -420,15 +420,16 @@ inline static QUrl toUrl(Register *reg, int type, QDeclarativeContextData *conte if (vt == QVariant::Url) { base = var->toUrl(); } else if (vt == QVariant::ByteArray) { - base = QUrl(QString::fromUtf8(var->toByteArray())); + // Preserve any valid percent-encoded octets supplied by the source + base.setEncodedUrl(var->toByteArray(), QUrl::TolerantMode); } else if (vt == QVariant::String) { - base = QUrl(var->toString()); + base.setEncodedUrl(var->toString().toUtf8(), QUrl::TolerantMode); } else { if (ok) *ok = false; return QUrl(); } } else if (type == QMetaType::QString) { - base = QUrl(*reg->getstringptr()); + base.setEncodedUrl(reg->getstringptr()->toUtf8(), QUrl::TolerantMode); } else { if (ok) *ok = false; return QUrl(); @@ -974,7 +975,7 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, output.cleanupString(); MARK_CLEAN_REGISTER(instr->unaryop.output); } - output.setint(tmp.toInt32()); + output.setint(tmp.toInt()); } } QML_V4_END_INSTR(ConvertStringToInt, unaryop) @@ -1012,7 +1013,10 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, output.cleanupString(); MARK_CLEAN_REGISTER(instr->unaryop.output); } - new (output.geturlptr()) QUrl(tmp); + QUrl *urlPtr = output.geturlptr(); + new (urlPtr) QUrl(); + urlPtr->setEncodedUrl(tmp.toUtf8(), QUrl::TolerantMode); + URL_REGISTER(instr->unaryop.output); } } diff --git a/src/declarative/qml/v4/qv4bindings_p.h b/src/declarative/qml/v4/qv4bindings_p.h index 88e293d867..74a86dc072 100644 --- a/src/declarative/qml/v4/qv4bindings_p.h +++ b/src/declarative/qml/v4/qv4bindings_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v4/qv4compiler.cpp b/src/declarative/qml/v4/qv4compiler.cpp index 89f9ad8272..1c58944146 100644 --- a/src/declarative/qml/v4/qv4compiler.cpp +++ b/src/declarative/qml/v4/qv4compiler.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v4/qv4compiler_p.h b/src/declarative/qml/v4/qv4compiler_p.h index da148c7579..94b31653c6 100644 --- a/src/declarative/qml/v4/qv4compiler_p.h +++ b/src/declarative/qml/v4/qv4compiler_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v4/qv4compiler_p_p.h b/src/declarative/qml/v4/qv4compiler_p_p.h index 5d551d2410..7115f51428 100644 --- a/src/declarative/qml/v4/qv4compiler_p_p.h +++ b/src/declarative/qml/v4/qv4compiler_p_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v4/qv4instruction.cpp b/src/declarative/qml/v4/qv4instruction.cpp index bc58c9a9eb..e5156885bd 100644 --- a/src/declarative/qml/v4/qv4instruction.cpp +++ b/src/declarative/qml/v4/qv4instruction.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v4/qv4instruction_p.h b/src/declarative/qml/v4/qv4instruction_p.h index e41537caa8..3be1e80f32 100644 --- a/src/declarative/qml/v4/qv4instruction_p.h +++ b/src/declarative/qml/v4/qv4instruction_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v4/qv4ir.cpp b/src/declarative/qml/v4/qv4ir.cpp index 46af2ee74c..a79900a6c1 100644 --- a/src/declarative/qml/v4/qv4ir.cpp +++ b/src/declarative/qml/v4/qv4ir.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v4/qv4ir_p.h b/src/declarative/qml/v4/qv4ir_p.h index 13f842073f..e1b45844cb 100644 --- a/src/declarative/qml/v4/qv4ir_p.h +++ b/src/declarative/qml/v4/qv4ir_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v4/qv4irbuilder.cpp b/src/declarative/qml/v4/qv4irbuilder.cpp index 087f755a48..452cb43150 100644 --- a/src/declarative/qml/v4/qv4irbuilder.cpp +++ b/src/declarative/qml/v4/qv4irbuilder.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v4/qv4irbuilder_p.h b/src/declarative/qml/v4/qv4irbuilder_p.h index 9b1876c2eb..566ebd9345 100644 --- a/src/declarative/qml/v4/qv4irbuilder_p.h +++ b/src/declarative/qml/v4/qv4irbuilder_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v4/qv4program_p.h b/src/declarative/qml/v4/qv4program_p.h index 216b1763c4..e7eeaf59f2 100644 --- a/src/declarative/qml/v4/qv4program_p.h +++ b/src/declarative/qml/v4/qv4program_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp b/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp index 5153043dc9..830b521027 100644 --- a/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp +++ b/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -80,6 +80,36 @@ enum ConsoleLogTypes { Error }; +static QString extendMessage(const QString &msg) { + if (qmlConsoleExtended()) { + v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(1); + if (stackTrace->GetFrameCount()) { + v8::Local<v8::StackFrame> frame = stackTrace->GetFrame(0); + int line = frame->GetLineNumber(); + QString scriptName = QString::fromUtf16(*v8::String::Value(frame->GetScriptName())); + + return QString::fromLatin1("%1 (%2:%3)").arg(msg).arg(scriptName).arg(line); + } + } + return msg; +} + +static void printStack() { + //The v8 default is currently 10 stack frames. + v8::Handle<v8::StackTrace> stackTrace = + v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kOverview); + int stackCount = stackTrace->GetFrameCount(); + + for (int i = 0; i < stackCount; i++) { + v8::Local<v8::StackFrame> frame = stackTrace->GetFrame(i); + v8::String::Utf8Value func_name(frame->GetFunctionName()); + v8::String::Utf8Value script_name(frame->GetScriptName()); + int lineNumber = frame->GetLineNumber(); + int columnNumber = frame->GetColumn(); + qDebug("%s (%s:%d:%d)\n", *func_name, *script_name, lineNumber, columnNumber); + } +} + v8::Handle<v8::Value> console(ConsoleLogTypes logType, const v8::Arguments &args) { v8::HandleScope handleScope; @@ -105,19 +135,7 @@ v8::Handle<v8::Value> console(ConsoleLogTypes logType, const v8::Arguments &args } } - if (qmlConsoleExtended()) { - int line = -1; - QString scriptName; - //get only current frame - v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(1); - if (stackTrace->GetFrameCount()) { - v8::Local<v8::StackFrame> currentStackFrame = stackTrace->GetFrame(0); - line = currentStackFrame->GetLineNumber(); - scriptName = V8ENGINE()->toString(currentStackFrame->GetScriptName()); - } - - result = QString(QLatin1String("%1 (%2:%3)")).arg(result).arg(scriptName).arg(line); - } + result = extendMessage(result); switch (logType) { case Log: @@ -152,6 +170,7 @@ v8::Handle<v8::Value> consoleLog(const v8::Arguments &args) { //console.log //console.debug + //console.info //print return console(Log, args); } @@ -217,24 +236,39 @@ v8::Handle<v8::Value> consoleTimeEnd(const v8::Arguments &args) return v8::Undefined(); } -v8::Handle<v8::Value> consoleTrace(const v8::Arguments &args) +v8::Handle<v8::Value> consoleCount(const v8::Arguments &args) { - if (args.Length() != 0) - V8THROW_ERROR("console.trace(): Invalid arguments"); + // first argument: name to print. Ignore any additional arguments + QString name; + if (args.Length() > 0) + name = V8ENGINE()->toString(args[0]); - //The v8 default is currently 10 stack frames. v8::Handle<v8::StackTrace> stackTrace = - v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kOverview); - int stackCount = stackTrace->GetFrameCount(); + v8::StackTrace::CurrentStackTrace(1, v8::StackTrace::kOverview); - for (int i = 0; i < stackCount; i++) { - v8::Local<v8::StackFrame> frame = stackTrace->GetFrame(i); - v8::String::Utf8Value func_name(frame->GetFunctionName()); - v8::String::Utf8Value script_name(frame->GetScriptName()); - int lineNumber = frame->GetLineNumber(); - int columnNumber = frame->GetColumn(); - qDebug("%s (%s:%d:%d)\n", *func_name, *script_name, lineNumber, columnNumber); + if (stackTrace->GetFrameCount()) { + v8::Local<v8::StackFrame> frame = stackTrace->GetFrame(0); + + QString scriptName = V8ENGINE()->toString(frame->GetScriptName()); + int line = frame->GetLineNumber(); + int column = frame->GetColumn(); + + int value = V8ENGINE()->consoleCountHelper(scriptName, line, column); + QString message = name + QLatin1String(": ") + QString::number(value); + if (qmlConsoleExtended()) + message = QString::fromLatin1("%1 (%2:%3)").arg(message).arg(scriptName).arg(line); + qDebug("%s", qPrintable(message)); } + + return v8::Undefined(); +} + +v8::Handle<v8::Value> consoleTrace(const v8::Arguments &args) +{ + if (args.Length() != 0) + V8THROW_ERROR("console.trace(): Invalid arguments"); + + printStack(); return v8::Undefined(); } @@ -243,6 +277,38 @@ v8::Handle<v8::Value> consoleWarn(const v8::Arguments &args) return console(Warn, args); } +v8::Handle<v8::Value> consoleAssert(const v8::Arguments &args) +{ + if (args.Length() == 0) + V8THROW_ERROR("console.assert(): Missing argument"); + + if (!args[0]->ToBoolean()->Value()) { + QString message; + for (int i = 1; i < args.Length(); ++i) { + if (i != 1) + message.append(QLatin1Char(' ')); + + v8::Local<v8::Value> value = args[i]; + message.append(V8ENGINE()->toString(value->ToString())); + } + + message = extendMessage(message); + qCritical("%s", qPrintable(message)); + printStack(); + } + return v8::Undefined(); +} + +v8::Handle<v8::Value> consoleException(const v8::Arguments &args) +{ + if (args.Length() == 0) + V8THROW_ERROR("console.exception(): Missing argument"); + console(Error, args); + printStack(); + + return v8::Undefined(); +} + v8::Handle<v8::Value> stringArg(const v8::Arguments &args) { QString value = V8ENGINE()->toString(args.This()->ToString()); diff --git a/src/declarative/qml/v8/qdeclarativebuiltinfunctions_p.h b/src/declarative/qml/v8/qdeclarativebuiltinfunctions_p.h index 815182f2a5..62dcffb367 100644 --- a/src/declarative/qml/v8/qdeclarativebuiltinfunctions_p.h +++ b/src/declarative/qml/v8/qdeclarativebuiltinfunctions_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -67,8 +67,11 @@ v8::Handle<v8::Value> consoleProfile(const v8::Arguments &args); v8::Handle<v8::Value> consoleProfileEnd(const v8::Arguments &args); v8::Handle<v8::Value> consoleTime(const v8::Arguments &args); v8::Handle<v8::Value> consoleTimeEnd(const v8::Arguments &args); +v8::Handle<v8::Value> consoleCount(const v8::Arguments &args); v8::Handle<v8::Value> consoleTrace(const v8::Arguments &args); v8::Handle<v8::Value> consoleWarn(const v8::Arguments &args); +v8::Handle<v8::Value> consoleAssert(const v8::Arguments &args); +v8::Handle<v8::Value> consoleException(const v8::Arguments &args); v8::Handle<v8::Value> isQtObject(const v8::Arguments &args); v8::Handle<v8::Value> rgba(const v8::Arguments &args); v8::Handle<v8::Value> hsla(const v8::Arguments &args); diff --git a/src/declarative/qml/v8/qjsconverter_impl_p.h b/src/declarative/qml/v8/qjsconverter_impl_p.h index d00e9f5760..d5196fd619 100644 --- a/src/declarative/qml/v8/qjsconverter_impl_p.h +++ b/src/declarative/qml/v8/qjsconverter_impl_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qjsconverter_p.h b/src/declarative/qml/v8/qjsconverter_p.h index 442c734c8c..95dee96f25 100644 --- a/src/declarative/qml/v8/qjsconverter_p.h +++ b/src/declarative/qml/v8/qjsconverter_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qjsengine.cpp b/src/declarative/qml/v8/qjsengine.cpp index 6bcd3ab134..97e247a6cb 100644 --- a/src/declarative/qml/v8/qjsengine.cpp +++ b/src/declarative/qml/v8/qjsengine.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -158,6 +158,8 @@ QJSEngine::QJSEngine() { } +#ifdef QT_DEPRECATED + /*! \internal */ @@ -166,6 +168,8 @@ QJSEngine::QJSEngine(QJSEngine::ContextOwnership ownership) { } +#endif // QT_DEPRECATED + /*! Constructs a QJSEngine object with the given \a parent. @@ -198,7 +202,11 @@ QJSEngine::~QJSEngine() \internal */ +#ifdef QT_DEPRECATED + /*! + \obsolete + Returns true if the last script evaluation resulted in an uncaught exception; otherwise returns false. @@ -215,6 +223,8 @@ bool QJSEngine::hasUncaughtException() const } /*! + \obsolete + Returns the current uncaught exception, or an invalid QJSValue if there is no uncaught exception. @@ -233,6 +243,8 @@ QJSValue QJSEngine::uncaughtException() const } /*! + \obsolete + Clears any uncaught exceptions in this engine. \sa hasUncaughtException() @@ -244,6 +256,7 @@ void QJSEngine::clearExceptions() d->clearExceptions(); } +#endif // QT_DEPRECATED /*! Runs the garbage collector. @@ -298,7 +311,11 @@ QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, in return QJSValuePrivate::get(d->evaluate(program, fileName, lineNumber)); } +#ifdef QT_DEPRECATED + /*! + \obsolete + Returns a QJSValue of the primitive type Null. \sa nullValue() @@ -312,6 +329,8 @@ QJSValue QJSEngine::nullValue() } /*! + \obsolete + Returns a QJSValue of the primitive type Undefined. \sa nullValue() @@ -324,6 +343,8 @@ QJSValue QJSEngine::undefinedValue() return QJSValuePrivate::get(new QJSValuePrivate(d, v8::Undefined())); } +#endif // QT_DEPRECATED + /*! Creates a JavaScript object of class Object. @@ -382,7 +403,11 @@ QJSValue QJSEngine::newQObject(QObject *object) return d->scriptValueFromInternal(d->newQObject(object, QV8Engine::JavaScriptOwnership)); } +#ifdef QT_DEPRECATED + /*! + \obsolete + Creates a JavaScript object holding the given variant \a value. If a default prototype has been registered with the meta type id of @@ -400,6 +425,7 @@ QJSValue QJSEngine::newVariant(const QVariant &value) return d->scriptValueFromInternal(d->newVariant(value)); } +#endif // QT_DEPRECATED /*! Returns this engine's Global Object. @@ -419,7 +445,11 @@ QJSValue QJSEngine::globalObject() const return d->scriptValueFromInternal(d->global()); } +#ifdef QT_DEPRECATED + /*! + \obsolete + Converts the given \a value to an object, if such a conversion is possible; otherwise returns an invalid QJSValue. The conversion is performed according to the following table: @@ -445,6 +475,8 @@ QJSValue QJSEngine::toObject(const QJSValue& value) } /*! + \obsolete + Creates a JavaScript object of class Date from the given \a value. \sa QJSValue::toDateTime() @@ -458,6 +490,8 @@ QJSValue QJSEngine::newDate(const QDateTime &dt) } /*! + \obsolete + Creates a JavaScript object of class Date with the given \a value (the number of milliseconds since 01 January 1970, UTC). @@ -471,6 +505,8 @@ QJSValue QJSEngine::newDate(double date) } /*! + \obsolete + Creates a JavaScript object of class RegExp with the given \a regexp. @@ -485,6 +521,8 @@ QJSValue QJSEngine::newRegExp(const QRegExp ®exp) } /*! + \obsolete + Creates a JavaScript object of class RegExp with the given \a pattern and \a flags. @@ -499,6 +537,8 @@ QJSValue QJSEngine::newRegExp(const QString &pattern, const QString &flags) return QJSValuePrivate::get(d->newRegExp(pattern, flags)); } +#endif // QT_DEPRECATED + /*! * \internal * used by QJSEngine::toScriptValue diff --git a/src/declarative/qml/v8/qjsengine.h b/src/declarative/qml/v8/qjsengine.h index 09e055fcaf..877f6555f4 100644 --- a/src/declarative/qml/v8/qjsengine.h +++ b/src/declarative/qml/v8/qjsengine.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -35,7 +35,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QDateTime; class QV8Engine; @@ -51,13 +50,15 @@ class Q_DECLARATIVE_EXPORT QJSEngine { Q_OBJECT public: +#ifdef QT_DEPRECATED enum ContextOwnership { AdoptCurrentContext, CreateNewContext }; + QT_DEPRECATED explicit QJSEngine(ContextOwnership ownership); +#endif QJSEngine(); - explicit QJSEngine(ContextOwnership ownership); explicit QJSEngine(QObject *parent); virtual ~QJSEngine(); @@ -65,22 +66,8 @@ public: QJSValue evaluate(const QString &program, const QString &fileName = QString(), int lineNumber = 1); - bool hasUncaughtException() const; - QJSValue uncaughtException() const; - void clearExceptions(); - - QJSValue nullValue(); - QJSValue undefinedValue(); - - QJSValue newVariant(const QVariant &value); - - QJSValue newRegExp(const QRegExp ®exp); - QJSValue newObject(); QJSValue newArray(uint length = 0); - QJSValue newRegExp(const QString &pattern, const QString &flags); - QJSValue newDate(double value); - QJSValue newDate(const QDateTime &value); QJSValue newQObject(QObject *object); @@ -97,10 +84,27 @@ public: void collectGarbage(); - QJSValue toObject(const QJSValue &value); - QV8Engine *handle() const { return d; } +#ifdef QT_DEPRECATED + QT_DEPRECATED bool hasUncaughtException() const; + QT_DEPRECATED QJSValue uncaughtException() const; + QT_DEPRECATED void clearExceptions(); + + QT_DEPRECATED QJSValue nullValue(); + QT_DEPRECATED QJSValue undefinedValue(); + + QT_DEPRECATED QJSValue newVariant(const QVariant &value); + + QT_DEPRECATED QJSValue newRegExp(const QRegExp ®exp); + + QT_DEPRECATED QJSValue newRegExp(const QString &pattern, const QString &flags); + QT_DEPRECATED QJSValue newDate(double value); + QT_DEPRECATED QJSValue newDate(const QDateTime &value); + + QT_DEPRECATED QJSValue toObject(const QJSValue &value); +#endif + Q_SIGNALS: void signalHandlerException(const QJSValue &exception); diff --git a/src/declarative/qml/v8/qjsengine_p.h b/src/declarative/qml/v8/qjsengine_p.h index 1bb8f416b4..6f4b2812be 100644 --- a/src/declarative/qml/v8/qjsengine_p.h +++ b/src/declarative/qml/v8/qjsengine_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qjsvalue.cpp b/src/declarative/qml/v8/qjsvalue.cpp index 7df1d04847..db77bef2b7 100644 --- a/src/declarative/qml/v8/qjsvalue.cpp +++ b/src/declarative/qml/v8/qjsvalue.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -71,9 +71,9 @@ Object values have an internal \c{prototype} property, which can be accessed with prototype() and setPrototype(). - Function objects (objects for which isFunction() returns true) can + Function objects (objects for which isCallable()) returns true) can be invoked by calling call(). Constructor functions can be used to - construct new objects by calling construct(). + construct new objects by calling callAsConstructor(). Use equals() or strictlyEquals() to compare a QJSValue to another. @@ -213,6 +213,8 @@ QJSValue::QJSValue(QScriptPassPointer<QJSValuePrivate> d) { } +#ifdef QT_DEPRECATED + /*! \obsolete @@ -325,6 +327,8 @@ QJSValue::QJSValue(QJSEngine* engine, SpecialValue value) } } +#endif // QT_DEPRECATED + /*! Constructs a new QJSValue that is a copy of \a other. @@ -344,7 +348,11 @@ QJSValue::~QJSValue() { } +#ifdef QT_DEPRECATED + /*! + \obsolete + Returns true if this QJSValue is valid; otherwise returns false. */ @@ -355,6 +363,8 @@ bool QJSValue::isValid() const return d->isValid(); } +#endif // QT_DEPRECATED + /*! Returns true if this QJSValue is of the primitive type Boolean; otherwise returns false. @@ -461,11 +471,25 @@ bool QJSValue::isObject() const } /*! - Returns true if this QJSValue is a function; otherwise returns - false. + Returns true if this QJSValue can be called a function, otherwise + returns false. \sa call() */ +bool QJSValue::isCallable() const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->isCallable(); +} + +#ifdef QT_DEPRECATED + +/*! + \obsolete + + Use isCallable() instead. +*/ bool QJSValue::isFunction() const { Q_D(const QJSValue); @@ -473,6 +497,8 @@ bool QJSValue::isFunction() const return d->isCallable(); } +#endif // QT_DEPRECATED + /*! Returns true if this QJSValue is a variant value; otherwise returns false. @@ -515,7 +541,7 @@ QString QJSValue::toString() const attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception). - \sa isNumber(), toInteger(), toInt32(), toUInt32(), toUInt16() + \sa isNumber(), toInteger(), toInt(), toUInt(), toUInt16() */ double QJSValue::toNumber() const { @@ -543,7 +569,11 @@ bool QJSValue::toBool() const return d->toBool(); } +#ifdef QT_DEPRECATED + /*! + \obsolete + Returns the integer value of this QJSValue, using the conversion rules described in \l{ECMA-262} section 9.4, "ToInteger". @@ -562,6 +592,8 @@ double QJSValue::toInteger() const return d->toInteger(); } +#endif // QT_DEPRECATED + /*! Returns the signed 32-bit integer value of this QJSValue, using the conversion rules described in \l{ECMA-262} section 9.5, "ToInt32". @@ -572,9 +604,9 @@ double QJSValue::toInteger() const attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception). - \sa toNumber(), toUInt32() + \sa toNumber(), toUInt() */ -qint32 QJSValue::toInt32() const +qint32 QJSValue::toInt() const { Q_D(const QJSValue); QScriptIsolate api(d->engine()); @@ -591,7 +623,33 @@ qint32 QJSValue::toInt32() const attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception). - \sa toNumber(), toInt32() + \sa toNumber(), toInt() +*/ +quint32 QJSValue::toUInt() const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->toUInt32(); +} + +#ifdef QT_DEPRECATED + +/*! + \obsolete + + Use toInt() instead. +*/ +qint32 QJSValue::toInt32() const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->toInt32(); +} + +/*! + \obsolete + + Use toUInt() instead. */ quint32 QJSValue::toUInt32() const { @@ -631,6 +689,8 @@ QJSValue QJSValue::toObject() const return QJSValuePrivate::get(d->toObject()); } +#endif // QT_DEPRECATED + /*! Returns the QVariant value of this QJSValue, if it can be converted to a QVariant; otherwise returns an invalid QVariant. @@ -660,9 +720,31 @@ QVariant QJSValue::toVariant() const return d->toVariant(); } +/*! + Calls this QJSValue as a function, passing \a args as arguments + to the function, and using the globalObject() as the "this"-object. + Returns the value returned from the function. + + If this QJSValue is not callable, call() does nothing and + returns an undefined QJSValue. + + Calling call() can cause an exception to occur in the script engine; + in that case, call() returns the value that was thrown (typically an + \c{Error} object). You can call + QJSEngine::hasUncaughtException() to determine if an exception + occurred. + + \sa isCallable(), callWithInstance(), callAsConstructor() +*/ +QJSValue QJSValue::call(const QJSValueList &args) +{ + Q_D(QJSValue); + QScriptIsolate api(d->engine()); + return d->call(/*thisObject=*/0, args); +} /*! - Calls this QJSValue as a function, using \a thisObject as + Calls this QJSValue as a function, using \a instance as the `this' object in the function call, and passing \a args as arguments to the function. Returns the value returned from the function. @@ -670,7 +752,7 @@ QVariant QJSValue::toVariant() const If this QJSValue is not a function, call() does nothing and returns an invalid QJSValue. - Note that if \a thisObject is not an object, the global object + Note that if \a instance is not an object, the global object (see \l{QJSEngine::globalObject()}) will be used as the `this' object. @@ -680,15 +762,13 @@ QVariant QJSValue::toVariant() const QJSEngine::hasUncaughtException() to determine if an exception occurred. - \snippet doc/src/snippets/code/src_script_qjsvalue.cpp 1 - - \sa construct() + \sa call() */ -QJSValue QJSValue::call(const QJSValue& thisObject, const QJSValueList& args) +QJSValue QJSValue::callWithInstance(const QJSValue &instance, const QJSValueList &args) { Q_D(QJSValue); QScriptIsolate api(d->engine()); - return d->call(QJSValuePrivate::get(thisObject), args); + return d->call(QJSValuePrivate::get(instance), args); } /*! @@ -698,25 +778,53 @@ QJSValue QJSValue::call(const QJSValue& thisObject, const QJSValueList& args) constructor call is an object, then that object is returned; otherwise the default constructed object is returned. - If this QJSValue is not a function, construct() does nothing - and returns an invalid QJSValue. + If this QJSValue is not a function, callAsConstructor() does + nothing and returns an undefined QJSValue. - Calling construct() can cause an exception to occur in the script - engine; in that case, construct() returns the value that was thrown - (typically an \c{Error} object). You can call + Calling this function can cause an exception to occur in the + script engine; in that case, the value that was thrown + (typically an \c{Error} object) is returned. You can call QJSEngine::hasUncaughtException() to determine if an exception occurred. \sa call(), QJSEngine::newObject() */ +QJSValue QJSValue::callAsConstructor(const QJSValueList &args) +{ + Q_D(QJSValue); + QScriptIsolate api(d->engine()); + return QJSValuePrivate::get(d->callAsConstructor(args)); +} + +#ifdef QT_DEPRECATED + +/*! + \obsolete + + Use callWithInstance() instead. +*/ +QJSValue QJSValue::call(const QJSValue& thisObject, const QJSValueList& args) +{ + Q_D(QJSValue); + QScriptIsolate api(d->engine()); + return d->call(QJSValuePrivate::get(thisObject), args); +} + +/*! + \obsolete + + Use callAsConstructor() instead. +*/ QJSValue QJSValue::construct(const QJSValueList &args) { Q_D(QJSValue); QScriptIsolate api(d->engine()); - return QJSValuePrivate::get(d->construct(args)); + return QJSValuePrivate::get(d->callAsConstructor(args)); } /*! + \obsolete + Returns the QJSEngine that created this QJSValue, or 0 if this QJSValue is invalid or the value is not associated with a particular engine. @@ -731,6 +839,7 @@ QJSEngine* QJSValue::engine() const return 0; } +#endif // QT_DEPRECATED /*! If this QJSValue is an object, returns the internal prototype @@ -839,7 +948,11 @@ bool QJSValue::strictlyEquals(const QJSValue& other) const return d_ptr->strictlyEquals(o); } +#ifdef QT_DEPRECATED + /*! + \obsolete + Returns true if this QJSValue is an instance of \a other; otherwise returns false. @@ -855,6 +968,8 @@ bool QJSValue::instanceOf(const QJSValue &other) const return d->instanceOf(QJSValuePrivate::get(other)); } +#endif // QT_DEPRECATED + /*! Returns the value of this QJSValue's property with the given \a name. If no such property exists, an invalid QJSValue is returned. @@ -866,7 +981,7 @@ bool QJSValue::instanceOf(const QJSValue &other) const occurred, property() returns the value that was thrown (typically an \c{Error} object). - \sa setProperty(), propertyFlags(), QJSValueIterator + \sa setProperty(), hasProperty(), QJSValueIterator */ QJSValue QJSValue::property(const QString& name) const { @@ -915,7 +1030,7 @@ QJSValue QJSValue::property(quint32 arrayIndex) const built-in properties, such as the \c{length} property of Array objects or meta properties of QObject objects. - \sa property() + \sa property(), deleteProperty() */ void QJSValue::setProperty(const QString& name, const QJSValue& value) { @@ -944,6 +1059,63 @@ void QJSValue::setProperty(quint32 arrayIndex, const QJSValue& value) } /*! + Attempts to delete this object's property of the given \a name. + Returns true if the property was deleted, otherwise returns false. + + The behavior of this function is consistent with the JavaScript + delete operator. In particular: + + \list + \o Non-configurable properties cannot be deleted. + \o This function will return true even if this object doesn't + have a property of the given \a name (i.e., non-existent + properties are "trivially deletable"). + \o If this object doesn't have an own property of the given + \a name, but an object in the prototype() chain does, the + prototype object's property is not deleted, and this function + returns true. + \endlist + + \sa setProperty(), hasOwnProperty() +*/ +bool QJSValue::deleteProperty(const QString &name) +{ + Q_D(QJSValue); + QScriptIsolate api(d->engine()); + return d->deleteProperty(name); +} + +/*! + Returns true if this object has a property of the given \a name, + otherwise returns false. + + \sa property(), hasOwnProperty() +*/ +bool QJSValue::hasProperty(const QString &name) const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->hasProperty(name); +} + +/*! + Returns true if this object has an own (not prototype-inherited) + property of the given \a name, otherwise returns false. + + \sa property(), hasProperty() +*/ +bool QJSValue::hasOwnProperty(const QString &name) const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->hasOwnProperty(name); +} + +#ifdef QT_DEPRECATED + +/*! + \obsolete + Returns the flags of the property with the given \a name. \sa property() @@ -955,6 +1127,8 @@ QJSValue::PropertyFlags QJSValue::propertyFlags(const QString& name) const return d->propertyFlags(name); } +#endif // QT_DEPRECATED + /*! * If this QJSValue is a QObject, returns the QObject pointer * that the QJSValue represents; otherwise, returns 0. @@ -986,7 +1160,11 @@ QDateTime QJSValue::toDateTime() const return d->toDataTime(); } +#ifdef QT_DEPRECATED + /*! + \obsolete + Returns the QRegExp representation of this value. If this QJSValue is not a regular expression, an empty QRegExp is returned. @@ -1000,6 +1178,8 @@ QRegExp QJSValue::toRegExp() const return d->toRegExp(); } +#endif // QT_DEPRECATED + /*! Returns true if this QJSValue is an object of the Date class; otherwise returns false. diff --git a/src/declarative/qml/v8/qjsvalue.h b/src/declarative/qml/v8/qjsvalue.h index c75bd3fdc4..0acaa16de4 100644 --- a/src/declarative/qml/v8/qjsvalue.h +++ b/src/declarative/qml/v8/qjsvalue.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -34,7 +34,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QJSValue; class QJSEngine; @@ -53,12 +52,14 @@ template <class T> class QScriptPassPointer; class Q_DECLARATIVE_EXPORT QJSValue { public: +#ifdef QT_DEPRECATED enum PropertyFlag { ReadOnly = 0x00000001, Undeletable = 0x00000002, SkipInEnumeration = 0x00000004 }; Q_DECLARE_FLAGS(PropertyFlags, PropertyFlag) +#endif enum SpecialValue { NullValue, @@ -69,12 +70,6 @@ public: QJSValue(); ~QJSValue(); QJSValue(const QJSValue &other); - QJSValue(QJSEngine *engine, SpecialValue val); - QJSValue(QJSEngine *engine, bool val); - QJSValue(QJSEngine *engine, int val); - QJSValue(QJSEngine *engine, uint val); - QJSValue(QJSEngine *engine, double val); - QJSValue(QJSEngine *engine, const QString &val); QJSValue(SpecialValue value); QJSValue(bool value); @@ -89,11 +84,8 @@ public: QJSValue &operator=(const QJSValue &other); - QJSEngine *engine() const; - bool isValid() const; bool isBool() const; bool isNumber() const; - bool isFunction() const; bool isNull() const; bool isString() const; bool isUndefined() const; @@ -107,18 +99,12 @@ public: QString toString() const; double toNumber() const; + qint32 toInt() const; + quint32 toUInt() const; bool toBool() const; - double toInteger() const; - qint32 toInt32() const; - quint32 toUInt32() const; - quint16 toUInt16() const; QVariant toVariant() const; QObject *toQObject() const; - QJSValue toObject() const; QDateTime toDateTime() const; - QRegExp toRegExp() const; - - bool instanceOf(const QJSValue &other) const; bool equals(const QJSValue &other) const; bool strictlyEquals(const QJSValue &other) const; @@ -129,21 +115,55 @@ public: QJSValue property(const QString &name) const; void setProperty(const QString &name, const QJSValue &value); + bool hasProperty(const QString &name) const; + bool hasOwnProperty(const QString &name) const; + QJSValue property(quint32 arrayIndex) const; void setProperty(quint32 arrayIndex, const QJSValue &value); - QJSValue::PropertyFlags propertyFlags(const QString &name) const; + bool deleteProperty(const QString &name); + + bool isCallable() const; + QJSValue call(const QJSValueList &args); + QJSValue callWithInstance(const QJSValue &instance, const QJSValueList &args = QJSValueList()); + QJSValue callAsConstructor(const QJSValueList &args = QJSValueList()); + +#ifdef QT_DEPRECATED + QT_DEPRECATED QJSValue(QJSEngine *engine, SpecialValue val); + QT_DEPRECATED QJSValue(QJSEngine *engine, bool val); + QT_DEPRECATED QJSValue(QJSEngine *engine, int val); + QT_DEPRECATED QJSValue(QJSEngine *engine, uint val); + QT_DEPRECATED QJSValue(QJSEngine *engine, double val); + QT_DEPRECATED QJSValue(QJSEngine *engine, const QString &val); + + QT_DEPRECATED QJSEngine *engine() const; - QJSValue call(const QJSValue &thisObject = QJSValue(), + QT_DEPRECATED bool isValid() const; + QT_DEPRECATED bool isFunction() const; + QT_DEPRECATED double toInteger() const; + QT_DEPRECATED qint32 toInt32() const; + QT_DEPRECATED quint32 toUInt32() const; + QT_DEPRECATED quint16 toUInt16() const; + QT_DEPRECATED QJSValue toObject() const; + QT_DEPRECATED QRegExp toRegExp() const; + + QT_DEPRECATED bool instanceOf(const QJSValue &other) const; + + QT_DEPRECATED QJSValue::PropertyFlags propertyFlags(const QString &name) const; + + QT_DEPRECATED QJSValue call(const QJSValue &thisObject = QJSValue(), const QJSValueList &args = QJSValueList()); - QJSValue construct(const QJSValueList &args = QJSValueList()); + QT_DEPRECATED QJSValue construct(const QJSValueList &args = QJSValueList()); +#endif private: // force compile error, prevent QJSValue(bool) to be called QJSValue(void *); +#ifdef QT_DEPRECATED // force compile error, prevent QJSValue(QScriptEngine*, bool) to be called QJSValue(QJSEngine *, void *); QJSValue(QJSEngine *, const char *); +#endif QJSValue(QJSValuePrivate*); QJSValue(QScriptPassPointer<QJSValuePrivate>); @@ -154,7 +174,9 @@ private: Q_DECLARE_PRIVATE(QJSValue) }; +#ifdef QT_DEPRECATED Q_DECLARE_OPERATORS_FOR_FLAGS(QJSValue::PropertyFlags) +#endif QT_END_NAMESPACE diff --git a/src/declarative/qml/v8/qjsvalue_impl_p.h b/src/declarative/qml/v8/qjsvalue_impl_p.h index 9e8259931a..c296d38b22 100644 --- a/src/declarative/qml/v8/qjsvalue_impl_p.h +++ b/src/declarative/qml/v8/qjsvalue_impl_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -880,6 +880,26 @@ inline bool QJSValuePrivate::deleteProperty(const QString& name) return self->Delete(QJSConverter::toString(name)); } +inline bool QJSValuePrivate::hasProperty(const QString &name) const +{ + if (!isObject()) + return false; + + v8::HandleScope handleScope; + v8::Handle<v8::Object> self(v8::Handle<v8::Object>::Cast(m_value)); + return self->Has(QJSConverter::toString(name)); +} + +inline bool QJSValuePrivate::hasOwnProperty(const QString &name) const +{ + if (!isObject()) + return false; + + v8::HandleScope handleScope; + v8::Handle<v8::Object> self(v8::Handle<v8::Object>::Cast(m_value)); + return self->HasOwnProperty(QJSConverter::toString(name)); +} + inline QJSValue::PropertyFlags QJSValuePrivate::propertyFlags(const QString& name) const { if (!isObject()) @@ -954,7 +974,7 @@ QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::call(QJSValuePrivate* thisO return new QJSValuePrivate(e, result); } -inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::construct(int argc, v8::Handle<v8::Value> *argv) +inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::callAsConstructor(int argc, v8::Handle<v8::Value> *argv) { QV8Engine *e = engine(); @@ -975,7 +995,7 @@ inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::construct(int argc, return new QJSValuePrivate(e, result); } -inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::construct(const QJSValueList& args) +inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::callAsConstructor(const QJSValueList& args) { if (!isCallable()) return InvalidValue(); @@ -986,11 +1006,11 @@ inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::construct(const QJSV int argc = args.size(); QVarLengthArray<v8::Handle<v8::Value>, 8> argv(argc); if (!prepareArgumentsForCall(argv.data(), args)) { - qWarning("QJSValue::construct() failed: cannot construct function with argument created in a different engine"); + qWarning("QJSValue::callAsConstructor() failed: cannot construct function with argument created in a different engine"); return InvalidValue(); } - return construct(argc, argv.data()); + return callAsConstructor(argc, argv.data()); } /*! \internal diff --git a/src/declarative/qml/v8/qjsvalue_p.h b/src/declarative/qml/v8/qjsvalue_p.h index 364742532c..23aebc7822 100644 --- a/src/declarative/qml/v8/qjsvalue_p.h +++ b/src/declarative/qml/v8/qjsvalue_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -130,15 +130,17 @@ public: template<typename T> inline QScriptPassPointer<QJSValuePrivate> property(T name) const; inline bool deleteProperty(const QString& name); + inline bool hasProperty(const QString &name) const; + inline bool hasOwnProperty(const QString &name) const; inline QJSValue::PropertyFlags propertyFlags(const QString& name) const; inline QJSValue::PropertyFlags propertyFlags(v8::Handle<v8::String> name) const; inline QScriptPassPointer<QJSValuePrivate> call(QJSValuePrivate* thisObject, const QJSValueList& args); inline QScriptPassPointer<QJSValuePrivate> call(QJSValuePrivate* thisObject, const QJSValue& arguments); inline QScriptPassPointer<QJSValuePrivate> call(QJSValuePrivate* thisObject, int argc, v8::Handle< v8::Value >* argv); - inline QScriptPassPointer<QJSValuePrivate> construct(int argc, v8::Handle<v8::Value> *argv); - inline QScriptPassPointer<QJSValuePrivate> construct(const QJSValueList& args); - inline QScriptPassPointer<QJSValuePrivate> construct(const QJSValue& arguments); + inline QScriptPassPointer<QJSValuePrivate> callAsConstructor(int argc, v8::Handle<v8::Value> *argv); + inline QScriptPassPointer<QJSValuePrivate> callAsConstructor(const QJSValueList& args); + inline QScriptPassPointer<QJSValuePrivate> callAsConstructor(const QJSValue& arguments); inline bool assignEngine(QV8Engine *engine); inline QV8Engine *engine() const; diff --git a/src/declarative/qml/v8/qjsvalueiterator.cpp b/src/declarative/qml/v8/qjsvalueiterator.cpp index 1e9973b79d..161343924a 100644 --- a/src/declarative/qml/v8/qjsvalueiterator.cpp +++ b/src/declarative/qml/v8/qjsvalueiterator.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qjsvalueiterator.h b/src/declarative/qml/v8/qjsvalueiterator.h index d0d4065903..69bd57f806 100644 --- a/src/declarative/qml/v8/qjsvalueiterator.h +++ b/src/declarative/qml/v8/qjsvalueiterator.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -31,7 +31,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QString; diff --git a/src/declarative/qml/v8/qjsvalueiterator_impl_p.h b/src/declarative/qml/v8/qjsvalueiterator_impl_p.h index 3da3a8ba9e..21f7119b3d 100644 --- a/src/declarative/qml/v8/qjsvalueiterator_impl_p.h +++ b/src/declarative/qml/v8/qjsvalueiterator_impl_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qjsvalueiterator_p.h b/src/declarative/qml/v8/qjsvalueiterator_p.h index 95e1f22337..fb68203c65 100644 --- a/src/declarative/qml/v8/qjsvalueiterator_p.h +++ b/src/declarative/qml/v8/qjsvalueiterator_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qscript_impl_p.h b/src/declarative/qml/v8/qscript_impl_p.h index 00e965a997..5f21d92843 100644 --- a/src/declarative/qml/v8/qscript_impl_p.h +++ b/src/declarative/qml/v8/qscript_impl_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qscriptisolate_p.h b/src/declarative/qml/v8/qscriptisolate_p.h index b2ab24b7a7..6a22e19d8f 100644 --- a/src/declarative/qml/v8/qscriptisolate_p.h +++ b/src/declarative/qml/v8/qscriptisolate_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h b/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h index 4db5d17237..74151bddae 100644 --- a/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h +++ b/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qscriptshareddata_p.h b/src/declarative/qml/v8/qscriptshareddata_p.h index 3d4284f2ee..8b0f0e3239 100644 --- a/src/declarative/qml/v8/qscriptshareddata_p.h +++ b/src/declarative/qml/v8/qscriptshareddata_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qscripttools_p.h b/src/declarative/qml/v8/qscripttools_p.h index b68039aa7a..9263028816 100644 --- a/src/declarative/qml/v8/qscripttools_p.h +++ b/src/declarative/qml/v8/qscripttools_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qv8_p.h b/src/declarative/qml/v8/qv8_p.h index c70e3b5a7f..73ba1d4fd3 100644 --- a/src/declarative/qml/v8/qv8_p.h +++ b/src/declarative/qml/v8/qv8_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8bindings.cpp b/src/declarative/qml/v8/qv8bindings.cpp index e4aeecc5c1..3d0398d087 100644 --- a/src/declarative/qml/v8/qv8bindings.cpp +++ b/src/declarative/qml/v8/qv8bindings.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8bindings_p.h b/src/declarative/qml/v8/qv8bindings_p.h index e8ac1b119c..e8af97ce54 100644 --- a/src/declarative/qml/v8/qv8bindings_p.h +++ b/src/declarative/qml/v8/qv8bindings_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8contextwrapper.cpp b/src/declarative/qml/v8/qv8contextwrapper.cpp index 39e9fa89db..af12247870 100644 --- a/src/declarative/qml/v8/qv8contextwrapper.cpp +++ b/src/declarative/qml/v8/qv8contextwrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8contextwrapper_p.h b/src/declarative/qml/v8/qv8contextwrapper_p.h index 3ac182d27f..04f2e6c6ab 100644 --- a/src/declarative/qml/v8/qv8contextwrapper_p.h +++ b/src/declarative/qml/v8/qv8contextwrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8debug_p.h b/src/declarative/qml/v8/qv8debug_p.h index 13c32c6b19..b3a9c31721 100644 --- a/src/declarative/qml/v8/qv8debug_p.h +++ b/src/declarative/qml/v8/qv8debug_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8domerrors.cpp b/src/declarative/qml/v8/qv8domerrors.cpp index 8652cdac00..f86486cf5c 100644 --- a/src/declarative/qml/v8/qv8domerrors.cpp +++ b/src/declarative/qml/v8/qv8domerrors.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8domerrors_p.h b/src/declarative/qml/v8/qv8domerrors_p.h index c3c6d3bf6e..fab93b4dcf 100644 --- a/src/declarative/qml/v8/qv8domerrors_p.h +++ b/src/declarative/qml/v8/qv8domerrors_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8engine.cpp b/src/declarative/qml/v8/qv8engine.cpp index ef65398859..e7fe2c713d 100644 --- a/src/declarative/qml/v8/qv8engine.cpp +++ b/src/declarative/qml/v8/qv8engine.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -501,10 +501,6 @@ QVariant QV8Engine::toBasicVariant(v8::Handle<v8::Value> value) if (!value->IsFunction()) { v8::Context::Scope scope(context()); v8::Handle<v8::Object> object = value->ToObject(); - v8::Local<v8::Array> properties = object->GetPropertyNames(); - int length = properties->Length(); - if (length == 0) - return QVariant(); return variantMapFromJS(object); } @@ -530,14 +526,19 @@ void QV8Engine::initializeGlobal(v8::Handle<v8::Object> global) v8::Local<v8::Function> consoleLogFn = V8FUNCTION(consoleLog, this); console->Set(v8::String::New("debug"), consoleLogFn); - console->Set(v8::String::New("error"), V8FUNCTION(consoleError, this)); console->Set(v8::String::New("log"), consoleLogFn); + console->Set(v8::String::New("info"), consoleLogFn); + console->Set(v8::String::New("warn"), V8FUNCTION(consoleWarn, this)); + console->Set(v8::String::New("error"), V8FUNCTION(consoleError, this)); + console->Set(v8::String::New("assert"), V8FUNCTION(consoleAssert, this)); + + console->Set(v8::String::New("count"), V8FUNCTION(consoleCount, this)); console->Set(v8::String::New("profile"), V8FUNCTION(consoleProfile, this)); console->Set(v8::String::New("profileEnd"), V8FUNCTION(consoleProfileEnd, this)); console->Set(v8::String::New("time"), V8FUNCTION(consoleTime, this)); console->Set(v8::String::New("timeEnd"), V8FUNCTION(consoleTimeEnd, this)); console->Set(v8::String::New("trace"), V8FUNCTION(consoleTrace, this)); - console->Set(v8::String::New("warn"), V8FUNCTION(consoleWarn, this)); + console->Set(v8::String::New("exception"), V8FUNCTION(consoleException, this)); v8::Local<v8::Object> qt = v8::Object::New(); @@ -1086,14 +1087,19 @@ v8::Local<v8::Object> QV8Engine::variantMapToJS(const QVariantMap &vmap) QVariantMap QV8Engine::variantMapFromJS(v8::Handle<v8::Object> jsObject) { QVariantMap result; + + v8::HandleScope handleScope; + v8::Handle<v8::Array> propertyNames = jsObject->GetPropertyNames(); + uint32_t length = propertyNames->Length(); + if (length == 0) + return result; + int hash = jsObject->GetIdentityHash(); if (visitedConversionObjects.contains(hash)) return result; // Avoid recursion. + visitedConversionObjects.insert(hash); - v8::HandleScope handleScope; // TODO: Only object's own property names. Include non-enumerable properties. - v8::Handle<v8::Array> propertyNames = jsObject->GetPropertyNames(); - uint32_t length = propertyNames->Length(); for (uint32_t i = 0; i < length; ++i) { v8::Handle<v8::Value> name = propertyNames->Get(i); result.insert(QJSConverter::toString(name->ToString()), variantFromJS(jsObject->Get(name))); @@ -1511,6 +1517,15 @@ qint64 QV8Engine::stopTimer(const QString &timerName, bool *wasRunning) return m_time.elapsed() - startedAt; } +int QV8Engine::consoleCountHelper(const QString &file, int line, int column) +{ + const QString key = file + QString::number(line) + QString::number(column); + int number = m_consoleCount.value(key, 0); + number++; + m_consoleCount.insert(key, number); + return number; +} + void QV8GCCallback::registerGcPrologueCallback() { QV8Engine::ThreadData *td = QV8Engine::threadData(); diff --git a/src/declarative/qml/v8/qv8engine_impl_p.h b/src/declarative/qml/v8/qv8engine_impl_p.h index 575906ebcb..eed97d41a9 100644 --- a/src/declarative/qml/v8/qv8engine_impl_p.h +++ b/src/declarative/qml/v8/qv8engine_impl_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -16,7 +16,7 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** us via http://www.qt-project.org/. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/v8/qv8engine_p.h b/src/declarative/qml/v8/qv8engine_p.h index 9dfc1d58f2..b625704c5b 100644 --- a/src/declarative/qml/v8/qv8engine_p.h +++ b/src/declarative/qml/v8/qv8engine_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -432,6 +432,9 @@ public: void startTimer(const QString &timerName); qint64 stopTimer(const QString &timerName, bool *wasRunning); + // used for console.count() + int consoleCountHelper(const QString &file, int line, int column); + QObject *qtObjectFromJS(v8::Handle<v8::Value> value); QSet<int> visitedConversionObjects; @@ -486,6 +489,8 @@ protected: QElapsedTimer m_time; QHash<QString, qint64> m_startedTimers; + QHash<QString, quint32> m_consoleCount; + QVariant toBasicVariant(v8::Handle<v8::Value>); void initializeGlobal(v8::Handle<v8::Object>); diff --git a/src/declarative/qml/v8/qv8include.cpp b/src/declarative/qml/v8/qv8include.cpp index e0a10742f7..70585461a3 100644 --- a/src/declarative/qml/v8/qv8include.cpp +++ b/src/declarative/qml/v8/qv8include.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8include_p.h b/src/declarative/qml/v8/qv8include_p.h index 41feece9e7..935a209acc 100644 --- a/src/declarative/qml/v8/qv8include_p.h +++ b/src/declarative/qml/v8/qv8include_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8listwrapper.cpp b/src/declarative/qml/v8/qv8listwrapper.cpp index 0ef94e079c..ccbe1f74b4 100644 --- a/src/declarative/qml/v8/qv8listwrapper.cpp +++ b/src/declarative/qml/v8/qv8listwrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8listwrapper_p.h b/src/declarative/qml/v8/qv8listwrapper_p.h index 89cb679375..46a6e72c94 100644 --- a/src/declarative/qml/v8/qv8listwrapper_p.h +++ b/src/declarative/qml/v8/qv8listwrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8profiler_p.h b/src/declarative/qml/v8/qv8profiler_p.h index 51d681e3a1..0851a33263 100644 --- a/src/declarative/qml/v8/qv8profiler_p.h +++ b/src/declarative/qml/v8/qv8profiler_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8qobjectwrapper.cpp b/src/declarative/qml/v8/qv8qobjectwrapper.cpp index 2663344534..a8d5a279bd 100644 --- a/src/declarative/qml/v8/qv8qobjectwrapper.cpp +++ b/src/declarative/qml/v8/qv8qobjectwrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -589,10 +589,11 @@ static inline void StoreProperty(QV8Engine *engine, QObject *object, QDeclarativ v8::StackTrace::kScriptName)); v8::Local<v8::StackFrame> frame = trace->GetFrame(0); int lineNumber = frame->GetLineNumber(); + int columNumber = frame->GetColumn(); QString url = engine->toString(frame->GetScriptName()); newBinding = new QDeclarativeBinding(&function, object, context); - newBinding->setSourceLocation(url, lineNumber); + newBinding->setSourceLocation(url, lineNumber, columNumber); newBinding->setTarget(object, *property, context); newBinding->setEvaluateFlags(newBinding->evaluateFlags() | QDeclarativeBinding::RequiresThisObject); diff --git a/src/declarative/qml/v8/qv8qobjectwrapper_p.h b/src/declarative/qml/v8/qv8qobjectwrapper_p.h index 9c545cb3b1..54d354c638 100644 --- a/src/declarative/qml/v8/qv8qobjectwrapper_p.h +++ b/src/declarative/qml/v8/qv8qobjectwrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8sequencewrapper.cpp b/src/declarative/qml/v8/qv8sequencewrapper.cpp index 32c98f046a..091b44063c 100644 --- a/src/declarative/qml/v8/qv8sequencewrapper.cpp +++ b/src/declarative/qml/v8/qv8sequencewrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8sequencewrapper_p.h b/src/declarative/qml/v8/qv8sequencewrapper_p.h index ef7f714e0f..2ca5ab503e 100644 --- a/src/declarative/qml/v8/qv8sequencewrapper_p.h +++ b/src/declarative/qml/v8/qv8sequencewrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8sequencewrapper_p_p.h b/src/declarative/qml/v8/qv8sequencewrapper_p_p.h index c7a8ca4d8d..8b2487e8d0 100644 --- a/src/declarative/qml/v8/qv8sequencewrapper_p_p.h +++ b/src/declarative/qml/v8/qv8sequencewrapper_p_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -180,12 +180,14 @@ static QString convertQStringToString(QV8Engine *, const QString &v) static QUrl convertV8ValueToUrl(QV8Engine *e, v8::Handle<v8::Value> v) { - return QUrl(e->toString(v->ToString())); + QUrl u; + u.setEncodedUrl(e->toString(v->ToString()).toUtf8(), QUrl::TolerantMode); + return u; } static v8::Handle<v8::Value> convertUrlToV8Value(QV8Engine *e, const QUrl &v) { - return e->toString(v.toString()); + return e->toString(v.toEncoded()); } static QString convertUrlToString(QV8Engine *, const QUrl &v) diff --git a/src/declarative/qml/v8/qv8stringwrapper.cpp b/src/declarative/qml/v8/qv8stringwrapper.cpp index efc513a965..745d4d374a 100644 --- a/src/declarative/qml/v8/qv8stringwrapper.cpp +++ b/src/declarative/qml/v8/qv8stringwrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8stringwrapper_p.h b/src/declarative/qml/v8/qv8stringwrapper_p.h index ff0e9dc51b..011acf8249 100644 --- a/src/declarative/qml/v8/qv8stringwrapper_p.h +++ b/src/declarative/qml/v8/qv8stringwrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8typewrapper.cpp b/src/declarative/qml/v8/qv8typewrapper.cpp index 3016f7b37d..f1c095678b 100644 --- a/src/declarative/qml/v8/qv8typewrapper.cpp +++ b/src/declarative/qml/v8/qv8typewrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -196,9 +196,16 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property, resource->importNamespace); if (r.isValid()) { - Q_ASSERT(r.type); + if (r.type) { + return v8engine->typeWrapper()->newObject(object, r.type, resource->mode); + } else if (r.scriptIndex != -1) { + int index = r.scriptIndex; + QDeclarativeContextData *context = v8engine->callingContext(); + if (index < context->importedScripts.count()) + return context->importedScripts.at(index); + } - return v8engine->typeWrapper()->newObject(object, r.type, resource->mode); + return v8::Undefined(); } else if (QDeclarativeMetaType::ModuleApiInstance *moduleApi = resource->typeNamespace->moduleApi(resource->importNamespace)) { if (moduleApi->scriptCallback) { diff --git a/src/declarative/qml/v8/qv8typewrapper_p.h b/src/declarative/qml/v8/qv8typewrapper_p.h index e1c6b177df..f658b9b14c 100644 --- a/src/declarative/qml/v8/qv8typewrapper_p.h +++ b/src/declarative/qml/v8/qv8typewrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8valuetypewrapper.cpp b/src/declarative/qml/v8/qv8valuetypewrapper.cpp index b712ac5028..f6ce43ee10 100644 --- a/src/declarative/qml/v8/qv8valuetypewrapper.cpp +++ b/src/declarative/qml/v8/qv8valuetypewrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -342,10 +342,11 @@ v8::Handle<v8::Value> QV8ValueTypeWrapper::Setter(v8::Local<v8::String> property v8::StackTrace::kScriptName)); v8::Local<v8::StackFrame> frame = trace->GetFrame(0); int lineNumber = frame->GetLineNumber(); + int columnNumber = frame->GetColumn(); QString url = r->engine->toString(frame->GetScriptName()); newBinding = new QDeclarativeBinding(&function, reference->object, context); - newBinding->setSourceLocation(url, lineNumber); + newBinding->setSourceLocation(url, lineNumber, columnNumber); newBinding->setTarget(reference->object, cacheData, context); newBinding->setEvaluateFlags(newBinding->evaluateFlags() | QDeclarativeBinding::RequiresThisObject); diff --git a/src/declarative/qml/v8/qv8valuetypewrapper_p.h b/src/declarative/qml/v8/qv8valuetypewrapper_p.h index bb5085557c..f0f018074a 100644 --- a/src/declarative/qml/v8/qv8valuetypewrapper_p.h +++ b/src/declarative/qml/v8/qv8valuetypewrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8variantresource_p.h b/src/declarative/qml/v8/qv8variantresource_p.h index cca272bbc9..a87fa9606c 100644 --- a/src/declarative/qml/v8/qv8variantresource_p.h +++ b/src/declarative/qml/v8/qv8variantresource_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8variantwrapper.cpp b/src/declarative/qml/v8/qv8variantwrapper.cpp index 2fc63333d6..cdc1444633 100644 --- a/src/declarative/qml/v8/qv8variantwrapper.cpp +++ b/src/declarative/qml/v8/qv8variantwrapper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8variantwrapper_p.h b/src/declarative/qml/v8/qv8variantwrapper_p.h index d46832ae87..e3412fab0b 100644 --- a/src/declarative/qml/v8/qv8variantwrapper_p.h +++ b/src/declarative/qml/v8/qv8variantwrapper_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8worker.cpp b/src/declarative/qml/v8/qv8worker.cpp index e1bc3ec3a9..474b28bb5b 100644 --- a/src/declarative/qml/v8/qv8worker.cpp +++ b/src/declarative/qml/v8/qv8worker.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** diff --git a/src/declarative/qml/v8/qv8worker_p.h b/src/declarative/qml/v8/qv8worker_p.h index e42438f8d6..3b456a8db9 100644 --- a/src/declarative/qml/v8/qv8worker_p.h +++ b/src/declarative/qml/v8/qv8worker_p.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** |