feat: some other exiv metadata for display

This commit is contained in:
Gary Wang 2020-11-17 00:08:07 +08:00
parent e97dfe3a10
commit 13de9bdc4c
5 changed files with 272 additions and 31 deletions

View File

@ -30,6 +30,7 @@ void Exiv2Wrapper::cacheSection(Collection collection)
Iterator it = exifData.begin(), end = exifData.end();
for (; it != end; ++it) {
QString key = QString::fromUtf8(it->key().c_str());
if (it->tagName().substr(0, 2) == "0x") continue;
QString label = QString::fromLocal8Bit(it->tagLabel().c_str());
std::ostringstream stream;
stream << *it;

View File

@ -64,21 +64,62 @@ void MetadataModel::setFile(const QString &imageFilePath)
if (wrapper.load(imageFilePath)) {
wrapper.cacheSections();
appendProperty(QStringLiteral("Description"), QStringLiteral("Description.Comments"),
tr("Comments"), wrapper.comment());
appendExivPropertyIfExist(wrapper, QStringLiteral("Description"),
QStringLiteral("Exif.Image.Rating"), tr("Rating"));
appendPropertyIfNotEmpty(QStringLiteral("Description"), QStringLiteral("Description.Comments"),
tr("Comments"), wrapper.comment());
appendExivPropertyIfExist(wrapper, QStringLiteral("Origin"),
QStringLiteral("Exif.Image.Artist"), tr("Authors"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Origin"),
QStringLiteral("Exif.Photo.DateTimeOriginal"), tr("Date taken"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Origin"),
QStringLiteral("Exif.Image.Software"), tr("Program name"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Image"),
QStringLiteral("Exif.Image.XResolution"), tr("Horizontal resolution"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Image"),
QStringLiteral("Exif.Image.YResolution"), tr("Vertical resolution"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Image"),
QStringLiteral("Exif.Image.ResolutionUnit"), tr("Resolution unit"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Image"),
QStringLiteral("Exif.Photo.ColorSpace"), tr("Colour representation"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
QStringLiteral("Exif.Image.Make"), tr("Camera maker"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
QStringLiteral("Exif.Image.Model"), tr("Camera model"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
QStringLiteral("Exif.Photo.FNumber"), tr("F-stop"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
QStringLiteral("Exif.Photo.ExposureTime"), tr("Exposure time"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
QStringLiteral("Exif.Photo.ISOSpeedRatings"), tr("ISO speed"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
QStringLiteral("Exif.Photo.ExposureBiasValue"), tr("Exposure bias"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
QStringLiteral("Exif.Photo.FocalLength"), tr("Focal length"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
QStringLiteral("Exif.Photo.MaxApertureValue"), tr("Max aperture"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
QStringLiteral("Exif.Photo.MeteringMode"), tr("Metering mode"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
QStringLiteral("Exif.Photo.Flash"), tr("Flash mode"));
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
QStringLiteral("Exif.Photo.FocalLengthIn35mmFilm"), tr("35mm focal length"));
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
QStringLiteral("Exif.Photo.LensModel"), tr("Lens model"));
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
QStringLiteral("Exif.Photo.BrightnessValue"), tr("Brightness"));
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
QStringLiteral("Exif.Photo.ExposureProgram"), tr("Exposure program"));
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
QStringLiteral("Exif.Photo.Saturation"), tr("Saturation"));
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
QStringLiteral("Exif.Photo.Sharpness"), tr("Sharpness"));
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
QStringLiteral("Exif.Photo.WhiteBalance"), tr("White balance"));
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
QStringLiteral("Exif.Photo.DigitalZoomRatio"), tr("Digital zoom"));
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
@ -124,6 +165,13 @@ bool MetadataModel::appendSection(const QString &sectionKey, const QString &sect
return true;
}
bool MetadataModel::appendPropertyIfNotEmpty(const QString &sectionKey, const QString &propertyKey, const QString &propertyDisplayName, const QString &propertyValue)
{
if (propertyValue.isEmpty()) return false;
return appendProperty(sectionKey, propertyKey, propertyDisplayName, propertyValue);
}
bool MetadataModel::appendProperty(const QString &sectionKey, const QString &propertyKey, const QString &propertyDisplayName, const QString &propertyValue)
{
if (!m_sections.contains(sectionKey)) {

View File

@ -16,6 +16,8 @@ public:
static QString imageSize(const QSize &size);
static QString imageSizeRatio(const QSize &size);
bool appendSection(const QString & sectionKey, const QString & sectionDisplayName);
bool appendPropertyIfNotEmpty(const QString & sectionKey, const QString & propertyKey,
const QString & propertyDisplayName, const QString & propertyValue = QString());
bool appendProperty(const QString & sectionKey, const QString & propertyKey,
const QString & propertyDisplayName, const QString & propertyValue = QString());
bool updateProperty(const QString & propertyKey, const QString & propertyValue);

View File

@ -355,66 +355,161 @@
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="68"/>
<source>Rating</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="70"/>
<source>Comments</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="71"/>
<source>Program name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="73"/>
<source>Colour representation</source>
<source>Authors</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="75"/>
<source>Camera maker</source>
<source>Date taken</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="77"/>
<source>Program name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="80"/>
<source>Horizontal resolution</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="82"/>
<source>Vertical resolution</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="84"/>
<source>Resolution unit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="86"/>
<source>Colour representation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="89"/>
<source>Camera maker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="91"/>
<source>Camera model</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="79"/>
<location filename="../app/metadatamodel.cpp" line="93"/>
<source>F-stop</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="95"/>
<source>Exposure time</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="97"/>
<source>ISO speed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="81"/>
<location filename="../app/metadatamodel.cpp" line="99"/>
<source>Exposure bias</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="101"/>
<source>Focal length</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="83"/>
<source>Digital zoom</source>
<location filename="../app/metadatamodel.cpp" line="103"/>
<source>Max aperture</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="85"/>
<source>EXIF version</source>
<location filename="../app/metadatamodel.cpp" line="105"/>
<source>Metering mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="94"/>
<source>%1 x %2</source>
<location filename="../app/metadatamodel.cpp" line="107"/>
<source>Flash mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="109"/>
<source>35mm focal length</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="112"/>
<source>Lens model</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="114"/>
<source>Brightness</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="116"/>
<source>Exposure program</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="118"/>
<source>Saturation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="120"/>
<source>Sharpness</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="122"/>
<source>White balance</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="124"/>
<source>Digital zoom</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="126"/>
<source>EXIF version</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="135"/>
<source>%1 x %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="153"/>
<source>%1 : %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="240"/>
<location filename="../app/metadatamodel.cpp" line="288"/>
<source>Property</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="240"/>
<location filename="../app/metadatamodel.cpp" line="288"/>
<source>Value</source>
<translation type="unfinished"></translation>
</message>

View File

@ -355,66 +355,161 @@
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="68"/>
<source>Rating</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="70"/>
<source>Comments</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="71"/>
<location filename="../app/metadatamodel.cpp" line="73"/>
<source>Authors</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="75"/>
<source>Date taken</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="77"/>
<source>Program name</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="73"/>
<location filename="../app/metadatamodel.cpp" line="80"/>
<source>Horizontal resolution</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="82"/>
<source>Vertical resolution</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="84"/>
<source>Resolution unit</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="86"/>
<source>Colour representation</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="75"/>
<location filename="../app/metadatamodel.cpp" line="89"/>
<source>Camera maker</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="77"/>
<location filename="../app/metadatamodel.cpp" line="91"/>
<source>Camera model</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="79"/>
<location filename="../app/metadatamodel.cpp" line="93"/>
<source>F-stop</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="95"/>
<source>Exposure time</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="97"/>
<source>ISO speed</source>
<translation>ISO </translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="81"/>
<location filename="../app/metadatamodel.cpp" line="99"/>
<source>Exposure bias</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="101"/>
<source>Focal length</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="83"/>
<location filename="../app/metadatamodel.cpp" line="103"/>
<source>Max aperture</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="105"/>
<source>Metering mode</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="107"/>
<source>Flash mode</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="109"/>
<source>35mm focal length</source>
<translation>35mm </translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="112"/>
<source>Lens model</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="114"/>
<source>Brightness</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="116"/>
<source>Exposure program</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="118"/>
<source>Saturation</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="120"/>
<source>Sharpness</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="122"/>
<source>White balance</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="124"/>
<source>Digital zoom</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="85"/>
<location filename="../app/metadatamodel.cpp" line="126"/>
<source>EXIF version</source>
<translation>EXIF </translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="94"/>
<location filename="../app/metadatamodel.cpp" line="135"/>
<source>%1 x %2</source>
<translation>%1 x %2</translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="112"/>
<location filename="../app/metadatamodel.cpp" line="153"/>
<source>%1 : %2</source>
<translation>%1 : %2</translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="240"/>
<location filename="../app/metadatamodel.cpp" line="288"/>
<source>Property</source>
<translation></translation>
</message>
<message>
<location filename="../app/metadatamodel.cpp" line="240"/>
<location filename="../app/metadatamodel.cpp" line="288"/>
<source>Value</source>
<translation></translation>
</message>