Ejemplo n.º 1
0
void Overlay::setProperties(const QScriptValue& properties) {
    QScriptValue color = properties.property("color");
    if (color.isValid()) {
        QScriptValue red = color.property("red");
        QScriptValue green = color.property("green");
        QScriptValue blue = color.property("blue");
        if (red.isValid() && green.isValid() && blue.isValid()) {
            _color.red = red.toVariant().toInt();
            _color.green = green.toVariant().toInt();
            _color.blue = blue.toVariant().toInt();
        }
    }

    if (properties.property("alpha").isValid()) {
        setAlpha(properties.property("alpha").toVariant().toFloat());
    }
    
    if (properties.property("glowLevel").isValid()) {
        setGlowLevel(properties.property("glowLevel").toVariant().toFloat());
    }

    if (properties.property("pulseMax").isValid()) {
        setPulseMax(properties.property("pulseMax").toVariant().toFloat());
    }

    if (properties.property("pulseMin").isValid()) {
        setPulseMin(properties.property("pulseMin").toVariant().toFloat());
    }

    if (properties.property("pulsePeriod").isValid()) {
        setPulsePeriod(properties.property("pulsePeriod").toVariant().toFloat());
    }
    
    if (properties.property("glowLevelPulse").isValid()) {
        setGlowLevelPulse(properties.property("glowLevelPulse").toVariant().toFloat());
    }
    
    if (properties.property("alphaPulse").isValid()) {
        setAlphaPulse(properties.property("alphaPulse").toVariant().toFloat());
    }

    if (properties.property("colorPulse").isValid()) {
        setColorPulse(properties.property("colorPulse").toVariant().toFloat());
    }

    if (properties.property("visible").isValid()) {
        setVisible(properties.property("visible").toVariant().toBool());
    }
    
    if (properties.property("anchor").isValid()) {
        QString property = properties.property("anchor").toVariant().toString();
        if (property == "MyAvatar") {
            setAnchor(MY_AVATAR);
        }
    }
}
Ejemplo n.º 2
0
void Overlay::setProperties(const QVariantMap& properties) {
    bool valid;
    auto color = xColorFromVariant(properties["color"], valid);
    if (valid) {
        _color = color;
    }

    if (properties["alpha"].isValid()) {
        setAlpha(properties["alpha"].toFloat());
    }

    if (properties["pulseMax"].isValid()) {
        setPulseMax(properties["pulseMax"].toFloat());
    }

    if (properties["pulseMin"].isValid()) {
        setPulseMin(properties["pulseMin"].toFloat());
    }

    if (properties["pulsePeriod"].isValid()) {
        setPulsePeriod(properties["pulsePeriod"].toFloat());
    }

    if (properties["alphaPulse"].isValid()) {
        setAlphaPulse(properties["alphaPulse"].toFloat());
    }

    if (properties["colorPulse"].isValid()) {
        setColorPulse(properties["colorPulse"].toFloat());
    }

    if (properties["visible"].isValid()) {
        bool visible = properties["visible"].toBool();
        setVisible(visible);
    }

    if (properties["anchor"].isValid()) {
        QString property = properties["anchor"].toString();
        if (property == "MyAvatar") {
            setAnchor(MY_AVATAR);
        }
    }
}