chore: jfif is a thing

This commit is contained in:
Gary Wang 2021-09-28 12:32:58 +08:00
parent a97e2126f0
commit abf6bfd172
2 changed files with 12 additions and 7 deletions

View File

@ -470,7 +470,7 @@ void Caesium::on_actionAdd_Pictures_triggered()
} }
filePaths = QFileDialog::getOpenFileNames( 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) if (filePaths.size() != 0)
{ {
@ -522,7 +522,7 @@ void Caesium::on_actionOpen_Folder_triggered()
| QFileDialog::DontResolveSymlinks); | QFileDialog::DontResolveSymlinks);
QStringList filters, fileList; 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<bool>()) if(settings.value("Preferences/scansubdir").value<bool>())
{ {
fileList = findFilesRecursively(directory, filters); fileList = findFilesRecursively(directory, filters);

View File

@ -51,11 +51,16 @@ bool QDropTreeWidget::d_duplicateCheck(QString name, QString dir)
bool checkExtension(QString extension) 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") const QStringList supportedSuffix {
{ "jpg", "jfif", "png", "bmp", "jpeg", "tif", "tiff", "ppm", "xbm", "xpm"
return true; };
}
return false; // 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) QStringList findFilesRecursivelyDrop(QString directory_path, QStringList filters)