Commit 0e0dbf15 authored by Boudewijn Rempt's avatar Boudewijn Rempt

jpeg export: save settings between sessions

Also hide the preview checkbox, since the preview isn't implemented yet.
parent c297b06b
......@@ -35,7 +35,8 @@
#include <kis_group_layer.h>
#include <kis_paint_layer.h>
#include <kis_paint_device.h>
#include <kis_properties_configuration.h>
#include <kis_config.h>
#include <kis_meta_data_store.h>
#include <kis_meta_data_filter_registry_model.h>
#include <kis_exif_info_visitor.h>
......@@ -71,12 +72,30 @@ KoFilter::ConversionStatus KisJPEGExport::convert(const QByteArray& from, const
kdb->setButtons(KDialog::Ok | KDialog::Cancel);
Ui::WdgOptionsJPEG wdgUi;
// = new Ui::WdgOptionsJPEG(kdb);
QWidget* wdg = new QWidget(kdb);
wdgUi.setupUi(wdg);
KisMetaData::FilterRegistryModel frm;
wdgUi.metaDataFilters->setModel(&frm);
// until we've got an actual quality preview here!
wdgUi.chkPreview->setVisible(false);
QString filterConfig = KisConfig().exportConfiguration("JPEG");
KisPropertiesConfiguration cfg;
cfg.fromXML(filterConfig);
wdgUi.progressive->setChecked(cfg.getBool("progressive", false));
wdgUi.qualityLevel->setValue(cfg.getInt("quality", 80));
wdgUi.optimize->setChecked(cfg.getBool("optimize", true));
wdgUi.smoothLevel->setValue(cfg.getInt("smoothing", 0));
wdgUi.baseLineJPEG->setChecked(cfg.getBool("baseline", true));
wdgUi.subsampling->setCurrentIndex(cfg.getInt("subsampling", 0));
wdgUi.exif->setChecked(cfg.getBool("exif", true));
wdgUi.iptc->setChecked(cfg.getBool("iptc", true));
wdgUi.xmp->setChecked(cfg.getBool("xmp", true));
frm.setEnabledFilters(cfg.getString("filters").split(","));
kdb->setMainWidget(wdg);
kapp->restoreOverrideCursor();
......@@ -88,17 +107,43 @@ KoFilter::ConversionStatus KisJPEGExport::convert(const QByteArray& from, const
KisJPEGOptions options;
options.progressive = wdgUi.progressive->isChecked();
cfg.setProperty("progressive", options.progressive);
options.quality = wdgUi.qualityLevel->value();
cfg.setProperty("quality", options.quality);
// Advanced
options.optimize = wdgUi.optimize->isChecked();
cfg.setProperty("optimize", options.optimize);
options.smooth = wdgUi.smoothLevel->value();
cfg.setProperty("smoothing", options.smooth);
options.baseLineJPEG = wdgUi.baseLineJPEG->isChecked();
cfg.setProperty("baseline", options.baseLineJPEG);
options.subsampling = wdgUi.subsampling->currentIndex();
cfg.setProperty("subsampling", options.subsampling);
// Jpeg
options.exif = wdgUi.exif->isChecked();
cfg.setProperty("exif", options.exif);
options.iptc = wdgUi.iptc->isChecked();
cfg.setProperty("iptc", options.iptc);
options.xmp = wdgUi.xmp->isChecked();
cfg.setProperty("xmp", options.xmp);
options.filters = frm.enabledFilters();
QString enabledFilters;
foreach(const KisMetaData::Filter* filter, options.filters) {
enabledFilters = enabledFilters + filter->id() + ",";
}
cfg.setProperty("filters", enabledFilters);
KisConfig().setExportConfiguration("JPEG", cfg);
delete kdb;
// XXX: Add dialog about flattening layers here
......
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