Use image dimmentions from metadata as a fallback

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
(cherry picked from commit 985d8126df)
pull/34/head
Alexander Golubev 9 months ago committed by Michele Calgaro
parent db4080c183
commit 8f266257f3
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -235,11 +235,23 @@ void FileThumbnailViewItem::updateLines() {
mLines.append( new CroppedLine(this, TimeUtils::formatTime(time)) ); mLines.append( new CroppedLine(this, TimeUtils::formatTime(time)) );
} }
if (showImageSize) { if (showImageSize) {
TQString txt; TQSize sz;
if (mImageSize.isValid()) { if (mImageSize.isValid()) {
txt=TQString::number(mImageSize.width())+"x"+TQString::number(mImageSize.height()); sz=mImageSize;
} else {
const KFileMetaInfo& info = mFileItem->metaInfo(/*autogen=*/false);
if (info.isValid()) {
sz = info.value("Dimensions").toSize();
}
}
if (sz.isValid()) {
TQString txt = TQString::number(sz.width())+"x"+TQString::number(sz.height());
mLines.append( new CroppedLine(this, txt) );
} else if ( iconView()->itemTextPos()==TQIconView::Right) {
// add empty line for they would nicely alligned;
// for text at the bottom it doesn't look that nice
mLines.append( new CroppedLine(this, TQString()));
} }
mLines.append( new CroppedLine(this, txt) );
} }
if (showFilesize) { if (showFilesize) {
mLines.append( new CroppedLine(this, TDEIO::convertSize(mFileItem->size())) ); mLines.append( new CroppedLine(this, TDEIO::convertSize(mFileItem->size())) );

Loading…
Cancel
Save