当前位置: 首页>>代码示例>>C++>>正文


C++ KPMetadata::setExif方法代码示例

本文整理汇总了C++中KPMetadata::setExif方法的典型用法代码示例。如果您正苦于以下问题:C++ KPMetadata::setExif方法的具体用法?C++ KPMetadata::setExif怎么用?C++ KPMetadata::setExif使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KPMetadata的用法示例。


在下文中一共展示了KPMetadata::setExif方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: apply

void XMPEditWidget::apply()
{
    if (d->modified && !d->isReadOnly)
    {
        KPImageInfo info(*d->dlg->currentItem());

        if (d->contentPage->syncHOSTCommentIsChecked())
        {
            info.setDescription(d->contentPage->getXMPCaption());
        }
        d->contentPage->applyMetadata(d->exifData, d->xmpData);

        if (d->originPage->syncHOSTDateIsChecked())
        {
            info.setDate(d->originPage->getXMPCreationDate());
        }
        d->originPage->applyMetadata(d->exifData, d->xmpData);

        d->subjectsPage->applyMetadata(d->xmpData);
        d->keywordsPage->applyMetadata(d->xmpData);
        d->categoriesPage->applyMetadata(d->xmpData);
        d->creditsPage->applyMetadata(d->xmpData);
        d->statusPage->applyMetadata(d->xmpData);
        d->propertiesPage->applyMetadata(d->xmpData);

        KPMetadata meta;

        meta.load((*d->dlg->currentItem()).path());
        meta.setExif(d->exifData);
        meta.setIptc(d->iptcData);
        meta.setXmp(d->xmpData);
        meta.save((*d->dlg->currentItem()).path());
        d->modified = false;
    }
}
开发者ID:NathanDM,项目名称:kipi-plugins,代码行数:35,代码来源:xmpeditwidget.cpp

示例2: applyMetadata

void EXIFAdjust::applyMetadata(QByteArray& exifData)
{
    KPMetadata meta;
    meta.setExif(exifData);
    long int num=1, den=1;

    if (d->brightnessCheck->isChecked())
    {
        meta.convertToRational(d->brightnessEdit->value(), &num, &den, 1);
        meta.setExifTagRational("Exif.Photo.BrightnessValue", num, den);
    }
    else
        meta.removeExifTag("Exif.Photo.BrightnessValue");

    if (d->gainControlCheck->isChecked())
        meta.setExifTagLong("Exif.Photo.GainControl", d->gainControlCB->currentIndex());
    else if (d->gainControlCheck->isValid())
        meta.removeExifTag("Exif.Photo.GainControl");

    if (d->contrastCheck->isChecked())
        meta.setExifTagLong("Exif.Photo.Contrast", d->contrastCB->currentIndex());
    else if (d->contrastCheck->isValid())
        meta.removeExifTag("Exif.Photo.Contrast");

    if (d->saturationCheck->isChecked())
        meta.setExifTagLong("Exif.Photo.Saturation", d->saturationCB->currentIndex());
    else if (d->saturationCheck->isValid())
        meta.removeExifTag("Exif.Photo.Saturation");

    if (d->sharpnessCheck->isChecked())
        meta.setExifTagLong("Exif.Photo.Sharpness", d->sharpnessCB->currentIndex());
    else if (d->sharpnessCheck->isValid())
        meta.removeExifTag("Exif.Photo.Sharpness");

    if (d->customRenderedCheck->isChecked())
        meta.setExifTagLong("Exif.Photo.CustomRendered", d->customRenderedCB->currentIndex());
    else if (d->customRenderedCheck->isValid())
        meta.removeExifTag("Exif.Photo.CustomRendered");

#if KEXIV2_VERSION >= 0x010000
    exifData = meta.getExifEncoded();
#else
    exifData = meta.getExif();
#endif
}
开发者ID:UIKit0,项目名称:digikam-2012-kipi-plugins,代码行数:45,代码来源:exifadjust.cpp

示例3: applyMetadata

void XMPContent::applyMetadata(QByteArray& exifData, QByteArray& xmpData)
{
    KPMetadata meta;
    meta.setExif(exifData);
    meta.setXmp(xmpData);

    if (d->headlineCheck->isChecked())
        meta.setXmpTagString("Xmp.photoshop.Headline", d->headlineEdit->text());
    else
        meta.removeXmpTag("Xmp.photoshop.Headline");

    KPMetadata::AltLangMap oldAltLangMap, newAltLangMap;
    if (d->captionEdit->getValues(oldAltLangMap, newAltLangMap))
    {
        meta.setXmpTagStringListLangAlt("Xmp.dc.description", newAltLangMap, false);

        if (syncEXIFCommentIsChecked())
            meta.setExifComment(getXMPCaption());

        if (syncJFIFCommentIsChecked())
            meta.setComments(getXMPCaption().toUtf8());
    }
    else if (d->captionEdit->isValid())
        meta.removeXmpTag("Xmp.dc.description");

    if (d->writerCheck->isChecked())
        meta.setXmpTagString("Xmp.photoshop.CaptionWriter", d->writerEdit->text());
    else
        meta.removeXmpTag("Xmp.photoshop.CaptionWriter");

    if (d->copyrightEdit->getValues(oldAltLangMap, newAltLangMap))
        meta.setXmpTagStringListLangAlt("Xmp.dc.rights", newAltLangMap, false);
    else if (d->copyrightEdit->isValid())
        meta.removeXmpTag("Xmp.dc.rights");

#if KEXIV2_VERSION >= 0x010000
    exifData = meta.getExifEncoded();
#else
    exifData = meta.getExif();
#endif

    xmpData  = meta.getXmp();
}
开发者ID:UIKit0,项目名称:digikam-2012-kipi-plugins,代码行数:43,代码来源:xmpcontent.cpp

示例4: applyMetadata

void XMPOrigin::applyMetadata(QByteArray& exifData, QByteArray& xmpData)
{
    KPMetadata meta;
    meta.setExif(exifData);
    meta.setXmp(xmpData);

    if (d->dateCreatedCheck->isChecked())
    {
        meta.setXmpTagString("Xmp.photoshop.DateCreated",
                                   getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
        meta.setXmpTagString("Xmp.xmp.CreateDate",
                                   getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
        meta.setXmpTagString("Xmp.exif.DateTimeCreated",
                                   getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
        meta.setXmpTagString("Xmp.exif.DateTimeOriginal",
                                   getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
        meta.setXmpTagString("Xmp.tiff.DateTime",
                                   getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
        meta.setXmpTagString("Xmp.xmp.ModifyDate",
                                   getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
        meta.setXmpTagString("Xmp.xmp.MetadataDate",
                                   getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
        if (syncEXIFDateIsChecked())
        {
            meta.setExifTagString("Exif.Image.DateTime",
                    getXMPCreationDate().toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii());
        }
    }
    else
    {
        meta.removeXmpTag("Xmp.photoshop.DateCreated");
        meta.removeXmpTag("Xmp.xmp.CreateDate");
        meta.removeXmpTag("Xmp.exif.DateTimeCreated");
        meta.removeXmpTag("Xmp.exif.DateTimeOriginal");
        meta.removeXmpTag("Xmp.tiff.DateTime");
        meta.removeXmpTag("Xmp.xmp.ModifyDate");
        meta.removeXmpTag("Xmp.xmp.MetadataDate");
    }

    if (d->dateDigitalizedCheck->isChecked())
        meta.setXmpTagString("Xmp.exif.DateTimeDigitized",
                                   d->dateDigitalizedSel->dateTime().toString("yyyy:MM:dd hh:mm:ss"));
    else
        meta.removeXmpTag("Xmp.exif.DateTimeDigitized");

    if (d->cityCheck->isChecked())
        meta.setXmpTagString("Xmp.photoshop.City", d->cityEdit->text());
    else
        meta.removeXmpTag("Xmp.photoshop.City");

    if (d->sublocationCheck->isChecked())
        meta.setXmpTagString("Xmp.iptc.Location", d->sublocationEdit->text());
    else
        meta.removeXmpTag("Xmp.iptc.Location");

    if (d->provinceCheck->isChecked())
        meta.setXmpTagString("Xmp.photoshop.State", d->provinceEdit->text());
    else
        meta.removeXmpTag("Xmp.photoshop.State");

    if (d->countryCheck->isChecked())
    {
        QString countryName = d->countryCB->currentText().mid(6);
        QString countryCode = d->countryCB->currentText().left(3);
        meta.setXmpTagString("Xmp.iptc.CountryCode", countryCode);
        meta.setXmpTagString("Xmp.photoshop.Country", countryName);
    }
    else if (d->countryCheck->isValid())
    {
        meta.removeXmpTag("Xmp.iptc.CountryCode");
        meta.removeXmpTag("Xmp.photoshop.Country");
    }

#if KEXIV2_VERSION >= 0x010000
    exifData = meta.getExifEncoded();
#else
    exifData = meta.getExif();
#endif

    xmpData  = meta.getXmp();
}
开发者ID:UIKit0,项目名称:digikam-2012-kipi-plugins,代码行数:81,代码来源:xmporigin.cpp

示例5: applyMetadata

void EXIFDevice::applyMetadata(QByteArray& exifData)
{
    KPMetadata meta;
    meta.setExif(exifData);
    long int num=1, den=1;

    if (d->makeCheck->isChecked())
        meta.setExifTagString("Exif.Image.Make", d->makeEdit->text());
    else
        meta.removeExifTag("Exif.Image.Make");

    if (d->modelCheck->isChecked())
        meta.setExifTagString("Exif.Image.Model", d->modelEdit->text());
    else
        meta.removeExifTag("Exif.Image.Model");

    if (d->deviceTypeCheck->isChecked())
        meta.setExifTagLong("Exif.Photo.FileSource", d->deviceTypeCB->currentIndex()+1);
    else if (d->deviceTypeCheck->isValid())
        meta.removeExifTag("Exif.Photo.FileSource");

    if (d->exposureTimeCheck->isChecked())
    {
        meta.setExifTagRational("Exif.Photo.ExposureTime", d->exposureTimeNumEdit->value(),
                                      d->exposureTimeDenEdit->value());

        double exposureTime = (double)(d->exposureTimeNumEdit->value())/
                              (double)(d->exposureTimeDenEdit->value());
        double shutterSpeed = (-1.0)*(std::log(exposureTime)/std::log(2.0));
        meta.convertToRational(shutterSpeed, &num, &den, 8);
        meta.setExifTagRational("Exif.Photo.ShutterSpeedValue", num, den);
    }
    else
    {
        meta.removeExifTag("Exif.Photo.ExposureTime");
        meta.removeExifTag("Exif.Photo.ShutterSpeedValue");
    }

    if (d->exposureProgramCheck->isChecked())
        meta.setExifTagLong("Exif.Photo.ExposureProgram", d->exposureProgramCB->currentIndex());
    else if (d->exposureProgramCheck->isValid())
        meta.removeExifTag("Exif.Photo.ExposureProgram");

    if (d->exposureModeCheck->isChecked())
        meta.setExifTagLong("Exif.Photo.ExposureMode", d->exposureModeCB->currentIndex());
    else if (d->exposureModeCheck->isValid())
        meta.removeExifTag("Exif.Photo.ExposureMode");

    if (d->exposureBiasCheck->isChecked())
    {
        meta.convertToRational(d->exposureBiasEdit->value(), &num, &den, 1);
        meta.setExifTagRational("Exif.Photo.ExposureBiasValue", num, den);
    }
    else
    {
        meta.removeExifTag("Exif.Photo.ExposureBiasValue");
    }

    if (d->meteringModeCheck->isChecked())
    {
        long met = d->meteringModeCB->currentIndex();
        meta.setExifTagLong("Exif.Photo.MeteringMode", met > 6 ? 255 : met);
    }
    else if (d->meteringModeCheck->isValid())
        meta.removeExifTag("Exif.Photo.MeteringMode");

    if (d->ISOSpeedCheck->isChecked())
    {
        meta.setExifTagLong("Exif.Photo.ISOSpeedRatings", d->ISOSpeedCB->currentText().toLong());

        meta.convertToRational(d->ISOSpeedCB->currentText().toDouble(), &num, &den, 1);
        meta.setExifTagRational("Exif.Photo.ExposureIndex", num, den);
    }
    else if (d->ISOSpeedCheck->isValid())
    {
        meta.removeExifTag("Exif.Photo.ISOSpeedRatings");
        meta.removeExifTag("Exif.Photo.ExposureIndex");
    }

    if (d->sensingMethodCheck->isChecked())
    {
        long sem = d->sensingMethodCB->currentIndex();
        meta.setExifTagLong("Exif.Photo.SensingMethod", sem > 4 ? sem+2 : sem+1);
    }
    else if (d->sensingMethodCheck->isValid())
    {
        meta.removeExifTag("Exif.Photo.SensingMethod");
    }

    if (d->sceneTypeCheck->isChecked())
        meta.setExifTagLong("Exif.Photo.SceneCaptureType", d->sceneTypeCB->currentIndex());
    else if (d->sceneTypeCheck->isValid())
        meta.removeExifTag("Exif.Photo.SceneCaptureType");

    if (d->subjectDistanceTypeCheck->isChecked())
        meta.setExifTagLong("Exif.Photo.SubjectDistanceRange", d->subjectDistanceTypeCB->currentIndex());
    else if (d->subjectDistanceTypeCheck->isValid())
        meta.removeExifTag("Exif.Photo.SubjectDistanceRange");

#if KEXIV2_VERSION >= 0x010000
//.........这里部分代码省略.........
开发者ID:rickysarraf,项目名称:digikam,代码行数:101,代码来源:exifdevice.cpp


注:本文中的KPMetadata::setExif方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。