Krita Source Code Documentation
Loading...
Searching...
No Matches
KisWdgOptionsPNG Class Reference

#include <kis_png_export.h>

+ Inheritance diagram for KisWdgOptionsPNG:

Public Member Functions

KisPropertiesConfigurationSP configuration () const override
 
 KisWdgOptionsPNG (QWidget *parent)
 
void setConfiguration (const KisPropertiesConfigurationSP config) override
 
- Public Member Functions inherited from KisConfigWidget
virtual KoCanvasResourcesInterfaceSP canvasResourcesInterface () const
 
virtual void setCanvasResourcesInterface (KoCanvasResourcesInterfaceSP canvasResourcesInterface)
 
virtual void setView (KisViewManager *view)
 
 ~KisConfigWidget () override
 

Private Slots

void on_alpha_toggled (bool checked)
 
void slotUseHDRChanged (bool value)
 

Additional Inherited Members

- Signals inherited from KisConfigWidget
void sigConfigurationItemChanged ()
 
void sigConfigurationUpdated ()
 
void sigDropLockedConfig (KisPropertiesConfigurationSP p)
 
void sigSaveLockedConfig (KisPropertiesConfigurationSP p)
 
- Protected Member Functions inherited from KisConfigWidget
 KisConfigWidget (QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags(), int delay=200)
 

Detailed Description

Definition at line 15 of file kis_png_export.h.

Constructor & Destructor Documentation

◆ KisWdgOptionsPNG()

KisWdgOptionsPNG::KisWdgOptionsPNG ( QWidget * parent)

Definition at line 130 of file kis_png_export.cc.

131 : KisConfigWidget(parent)
132{
133 setupUi(this);
134
135 connect(chkSaveAsHDR, SIGNAL(toggled(bool)), this, SLOT(slotUseHDRChanged(bool)));
136}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisConfigWidget(QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags(), int delay=200)
void slotUseHDRChanged(bool value)

References connect(), and slotUseHDRChanged().

Member Function Documentation

◆ configuration()

KisPropertiesConfigurationSP KisWdgOptionsPNG::configuration ( ) const
overridevirtual
Returns
the configuration

Implements KisConfigWidget.

Definition at line 191 of file kis_png_export.cc.

192{
193
195
196 bool alpha = this->alpha->isChecked();
197 bool interlace = interlacing->isChecked();
198 int compression = (int)compressionLevel->value();
199 bool saveAsHDR = chkSaveAsHDR->isChecked();
200 bool tryToSaveAsIndexed = !saveAsHDR && this->tryToSaveAsIndexed->isChecked();
201 bool saveSRGB = !saveAsHDR && chkSRGB->isChecked();
202 bool forceSRGB = !saveAsHDR && chkForceSRGB->isChecked();
203 bool storeAuthor = chkAuthor->isChecked();
204 bool storeMetaData = chkMetaData->isChecked();
205 bool downsample = chkDownsample->isChecked();
206
207
208 QVariant transparencyFillcolor;
209 transparencyFillcolor.setValue(bnTransparencyFillColor->color());
210
211 cfg->setProperty("alpha", alpha);
212 cfg->setProperty("indexed", tryToSaveAsIndexed);
213 cfg->setProperty("compression", compression);
214 cfg->setProperty("interlaced", interlace);
215 cfg->setProperty("transparencyFillcolor", transparencyFillcolor);
216 cfg->setProperty("saveAsHDR", saveAsHDR);
217 cfg->setProperty("saveSRGBProfile", saveSRGB);
218 cfg->setProperty("forceSRGB", forceSRGB);
219 cfg->setProperty("storeAuthor", storeAuthor);
220 cfg->setProperty("storeMetaData", storeMetaData);
221 cfg->setProperty("downsample", downsample);
222 return cfg;
223}

◆ on_alpha_toggled

void KisWdgOptionsPNG::on_alpha_toggled ( bool checked)
privateslot

Definition at line 225 of file kis_png_export.cc.

226{
227 bnTransparencyFillColor->setEnabled(!checked);
228}

◆ setConfiguration()

void KisWdgOptionsPNG::setConfiguration ( const KisPropertiesConfigurationSP config)
overridevirtual
Parameters
configthe configuration for this configuration widget.

Implements KisConfigWidget.

Definition at line 138 of file kis_png_export.cc.

139{
140 // the export manager should have prepared some info for us!
144
145 const bool isThereAlpha = cfg->getBool(KisImportExportFilter::ImageContainsTransparencyTag);
146
147 alpha->setChecked(cfg->getBool("alpha", isThereAlpha));
148
149 bnTransparencyFillColor->setEnabled(!alpha->isChecked());
150
152 tryToSaveAsIndexed->setVisible(true);
153 if (alpha->isChecked()) {
154 tryToSaveAsIndexed->setChecked(false);
155 }
156 else {
157 tryToSaveAsIndexed->setChecked(cfg->getBool("indexed", false));
158 }
159 }
160 else {
161 tryToSaveAsIndexed->setVisible(false);
162 }
163 interlacing->setChecked(cfg->getBool("interlaced", false));
164 compressionLevel->setValue(cfg->getInt("compression", 3));
165 compressionLevel->setRange(1, 9, 0);
166
167 tryToSaveAsIndexed->setVisible(!isThereAlpha);
168
169 //const bool sRGB = cfg->getBool(KisImportExportFilter::sRGBTag, false);
170
171 //chkSRGB->setEnabled(sRGB);
172 chkSRGB->setChecked(cfg->getBool("saveSRGBProfile", true));
173
174 //chkForceSRGB->setEnabled(!sRGB);
175 chkForceSRGB->setChecked(cfg->getBool("forceSRGB", false));
176
177 chkSaveAsHDR->setChecked(cfg->getBool("saveAsHDR", false));
178 slotUseHDRChanged(chkSaveAsHDR->isChecked());
179
180 chkAuthor->setChecked(cfg->getBool("storeAuthor", false));
181 chkMetaData->setChecked(cfg->getBool("storeMetaData", false));
182
183 KoColor background(KoColorSpaceRegistry::instance()->rgb8());
184 background.fromQColor(Qt::white);
185 bnTransparencyFillColor->setDefaultColor(background);
186 bnTransparencyFillColor->setColor(cfg->getColor("transparencyFillcolor", background));
187
188 chkDownsample->setChecked(cfg->getBool("downsample", false));
189}
const KoID RGBAColorModelID("RGBA", ki18n("RGB/Alpha"))
static const QString ColorModelIDTag
static const QString ImageContainsTransparencyTag
static const QString sRGBTag
QString id() const
Definition KoID.cpp:63
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130
static KoColorSpaceRegistry * instance()

References KisImportExportFilter::ColorModelIDTag, KoColor::fromQColor(), KoID::id(), KisImportExportFilter::ImageContainsTransparencyTag, KoColorSpaceRegistry::instance(), KIS_SAFE_ASSERT_RECOVER_NOOP, RGBAColorModelID, slotUseHDRChanged(), and KisImportExportFilter::sRGBTag.

◆ slotUseHDRChanged

void KisWdgOptionsPNG::slotUseHDRChanged ( bool value)
privateslot

Definition at line 230 of file kis_png_export.cc.

231{
232 tryToSaveAsIndexed->setDisabled(value);
233 chkForceSRGB->setDisabled(value);
234 chkSRGB->setDisabled(value);
235}
float value(const T *src, size_t ch)

References value().


The documentation for this class was generated from the following files: