void KUrlMimeData::setMetaData(const MetaDataMap& metaData, QMimeData *mimeData) { QByteArray metaDataData; // :) for(MetaDataMap::const_iterator it = metaData.begin(); it != metaData.end(); ++it) { metaDataData += it.key().toUtf8(); metaDataData += "$@@$"; metaDataData += it.value().toUtf8(); metaDataData += "$@@$"; } mimeData->setData(QString::fromLatin1("application/x-kio-metadata"), metaDataData); }
bool DMetadata::removeXmpTags(const QStringList& tagFilters) { MetaDataMap m = getXmpTagsDataList(tagFilters); if (m.isEmpty()) return false; for (MetaDataMap::iterator it = m.begin() ; it != m.end() ; ++it) { removeXmpTag(it.key().toLatin1().constData()); } return true; }
void medDatabaseControllerPrivate::buildMetaDataLookup() { // The table defines the mapping between metadata in the medAbstractData and the database tables. metaDataLookup.insert(medMetaDataKeys::ThumbnailPath.key(), TableEntryList() << TableEntry(T_image, "thumbnail", true) << TableEntry(T_series, "thumbnail", true) << TableEntry(T_study, "thumbnail", true) << TableEntry(T_patient, "thumbnail", true) ); //Patient data metaDataLookup.insert(medMetaDataKeys::PatientName.key(), TableEntryList() << TableEntry(T_patient, "name") ); metaDataLookup.insert(medMetaDataKeys::Gender.key(), TableEntryList() << TableEntry(T_patient, "gender") ); metaDataLookup.insert(medMetaDataKeys::BirthDate.key(), TableEntryList() << TableEntry(T_patient, "birthdate") ); metaDataLookup.insert(medMetaDataKeys::PatientID.key(), TableEntryList() << TableEntry(T_patient, "patientId") ); //Study Data metaDataLookup.insert(medMetaDataKeys::StudyDescription.key(), TableEntryList() << TableEntry(T_study, "name") ); metaDataLookup.insert(medMetaDataKeys::StudyDicomID.key(), TableEntryList() << TableEntry(T_study, "uid") ); metaDataLookup.insert(medMetaDataKeys::StudyID.key(), TableEntryList() << TableEntry(T_study, "studyId") ); //Series Data metaDataLookup.insert(medMetaDataKeys::Size.key(), TableEntryList() << TableEntry(T_series, "size") ); metaDataLookup.insert(medMetaDataKeys::SeriesDescription.key(), TableEntryList() << TableEntry(T_series, "name") ); metaDataLookup.insert(medMetaDataKeys::Size.key(), TableEntryList() << TableEntry(T_series, "size") ); metaDataLookup.insert(medMetaDataKeys::SeriesDicomID.key(), TableEntryList() << TableEntry(T_series, "uid") ); metaDataLookup.insert(medMetaDataKeys::SeriesID.key(), TableEntryList() << TableEntry(T_series, "seriesId") ); metaDataLookup.insert(medMetaDataKeys::Orientation.key(), TableEntryList() << TableEntry(T_series, "orientation") ); metaDataLookup.insert(medMetaDataKeys::SeriesNumber.key(), TableEntryList() << TableEntry(T_series, "seriesNumber") ); metaDataLookup.insert(medMetaDataKeys::SequenceName.key(), TableEntryList() << TableEntry(T_series, "sequenceName") ); metaDataLookup.insert(medMetaDataKeys::SliceThickness.key(), TableEntryList() << TableEntry(T_series, "sliceThickness") ); metaDataLookup.insert(medMetaDataKeys::Rows.key(), TableEntryList() << TableEntry(T_series, "rows") ); metaDataLookup.insert(medMetaDataKeys::Columns.key(), TableEntryList() << TableEntry(T_series, "columns") ); metaDataLookup.insert(medMetaDataKeys::Age.key(), TableEntryList() << TableEntry(T_series, "age") ); metaDataLookup.insert(medMetaDataKeys::Description.key(), TableEntryList() << TableEntry(T_series, "description") ); metaDataLookup.insert(medMetaDataKeys::Modality.key(), TableEntryList() << TableEntry(T_series, "modality") ); metaDataLookup.insert(medMetaDataKeys::Protocol.key(), TableEntryList() << TableEntry(T_series, "protocol") ); metaDataLookup.insert(medMetaDataKeys::Comments.key(), TableEntryList() << TableEntry(T_series, "comments") ); metaDataLookup.insert(medMetaDataKeys::Status.key(), TableEntryList() << TableEntry(T_series, "status") ); metaDataLookup.insert(medMetaDataKeys::AcquisitionDate.key(), TableEntryList() << TableEntry(T_series, "acquisitiondate") ); metaDataLookup.insert(medMetaDataKeys::ImportationDate.key(), TableEntryList() << TableEntry(T_series, "importationdate") ); metaDataLookup.insert(medMetaDataKeys::Referee.key(), TableEntryList() << TableEntry(T_series, "referee") ); metaDataLookup.insert(medMetaDataKeys::Performer.key(), TableEntryList() << TableEntry(T_series, "performer") ); metaDataLookup.insert(medMetaDataKeys::Institution.key(), TableEntryList() << TableEntry(T_series, "institution") ); metaDataLookup.insert(medMetaDataKeys::Report.key(), TableEntryList() << TableEntry(T_series, "report") ); //Image data }
KExiv2::MetaDataMap KExiv2::getIptcTagsDataList(const QStringList& iptcKeysFilter, bool invertSelection) const { if (d->iptcMetadata().empty()) return MetaDataMap(); try { Exiv2::IptcData iptcData = d->iptcMetadata(); iptcData.sortByKey(); QString ifDItemName; MetaDataMap metaDataMap; for (Exiv2::IptcData::iterator md = iptcData.begin(); md != iptcData.end(); ++md) { QString key = QString::fromLocal8Bit(md->key().c_str()); // Decode the tag value with a user friendly output. std::ostringstream os; os << *md; QString value = QString(os.str().c_str()); // To make a string just on one line. value.replace('\n', ' '); // Some Iptc key are redondancy. check if already one exist... MetaDataMap::iterator it = metaDataMap.find(key); // We apply a filter to get only the Iptc tags that we need. if (!invertSelection) { if (iptcKeysFilter.contains(key.section('.', 1, 1))) { if (it == metaDataMap.end()) metaDataMap.insert(key, value); else { QString v = *it; v.append(", "); v.append(value); metaDataMap.insert(key, v); } } } else { if (!iptcKeysFilter.contains(key.section('.', 1, 1))) { if (it == metaDataMap.end()) metaDataMap.insert(key, value); else { QString v = *it; v.append(", "); v.append(value); metaDataMap.insert(key, v); } } } } return metaDataMap; } catch (Exiv2::Error& e) { d->printExiv2ExceptionError("Cannot parse Iptc metadata using Exiv2 ", e); } return MetaDataMap(); }