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::appendSidecarsTab() 0024 { 0025 QWidget* const sidecarsPanel = new QWidget(d->tab); 0026 QVBoxLayout* const sidecarsLayout = new QVBoxLayout(sidecarsPanel); 0027 0028 // -------------------------------------------------------- 0029 0030 QGroupBox* rwSidecarsGroup = new QGroupBox; 0031 QGridLayout* const rwSidecarsLayout = new QGridLayout; 0032 0033 QLabel* const rwSidecarsLabel = new QLabel(i18nc("@label", "Reading and Writing to Sidecars")); 0034 0035 d->readXMPSidecarBox = new QCheckBox; 0036 d->readXMPSidecarBox->setText(i18nc("@option:check", "Read from sidecar files")); 0037 d->readXMPSidecarBox->setWhatsThis(i18nc("@info:whatsthis", 0038 "Turn on this option to read metadata from XMP sidecar files when reading metadata.")); 0039 d->readXMPSidecarBox->setEnabled(MetaEngine::supportXmp()); 0040 0041 d->writeXMPSidecarBox = new QCheckBox; 0042 d->writeXMPSidecarBox->setText(i18nc("@option:check", "Write to sidecar files")); 0043 d->writeXMPSidecarBox->setWhatsThis(i18nc("@info:whatsthis", 0044 "Turn on this option to save, as specified, metadata to XMP sidecar files.")); 0045 d->writeXMPSidecarBox->setEnabled(MetaEngine::supportXmp()); 0046 0047 d->writingModeCombo = new QComboBox; 0048 d->writingModeCombo->addItem(i18nc("@item", "Write to XMP sidecar for read-only item only"), MetaEngine::WRITE_TO_SIDECAR_ONLY_FOR_READ_ONLY_FILES); 0049 d->writingModeCombo->addItem(i18nc("@item", "Write to XMP sidecar only"), MetaEngine::WRITE_TO_SIDECAR_ONLY); 0050 d->writingModeCombo->addItem(i18nc("@item", "Write to item and XMP Sidecar"), MetaEngine::WRITE_TO_SIDECAR_AND_FILE); 0051 d->writingModeCombo->setToolTip(i18nc("@info:tooltip", "Specify the exact mode of XMP sidecar writing")); 0052 d->writingModeCombo->setEnabled(false); 0053 0054 d->sidecarFileNameBox = new QCheckBox; 0055 d->sidecarFileNameBox->setText(i18nc("@option:check", "Sidecar file names are compatible with commercial programs")); 0056 d->sidecarFileNameBox->setWhatsThis(i18nc("@info:whatsthis", 0057 "Turn on this option to create the XMP sidecar files with a compatible " 0058 "file name (BASENAME.xmp) used by many commercial programs. " 0059 "For Darktable do not enable this option.")); 0060 d->sidecarFileNameBox->setEnabled(false); 0061 0062 rwSidecarsLayout->addWidget(rwSidecarsLabel, 0, 0, 1, 3); 0063 rwSidecarsLayout->addWidget(d->readXMPSidecarBox, 1, 0, 1, 3); 0064 rwSidecarsLayout->addWidget(d->writeXMPSidecarBox, 2, 0, 1, 3); 0065 rwSidecarsLayout->addWidget(d->writingModeCombo, 3, 1, 1, 2); 0066 rwSidecarsLayout->addWidget(d->sidecarFileNameBox, 4, 0, 1, 3); 0067 rwSidecarsLayout->setColumnStretch(3, 10); 0068 rwSidecarsGroup->setLayout(rwSidecarsLayout); 0069 0070 // -------------------------------------------------------- 0071 0072 QGroupBox* const extensionsGroup = new QGroupBox(sidecarsPanel); 0073 QGridLayout* const extensionsGrid = new QGridLayout(extensionsGroup); 0074 0075 QLabel* const extensionsGroupLabel = new QLabel( 0076 i18nc("@info", "Add file types to be recognised as sidecars.\n" 0077 "digiKam (optionally) writes metadata to *.xmp sidecar " 0078 "files. Other programs might use different types, which " 0079 "can be specified below. digiKam will neither display these " 0080 "nor read from or write to them. But whenever a matching album " 0081 "item (e.g. \"image.dng\" for \"image.dng.pp3\") is renamed, " 0082 "moved, copied or deleted, the same operation will be done " 0083 "on these sidecar files.\n" 0084 "Multiple extensions must be separated by a semicolon or a space.")); 0085 extensionsGroupLabel->setWordWrap(true); 0086 0087 QLabel* const extensionsLogo = new QLabel(extensionsGroup); 0088 extensionsLogo->setPixmap(QIcon::fromTheme(QLatin1String("text-x-texinfo")).pixmap(48)); 0089 0090 d->extensionsEdit = new QLineEdit(extensionsGroup); 0091 d->extensionsEdit->setWhatsThis(i18nc("@info", "Here you can add extra extensions\n" 0092 "of sidecars files to be processed alongside\n" 0093 "regular items. These files will not be visible,\n" 0094 "but regarded as an extension of the main file.\n" 0095 "Just write \"xyz abc\" to support files with\n" 0096 "the *.xyz and *.abc extensions. The internally\n" 0097 "used sidecars type *.xmp is always included.")); 0098 d->extensionsEdit->setClearButtonEnabled(true); 0099 d->extensionsEdit->setPlaceholderText(i18nc("@info", "Enter additional sidecars file extensions.")); 0100 0101 QLabel* const extensionsLabel = new QLabel(extensionsGroup); 0102 extensionsLabel->setText(i18nc("@info", "Additional &sidecar file extensions")); 0103 extensionsLabel->setBuddy(d->extensionsEdit); 0104 0105 extensionsGrid->addWidget(extensionsGroupLabel, 0, 0, 1, -1); 0106 extensionsGrid->addWidget(extensionsLogo, 1, 0, 2, 1); 0107 extensionsGrid->addWidget(extensionsLabel, 1, 1, 1, -1); 0108 extensionsGrid->addWidget(d->extensionsEdit, 2, 1, 1, -1); 0109 extensionsGrid->setColumnStretch(1, 10); 0110 0111 // -------------------------------------------------------- 0112 0113 sidecarsLayout->addWidget(rwSidecarsGroup); 0114 sidecarsLayout->addWidget(extensionsGroup); 0115 sidecarsLayout->addStretch(); 0116 0117 d->tab->insertTab(Sidecars, sidecarsPanel, i18nc("@title:tab", "Sidecars")); 0118 } 0119 0120 } // namespace Digikam