26 scrollAreaWidgetContents->setAutoFillBackground(
false);
27 scrollAreaWidgetContents->parentWidget()->setAutoFillBackground(
false);
30#if WEBP_ENCODER_ABI_VERSION < 0x020f
31 qMin->setEnabled(
false);
32 qMax->setEnabled(
false);
35 preset->addItem(i18nc(
"WebP presets",
"Default"), WEBP_PRESET_DEFAULT);
36 preset->addItem(i18nc(
"WebP presets",
"Portrait"), WEBP_PRESET_PICTURE);
37 preset->addItem(i18nc(
"WebP presets",
"Outdoor photo"), WEBP_PRESET_PHOTO);
38 preset->addItem(i18nc(
"WebP presets",
"Line drawing"), WEBP_PRESET_DRAWING);
39 preset->addItem(i18nc(
"WebP presets",
"Icon"), WEBP_PRESET_ICON);
40 preset->addItem(i18nc(
"WebP presets",
"Text"), WEBP_PRESET_TEXT);
42 filterType->addItem(i18nc(
"WebP filters",
"Simple"), 0);
43 filterType->addItem(i18nc(
"WebP filters",
"Strong"), 1);
45 alphaCompression->addItem(i18nc(
"WebP alpha plane compression",
"None"), 0);
46 alphaCompression->addItem(i18nc(
"WebP alpha plane compression",
"Lossless"),
49 preprocessing->addItem(i18nc(
"WebP preprocessing filters",
"None"), 0);
50 preprocessing->addItem(
51 i18nc(
"WebP preprocessing filters",
"Segment-smooth"),
53 preprocessing->addItem(
54 i18nc(
"WebP preprocessing filters",
"Pseudo-random dithering"),
57 targetPSNR->setDisplayUnit(
false);
58 targetPSNR->setSuffix(
" dB");
63 SIGNAL(currentIndexChanged(
int)),
71 haveAnimation->setChecked(cfg->getBool(
"haveAnimation",
true));
73 preset->setCurrentIndex(cfg->getInt(
"preset", 0));
74 lossless->setChecked(cfg->getBool(
"lossless",
true));
75 quality->setValue(cfg->getDouble(
"quality", 75.0));
77 tradeoff->setValue(cfg->getInt(
"method", 4));
78 dithering->setChecked(cfg->getBool(
"dithering",
true));
79 chkForceSRGB->setChecked(cfg->getBool(
"force_srgb",
false));
80 chkSaveProfile->setChecked(cfg->getBool(
"save_profile",
true));
82 targetSize->setValue(cfg->getInt(
"target_size", 0));
83 targetPSNR->setValue(cfg->getDouble(
"target_PSNR", 0.0));
84 segments->setValue(cfg->getInt(
"segments", 4));
85 snsStrength->setValue(cfg->getInt(
"sns_strength", 50));
87 filterStrength->setValue(cfg->getInt(
"filter_strength", 60));
89 filterSharpness->setValue(cfg->getInt(
"filter_sharpness", 0));
90 filterType->setCurrentIndex(cfg->getInt(
"filter_type", 1));
91 autofilter->setChecked(cfg->getBool(
"autofilter",
false));
92 alphaCompression->setCurrentIndex(cfg->getInt(
"alpha_compression", 1));
93 alphaFiltering->setValue(cfg->getInt(
"alpha_filtering", 1));
94 alphaQuality->setValue(cfg->getInt(
"alpha_quality", 100));
96 pass->setValue(cfg->getInt(
"pass", 1));
97 showCompressed->setChecked(cfg->getBool(
"show_compressed",
false));
98 preprocessing->setCurrentIndex(cfg->getInt(
"preprocessing", 0));
99 partitions->setValue(cfg->getInt(
"partitions", 0));
100 partitionLimit->setValue(cfg->getInt(
"partition_limit", 0));
102 emulateJPEGSize->setChecked(cfg->getBool(
"emulate_jpeg_size",
false));
103 threadLevel->setChecked(cfg->getBool(
"thread_level",
false));
104 lowMemory->setChecked(cfg->getBool(
"low_memory",
false));
105 nearLossless->setValue(cfg->getInt(
"near_lossless", 100));
107 exact->setChecked(cfg->getBool(
"exact",
false));
108 useSharpYUV->setChecked(cfg->getBool(
"use_sharp_yuv",
false));
109#if WEBP_ENCODER_ABI_VERSION >= 0x020f
110 qMin->setValue(cfg->getInt(
"qmin", 0));
112 qMax->setValue(cfg->getInt(
"qmax", 100));
116 exif->setChecked(cfg->getBool(
"exif",
true));
117 xmp->setChecked(cfg->getBool(
"xmp",
true));
118 chkMetadata->setChecked(cfg->getBool(
"storeMetaData",
true));
120 cfg->getString(
"filters").split(
','));
127 if (!WebPConfigPreset(
129 static_cast<WebPPreset
>(this->preset->currentData().value<
int>()),
130 static_cast<float>(this->quality->value()))) {
134 if (this->lossless->isChecked()
135 && !WebPConfigLosslessPreset(&preset, this->tradeoff->value())) {
139 quality->setValue(
static_cast<double>(preset.quality));
140 tradeoff->setValue(preset.method);
142 targetSize->setValue(preset.target_size);
143 targetPSNR->setValue(
static_cast<double>(preset.target_PSNR));
144 segments->setValue(preset.segments);
145 snsStrength->setValue(preset.sns_strength);
146 filterStrength->setValue(preset.filter_strength);
147 filterSharpness->setValue(preset.filter_sharpness);
148 filterType->setCurrentIndex(preset.filter_type);
149 autofilter->setChecked(preset.autofilter == 1);
150 alphaCompression->setCurrentIndex(
151 alphaCompression->findData(preset.alpha_compression));
152 alphaFiltering->setValue(preset.alpha_filtering);
153 alphaQuality->setValue(preset.alpha_quality);
154 pass->setValue(preset.pass);
155 showCompressed->setChecked(preset.show_compressed == 1);
156 preprocessing->setCurrentIndex(
157 preprocessing->findData(preset.preprocessing));
158 partitions->setValue(preset.partitions);
159 partitionLimit->setValue(preset.partition_limit);
160 emulateJPEGSize->setChecked(preset.emulate_jpeg_size == 1);
161 threadLevel->setChecked(preset.thread_level > 0);
162 lowMemory->setChecked(preset.low_memory == 1);
163 nearLossless->setValue(preset.near_lossless);
164 exact->setChecked(preset.exact == 1);
165 useSharpYUV->setChecked(preset.use_sharp_yuv);
166#if WEBP_ENCODER_ABI_VERSION >= 0x020f
167 qMin->setValue(preset.qmin);
168 qMax->setValue(preset.qmax);
176 cfg->setProperty(
"haveAnimation", haveAnimation->isChecked());
178 cfg->setProperty(
"preset", preset->currentIndex());
179 cfg->setProperty(
"lossless", lossless->isChecked());
180 cfg->setProperty(
"quality", quality->value());
181 cfg->setProperty(
"method", tradeoff->value());
182 cfg->setProperty(
"dithering", dithering->isChecked());
183 cfg->setProperty(
"force_srgb", chkForceSRGB->isChecked());
184 cfg->setProperty(
"save_profile", chkSaveProfile->isChecked());
186 cfg->setProperty(
"target_size", targetSize->value());
187 cfg->setProperty(
"target_PSNR", targetPSNR->value());
188 cfg->setProperty(
"segments", segments->value());
189 cfg->setProperty(
"sns_strength", snsStrength->value());
190 cfg->setProperty(
"filter_strength", filterStrength->value());
191 cfg->setProperty(
"filter_sharpness", filterSharpness->value());
192 cfg->setProperty(
"filter_type", filterType->currentData().value<
int>());
193 cfg->setProperty(
"autofilter", autofilter->isChecked());
194 cfg->setProperty(
"alpha_compression",
195 alphaCompression->currentData().value<
int>());
196 cfg->setProperty(
"alpha_filtering", alphaFiltering->value());
197 cfg->setProperty(
"alpha_quality", alphaQuality->value());
198 cfg->setProperty(
"pass", pass->value());
199 cfg->setProperty(
"show_compressed", showCompressed->isChecked());
200 cfg->setProperty(
"preprocessing",
201 preprocessing->currentData().value<
int>());
202 cfg->setProperty(
"partitions", partitions->value());
203 cfg->setProperty(
"partition_limit", partitionLimit->value());
204 cfg->setProperty(
"emulate_jpeg_size", emulateJPEGSize->isChecked());
205 cfg->setProperty(
"thread_level", threadLevel->isChecked());
206 cfg->setProperty(
"low_memory", lowMemory->isChecked());
207 cfg->setProperty(
"near_lossless", nearLossless->value());
208 cfg->setProperty(
"exact", exact->isChecked());
209 cfg->setProperty(
"use_sharp_yuv", useSharpYUV->isChecked());
210#if WEBP_ENCODER_ABI_VERSION >= 0x020f
211 cfg->setProperty(
"qmin", qMin->value());
212 cfg->setProperty(
"qmax", qMax->value());
215 cfg->setProperty(
"exif", exif->isChecked());
216 cfg->setProperty(
"xmp", xmp->isChecked());
217 cfg->setProperty(
"storeMetaData", chkMetadata->isChecked());
219 QString enabledFilters;
222 enabledFilters += filter->id() +
',';
224 cfg->setProperty(
"filters", enabledFilters);