File indexing completed on 2025-01-05 03:56:44
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-04-19 0007 * Description : A tab to display general item information 0008 * 0009 * SPDX-FileCopyrightText: 2006-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 #ifndef DIGIKAM_ITEM_PROPERTIES_TAB_H 0016 #define DIGIKAM_ITEM_PROPERTIES_TAB_H 0017 0018 // Qt includes 0019 0020 #include <QString> 0021 #include <QColor> 0022 #include <QUrl> 0023 #include <QFileInfo> 0024 0025 // Local includes 0026 0027 #include "template.h" 0028 #include "dexpanderbox.h" 0029 #include "digikam_export.h" 0030 0031 namespace Digikam 0032 { 0033 0034 class DIGIKAM_EXPORT ItemPropertiesTab : public DExpanderBox 0035 { 0036 Q_OBJECT 0037 0038 public: 0039 0040 enum Section 0041 { 0042 FileProperties = 0, 0043 ImageProperties, 0044 PhotoProperties, 0045 VideoProperties, 0046 digiKamProperties, 0047 TagsProperties, 0048 LocationProperties, 0049 RightProperties 0050 }; 0051 0052 public: 0053 0054 explicit ItemPropertiesTab(QWidget* const parent); 0055 ~ItemPropertiesTab() override; 0056 0057 void showOrHideCachedProperties(); 0058 0059 ///@{ 0060 /// Setter methods (itempropertiestab_setters.cpp) 0061 0062 void setCurrentURL(const QUrl& url = QUrl()); 0063 0064 void setPhotoInfoDisable(const bool b); 0065 void setVideoInfoDisable(const bool b); 0066 0067 void setFileName(const QString& str); 0068 void setFileFolder(const QString& str); 0069 void setFileModifiedDate(const QString& str); 0070 void setFileSize(const QString& str); 0071 void setFileOwner(const QString& str); 0072 void setFilePermissions(const QString& str); 0073 0074 void setItemDimensions(const QString& str); 0075 void setImageRatio(const QString& str); 0076 void setImageMime(const QString& str); 0077 void setImageBitDepth(const QString& str); 0078 void setImageColorMode(const QString& str); 0079 void setHasSidecar(const QString& str); 0080 void setHasGPSInfo(const QString& str); 0081 void setVersionnedInfo(const QString& str); 0082 void setGroupedInfo(const QString& str); 0083 0084 void setPhotoMake(const QString& str); 0085 void setPhotoModel(const QString& str); 0086 void setPhotoDateTime(const QString& str); 0087 void setPhotoLens(const QString& str); 0088 void setPhotoAperture(const QString& str); 0089 void setPhotoFocalLength(const QString& str); 0090 void setPhotoExposureTime(const QString& str); 0091 void setPhotoSensitivity(const QString& str); 0092 void setPhotoExposureMode(const QString& str); 0093 void setPhotoFlash(const QString& str); 0094 void setPhotoWhiteBalance(const QString& str); 0095 0096 void setVideoAspectRatio(const QString& str); 0097 void setVideoAudioBitRate(const QString& str); 0098 void setVideoAudioChannelType(const QString& str); 0099 void setVideoAudioCodec(const QString& str); 0100 void setVideoDuration(const QString& str); 0101 void setVideoFrameRate(const QString& str); 0102 void setVideoVideoCodec(const QString& str); 0103 0104 void setTitle(const QString& str); 0105 void setCaption(const QString& str); 0106 void setPickLabel(int pickId); 0107 void setColorLabel(int colorId); 0108 void setRating(int rating); 0109 void setTags(const QStringList& tagPaths, 0110 const QStringList& tagNames = QStringList(), 0111 const QStringList& peopleTagPaths = QStringList(), 0112 const QStringList& peopleTagNames = QStringList()); 0113 void setTemplate(const Template& t); 0114 0115 ///@} 0116 0117 ///@{ 0118 /// Helper methods (itempropertiestab_helpers.cpp) 0119 0120 /** 0121 * Shortens the tag paths by sorting and then cutting identical paths from the second 0122 * and following paths (only the first item gives the full path). 0123 * If you want to retain information about which tag path is sorted where, 0124 * you can optionally give a QVariant list. This list shall contain an identifier 0125 * for the tag path at the same index and will be resorted as the returned list. 0126 */ 0127 static QStringList shortenedTagPaths(const QStringList& tagPaths, QList<QVariant>* identifiers = nullptr); 0128 0129 /** 0130 * This methods shortens make an model camera info to prevent bloating GUI 0131 * See bug #265231 for details. 0132 */ 0133 static void shortenedMakeInfo(QString& make); 0134 static void shortenedModelInfo(QString& model); 0135 0136 /** 0137 * Write a string with aspect ratio information formatted 0138 */ 0139 static bool aspectRatioToString(int width, int height, QString& arString); 0140 0141 /** 0142 * Return file permissions string. 0143 */ 0144 static QString permissionsString(const QFileInfo& fi); 0145 0146 /** 0147 * Return an human readable string of file size in 'bytes'. 0148 * If 'si' is true, a decade of bytes is interpreted on base of 1000 byte, else 1024. 0149 */ 0150 static QString humanReadableBytesCount(qint64 bytes, bool si = false); 0151 0152 private: 0153 0154 static double doubleToHumanReadableFraction(double val, long* num, long* den, long maxden = 2); 0155 0156 ///@} 0157 0158 private: 0159 0160 class Private; 0161 Private* const d; 0162 }; 0163 0164 } // namespace Digikam 0165 0166 #endif // DIGIKAM_ITEM_PROPERTIES_TAB_H