Commit dd73f96f authored by Boudewijn Rempt's avatar Boudewijn Rempt

Save the PNG settings between sessions.

parent 18ba5b8b
......@@ -35,9 +35,9 @@
#include <kis_image.h>
#include <kis_paint_layer.h>
#include <kis_group_layer.h>
#include <kis_config.h>
#include <kis_iterators_pixel.h>
#include <kis_properties_configuration.h>
#include <kis_meta_data_store.h>
#include <kis_meta_data_filter_registry_model.h>
#include <kis_exif_info_visitor.h>
......@@ -82,12 +82,12 @@ KoFilter::ConversionStatus KisPNGExport::convert(const QByteArray& from, const Q
if (from != "application/x-krita")
return KoFilter::NotImplemented;
KDialog* kdb = new KDialog(0);
kdb->setCaption(i18n("PNG Export Options"));
kdb->setModal(false);
KisImageWSP image = output->image();
qDebug() << ">>>>>>>>>>>" << image->locked();
image->refreshGraph();
image->lock();
KisPaintDeviceSP pd;
......@@ -108,12 +108,24 @@ KoFilter::ConversionStatus KisPNGExport::convert(const QByteArray& from, const Q
}
KisWdgOptionsPNG* wdg = new KisWdgOptionsPNG(kdb);
wdg->alpha->setChecked(isThereAlpha);
wdg->alpha->setVisible(isThereAlpha);
wdg->tryToSaveAsIndexed->setVisible(!isThereAlpha);
if (isThereAlpha) {
QString filterConfig = KisConfig().exportConfiguration("PNG");
KisPropertiesConfiguration cfg;
cfg.fromXML(filterConfig);
wdg->alpha->setChecked(cfg.getBool("alpha", isThereAlpha));
if (wdg->alpha->isChecked()) {
wdg->tryToSaveAsIndexed->setChecked(false);
}
else {
wdg->tryToSaveAsIndexed->setChecked(cfg.getBool("indexed", false));
}
wdg->interlacing->setChecked(cfg.getBool("interlaced", false));
wdg->compressionLevel->setValue(cfg.getInt("compression", 9));
wdg->alpha->setVisible(isThereAlpha);
wdg->tryToSaveAsIndexed->setVisible(!isThereAlpha);
kdb->setMainWidget(wdg);
kapp->restoreOverrideCursor();
if (hasVisibleWidgets()) {
......@@ -129,6 +141,13 @@ KoFilter::ConversionStatus KisPNGExport::convert(const QByteArray& from, const Q
int compression = wdg->compressionLevel->value();
bool tryToSaveAsIndexed = wdg->tryToSaveAsIndexed->isChecked();
cfg.setProperty("alpha", alpha);
cfg.setProperty("indexed", tryToSaveAsIndexed);
cfg.setProperty("compression", compression);
cfg.setProperty("interlaced", interlace);
KisConfig().setExportConfiguration("PNG", cfg);
delete kdb;
KUrl url;
......
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