File indexing completed on 2025-01-05 04:00:13
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2003-08-03 0007 * Description : setup Metadata tab. 0008 * 0009 * SPDX-FileCopyrightText: 2003-2004 by Ralf Holzer <ralf at well dot com> 0010 * SPDX-FileCopyrightText: 2003-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * SPDX-FileCopyrightText: 2009-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0012 * SPDX-FileCopyrightText: 2017 by Simon Frei <freisim93 at gmail dot com> 0013 * 0014 * SPDX-License-Identifier: GPL-2.0-or-later 0015 * 0016 * ============================================================ */ 0017 0018 #include "setupmetadata_p.h" 0019 0020 namespace Digikam 0021 { 0022 0023 void SetupMetadata::appendBehaviorTab() 0024 { 0025 QWidget* const panel = new QWidget; 0026 QVBoxLayout* const mainLayout = new QVBoxLayout; 0027 0028 const int spacing = qMin(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing), 0029 QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing)); 0030 0031 d->fieldsGroup = new QGroupBox; 0032 QGridLayout* const fieldsLayout = new QGridLayout; 0033 0034 d->fieldsGroup->setWhatsThis(xi18nc("@info:whatsthis", 0035 "<para>In addition to the pixel content, image files usually " 0036 "contain a variety of metadata. A lot of the parameters you can use " 0037 "in digiKam to manage files, such as rating or comment, can be written " 0038 "to the files' metadata.</para> " 0039 "<para>Storing in metadata allows one to preserve this information " 0040 "when moving or sending the files to different systems.</para>")); 0041 0042 DHBox* const title1 = new DHBox; 0043 QLabel* const fieldsIconLabel = new QLabel(title1); 0044 fieldsIconLabel->setPixmap(QIcon::fromTheme(QLatin1String("format-list-unordered")).pixmap(32)); 0045 new QLabel(i18nc("@label", "Write This Information to the Metadata"), title1); 0046 QWidget* const space1 = new QWidget(title1); 0047 title1->setStretchFactor(space1, 10); 0048 0049 d->saveTagsBox = new QCheckBox; 0050 d->saveTagsBox->setText(i18nc("@option:check", "Image tags")); 0051 d->saveTagsBox->setWhatsThis(i18nc("@info:whatsthis", "Turn on this option to store the item tags " 0052 "in the XMP and IPTC tags.")); 0053 0054 d->saveCommentsBox = new QCheckBox; 0055 d->saveCommentsBox->setText(i18nc("@option:check", "Captions and title")); 0056 d->saveCommentsBox->setWhatsThis(i18nc("@info:whatsthis", "Turn on this option to store item caption and title " 0057 "in the JFIF Comment section, the Exif tag, the XMP tag, " 0058 "and the IPTC tag.")); 0059 0060 d->saveRatingBox = new QCheckBox; 0061 d->saveRatingBox->setText(i18nc("@option:check", "Rating")); 0062 d->saveRatingBox->setWhatsThis(i18nc("@info:whatsthis", "Turn on this option to store the item rating " 0063 "in the Exif tag and the XMP tags.")); 0064 0065 d->savePickLabelBox = new QCheckBox; 0066 d->savePickLabelBox->setText(i18nc("@option:check", "Pick label")); 0067 d->savePickLabelBox->setWhatsThis(i18nc("@info:whatsthis", "Turn on this option to store the item pick label " 0068 "in the XMP tags.")); 0069 0070 d->saveColorLabelBox = new QCheckBox; 0071 d->saveColorLabelBox->setText(i18nc("@option:check", "Color label")); 0072 d->saveColorLabelBox->setWhatsThis(i18nc("@info:whatsthis", "Turn on this option to store the item color label " 0073 "in the XMP tags.")); 0074 0075 d->saveDateTimeBox = new QCheckBox; 0076 d->saveDateTimeBox->setText(i18nc("@option:check", "Timestamps")); 0077 d->saveDateTimeBox->setWhatsThis(i18nc("@info:whatsthis", "Turn on this option to store the item date and time " 0078 "in the EXIF, XMP, and IPTC tags.")); 0079 0080 d->saveTemplateBox = new QCheckBox; 0081 d->saveTemplateBox->setText(i18nc("@option:check", "Metadata templates (Copyright etc.)")); 0082 d->saveTemplateBox->setWhatsThis(i18nc("@info:whatsthis", "Turn on this option to store the metadata " 0083 "template in the XMP and the IPTC tags. " 0084 "You can set template values to Template setup page.")); 0085 d->saveFaceTags = new QCheckBox; 0086 d->saveFaceTags->setText(i18nc("@option:check", "Face Tags (including face areas)")); 0087 d->saveFaceTags->setWhatsThis(i18nc("@info:whatsthis", "Turn on this option to store face tags " 0088 "with face rectangles in the XMP tags.")); 0089 0090 d->savePosition = new QCheckBox; 0091 d->savePosition->setText(i18nc("@option:check", "Geolocation information (GPS)")); 0092 d->savePosition->setWhatsThis(i18nc("@info:whatsthis", "Turn on this option to store Geolocation information " 0093 "in the Exif tag and the XMP tags.")); 0094 0095 fieldsLayout->addWidget(title1, 0, 0, 1, 3); 0096 fieldsLayout->addWidget(d->saveTagsBox, 1, 0, 1, 1); 0097 fieldsLayout->addWidget(d->saveCommentsBox, 2, 0, 1, 1); 0098 fieldsLayout->addWidget(d->saveRatingBox, 3, 0, 1, 1); 0099 fieldsLayout->addWidget(d->savePickLabelBox, 4, 0, 1, 1); 0100 fieldsLayout->addWidget(d->saveColorLabelBox, 5, 0, 1, 1); 0101 fieldsLayout->addWidget(d->saveDateTimeBox, 1, 1, 1, 1); 0102 fieldsLayout->addWidget(d->saveTemplateBox, 2, 1, 1, 1); 0103 fieldsLayout->addWidget(d->saveFaceTags, 3, 1, 1, 1); 0104 fieldsLayout->addWidget(d->savePosition, 4, 1, 1, 1); 0105 fieldsLayout->setColumnStretch(2, 10); 0106 d->fieldsGroup->setLayout(fieldsLayout); 0107 0108 // -------------------------------------------------------- 0109 0110 d->readWriteGroup = new QGroupBox; 0111 QGridLayout* const readWriteLayout = new QGridLayout; 0112 0113 DHBox* const title2 = new DHBox; 0114 QLabel* const readWriteIconLabel = new QLabel(title2); 0115 readWriteIconLabel->setPixmap(QIcon::fromTheme(QLatin1String("document-open")).pixmap(32)); 0116 new QLabel(i18nc("@label", "Reading and Writing Metadata"), title2); 0117 QWidget* const space2 = new QWidget(title2); 0118 title2->setStretchFactor(space2, 10); 0119 0120 d->writeWithExifToolBox = new QCheckBox; 0121 d->writeWithExifToolBox->setText(i18nc("@option:check", "Delegate to ExifTool backend all operations to write metadata to files")); 0122 d->writeWithExifToolBox->setWhatsThis(i18nc("@info:whatsthis", "Turn on this option to write metadata to files " 0123 "with ExifTool backend instead Exiv2. This will slowdown a little bit the " 0124 "synchronization of files metadata with database.")); 0125 0126 d->writeDngFilesBox = new QCheckBox; 0127 d->writeDngFilesBox->setText(i18nc("@option:check", "Write metadata to DNG files")); 0128 d->writeDngFilesBox->setWhatsThis(i18nc("@info:whatsthis", "Turn on this option to write metadata into DNG files.")); 0129 0130 d->writeRawFilesBox = new QCheckBox; 0131 d->writeRawFilesBox->setText(i18nc("@option:check", "If possible write metadata to RAW files")); 0132 d->writeRawFilesBox->setWhatsThis(i18nc("@info:whatsthis", "Turn on this option to write metadata into RAW files. " 0133 "This feature is delegate to ExifTool backend and is disabled by default.")); 0134 0135 d->writeWithExifToolLabel = new QLabel; 0136 d->writeWithExifToolLabel->setOpenExternalLinks(true); 0137 0138 // --- 0139 0140 d->useLazySync = new QCheckBox; 0141 d->useLazySync->setText(i18nc("@option:check", "Use lazy synchronization")); 0142 d->useLazySync->setWhatsThis(i18nc("@info:whatsthis", 0143 "Instead of synchronizing metadata, just schedule it for synchronization." 0144 "Synchronization can be done later by triggering the apply pending, or at digikam exit")); 0145 0146 d->updateFileTimeStampBox = new QCheckBox; 0147 d->updateFileTimeStampBox->setText(i18nc("@option:check", "&Update file modification timestamp when files are modified")); 0148 d->updateFileTimeStampBox->setWhatsThis(i18nc("@info:whatsthis", 0149 "Turn off this option to not update file timestamps when files are changed as " 0150 "when you update metadata or image data. Note: disabling this option can " 0151 "introduce some dysfunctions with applications which use file timestamps " 0152 "properties to detect file modifications automatically.")); 0153 0154 d->rescanImageIfModifiedBox = new QCheckBox; 0155 d->rescanImageIfModifiedBox->setText(i18nc("@option:check", "&Rescan file when files are modified")); 0156 d->rescanImageIfModifiedBox->setWhatsThis(i18nc("@info:whatsthis", 0157 "Turning this option on, will force digiKam to rescan files that has been " 0158 "modified outside digiKam. If a file has changed it is file size or if " 0159 "the last modified timestamp has changed, a rescan of that " 0160 "file will be performed when digiKam starts.")); 0161 0162 readWriteLayout->addWidget(title2, 0, 0, 2, 3); 0163 readWriteLayout->addWidget(d->writeWithExifToolBox, 2, 0, 1, 3); 0164 readWriteLayout->addWidget(d->writeDngFilesBox, 3, 1, 1, 2); 0165 readWriteLayout->addWidget(d->writeRawFilesBox, 4, 1, 1, 2); 0166 readWriteLayout->addWidget(d->writeWithExifToolLabel, 5, 1, 1, 2); 0167 readWriteLayout->addWidget(new DLineWidget(Qt::Horizontal, this), 6, 0, 1, 3); 0168 readWriteLayout->addWidget(d->useLazySync, 7, 0, 1, 3); 0169 readWriteLayout->addWidget(d->updateFileTimeStampBox, 8, 0, 1, 3); 0170 readWriteLayout->addWidget(d->rescanImageIfModifiedBox, 9, 0, 1, 3); 0171 readWriteLayout->setColumnStretch(0, 5); 0172 readWriteLayout->setColumnStretch(2, 100); 0173 d->readWriteGroup->setLayout(readWriteLayout); 0174 0175 // -------------------------------------------------------- 0176 0177 QFrame* const infoBox = new QFrame; 0178 QGridLayout* const infoBoxGrid = new QGridLayout; 0179 infoBox->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); 0180 0181 QLabel* const explanation = new QLabel(infoBox); 0182 explanation->setOpenExternalLinks(true); 0183 explanation->setWordWrap(true); 0184 QString txt; 0185 0186 txt.append(QString::fromUtf8("<p><a href='https://en.wikipedia.org/wiki/Exif'>Exif</a> - %1</p>") 0187 .arg(i18nc("@info", "a standard used by most digital cameras today to store technical " 0188 "information (like aperture and shutter speed) about an image."))); 0189 0190 txt.append(QString::fromUtf8("<p><a href='https://en.wikipedia.org/wiki/IPTC_Information_Interchange_Model'>IPTC</a> - %1</p>") 0191 .arg(i18nc("@info", "an older standard used in digital photography to store " 0192 "photographer information in images."))); 0193 0194 if (MetaEngine::supportXmp()) 0195 { 0196 txt.append(QString::fromUtf8("<p><a href='https://en.wikipedia.org/wiki/Extensible_Metadata_Platform'>XMP</a> - %1</p>") 0197 .arg(i18nc("@info", "a new standard used in digital photography, designed to replace IPTC."))); 0198 } 0199 0200 explanation->setText(txt); 0201 0202 infoBoxGrid->addWidget(explanation, 0, 0, 1, 1); 0203 infoBoxGrid->setColumnStretch(0, 10); 0204 infoBoxGrid->setRowStretch(0, 10); 0205 infoBoxGrid->setContentsMargins(spacing, spacing, spacing, spacing); 0206 infoBoxGrid->setSpacing(0); 0207 0208 infoBox->setLayout(infoBoxGrid); 0209 0210 // -------------------------------------------------------- 0211 0212 mainLayout->addWidget(d->fieldsGroup); 0213 mainLayout->addWidget(d->readWriteGroup); 0214 mainLayout->addWidget(infoBox); 0215 mainLayout->addStretch(); 0216 panel->setLayout(mainLayout); 0217 0218 d->tab->insertTab(Behavior, panel, i18nc("@title:tab", "Behavior")); 0219 } 0220 0221 void SetupMetadata::slotExifToolSettingsChanged(bool available) 0222 { 0223 if (available) 0224 { 0225 d->writeWithExifToolBox->setEnabled(true); 0226 d->writeDngFilesBox->setEnabled(true); 0227 d->writeRawFilesBox->setEnabled(true); 0228 d->writeWithExifToolLabel->setText(i18nc("@label", "Note: see %1 of ExifTool backend.", 0229 QString::fromUtf8("<a href='https://exiftool.org/#limitations'>%1</a>") 0230 .arg(i18nc("@label", "write limitations")))); 0231 } 0232 else 0233 { 0234 d->writeWithExifToolBox->setEnabled(false); 0235 d->writeDngFilesBox->setEnabled(false); 0236 d->writeRawFilesBox->setEnabled(false); 0237 d->writeWithExifToolLabel->setText(i18nc("@label", "Note: these options depends of %1 availability. " 0238 "Check in the ExifTool tab for details.", 0239 QString::fromUtf8("<a href='https://exiftool.org/'>%1</a>") 0240 .arg(i18nc("@label", "ExifTool backend")))); 0241 } 0242 } 0243 0244 } // namespace Digikam