File indexing completed on 2025-04-27 03:58:34
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-02-21 0007 * Description : a generic list view item widget to 0008 * display metadata key like a title 0009 * 0010 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #include "mdkeylistviewitem.h" 0017 0018 // Qt includes 0019 0020 #include <QPalette> 0021 #include <QFont> 0022 #include <QPainter> 0023 #include <QApplication> 0024 0025 // KDE includes 0026 0027 #include <klocalizedstring.h> 0028 0029 // Local includes 0030 0031 #include "thememanager.h" 0032 0033 namespace Digikam 0034 { 0035 0036 MdKeyListViewItem::MdKeyListViewItem(QTreeWidget* const parent, const QString& key) 0037 : QObject (parent), 0038 QTreeWidgetItem(parent), 0039 m_key (key), 0040 m_decryptedKey (key) 0041 { 0042 0043 // Standard Exif key descriptions. 0044 0045 if (key == QLatin1String("Iop")) 0046 { 0047 m_decryptedKey = i18n("Interoperability"); 0048 } 0049 else if (key == QLatin1String("Image")) 0050 { 0051 m_decryptedKey = i18n("Image Information"); 0052 } 0053 else if (key == QLatin1String("Photo")) 0054 { 0055 m_decryptedKey = i18n("Photograph Information"); 0056 } 0057 else if (key == QLatin1String("GPSInfo")) 0058 { 0059 m_decryptedKey = i18n("Global Positioning System"); 0060 } 0061 else if (key == QLatin1String("Thumbnail")) 0062 { 0063 m_decryptedKey = i18n("Embedded Thumbnail"); 0064 } 0065 0066 // Standard IPTC key descriptions. 0067 0068 else if (key == QLatin1String("Envelope")) 0069 { 0070 m_decryptedKey = i18n("IIM Envelope"); 0071 } 0072 else if (key == QLatin1String("Application2")) 0073 { 0074 m_decryptedKey = i18n("IIM Application 2"); 0075 } 0076 0077 // Standard XMP key descriptions. 0078 0079 else if (key == QLatin1String("aux")) 0080 { 0081 m_decryptedKey = i18n("Additional Exif Properties"); 0082 } 0083 else if (key == QLatin1String("crs")) 0084 { 0085 m_decryptedKey = i18n("Camera Raw"); 0086 } 0087 else if (key == QLatin1String("dc")) 0088 { 0089 m_decryptedKey = i18n("Dublin Core"); 0090 } 0091 else if (key == QLatin1String("digiKam")) 0092 { 0093 m_decryptedKey = i18n("digiKam schema"); 0094 } 0095 else if (key == QLatin1String("exif")) 0096 { 0097 m_decryptedKey = i18n("Exif-specific Properties"); 0098 } 0099 else if (key == QLatin1String("iptc")) 0100 { 0101 m_decryptedKey = i18n("IPTC Core"); 0102 } 0103 else if (key == QLatin1String("iptcExt")) 0104 { 0105 m_decryptedKey = i18n("IPTC Extension schema"); 0106 } 0107 else if (key == QLatin1String("MicrosoftPhoto")) 0108 { 0109 m_decryptedKey = i18n("Microsoft Photo"); 0110 } 0111 else if (key == QLatin1String("pdf")) 0112 { 0113 m_decryptedKey = i18n("Adobe PDF"); 0114 } 0115 else if (key == QLatin1String("photoshop")) 0116 { 0117 m_decryptedKey = i18n("Adobe Photoshop"); 0118 } 0119 else if (key == QLatin1String("plus")) 0120 { 0121 m_decryptedKey = i18n("PLUS License Data Format Schema"); 0122 } 0123 else if (key == QLatin1String("tiff")) 0124 { 0125 m_decryptedKey = i18n("TIFF Properties"); 0126 } 0127 else if (key == QLatin1String("xmp")) 0128 { 0129 m_decryptedKey = i18n("Basic Schema"); 0130 } 0131 else if (key == QLatin1String("xmpBJ")) 0132 { 0133 m_decryptedKey = i18n("Basic Job Ticket"); 0134 } 0135 else if (key == QLatin1String("xmpDM")) 0136 { 0137 m_decryptedKey = i18n("Dynamic Media"); 0138 } 0139 else if (key == QLatin1String("xmpMM")) 0140 { 0141 m_decryptedKey = i18n("Media Management "); 0142 } 0143 else if (key == QLatin1String("xmpRights")) 0144 { 0145 m_decryptedKey = i18n("Rights Management"); 0146 } 0147 else if (key == QLatin1String("xmpTPg")) 0148 { 0149 m_decryptedKey = i18n("Paged-Text"); 0150 } 0151 0152 // Additional XMP key descriptions. 0153 0154 else if (key == QLatin1String("mwg-rs")) 0155 { 0156 m_decryptedKey = i18n("Metadata Working Group Regions"); 0157 } 0158 else if (key == QLatin1String("dwc")) 0159 { 0160 m_decryptedKey = i18n("Darwin Core"); 0161 } 0162 else if (key == QLatin1String("lr")) 0163 { 0164 m_decryptedKey = i18n("Adobe Lightroom Schema"); 0165 } 0166 else if (key == QLatin1String("acdsee")) 0167 { 0168 m_decryptedKey = i18n("ACDSee XMP Schema"); 0169 } 0170 else if (key == QLatin1String("MP")) 0171 { 0172 m_decryptedKey = i18n("Microsoft Photo 1.2 Schema"); 0173 } 0174 else if (key == QLatin1String("kipi")) 0175 { 0176 m_decryptedKey = i18n("KDE Image Program Interface schema"); 0177 } 0178 else if (key == QLatin1String("video")) 0179 { 0180 m_decryptedKey = i18n("XMP Extended Video schema"); 0181 } 0182 else if (key == QLatin1String("exifEX")) 0183 { 0184 m_decryptedKey = i18n("Exif 2.3 metadata for XMP"); 0185 } 0186 else if (key == QLatin1String("MIFF")) 0187 { 0188 m_decryptedKey = i18n("Image Magick Attributes"); 0189 } 0190 else if (key == QLatin1String("MIFP")) 0191 { 0192 m_decryptedKey = i18n("Image Magick Properties"); 0193 } 0194 0195 // Reset all item flags: item is not selectable. 0196 0197 setFlags(Qt::ItemIsEnabled); 0198 0199 setDisabled(false); 0200 setExpanded(true); 0201 0202 setFirstColumnSpanned(true); 0203 setTextAlignment(0, Qt::AlignCenter); 0204 QFont fn0(font(0)); 0205 fn0.setBold(true); 0206 fn0.setItalic(false); 0207 setFont(0, fn0); 0208 QFont fn1(font(1)); 0209 fn1.setBold(true); 0210 fn1.setItalic(false); 0211 setFont(1, fn1); 0212 setText(0, m_decryptedKey); 0213 slotThemeChanged(); 0214 0215 connect(ThemeManager::instance(), SIGNAL(signalThemeChanged()), 0216 this, SLOT(slotThemeChanged())); 0217 } 0218 0219 MdKeyListViewItem::~MdKeyListViewItem() 0220 { 0221 } 0222 0223 QString MdKeyListViewItem::getKey() const 0224 { 0225 return m_key; 0226 } 0227 0228 QString MdKeyListViewItem::getDecryptedKey() const 0229 { 0230 return m_decryptedKey; 0231 } 0232 0233 void MdKeyListViewItem::slotThemeChanged() 0234 { 0235 setBackground(0, QBrush(qApp->palette().color(QPalette::Highlight))); 0236 setBackground(1, QBrush(qApp->palette().color(QPalette::Highlight))); 0237 setForeground(0, QBrush(qApp->palette().color(QPalette::HighlightedText))); 0238 setForeground(1, QBrush(qApp->palette().color(QPalette::HighlightedText))); 0239 } 0240 0241 } // namespace Digikam 0242 0243 #include "moc_mdkeylistviewitem.cpp"