Commit 0ed201c7 authored by Halla Rempt's avatar Halla Rempt

Extend the Import/Export filter API

Following paintops and filters, we make it possible to retrieve
a default filter configuration and the filter configuration widget
so we don't have to do everything in the convert method.
parent c1fb1319
......@@ -43,7 +43,7 @@ KisBMPExport::~KisBMPExport()
{
}
KisImportExportFilter::ConversionStatus KisBMPExport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisBMPExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "BMP export! From:" << from << ", To:" << to << "";
......
......@@ -31,7 +31,7 @@ public:
KisBMPExport(QObject *parent, const QVariantList &);
virtual ~KisBMPExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -50,7 +50,7 @@ KisBMPImport::~KisBMPImport()
{
}
KisImportExportFilter::ConversionStatus KisBMPImport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisBMPImport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "BMP import! From:" << from << ", To:" << to << 0;
......@@ -67,7 +67,7 @@ KisImportExportFilter::ConversionStatus KisBMPImport::convert(const QByteArray&
doc->prepareForImport();
if (!filename.isEmpty()) {
QFileInfo fi(filename);
if (!fi.exists()) {
return KisImportExportFilter::FileNotFound;
......
......@@ -31,7 +31,7 @@ public:
KisBMPImport(QObject *parent, const QVariantList &);
virtual ~KisBMPImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -62,7 +62,7 @@ KisBrushExport::~KisBrushExport()
{
}
KisImportExportFilter::ConversionStatus KisBrushExport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisBrushExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
KisDocument *input = inputDocument();
QString filename = outputFile();
......
......@@ -31,7 +31,7 @@ public:
KisBrushExport(QObject *parent, const QVariantList &);
virtual ~KisBrushExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -56,7 +56,7 @@ KisBrushImport::~KisBrushImport()
}
KisImportExportFilter::ConversionStatus KisBrushImport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisBrushImport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
if (to != "application/x-krita")
return KisImportExportFilter::BadMimeType;
......
......@@ -31,7 +31,7 @@ public:
KisBrushImport(QObject *parent, const QVariantList &);
virtual ~KisBrushImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -64,7 +64,7 @@ KisCSVExport::~KisCSVExport()
{
}
KisImportExportFilter::ConversionStatus KisCSVExport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisCSVExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "CSV export! From:" << from << ", To:" << to << "";
......
......@@ -31,7 +31,7 @@ public:
KisCSVExport(QObject *parent, const QVariantList &);
virtual ~KisCSVExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -42,7 +42,7 @@ KisCSVImport::~KisCSVImport()
{
}
KisImportExportFilter::ConversionStatus KisCSVImport::convert(const QByteArray&, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisCSVImport::convert(const QByteArray&, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "Importing using CSVImport!";
......
......@@ -30,7 +30,7 @@ public:
KisCSVImport(QObject *parent, const QVariantList &);
virtual ~KisCSVImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -6,7 +6,7 @@
"X-KDE-Import": "application/x-krita",
"X-KDE-Library": "kritacsvexport",
"X-KDE-ServiceTypes": [
"Krita/FileFilter"
"Krita/AnimationExporter"
],
"X-KDE-Weight": "1",
"X-KDE-Extensions" : "csv"
......
......@@ -55,7 +55,7 @@ exrExport::~exrExport()
{
}
KisImportExportFilter::ConversionStatus exrExport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus exrExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "EXR export! From:" << from << ", To:" << to << "";
......
......@@ -31,7 +31,7 @@ public:
exrExport(QObject *parent, const QVariantList &);
virtual ~exrExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -40,7 +40,7 @@ exrImport::~exrImport()
{
}
KisImportExportFilter::ConversionStatus exrImport::convert(const QByteArray&, const QByteArray& to)
KisImportExportFilter::ConversionStatus exrImport::convert(const QByteArray&, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "Importing using EXRImport!";
......
......@@ -31,7 +31,7 @@ public:
exrImport(QObject *parent, const QVariantList &);
virtual ~exrImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -56,7 +56,7 @@ KisHeightMapExport::~KisHeightMapExport()
{
}
KisImportExportFilter::ConversionStatus KisHeightMapExport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisHeightMapExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "HeightMap export! From:" << from << ", To:" << to;
......
......@@ -30,7 +30,7 @@ public:
KisHeightMapExport(QObject *parent, const QVariantList &);
virtual ~KisHeightMapExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -60,7 +60,7 @@ KisHeightMapImport::~KisHeightMapImport()
{
}
KisImportExportFilter::ConversionStatus KisHeightMapImport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisHeightMapImport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
KisDocument * doc = outputDocument();
......
......@@ -32,7 +32,7 @@ public:
KisHeightMapImport(QObject *parent, const QVariantList &);
virtual ~KisHeightMapImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -54,7 +54,7 @@ jp2Export::~jp2Export()
{
}
KisImportExportFilter::ConversionStatus jp2Export::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus jp2Export::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "JP2 export! From:" << from << ", To:" << to << "";
......
......@@ -30,7 +30,7 @@ public:
jp2Export(QObject *parent, const QVariantList &);
virtual ~jp2Export();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -38,7 +38,7 @@ jp2Import::~jp2Import()
{
}
KisImportExportFilter::ConversionStatus jp2Import::convert(const QByteArray&, const QByteArray& to)
KisImportExportFilter::ConversionStatus jp2Import::convert(const QByteArray&, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "Importing using JP2Import!";
......
......@@ -30,7 +30,7 @@ public:
jp2Import(QObject *parent, const QVariantList &);
virtual ~jp2Import();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -65,7 +65,7 @@ KisJPEGExport::~KisJPEGExport()
{
}
KisImportExportFilter::ConversionStatus KisJPEGExport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisJPEGExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "JPEG export! From:" << from << ", To:" << to << "";
......
......@@ -31,7 +31,7 @@ public:
KisJPEGExport(QObject *parent, const QVariantList &);
virtual ~KisJPEGExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -41,7 +41,7 @@ KisJPEGImport::~KisJPEGImport()
{
}
KisImportExportFilter::ConversionStatus KisJPEGImport::convert(const QByteArray&, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisJPEGImport::convert(const QByteArray&, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "Importing using JPEGImport!";
......
......@@ -30,7 +30,7 @@ public:
KisJPEGImport(QObject *parent, const QVariantList &);
virtual ~KisJPEGImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -52,7 +52,7 @@ KisODGImport::~KisODGImport()
{
}
KisImportExportFilter::ConversionStatus KisODGImport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisODGImport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "Import odg";
......@@ -71,7 +71,7 @@ KisImportExportFilter::ConversionStatus KisODGImport::convert(const QByteArray&
delete store;
return KisImportExportFilter::BadConversionGraph;
}
doc -> prepareForImport();
......
......@@ -30,7 +30,7 @@ public:
KisODGImport(QObject *parent, const QVariantList &);
virtual ~KisODGImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -72,7 +72,7 @@ bool hasShapeLayerChild(KisNodeSP node)
return false;
}
KisImportExportFilter::ConversionStatus OraExport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus OraExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "ORA export! From:" << from << ", To:" << to << "";
......
......@@ -29,7 +29,7 @@ public:
OraExport(QObject *parent, const QVariantList &);
virtual ~OraExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -37,7 +37,7 @@ OraImport::~OraImport()
{
}
KisImportExportFilter::ConversionStatus OraImport::convert(const QByteArray&, const QByteArray& to)
KisImportExportFilter::ConversionStatus OraImport::convert(const QByteArray&, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "Importing using ORAImport!";
......
......@@ -29,7 +29,7 @@ public:
OraImport(QObject *parent, const QVariantList &);
virtual ~OraImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -57,7 +57,8 @@
K_PLUGIN_FACTORY_WITH_JSON(PDFImportFactory, "krita_pdf_import.json",
registerPlugin<KisPDFImport>();)
KisPDFImport::KisPDFImport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent)
KisPDFImport::KisPDFImport(QObject *parent, const QVariantList &)
: KisImportExportFilter(parent)
{
}
......@@ -65,7 +66,7 @@ KisPDFImport::~KisPDFImport()
{
}
KisPDFImport::ConversionStatus KisPDFImport::convert(const QByteArray& , const QByteArray&)
KisPDFImport::ConversionStatus KisPDFImport::convert(const QByteArray& , const QByteArray&, KisPropertiesConfigurationSP configuration)
{
QString filename = inputFile();
dbgFile << "Importing using PDFImport!" << filename;
......
......@@ -31,7 +31,7 @@ public:
KisPDFImport(QObject *parent, const QVariantList &);
virtual ~KisPDFImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -68,7 +68,7 @@ bool hasVisibleWidgets()
return false;
}
KisImportExportFilter::ConversionStatus KisPNGExport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisPNGExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "Png export! From:" << from << ", To:" << to << "";
......
......@@ -43,7 +43,7 @@ public:
KisPNGExport(QObject *parent, const QVariantList &);
virtual ~KisPNGExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -42,7 +42,7 @@ KisPNGImport::~KisPNGImport()
{
}
KisImportExportFilter::ConversionStatus KisPNGImport::convert(const QByteArray&, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisPNGImport::convert(const QByteArray&, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "Importing using PNGImport!";
......
......@@ -30,7 +30,7 @@ public:
KisPNGImport(QObject *parent, const QVariantList &);
virtual ~KisPNGImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -136,7 +136,7 @@ private:
quint8 m_current;
};
KisImportExportFilter::ConversionStatus KisPPMExport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisPPMExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "PPM export! From:" << from << ", To:" << to << "";
......
......@@ -30,7 +30,7 @@ public:
KisPPMExport(QObject *parent, const QVariantList &);
virtual ~KisPPMExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -53,7 +53,7 @@ KisPPMImport::~KisPPMImport()
{
}
KisImportExportFilter::ConversionStatus KisPPMImport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisPPMImport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
Q_UNUSED(from);
dbgFile << "Importing using PPMImport!";
......
......@@ -34,7 +34,7 @@ public:
KisPPMImport(QObject *parent, const QVariantList &);
virtual ~KisPPMImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
private:
KisImportExportFilter::ConversionStatus loadFromDevice(QIODevice* device, KisDocument* doc);
};
......
......@@ -72,7 +72,7 @@ psdExport::~psdExport()
{
}
KisImportExportFilter::ConversionStatus psdExport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus psdExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile <<"PSD export! From:" << from <<", To:" << to <<"";
......
......@@ -28,7 +28,7 @@ class psdExport : public KisImportExportFilter {
psdExport(QObject *parent, const QVariantList &);
virtual ~psdExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -37,7 +37,7 @@ psdImport::~psdImport()
{
}
KisImportExportFilter::ConversionStatus psdImport::convert(const QByteArray&, const QByteArray& to)
KisImportExportFilter::ConversionStatus psdImport::convert(const QByteArray&, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile <<"Importing using PSDImport!";
......
......@@ -28,7 +28,7 @@ class psdImport : public KisImportExportFilter {
psdImport(QObject *parent, const QVariantList &);
virtual ~psdImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -41,7 +41,7 @@ QMLExport::~QMLExport()
{
}
KisImportExportFilter::ConversionStatus QMLExport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus QMLExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
Q_UNUSED(to);
......
......@@ -29,7 +29,7 @@ public:
QMLExport(QObject *parent, const QVariantList &);
virtual ~QMLExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
};
#endif
......@@ -68,7 +68,7 @@ inline quint16 correctIndian(quint16 v)
#endif
}
KisImportExportFilter::ConversionStatus KisRawImport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisRawImport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << from << " " << to << "";
if (/*from != "image/x-raw" || */to != "application/x-krita") { // too many from to check, and I don't think it can happen an unsupported from
......
......@@ -41,7 +41,7 @@ public:
virtual ~KisRawImport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
private Q_SLOTS:
......
......@@ -463,7 +463,7 @@ Bone *findBoneByName(Bone *startBone, const QString &name)
return 0;
}
KisImportExportFilter::ConversionStatus KisSpriterExport::convert(const QByteArray& from, const QByteArray& to)
KisImportExportFilter::ConversionStatus KisSpriterExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration)
{
dbgFile << "Spriter export! From:" << from << ", To:" << to << "" << outputFile();
......
......@@ -110,7 +110,7 @@ public:
KisSpriterExport(QObject *parent, const QVariantList &);
virtual ~KisSpriterExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to);
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from,