File indexing completed on 2025-01-05 03:56:43
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-02-08 0007 * Description : A tab to display import 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 #include "importitempropertiestab.h" 0016 0017 // Qt includes 0018 0019 #include <QStyle> 0020 #include <QFile> 0021 #include <QGridLayout> 0022 #include <QApplication> 0023 #include <QIcon> 0024 #include <QMimeType> 0025 #include <QMimeDatabase> 0026 #include <QLocale> 0027 0028 // KDE includes 0029 0030 #include <klocalizedstring.h> 0031 0032 // Local includes 0033 0034 #include "itempropertiestxtlabel.h" 0035 #include "dlayoutbox.h" 0036 #include "itempropertiestab.h" 0037 0038 namespace Digikam 0039 { 0040 0041 class Q_DECL_HIDDEN ImportItemPropertiesTab::Private 0042 { 0043 public: 0044 0045 explicit Private() 0046 : file (nullptr), 0047 folder (nullptr), 0048 date (nullptr), 0049 size (nullptr), 0050 isReadable (nullptr), 0051 isWritable (nullptr), 0052 mime (nullptr), 0053 dimensions (nullptr), 0054 ratio (nullptr), 0055 newFileName (nullptr), 0056 downloaded (nullptr), 0057 make (nullptr), 0058 model (nullptr), 0059 photoDate (nullptr), 0060 lens (nullptr), 0061 aperture (nullptr), 0062 focalLength (nullptr), 0063 exposureTime (nullptr), 0064 sensitivity (nullptr), 0065 exposureMode (nullptr), 0066 flash (nullptr), 0067 whiteBalance (nullptr), 0068 labelFile (nullptr), 0069 labelFolder (nullptr), 0070 labelFileIsReadable (nullptr), 0071 labelFileIsWritable (nullptr), 0072 labelFileDate (nullptr), 0073 labelFileSize (nullptr), 0074 labelImageMime (nullptr), 0075 labelImageDimensions (nullptr), 0076 labelImageRatio (nullptr), 0077 labelNewFileName (nullptr), 0078 labelAlreadyDownloaded (nullptr), 0079 labelPhotoMake (nullptr), 0080 labelPhotoModel (nullptr), 0081 labelPhotoDateTime (nullptr), 0082 labelPhotoLens (nullptr), 0083 labelPhotoAperture (nullptr), 0084 labelPhotoFocalLength (nullptr), 0085 labelPhotoExposureTime (nullptr), 0086 labelPhotoSensitivity (nullptr), 0087 labelPhotoExposureMode (nullptr), 0088 labelPhotoFlash (nullptr), 0089 labelPhotoWhiteBalance (nullptr), 0090 aspectRatio (nullptr), 0091 duration (nullptr), 0092 frameRate (nullptr), 0093 videoCodec (nullptr), 0094 audioBitRate (nullptr), 0095 audioChannelType (nullptr), 0096 audioCodec (nullptr), 0097 labelVideoAspectRatio (nullptr), 0098 labelVideoDuration (nullptr), 0099 labelVideoFrameRate (nullptr), 0100 labelVideoVideoCodec (nullptr), 0101 labelVideoAudioBitRate (nullptr), 0102 labelVideoAudioChannelType (nullptr), 0103 labelVideoAudioCodec (nullptr) 0104 { 0105 } 0106 0107 DTextLabelName* file; 0108 DTextLabelName* folder; 0109 DTextLabelName* date; 0110 DTextLabelName* size; 0111 DTextLabelName* isReadable; 0112 DTextLabelName* isWritable; 0113 DTextLabelName* mime; 0114 DTextLabelName* dimensions; 0115 DTextLabelName* ratio; 0116 DTextLabelName* newFileName; 0117 DTextLabelName* downloaded; 0118 0119 DTextLabelName* make; 0120 DTextLabelName* model; 0121 DTextLabelName* photoDate; 0122 DTextLabelName* lens; 0123 DTextLabelName* aperture; 0124 DTextLabelName* focalLength; 0125 DTextLabelName* exposureTime; 0126 DTextLabelName* sensitivity; 0127 DTextLabelName* exposureMode; 0128 DTextLabelName* flash; 0129 DTextLabelName* whiteBalance; 0130 0131 DTextLabelValue* labelFile; 0132 DTextLabelValue* labelFolder; 0133 DTextLabelValue* labelFileIsReadable; 0134 DTextLabelValue* labelFileIsWritable; 0135 DTextLabelValue* labelFileDate; 0136 DTextLabelValue* labelFileSize; 0137 DTextLabelValue* labelImageMime; 0138 DTextLabelValue* labelImageDimensions; 0139 DTextLabelValue* labelImageRatio; 0140 DTextLabelValue* labelNewFileName; 0141 DTextLabelValue* labelAlreadyDownloaded; 0142 0143 DTextLabelValue* labelPhotoMake; 0144 DTextLabelValue* labelPhotoModel; 0145 DTextLabelValue* labelPhotoDateTime; 0146 DTextLabelValue* labelPhotoLens; 0147 DTextLabelValue* labelPhotoAperture; 0148 DTextLabelValue* labelPhotoFocalLength; 0149 DTextLabelValue* labelPhotoExposureTime; 0150 DTextLabelValue* labelPhotoSensitivity; 0151 DTextLabelValue* labelPhotoExposureMode; 0152 DTextLabelValue* labelPhotoFlash; 0153 DTextLabelValue* labelPhotoWhiteBalance; 0154 0155 DTextLabelName* aspectRatio; 0156 DTextLabelName* duration; 0157 DTextLabelName* frameRate; 0158 DTextLabelName* videoCodec; 0159 DTextLabelName* audioBitRate; 0160 DTextLabelName* audioChannelType; 0161 DTextLabelName* audioCodec; 0162 0163 DTextLabelValue* labelVideoAspectRatio; 0164 DTextLabelValue* labelVideoDuration; 0165 DTextLabelValue* labelVideoFrameRate; 0166 DTextLabelValue* labelVideoVideoCodec; 0167 DTextLabelValue* labelVideoAudioBitRate; 0168 DTextLabelValue* labelVideoAudioChannelType; 0169 DTextLabelValue* labelVideoAudioCodec; 0170 }; 0171 0172 ImportItemPropertiesTab::ImportItemPropertiesTab(QWidget* const parent) 0173 : DExpanderBox(parent), 0174 d (new Private) 0175 { 0176 setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); 0177 setLineWidth(style()->pixelMetric(QStyle::PM_DefaultFrameWidth)); 0178 0179 // -------------------------------------------------- 0180 0181 const int spacing = qMin(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing), 0182 QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing)); 0183 0184 QWidget* w1 = new QWidget(this); 0185 QGridLayout* glay1 = new QGridLayout(w1); 0186 0187 d->file = new DTextLabelName(i18nc("@label: item properties", "File: "), w1); 0188 d->folder = new DTextLabelName(i18nc("@label: item properties", "Folder: "), w1); 0189 d->date = new DTextLabelName(i18nc("@label: item properties", "Date: "), w1); 0190 d->size = new DTextLabelName(i18nc("@label: item properties", "Size: "), w1); 0191 d->isReadable = new DTextLabelName(i18nc("@label: item properties", "Readable: "), w1); 0192 d->isWritable = new DTextLabelName(i18nc("@label: item properties", "Writable: "), w1); 0193 d->mime = new DTextLabelName(i18nc("@label: item properties", "Type: "), w1); 0194 d->dimensions = new DTextLabelName(i18nc("@label: item properties", "Dimensions: "), w1); 0195 d->ratio = new DTextLabelName(i18nc("@label: item properties", "Aspect Ratio: "), w1); 0196 d->newFileName = new DTextLabelName(i18nc("@label: item properties", "New Name: "), w1); 0197 d->downloaded = new DTextLabelName(i18nc("@label: item properties", "Downloaded: "), w1); 0198 0199 d->labelFile = new DTextLabelValue(QString(), w1); 0200 d->labelFolder = new DTextLabelValue(QString(), w1); 0201 d->labelFileDate = new DTextLabelValue(QString(), w1); 0202 d->labelFileSize = new DTextLabelValue(QString(), w1); 0203 d->labelFileIsReadable = new DTextLabelValue(QString(), w1); 0204 d->labelFileIsWritable = new DTextLabelValue(QString(), w1); 0205 d->labelImageMime = new DTextLabelValue(QString(), w1); 0206 d->labelImageDimensions = new DTextLabelValue(QString(), w1); 0207 d->labelImageRatio = new DTextLabelValue(QString(), w1); 0208 d->labelNewFileName = new DTextLabelValue(QString(), w1); 0209 d->labelAlreadyDownloaded = new DTextLabelValue(QString(), w1); 0210 0211 glay1->addWidget(d->file, 0, 0, 1, 1); 0212 glay1->addWidget(d->labelFile, 0, 1, 1, 1); 0213 glay1->addWidget(d->folder, 1, 0, 1, 1); 0214 glay1->addWidget(d->labelFolder, 1, 1, 1, 1); 0215 glay1->addWidget(d->date, 2, 0, 1, 1); 0216 glay1->addWidget(d->labelFileDate, 2, 1, 1, 1); 0217 glay1->addWidget(d->size, 3, 0, 1, 1); 0218 glay1->addWidget(d->labelFileSize, 3, 1, 1, 1); 0219 glay1->addWidget(d->isReadable, 4, 0, 1, 1); 0220 glay1->addWidget(d->labelFileIsReadable, 4, 1, 1, 1); 0221 glay1->addWidget(d->isWritable, 5, 0, 1, 1); 0222 glay1->addWidget(d->labelFileIsWritable, 5, 1, 1, 1); 0223 glay1->addWidget(d->mime, 6, 0, 1, 1); 0224 glay1->addWidget(d->labelImageMime, 6, 1, 1, 1); 0225 glay1->addWidget(d->dimensions, 7, 0, 1, 1); 0226 glay1->addWidget(d->labelImageDimensions, 7, 1, 1, 1); 0227 glay1->addWidget(d->ratio, 8, 0, 1, 1); 0228 glay1->addWidget(d->labelImageRatio, 8, 1, 1, 1); 0229 glay1->addWidget(d->newFileName, 9, 0, 1, 1); 0230 glay1->addWidget(d->labelNewFileName, 9, 1, 1, 1); 0231 glay1->addWidget(d->downloaded, 10, 0, 1, 1); 0232 glay1->addWidget(d->labelAlreadyDownloaded, 10, 1, 1, 1); 0233 glay1->setColumnStretch(1, 10); 0234 glay1->setContentsMargins(spacing, spacing, spacing, spacing); 0235 glay1->setSpacing(0); 0236 0237 addItem(w1, QIcon::fromTheme(QLatin1String("dialog-information")), 0238 i18nc("@title", "Camera File Properties"), QLatin1String("FileProperties"), true); 0239 0240 // -------------------------------------------------- 0241 0242 QWidget* w2 = new QWidget(this); 0243 QGridLayout* glay2 = new QGridLayout(w2); 0244 0245 d->make = new DTextLabelName(i18nc("@label: item properties", "Make: "), w2); 0246 d->model = new DTextLabelName(i18nc("@label: item properties", "Model: "), w2); 0247 d->photoDate = new DTextLabelName(i18nc("@label: item properties", "Created: "), w2); 0248 d->lens = new DTextLabelName(i18nc("@label: item properties", "Lens: "), w2); 0249 d->aperture = new DTextLabelName(i18nc("@label: item properties", "Aperture: "), w2); 0250 d->focalLength = new DTextLabelName(i18nc("@label: item properties", "Focal: "), w2); 0251 d->exposureTime = new DTextLabelName(i18nc("@label: item properties", "Exposure: "), w2); 0252 d->sensitivity = new DTextLabelName(i18nc("@label: item properties", "Sensitivity: "), w2); 0253 d->exposureMode = new DTextLabelName(i18nc("@label: item properties", "Mode/Program: "), w2); 0254 d->flash = new DTextLabelName(i18nc("@label: item properties", "Flash: "), w2); 0255 d->whiteBalance = new DTextLabelName(i18nc("@label: item properties", "White balance: "), w2); 0256 0257 d->labelPhotoMake = new DTextLabelValue(QString(), w2); 0258 d->labelPhotoModel = new DTextLabelValue(QString(), w2); 0259 d->labelPhotoDateTime = new DTextLabelValue(QString(), w2); 0260 d->labelPhotoLens = new DTextLabelValue(QString(), w2); 0261 d->labelPhotoAperture = new DTextLabelValue(QString(), w2); 0262 d->labelPhotoFocalLength = new DTextLabelValue(QString(), w2); 0263 d->labelPhotoExposureTime = new DTextLabelValue(QString(), w2); 0264 d->labelPhotoSensitivity = new DTextLabelValue(QString(), w2); 0265 d->labelPhotoExposureMode = new DTextLabelValue(QString(), w2); 0266 d->labelPhotoFlash = new DTextLabelValue(QString(), w2); 0267 d->labelPhotoWhiteBalance = new DTextLabelValue(QString(), w2); 0268 0269 glay2->addWidget(d->make, 0, 0, 1, 1); 0270 glay2->addWidget(d->labelPhotoMake, 0, 1, 1, 1); 0271 glay2->addWidget(d->model, 1, 0, 1, 1); 0272 glay2->addWidget(d->labelPhotoModel, 1, 1, 1, 1); 0273 glay2->addWidget(d->photoDate, 2, 0, 1, 1); 0274 glay2->addWidget(d->labelPhotoDateTime, 2, 1, 1, 1); 0275 glay2->addWidget(d->lens, 3, 0, 1, 1); 0276 glay2->addWidget(d->labelPhotoLens, 3, 1, 1, 1); 0277 glay2->addWidget(d->aperture, 4, 0, 1, 1); 0278 glay2->addWidget(d->labelPhotoAperture, 4, 1, 1, 1); 0279 glay2->addWidget(d->focalLength, 5, 0, 1, 1); 0280 glay2->addWidget(d->labelPhotoFocalLength, 5, 1, 1, 1); 0281 glay2->addWidget(d->exposureTime, 6, 0, 1, 1); 0282 glay2->addWidget(d->labelPhotoExposureTime, 6, 1, 1, 1); 0283 glay2->addWidget(d->sensitivity, 7, 0, 1, 1); 0284 glay2->addWidget(d->labelPhotoSensitivity, 7, 1, 1, 1); 0285 glay2->addWidget(d->exposureMode, 8, 0, 1, 1); 0286 glay2->addWidget(d->labelPhotoExposureMode, 8, 1, 1, 1); 0287 glay2->addWidget(d->flash, 9, 0, 1, 1); 0288 glay2->addWidget(d->labelPhotoFlash, 9, 1, 1, 1); 0289 glay2->addWidget(d->whiteBalance, 10, 0, 1, 1); 0290 glay2->addWidget(d->labelPhotoWhiteBalance, 10, 1, 1, 1); 0291 glay2->setColumnStretch(1, 10); 0292 glay2->setContentsMargins(spacing, spacing, spacing, spacing); 0293 glay2->setSpacing(0); 0294 0295 addItem(w2, QIcon::fromTheme(QLatin1String("camera-photo")), 0296 i18nc("@title", "Photograph Properties"), QLatin1String("PhotographProperties"), true); 0297 0298 // -------------------------------------------------- 0299 0300 QWidget* const w3 = new QWidget(this); 0301 QGridLayout* const glay3 = new QGridLayout(w3); 0302 0303 d->aspectRatio = new DTextLabelName(i18nc("@label: item properties", "Aspect Ratio: "), w3); 0304 d->audioBitRate = new DTextLabelName(i18nc("@label: item properties", "Audio Bit Rate: "), w3); 0305 d->audioChannelType = new DTextLabelName(i18nc("@label: item properties", "Audio Channel Type: "), w3); 0306 d->audioCodec = new DTextLabelName(i18nc("@label: item properties", "Audio Codec: "), w3); 0307 d->duration = new DTextLabelName(i18nc("@label: item properties", "Duration: "), w3); 0308 d->frameRate = new DTextLabelName(i18nc("@label: item properties", "Frame Rate: "), w3); 0309 d->videoCodec = new DTextLabelName(i18nc("@label: item properties", "Video Codec: "), w3); 0310 0311 d->labelVideoAspectRatio = new DTextLabelValue(QString(), w3); 0312 d->labelVideoAudioBitRate = new DTextLabelValue(QString(), w3); 0313 d->labelVideoAudioChannelType = new DTextLabelValue(QString(), w3); 0314 d->labelVideoAudioCodec = new DTextLabelValue(QString(), w3); 0315 d->labelVideoDuration = new DTextLabelValue(QString(), w3); 0316 d->labelVideoFrameRate = new DTextLabelValue(QString(), w3); 0317 d->labelVideoVideoCodec = new DTextLabelValue(QString(), w3); 0318 0319 glay3->addWidget(d->aspectRatio, 0, 0, 1, 1); 0320 glay3->addWidget(d->labelVideoAspectRatio, 0, 1, 1, 1); 0321 glay3->addWidget(d->audioBitRate, 1, 0, 1, 1); 0322 glay3->addWidget(d->labelVideoAudioBitRate, 1, 1, 1, 1); 0323 glay3->addWidget(d->audioChannelType, 2, 0, 1, 1); 0324 glay3->addWidget(d->labelVideoAudioChannelType, 2, 1, 1, 1); 0325 glay3->addWidget(d->audioCodec, 3, 0, 1, 1); 0326 glay3->addWidget(d->labelVideoAudioCodec, 3, 1, 1, 1); 0327 glay3->addWidget(d->duration, 4, 0, 1, 1); 0328 glay3->addWidget(d->labelVideoDuration, 4, 1, 1, 1); 0329 glay3->addWidget(d->frameRate, 5, 0, 1, 1); 0330 glay3->addWidget(d->labelVideoFrameRate, 5, 1, 1, 1); 0331 glay3->addWidget(d->videoCodec, 6, 0, 1, 1); 0332 glay3->addWidget(d->labelVideoVideoCodec, 6, 1, 1, 1); 0333 glay3->setContentsMargins(spacing, spacing, spacing, spacing); 0334 glay3->setSpacing(0); 0335 glay3->setColumnStretch(1, 10); 0336 0337 addItem(w3, QIcon::fromTheme(QLatin1String("video-x-generic")), 0338 i18nc("@title", "Audio/Video Properties"), QLatin1String("VideoProperties"), true); 0339 0340 // -------------------------------------------------- 0341 0342 addStretch(); 0343 } 0344 0345 ImportItemPropertiesTab::~ImportItemPropertiesTab() 0346 { 0347 delete d; 0348 } 0349 0350 void ImportItemPropertiesTab::setCurrentItem(const CamItemInfo& itemInfo, DMetadata* const meta) 0351 { 0352 if (itemInfo.isNull()) 0353 { 0354 d->labelFile->setAdjustedText(QString()); 0355 d->labelFolder->setAdjustedText(QString()); 0356 d->labelFileIsReadable->setAdjustedText(QString()); 0357 d->labelFileIsWritable->setAdjustedText(QString()); 0358 d->labelFileDate->setAdjustedText(QString()); 0359 d->labelFileSize->setAdjustedText(QString()); 0360 d->labelImageMime->setAdjustedText(QString()); 0361 d->labelImageDimensions->setAdjustedText(QString()); 0362 d->labelImageRatio->setAdjustedText(QString()); 0363 d->labelNewFileName->setAdjustedText(QString()); 0364 d->labelAlreadyDownloaded->setAdjustedText(QString()); 0365 0366 d->labelPhotoMake->setAdjustedText(QString()); 0367 d->labelPhotoModel->setAdjustedText(QString()); 0368 d->labelPhotoDateTime->setAdjustedText(QString()); 0369 d->labelPhotoLens->setAdjustedText(QString()); 0370 d->labelPhotoAperture->setAdjustedText(QString()); 0371 d->labelPhotoFocalLength->setAdjustedText(QString()); 0372 d->labelPhotoExposureTime->setAdjustedText(QString()); 0373 d->labelPhotoSensitivity->setAdjustedText(QString()); 0374 d->labelPhotoExposureMode->setAdjustedText(QString()); 0375 d->labelPhotoFlash->setAdjustedText(QString()); 0376 d->labelPhotoWhiteBalance->setAdjustedText(QString()); 0377 0378 d->labelVideoAspectRatio->setAdjustedText(QString()); 0379 d->labelVideoAudioBitRate->setAdjustedText(QString()); 0380 d->labelVideoAudioChannelType->setAdjustedText(QString()); 0381 d->labelVideoAudioCodec->setAdjustedText(QString()); 0382 d->labelVideoDuration->setAdjustedText(QString()); 0383 d->labelVideoFrameRate->setAdjustedText(QString()); 0384 d->labelVideoVideoCodec->setAdjustedText(QString()); 0385 0386 setEnabled(false); 0387 return; 0388 } 0389 0390 setEnabled(true); 0391 0392 QString str; 0393 QString unknown(QString::fromUtf8("<i>%1</i>").arg(i18nc("@info: item properties", "unknown"))); 0394 QString unchanged(QString::fromUtf8("<i>%1</i>").arg(i18nc("@info: item properties", "unchanged"))); 0395 QString unavailable(QString::fromUtf8("<i>%1</i>").arg(i18nc("@info: item properties", "unavailable"))); 0396 0397 // -- Camera file system information ------------------------------------------ 0398 0399 d->labelFile->setAdjustedText(itemInfo.name); 0400 d->labelFolder->setAdjustedText(itemInfo.folder); 0401 0402 if (itemInfo.readPermissions < 0) 0403 { 0404 str = unknown; 0405 } 0406 else if (itemInfo.readPermissions == 0) 0407 { 0408 str = i18nc("@info: item properties", "No"); 0409 } 0410 else 0411 { 0412 str = i18nc("@info: item properties", "Yes"); 0413 } 0414 0415 d->labelFileIsReadable->setAdjustedText(str); 0416 0417 if (itemInfo.writePermissions < 0) 0418 { 0419 str = unknown; 0420 } 0421 else if (itemInfo.writePermissions == 0) 0422 { 0423 str = i18nc("@info: item properties", "No"); 0424 } 0425 else 0426 { 0427 str = i18nc("@info: item properties", "Yes"); 0428 } 0429 0430 d->labelFileIsWritable->setAdjustedText(str); 0431 0432 if (itemInfo.ctime.isValid()) 0433 { 0434 d->labelFileDate->setAdjustedText(QLocale().toString(itemInfo.ctime, QLocale::ShortFormat)); 0435 } 0436 else 0437 { 0438 d->labelFileDate->setAdjustedText(unknown); 0439 } 0440 0441 str = i18nc("@info: item size", "%1 (%2)", ItemPropertiesTab::humanReadableBytesCount(itemInfo.size), QLocale().toString(itemInfo.size)); 0442 d->labelFileSize->setAdjustedText(str); 0443 0444 // -- Image Properties -------------------------------------------------- 0445 0446 if (itemInfo.mime == QLatin1String("image/x-raw")) 0447 { 0448 d->labelImageMime->setAdjustedText(i18nc("@label", "RAW Image")); 0449 } 0450 else 0451 { 0452 QMimeType mimeType = QMimeDatabase().mimeTypeForName(itemInfo.mime); 0453 0454 if (mimeType.isValid()) 0455 { 0456 d->labelImageMime->setAdjustedText(mimeType.comment()); 0457 } 0458 else 0459 { 0460 d->labelImageMime->setAdjustedText(itemInfo.mime); // last fallback 0461 } 0462 } 0463 0464 QString mpixels; 0465 QSize dims; 0466 0467 if ((itemInfo.width == -1) && (itemInfo.height == -1)) 0468 { 0469 // delayed loading to list faster from UMSCamera 0470 0471 if (itemInfo.mime == QLatin1String("image/x-raw")) 0472 { 0473 dims = meta->getItemDimensions(); 0474 } 0475 else 0476 { 0477 dims = meta->getPixelSize(); 0478 } 0479 } 0480 else 0481 { 0482 // if available (GPCamera), take dimensions directly from itemInfo 0483 0484 dims = QSize(itemInfo.width, itemInfo.height); 0485 } 0486 0487 mpixels = QLocale().toString(dims.width()*dims.height()/1000000.0, 'f', 1); 0488 str = (!dims.isValid()) ? unknown : i18nc("@info: item resolution", "%1x%2 (%3Mpx)", 0489 dims.width(), dims.height(), mpixels); 0490 d->labelImageDimensions->setAdjustedText(str); 0491 0492 if (!dims.isValid()) str = unknown; 0493 else ItemPropertiesTab::aspectRatioToString(dims.width(), dims.height(), str); 0494 0495 d->labelImageRatio->setAdjustedText(str); 0496 0497 // -- Download information ------------------------------------------ 0498 0499 d->labelNewFileName->setAdjustedText(itemInfo.downloadName.isEmpty() ? unchanged : itemInfo.downloadName); 0500 0501 if (itemInfo.downloaded == CamItemInfo::DownloadUnknown) 0502 { 0503 str = unknown; 0504 } 0505 else if (itemInfo.downloaded == CamItemInfo::DownloadedYes) 0506 { 0507 str = i18nc("@info: item properties", "Yes"); 0508 } 0509 else 0510 { 0511 str = i18nc("@info: item properties", "No"); 0512 } 0513 0514 d->labelAlreadyDownloaded->setAdjustedText(str); 0515 0516 // -- Photograph information ------------------------------------------ 0517 // Note: If something is changed here, please updated albumfiletip section too. 0518 0519 PhotoInfoContainer photoInfo = meta->getPhotographInformation(); 0520 0521 if (photoInfo.isEmpty()) 0522 { 0523 widget(1)->hide(); 0524 } 0525 else 0526 { 0527 widget(1)->show(); 0528 } 0529 0530 ItemPropertiesTab::shortenedMakeInfo(photoInfo.make); 0531 ItemPropertiesTab::shortenedModelInfo(photoInfo.model); 0532 d->labelPhotoMake->setAdjustedText(photoInfo.make.isEmpty() ? unavailable : photoInfo.make); 0533 d->labelPhotoModel->setAdjustedText(photoInfo.model.isEmpty() ? unavailable : photoInfo.model); 0534 0535 if (photoInfo.dateTime.isValid()) 0536 { 0537 str = QLocale().toString(photoInfo.dateTime, QLocale::ShortFormat); 0538 d->labelPhotoDateTime->setAdjustedText(str); 0539 } 0540 else 0541 { 0542 d->labelPhotoDateTime->setAdjustedText(unavailable); 0543 } 0544 0545 d->labelPhotoLens->setAdjustedText(photoInfo.lens.isEmpty() ? unavailable : photoInfo.lens); 0546 d->labelPhotoAperture->setAdjustedText(photoInfo.aperture.isEmpty() ? unavailable : photoInfo.aperture); 0547 0548 if (photoInfo.focalLength35mm.isEmpty()) 0549 { 0550 d->labelPhotoFocalLength->setAdjustedText(photoInfo.focalLength.isEmpty() ? unavailable : photoInfo.focalLength); 0551 } 0552 else 0553 { 0554 str = i18nc("@info: focal length", "%1 (%2)", photoInfo.focalLength, photoInfo.focalLength35mm); 0555 d->labelPhotoFocalLength->setAdjustedText(str); 0556 } 0557 0558 d->labelPhotoExposureTime->setAdjustedText(photoInfo.exposureTime.isEmpty() ? unavailable : photoInfo.exposureTime); 0559 d->labelPhotoSensitivity->setAdjustedText(photoInfo.sensitivity.isEmpty() ? unavailable : i18nc("@label", "%1 ISO", photoInfo.sensitivity)); 0560 0561 if (photoInfo.exposureMode.isEmpty() && photoInfo.exposureProgram.isEmpty()) 0562 { 0563 d->labelPhotoExposureMode->setAdjustedText(unavailable); 0564 } 0565 else if (!photoInfo.exposureMode.isEmpty() && photoInfo.exposureProgram.isEmpty()) 0566 { 0567 d->labelPhotoExposureMode->setAdjustedText(photoInfo.exposureMode); 0568 } 0569 else if (photoInfo.exposureMode.isEmpty() && !photoInfo.exposureProgram.isEmpty()) 0570 { 0571 d->labelPhotoExposureMode->setAdjustedText(photoInfo.exposureProgram); 0572 } 0573 else 0574 { 0575 str = QString::fromUtf8("%1 / %2").arg(photoInfo.exposureMode).arg(photoInfo.exposureProgram); 0576 d->labelPhotoExposureMode->setAdjustedText(str); 0577 } 0578 0579 d->labelPhotoFlash->setAdjustedText(photoInfo.flash.isEmpty() ? unavailable : photoInfo.flash); 0580 d->labelPhotoWhiteBalance->setAdjustedText(photoInfo.whiteBalance.isEmpty() ? unavailable : photoInfo.whiteBalance); 0581 0582 // -- Audio/Video information ------------------------------------------ 0583 0584 VideoInfoContainer videoInfo = meta->getVideoInformation(); 0585 0586 if (videoInfo.isEmpty()) 0587 { 0588 widget(2)->hide(); 0589 } 0590 else 0591 { 0592 widget(2)->show(); 0593 } 0594 0595 d->labelVideoAspectRatio->setAdjustedText(videoInfo.aspectRatio.isEmpty() ? unavailable : videoInfo.aspectRatio); 0596 d->labelVideoAudioBitRate->setAdjustedText(videoInfo.audioBitRate.isEmpty() ? unavailable : videoInfo.audioBitRate); 0597 d->labelVideoAudioChannelType->setAdjustedText(videoInfo.audioChannelType.isEmpty() ? unavailable : videoInfo.audioChannelType); 0598 d->labelVideoAudioCodec->setAdjustedText(videoInfo.audioCodec.isEmpty() ? unavailable : videoInfo.audioCodec); 0599 d->labelVideoDuration->setAdjustedText(videoInfo.duration.isEmpty() ? unavailable : videoInfo.duration); 0600 d->labelVideoFrameRate->setAdjustedText(videoInfo.frameRate.isEmpty() ? unavailable : videoInfo.frameRate); 0601 d->labelVideoVideoCodec->setAdjustedText(videoInfo.videoCodec.isEmpty() ? unavailable : videoInfo.videoCodec); 0602 } 0603 0604 } // namespace Digikam 0605 0606 #include "moc_importitempropertiestab.cpp"