94
96
bool DMetadata::loadUsingDcraw(const QString& filePath) const
96
98
DcrawInfoContainer identify;
97
100
if (KDcraw::rawFileIdentify(identify, filePath))
99
102
long int num=1, den=1;
101
104
if (!identify.model.isNull())
102
106
setExifTagString("Exif.Image.Model", identify.model.toLatin1(), false);
104
109
if (!identify.make.isNull())
105
111
setExifTagString("Exif.Image.Make", identify.make.toLatin1(), false);
107
114
if (!identify.owner.isNull())
108
116
setExifTagString("Exif.Image.Artist", identify.owner.toLatin1(), false);
110
119
if (identify.sensitivity != -1)
111
121
setExifTagLong("Exif.Photo.ISOSpeedRatings", lroundf(identify.sensitivity), false);
113
124
if (identify.dateTime.isValid())
114
126
setImageDateTime(identify.dateTime, false, false);
116
129
if (identify.exposureTime != -1.0)
177
194
// Get author name from IPTC DescriptionWriter. Private namespace above gets precedence.
178
195
QVariant descriptionWriter = getMetadataField(MetadataInfo::DescriptionWriter);
179
197
if (!descriptionWriter.isNull())
180
199
commonAuthor = descriptionWriter.toString();
182
202
// In first, we check XMP alternative language tags to create map of values.
186
206
commentsMap = getXmpTagStringListLangAlt("Xmp.dc.description", false);
187
208
if (!commentsMap.isEmpty())
189
210
captionsMap.setData(commentsMap, authorsMap, commonAuthor, datesMap);
286
320
// NOTE : setXmpTagStringListLangAlt remove xmp tag before to add new values
287
321
if (!setXmpTagStringListLangAlt("Xmp.dc.description", comments.toAltLangMap(), false))
290
326
removeXmpTag("Xmp.exif.UserComment");
292
328
if (!defaultComment.isNull())
293
329
if (!setXmpTagStringLangAlt("Xmp.exif.UserComment", defaultComment, QString(), false))
296
334
removeXmpTag("Xmp.tiff.ImageDescription");
297
336
if (!defaultComment.isNull())
298
337
if (!setXmpTagStringLangAlt("Xmp.tiff.ImageDescription", defaultComment, QString(), false))
301
343
// In Four we write comments into IPTC.
302
344
// Note that Caption IPTC tag is limited to 2000 char and ASCII charset.
317
361
int DMetadata::getImageRating() const
319
363
if (getFilePath().isEmpty())
324
370
QString value = getXmpTagString("Xmp.xmp.Rating", false);
325
372
if (!value.isEmpty())
328
375
long rating = value.toLong(&ok);
329
377
if (ok && rating >= RatingMin && rating <= RatingMax)
333
383
value = getXmpTagString("Xmp.MicrosoftPhoto.Rating", false);
334
385
if (!value.isEmpty())
337
388
long ratingPercent = value.toLong(&ok);
340
392
// Wrapper around rating percents managed by Windows Vista.
341
393
long rating = -1;
342
switch(ratingPercent)
395
switch (ratingPercent)
405
463
if (!IptcUrgency.isEmpty())
407
465
if (IptcUrgency == QString("1"))
409
469
else if (IptcUrgency == QString("2"))
411
473
else if (IptcUrgency == QString("3"))
413
477
else if (IptcUrgency == QString("4"))
415
481
else if (IptcUrgency == QString("5"))
417
485
else if (IptcUrgency == QString("6"))
419
489
else if (IptcUrgency == QString("7"))
421
493
else if (IptcUrgency == QString("8"))
500
585
photoInfo.dateTime = getImageDateTime();
502
587
photoInfo.make = getExifTagString("Exif.Image.Make");
503
589
if (photoInfo.make.isEmpty())
504
591
photoInfo.make = getXmpTagString("Xmp.tiff.Make");
506
594
photoInfo.model = getExifTagString("Exif.Image.Model");
507
596
if (photoInfo.model.isEmpty())
508
598
photoInfo.model = getXmpTagString("Xmp.tiff.Model");
510
601
photoInfo.lens = getLensDescription();
512
603
photoInfo.aperture = getExifTagString("Exif.Photo.FNumber");
513
605
if (photoInfo.aperture.isEmpty())
514
607
photoInfo.aperture = getExifTagString("Exif.Photo.ApertureValue");
515
610
if (photoInfo.aperture.isEmpty())
516
612
photoInfo.aperture = getXmpTagString("Xmp.exif.FNumber");
517
615
if (photoInfo.aperture.isEmpty())
518
617
photoInfo.aperture = getXmpTagString("Xmp.exif.ApertureValue");
520
620
photoInfo.exposureTime = getExifTagString("Exif.Photo.ExposureTime");
521
622
if (photoInfo.exposureTime.isEmpty())
522
624
photoInfo.exposureTime = getExifTagString("Exif.Photo.ShutterSpeedValue");
523
627
if (photoInfo.exposureTime.isEmpty())
524
629
photoInfo.exposureTime = getXmpTagString("Xmp.exif.ExposureTime");
525
632
if (photoInfo.exposureTime.isEmpty())
526
634
photoInfo.exposureTime = getXmpTagString("Xmp.exif.ShutterSpeedValue");
528
637
photoInfo.exposureMode = getExifTagString("Exif.Photo.ExposureMode");
529
639
if (photoInfo.exposureMode.isEmpty())
530
641
photoInfo.exposureMode = getXmpTagString("Xmp.exif.ExposureMode");
531
644
if (photoInfo.exposureMode.isEmpty())
532
646
photoInfo.exposureMode = getExifTagString("Exif.CanonCs.MeteringMode");
534
649
photoInfo.exposureProgram = getExifTagString("Exif.Photo.ExposureProgram");
535
651
if (photoInfo.exposureProgram.isEmpty())
536
653
photoInfo.exposureProgram = getXmpTagString("Xmp.exif.ExposureProgram");
537
656
if (photoInfo.exposureProgram.isEmpty())
538
658
photoInfo.exposureProgram = getExifTagString("Exif.CanonCs.ExposureProgram");
540
661
photoInfo.focalLength = getExifTagString("Exif.Photo.FocalLength");
541
663
if (photoInfo.focalLength.isEmpty())
542
665
photoInfo.focalLength = getXmpTagString("Xmp.exif.FocalLength");
543
668
if (photoInfo.focalLength.isEmpty())
544
670
photoInfo.focalLength = getExifTagString("Exif.Canon.FocalLength");
546
673
photoInfo.focalLength35mm = getExifTagString("Exif.Photo.FocalLengthIn35mmFilm");
547
675
if (photoInfo.focalLength35mm.isEmpty())
548
677
photoInfo.focalLength35mm = getXmpTagString("Xmp.exif.FocalLengthIn35mmFilm");
550
680
photoInfo.sensitivity = getExifTagString("Exif.Photo.ISOSpeedRatings");
551
682
if (photoInfo.sensitivity.isEmpty())
552
684
photoInfo.sensitivity = getExifTagString("Exif.Photo.ExposureIndex");
553
687
if (photoInfo.sensitivity.isEmpty())
554
689
photoInfo.sensitivity = getXmpTagString("Xmp.exif.ISOSpeedRatings");
555
692
if (photoInfo.sensitivity.isEmpty())
556
694
photoInfo.sensitivity = getXmpTagString("Xmp.exif.ExposureIndex");
557
697
if (photoInfo.sensitivity.isEmpty())
558
699
photoInfo.sensitivity = getExifTagString("Exif.CanonSi.ISOSpeed");
560
702
photoInfo.flash = getExifTagString("Exif.Photo.Flash");
561
704
if (photoInfo.flash.isEmpty())
562
706
photoInfo.flash = getXmpTagString("Xmp.exif.Flash");
563
709
if (photoInfo.flash.isEmpty())
564
711
photoInfo.flash = getExifTagString("Exif.CanonCs.FlashActivity");
566
714
photoInfo.whiteBalance = getExifTagString("Exif.Photo.WhiteBalance");
567
716
if (photoInfo.whiteBalance.isEmpty())
568
718
photoInfo.whiteBalance = getXmpTagString("Xmp.exif.WhiteBalance");
571
722
return photoInfo;
629
791
if (supportXmp())
631
793
if (!setXmpTagStringSeq("Xmp.digiKam.TagsList", tagsPath))
634
798
QStringList LRtagsPath = tagsPath;
635
799
LRtagsPath = LRtagsPath.replaceInStrings("/", "|");
636
801
if (!setXmpTagStringBag("Xmp.lr.hierarchicalSubject", LRtagsPath))
642
810
bool DMetadata::setMetadataTemplate(const Template& t) const
644
if (t.isNull()) return false;
646
817
if (!setProgramId())
649
822
QStringList authors = t.authors();
650
823
QString authorsPosition = t.authorsPosition();
661
834
if (supportXmp())
663
836
if (!setXmpTagStringSeq("Xmp.dc.creator", authors, false))
666
841
if (!setXmpTagStringSeq("Xmp.tiff.Artist", authors, false))
669
846
if (!setXmpTagString("Xmp.photoshop.AuthorsPosition", authorsPosition, false))
672
851
if (!setXmpTagString("Xmp.photoshop.Credit", credit, false))
675
856
if (!setXmpTagString("Xmp.photoshop.Source", source, false))
678
861
if (!setXmpTagString("Xmp.dc.source", source, false))
681
866
if (!setXmpTagStringListLangAlt("Xmp.dc.rights", copyright, false))
684
871
if (!setXmpTagStringListLangAlt("Xmp.tiff.Copyright", copyright, false))
687
876
if (!setXmpTagStringListLangAlt("Xmp.xmpRights.UsageTerms", rightUsage, false))
690
881
if (!setXmpTagString("Xmp.photoshop.Instructions", instructions, false))
694
887
// Set IPTC tags.
696
889
if (!setIptcTagsStringList("Iptc.Application2.Byline", 32,
697
890
getIptcTagsStringList("Iptc.Application2.Byline"),
698
authors, false)) return false;
700
if (!setIptcTag(authorsPosition, 32, "Authors Title", "Iptc.Application2.BylineTitle")) return false;
701
if (!setIptcTag(credit, 32, "Credit", "Iptc.Application2.Credit")) return false;
702
if (!setIptcTag(source, 32, "Source", "Iptc.Application2.Source")) return false;
703
if (!setIptcTag(copyright["x-default"], 128, "Copyright", "Iptc.Application2.Copyright")) return false;
704
if (!setIptcTag(instructions, 256, "Instructions", "Iptc.Application2.SpecialInstructions")) return false;
706
if (!setIptcCoreLocation(t.locationInfo())) return false;
707
if (!setCreatorContactInfo(t.contactInfo())) return false;
896
if (!setIptcTag(authorsPosition, 32, "Authors Title", "Iptc.Application2.BylineTitle"))
901
if (!setIptcTag(credit, 32, "Credit", "Iptc.Application2.Credit"))
906
if (!setIptcTag(source, 32, "Source", "Iptc.Application2.Source"))
911
if (!setIptcTag(copyright["x-default"], 128, "Copyright", "Iptc.Application2.Copyright"))
916
if (!setIptcTag(instructions, 256, "Instructions", "Iptc.Application2.SpecialInstructions"))
921
if (!setIptcCoreLocation(t.locationInfo()))
926
if (!setCreatorContactInfo(t.contactInfo()))
709
931
if (supportXmp())
711
if (!setXmpSubjects(t.IptcSubjects())) return false;
933
if (!setXmpSubjects(t.IptcSubjects()))
714
939
// Synchronize Iptc subjects tags with Xmp subjects tags.
861
1097
info.phone = metadataInfos[6].toString();
862
1098
info.webUrl = metadataInfos[7].toString();
867
1104
bool DMetadata::setCreatorContactInfo(const IptcCoreContactInfo& info) const
869
1106
if (!supportXmp())
872
1111
if (!setXmpTagString("Xmp.iptc.CiAdrCity", info.city, false))
875
1116
if (!setXmpTagString("Xmp.iptc.CiAdrCtry", info.country, false))
878
1121
if (!setXmpTagString("Xmp.iptc.CiAdrExtadr", info.address, false))
881
1126
if (!setXmpTagString("Xmp.iptc.CiAdrPcode", info.postalCode, false))
884
1131
if (!setXmpTagString("Xmp.iptc.CiAdrRegion", info.provinceState, false))
887
1136
if (!setXmpTagString("Xmp.iptc.CiEmailWork", info.email, false))
890
1141
if (!setXmpTagString("Xmp.iptc.CiTelWork", info.phone, false))
893
1146
if (!setXmpTagString("Xmp.iptc.CiUrlWork", info.webUrl, false))
924
1181
if (supportXmp())
926
1183
if (!setXmpTagString("Xmp.photoshop.Country", location.country, false))
929
1188
if (!setXmpTagString("Xmp.iptc.CountryCode", location.countryCode, false))
932
1193
if (!setXmpTagString("Xmp.photoshop.City", location.city, false))
935
1198
if (!setXmpTagString("Xmp.iptc.Location", location.location, false))
938
1203
if (!setXmpTagString("Xmp.photoshop.State", location.provinceState, false))
942
if (!setIptcTag(location.country, 64, "Country", "Iptc.Application2.CountryName")) return false;
943
if (!setIptcTag(location.countryCode, 3, "Country Code", "Iptc.Application2.CountryCode")) return false;
944
if (!setIptcTag(location.city, 32, "City", "Iptc.Application2.City")) return false;
945
if (!setIptcTag(location.location, 32, "SubLocation", "Iptc.Application2.SubLocation")) return false;
946
if (!setIptcTag(location.provinceState, 32, "Province/State", "Iptc.Application2.ProvinceState")) return false;
1209
if (!setIptcTag(location.country, 64, "Country", "Iptc.Application2.CountryName"))
1214
if (!setIptcTag(location.countryCode, 3, "Country Code", "Iptc.Application2.CountryCode"))
1219
if (!setIptcTag(location.city, 32, "City", "Iptc.Application2.City"))
1224
if (!setIptcTag(location.location, 32, "SubLocation", "Iptc.Application2.SubLocation"))
1229
if (!setIptcTag(location.provinceState, 32, "Province/State", "Iptc.Application2.ProvinceState"))
994
1283
for (QStringList::Iterator it = lensExifTags.begin(); it != lensExifTags.end(); ++it)
996
1285
lens = getExifTagString((*it).toAscii());
997
1287
if ( !lens.isEmpty() &&
998
1288
!(lens.startsWith('(') && lens.endsWith(')')) ) // To prevent undecoded tag values from Exiv2 as "(65535)".
1002
1294
// -------------------------------------------------------------------
1003
1295
// Try to get Lens Data information from XMP.
1004
1296
// XMP aux tags.
1005
1297
lens = getXmpTagString("Xmp.aux.Lens");
1006
1299
if (lens.isEmpty())
1008
1301
// XMP M$ tags (Lens Maker + Lens Model).
1009
1302
lens = getXmpTagString("Xmp.MicrosoftPhoto.LensManufacturer");
1010
1304
if (!lens.isEmpty())
1011
1306
lens.append(" ");
1013
1309
lens.append(getXmpTagString("Xmp.MicrosoftPhoto.LensModel"));
1057
1354
return setIptcTagString(tagKey, truncatedText); // returns false if failed
1060
inline QVariant DMetadata::fromExifOrXmp(const char *exifTagName, const char *xmpTagName) const
1357
inline QVariant DMetadata::fromExifOrXmp(const char* exifTagName, const char* xmpTagName) const
1064
1361
if (exifTagName)
1066
1363
var = getExifTagVariant(exifTagName, false);
1067
1365
if (!var.isNull())
1071
1371
if (xmpTagName)
1073
1373
var = getXmpTagVariant(xmpTagName);
1074
1375
if (!var.isNull())
1081
inline QVariant DMetadata::fromIptcOrXmp(const char *iptcTagName, const char *xmpTagName) const
1384
inline QVariant DMetadata::fromIptcOrXmp(const char* iptcTagName, const char* xmpTagName) const
1083
1386
if (iptcTagName)
1085
1388
QString iptcValue = getIptcTagString(iptcTagName);
1086
1390
if (!iptcValue.isNull())
1087
1392
return iptcValue;
1090
1396
if (xmpTagName)
1092
1398
QVariant var = getXmpTagVariant(xmpTagName);
1093
1400
if (!var.isNull())
1097
1406
return QVariant(QVariant::String);
1100
inline QVariant DMetadata::fromIptcEmulateList(const char *iptcTagName) const
1409
inline QVariant DMetadata::fromIptcEmulateList(const char* iptcTagName) const
1102
1411
return toStringListVariant(getIptcTagsStringList(iptcTagName));
1105
inline QVariant DMetadata::fromXmpList(const char *xmpTagName) const
1414
inline QVariant DMetadata::fromXmpList(const char* xmpTagName) const
1107
1416
QVariant var = getXmpTagVariant(xmpTagName);
1109
1418
if (var.isNull())
1110
1420
return QVariant(QVariant::StringList);
1114
inline QVariant DMetadata::fromIptcEmulateLangAlt(const char *iptcTagName) const
1426
inline QVariant DMetadata::fromIptcEmulateLangAlt(const char* iptcTagName) const
1116
1428
QString str = getIptcTagString(iptcTagName);
1117
1430
if (str.isNull())
1118
1432
return QVariant(QVariant::Map);
1120
1435
QMap<QString, QVariant> map;
1121
1436
map["x-default"] = str;
1125
inline QVariant DMetadata::fromXmpLangAlt(const char *xmpTagName) const
1440
inline QVariant DMetadata::fromXmpLangAlt(const char* xmpTagName) const
1127
1442
QVariant var = getXmpTagVariant(xmpTagName);
1129
1444
if (var.isNull())
1130
1446
return QVariant(QVariant::Map);
1134
inline QVariant DMetadata::toStringListVariant(const QStringList &list) const
1452
inline QVariant DMetadata::toStringListVariant(const QStringList& list) const
1136
1454
if (list.isEmpty())
1137
1456
return QVariant(QVariant::StringList);
1256
1595
case MetadataInfo::LongitudeNumber:
1258
1597
double longitude;
1259
1599
if (getGPSLongitudeNumber(&longitude))
1260
1601
return longitude;
1262
1605
return QVariant(QVariant::Double);
1264
1608
case MetadataInfo::Latitude:
1265
1609
return getGPSLatitudeString();
1266
1610
case MetadataInfo::LatitudeNumber:
1268
1612
double latitude;
1269
1614
if (getGPSLatitudeNumber(&latitude))
1270
1616
return latitude;
1272
1620
return QVariant(QVariant::Double);
1274
1623
case MetadataInfo::Altitude:
1276
1625
double altitude;
1277
1627
if (getGPSAltitude(&altitude))
1278
1629
return altitude;
1280
1633
return QVariant(QVariant::Double);
1282
1636
case MetadataInfo::PositionOrientation:
1283
1637
case MetadataInfo::PositionTilt:
1407
1779
case MetadataInfo::DigitizationDate:
1408
1780
return value.toDateTime().toString(Qt::LocaleDate);
1409
1781
case MetadataInfo::Orientation:
1410
1783
switch (value.toInt())
1412
// Example why the English text differs from the enum names: ORIENTATION_ROT_90.
1413
// Rotation by 90 degrees is right (clockwise) rotation.
1414
// But: The enum names describe what needs to be done to get the image right again.
1415
// And an image that needs to be rotated 90 degrees is currently rotated 270 degrees = left.
1785
// Example why the English text differs from the enum names: ORIENTATION_ROT_90.
1786
// Rotation by 90 degrees is right (clockwise) rotation.
1787
// But: The enum names describe what needs to be done to get the image right again.
1788
// And an image that needs to be rotated 90 degrees is currently rotated 270 degrees = left.
1417
1790
case ORIENTATION_UNSPECIFIED:
1418
1791
return i18n("Unspecified");
1473
1846
int degrees, minutes;
1474
1847
double seconds;
1475
1848
char directionRef;
1476
1850
if (!convertToUserPresentableNumbers(value.toString(), °rees, &minutes, &seconds, &directionRef))
1477
1852
return QString();
1478
1855
QString direction = (directionRef == 'W') ?
1479
1856
i18nc("For use in longitude coordinate", "West") : i18nc("For use in longitude coordinate", "East");
1480
1857
return QString("%1%2%3%4%L5%6 %7").arg(degrees).arg(QChar(0xB0))
1481
.arg(minutes).arg(QChar(0x2032))
1482
.arg(seconds, 'f').arg(QChar(0x2033)).arg(direction);
1858
.arg(minutes).arg(QChar(0x2032))
1859
.arg(seconds, 'f').arg(QChar(0x2033)).arg(direction);
1484
1861
case MetadataInfo::LongitudeNumber:
1490
1867
QString direction = (directionRef == 'W') ?
1491
1868
i18nc("For use in longitude coordinate", "West") : i18nc("For use in longitude coordinate", "East");
1492
1869
return QString("%1%2%3%4%L5%6 %7").arg(degrees).arg(QChar(0xB0))
1493
.arg(minutes).arg(QChar(0x2032))
1494
.arg(seconds, 'f').arg(QChar(0x2033)).arg(direction);
1870
.arg(minutes).arg(QChar(0x2032))
1871
.arg(seconds, 'f').arg(QChar(0x2033)).arg(direction);
1496
1873
case MetadataInfo::Latitude:
1498
1875
int degrees, minutes;
1499
1876
double seconds;
1500
1877
char directionRef;
1501
1879
if (!convertToUserPresentableNumbers(value.toString(), °rees, &minutes, &seconds, &directionRef))
1502
1881
return QString();
1503
1884
QString direction = (directionRef == 'N') ?
1504
1885
i18nc("For use in latitude coordinate", "North") : i18nc("For use in latitude coordinate", "South");
1505
1886
return QString("%1%2%3%4%L5%6 %7").arg(degrees).arg(QChar(0xB0))
1506
.arg(minutes).arg(QChar(0x2032))
1507
.arg(seconds, 'f').arg(QChar(0x2033)).arg(direction);
1887
.arg(minutes).arg(QChar(0x2032))
1888
.arg(seconds, 'f').arg(QChar(0x2033)).arg(direction);
1509
1890
case MetadataInfo::LatitudeNumber:
1515
1896
QString direction = (directionRef == 'N') ?
1516
1897
i18nc("For use in latitude coordinate", "North") : i18nc("For use in latitude coordinate", "North");
1517
1898
return QString("%1%2%3%4%L5%6 %7").arg(degrees).arg(QChar(0xB0))
1518
.arg(minutes).arg(QChar(0x2032))
1519
.arg(seconds, 'f').arg(QChar(0x2033)).arg(direction);
1899
.arg(minutes).arg(QChar(0x2032))
1900
.arg(seconds, 'f').arg(QChar(0x2033)).arg(direction);
1521
1902
case MetadataInfo::Altitude:
1534
1915
case MetadataInfo::PositionDescription:
1535
1916
return value.toString();
1538
1919
case MetadataInfo::IptcCoreCopyrightNotice:
1539
1920
case MetadataInfo::IptcCoreRightsUsageTerms:
1540
1921
case MetadataInfo::Description:
1541
1922
case MetadataInfo::Title:
1543
1924
QMap<QString, QVariant> map = value.toMap();
1544
1926
// the most common cases
1545
1927
if (map.isEmpty())
1546
1929
return QString();
1547
1931
else if (map.size() == 1)
1548
1933
return map.begin().value().toString();
1550
KLocale *locale = KGlobal::locale();
1937
KLocale* locale = KGlobal::locale();
1551
1938
QString spec = locale->language().toLower() + '-' + locale->country().toLower();
1552
1940
if (map.contains(spec))
1553
1942
return map[spec].toString();
1556
1946
QStringList keys = map.keys();
1557
1947
QRegExp exp(locale->language().toLower() + '-');
1558
1948
QStringList matches = keys.filter(exp);
1559
1950
if (!matches.isEmpty())
1560
1952
return map[matches.first()].toString();
1562
1955
// return default
1563
1956
if (map.contains("x-default"))
1564
1958
return map["x-default"].toString();
1566
1961
// return first entry
1567
1962
return map.begin().value().toString();
1666
2065
// convert from APEX. See Exif spec, Annex C.
1667
2066
if (aperture == 0.0)
1669
2070
else if (aperture == 1.0)
1671
2074
else if (aperture == 2.0)
1673
2078
else if (aperture == 3.0)
1675
2082
else if (aperture == 4.0)
1677
2086
else if (aperture == 5.0)
1679
2090
else if (aperture == 6.0)
1681
2094
else if (aperture == 7.0)
1683
2098
else if (aperture == 8.0)
1685
2102
else if (aperture == 9.0)
1687
2106
else if (aperture == 10.0)
1689
2111
return exp(log(2) * aperture / 2.0);
1694
2116
// convert from APEX. See Exif spec, Annex C.
1695
2117
if (shutterSpeed == -5.0)
1697
2121
else if (shutterSpeed == -4.0)
1699
2125
else if (shutterSpeed == -3.0)
1701
2129
else if (shutterSpeed == -2.0)
1703
2133
else if (shutterSpeed == -1.0)
1705
2137
else if (shutterSpeed == 0.0)
1707
2141
else if (shutterSpeed == 1.0)
1709
2145
else if (shutterSpeed == 2.0)
1711
2149
else if (shutterSpeed == 3.0)
1713
2153
else if (shutterSpeed == 4.0)
1714
2155
return 1.0 / 15.0;
1715
2157
else if (shutterSpeed == 5.0)
1716
2159
return 1.0 / 30.0;
1717
2161
else if (shutterSpeed == 6.0)
1718
2163
return 1.0 / 60.0;
1719
2165
else if (shutterSpeed == 7.0)
1720
return 0.008; // 1/125
2167
return 0.008; // 1/125
1721
2169
else if (shutterSpeed == 8.0)
1722
return 0.004; // 1/250
2171
return 0.004; // 1/250
1723
2173
else if (shutterSpeed == 9.0)
1724
return 0.002; // 1/500
2175
return 0.002; // 1/500
1725
2177
else if (shutterSpeed == 10.0)
1726
return 0.001; // 1/1000
2179
return 0.001; // 1/1000
1727
2181
else if (shutterSpeed == 11.0)
1728
return 0.0005; // 1/2000
2183
return 0.0005; // 1/2000
1729
2185
// additions by me
1730
2186
else if (shutterSpeed == 12.0)
1731
return 0.00025; // 1/4000
2188
return 0.00025; // 1/4000
1732
2190
else if (shutterSpeed == 13.0)
1733
return 0.000125; // 1/8000
2192
return 0.000125; // 1/8000
1735
2195
return exp( - log(2) * shutterSpeed);
1738
KExiv2::AltLangMap DMetadata::toAltLangMap(const QVariant &var)
2198
KExiv2::AltLangMap DMetadata::toAltLangMap(const QVariant& var)
1740
2200
KExiv2::AltLangMap map;
1742
2202
if (var.isNull())
1745
2207
switch (var.type())
1764
2230
// ---------- Pushed to libkexiv2 for KDE 4.4 --------------
1766
bool DMetadata::addToXmpTagStringBag(const char *xmpTagName, const QStringList& entriesToAdd,
2232
bool DMetadata::addToXmpTagStringBag(const char* xmpTagName, const QStringList& entriesToAdd,
1767
2233
bool setProgramName) const
1769
//#ifdef _XMP_SUPPORT_
2235
//#ifdef _XMP_SUPPORT_
1771
2237
if (!setProgramId(setProgramName))
1774
2242
QStringList oldEntries = getXmpTagStringBag(xmpTagName, false);
1775
2243
QStringList newEntries = entriesToAdd;
1778
2246
for (QStringList::const_iterator it = oldEntries.constBegin(); it != oldEntries.constEnd(); ++it )
1780
2248
if (!newEntries.contains(*it))
1781
2250
newEntries.append(*it);
1784
2254
if (setXmpTagStringBag(xmpTagName, newEntries, false))
1787
//#endif // _XMP_SUPPORT_
2259
//#endif // _XMP_SUPPORT_
1792
bool DMetadata::removeFromXmpTagStringBag(const char *xmpTagName, const QStringList& entriesToRemove,
1793
bool setProgramName) const
2264
bool DMetadata::removeFromXmpTagStringBag(const char* xmpTagName, const QStringList& entriesToRemove,
2265
bool setProgramName) const
1795
//#ifdef _XMP_SUPPORT_
2267
//#ifdef _XMP_SUPPORT_
1797
2269
if (!setProgramId(setProgramName))
1800
2274
QStringList currentEntries = getXmpTagStringBag(xmpTagName, false);
1801
2275
QStringList newEntries;