void KisPaintOpPreset::fromXML(const QDomElement& presetElt)
{
    setName(presetElt.attribute("name"));
    QString paintopid = presetElt.attribute("paintopid");

    if (paintopid.isEmpty())
    {
        dbgImage << "No paintopid attribute";
        setValid(false);
        return;
    }

    if (KisPaintOpRegistry::instance()->get(paintopid) == 0)
    {
        dbgImage << "No paintop " << paintopid;
        setValid(false);
        return;
    }

    KoID id(paintopid);

    KisPaintOpSettingsSP settings = KisPaintOpRegistry::instance()->settings(id, 0);
    if (!settings)
    {
        setValid(false);
        qWarning() << "Could not load settings for preset" << paintopid;
        return;
    }
    settings->fromXML(presetElt);
    setSettings(settings);
}
示例#2
0
KisPaintOpPresetSP KisRecordedPaintActionFactory::paintOpPresetFromXML(const QString& paintOpId, const QDomElement& elt, KisImageSP image)
{
    Q_UNUSED(paintOpId);
    Q_UNUSED(elt);
    Q_UNUSED(image);

#if 0
    KisPaintOpSettingsSP settings = KisPaintOpRegistry::instance()->get(paintOpId)->settings(image);
    if (settings) {
        settings->fromXML(elt);
    }
#else
    //KisPaintOpSettingsSP settings;
    KisPaintOpPresetSP settings;
#endif
    return settings;
}