mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
59bbaa7820
commit
462797396b
4 changed files with 18 additions and 5 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue