void CaptionsMap::fromAltLangMap(const KExiv2::AltLangMap& map) { clear(); for (KExiv2::AltLangMap::const_iterator it = map.constBegin(); it != map.constEnd(); ++it) { CaptionValues val; val.caption = it.value(); insert(it.key(), val); } }
KExiv2::AltLangMap CaptionsMap::toAltLangMap() const { KExiv2::AltLangMap map; for (CaptionsMap::const_iterator it = constBegin(); it != constEnd(); ++it) { map.insert(it.key(), (*it).caption); } return map; }
KExiv2::AltLangMap CaptionsMap::datesList() const { KExiv2::AltLangMap map; for (CaptionsMap::const_iterator it = constBegin(); it != constEnd(); ++it) { map.insert(it.key(), (*it).date.toString(Qt::ISODate)); } return map; }
void CaptionsMap::setDatesList(const KExiv2::AltLangMap& map) { for (KExiv2::AltLangMap::const_iterator it = map.constBegin(); it != map.constEnd(); ++it) { CaptionsMap::iterator val = find(it.key()); if (val != end()) { (*val).date = QDateTime::fromString(it.value(), Qt::ISODate); } } }
void CaptionsMap::setAuthorsList(const KExiv2::AltLangMap& map, const QString& commonAuthor) { for (CaptionsMap::iterator it = begin(); it != end(); ++it) { KExiv2::AltLangMap::const_iterator authorIt = map.find(it.key()); if (authorIt != map.constEnd()) { (*it).author = authorIt.value(); } else if (!commonAuthor.isNull()) { (*it).author = commonAuthor; } } }
bool AltLangStringsEdit::getValues(KExiv2::AltLangMap& oldValues, KExiv2::AltLangMap& newValues) { oldValues = d->oldValues; newValues.clear(); for (int i = 0 ; i < d->valueBox->count(); i++) { QListWidgetItem *item = d->valueBox->item(i); QString lang = item->text().left(item->text().indexOf("] ")); lang.remove(0, 1); QString text = item->text().remove(0, lang.size()+3); newValues.insert(lang, text); } return d->valueCheck->isChecked(); }