Index: app/advancedconfigpage.ui
===================================================================
--- app/advancedconfigpage.ui
+++ app/advancedconfigpage.ui
@@ -26,7 +26,7 @@
-
- Delete thumbnail cache folder on exit
+ Low resource usage mode
@@ -48,7 +48,7 @@
-
- Enable this option if you do not have a lot of disk space.<br/><br/><em>Be careful:</em> this will delete the folder named <filename>.thumbnails</filename> in your home folder, deleting all thumbnails previously generated by Gwenview and other applications.
+ Enable this option if you do not have a lot of disk space. This will avoid storing thumbnails on disk and will prefer embedded thumbnails of lower quality that are faster to load, if available.<br/><br/><em>Be careful:</em> this will delete the folder named <filename>.thumbnails</filename> in your home folder, deleting all thumbnails previously generated by Gwenview and other applications.
true
Index: doc/index.docbook
===================================================================
--- doc/index.docbook
+++ doc/index.docbook
@@ -846,7 +846,7 @@
Cache
- Enable the Delete thumbnail cache folder on exit option if you do not have a lot of disk space.
+ Enable the Low resource usage mode option if you do not have a lot of disk space. This will avoid storing thumbnails on disk and will prefer embedded thumbnails of lower quality that are faster to load, if available.
Be careful: This will delete the folder named .thumbnails in your home folder, deleting all thumbnails previously generated by &gwenview; and other applications.
Index: lib/thumbnailprovider/thumbnailgenerator.cpp
===================================================================
--- lib/thumbnailprovider/thumbnailgenerator.cpp
+++ lib/thumbnailprovider/thumbnailgenerator.cpp
@@ -119,7 +119,11 @@
if (!content.rawData().isEmpty()) {
QImage thumbnail = content.thumbnail();
- if (qMax(thumbnail.width(), thumbnail.height()) >= pixelSize) {
+ // If the user does not care about the generated thumbnails (by deleting them on exit), use ANY
+ // embedded thumnail, even if it's too small.
+ if (!thumbnail.isNull() &&
+ (GwenviewConfig::deleteThumbnailCacheOnExit() || qMax(thumbnail.width(), thumbnail.height()) >= pixelSize)
+ ) {
mImage = std::move(thumbnail);
mOriginalWidth = content.size().width();
mOriginalHeight = content.size().height();
Index: tests/auto/thumbnailprovidertest.cpp
===================================================================
--- tests/auto/thumbnailprovidertest.cpp
+++ tests/auto/thumbnailprovidertest.cpp
@@ -34,6 +34,7 @@
// Local
#include "../lib/thumbnailprovider/thumbnailprovider.h"
#include "testutils.h"
+#include "gwenviewconfig.h"
// libc
#include
@@ -212,7 +213,8 @@
QVERIFY(TestUtils::imageCompare(expectedThumbnail, thumbnailPix.toImage()));
}
- // Loading a large thumbnail should bring the red one
+ // Loading a large thumbnail should bring the red one, unless thumbnails are deleted on exit,
+ // which should bring the white one
{
ThumbnailProvider provider;
provider.setThumbnailGroup(ThumbnailGroup::Large);
@@ -221,7 +223,11 @@
syncRun(&provider);
QCOMPARE(spy.count(), 1);
- expectedThumbnail = createColoredImage(256, 128, QColor(254, 0, 0));
+ if (GwenviewConfig::deleteThumbnailCacheOnExit()) {
+ expectedThumbnail = createColoredImage(128, 64, Qt::white);
+ } else {
+ expectedThumbnail = createColoredImage(256, 128, QColor(254, 0, 0));
+ }
thumbnailPix = qvariant_cast(spy.at(0).at(1));
QVERIFY(TestUtils::imageCompare(expectedThumbnail, thumbnailPix.toImage()));
}