File indexing completed on 2025-01-19 03:51:26
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2007-10-24 0007 * Description : XMP workflow status properties settings page. 0008 * 0009 * SPDX-FileCopyrightText: 2007-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "xmpproperties.h" 0016 0017 // Qt includes 0018 0019 #include <QCheckBox> 0020 #include <QPushButton> 0021 #include <QGridLayout> 0022 #include <QApplication> 0023 #include <QStyle> 0024 #include <QComboBox> 0025 0026 // KDE includes 0027 0028 #include <klocalizedstring.h> 0029 0030 // Local includes 0031 0032 #include "dlayoutbox.h" 0033 #include "squeezedcombobox.h" 0034 #include "digikam_debug.h" 0035 #include "altlangstringedit.h" 0036 #include "metadatacheckbox.h" 0037 #include "multivaluesedit.h" 0038 #include "objectattributesedit.h" 0039 #include "dexpanderbox.h" 0040 #include "dtextedit.h" 0041 0042 namespace DigikamGenericMetadataEditPlugin 0043 { 0044 0045 class Q_DECL_HIDDEN XMPProperties::Private 0046 { 0047 public: 0048 0049 explicit Private() 0050 : originalTransCheck (nullptr), 0051 priorityCB (nullptr), 0052 objectTypeCB (nullptr), 0053 objectAttributeEdit (nullptr), 0054 originalTransEdit (nullptr), 0055 priorityCheck (nullptr), 0056 objectAttributeCheck(nullptr), 0057 sceneEdit (nullptr), 0058 objectTypeEdit (nullptr), 0059 languageEdit (nullptr), 0060 objectAttributeCB (nullptr) 0061 { 0062 sceneCodeMap.insert( QLatin1String("010100"), i18nc("@item: scene code", "Headshot") ); 0063 sceneCodeMap.insert( QLatin1String("010200"), i18nc("@item: scene code", "Half-length") ); 0064 sceneCodeMap.insert( QLatin1String("010300"), i18nc("@item: scene code", "Full-length") ); 0065 sceneCodeMap.insert( QLatin1String("010400"), i18nc("@item: side view of a person", "Profile") ); 0066 sceneCodeMap.insert( QLatin1String("010500"), i18nc("@item: scene code", "Rear view") ); 0067 sceneCodeMap.insert( QLatin1String("010600"), i18nc("@item: scene code", "Single") ); 0068 sceneCodeMap.insert( QLatin1String("010700"), i18nc("@item: scene code", "Couple") ); 0069 sceneCodeMap.insert( QLatin1String("010800"), i18nc("@item: scene code", "Two") ); 0070 sceneCodeMap.insert( QLatin1String("010900"), i18nc("@item: group of people", "Group") ); 0071 sceneCodeMap.insert( QLatin1String("011000"), i18nc("@item: scene code", "General view") ); 0072 sceneCodeMap.insert( QLatin1String("011100"), i18nc("@item: scene code", "Panoramic view") ); 0073 sceneCodeMap.insert( QLatin1String("011200"), i18nc("@item: scene code", "Aerial view") ); 0074 sceneCodeMap.insert( QLatin1String("011300"), i18nc("@item: scene code", "Under-water") ); 0075 sceneCodeMap.insert( QLatin1String("011400"), i18nc("@item: scene code", "Night scene") ); 0076 sceneCodeMap.insert( QLatin1String("011500"), i18nc("@item: scene code", "Satellite") ); 0077 sceneCodeMap.insert( QLatin1String("011600"), i18nc("@item: scene code", "Exterior view") ); 0078 sceneCodeMap.insert( QLatin1String("011700"), i18nc("@item: scene code", "Interior view") ); 0079 sceneCodeMap.insert( QLatin1String("011800"), i18nc("@item: scene code", "Close-up") ); 0080 sceneCodeMap.insert( QLatin1String("011900"), i18nc("@item: scene code", "Action") ); 0081 sceneCodeMap.insert( QLatin1String("012000"), i18nc("@item: scene code", "Performing") ); 0082 sceneCodeMap.insert( QLatin1String("012100"), i18nc("@item: scene code", "Posing") ); 0083 sceneCodeMap.insert( QLatin1String("012200"), i18nc("@item: scene code", "Symbolic") ); 0084 sceneCodeMap.insert( QLatin1String("012300"), i18nc("@item: scene code", "Off-beat") ); 0085 sceneCodeMap.insert( QLatin1String("012400"), i18nc("@item: scene code", "Movie scene") ); 0086 0087 typeCodeMap.insert( QLatin1String("Advisory"), i18nc("@item: type code", "Advisory") ); 0088 typeCodeMap.insert( QLatin1String("Alert"), i18nc("@item: type code", "Alert") ); 0089 typeCodeMap.insert( QLatin1String("Catalog"), i18nc("@item: type code", "Catalog") ); 0090 typeCodeMap.insert( QLatin1String("Data"), i18nc("@item: type code", "Data") ); 0091 typeCodeMap.insert( QLatin1String("Document"), i18nc("@item: type is a document", "Document") ); 0092 typeCodeMap.insert( QLatin1String("DTD"), i18nc("@item: type code", "DTD") ); 0093 typeCodeMap.insert( QLatin1String("Maintenance"), i18nc("@item: type code", "Maintenance") ); 0094 typeCodeMap.insert( QLatin1String("News"), i18nc("@item: type code", "News") ); 0095 typeCodeMap.insert( QLatin1String("NewsManagementMode"), i18nc("@item: type code", "News Management Mode") ); 0096 typeCodeMap.insert( QLatin1String("Package"), i18nc("@item: type code", "Package") ); 0097 typeCodeMap.insert( QLatin1String("Schema"), i18nc("@item: type code", "Schema") ); 0098 typeCodeMap.insert( QLatin1String("Topic"), i18nc("@item: type code", "Topic") ); 0099 typeCodeMap.insert( QLatin1String("TopicSet"), i18nc("@item: type code", "Topic Set") ); 0100 0101 DMetadata::CountryCodeMap map = DMetadata::countryCodeMap(); 0102 0103 for (DMetadata::CountryCodeMap::Iterator it = map.begin() ; it != map.end() ; ++it) 0104 { 0105 languageCodeMap.insert(it.key(), it.value()); 0106 } 0107 } 0108 0109 typedef QMap<QString, QString> SceneCodeMap; 0110 typedef QMap<QString, QString> TypeCodeMap; 0111 typedef QMap<QString, QString> LanguageCodeMap; 0112 0113 SceneCodeMap sceneCodeMap; 0114 TypeCodeMap typeCodeMap; 0115 LanguageCodeMap languageCodeMap; 0116 0117 QCheckBox* originalTransCheck; 0118 0119 QComboBox* priorityCB; 0120 QComboBox* objectTypeCB; 0121 0122 DTextEdit* objectAttributeEdit; 0123 DTextEdit* originalTransEdit; 0124 0125 MetadataCheckBox* priorityCheck; 0126 MetadataCheckBox* objectAttributeCheck; 0127 0128 MultiValuesEdit* sceneEdit; 0129 MultiValuesEdit* objectTypeEdit; 0130 MultiValuesEdit* languageEdit; 0131 0132 SqueezedComboBox* objectAttributeCB; 0133 }; 0134 0135 XMPProperties::XMPProperties(QWidget* const parent) 0136 : MetadataEditPage(parent), 0137 d (new Private) 0138 { 0139 QGridLayout* const grid = new QGridLayout(widget()); 0140 0141 // -------------------------------------------------------- 0142 0143 d->languageEdit = new MultiValuesEdit(this, i18nc("@option", "Language:"), 0144 i18nc("@info", "Select here the language of content.")); 0145 0146 QStringList list; 0147 0148 for (Private::LanguageCodeMap::Iterator it = d->languageCodeMap.begin() ; 0149 it != d->languageCodeMap.end() ; ++it) 0150 { 0151 list.append(QString::fromUtf8("%1 - %2").arg(it.key()).arg(it.value())); 0152 } 0153 0154 d->languageEdit->setData(list); 0155 0156 // -------------------------------------------------------- 0157 0158 d->priorityCheck = new MetadataCheckBox(i18nc("@option", "Priority:"), this); 0159 d->priorityCB = new QComboBox(this); 0160 d->priorityCB->insertItem(0, i18nc("@item: editorial urgency of content", "0: None")); 0161 d->priorityCB->insertItem(1, i18nc("@item: editorial urgency of content", "1: High")); 0162 d->priorityCB->insertItem(2, QLatin1String("2")); 0163 d->priorityCB->insertItem(3, QLatin1String("3")); 0164 d->priorityCB->insertItem(4, QLatin1String("4")); 0165 d->priorityCB->insertItem(5, i18nc("@item: editorial urgency of content", "5: Normal")); 0166 d->priorityCB->insertItem(6, QLatin1String("6")); 0167 d->priorityCB->insertItem(7, QLatin1String("7")); 0168 d->priorityCB->insertItem(8, i18nc("@item: editorial urgency of content", "8: Low")); 0169 d->priorityCB->insertItem(9, i18nc("@item: editorial urgency of content", "9: User-defined")); 0170 d->priorityCB->setWhatsThis(i18nc("@info", "@info: Select here the editorial urgency of content.")); 0171 0172 // -------------------------------------------------------- 0173 0174 d->sceneEdit = new MultiValuesEdit(this, i18nc("@option", "Scene:"), 0175 i18nc("@info", "Select here the scene type of the content.")); 0176 0177 QStringList list2; 0178 0179 for (Private::SceneCodeMap::Iterator it = d->sceneCodeMap.begin() ; 0180 it != d->sceneCodeMap.end() ; ++it) 0181 { 0182 list2.append(QString::fromUtf8("%1 - %2").arg(it.key()).arg(it.value())); 0183 } 0184 0185 d->sceneEdit->setData(list2); 0186 0187 // -------------------------------------------------------- 0188 0189 d->objectTypeEdit = new MultiValuesEdit(this, i18nc("@option", "Type:"), 0190 i18nc("@info", "Select here the editorial type of the content.")); 0191 0192 QStringList list3; 0193 0194 for (Private::TypeCodeMap::Iterator it = d->typeCodeMap.begin() ; 0195 it != d->typeCodeMap.end() ; ++it) 0196 { 0197 list3.append(it.value()); 0198 } 0199 0200 d->objectTypeEdit->setData(list3); 0201 0202 // -------------------------------------------------------- 0203 0204 DHBox* const objectBox = new DHBox(this); 0205 d->objectAttributeCheck = new MetadataCheckBox(i18nc("@option", "Attribute:"), this); 0206 d->objectAttributeCB = new SqueezedComboBox(objectBox); 0207 d->objectAttributeCB->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 0208 d->objectAttributeEdit = new DTextEdit(objectBox); 0209 d->objectAttributeEdit->setLinesVisible(1); 0210 d->objectAttributeEdit->setPlaceholderText(i18nc("@info", "Set here the editorial attribute description")); 0211 d->objectAttributeEdit->setWhatsThis(i18nc("@info", "Set here the editorial attribute description of the content.")); 0212 0213 d->objectAttributeCB->setWhatsThis(i18nc("@info", "Select here the editorial attribute of the content.")); 0214 d->objectAttributeCB->addSqueezedItem(QLatin1String("001 - ") + i18nc("@item: editorial content attribute", "Current")); 0215 d->objectAttributeCB->addSqueezedItem(QLatin1String("002 - ") + i18nc("@item: editorial content attribute", "Analysis")); 0216 d->objectAttributeCB->addSqueezedItem(QLatin1String("003 - ") + i18nc("@item: editorial content attribute", "Archive material")); 0217 d->objectAttributeCB->addSqueezedItem(QLatin1String("004 - ") + i18nc("@item: editorial content attribute", "Background")); 0218 d->objectAttributeCB->addSqueezedItem(QLatin1String("005 - ") + i18nc("@item: editorial content attribute", "Feature")); 0219 d->objectAttributeCB->addSqueezedItem(QLatin1String("006 - ") + i18nc("@item: editorial content attribute", "Forecast")); 0220 d->objectAttributeCB->addSqueezedItem(QLatin1String("007 - ") + i18nc("@item: editorial content attribute", "History")); 0221 d->objectAttributeCB->addSqueezedItem(QLatin1String("008 - ") + i18nc("@item: editorial content attribute", "Obituary")); 0222 d->objectAttributeCB->addSqueezedItem(QLatin1String("009 - ") + i18nc("@item: editorial content attribute", "Opinion")); 0223 d->objectAttributeCB->addSqueezedItem(QLatin1String("010 - ") + i18nc("@item: editorial content attribute", "Polls & Surveys")); 0224 d->objectAttributeCB->addSqueezedItem(QLatin1String("011 - ") + i18nc("@item: editorial content attribute", "Profile")); 0225 d->objectAttributeCB->addSqueezedItem(QLatin1String("012 - ") + i18nc("@item: editorial content attribute", "Results Listings & Table")); 0226 d->objectAttributeCB->addSqueezedItem(QLatin1String("013 - ") + i18nc("@item: editorial content attribute", "Side bar & Supporting information")); 0227 d->objectAttributeCB->addSqueezedItem(QLatin1String("014 - ") + i18nc("@item: editorial content attribute", "Summary")); 0228 d->objectAttributeCB->addSqueezedItem(QLatin1String("015 - ") + i18nc("@item: editorial content attribute", "Transcript & Verbatim")); 0229 d->objectAttributeCB->addSqueezedItem(QLatin1String("016 - ") + i18nc("@item: editorial content attribute", "Interview")); 0230 d->objectAttributeCB->addSqueezedItem(QLatin1String("017 - ") + i18nc("@item: editorial content attribute", "From the Scene")); 0231 d->objectAttributeCB->addSqueezedItem(QLatin1String("018 - ") + i18nc("@item: editorial content attribute", "Retrospective")); 0232 d->objectAttributeCB->addSqueezedItem(QLatin1String("019 - ") + i18nc("@item: editorial content attribute", "Statistics")); 0233 d->objectAttributeCB->addSqueezedItem(QLatin1String("020 - ") + i18nc("@item: editorial content attribute", "Update")); 0234 d->objectAttributeCB->addSqueezedItem(QLatin1String("021 - ") + i18nc("@item: editorial content attribute", "Wrap-up")); 0235 d->objectAttributeCB->addSqueezedItem(QLatin1String("022 - ") + i18nc("@item: editorial content attribute", "Press Release")); 0236 0237 // -------------------------------------------------------- 0238 0239 d->originalTransCheck = new QCheckBox(i18nc("@option", "Reference:"), this); 0240 d->originalTransEdit = new DTextEdit(this); 0241 d->originalTransEdit->setLinesVisible(1); 0242 d->originalTransEdit->setPlaceholderText(i18nc("@info", "Set here the content reference")); 0243 d->originalTransEdit->setWhatsThis(i18nc("@info", "Set here the original content transmission reference.")); 0244 0245 // -------------------------------------------------------- 0246 0247 grid->addWidget(d->languageEdit, 0, 0, 1, 5); 0248 grid->addWidget(d->priorityCheck, 1, 0, 1, 1); 0249 grid->addWidget(d->priorityCB, 1, 1, 1, 1); 0250 grid->addWidget(d->sceneEdit, 2, 0, 1, 5); 0251 grid->addWidget(d->objectTypeEdit, 3, 0, 1, 5); 0252 grid->addWidget(new DLineWidget(Qt::Horizontal, this), 4, 0, 1, 5); 0253 grid->addWidget(d->objectAttributeCheck, 5, 0, 1, 1); 0254 grid->addWidget(objectBox, 5, 1, 1, 4); 0255 grid->addWidget(new DLineWidget(Qt::Horizontal, this), 6, 0, 1, 5); 0256 grid->addWidget(d->originalTransCheck, 7, 0, 1, 1); 0257 grid->addWidget(d->originalTransEdit, 7, 1, 1, 4); 0258 grid->setRowStretch(8, 10); 0259 grid->setColumnStretch(4, 10); 0260 0261 int spacing = qMin(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing), 0262 QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing)); 0263 0264 grid->setContentsMargins(spacing, spacing, spacing, spacing); 0265 grid->setSpacing(spacing); 0266 0267 // -------------------------------------------------------- 0268 0269 connect(d->priorityCheck, SIGNAL(toggled(bool)), 0270 d->priorityCB, SLOT(setEnabled(bool))); 0271 0272 connect(d->objectAttributeCheck, SIGNAL(toggled(bool)), 0273 d->objectAttributeCB, SLOT(setEnabled(bool))); 0274 0275 connect(d->objectAttributeCheck, SIGNAL(toggled(bool)), 0276 d->objectAttributeEdit, SLOT(setEnabled(bool))); 0277 0278 connect(d->originalTransCheck, SIGNAL(toggled(bool)), 0279 d->originalTransEdit, SLOT(setEnabled(bool))); 0280 0281 // -------------------------------------------------------- 0282 0283 connect(d->languageEdit, SIGNAL(signalModified()), 0284 this, SIGNAL(signalModified())); 0285 0286 connect(d->priorityCheck, SIGNAL(toggled(bool)), 0287 this, SIGNAL(signalModified())); 0288 0289 connect(d->sceneEdit, SIGNAL(signalModified()), 0290 this, SIGNAL(signalModified())); 0291 0292 connect(d->objectTypeEdit, SIGNAL(signalModified()), 0293 this, SIGNAL(signalModified())); 0294 0295 connect(d->objectAttributeCheck, SIGNAL(toggled(bool)), 0296 this, SIGNAL(signalModified())); 0297 0298 connect(d->originalTransCheck, SIGNAL(toggled(bool)), 0299 this, SIGNAL(signalModified())); 0300 0301 // -------------------------------------------------------- 0302 0303 connect(d->priorityCB, SIGNAL(activated(int)), 0304 this, SIGNAL(signalModified())); 0305 0306 connect(d->objectAttributeCB, SIGNAL(activated(int)), 0307 this, SIGNAL(signalModified())); 0308 0309 connect(d->objectAttributeEdit, SIGNAL(textChanged()), 0310 this, SIGNAL(signalModified())); 0311 0312 connect(d->originalTransEdit, SIGNAL(textChanged()), 0313 this, SIGNAL(signalModified())); 0314 } 0315 0316 XMPProperties::~XMPProperties() 0317 { 0318 delete d; 0319 } 0320 0321 void XMPProperties::readMetadata(const DMetadata& meta) 0322 { 0323 blockSignals(true); 0324 0325 int val; 0326 QString data; 0327 QStringList code, list, list2; 0328 QString dateStr, timeStr; 0329 DMetadata::AltLangMap map; 0330 0331 // --------------------------------------------------------------- 0332 0333 code = meta.getXmpTagStringBag("Xmp.dc.language", false); 0334 0335 for (QStringList::Iterator it = code.begin() ; it != code.end() ; ++it) 0336 { 0337 QStringList lst1 = d->languageEdit->getData(); 0338 QStringList::Iterator it2; 0339 0340 for (it2 = lst1.begin() ; it2 != lst1.end() ; ++it2) 0341 { 0342 if ((*it2).left(2) == (*it)) 0343 { 0344 list.append(*it2); 0345 break; 0346 } 0347 } 0348 0349 if (it2 == lst1.end()) 0350 { 0351 d->languageEdit->setValid(false); 0352 } 0353 } 0354 0355 d->languageEdit->setValues(list); 0356 0357 // --------------------------------------------------------------- 0358 0359 d->priorityCB->setCurrentIndex(0); 0360 d->priorityCheck->setChecked(false); 0361 data = meta.getXmpTagString("Xmp.photoshop.Urgency", false); 0362 0363 if (!data.isNull()) 0364 { 0365 val = data.toInt(); 0366 0367 if ((val >= 0) && (val <= 9)) 0368 { 0369 d->priorityCB->setCurrentIndex(val); 0370 d->priorityCheck->setChecked(true); 0371 } 0372 else 0373 d->priorityCheck->setValid(false); 0374 } 0375 0376 d->priorityCB->setEnabled(d->priorityCheck->isChecked()); 0377 0378 // --------------------------------------------------------------- 0379 0380 code = meta.getXmpTagStringBag("Xmp.iptc.Scene", false); 0381 0382 for (QStringList::Iterator it = code.begin() ; it != code.end() ; ++it) 0383 { 0384 QStringList lst2 = d->sceneEdit->getData(); 0385 QStringList::Iterator it2; 0386 0387 for (it2 = lst2.begin() ; it2 != lst2.end() ; ++it2) 0388 { 0389 if ((*it2).left(6) == (*it)) 0390 { 0391 list.append(*it2); 0392 break; 0393 } 0394 } 0395 0396 if (it2 == lst2.end()) 0397 { 0398 d->sceneEdit->setValid(false); 0399 } 0400 } 0401 0402 d->sceneEdit->setValues(list); 0403 0404 // --------------------------------------------------------------- 0405 0406 code = meta.getXmpTagStringBag("Xmp.dc.type", false); 0407 0408 for (QStringList::Iterator it3 = code.begin() ; it3 != code.end() ; ++it3) 0409 { 0410 QStringList lst3 = d->objectTypeEdit->getData(); 0411 QStringList::Iterator it4; 0412 0413 for (it4 = lst3.begin() ; it4 != lst3.end() ; ++it4) 0414 { 0415 if ((*it4) == (*it3)) 0416 { 0417 list2.append(*it4); 0418 break; 0419 } 0420 } 0421 0422 if (it4 == lst3.end()) 0423 { 0424 d->objectTypeEdit->setValid(false); 0425 } 0426 } 0427 0428 d->objectTypeEdit->setValues(list2); 0429 0430 // --------------------------------------------------------------- 0431 0432 d->objectAttributeCB->setCurrentIndex(0); 0433 d->objectAttributeEdit->clear(); 0434 d->objectAttributeCheck->setChecked(false); 0435 data = meta.getXmpTagString("Xmp.iptc.IntellectualGenre", false); 0436 0437 if (!data.isNull()) 0438 { 0439 QString attrSec = data.section(QLatin1Char(':'), 0, 0); 0440 0441 if (!attrSec.isEmpty()) 0442 { 0443 int attr = attrSec.toInt()-1; 0444 0445 if ((attr >= 0) && (attr < 23)) 0446 { 0447 d->objectAttributeCB->setCurrentIndex(attr); 0448 d->objectAttributeEdit->setText(data.section(QLatin1Char(':'), -1)); 0449 d->objectAttributeCheck->setChecked(true); 0450 } 0451 else 0452 { 0453 d->objectAttributeCheck->setValid(false); 0454 } 0455 } 0456 } 0457 0458 d->objectAttributeCB->setEnabled(d->objectAttributeCheck->isChecked()); 0459 d->objectAttributeEdit->setEnabled(d->objectAttributeCheck->isChecked()); 0460 0461 // --------------------------------------------------------------- 0462 0463 d->originalTransEdit->clear(); 0464 d->originalTransCheck->setChecked(false); 0465 data = meta.getXmpTagString("Xmp.photoshop.TransmissionReference", false); 0466 0467 if (!data.isNull()) 0468 { 0469 d->originalTransEdit->setText(data); 0470 d->originalTransCheck->setChecked(true); 0471 } 0472 0473 d->originalTransEdit->setEnabled(d->originalTransCheck->isChecked()); 0474 0475 // --------------------------------------------------------------- 0476 0477 blockSignals(false); 0478 } 0479 0480 void XMPProperties::applyMetadata(const DMetadata& meta) 0481 { 0482 QStringList oldList, newList; 0483 0484 // --------------------------------------------------------------- 0485 0486 if (d->languageEdit->getValues(oldList, newList)) 0487 { 0488 QStringList newCode; 0489 0490 for (QStringList::Iterator it2 = newList.begin() ; it2 != newList.end() ; ++it2) 0491 { 0492 newCode.append((*it2).left(2)); 0493 } 0494 0495 meta.setXmpTagStringBag("Xmp.dc.language", newCode); 0496 } 0497 else 0498 { 0499 meta.removeXmpTag("Xmp.dc.language"); 0500 } 0501 0502 // --------------------------------------------------------------- 0503 0504 if (d->priorityCheck->isChecked()) 0505 { 0506 meta.setXmpTagString("Xmp.photoshop.Urgency", QString::number(d->priorityCB->currentIndex())); 0507 } 0508 else if (d->priorityCheck->isValid()) 0509 { 0510 meta.removeXmpTag("Xmp.photoshop.Urgency"); 0511 } 0512 0513 // --------------------------------------------------------------- 0514 0515 if (d->sceneEdit->getValues(oldList, newList)) 0516 { 0517 QStringList newCode; 0518 0519 for (QStringList::Iterator it2 = newList.begin() ; it2 != newList.end() ; ++it2) 0520 { 0521 newCode.append((*it2).left(6)); 0522 } 0523 0524 meta.setXmpTagStringBag("Xmp.iptc.Scene", newCode); 0525 } 0526 else 0527 { 0528 meta.removeXmpTag("Xmp.iptc.Scene"); 0529 } 0530 0531 // --------------------------------------------------------------- 0532 0533 if (d->objectTypeEdit->getValues(oldList, newList)) 0534 { 0535 meta.setXmpTagStringBag("Xmp.dc.type", newList); 0536 } 0537 else 0538 { 0539 meta.removeXmpTag("Xmp.dc.type"); 0540 } 0541 0542 // --------------------------------------------------------------- 0543 0544 if (d->objectAttributeCheck->isChecked()) 0545 { 0546 QString objectAttribute; 0547 objectAttribute = QString().asprintf("%3d", d->objectAttributeCB->currentIndex()+1); 0548 objectAttribute.append(QLatin1Char(':')); 0549 0550 if (!d->objectAttributeEdit->text().isEmpty()) 0551 { 0552 objectAttribute.append(d->objectAttributeEdit->text()); 0553 } 0554 else 0555 { 0556 objectAttribute.append(d->objectAttributeCB->itemHighlighted() 0557 .section(QLatin1String(" - "), -1)); 0558 } 0559 0560 meta.setXmpTagString("Xmp.iptc.IntellectualGenre", objectAttribute); 0561 } 0562 else if (d->objectAttributeCheck->isValid()) 0563 { 0564 meta.removeXmpTag("Xmp.iptc.IntellectualGenre"); 0565 } 0566 0567 // --------------------------------------------------------------- 0568 0569 if (d->originalTransCheck->isChecked()) 0570 { 0571 meta.setXmpTagString("Xmp.photoshop.TransmissionReference", d->originalTransEdit->text()); 0572 } 0573 else 0574 { 0575 meta.removeXmpTag("Xmp.photoshop.TransmissionReference"); 0576 } 0577 } 0578 0579 } // namespace DigikamGenericMetadataEditPlugin 0580 0581 #include "moc_xmpproperties.cpp"