summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2024-02-21 00:11:00 +0300
committerAlexander Golubev <fatzer2@gmail.com>2024-02-21 05:50:59 +0300
commit13d26b59848dce276051f8f322bf82d291aa0c23 (patch)
tree4d80ac84406936fdbc4495fcc8d4f6b5c333fe0e
parent985d8126df0c00fb0a04b57f7a92acd9952d369e (diff)
downloadgwenview-13d26b59.tar.gz
gwenview-13d26b59.zip
Make metadata loading optional
See: https://mirror.git.trinitydesktop.org/gitea/TDE/gwenview/issues/17#issuecomment-44076 Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
-rw-r--r--src/app/configimagelistpage.ui27
-rw-r--r--src/gvcore/filethumbnailviewitem.cpp4
-rw-r--r--src/gvcore/fileviewconfig.kcfg3
-rw-r--r--src/gvcore/fileviewcontroller.cpp9
-rw-r--r--src/gvcore/timeutils.cpp19
-rw-r--r--src/gvcore/timeutils.h3
6 files changed, 52 insertions, 13 deletions
diff --git a/src/app/configimagelistpage.ui b/src/app/configimagelistpage.ui
index 01cfe95..892ec88 100644
--- a/src/app/configimagelistpage.ui
+++ b/src/app/configimagelistpage.ui
@@ -1,4 +1,4 @@
-<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConfigImageListPage</class>
<widget class="TQWidget">
<property name="name">
@@ -29,6 +29,31 @@
<property name="text">
<string>Show folders and archives</string>
</property>
+ <property name="accel">
+ <string>Alt+S</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If enabled, folders and archives will be displayed alongside images in the browse view.</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox">
+ <property name="name">
+ <cstring>kcfg_loadMetadata</cstring>
+ </property>
+ <property name="text">
+ <string>Load &amp;metadata from files</string>
+ </property>
+ <property name="accel">
+ <string>Alt+M</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;p&gt;This will cause metadata to be loaded from all the files in the current folder.&lt;/p&gt;
+&lt;p&gt;The metadata will be used to display the creation timestamp of the image instead of the file's mtime. Also, if the preview load fails, it may be used to display the image dimensions as a fallback.
+&lt;/p&gt;
+&lt;p&gt;For this option to work, you will need to have appropriate file plugins from &lt;i&gt;&lt;/i&gt; to be installed.
+&lt;/p&gt;
+&lt;p&gt;This may have some performance impact when browsing very large folders.&lt;/p&gt;</string>
+ </property>
</widget>
<spacer>
<property name="name">
diff --git a/src/gvcore/filethumbnailviewitem.cpp b/src/gvcore/filethumbnailviewitem.cpp
index be74115..899bffd 100644
--- a/src/gvcore/filethumbnailviewitem.cpp
+++ b/src/gvcore/filethumbnailviewitem.cpp
@@ -238,7 +238,7 @@ void FileThumbnailViewItem::updateLines() {
TQSize sz;
if (mImageSize.isValid()) {
sz=mImageSize;
- } else {
+ } else if (FileViewConfig::loadMetadata()) {
const KFileMetaInfo& info = mFileItem->metaInfo(/*autogen=*/false);
if (info.isValid()) {
sz = info.value("Dimensions").toSize();
@@ -247,7 +247,7 @@ void FileThumbnailViewItem::updateLines() {
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) {
+ } 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()));
diff --git a/src/gvcore/fileviewconfig.kcfg b/src/gvcore/fileviewconfig.kcfg
index 9ec2ed6..489b48c 100644
--- a/src/gvcore/fileviewconfig.kcfg
+++ b/src/gvcore/fileviewconfig.kcfg
@@ -7,6 +7,9 @@
<entry name="showDirs" key="show dirs" type="Bool">
<default>true</default>
</entry>
+ <entry name="loadMetadata" key="load metadata" type="Bool">
+ <default>true</default>
+ </entry>
<entry name="showDotFiles" key="show dot files" type="Bool">
<default>false</default>
</entry>
diff --git a/src/gvcore/fileviewcontroller.cpp b/src/gvcore/fileviewcontroller.cpp
index 4da91b0..576f9c6 100644
--- a/src/gvcore/fileviewcontroller.cpp
+++ b/src/gvcore/fileviewcontroller.cpp
@@ -1053,7 +1053,9 @@ void FileViewController::dirListerNewItems(const KFileItemList& items) {
LOG("");
mThumbnailsNeedUpdate=true;
currentFileView()->addItemList(items);
- loadMetaInfo(items);
+ if (FileViewConfig::loadMetadata()) {
+ loadMetaInfo(items);
+ }
}
@@ -1063,7 +1065,10 @@ void FileViewController::dirListerRefreshItems(const KFileItemList& list) {
for (; *it!=0L; ++it) {
updateViewItem(*it);
}
- loadMetaInfo(list, true);
+
+ if (FileViewConfig::loadMetadata()) {
+ loadMetaInfo(list, true);
+ }
}
void FileViewController::updateViewItem(const KFileItem *item, bool metaDataOnly) {
diff --git a/src/gvcore/timeutils.cpp b/src/gvcore/timeutils.cpp
index c917232..75dd41f 100644
--- a/src/gvcore/timeutils.cpp
+++ b/src/gvcore/timeutils.cpp
@@ -25,17 +25,22 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <tdefilemetainfo.h>
#include <tdeglobal.h>
#include <tdelocale.h>
-
+
+// Local
+#include "fileviewconfig.h"
+
namespace Gwenview {
namespace TimeUtils {
time_t getTime(const KFileItem* item) {
- const KFileMetaInfo& info = item->metaInfo(/*autogen=*/false);
- if (info.isValid()) {
- TQVariant value = info.value("Date/time");
- TQDateTime dt = value.toDateTime();
- if (dt.isValid()) {
- return dt.toTime_t();
+
+ if (FileViewConfig::loadMetadata()) {
+ const KFileMetaInfo& info = item->metaInfo(/*autogen=*/false);
+ if (info.isValid()) {
+ TQDateTime dt = info.value("Date/time").toDateTime();
+ if (dt.isValid()) {
+ return dt.toTime_t();
+ }
}
}
return item->time(TDEIO::UDS_MODIFICATION_TIME);
diff --git a/src/gvcore/timeutils.h b/src/gvcore/timeutils.h
index 8570b36..53eb065 100644
--- a/src/gvcore/timeutils.h
+++ b/src/gvcore/timeutils.h
@@ -29,7 +29,8 @@ namespace Gwenview {
namespace TimeUtils {
/**
- * Returns the time of an item, using EXIF info if available and already loaded
+ * Returns the time of an item, using EXIF info if available, enabled and
+ * already loaded
*/
time_t getTime(const KFileItem*);