summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2024-02-20 00:42:12 +0300
committerMichele Calgaro <michele.calgaro@yahoo.it>2024-02-22 18:29:31 +0900
commita5931c83bdad1b1d137cf30f5c9cf59bf3e4c8cd (patch)
treee95d5f49a3dda087ec4be13f0690b3d536e73fd0
parentd84beae42af5046defaa379865e994a47b56ba96 (diff)
downloadgwenview-a5931c83bdad1b1d137cf30f5c9cf59bf3e4c8cd.tar.gz
gwenview-a5931c83bdad1b1d137cf30f5c9cf59bf3e4c8cd.zip
Some refactoring of FileThumbnailViewItem::updateLines()
Signed-off-by: Alexander Golubev <fatzer2@gmail.com> (cherry picked from commit 79826b760ff5c65840794d3d2dc4c4a60916996c)
-rw-r--r--src/gvcore/filethumbnailviewitem.cpp59
1 files changed, 29 insertions, 30 deletions
diff --git a/src/gvcore/filethumbnailviewitem.cpp b/src/gvcore/filethumbnailviewitem.cpp
index d017140..c3f7e69 100644
--- a/src/gvcore/filethumbnailviewitem.cpp
+++ b/src/gvcore/filethumbnailviewitem.cpp
@@ -204,46 +204,45 @@ void FileThumbnailViewItem::updateLines() {
mLines.clear();
if (!mFileItem) return;
+ bool showName, showDate, showImageSize, showFilesize;
+
bool isDir=mFileItem->isDir();
+
if (iconView()->itemTextPos()==TQIconView::Right) {
// Text is on the right, show everything
-
- time_t time = TimeUtils::getTime(mFileItem);
- mLines.append( new WrappedLine(this, mFileItem->name()) );
- mLines.append( new CroppedLine(this, TimeUtils::formatTime(time)) );
- if (mImageSize.isValid()) {
- TQString txt=TQString::number(mImageSize.width())+"x"+TQString::number(mImageSize.height());
- mLines.append( new CroppedLine(this, txt) );
- }
- if (!isDir) {
- mLines.append( new CroppedLine(this, TDEIO::convertSize(mFileItem->size())) );
- }
-
+ showName = true;
+ showDate = true;
+ showImageSize = true;
+ showFilesize = !isDir;
} else {
// Text is below the icon, only show details selected in
// view->itemDetails()
FileThumbnailView *view=static_cast<FileThumbnailView*>(iconView());
int details=view->itemDetails();
bool isImage=!Archive::fileItemIsDirOrArchive(mFileItem);
-
- if (!isImage || (details & FileThumbnailView::FILENAME)) {
- mLines.append( new WrappedLine(this, mFileItem->name()) );
- }
- if (details & FileThumbnailView::FILEDATE) {
- time_t time = TimeUtils::getTime(mFileItem);
- mLines.append( new CroppedLine(this, TimeUtils::formatTime(time)) );
- }
- if (details & FileThumbnailView::IMAGESIZE) {
- TQString txt;
- if (mImageSize.isValid()) {
- txt=TQString::number(mImageSize.width())+"x"+TQString::number(mImageSize.height());
- }
- mLines.append( new CroppedLine(this, txt) );
- }
- if (!isDir && (details & FileThumbnailView::FILESIZE)) {
- mLines.append( new CroppedLine(this, TDEIO::convertSize(mFileItem->size())) );
- }
+ showName = !isImage || ( details & FileThumbnailView::FILENAME );
+ showDate = ( details & FileThumbnailView::FILEDATE );
+ showImageSize = ( details & FileThumbnailView::IMAGESIZE );
+ showFilesize = !isDir && ( details & FileThumbnailView::FILESIZE );
+ }
+
+ if (showName) {
+ mLines.append( new WrappedLine(this, mFileItem->name()) );
+ }
+ if (showDate) {
+ time_t time = TimeUtils::getTime(mFileItem);
+ mLines.append( new CroppedLine(this, TimeUtils::formatTime(time)) );
+ }
+ if (showImageSize) {
+ TQString txt;
+ if (mImageSize.isValid()) {
+ txt=TQString::number(mImageSize.width())+"x"+TQString::number(mImageSize.height());
+ }
+ mLines.append( new CroppedLine(this, txt) );
+ }
+ if (showFilesize) {
+ mLines.append( new CroppedLine(this, TDEIO::convertSize(mFileItem->size())) );
}
calcRect();