summaryrefslogtreecommitdiffstats
path: root/core
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
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')
-rw-r--r--core/qthelper.cpp14
-rw-r--r--core/qthelper.h1
2 files changed, 11 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));
diff --git a/core/qthelper.h b/core/qthelper.h
index 9788bb55d..e0e4da0c5 100644
--- a/core/qthelper.h
+++ b/core/qthelper.h
@@ -46,5 +46,6 @@ extern "C" enum deco_mode decoMode();
extern "C" void subsurface_mkdir(const char *dir);
void init_proxy();
QString getUUID();
+QStringList imageExtensionFilters();
#endif // QTHELPER_H