Commit 11822fe6 authored by Halla Rempt's avatar Halla Rempt

Add capabilities for CSV

This is multilayer, no groups, sRGB png.
parent c8ad9511
......@@ -35,7 +35,7 @@ public:
float density;
int visible;
KisPaintLayer* layer;
KisLayer* layer;
KisRasterKeyframeChannel *channel;
QString last;
QString path;
......
......@@ -116,8 +116,8 @@ KisImageBuilder_Result CSVSaver::encode(QIODevice *io)
idx = 0;
while (node) {
if (node->inherits("KisPaintLayer")) {
KisPaintLayer* paintLayer = dynamic_cast<KisPaintLayer*>(node.data());
if (node->inherits("KisLayer")) {
KisLayer* paintLayer = dynamic_cast<KisLayer*>(node.data());
CSVLayerRecord* layerRecord = new CSVLayerRecord();
layers.prepend(layerRecord); //reverse order!
......@@ -406,7 +406,6 @@ KisImageBuilder_Result CSVSaver::getLayer(CSVLayerRecord* layer, KisDocument* ex
filename.append(layer->last);
//save to PNG
KisSequentialConstIterator it(device, image->bounds());
const KoColorSpace* cs = device->colorSpace();
......
......@@ -27,6 +27,7 @@
#include <QFileInfo>
#include <QApplication>
#include <KisExportCheckRegistry.h>
#include <KisImportExportManager.h>
#include <KoColorSpaceConstants.h>
......@@ -40,21 +41,6 @@
K_PLUGIN_FACTORY_WITH_JSON(KisCSVExportFactory, "krita_csv_export.json", registerPlugin<KisCSVExport>();)
bool checkHomogenity(KisNodeSP root)
{
bool res = true;
KisNodeSP child = root->firstChild();
while (child) {
if (child->childCount() > 0) {
res = false;
break;
}
child = child->nextSibling();
}
return res;
}
KisCSVExport::KisCSVExport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent)
{
}
......@@ -65,17 +51,6 @@ KisCSVExport::~KisCSVExport()
KisImportExportFilter::ConversionStatus KisCSVExport::convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP /*configuration*/)
{
if (!checkHomogenity(document->image()->rootLayer())) {
if (!batchMode()) {
QMessageBox::critical(0,
i18nc("@title:window", "CSV Export Error"),
i18n("Unable to save to the CSV format.\n"
"The CSV format not supports layer groups or masked layers."));
}
return KisImportExportFilter::InvalidFormat;
}
CSVSaver kpc(document, batchMode());
KisImageBuilder_Result res;
......@@ -91,4 +66,12 @@ KisImportExportFilter::ConversionStatus KisCSVExport::convert(KisDocument *docum
return KisImportExportFilter::InternalError;
}
void KisCSVExport::initializeCapabilities()
{
addCapability(KisExportCheckRegistry::instance()->get("MultiLayerCheck")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelPerLayerCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("sRGBProfileCheck")->create(KisExportCheckBase::SUPPORTED));
}
#include "kis_csv_export.moc"
......@@ -32,6 +32,7 @@ public:
virtual ~KisCSVExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
void initializeCapabilities();
};
#endif
......@@ -63,7 +63,7 @@ KisPropertiesConfigurationSP EXRExport::defaultConfiguration(const QByteArray &/
KisPropertiesConfigurationSP EXRExport::lastSavedConfiguration(const QByteArray &from, const QByteArray &to) const
{
KisPropertiesConfigurationSP cfg = defaultConfiguration(from, to);
QString filterConfig = KisConfig().exportConfiguration("EXR");
QString filterConfig = KisConfig().exportConfiguration(mimeType());
cfg->fromXML(filterConfig, false);
return cfg;
}
......@@ -129,7 +129,7 @@ KisImportExportFilter::ConversionStatus EXRExport::convert(KisDocument *document
}
EXRExport::initializeCapabilities()
void EXRExport::initializeCapabilities()
{
}
......
......@@ -27,11 +27,13 @@
#include <KoColorSpace.h>
#include <KoColorSpaceConstants.h>
#include <KisImportExportManager.h>
#include <KoColorSpaceTraits.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorModelStandardIds.h>
#include <KisImportExportManager.h>
#include <KisExportCheckRegistry.h>
#include <kis_debug.h>
#include <KisDocument.h>
#include <kis_image.h>
......@@ -72,6 +74,11 @@ KisConfigWidget *KisHeightMapExport::createConfigurationWidget(QWidget *parent,
return new KisWdgOptionsHeightmap(parent);
}
void KisHeightMapExport::initializeCapabilities()
{
}
KisImportExportFilter::ConversionStatus KisHeightMapExport::convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration)
{
KisImageWSP image = document->image();
......
......@@ -50,7 +50,8 @@ public:
KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const;
KisPropertiesConfigurationSP lastSavedConfiguration(const QByteArray &from = "", const QByteArray &to = "") const;
KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
public:
void initializeCapabilities();
virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
};
......
......@@ -28,6 +28,7 @@
#include <KisImportExportManager.h>
#include <KoColorModelStandardIds.h>
#include <KoColorSpace.h>
#include <KisExportCheckRegistry.h>
#include <KisDocument.h>
#include <kis_image.h>
......@@ -108,5 +109,11 @@ KisImportExportFilter::ConversionStatus OraExport::convert(KisDocument *document
return KisImportExportFilter::InternalError;
}
void OraExport::initializeCapabilities()
{
}
#include <ora_export.moc>
......@@ -30,6 +30,7 @@ public:
virtual ~OraExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
void initializeCapabilities();
};
#endif
......@@ -22,7 +22,9 @@
#include <KoColorSpace.h>
#include <KoColorSpaceConstants.h>
#include <KisImportExportManager.h>
#include <KisExportCheckRegistry.h>
#include <kis_debug.h>
#include <KisDocument.h>
......@@ -268,5 +270,12 @@ KisPropertiesConfigurationSP KisWdgOptionsPPM::configuration() const
return cfg;
}
void KisPPMExport::initializeCapabilities()
{
}
#include "kis_ppm_export.moc"
......@@ -53,6 +53,7 @@ public:
KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const;
KisPropertiesConfigurationSP lastSavedConfiguration(const QByteArray &from = "", const QByteArray &to = "") const;
KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
void initializeCapabilities();
};
#endif
......@@ -27,6 +27,7 @@
#include <KisExportCheckRegistry.h>
#include <KisImportExportManager.h>
#include <KoColorSpaceConstants.h>
#include <KisDocument.h>
......
......@@ -24,6 +24,7 @@
#include <QFileInfo>
#include <QApplication>
#include <KisExportCheckRegistry.h>
#include <KisDocument.h>
#include <kis_image.h>
......@@ -54,5 +55,11 @@ KisImportExportFilter::ConversionStatus QMLExport::convert(KisDocument *document
return KisImportExportFilter::InternalError;
}
void QMLExport::initializeCapabilities()
{
}
#include <qml_export.moc>
......@@ -30,6 +30,7 @@ public:
virtual ~QMLExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
void initializeCapabilities();
};
#endif
......@@ -35,10 +35,12 @@
#include <KoColorSpaceConstants.h>
#include <KoColorSpaceRegistry.h>
#include <KisExportCheckRegistry.h>
#include <KisImportExportManager.h>
#include <KisDocument.h>
#include <kis_group_layer.h>
#include <kis_image.h>
#include <KisImportExportManager.h>
#include <kis_layer.h>
#include <kis_node.h>
#include <kis_painter.h>
......@@ -594,4 +596,10 @@ KisImportExportFilter::ConversionStatus KisSpriterExport::convert(KisDocument *d
return KisImportExportFilter::OK;
}
void KisSpriterExport::initializeCapabilities()
{
}
#include "kis_spriter_export.moc"
......@@ -111,6 +111,7 @@ public:
virtual ~KisSpriterExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
void initializeCapabilities();
private:
bool savePaintDevice(KisPaintDeviceSP dev, const QString &fileName);
......
......@@ -26,6 +26,7 @@
#include <QFileInfo>
#include <QApplication>
#include <KisImportExportManager.h>
#include <kis_paint_device.h>
#include <KisDocument.h>
#include <kis_image.h>
......@@ -76,5 +77,11 @@ KisImportExportFilter::ConversionStatus KisTGAExport::convert(KisDocument *docum
return KisImportExportFilter::OK;
}
void KisTGAExport::initializeCapabilities()
{
}
#include "kis_tga_export.moc"
......@@ -32,6 +32,7 @@ public:
virtual ~KisTGAExport();
public:
virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
void initializeCapabilities();
};
#endif
......@@ -36,6 +36,7 @@ public:
KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from, const QByteArray& to) const;
KisPropertiesConfigurationSP lastSavedConfiguration(const QByteArray &from, const QByteArray &to) const;
KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
};
#endif
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