if (a < 0.0) a=0.0;
if (a > 1.0) a=1.0;
- return ctx->engine->publicEngine->handle()->fromVariant(QQml_colorProvider()->fromRgbF(r, g, b, a));
+ return ctx->engine->v8Engine->fromVariant(QQml_colorProvider()->fromRgbF(r, g, b, a));
}
/*!
if (a < 0.0) a=0.0;
if (a > 1.0) a=1.0;
- return ctx->engine->publicEngine->handle()->fromVariant(QQml_colorProvider()->fromHslF(h, s, l, a));
+ return ctx->engine->v8Engine->fromVariant(QQml_colorProvider()->fromHslF(h, s, l, a));
}
/*!
bool ok = false;
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QVariant lhs = v8engine->toVariant(ctx->arguments[0], -1);
if (lhs.userType() == QVariant::String) {
double w = ctx->arguments[2].toNumber();
double h = ctx->arguments[3].toNumber();
- return ctx->engine->publicEngine->handle()->fromVariant(QVariant::fromValue(QRectF(x, y, w, h)));
+ return ctx->engine->v8Engine->fromVariant(QVariant::fromValue(QRectF(x, y, w, h)));
}
/*!
double x = ctx->arguments[0].toNumber();
double y = ctx->arguments[1].toNumber();
- return ctx->engine->publicEngine->handle()->fromVariant(QVariant::fromValue(QPointF(x, y)));
+ return ctx->engine->v8Engine->fromVariant(QVariant::fromValue(QPointF(x, y)));
}
/*!
double w = ctx->arguments[0].toNumber();
double h = ctx->arguments[1].toNumber();
- return ctx->engine->publicEngine->handle()->fromVariant(QVariant::fromValue(QSizeF(w, h)));
+ return ctx->engine->v8Engine->fromVariant(QVariant::fromValue(QSizeF(w, h)));
}
/*!
if (ctx->argumentCount != 1 || !ctx->arguments[0].isObject())
V4THROW_ERROR("Qt.font(): Invalid arguments");
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
bool ok = false;
QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QFont, QQmlV4Handle(ctx->arguments[0]), v8engine, &ok);
if (!ok)
xy[1] = ctx->arguments[1].toNumber();
const void *params[] = { xy };
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
return v8engine->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QVector2D, 1, params));
}
xyz[2] = ctx->arguments[2].toNumber();
const void *params[] = { xyz };
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
return v8engine->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QVector3D, 1, params));
}
xyzw[3] = ctx->arguments[3].toNumber();
const void *params[] = { xyzw };
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
return v8engine->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QVector4D, 1, params));
}
sxyz[3] = ctx->arguments[3].toNumber();
const void *params[] = { sxyz };
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
return v8engine->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QQuaternion, 1, params));
}
*/
Value QtObject::method_matrix4x4(QV4::SimpleCallContext *ctx)
{
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
if (ctx->argumentCount == 1 && ctx->arguments[0].isObject()) {
bool ok = false;
if (ctx->argumentCount != 1 && ctx->argumentCount != 2)
V4THROW_ERROR("Qt.lighter(): Invalid arguments");
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QVariant v = v8engine->toVariant(ctx->arguments[0], -1);
if (v.userType() == QVariant::String) {
bool ok = false;
if (ctx->argumentCount != 1 && ctx->argumentCount != 2)
V4THROW_ERROR("Qt.darker(): Invalid arguments");
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QVariant v = v8engine->toVariant(ctx->arguments[0], -1);
if (v.userType() == QVariant::String) {
bool ok = false;
if (ctx->argumentCount != 2)
V4THROW_ERROR("Qt.tint(): Invalid arguments");
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
// base color
QVariant v1 = v8engine->toVariant(ctx->arguments[0], -1);
if (ctx->argumentCount < 1 || ctx->argumentCount > 2)
V4THROW_ERROR("Qt.formatDate(): Invalid arguments");
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
QDate date = v8engine->toVariant(ctx->arguments[0], -1).toDateTime().date();
if (ctx->argumentCount < 1 || ctx->argumentCount > 2)
V4THROW_ERROR("Qt.formatTime(): Invalid arguments");
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QVariant argVariant = v8engine->toVariant(ctx->arguments[0], -1);
QTime time;
if (ctx->argumentCount < 1 || ctx->argumentCount > 2)
V4THROW_ERROR("Qt.formatDateTime(): Invalid arguments");
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
QDateTime dt = v8engine->toVariant(ctx->arguments[0], -1).toDateTime();
if (ctx->argumentCount != 1)
return QV4::Value::fromBoolean(false);
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QUrl url(method_resolvedUrl(ctx).toQString());
return v8engine->fromVariant(QQml_guiProvider()->openUrlExternally(url));
*/
Value QtObject::method_resolvedUrl(QV4::SimpleCallContext *ctx)
{
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QUrl url = v8engine->toVariant(ctx->arguments[0], -1).toUrl();
QQmlEngine *e = v8engine->engine();
if (ctx->argumentCount != 0)
V4THROW_ERROR("Qt.fontFamilies(): Invalid arguments");
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
return v8engine->fromVariant(QVariant(QQml_guiProvider()->fontFamilies()));
}
*/
Value QtObject::method_quit(SimpleCallContext *ctx)
{
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QQmlEnginePrivate::get(v8engine->engine())->sendQuit();
return QV4::Value::undefinedValue();
}
};
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QQmlEngine *engine = v8engine->engine();
QQmlContextData *context = v8engine->callingContext();
if (ctx->argumentCount < 1 || ctx->argumentCount > 3)
ctx->throwError(invalidArgs);
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QQmlEngine *engine = v8engine->engine();
QQmlContextData *context = v8engine->callingContext();
if (ctx->argumentCount == 1 && !ctx->arguments[0].isString())
V4THROW_TYPE("locale(): argument (locale code) must be a string");
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
if (ctx->argumentCount == 1)
code = ctx->arguments[0].toQString();
if (!qt->m_platform)
// Only allocate a platform object once
- qt->m_platform = new QQmlPlatform(ctx->engine->publicEngine);
+ qt->m_platform = new QQmlPlatform(ctx->engine->v8Engine->publicEngine());
- return ctx->engine->publicEngine->handle()->newQObject(qt->m_platform);
+ return ctx->engine->v8Engine->newQObject(qt->m_platform);
}
Value QtObject::method_get_application(SimpleCallContext *ctx)
if (!qt->m_application)
// Only allocate an application object once
- qt->m_application = QQml_guiProvider()->application(ctx->engine->publicEngine);
+ qt->m_application = QQml_guiProvider()->application(ctx->engine->v8Engine->publicEngine());
- return ctx->engine->publicEngine->handle()->newQObject(qt->m_application);
+ return ctx->engine->v8Engine->newQObject(qt->m_application);
}
#ifndef QT_NO_IM
Value QtObject::method_get_inputMethod(SimpleCallContext *ctx)
{
- QV8Engine *engine = ctx->engine->publicEngine->handle();
+ QV8Engine *engine = ctx->engine->v8Engine;
return engine->newQObject(QQml_guiProvider()->inputMethod(), QV8Engine::CppOwnership);
}
#endif
if (ctx->argumentCount != 1)
V4THROW_ERROR("console.time(): Invalid arguments");
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QString name = ctx->arguments[0].toQString();
v8engine->startTimer(name);
if (ctx->argumentCount != 1)
V4THROW_ERROR("console.time(): Invalid arguments");
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QString name = ctx->arguments[0].toQString();
bool wasRunning;
name = ctx->arguments[0].toQString();
QV4::ExecutionEngine *v4 = ctx->engine;
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QV4::ExecutionEngine::StackFrame frame = v4->currentStackFrame();
if ((ctx->argumentCount > 2) && !ctx->arguments[2].isNumber())
V4THROW_ERROR("qsTr(): third argument (n) must be a number");
- QV8Engine *v8engine = ctx->engine->publicEngine->handle();
+ QV8Engine *v8engine = ctx->engine->v8Engine;
QQmlContextData *ctxt = v8engine->callingContext();
QString path = ctxt->url.toString();
}
QHashedV4String propertystring(QV4::Value::fromString(name));
- QV8Engine *v8Engine = QV8Engine::get(ctx->engine->publicEngine);
+ QV8Engine *v8Engine = ctx->engine->v8Engine;
QQmlContextData *context = QV4::QmlContextWrapper::callingContext(ctx->engine);
QV4::Value QObjectWrapper::wrap(ExecutionEngine *engine, QQmlData *ddata, QObject *object)
{
- QQmlEngine *qmlEngine = qobject_cast<QQmlEngine*>(engine->publicEngine);
+ QQmlEngine *qmlEngine = engine->v8Engine->engine();
if (!ddata->propertyCache && qmlEngine) {
ddata->propertyCache = QQmlEnginePrivate::get(qmlEngine)->cache(object);
if (ddata->propertyCache) ddata->propertyCache->addref();
QHashedV4String propertystring(QV4::Value::fromString(name));
QQmlContextData *context = QV4::QmlContextWrapper::callingContext(ctx->engine);
- QV8Engine *v8engine = QV8Engine::get(ctx->engine->publicEngine);
+ QV8Engine *v8engine = ctx->engine->v8Engine;
bool result = QV8QObjectWrapper::SetProperty(v8engine, object, propertystring, context, value, QV4::QObjectWrapper::IgnoreRevision);
if (!result) {
QStringList result;
- QV8Engine *v8Engine = QV8Engine::get(that->engine()->publicEngine);
+ QV8Engine *v8Engine = that->engine()->v8Engine;
QQmlEnginePrivate *ep = v8Engine->engine()
? QQmlEnginePrivate::get(v8Engine->engine())
: 0;
Q_ASSERT(pdata->isWritable() || pdata->isQList());
- StoreProperty(QV8Engine::get(wrapper->engine()->publicEngine), object, pdata, value);
+ StoreProperty(wrapper->engine()->v8Engine, object, pdata, value);
}
static void FastValueSetterReadOnly(v8::Handle<v8::String> property, v8::Handle<v8::Value>,
if (QQmlData::wasDeleted(wrapper->object()))
return;
- QV8Engine *v8engine = QV8Engine::get(wrapper->engine()->publicEngine);
+ QV8Engine *v8engine = wrapper->engine()->v8Engine;
QString error = QLatin1String("Cannot assign to read-only property \"") +
property->v4Value().toQString() + QLatin1Char('\"');
if (ctx->argumentCount == 0)
V4THROW_ERROR("Function.prototype.connect: no arguments given");
- // ### Eliminate, won't work within worker scripts
- QV8Engine *engine = QV8Engine::get(ctx->engine->publicEngine);
+ QV8Engine *engine = ctx->engine->v8Engine;
QPair<QObject *, int> signalInfo = ExtractQtSignal(engine, ctx->thisObject);
QObject *signalObject = signalInfo.first;
if (ctx->argumentCount == 0)
V4THROW_ERROR("Function.prototype.disconnect: no arguments given");
- // ### Eliminate, won't work within worker scripts
- QV8Engine *engine = QV8Engine::get(ctx->engine->publicEngine);
+ QV8Engine *engine = ctx->engine->v8Engine;
QPair<QObject *, int> signalInfo = ExtractQtSignal(engine, ctx->thisObject);
QObject *signalObject = signalInfo.first;
}
} else if (actual->IsObject()) {
QV4::Object *obj = actual->v4Value().asObject();
- QV8Engine *engine = obj->engine()->publicEngine->handle();
+ QV8Engine *engine = obj->engine()->v8Engine;
if (QV4::VariantObject *v = obj->as<QV4::VariantObject>()) {
if (conversionType == qMetaTypeId<QVariant>())
if (!ddata)
return QV4::Value::undefinedValue();
- QV8Engine *v8Engine = QV8Engine::get(context->engine->publicEngine);
+ QV8Engine *v8Engine = context->engine->v8Engine;
QQmlPropertyData method;