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>
(cherry picked from commit 13d26b5984)
pull/34/head
Alexander Golubev 9 months ago committed by Michele Calgaro
parent 8f266257f3
commit c42622ee63
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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">

@ -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()));

@ -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>

@ -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) {

@ -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);

@ -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*);

Loading…
Cancel
Save