diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-07 04:25:54 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-07 04:26:46 (GMT) |
commit | ec50ac021ba0908bfaeb5fbf1838ffb59ad829d5 (patch) | |
tree | 1a6365c8b7487e4f5cf7e489aba8005797005e3c /src/declarative/qml | |
parent | b3beb6ded506f1701b68642d981c63295bc6c6a2 (diff) | |
download | Qt-ec50ac021ba0908bfaeb5fbf1838ffb59ad829d5.zip Qt-ec50ac021ba0908bfaeb5fbf1838ffb59ad829d5.tar.gz Qt-ec50ac021ba0908bfaeb5fbf1838ffb59ad829d5.tar.bz2 |
Cleanup (remove QDeclarativeScriptClass)
QDeclarativeScriptClass only existed to make compiling against 4.6 and
4.7 easier.
Diffstat (limited to 'src/declarative/qml')
13 files changed, 34 insertions, 142 deletions
diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp index 8566744..6d31c22 100644 --- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp +++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp @@ -79,7 +79,7 @@ struct ContextData : public QScriptDeclarativeClass::Object { via QtScript. */ QDeclarativeContextScriptClass::QDeclarativeContextScriptClass(QDeclarativeEngine *bindEngine) -: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine), +: QScriptDeclarativeClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine), lastScopeObject(0), lastContext(0), lastData(0), lastPropertyIndex(-1) { } @@ -223,7 +223,7 @@ QDeclarativeContextScriptClass::queryProperty(QDeclarativeContextData *bindConte return 0; } -QDeclarativeContextScriptClass::ScriptValue +QDeclarativeContextScriptClass::Value QDeclarativeContextScriptClass::property(Object *object, const Identifier &name) { Q_UNUSED(object); diff --git a/src/declarative/qml/qdeclarativecontextscriptclass_p.h b/src/declarative/qml/qdeclarativecontextscriptclass_p.h index b89f0cd..1936d38 100644 --- a/src/declarative/qml/qdeclarativecontextscriptclass_p.h +++ b/src/declarative/qml/qdeclarativecontextscriptclass_p.h @@ -54,14 +54,14 @@ // #include "private/qdeclarativetypenamecache_p.h" -#include "private/qdeclarativescriptclass_p.h" +#include <private/qscriptdeclarativeclass_p.h> QT_BEGIN_NAMESPACE class QDeclarativeEngine; class QDeclarativeContext; class QDeclarativeContextData; -class QDeclarativeContextScriptClass : public QDeclarativeScriptClass +class QDeclarativeContextScriptClass : public QScriptDeclarativeClass { public: QDeclarativeContextScriptClass(QDeclarativeEngine *); @@ -76,7 +76,7 @@ public: protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual ScriptValue property(Object *, const Identifier &); + virtual Value property(Object *, const Identifier &); virtual void setProperty(Object *, const Identifier &name, const QScriptValue &); private: diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index f7d1df3..e8b6913 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -61,7 +61,6 @@ #include "private/qdeclarativeglobal_p.h" #include "private/qdeclarativeworkerscript_p.h" #include "private/qdeclarativecomponent_p.h" -#include "private/qdeclarativescriptclass_p.h" #include "qdeclarativenetworkaccessmanagerfactory.h" #include "qdeclarativeimageprovider.h" #include "private/qdeclarativedirparser_p.h" @@ -1365,19 +1364,6 @@ QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val } } -QDeclarativeScriptClass::QDeclarativeScriptClass(QScriptEngine *engine) -: QScriptDeclarativeClass(engine) -{ -} - -QVariant QDeclarativeScriptClass::toVariant(QDeclarativeEngine *engine, const QScriptValue &val) -{ - QDeclarativeEnginePrivate *ep = - static_cast<QDeclarativeEnginePrivate *>(QObjectPrivate::get(engine)); - - return ep->scriptValueToVariant(val); -} - // XXX this beyonds in QUrl::toLocalFile() // WARNING, there is a copy of this function in qdeclarativecompositetypemanager.cpp static QString toLocalFileOrQrc(const QUrl& url) diff --git a/src/declarative/qml/qdeclarativelistscriptclass.cpp b/src/declarative/qml/qdeclarativelistscriptclass.cpp index 3958dd5..d27427e 100644 --- a/src/declarative/qml/qdeclarativelistscriptclass.cpp +++ b/src/declarative/qml/qdeclarativelistscriptclass.cpp @@ -54,7 +54,7 @@ struct ListData : public QScriptDeclarativeClass::Object { }; QDeclarativeListScriptClass::QDeclarativeListScriptClass(QDeclarativeEngine *e) -: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(e)), engine(e) +: QScriptDeclarativeClass(QDeclarativeEnginePrivate::getScriptEngine(e)), engine(e) { QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); Q_UNUSED(scriptEngine); @@ -114,7 +114,7 @@ QDeclarativeListScriptClass::queryProperty(Object *object, const Identifier &nam } } -QDeclarativeListScriptClass::ScriptValue QDeclarativeListScriptClass::property(Object *obj, const Identifier &name) +QDeclarativeListScriptClass::Value QDeclarativeListScriptClass::property(Object *obj, const Identifier &name) { QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); diff --git a/src/declarative/qml/qdeclarativelistscriptclass_p.h b/src/declarative/qml/qdeclarativelistscriptclass_p.h index 68c680d..89984a1 100644 --- a/src/declarative/qml/qdeclarativelistscriptclass_p.h +++ b/src/declarative/qml/qdeclarativelistscriptclass_p.h @@ -53,13 +53,13 @@ // We mean it. // -#include <private/qdeclarativescriptclass_p.h> +#include <private/qscriptdeclarativeclass_p.h> #include "qdeclarativelist.h" QT_BEGIN_NAMESPACE class QDeclarativeEngine; -class QDeclarativeListScriptClass : public QDeclarativeScriptClass +class QDeclarativeListScriptClass : public QScriptDeclarativeClass { public: QDeclarativeListScriptClass(QDeclarativeEngine *); @@ -71,7 +71,7 @@ public: protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual ScriptValue property(Object *, const Identifier &); + virtual Value property(Object *, const Identifier &); virtual QVariant toVariant(Object *, bool *ok); private: diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 759a506..10b9fab 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -78,11 +78,8 @@ struct ObjectData : public QScriptDeclarativeClass::Object { QtScript for QML. */ QDeclarativeObjectScriptClass::QDeclarativeObjectScriptClass(QDeclarativeEngine *bindEngine) -: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), -#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE) - methods(bindEngine), -#endif - lastData(0), engine(bindEngine) +: QScriptDeclarativeClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), + methods(bindEngine), lastData(0), engine(bindEngine) { QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); @@ -191,13 +188,13 @@ QDeclarativeObjectScriptClass::queryProperty(QObject *obj, const Identifier &nam return 0; } -QDeclarativeObjectScriptClass::ScriptValue +QDeclarativeObjectScriptClass::Value QDeclarativeObjectScriptClass::property(Object *object, const Identifier &name) { return property(toQObject(object), name); } -QDeclarativeObjectScriptClass::ScriptValue +QDeclarativeObjectScriptClass::Value QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) { QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); @@ -357,7 +354,7 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, QMetaObject::metacall(obj, QMetaObject::ResetProperty, lastData->coreIndex, a); } else { // ### Can well known types be optimized? - QVariant v = QDeclarativeScriptClass::toVariant(engine, value); + QVariant v = enginePriv->scriptValueToVariant(value); QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext); } } @@ -557,7 +554,7 @@ QDeclarativeObjectMethodScriptClass::queryProperty(Object *, const Identifier &n } -QDeclarativeObjectScriptClass::ScriptValue +QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass::property(Object *, const Identifier &name) { QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); @@ -687,7 +684,7 @@ void MetaCallArgument::fromScriptValue(int callType, QDeclarativeEngine *engine, *((QObject **)&data) = value.toQObject(); type = callType; } else if (callType == qMetaTypeId<QVariant>()) { - new (&data) QVariant(QDeclarativeScriptClass::toVariant(engine, value)); + new (&data) QVariant(QDeclarativeEnginePrivate::get(engine)->scriptValueToVariant(value)); type = callType; } else if (callType == qMetaTypeId<QList<QObject*> >()) { new (&data) QList<QObject *>(); // We don't support passing in QList<QObject*> @@ -696,7 +693,7 @@ void MetaCallArgument::fromScriptValue(int callType, QDeclarativeEngine *engine, new (&data) QVariant(); type = -1; - QVariant v = QDeclarativeScriptClass::toVariant(engine, value); + QVariant v = QDeclarativeEnginePrivate::get(engine)->scriptValueToVariant(value); if (v.userType() == callType) { *((QVariant *)&data) = v; } else if (v.canConvert((QVariant::Type)callType)) { diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h index 8941ae0..8a2f7c7 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h +++ b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h @@ -56,7 +56,7 @@ #include "private/qdeclarativepropertycache_p.h" #include "private/qdeclarativetypenamecache_p.h" -#include <private/qdeclarativescriptclass_p.h> +#include <private/qscriptdeclarativeclass_p.h> #include <QtScript/qscriptengine.h> QT_BEGIN_NAMESPACE @@ -93,7 +93,7 @@ private: }; #endif -class Q_AUTOTEST_EXPORT QDeclarativeObjectScriptClass : public QDeclarativeScriptClass +class Q_AUTOTEST_EXPORT QDeclarativeObjectScriptClass : public QScriptDeclarativeClass { public: QDeclarativeObjectScriptClass(QDeclarativeEngine *); @@ -115,7 +115,7 @@ public: QDeclarativeContextData *evalContext, QueryHints hints = 0); - ScriptValue property(QObject *, const Identifier &); + Value property(QObject *, const Identifier &); void setProperty(QObject *, const Identifier &name, const QScriptValue &, QDeclarativeContextData *evalContext = 0); @@ -126,7 +126,7 @@ protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual ScriptValue property(Object *, const Identifier &); + virtual Value property(Object *, const Identifier &); virtual void setProperty(Object *, const Identifier &name, const QScriptValue &); virtual bool isQObject() const; virtual QObject *toQObject(Object *, bool *ok = 0); diff --git a/src/declarative/qml/qdeclarativescriptclass_p.h b/src/declarative/qml/qdeclarativescriptclass_p.h deleted file mode 100644 index d8733db..0000000 --- a/src/declarative/qml/qdeclarativescriptclass_p.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVESCRIPTCLASS_P_H -#define QDECLARATIVESCRIPTCLASS_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtScript/qscriptclass.h> -#include <private/qscriptdeclarativeclass_p.h> - -QT_BEGIN_NAMESPACE - -class QDeclarativeEngine; -class QDeclarativeScriptClass : public QScriptDeclarativeClass -{ -public: - QDeclarativeScriptClass(QScriptEngine *); - - static QVariant toVariant(QDeclarativeEngine *, const QScriptValue &); - -#if (QT_VERSION <= QT_VERSION_CHECK(4, 6, 2)) && !defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE) - struct Value : public QScriptValue { - Value() : QScriptValue() {} - Value(QScriptEngine *engine, int v) : QScriptValue(engine, v) {} - Value(QScriptEngine *engine, uint v) : QScriptValue(engine, v) {} - Value(QScriptEngine *engine, bool v) : QScriptValue(engine, v) {} - Value(QScriptEngine *engine, double v) : QScriptValue(engine, v) {} - Value(QScriptEngine *engine, float v) : QScriptValue(engine, v) {} - Value(QScriptEngine *engine, const QString &v) : QScriptValue(engine, v) {} - Value(QScriptEngine *, const QScriptValue &v) : QScriptValue(v) {} - }; - - typedef QScriptValue ScriptValue; -#else - typedef Value ScriptValue; -#endif -}; - -QT_END_NAMESPACE - -#endif // QDECLARATIVESCRIPTCLASS_P_H diff --git a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp index 9cac3e1..324b3de 100644 --- a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp +++ b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp @@ -62,7 +62,7 @@ struct TypeNameData : public QScriptDeclarativeClass::Object { }; QDeclarativeTypeNameScriptClass::QDeclarativeTypeNameScriptClass(QDeclarativeEngine *bindEngine) -: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), +: QScriptDeclarativeClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine), object(0), type(0) { } @@ -139,7 +139,7 @@ QDeclarativeTypeNameScriptClass::queryProperty(Object *obj, const Identifier &na return 0; } -QDeclarativeTypeNameScriptClass::ScriptValue +QDeclarativeTypeNameScriptClass::Value QDeclarativeTypeNameScriptClass::property(Object *obj, const Identifier &name) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); diff --git a/src/declarative/qml/qdeclarativetypenamescriptclass_p.h b/src/declarative/qml/qdeclarativetypenamescriptclass_p.h index 8e07f02..310e14e 100644 --- a/src/declarative/qml/qdeclarativetypenamescriptclass_p.h +++ b/src/declarative/qml/qdeclarativetypenamescriptclass_p.h @@ -54,16 +54,15 @@ // #include "private/qdeclarativeengine_p.h" +#include <private/qscriptdeclarativeclass_p.h> #include <QtScript/qscriptclass.h> -#include <private/qdeclarativescriptclass_p.h> - QT_BEGIN_NAMESPACE class QDeclarativeEngine; class QDeclarativeType; class QDeclarativeTypeNameCache; -class QDeclarativeTypeNameScriptClass : public QDeclarativeScriptClass +class QDeclarativeTypeNameScriptClass : public QScriptDeclarativeClass { public: QDeclarativeTypeNameScriptClass(QDeclarativeEngine *); @@ -77,7 +76,7 @@ protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual ScriptValue property(Object *, const Identifier &); + virtual Value property(Object *, const Identifier &); virtual void setProperty(Object *, const Identifier &name, const QScriptValue &); private: diff --git a/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp b/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp index f7902b9..fdb71c6 100644 --- a/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp +++ b/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp @@ -55,7 +55,7 @@ struct QDeclarativeValueTypeReference : public QScriptDeclarativeClass::Object { }; QDeclarativeValueTypeScriptClass::QDeclarativeValueTypeScriptClass(QDeclarativeEngine *bindEngine) -: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine) +: QScriptDeclarativeClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine) { } @@ -100,7 +100,7 @@ QDeclarativeValueTypeScriptClass::queryProperty(Object *obj, const Identifier &n return rv; } -QDeclarativeValueTypeScriptClass::ScriptValue QDeclarativeValueTypeScriptClass::property(Object *obj, const Identifier &) +QDeclarativeValueTypeScriptClass::Value QDeclarativeValueTypeScriptClass::property(Object *obj, const Identifier &) { QDeclarativeValueTypeReference *ref = static_cast<QDeclarativeValueTypeReference *>(obj); @@ -113,7 +113,7 @@ QDeclarativeValueTypeScriptClass::ScriptValue QDeclarativeValueTypeScriptClass:: } void QDeclarativeValueTypeScriptClass::setProperty(Object *obj, const Identifier &, - const QScriptValue &value) + const QScriptValue &value) { QDeclarativeValueTypeReference *ref = static_cast<QDeclarativeValueTypeReference *>(obj); @@ -122,7 +122,7 @@ void QDeclarativeValueTypeScriptClass::setProperty(Object *obj, const Identifier if (delBinding) delBinding->destroy(); - QVariant v = QDeclarativeScriptClass::toVariant(engine, value); + QVariant v = QDeclarativeEnginePrivate::get(engine)->scriptValueToVariant(value); ref->type->read(ref->object, ref->property); QMetaProperty p = ref->type->metaObject()->property(m_lastIndex); diff --git a/src/declarative/qml/qdeclarativevaluetypescriptclass_p.h b/src/declarative/qml/qdeclarativevaluetypescriptclass_p.h index 31bd415..2bbb61f 100644 --- a/src/declarative/qml/qdeclarativevaluetypescriptclass_p.h +++ b/src/declarative/qml/qdeclarativevaluetypescriptclass_p.h @@ -54,13 +54,13 @@ // -#include <private/qdeclarativescriptclass_p.h> +#include <private/qscriptdeclarativeclass_p.h> QT_BEGIN_NAMESPACE class QDeclarativeEngine; class QDeclarativeValueType; -class QDeclarativeValueTypeScriptClass : public QDeclarativeScriptClass +class QDeclarativeValueTypeScriptClass : public QScriptDeclarativeClass { public: QDeclarativeValueTypeScriptClass(QDeclarativeEngine *); @@ -70,7 +70,7 @@ public: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual ScriptValue property(Object *, const Identifier &); + virtual Value property(Object *, const Identifier &); virtual void setProperty(Object *, const Identifier &name, const QScriptValue &); virtual QVariant toVariant(Object *, bool *ok = 0); diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index e2f0c67..1087f44 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -121,7 +121,6 @@ HEADERS += \ $$PWD/qdeclarativetypenamescriptclass_p.h \ $$PWD/qdeclarativelistscriptclass_p.h \ $$PWD/qdeclarativeworkerscript_p.h \ - $$PWD/qdeclarativescriptclass_p.h \ $$PWD/qdeclarativeguard_p.h \ $$PWD/qdeclarativeimageprovider.h \ $$PWD/qdeclarativenetworkaccessmanagerfactory.h \ |