14.23: WebP import

This commit is contained in:
ZacharyZhang-NY committed 2026-10-11 12:14:13 -04:00
1 parent b10a9c5b71
commit f7498108c5
13 files changed
+93 -16

No files matched your search

+1 -1
View File
@@ -100,7 +100,7 @@ void ContentView::showImporter()
m_importer = new QFileDialog(this);
m_importer->setAttribute(Qt::WA_DeleteOnClose);
m_importer->setFileMode(QFileDialog::ExistingFiles);
m_importer->setNameFilter(QStringLiteral("Images (*.jpg *.jpeg *.png *.heic *.tif *.tiff *.psd *.psb *.svg *.svgz %1)").arg(RawImporter::globs().join(' ')));
m_importer->setNameFilter(QStringLiteral("Images (*.jpg *.jpeg *.png *.heic *.tif *.tiff *.webp *.psd *.psb *.svg *.svgz %1)").arg(RawImporter::globs().join(' ')));
connect(m_importer, &QDialog::finished, this, [this, panel = m_importer.data()](int result) {
// Ours no longer: the flag must not reject it again.
if (m_importer != panel)
+3 -3
View File
@@ -8,12 +8,12 @@
#include <algorithm>
namespace {
// Swift's order: PNG, JPEG, HEIC, TIFF, PSD, PSB, RAW, any.
// Swift's order: PNG, JPEG, HEIC, TIFF, WebP, Photoshop, RAW, any.
QStringList pictureFormats(const QMimeData &data)
{
QStringList formats;
for (const QString &format : {QStringLiteral("image/png"), QStringLiteral("image/jpeg"), QStringLiteral("image/heic"), QStringLiteral("image/tiff"),
QStringLiteral("image/vnd.adobe.photoshop"), QStringLiteral("image/x-photoshop-large-image")})
QStringLiteral("image/webp"), QStringLiteral("image/vnd.adobe.photoshop"), QStringLiteral("image/x-photoshop-large-image")})
if (data.hasFormat(format))
formats << format;
for (const QString &format : data.formats())
@@ -102,7 +102,7 @@ void ImageFileDrop::importProviders(const QMimeData &data, EditorSession &sessio
}
const auto finished = [&session, unreadable, done] {
if (unreadable) {
const QString message = QStringLiteral("Some dropped items couldn’t be read. Drag JPEG, PNG, HEIC, TIFF, or Photoshop (PSD) files from the file manager.");
const QString message = QStringLiteral("Some dropped items couldn’t be read. Drag JPEG, PNG, HEIC, TIFF, WebP, or Photoshop (PSD) files from the file manager.");
session.setImportError(session.importError() ? *session.importError() + QStringLiteral("\n\n") + message : message);
}
if (done)
+2 -2
View File
@@ -23,7 +23,7 @@ QString description(ImageImportError::Kind kind)
case ImageImportError::Kind::unreadable:
return QStringLiteral("The image could not be read. It may be damaged or unavailable.");
case ImageImportError::Kind::unsupported:
return QStringLiteral("Choose a JPEG, PNG, HEIC, TIFF, or Photoshop (PSD) file.");
return QStringLiteral("Choose a JPEG, PNG, HEIC, TIFF, WebP, or Photoshop (PSD) file.");
case ImageImportError::Kind::tooLarge:
return QStringLiteral("This import exceeds the current %1-megapixel document budget or %2-pixel side limit.").arg(DocumentLimits::documentBudgetMegapixels()).arg(DocumentLimits::maxSideText());
case ImageImportError::Kind::whiteBalance:
@@ -244,7 +244,7 @@ ImportedImage ImageImporter::decode(const QString &path, qint64 remainingPixels,
refuse(ImageImportError::Kind::unsupported, path, QStringLiteral("ISO media that is not HEIC"));
if (!heic && format.isEmpty())
refuse(ImageImportError::Kind::unreadable, path, QStringLiteral("no image format is recognised"));
if (!heic && format != "jpeg" && format != "png" && format != "tiff")
if (!heic && format != "jpeg" && format != "png" && format != "tiff" && format != "webp")
refuse(ImageImportError::Kind::unsupported, path, QString::fromLatin1(format));
// Qt's own turning drops the colour space: turn afterwards.
QImageIOHandler::Transformations orientation = QImageIOHandler::TransformationNone;