diff --git a/caesium.cpp b/caesium.cpp index bb5ebe6..9b73d99 100644 --- a/caesium.cpp +++ b/caesium.cpp @@ -470,7 +470,7 @@ void Caesium::on_actionAdd_Pictures_triggered() } filePaths = QFileDialog::getOpenFileNames( - this, tr("Select file(s)"), dir, tr("Supported Images (*.bmp *.jpg *.jpeg *.tif *.tiff *.png *.ppm *.xbm *.xpm);;PNG Files (*.png);;JPEG Files (*.jpg *.jpeg);;BMP Files (*.bmp);;TIFF Files (*.tif *.tiff);;PPM Files (*.ppm);;XBM Files (*.xbm);;XPM Files (*.xpm)")); + this, tr("Select file(s)"), dir, tr("Supported Images (*.bmp *.jpg *.jpeg *.jfif *.tif *.tiff *.png *.ppm *.xbm *.xpm);;PNG Files (*.png);;JPEG Files (*.jpg *.jpeg *.jfif);;BMP Files (*.bmp);;TIFF Files (*.tif *.tiff);;PPM Files (*.ppm);;XBM Files (*.xbm);;XPM Files (*.xpm)")); if (filePaths.size() != 0) { @@ -522,7 +522,7 @@ void Caesium::on_actionOpen_Folder_triggered() | QFileDialog::DontResolveSymlinks); QStringList filters, fileList; - filters << "*.bmp" << "*.jpg" << "*.jpeg" << "*.tif" << "*.png" << "*.ppm" << "*.xbm" << "*.xpm"; + filters << "*.bmp" << "*.jpg" << "*.jpeg" << "*.jfif" << "*.tif" << "*.png" << "*.ppm" << "*.xbm" << "*.xpm"; if(settings.value("Preferences/scansubdir").value()) { fileList = findFilesRecursively(directory, filters); diff --git a/qdroptreewidget.cpp b/qdroptreewidget.cpp index e0b555d..aee445a 100644 --- a/qdroptreewidget.cpp +++ b/qdroptreewidget.cpp @@ -51,11 +51,16 @@ bool QDropTreeWidget::d_duplicateCheck(QString name, QString dir) bool checkExtension(QString extension) { - if (extension.toLower() == "jpg" || extension.toLower() == "png" || extension.toLower() == "bmp" || extension.toLower() == "jpeg" || extension.toLower() == "tif" || extension.toLower() == "tiff" || extension.toLower() == "ppm" || extension.toLower() == "xbm" || extension.toLower() == "xpm") - { - return true; - } - return false; + const QStringList supportedSuffix { + "jpg", "jfif", "png", "bmp", "jpeg", "tif", "tiff", "ppm", "xbm", "xpm" + }; + + // Actually we can make use of this but it still doesn't cover all suffix + // since the suffix can be a mess. "jfif" is not reported but can be read + // as regular jpeg file, for example. + // qDebug() << QImageReader::supportedImageFormats(); + + return supportedSuffix.contains(extension.toLower()); } QStringList findFilesRecursivelyDrop(QString directory_path, QStringList filters)