Exemple #1
0
void XMPSubjects::applyMetadata(QByteArray& xmpData)
{
    DMetadata meta;
    meta.setXmp(xmpData);
    QStringList newSubjects = subjectsList();

    // We remove in first all existing subjects.
    meta.removeXmpTag("Xmp.iptc.SubjectCode");

    // And add new list if necessary.
    if (m_subjectsCheck->isChecked())
        meta.setXmpSubjects(newSubjects);

    xmpData = meta.getXmp();
}
Exemple #2
0
void XMPCredits::applyMetadata(QByteArray& xmpData)
{
    QStringList oldList, newList;
    DMetadata meta;
    meta.setXmp(xmpData);

    if (d->bylineEdit->getValues(oldList, newList))
        meta.setXmpTagStringSeq("Xmp.dc.creator", newList);
    else
        meta.removeXmpTag("Xmp.dc.creator");

    if (d->bylineTitleCheck->isChecked())
        meta.setXmpTagString("Xmp.photoshop.AuthorsPosition", d->bylineTitleEdit->text());
    else
        meta.removeXmpTag("Xmp.photoshop.AuthorsPosition");

    // --------------------------------------------------------

    if (d->emailCheck->isChecked())
    {
        meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiEmailWork", d->emailEdit->text());
        meta.removeXmpTag("Xmp.iptc.CiEmailWork");
    }
    else
    {
        meta.removeXmpTag("Xmp.iptc.CiEmailWork");
        meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiEmailWork");
    }

    if (d->urlCheck->isChecked())
    {
        meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiUrlWork", d->urlEdit->text());
        meta.removeXmpTag("Xmp.iptc.CiUrlWork");
    }
    else
    {
        meta.removeXmpTag("Xmp.iptc.CiUrlWork");
        meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiUrlWork");
    }

    if (d->phoneCheck->isChecked())
    {
        meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiTelWork", d->phoneEdit->text());
        meta.removeXmpTag("Xmp.iptc.CiTelWork");
    }
    else
    {
        meta.removeXmpTag("Xmp.iptc.CiTelWork");
        meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiTelWork");
    }

    if (d->addressCheck->isChecked())
    {
        meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrExtadr", d->addressEdit->text());
        meta.removeXmpTag("Xmp.iptc.CiAdrExtadr");
    }
    else
    {
        meta.removeXmpTag("Xmp.iptc.CiAdrExtadr");
        meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrExtadr");
    }

    if (d->postalCodeCheck->isChecked())
    {
        meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrPcode", d->postalCodeEdit->text());
        meta.removeXmpTag("Xmp.iptc.CiAdrPcode");
    }
    else
    {
        meta.removeXmpTag("Xmp.iptc.CiAdrPcode");
        meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrPcode");
    }

    if (d->cityCheck->isChecked())
    {
        meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrCity", d->cityEdit->text());
        meta.removeXmpTag("Xmp.iptc.CiAdrCity");
    }
    else
    {
        meta.removeXmpTag("Xmp.iptc.CiAdrCity");
        meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrCity");
    }

    if (d->countryCheck->isChecked())
    {
        meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrCtry", d->countryEdit->text());
        meta.removeXmpTag("Xmp.iptc.CiAdrCtry");
    }
    else
    {
        meta.removeXmpTag("Xmp.iptc.CiAdrCtry");
        meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrCtry");
    }

    // --------------------------------------------------------

    if (d->creditCheck->isChecked())
        meta.setXmpTagString("Xmp.photoshop.Credit", d->creditEdit->text());
    else
        meta.removeXmpTag("Xmp.photoshop.Credit");

    if (d->sourceCheck->isChecked())
    {
        meta.setXmpTagString("Xmp.photoshop.Source", d->sourceEdit->text());
        meta.setXmpTagString("Xmp.dc.source", d->sourceEdit->text());
    }
    else
    {
        meta.removeXmpTag("Xmp.photoshop.Source");
        meta.removeXmpTag("Xmp.dc.source");
    }

    xmpData = meta.getXmp();
}