Exemple #1
0
EncodedJSValue JSC_HOST_CALL jsProgressEventPrototypeFunctionInitProgressEvent(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSProgressEvent::s_info))
        return throwVMTypeError(exec);
    JSProgressEvent* castedThis = static_cast<JSProgressEvent*>(asObject(thisValue));
    ProgressEvent* imp = static_cast<ProgressEvent*>(castedThis->impl());
    const String& typeArg(ustringToString(exec->argument(0).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    bool canBubbleArg(exec->argument(1).toBoolean(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    bool cancelableArg(exec->argument(2).toBoolean(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    bool lengthComputableArg(exec->argument(3).toBoolean(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    unsigned long long loadedArg(static_cast<unsigned long long>(exec->argument(4).toInteger(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    unsigned long long totalArg(static_cast<unsigned long long>(exec->argument(5).toInteger(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    imp->initProgressEvent(typeArg, canBubbleArg, cancelableArg, lengthComputableArg, loadedArg, totalArg);
    return JSValue::encode(jsUndefined());
}
Exemple #2
0
JSValue jsProgressEventTotal(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSProgressEvent* castedThis = static_cast<JSProgressEvent*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    ProgressEvent* imp = static_cast<ProgressEvent*>(castedThis->impl());
    JSValue result = jsNumber(imp->total());
    return result;
}
Exemple #3
0
JSValue jsProgressEventLengthComputable(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSProgressEvent* castedThis = static_cast<JSProgressEvent*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    ProgressEvent* imp = static_cast<ProgressEvent*>(castedThis->impl());
    JSValue result = jsBoolean(imp->lengthComputable());
    return result;
}
JSValue* jsProgressEventPrototypeFunctionInitProgressEvent(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSProgressEvent::s_info))
        return throwError(exec, TypeError);
    JSProgressEvent* castedThisObj = static_cast<JSProgressEvent*>(thisValue);
    ProgressEvent* imp = static_cast<ProgressEvent*>(castedThisObj->impl());
    const UString& typeArg = args.at(exec, 0)->toString(exec);
    bool canBubbleArg = args.at(exec, 1)->toBoolean(exec);
    bool cancelableArg = args.at(exec, 2)->toBoolean(exec);
    bool lengthComputableArg = args.at(exec, 3)->toBoolean(exec);
    unsigned loadedArg = args.at(exec, 4)->toInt32(exec);
    unsigned totalArg = args.at(exec, 5)->toInt32(exec);

    imp->initProgressEvent(typeArg, canBubbleArg, cancelableArg, lengthComputableArg, loadedArg, totalArg);
    return jsUndefined();
}
JSValue JSC_HOST_CALL jsProgressEventPrototypeFunctionInitProgressEvent(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSProgressEvent::s_info))
        return throwError(exec, TypeError);
    JSProgressEvent* castedThisObj = static_cast<JSProgressEvent*>(asObject(thisValue));
    ProgressEvent* imp = static_cast<ProgressEvent*>(castedThisObj->impl());
    const UString& typeArg = args.at(0).toString(exec);
    bool canBubbleArg = args.at(1).toBoolean(exec);
    bool cancelableArg = args.at(2).toBoolean(exec);
    bool lengthComputableArg = args.at(3).toBoolean(exec);
    unsigned loadedArg = args.at(4).toInt32(exec);
    unsigned totalArg = args.at(5).toInt32(exec);

    imp->initProgressEvent(typeArg, canBubbleArg, cancelableArg, lengthComputableArg, loadedArg, totalArg);
    return jsUndefined();
}
 bool ProgressWidget::event(QEvent * e )
 {
    switch(e->type())
    {
       case PROGRESS_EVENT_ID:
       {
          ProgressEvent* evt = dynamic_cast<ProgressEvent*>(e);
          if(evt)
          {
             setValue(static_cast<int>(evt->percentComplete()));
             e->accept();
             return true;
          }
          break;
       }
       default:
       {
          break;
       }
    }
    return QProgressBar::event(e);
 }
JSValue* JSProgressEvent::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case LengthComputableAttrNum: {
        ProgressEvent* imp = static_cast<ProgressEvent*>(impl());
        return jsBoolean(imp->lengthComputable());
    }
    case LoadedAttrNum: {
        ProgressEvent* imp = static_cast<ProgressEvent*>(impl());
        return jsNumber(exec, imp->loaded());
    }
    case TotalAttrNum: {
        ProgressEvent* imp = static_cast<ProgressEvent*>(impl());
        return jsNumber(exec, imp->total());
    }
    case ConstructorAttrNum:
        return getConstructor(exec);
    }
    return 0;
}