22#include <klocalizedstring.h>
48 : updater(0), mime(
"")
54 qDeleteAll(capabilities);
69 d->updater->setProgress(100);
81 return d->realFilename;
91 return d->importUserFeedBackInterface;
101 d->importUserFeedBackInterface = interface;
117 d->mime =
mime.toLatin1();
136 if (cfg && !filterConfig.isEmpty()) {
137 cfg->fromXML(filterConfig,
false);
151 qDeleteAll(
d->capabilities);
153 return d->capabilities;
163 QFileInfo fi(fileName);
166 return i18n(
"%1 does not exist after writing. Try saving again under a different name, in another location.", fileName);
169 if (!fi.isReadable()) {
170 return i18n(
"%1 is not readable", fileName);
173 if (fi.size() < 10) {
174 return i18n(
"%1 is smaller than 10 bytes, it must be corrupt. Try saving again under a different name, in another location.", fileName);
178 f.open(QFile::ReadOnly);
179 QByteArray ba = f.read(std::min(f.size(), (qint64)1000));
181 for(
int i = 0; i < ba.size(); ++i) {
189 return i18n(
"%1 has only zero bytes in the first 1000 bytes, it's probably corrupt. Try saving again under a different name, in another location.", fileName);
208 d->updater->setValue(
value);
219 d->capabilities[capability->
id()] = capability;
227 QString layerMessage;
228 QString imageMessage;
230 Q_FOREACH(
const KoID &colorModelID, allColorModels) {
232 Q_FOREACH(
const KoID &colorDepthID, allColorDepths) {
239 if(!colorModelCheckFactory || !colorModelPerLayerCheckFactory) {
240 qWarning() <<
"No factory for" << colorModelID << colorDepthID;
244 if (supportedColorModels.contains(QPair<KoID, KoID>(colorModelID, colorDepthID))) {
252 imageMessage = i18nc(
"image conversion warning",
253 "%1 cannot save images with color model <b>%2</b> and depth <b>%3</b>. The image will be converted."
254 ,name, colorModelID.
name(), colorDepthID.
name());
257 i18nc(
"image conversion warning",
258 "%1 cannot save layers with color model <b>%2</b> and depth <b>%3</b>. The layers will be converted or skipped."
259 ,name, colorModelID.
name(), colorDepthID.
name());
262 imageMessage = i18nc(
"image conversion warning",
263 "%1 cannot save images with color model <b>%2</b> and depth <b>%3</b>. The image will not be saved."
264 ,name, colorModelID.
name(), colorDepthID.
name());
267 i18nc(
"image conversion warning",
268 "%1 cannot save layers with color model <b>%2</b> and depth <b>%3</b>. The layers will be skipped."
269 , name, colorModelID.
name(), colorDepthID.
name());
285 if (!store || store->bad()) {
286 return i18n(
"Could not open the saved file %1. Please try to save again in a different location.", fileName);
289 Q_FOREACH(
const QString &file, filesToCheck) {
290 if (!store->hasFile(file)) {
291 return i18n(
"Component %1 is missing in %2. Please try to save again in a different location.", file, fileName);
float value(const T *src, size_t ch)
QString exportConfigurationXML(const QString &filterId, bool defaultValue=false) const
The KisExportCheckBase class defines the interface of the individual checks of an export filter's cap...
virtual QString id() const
virtual KisExportCheckBase * create(KisExportCheckBase::Level level, const QString &customWarning=QString())=0
static KisExportCheckRegistry * instance()
The base class for import and export filters.
void setImportUserFeedBackInterface(KisImportUserFeedbackInterface *interface)
virtual KisConfigWidget * createConfigurationWidget(QWidget *parent, const QByteArray &from="", const QByteArray &to="") const
createConfigurationWidget creates a widget that can be used to define the settings for a given import...
virtual KisPropertiesConfigurationSP defaultConfiguration(const QByteArray &from="", const QByteArray &to="") const
defaultConfiguration defines the default settings for the given import export filter
KisImportExportFilter(QObject *parent=0)
void setMimeType(const QString &mime)
void setUpdater(QPointer< KoUpdater > updater)
virtual QMap< QString, KisExportCheckBase * > exportChecks()
generate and return the list of capabilities of this export filter. The list
QPointer< KoUpdater > updater
KisPropertiesConfigurationSP lastSavedConfiguration(const QByteArray &from="", const QByteArray &to="") const
lastSavedConfiguration return the last saved configuration for this filter
static const QString ColorDepthIDTag
void setProgress(int value)
static const QString ColorModelIDTag
void setBatchMode(bool batchmode)
virtual void initializeCapabilities()
static const QString CICPTransferCharacteristicsTag
static const QString CICPPrimariesTag
KisImportUserFeedbackInterface * importUserFeedBackInterface
void addSupportedColorModels(QList< QPair< KoID, KoID > > supportedColorModels, const QString &name, KisExportCheckBase::Level level=KisExportCheckBase::PARTIALLY)
static const QString ImageContainsTransparencyTag
~KisImportExportFilter() override
virtual QString verify(const QString &fileName) const
Verify whether the given file is correct and readable.
QMap< QString, KisExportCheckBase * > capabilities
static const QString sRGBTag
QString verifyZiPBasedFiles(const QString &fileName, const QStringList &filesToCheck) const
void setFilename(const QString &filename)
void setRealFilename(const QString &filename)
static const QString HDRTag
void addCapability(KisExportCheckBase *capability)
virtual bool exportSupportsGuides() const
exportSupportsGuides Because guides are in the document and not the image, checking for guides cannot...
QByteArray mimeType() const
T get(const QString &id) const
static KoStore * createStore(const QString &fileName, Mode mode, const QByteArray &appIdentification=QByteArray(), Backend backend=Auto, bool writeMimetype=true)
QList< KoID > colorDepthList(const KoID &colorModelId, ColorSpaceListVisibility option) const
static KoColorSpaceRegistry * instance()
QList< KoID > colorModelsList(ColorSpaceListVisibility option) const
@ AllColorSpaces
All color space even those not visible to the user.