Commit 71d5f1b6 authored by Halla Rempt's avatar Halla Rempt
Browse files

Add clear error messages to the exr filter

parent ffc794b9
......@@ -105,6 +105,8 @@ KoFilter::ConversionStatus exrExport::convert(const QByteArray& from, const QByt
exrConverter kpc(input, !m_chain->manager()->getBatchMode());
KisImageBuilder_Result res;
if (widget.flatten->isChecked()) {
image->refreshGraph();
image->lock();
......@@ -112,29 +114,47 @@ KoFilter::ConversionStatus exrExport::convert(const QByteArray& from, const QByt
KisPaintLayerSP l = new KisPaintLayer(image, "projection", OPACITY_OPAQUE_U8, pd);
image->unlock();
KisImageBuilder_Result res;
if ((res = kpc.buildFile(url, l)) == KisImageBuilder_RESULT_OK) {
dbgFile << "success !";
return KoFilter::OK;
}
dbgFile << " Result =" << res;
return KoFilter::InternalError;
} else {
res = kpc.buildFile(url, l);
}
else {
image->lock();
KisImageBuilder_Result res = kpc.buildFile(url, image->rootLayer());
res = kpc.buildFile(url, image->rootLayer());
image->unlock();
if (res == KisImageBuilder_RESULT_OK) {
dbgFile << "success !";
return KoFilter::OK;
}
}
dbgFile << " Result =" << res;
switch (res) {
case KisImageBuilder_RESULT_INVALID_ARG:
input->setErrorMessage(i18n("This layer cannot be saved to EXR."));
return KoFilter::WrongFormat;
case KisImageBuilder_RESULT_EMPTY:
input->setErrorMessage(i18n("The layer does not have an image associated with it."));
return KoFilter::WrongFormat;
case KisImageBuilder_RESULT_NO_URI:
input->setErrorMessage(i18n("The filename is empty."));
return KoFilter::CreationError;
dbgFile << " Result =" << res;
case KisImageBuilder_RESULT_NOT_LOCAL:
input->setErrorMessage(i18n("EXR images cannot be saved remotely."));
return KoFilter::InternalError;
case KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE:
input->setErrorMessage(i18n("Colorspace not supported: EXR images must be 16 or 32 bits floating point RGB."));
return KoFilter::WrongFormat;
case KisImageBuilder_RESULT_OK:
return KoFilter::OK;
default:
break;
}
input->setErrorMessage(i18n("Internal Error"));
return KoFilter::InternalError;
}
#include <exr_export.moc>
......
......@@ -68,22 +68,27 @@ KoFilter::ConversionStatus exrImport::convert(const QByteArray&, const QByteArra
switch (ib.buildImage(url)) {
case KisImageBuilder_RESULT_UNSUPPORTED:
doc->setErrorMessage(i18n("Krita does support this type of EXR file."));
return KoFilter::NotImplemented;
break;
case KisImageBuilder_RESULT_INVALID_ARG:
doc->setErrorMessage(i18n("This is not an EXR file."));
return KoFilter::BadMimeType;
break;
case KisImageBuilder_RESULT_NO_URI:
case KisImageBuilder_RESULT_NOT_LOCAL:
doc->setErrorMessage(i18n("The EXR file does not exist."));
return KoFilter::FileNotFound;
break;
case KisImageBuilder_RESULT_BAD_FETCH:
case KisImageBuilder_RESULT_EMPTY:
doc->setErrorMessage(i18n("The EXR is corrupted."));
return KoFilter::ParsingError;
break;
case KisImageBuilder_RESULT_FAILURE:
doc->setErrorMessage(i18n("Krita could not create a new image."));
return KoFilter::InternalError;
break;
case KisImageBuilder_RESULT_OK:
Q_ASSERT(ib.image());
doc -> setCurrentImage(ib.image());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment