summaryrefslogtreecommitdiffstats
path: root/core/qthelper.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2017-05-05 21:13:46 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-06 08:07:16 -0700
commit462797396b082f31060df6706bfce416aebce037 (patch)
tree577ab4fc5450c068fb9146ebb72d1617f0fe1bd2 /core/qthelper.cpp
parent59bbaa78203fafe3f66ed34c281733fe6eea0940 (diff)
downloadsubsurface-462797396b082f31060df6706bfce416aebce037.tar.gz
File selector should filter images we can actually handle.
So better ask Qt about image formats known to it. Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/qthelper.cpp')
-rw-r--r--core/qthelper.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 79fc0effc..0cf37fffb 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -1173,9 +1173,18 @@ extern "C" void cache_picture(struct picture *picture)
QtConcurrent::run(hashPicture, clone_picture(picture));
}
+QStringList imageExtensionFilters() {
+ QStringList filters;
+ foreach (QString format, QImageReader::supportedImageFormats()) {
+ filters.append(QString("*.").append(format));
+ }
+ return filters;
+}
+
void learnImages(const QDir dir, int max_recursions)
{
- QStringList filters, files;
+ QStringList files;
+ QStringList filters = imageExtensionFilters();
if (max_recursions) {
foreach (QString dirname, dir.entryList(QStringList(), QDir::NoDotAndDotDot | QDir::Dirs)) {
@@ -1183,9 +1192,6 @@ void learnImages(const QDir dir, int max_recursions)
}
}
- foreach (QString format, QImageReader::supportedImageFormats()) {
- filters.append(QString("*.").append(format));
- }
foreach (QString file, dir.entryList(filters, QDir::Files)) {
files.append(dir.absoluteFilePath(file));