File indexing completed on 2025-01-05 03:57:12
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * date : 2006-09-13 0007 * Description : Raw Decoder settings widgets 0008 * 0009 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2006-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0011 * SPDX-FileCopyrightText: 2007-2008 by Guillaume Castagnino <casta at xwing dot info> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #define OPTIONFIXCOLORSHIGHLIGHTSENTRY "FixColorsHighlights" 0018 #define OPTIONDECODESIXTEENBITENTRY "SixteenBitsImage" 0019 #define OPTIONWHITEBALANCEENTRY "White Balance" 0020 #define OPTIONCUSTOMWHITEBALANCEENTRY "Custom White Balance" 0021 #define OPTIONCUSTOMWBGREENENTRY "Custom White Balance Green" 0022 #define OPTIONFOURCOLORRGBENTRY "Four Color RGB" 0023 #define OPTIONUNCLIPCOLORSENTRY "Unclip Color" 0024 #define OPTIONDONTSTRETCHPIXELSSENTRY "Dont Stretch Pixels" // krazy:exclude=spelling 0025 #define OPTIONMEDIANFILTERPASSESENTRY "Median Filter Passes" // krazy:exclude=spelling 0026 #define OPTIONNOISEREDUCTIONTYPEENTRY "Noise Reduction Type" 0027 #define OPTIONNOISEREDUCTIONTHRESHOLDENTRY "Noise Reduction Threshold" 0028 #define OPTIONAUTOBRIGHTNESSENTRY "AutoBrightness" 0029 #define OPTIONDECODINGQUALITYENTRY "Decoding Quality" 0030 #define OPTIONINPUTCOLORSPACEENTRY "Input Color Space" 0031 #define OPTIONOUTPUTCOLORSPACEENTRY "Output Color Space" 0032 #define OPTIONINPUTCOLORPROFILEENTRY "Input Color Profile" 0033 #define OPTIONOUTPUTCOLORPROFILEENTRY "Output Color Profile" 0034 #define OPTIONBRIGHTNESSMULTIPLIERENTRY "Brightness Multiplier" 0035 #define OPTIONUSEBLACKPOINTENTRY "Use Black Point" 0036 #define OPTIONBLACKPOINTENTRY "Black Point" 0037 #define OPTIONUSEWHITEPOINTENTRY "Use White Point" 0038 #define OPTIONWHITEPOINTENTRY "White Point" 0039 0040 //-- Extended demosaicing settings ---------------------------------------------------------- 0041 0042 #define OPTIONDCBITERATIONSENTRY "Dcb Iterations" 0043 #define OPTIONDCBENHANCEFLENTRY "Dcb Enhance Filter" 0044 #define OPTIONEXPOCORRECTIONENTRY "Expo Correction" 0045 #define OPTIONEXPOCORRECTIONSHIFTENTRY "Expo Correction Shift" 0046 #define OPTIONEXPOCORRECTIONHIGHLIGHTENTRY "Expo Correction Highlight" 0047 0048 #include "drawdecoderwidget.h" 0049 0050 // C++ includes 0051 0052 #include <cmath> 0053 0054 // Qt includes 0055 0056 #include <QCheckBox> 0057 #include <QLabel> 0058 #include <QWhatsThis> 0059 #include <QGridLayout> 0060 #include <QApplication> 0061 #include <QStyle> 0062 #include <QIcon> 0063 0064 // KDE includes 0065 0066 #include <kconfiggroup.h> 0067 #include <klocalizedstring.h> 0068 0069 // Local includes 0070 0071 #include "drawdecoder.h" 0072 #include "dnuminput.h" 0073 #include "dcombobox.h" 0074 #include "digikam_debug.h" 0075 0076 namespace Digikam 0077 { 0078 0079 class Q_DECL_HIDDEN DRawDecoderWidget::Private 0080 { 0081 public: 0082 0083 explicit Private() 0084 : demosaicingSettings (nullptr), 0085 whiteBalanceSettings (nullptr), 0086 correctionsSettings (nullptr), 0087 colormanSettings (nullptr), 0088 whiteBalanceLabel (nullptr), 0089 customWhiteBalanceLabel (nullptr), 0090 customWhiteBalanceGreenLabel (nullptr), 0091 brightnessLabel (nullptr), 0092 RAWQualityLabel (nullptr), 0093 NRLabel1 (nullptr), 0094 unclipColorLabel (nullptr), 0095 reconstructLabel (nullptr), 0096 inputColorSpaceLabel (nullptr), 0097 outputColorSpaceLabel (nullptr), 0098 medianFilterPassesLabel (nullptr), 0099 noiseReductionLabel (nullptr), 0100 expoCorrectionShiftLabel (nullptr), 0101 expoCorrectionHighlightLabel (nullptr), 0102 blackPointCheckBox (nullptr), 0103 whitePointCheckBox (nullptr), 0104 sixteenBitsImage (nullptr), 0105 autoBrightnessBox (nullptr), 0106 fourColorCheckBox (nullptr), 0107 dontStretchPixelsCheckBox (nullptr), 0108 fixColorsHighlightsBox (nullptr), 0109 refineInterpolationBox (nullptr), 0110 expoCorrectionBox (nullptr), 0111 inIccUrlEdit (nullptr), 0112 outIccUrlEdit (nullptr), 0113 noiseReductionComboBox (nullptr), 0114 whiteBalanceComboBox (nullptr), 0115 RAWQualityComboBox (nullptr), 0116 unclipColorComboBox (nullptr), 0117 inputColorSpaceComboBox (nullptr), 0118 outputColorSpaceComboBox (nullptr), 0119 customWhiteBalanceSpinBox (nullptr), 0120 reconstructSpinBox (nullptr), 0121 blackPointSpinBox (nullptr), 0122 whitePointSpinBox (nullptr), 0123 NRSpinBox1 (nullptr), 0124 medianFilterPassesSpinBox (nullptr), 0125 customWhiteBalanceGreenSpinBox (nullptr), 0126 brightnessSpinBox (nullptr), 0127 expoCorrectionShiftSpinBox (nullptr), 0128 expoCorrectionHighlightSpinBox (nullptr) 0129 { 0130 } 0131 0132 /** Convert Exposure correction shift E.V value from GUI to Linear value needs by libraw decoder. 0133 */ 0134 double shiftExpoFromEvToLinear(double ev) const 0135 { 0136 // From GUI : -2.0EV => 0.25 0137 // +3.0EV => 8.00 0138 return (1.55*ev + 3.35); 0139 } 0140 0141 /** Convert Exposure correction shift Linear value from liraw decoder to E.V value needs by GUI. 0142 */ 0143 double shiftExpoFromLinearToEv(double lin) const 0144 { 0145 // From GUI : 0.25 => -2.0EV 0146 // 8.00 => +3.0EV 0147 return ((lin-3.35) / 1.55); 0148 } 0149 0150 public: 0151 0152 QWidget* demosaicingSettings; 0153 QWidget* whiteBalanceSettings; 0154 QWidget* correctionsSettings; 0155 QWidget* colormanSettings; 0156 0157 QLabel* whiteBalanceLabel; 0158 QLabel* customWhiteBalanceLabel; 0159 QLabel* customWhiteBalanceGreenLabel; 0160 QLabel* brightnessLabel; 0161 QLabel* RAWQualityLabel; 0162 QLabel* NRLabel1; 0163 QLabel* unclipColorLabel; 0164 QLabel* reconstructLabel; 0165 QLabel* inputColorSpaceLabel; 0166 QLabel* outputColorSpaceLabel; 0167 QLabel* medianFilterPassesLabel; 0168 QLabel* noiseReductionLabel; 0169 QLabel* expoCorrectionShiftLabel; 0170 QLabel* expoCorrectionHighlightLabel; 0171 0172 QCheckBox* blackPointCheckBox; 0173 QCheckBox* whitePointCheckBox; 0174 QCheckBox* sixteenBitsImage; 0175 QCheckBox* autoBrightnessBox; 0176 QCheckBox* fourColorCheckBox; 0177 QCheckBox* dontStretchPixelsCheckBox; 0178 QCheckBox* fixColorsHighlightsBox; 0179 QCheckBox* refineInterpolationBox; 0180 QCheckBox* expoCorrectionBox; 0181 0182 DFileSelector* inIccUrlEdit; 0183 DFileSelector* outIccUrlEdit; 0184 0185 DComboBox* noiseReductionComboBox; 0186 DComboBox* whiteBalanceComboBox; 0187 DComboBox* RAWQualityComboBox; 0188 DComboBox* unclipColorComboBox; 0189 DComboBox* inputColorSpaceComboBox; 0190 DComboBox* outputColorSpaceComboBox; 0191 0192 DIntNumInput* customWhiteBalanceSpinBox; 0193 DIntNumInput* reconstructSpinBox; 0194 DIntNumInput* blackPointSpinBox; 0195 DIntNumInput* whitePointSpinBox; 0196 DIntNumInput* NRSpinBox1; 0197 DIntNumInput* medianFilterPassesSpinBox; 0198 0199 DDoubleNumInput* customWhiteBalanceGreenSpinBox; 0200 DDoubleNumInput* brightnessSpinBox; 0201 DDoubleNumInput* expoCorrectionShiftSpinBox; 0202 DDoubleNumInput* expoCorrectionHighlightSpinBox; 0203 }; 0204 0205 DRawDecoderWidget::DRawDecoderWidget(QWidget* const parent, int advSettings) 0206 : DExpanderBox(parent), 0207 d (new Private) 0208 { 0209 setup(advSettings); 0210 } 0211 0212 void DRawDecoderWidget::setup(int advSettings) 0213 { 0214 setObjectName( QLatin1String("DCRawSettings Expander" )); 0215 0216 // --------------------------------------------------------------- 0217 // DEMOSAICING Settings panel 0218 0219 d->demosaicingSettings = new QWidget(this); 0220 QGridLayout* const demosaicingLayout = new QGridLayout(d->demosaicingSettings); 0221 int line = 0; 0222 0223 d->sixteenBitsImage = new QCheckBox(i18nc("@option:check", "16 bits color depth"), d->demosaicingSettings); 0224 d->sixteenBitsImage->setWhatsThis(xi18nc("@info:whatsthis", "<para>If enabled, all RAW files will " 0225 "be decoded in 16-bit color depth using a linear gamma curve. To " 0226 "prevent dark picture rendering in the editor, it is recommended to " 0227 "use Color Management in this mode.</para>" 0228 "<para>If disabled, all RAW files will be decoded in 8-bit color " 0229 "depth with a BT.709 gamma curve and a 99th-percentile white point. " 0230 "This mode is faster than 16-bit decoding.</para>")); 0231 demosaicingLayout->addWidget(d->sixteenBitsImage, 0, 0, 1, 2); 0232 0233 if (advSettings & SIXTEENBITS) 0234 { 0235 d->sixteenBitsImage->show(); 0236 line = 1; 0237 } 0238 else 0239 { 0240 d->sixteenBitsImage->hide(); 0241 } 0242 0243 d->fourColorCheckBox = new QCheckBox(i18nc("@option:check", "Interpolate RGB as four colors"), d->demosaicingSettings); 0244 d->fourColorCheckBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Interpolate RGB as four " 0245 "colors</title>" 0246 "<para>The default is to assume that all green pixels are the same. " 0247 "If even-row green pixels are more sensitive to ultraviolet light " 0248 "than odd-row this difference causes a mesh pattern in the output; " 0249 "using this option solves this problem with minimal loss of detail.</para>" 0250 "<para>To resume, this option blurs the image a little, but it " 0251 "eliminates false 2x2 mesh patterns with VNG quality method or " 0252 "mazes with AHD quality method.</para>")); 0253 demosaicingLayout->addWidget(d->fourColorCheckBox, line, 0, 1, line == 0 ? 2 : 3); 0254 line++; 0255 0256 QLabel* const dcrawVersion = new QLabel(d->demosaicingSettings); 0257 dcrawVersion->setAlignment(Qt::AlignRight); 0258 dcrawVersion->setToolTip(i18nc("@info:tooltip", "Visit LibRaw project website")); 0259 dcrawVersion->setOpenExternalLinks(true); 0260 dcrawVersion->setTextFormat(Qt::RichText); 0261 dcrawVersion->setTextInteractionFlags(Qt::LinksAccessibleByMouse); 0262 dcrawVersion->setText(QString::fromLatin1("<a href=\"%1\">%2</a>") 0263 .arg(QLatin1String("https://www.libraw.org")) 0264 .arg(QString::fromLatin1("libraw %1").arg(DRawDecoder::librawVersion()))); 0265 0266 demosaicingLayout->addWidget(dcrawVersion, 0, 2, 1, 1); 0267 0268 d->dontStretchPixelsCheckBox = new QCheckBox(i18nc("@option:check", "Do not stretch or rotate pixels"), d->demosaicingSettings); 0269 d->dontStretchPixelsCheckBox->setWhatsThis(xi18nc("@info:whatsthis", 0270 "<title>Do not stretch or rotate pixels</title>" 0271 "<para>For Fuji Super CCD cameras, show the image tilted 45 degrees. " 0272 "For cameras with non-square pixels, do not stretch the image to " 0273 "its correct aspect ratio. In any case, this option guarantees that " 0274 "each output pixel corresponds to one RAW pixel.</para>")); 0275 demosaicingLayout->addWidget(d->dontStretchPixelsCheckBox, line, 0, 1, 3); 0276 line++; 0277 0278 d->RAWQualityLabel = new QLabel(i18nc("@label:listbox", "Quality:"), d->demosaicingSettings); 0279 d->RAWQualityComboBox = new DComboBox(d->demosaicingSettings); 0280 0281 // Original Raw engine demosaicing methods 0282 d->RAWQualityComboBox->insertItem(0, i18nc("@item:inlistbox Quality", "Bilinear"), QVariant(DRawDecoderSettings::BILINEAR)); 0283 d->RAWQualityComboBox->insertItem(1, i18nc("@item:inlistbox Quality", "VNG"), QVariant(DRawDecoderSettings::VNG)); 0284 d->RAWQualityComboBox->insertItem(2, i18nc("@item:inlistbox Quality", "PPG"), QVariant(DRawDecoderSettings::PPG)); 0285 d->RAWQualityComboBox->insertItem(3, i18nc("@item:inlistbox Quality", "AHD"), QVariant(DRawDecoderSettings::AHD)); 0286 d->RAWQualityComboBox->insertItem(4, i18nc("@item:inlistbox Quality", "DCB"), QVariant(DRawDecoderSettings::DCB)); 0287 d->RAWQualityComboBox->insertItem(5, i18nc("@item:inlistbox Quality", "DHT"), QVariant(DRawDecoderSettings::DHT)); 0288 d->RAWQualityComboBox->insertItem(6, i18nc("@item:inlistbox Quality", "AAHD"), QVariant(DRawDecoderSettings::AAHD)); 0289 0290 d->RAWQualityComboBox->setDefaultIndex(0); 0291 d->RAWQualityComboBox->setCurrentIndex(0); 0292 d->RAWQualityComboBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Quality (interpolation)</title>" 0293 "<para>Select here the demosaicing method to use when decoding RAW " 0294 "images. A demosaicing algorithm is a digital image process used to " 0295 "interpolate a complete image from the partial raw data received " 0296 "from the color-filtered image sensor, internal to many digital " 0297 "cameras, in form of a matrix of colored pixels. Also known as CFA " 0298 "interpolation or color reconstruction, another common spelling is " 0299 "demosaicing. The following methods are available for demosaicing " 0300 "RAW images:</para>" 0301 0302 "<para><list><item><emphasis strong='true'>Bilinear</emphasis>: use " 0303 "high-speed but low-quality bilinear interpolation (default - for " 0304 "slow computers). In this method, the red value of a non-red pixel " 0305 "is computed as the average of the adjacent red pixels, and similarly " 0306 "for blue and green.</item>" 0307 0308 "<item><emphasis strong='true'>VNG</emphasis>: use Variable Number " 0309 "of Gradients interpolation. This method computes gradients near " 0310 "the pixel of interest and uses the lower gradients (representing " 0311 "smoother and more similar parts of the image) to make an estimate.</item>" 0312 0313 "<item><emphasis strong='true'>PPG</emphasis>: use Patterned-Pixel-" 0314 "Grouping interpolation. Pixel Grouping uses assumptions about " 0315 "natural scenery in making estimates. It has fewer color artifacts " 0316 "on natural images than the Variable Number of Gradients method.</item>" 0317 0318 "<item><emphasis strong='true'>AHD</emphasis>: use Adaptive " 0319 "Homogeneity-Directed interpolation. This method selects the " 0320 "direction of interpolation so as to maximize a homogeneity metric, " 0321 "thus typically minimizing color artifacts.</item>" 0322 0323 "<item><emphasis strong='true'>DCB</emphasis>: DCB interpolation from " 0324 "linuxphoto.org project.</item>" 0325 0326 "<item><emphasis strong='true'>DHT</emphasis>: DHT interpolation." 0327 "See https://www.libraw.org/node/2306 for details.</item>" 0328 0329 "<item><emphasis strong='true'>AAHD</emphasis>: modified AHD " 0330 "interpolation.</item>" 0331 "</list></para>")); 0332 0333 demosaicingLayout->addWidget(d->RAWQualityLabel, line, 0, 1, 1); 0334 demosaicingLayout->addWidget(d->RAWQualityComboBox, line, 1, 1, 2); 0335 line++; 0336 0337 d->medianFilterPassesSpinBox = new DIntNumInput(d->demosaicingSettings); 0338 d->medianFilterPassesSpinBox->setRange(0, 10, 1); 0339 d->medianFilterPassesSpinBox->setDefaultValue(0); 0340 d->medianFilterPassesLabel = new QLabel(i18nc("@label:slider", "Pass:"), d->whiteBalanceSettings); 0341 d->medianFilterPassesSpinBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Pass</title>" 0342 "<para>Set here the passes used by the median filter applied after " 0343 "interpolation to Red-Green and Blue-Green channels.</para>" 0344 "<para>This setting is only available for specific Quality options: " 0345 "<emphasis strong='true'>Bilinear</emphasis>, <emphasis strong='true'>" 0346 "VNG</emphasis>, <emphasis strong='true'>PPG</emphasis>, " 0347 "<emphasis strong='true'>AHD</emphasis>, <emphasis strong='true'>" 0348 "DCB</emphasis>, and <emphasis strong='true'>VCD & AHD</emphasis>.</para>")); 0349 demosaicingLayout->addWidget(d->medianFilterPassesLabel, line, 0, 1, 1); 0350 demosaicingLayout->addWidget(d->medianFilterPassesSpinBox, line, 1, 1, 2); 0351 line++; 0352 0353 d->refineInterpolationBox = new QCheckBox(i18nc("@option:check", "Refine interpolation"), d->demosaicingSettings); 0354 d->refineInterpolationBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Refine interpolation</title>" 0355 "<para>This setting is available only for few Quality options:</para>" 0356 "<para><list><item><emphasis strong='true'>DCB</emphasis>: turn on " 0357 "the enhance interpolated colors filter.</item>" 0358 "<item><emphasis strong='true'>VCD & AHD</emphasis>: turn on the " 0359 "enhanced effective color interpolation (EECI) refine to improve " 0360 "sharpness.</item></list></para>")); 0361 demosaicingLayout->addWidget(d->refineInterpolationBox, line, 0, 1, 2); 0362 0363 d->medianFilterPassesLabel->setEnabled(false); 0364 d->medianFilterPassesSpinBox->setEnabled(false); 0365 d->refineInterpolationBox->setEnabled(false); 0366 0367 addItem(d->demosaicingSettings, QIcon::fromTheme(QLatin1String("image-x-adobe-dng")).pixmap(16, 16), i18nc("@label", "Demosaicing"), QLatin1String("demosaicing"), true); 0368 0369 // --------------------------------------------------------------- 0370 // WHITE BALANCE Settings Panel 0371 0372 d->whiteBalanceSettings = new QWidget(this); 0373 QGridLayout* const whiteBalanceLayout = new QGridLayout(d->whiteBalanceSettings); 0374 0375 d->whiteBalanceLabel = new QLabel(i18nc("@label:listbox", "Method:"), d->whiteBalanceSettings); 0376 d->whiteBalanceComboBox = new DComboBox(d->whiteBalanceSettings); 0377 d->whiteBalanceComboBox->insertItem(DRawDecoderSettings::NONE, i18nc("@item:inlistbox", "Default D65")); 0378 d->whiteBalanceComboBox->insertItem(DRawDecoderSettings::CAMERA, i18nc("@item:inlistbox", "Camera")); 0379 d->whiteBalanceComboBox->insertItem(DRawDecoderSettings::AUTO, i18nc("@item:inlistbox set while balance automatically", "Automatic")); 0380 d->whiteBalanceComboBox->insertItem(DRawDecoderSettings::CUSTOM, i18nc("@item:inlistbox set white balance manually", "Manual")); 0381 d->whiteBalanceComboBox->setDefaultIndex(DRawDecoderSettings::CAMERA); 0382 d->whiteBalanceComboBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>White Balance</title>" 0383 "<para>Configure the raw white balance:</para>" 0384 "<para><list><item><emphasis strong='true'>Default D65</emphasis>: " 0385 "Use a standard daylight D65 white balance.</item>" 0386 "<item><emphasis strong='true'>Camera</emphasis>: Use the white " 0387 "balance specified by the camera. If not available, reverts to " 0388 "default neutral white balance.</item>" 0389 "<item><emphasis strong='true'>Automatic</emphasis>: Calculates an " 0390 "automatic white balance averaging the entire image.</item>" 0391 "<item><emphasis strong='true'>Manual</emphasis>: Set a custom " 0392 "temperature and green level values.</item></list></para>")); 0393 0394 d->customWhiteBalanceSpinBox = new DIntNumInput(d->whiteBalanceSettings); 0395 d->customWhiteBalanceSpinBox->setRange(2000, 12000, 10); 0396 d->customWhiteBalanceSpinBox->setDefaultValue(6500); 0397 d->customWhiteBalanceLabel = new QLabel(i18nc("@label:slider", "T(K):"), d->whiteBalanceSettings); 0398 d->customWhiteBalanceSpinBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Temperature</title>" 0399 "<para>Set here the color temperature in Kelvin.</para>")); 0400 0401 d->customWhiteBalanceGreenSpinBox = new DDoubleNumInput(d->whiteBalanceSettings); 0402 d->customWhiteBalanceGreenSpinBox->setDecimals(2); 0403 d->customWhiteBalanceGreenSpinBox->setRange(0.2, 2.5, 0.01); 0404 d->customWhiteBalanceGreenSpinBox->setDefaultValue(1.0); 0405 d->customWhiteBalanceGreenLabel = new QLabel(i18nc("@label:slider Green component", "Green:"), d->whiteBalanceSettings); 0406 d->customWhiteBalanceGreenSpinBox->setWhatsThis(xi18nc("@info:whatsthis", "<para>Set here the " 0407 "green component to set magenta color cast removal level.</para>")); 0408 0409 d->unclipColorLabel = new QLabel(i18nc("@label:listbox", "Highlights:"), d->whiteBalanceSettings); 0410 d->unclipColorComboBox = new DComboBox(d->whiteBalanceSettings); 0411 d->unclipColorComboBox->insertItem(0, i18nc("@item:inlistbox", "Solid white")); 0412 d->unclipColorComboBox->insertItem(1, i18nc("@item:inlistbox", "Unclip")); 0413 d->unclipColorComboBox->insertItem(2, i18nc("@item:inlistbox", "Blend")); 0414 d->unclipColorComboBox->insertItem(3, i18nc("@item:inlistbox", "Rebuild")); 0415 d->unclipColorComboBox->setDefaultIndex(0); 0416 d->unclipColorComboBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Highlights</title>" 0417 "<para>Select here the highlight clipping method:</para>" 0418 "<para><list><item><emphasis strong='true'>Solid white</emphasis>: " 0419 "clip all highlights to solid white</item>" 0420 "<item><emphasis strong='true'>Unclip</emphasis>: leave highlights " 0421 "unclipped in various shades of pink</item>" 0422 "<item><emphasis strong='true'>Blend</emphasis>:Blend clipped and " 0423 "unclipped values together for a gradual fade to white</item>" 0424 "<item><emphasis strong='true'>Rebuild</emphasis>: reconstruct " 0425 "highlights using a level value</item></list></para>")); 0426 0427 d->reconstructLabel = new QLabel(i18nc("@label:slider Highlight reconstruct level", "Level:"), d->whiteBalanceSettings); 0428 d->reconstructSpinBox = new DIntNumInput(d->whiteBalanceSettings); 0429 d->reconstructSpinBox->setRange(0, 6, 1); 0430 d->reconstructSpinBox->setDefaultValue(0); 0431 d->reconstructSpinBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Level</title>" 0432 "<para>Specify the reconstruct highlight level. Low values favor " 0433 "whites and high values favor colors.</para>")); 0434 0435 d->expoCorrectionBox = new QCheckBox(i18nc("@option:check", "Exposure Correction (E.V)"), d->whiteBalanceSettings); 0436 d->expoCorrectionBox->setWhatsThis(xi18nc("@info:whatsthis", "<para>Turn on the exposure " 0437 "correction before interpolation.</para>")); 0438 0439 d->expoCorrectionShiftLabel = new QLabel(i18nc("@label:slider", "Linear Shift:"), d->whiteBalanceSettings); 0440 d->expoCorrectionShiftSpinBox = new DDoubleNumInput(d->whiteBalanceSettings); 0441 d->expoCorrectionShiftSpinBox->setDecimals(2); 0442 d->expoCorrectionShiftSpinBox->setRange(-2.0, 3.0, 0.01); 0443 d->expoCorrectionShiftSpinBox->setDefaultValue(0.0); 0444 d->expoCorrectionShiftSpinBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Shift</title>" 0445 "<para>Linear Shift of exposure correction before interpolation in E.V</para>")); 0446 0447 d->expoCorrectionHighlightLabel = new QLabel(i18nc("@label:slider", "Highlight:"), d->whiteBalanceSettings); 0448 d->expoCorrectionHighlightSpinBox = new DDoubleNumInput(d->whiteBalanceSettings); 0449 d->expoCorrectionHighlightSpinBox->setDecimals(2); 0450 d->expoCorrectionHighlightSpinBox->setRange(0.0, 1.0, 0.01); 0451 d->expoCorrectionHighlightSpinBox->setDefaultValue(0.0); 0452 d->expoCorrectionHighlightSpinBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Highlight</title>" 0453 "<para>Amount of highlight preservation for exposure correction " 0454 "before interpolation in E.V. Only take effect if Shift Correction is > 1.0 E.V</para>")); 0455 0456 d->fixColorsHighlightsBox = new QCheckBox(i18nc("@option:check", "Correct false colors in highlights"), d->whiteBalanceSettings); 0457 d->fixColorsHighlightsBox->setWhatsThis(xi18nc("@info:whatsthis", "<para>If enabled, images with " 0458 "overblown channels are processed much more accurately, without " 0459 "'pink clouds' (and blue highlights under tungsten lamps).</para>")); 0460 0461 d->autoBrightnessBox = new QCheckBox(i18nc("@option:check", "Auto Brightness"), d->whiteBalanceSettings); 0462 d->autoBrightnessBox->setWhatsThis(xi18nc("@info:whatsthis", "<para>If disable, use a fixed white level " 0463 "and ignore the image histogram to adjust brightness.</para>")); 0464 0465 d->brightnessLabel = new QLabel(i18nc("@label:slider", "Brightness:"), d->whiteBalanceSettings); 0466 d->brightnessSpinBox = new DDoubleNumInput(d->whiteBalanceSettings); 0467 d->brightnessSpinBox->setDecimals(2); 0468 d->brightnessSpinBox->setRange(0.0, 10.0, 0.01); 0469 d->brightnessSpinBox->setDefaultValue(1.0); 0470 d->brightnessSpinBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Brightness</title>" 0471 "<para>Specify the brightness level of output image. The default " 0472 "value is 1.0 (works in 8-bit mode only).</para>")); 0473 0474 if (! (advSettings & POSTPROCESSING)) 0475 { 0476 d->brightnessLabel->hide(); 0477 d->brightnessSpinBox->hide(); 0478 } 0479 0480 d->blackPointCheckBox = new QCheckBox(i18nc("@option:check Black point", "Black:"), d->whiteBalanceSettings); 0481 d->blackPointCheckBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Black point</title>" 0482 "<para>Use a specific black point value to decode RAW pictures. If " 0483 "you set this option to off, the Black Point value will be " 0484 "automatically computed.</para>")); 0485 d->blackPointSpinBox = new DIntNumInput(d->whiteBalanceSettings); 0486 d->blackPointSpinBox->setRange(0, 1000, 1); 0487 d->blackPointSpinBox->setDefaultValue(0); 0488 d->blackPointSpinBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Black point value</title>" 0489 "<para>Specify specific black point value of the output image.</para>")); 0490 0491 d->whitePointCheckBox = new QCheckBox(i18nc("@option:check White point", "White:"), d->whiteBalanceSettings); 0492 d->whitePointCheckBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>White point</title>" 0493 "<para>Use a specific white point value to decode RAW pictures. If " 0494 "you set this option to off, the White Point value will be " 0495 "automatically computed.</para>")); 0496 d->whitePointSpinBox = new DIntNumInput(d->whiteBalanceSettings); 0497 d->whitePointSpinBox->setRange(0, 20000, 1); 0498 d->whitePointSpinBox->setDefaultValue(0); 0499 d->whitePointSpinBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>White point value</title>" 0500 "<para>Specify specific white point value of the output image.</para>")); 0501 0502 if (! (advSettings & BLACKWHITEPOINTS)) 0503 { 0504 d->blackPointCheckBox->hide(); 0505 d->blackPointSpinBox->hide(); 0506 d->whitePointCheckBox->hide(); 0507 d->whitePointSpinBox->hide(); 0508 } 0509 0510 const int spacing = qMin(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing), 0511 QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing)); 0512 0513 whiteBalanceLayout->addWidget(d->whiteBalanceLabel, 0, 0, 1, 1); 0514 whiteBalanceLayout->addWidget(d->whiteBalanceComboBox, 0, 1, 1, 2); 0515 whiteBalanceLayout->addWidget(d->customWhiteBalanceLabel, 1, 0, 1, 1); 0516 whiteBalanceLayout->addWidget(d->customWhiteBalanceSpinBox, 1, 1, 1, 2); 0517 whiteBalanceLayout->addWidget(d->customWhiteBalanceGreenLabel, 2, 0, 1, 1); 0518 whiteBalanceLayout->addWidget(d->customWhiteBalanceGreenSpinBox, 2, 1, 1, 2); 0519 whiteBalanceLayout->addWidget(d->unclipColorLabel, 3, 0, 1, 1); 0520 whiteBalanceLayout->addWidget(d->unclipColorComboBox, 3, 1, 1, 2); 0521 whiteBalanceLayout->addWidget(d->reconstructLabel, 4, 0, 1, 1); 0522 whiteBalanceLayout->addWidget(d->reconstructSpinBox, 4, 1, 1, 2); 0523 whiteBalanceLayout->addWidget(d->expoCorrectionBox, 5, 0, 1, 2); 0524 whiteBalanceLayout->addWidget(d->expoCorrectionShiftLabel, 6, 0, 1, 1); 0525 whiteBalanceLayout->addWidget(d->expoCorrectionShiftSpinBox, 6, 1, 1, 2); 0526 whiteBalanceLayout->addWidget(d->expoCorrectionHighlightLabel, 7, 0, 1, 1); 0527 whiteBalanceLayout->addWidget(d->expoCorrectionHighlightSpinBox, 7, 1, 1, 2); 0528 whiteBalanceLayout->addWidget(d->fixColorsHighlightsBox, 8, 0, 1, 3); 0529 whiteBalanceLayout->addWidget(d->autoBrightnessBox, 9, 0, 1, 3); 0530 whiteBalanceLayout->addWidget(d->brightnessLabel, 10, 0, 1, 1); 0531 whiteBalanceLayout->addWidget(d->brightnessSpinBox, 10, 1, 1, 2); 0532 whiteBalanceLayout->addWidget(d->blackPointCheckBox, 11, 0, 1, 1); 0533 whiteBalanceLayout->addWidget(d->blackPointSpinBox, 11, 1, 1, 2); 0534 whiteBalanceLayout->addWidget(d->whitePointCheckBox, 12, 0, 1, 1); 0535 whiteBalanceLayout->addWidget(d->whitePointSpinBox, 12, 1, 1, 2); 0536 whiteBalanceLayout->setContentsMargins(spacing, spacing, spacing, spacing); 0537 whiteBalanceLayout->setSpacing(spacing); 0538 0539 addItem(d->whiteBalanceSettings, QIcon::fromTheme(QLatin1String("bordertool")).pixmap(16, 16), i18nc("@label", "White Balance"), QLatin1String("whitebalance"), true); 0540 0541 // --------------------------------------------------------------- 0542 // CORRECTIONS Settings panel 0543 0544 d->correctionsSettings = new QWidget(this); 0545 QGridLayout* const correctionsLayout = new QGridLayout(d->correctionsSettings); 0546 0547 d->noiseReductionLabel = new QLabel(i18nc("@label:listbox", "Noise reduction:"), d->correctionsSettings); 0548 d->noiseReductionComboBox = new DComboBox(d->colormanSettings); 0549 d->noiseReductionComboBox->insertItem(DRawDecoderSettings::NONR, i18nc("@item:inlistbox Noise Reduction", "None")); 0550 d->noiseReductionComboBox->insertItem(DRawDecoderSettings::WAVELETSNR, i18nc("@item:inlistbox Noise Reduction", "Wavelets")); 0551 d->noiseReductionComboBox->insertItem(DRawDecoderSettings::FBDDNR, i18nc("@item:inlistbox Noise Reduction", "FBDD")); 0552 d->noiseReductionComboBox->setDefaultIndex(DRawDecoderSettings::NONR); 0553 d->noiseReductionComboBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Noise Reduction</title>" 0554 "<para>Select here the noise reduction method to apply during RAW " 0555 "decoding.</para>" 0556 "<para><list><item><emphasis strong='true'>None</emphasis>: no " 0557 "noise reduction.</item>" 0558 "<item><emphasis strong='true'>Wavelets</emphasis>: wavelets " 0559 "correction to erase noise while preserving real detail. It is " 0560 "applied after interpolation.</item>" 0561 "<item><emphasis strong='true'>FBDD</emphasis>: Fake Before " 0562 "Demosaicing Denoising noise reduction. It is applied before " 0563 "interpolation.</item></list></para>")); 0564 0565 d->NRSpinBox1 = new DIntNumInput(d->correctionsSettings); 0566 d->NRSpinBox1->setRange(100, 1000, 1); 0567 d->NRSpinBox1->setDefaultValue(100); 0568 d->NRLabel1 = new QLabel(d->correctionsSettings); 0569 0570 correctionsLayout->addWidget(d->noiseReductionLabel, 0, 0, 1, 1); 0571 correctionsLayout->addWidget(d->noiseReductionComboBox, 0, 1, 1, 2); 0572 correctionsLayout->addWidget(d->NRLabel1, 1, 0, 1, 1); 0573 correctionsLayout->addWidget(d->NRSpinBox1, 1, 1, 1, 2); 0574 correctionsLayout->setRowStretch(2, 10); 0575 correctionsLayout->setContentsMargins(spacing, spacing, spacing, spacing); 0576 correctionsLayout->setSpacing(spacing); 0577 0578 addItem(d->correctionsSettings, QIcon::fromTheme(QLatin1String("document-edit")).pixmap(16, 16), i18nc("@label", "Corrections"), QLatin1String("corrections"), false); 0579 0580 // --------------------------------------------------------------- 0581 // COLOR MANAGEMENT Settings panel 0582 0583 d->colormanSettings = new QWidget(this); 0584 QGridLayout* const colormanLayout = new QGridLayout(d->colormanSettings); 0585 0586 d->inputColorSpaceLabel = new QLabel(i18nc("@label:listbox", "Camera Profile:"), d->colormanSettings); 0587 d->inputColorSpaceComboBox = new DComboBox(d->colormanSettings); 0588 d->inputColorSpaceComboBox->insertItem(DRawDecoderSettings::NOINPUTCS, i18nc("@item:inlistbox Camera Profile", "None")); 0589 d->inputColorSpaceComboBox->insertItem(DRawDecoderSettings::EMBEDDED, i18nc("@item:inlistbox Camera Profile", "Embedded")); 0590 d->inputColorSpaceComboBox->insertItem(DRawDecoderSettings::CUSTOMINPUTCS, i18nc("@item:inlistbox Camera Profile", "Custom")); 0591 d->inputColorSpaceComboBox->setDefaultIndex(DRawDecoderSettings::NOINPUTCS); 0592 d->inputColorSpaceComboBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Camera Profile</title>" 0593 "<para>Select here the input color space used to decode RAW data.</para>" 0594 "<para><list><item><emphasis strong='true'>None</emphasis>: no " 0595 "input color profile is used during RAW decoding.</item>" 0596 "<item><emphasis strong='true'>Embedded</emphasis>: use embedded " 0597 "color profile from RAW file, if it exists.</item>" 0598 "<item><emphasis strong='true'>Custom</emphasis>: use a custom " 0599 "input color space profile.</item></list></para>")); 0600 0601 d->inIccUrlEdit = new DFileSelector(d->colormanSettings); 0602 d->inIccUrlEdit->setFileDlgMode(QFileDialog::ExistingFile); 0603 d->inIccUrlEdit->setFileDlgFilter(i18nc("@info: open file filters", "ICC Files (*.icc *.icm)")); 0604 0605 d->outputColorSpaceLabel = new QLabel(i18nc("@label:listbox", "Workspace:"), d->colormanSettings); 0606 d->outputColorSpaceComboBox = new DComboBox( d->colormanSettings ); 0607 d->outputColorSpaceComboBox->insertItem(DRawDecoderSettings::RAWCOLOR, i18nc("@item:inlistbox Workspace", "Raw (no profile)")); 0608 d->outputColorSpaceComboBox->insertItem(DRawDecoderSettings::SRGB, i18nc("@item:inlistbox Workspace", "sRGB")); 0609 d->outputColorSpaceComboBox->insertItem(DRawDecoderSettings::ADOBERGB, i18nc("@item:inlistbox Workspace", "Adobe RGB")); 0610 d->outputColorSpaceComboBox->insertItem(DRawDecoderSettings::WIDEGAMMUT, i18nc("@item:inlistbox Workspace", "Wide Gamut")); 0611 d->outputColorSpaceComboBox->insertItem(DRawDecoderSettings::PROPHOTO, i18nc("@item:inlistbox Workspace", "Pro-Photo")); 0612 d->outputColorSpaceComboBox->insertItem(DRawDecoderSettings::CUSTOMOUTPUTCS, i18nc("@item:inlistbox Workspace", "Custom")); 0613 d->outputColorSpaceComboBox->setDefaultIndex(DRawDecoderSettings::SRGB); 0614 d->outputColorSpaceComboBox->setWhatsThis(xi18nc("@info:whatsthis", "<title>Workspace</title>" 0615 "<para>Select here the output color space used to decode RAW data.</para>" 0616 "<para><list><item><emphasis strong='true'>Raw (linear)</emphasis>: " 0617 "in this mode, no output color space is used during RAW decoding.</item>" 0618 "<item><emphasis strong='true'>sRGB</emphasis>: this is an RGB " 0619 "color space, created cooperatively by Hewlett-Packard and " 0620 "Microsoft. It is the best choice for images destined for the Web " 0621 "and portrait photography.</item>" 0622 "<item><emphasis strong='true'>Adobe RGB</emphasis>: this color " 0623 "space is an extended RGB color space, developed by Adobe. It is " 0624 "used for photography applications such as advertising and fine " 0625 "art.</item>" 0626 "<item><emphasis strong='true'>Wide Gamut</emphasis>: this color " 0627 "space is an expanded version of the Adobe RGB color space.</item>" 0628 "<item><emphasis strong='true'>Pro-Photo</emphasis>: this color " 0629 "space is an RGB color space, developed by Kodak, that offers an " 0630 "especially large gamut designed for use with photographic outputs " 0631 "in mind.</item>" 0632 "<item><emphasis strong='true'>Custom</emphasis>: use a custom " 0633 "output color space profile.</item></list></para>")); 0634 0635 d->outIccUrlEdit = new DFileSelector(d->colormanSettings); 0636 d->outIccUrlEdit->setFileDlgMode(QFileDialog::ExistingFile); 0637 d->outIccUrlEdit->setFileDlgFilter(i18nc("@info: open file filters", "ICC Files (*.icc *.icm)")); 0638 0639 colormanLayout->addWidget(d->inputColorSpaceLabel, 0, 0, 1, 1); 0640 colormanLayout->addWidget(d->inputColorSpaceComboBox, 0, 1, 1, 2); 0641 colormanLayout->addWidget(d->inIccUrlEdit, 1, 0, 1, 3); 0642 colormanLayout->addWidget(d->outputColorSpaceLabel, 2, 0, 1, 1); 0643 colormanLayout->addWidget(d->outputColorSpaceComboBox, 2, 1, 1, 2); 0644 colormanLayout->addWidget(d->outIccUrlEdit, 3, 0, 1, 3); 0645 colormanLayout->setRowStretch(4, 10); 0646 colormanLayout->setContentsMargins(spacing, spacing, spacing, spacing); 0647 colormanLayout->setSpacing(spacing); 0648 0649 addItem(d->colormanSettings, QIcon::fromTheme(QLatin1String("preferences-desktop-display-color")).pixmap(16, 16), i18nc("@label", "Color Management"), QLatin1String("colormanagement"), false); 0650 0651 if (! (advSettings & COLORSPACE)) 0652 { 0653 removeItem(COLORMANAGEMENT); 0654 } 0655 0656 addStretch(); 0657 0658 // --------------------------------------------------------------- 0659 0660 connect(d->unclipColorComboBox, static_cast<void (DComboBox::*)(int)>(&DComboBox::activated), 0661 this, &DRawDecoderWidget::slotUnclipColorActivated); 0662 0663 connect(d->whiteBalanceComboBox, static_cast<void (DComboBox::*)(int)>(&DComboBox::activated), 0664 this, &DRawDecoderWidget::slotWhiteBalanceToggled); 0665 0666 connect(d->noiseReductionComboBox, static_cast<void (DComboBox::*)(int)>(&DComboBox::activated), 0667 this, &DRawDecoderWidget::slotNoiseReductionChanged); 0668 0669 connect(d->blackPointCheckBox, SIGNAL(toggled(bool)), 0670 d->blackPointSpinBox, SLOT(setEnabled(bool))); 0671 0672 connect(d->whitePointCheckBox, SIGNAL(toggled(bool)), 0673 d->whitePointSpinBox, SLOT(setEnabled(bool))); 0674 0675 connect(d->sixteenBitsImage, &QCheckBox::toggled, 0676 this, &DRawDecoderWidget::slotsixteenBitsImageToggled); 0677 0678 connect(d->inputColorSpaceComboBox, static_cast<void (DComboBox::*)(int)>(&DComboBox::activated), 0679 this, &DRawDecoderWidget::slotInputColorSpaceChanged); 0680 0681 connect(d->outputColorSpaceComboBox, static_cast<void (DComboBox::*)(int)>(&DComboBox::activated), 0682 this, &DRawDecoderWidget::slotOutputColorSpaceChanged); 0683 0684 connect(d->expoCorrectionBox, &QCheckBox::toggled, 0685 this, &DRawDecoderWidget::slotExposureCorrectionToggled); 0686 0687 connect(d->expoCorrectionShiftSpinBox, &DDoubleNumInput::valueChanged, 0688 this, &DRawDecoderWidget::slotExpoCorrectionShiftChanged); 0689 0690 // Wrapper to Q_EMIT signal when something is changed in settings. 0691 0692 connect(d->inIccUrlEdit->lineEdit(), &QLineEdit::textChanged, 0693 this, &DRawDecoderWidget::signalSettingsChanged); 0694 0695 connect(d->outIccUrlEdit->lineEdit(), &QLineEdit::textChanged, 0696 this, &DRawDecoderWidget::signalSettingsChanged); 0697 0698 connect(d->whiteBalanceComboBox, static_cast<void (DComboBox::*)(int)>(&DComboBox::activated), 0699 this, &DRawDecoderWidget::signalSettingsChanged); 0700 0701 connect(d->RAWQualityComboBox, static_cast<void (DComboBox::*)(int)>(&DComboBox::activated), 0702 this, &DRawDecoderWidget::slotRAWQualityChanged); 0703 0704 connect(d->unclipColorComboBox, static_cast<void (DComboBox::*)(int)>(&DComboBox::activated), 0705 this, &DRawDecoderWidget::signalSettingsChanged); 0706 0707 connect(d->inputColorSpaceComboBox, static_cast<void (DComboBox::*)(int)>(&DComboBox::activated), 0708 this, &DRawDecoderWidget::signalSettingsChanged); 0709 0710 connect(d->outputColorSpaceComboBox, static_cast<void (DComboBox::*)(int)>(&DComboBox::activated), 0711 this, &DRawDecoderWidget::signalSettingsChanged); 0712 0713 connect(d->blackPointCheckBox, &QCheckBox::toggled, 0714 this, &DRawDecoderWidget::signalSettingsChanged); 0715 0716 connect(d->whitePointCheckBox, &QCheckBox::toggled, 0717 this, &DRawDecoderWidget::signalSettingsChanged); 0718 0719 connect(d->sixteenBitsImage, &QCheckBox::toggled, 0720 this, &DRawDecoderWidget::signalSettingsChanged); 0721 0722 connect(d->fixColorsHighlightsBox, &QCheckBox::toggled, 0723 this, &DRawDecoderWidget::signalSettingsChanged); 0724 0725 connect(d->autoBrightnessBox, &QCheckBox::toggled, 0726 this, &DRawDecoderWidget::signalSettingsChanged); 0727 0728 connect(d->fourColorCheckBox, &QCheckBox::toggled, 0729 this, &DRawDecoderWidget::signalSettingsChanged); 0730 0731 connect(d->dontStretchPixelsCheckBox, &QCheckBox::toggled, 0732 this, &DRawDecoderWidget::signalSettingsChanged); 0733 0734 connect(d->refineInterpolationBox, &QCheckBox::toggled, 0735 this, &DRawDecoderWidget::signalSettingsChanged); 0736 0737 connect(d->customWhiteBalanceSpinBox, &DIntNumInput::valueChanged, 0738 this, &DRawDecoderWidget::signalSettingsChanged); 0739 0740 connect(d->reconstructSpinBox, &DIntNumInput::valueChanged, 0741 this, &DRawDecoderWidget::signalSettingsChanged); 0742 0743 connect(d->blackPointSpinBox, &DIntNumInput::valueChanged, 0744 this, &DRawDecoderWidget::signalSettingsChanged); 0745 0746 connect(d->whitePointSpinBox, &DIntNumInput::valueChanged, 0747 this, &DRawDecoderWidget::signalSettingsChanged); 0748 0749 connect(d->NRSpinBox1, &DIntNumInput::valueChanged, 0750 this, &DRawDecoderWidget::signalSettingsChanged); 0751 0752 connect(d->medianFilterPassesSpinBox, &DIntNumInput::valueChanged, 0753 this, &DRawDecoderWidget::signalSettingsChanged); 0754 0755 connect(d->customWhiteBalanceGreenSpinBox, &DDoubleNumInput::valueChanged, 0756 this, &DRawDecoderWidget::signalSettingsChanged); 0757 0758 connect(d->brightnessSpinBox, &DDoubleNumInput::valueChanged, 0759 this, &DRawDecoderWidget::signalSettingsChanged); 0760 0761 connect(d->expoCorrectionHighlightSpinBox, &DDoubleNumInput::valueChanged, 0762 this, &DRawDecoderWidget::signalSettingsChanged); 0763 } 0764 0765 DRawDecoderWidget::~DRawDecoderWidget() 0766 { 0767 delete d; 0768 } 0769 0770 void DRawDecoderWidget::updateMinimumWidth() 0771 { 0772 int width = 0; 0773 0774 for (int i = 0 ; i < count() ; ++i) 0775 { 0776 if (widget(i)->width() > width) 0777 { 0778 width = widget(i)->width(); 0779 } 0780 } 0781 0782 setMinimumWidth(width); 0783 } 0784 0785 DFileSelector* DRawDecoderWidget::inputProfileUrlEdit() const 0786 { 0787 return d->inIccUrlEdit; 0788 } 0789 0790 DFileSelector* DRawDecoderWidget::outputProfileUrlEdit() const 0791 { 0792 return d->outIccUrlEdit; 0793 } 0794 0795 void DRawDecoderWidget::resetToDefault() 0796 { 0797 setSettings(DRawDecoderSettings()); 0798 } 0799 0800 void DRawDecoderWidget::slotsixteenBitsImageToggled(bool b) 0801 { 0802 setEnabledBrightnessSettings(!b); 0803 Q_EMIT signalSixteenBitsImageToggled(d->sixteenBitsImage->isChecked()); 0804 } 0805 0806 void DRawDecoderWidget::slotWhiteBalanceToggled(int v) 0807 { 0808 if (v == 3) 0809 { 0810 d->customWhiteBalanceSpinBox->setEnabled(true); 0811 d->customWhiteBalanceGreenSpinBox->setEnabled(true); 0812 d->customWhiteBalanceLabel->setEnabled(true); 0813 d->customWhiteBalanceGreenLabel->setEnabled(true); 0814 } 0815 else 0816 { 0817 d->customWhiteBalanceSpinBox->setEnabled(false); 0818 d->customWhiteBalanceGreenSpinBox->setEnabled(false); 0819 d->customWhiteBalanceLabel->setEnabled(false); 0820 d->customWhiteBalanceGreenLabel->setEnabled(false); 0821 } 0822 } 0823 0824 void DRawDecoderWidget::slotUnclipColorActivated(int v) 0825 { 0826 if (v == 3) // Reconstruct Highlight method 0827 { 0828 d->reconstructLabel->setEnabled(true); 0829 d->reconstructSpinBox->setEnabled(true); 0830 } 0831 else 0832 { 0833 d->reconstructLabel->setEnabled(false); 0834 d->reconstructSpinBox->setEnabled(false); 0835 } 0836 } 0837 0838 void DRawDecoderWidget::slotNoiseReductionChanged(int item) 0839 { 0840 d->NRSpinBox1->setEnabled(true); 0841 d->NRLabel1->setEnabled(true); 0842 d->NRLabel1->setText(i18nc("@label", "Threshold:")); 0843 d->NRSpinBox1->setWhatsThis(xi18nc("@info:whatsthis", "<title>Threshold</title>" 0844 "<para>Set here the noise reduction threshold value to use.</para>")); 0845 0846 switch (item) 0847 { 0848 case DRawDecoderSettings::WAVELETSNR: 0849 case DRawDecoderSettings::FBDDNR: 0850 { 0851 // NOTE : no ops 0852 break; 0853 } 0854 0855 default: 0856 { 0857 d->NRSpinBox1->setEnabled(false); 0858 d->NRLabel1->setEnabled(false); 0859 break; 0860 } 0861 } 0862 0863 Q_EMIT signalSettingsChanged(); 0864 } 0865 0866 void DRawDecoderWidget::slotExposureCorrectionToggled(bool b) 0867 { 0868 d->expoCorrectionShiftLabel->setEnabled(b); 0869 d->expoCorrectionShiftSpinBox->setEnabled(b); 0870 d->expoCorrectionHighlightLabel->setEnabled(b); 0871 d->expoCorrectionHighlightSpinBox->setEnabled(b); 0872 0873 slotExpoCorrectionShiftChanged(d->expoCorrectionShiftSpinBox->value()); 0874 } 0875 0876 void DRawDecoderWidget::slotExpoCorrectionShiftChanged(double ev) 0877 { 0878 // Only enable Highlight exposure correction if Shift correction is >= 1.0, else this settings do not take effect. 0879 0880 bool b = (ev >= 1.0); 0881 0882 d->expoCorrectionHighlightLabel->setEnabled(b); 0883 d->expoCorrectionHighlightSpinBox->setEnabled(b); 0884 0885 Q_EMIT signalSettingsChanged(); 0886 } 0887 0888 void DRawDecoderWidget::slotInputColorSpaceChanged(int item) 0889 { 0890 d->inIccUrlEdit->setEnabled(item == DRawDecoderSettings::CUSTOMINPUTCS); 0891 } 0892 0893 void DRawDecoderWidget::slotOutputColorSpaceChanged(int item) 0894 { 0895 d->outIccUrlEdit->setEnabled(item == DRawDecoderSettings::CUSTOMOUTPUTCS); 0896 } 0897 0898 void DRawDecoderWidget::slotRAWQualityChanged(int quality) 0899 { 0900 switch (quality) 0901 { 0902 case DRawDecoderSettings::DCB: 0903 { 0904 d->medianFilterPassesLabel->setEnabled(true); 0905 d->medianFilterPassesSpinBox->setEnabled(true); 0906 d->refineInterpolationBox->setEnabled(true); 0907 break; 0908 } 0909 0910 default: // BILINEAR, VNG, PPG, AHD 0911 { 0912 d->medianFilterPassesLabel->setEnabled(true); 0913 d->medianFilterPassesSpinBox->setEnabled(true); 0914 d->refineInterpolationBox->setEnabled(false); 0915 break; 0916 } 0917 } 0918 0919 Q_EMIT signalSettingsChanged(); 0920 } 0921 0922 void DRawDecoderWidget::setEnabledBrightnessSettings(bool b) 0923 { 0924 d->brightnessLabel->setEnabled(b); 0925 d->brightnessSpinBox->setEnabled(b); 0926 } 0927 0928 bool DRawDecoderWidget::brightnessSettingsIsEnabled() const 0929 { 0930 return d->brightnessSpinBox->isEnabled(); 0931 } 0932 0933 void DRawDecoderWidget::setSettings(const DRawDecoderSettings& settings) 0934 { 0935 d->sixteenBitsImage->setChecked(settings.sixteenBitsImage); 0936 0937 switch (settings.whiteBalance) 0938 { 0939 case DRawDecoderSettings::CAMERA: 0940 { 0941 d->whiteBalanceComboBox->setCurrentIndex(1); 0942 break; 0943 } 0944 0945 case DRawDecoderSettings::AUTO: 0946 { 0947 d->whiteBalanceComboBox->setCurrentIndex(2); 0948 break; 0949 } 0950 0951 case DRawDecoderSettings::CUSTOM: 0952 { 0953 d->whiteBalanceComboBox->setCurrentIndex(3); 0954 break; 0955 } 0956 0957 default: 0958 { 0959 d->whiteBalanceComboBox->setCurrentIndex(0); 0960 break; 0961 } 0962 } 0963 0964 slotWhiteBalanceToggled(d->whiteBalanceComboBox->currentIndex()); 0965 0966 d->customWhiteBalanceSpinBox->setValue(settings.customWhiteBalance); 0967 d->customWhiteBalanceGreenSpinBox->setValue(settings.customWhiteBalanceGreen); 0968 d->fourColorCheckBox->setChecked(settings.RGBInterpolate4Colors); 0969 d->autoBrightnessBox->setChecked(settings.autoBrightness); 0970 d->fixColorsHighlightsBox->setChecked(settings.fixColorsHighlights); 0971 0972 switch (settings.unclipColors) 0973 { 0974 case 0: 0975 { 0976 d->unclipColorComboBox->setCurrentIndex(0); 0977 break; 0978 } 0979 0980 case 1: 0981 { 0982 d->unclipColorComboBox->setCurrentIndex(1); 0983 break; 0984 } 0985 0986 case 2: 0987 { 0988 d->unclipColorComboBox->setCurrentIndex(2); 0989 break; 0990 } 0991 0992 default: // Reconstruct Highlight method 0993 { 0994 d->unclipColorComboBox->setCurrentIndex(3); 0995 d->reconstructSpinBox->setValue(settings.unclipColors-3); 0996 break; 0997 } 0998 } 0999 1000 slotUnclipColorActivated(d->unclipColorComboBox->currentIndex()); 1001 1002 d->dontStretchPixelsCheckBox->setChecked(settings.DontStretchPixels); 1003 d->brightnessSpinBox->setValue(settings.brightness); 1004 d->blackPointCheckBox->setChecked(settings.enableBlackPoint); 1005 d->blackPointSpinBox->setEnabled(settings.enableBlackPoint); 1006 d->blackPointSpinBox->setValue(settings.blackPoint); 1007 d->whitePointCheckBox->setChecked(settings.enableWhitePoint); 1008 d->whitePointSpinBox->setEnabled(settings.enableWhitePoint); 1009 d->whitePointSpinBox->setValue(settings.whitePoint); 1010 1011 int q = d->RAWQualityComboBox->combo()->findData(settings.RAWQuality); 1012 1013 if (q == -1) 1014 { 1015 q = 0; // Fail back to bilinear 1016 } 1017 1018 d->RAWQualityComboBox->setCurrentIndex(q); 1019 1020 switch (q) 1021 { 1022 case DRawDecoderSettings::DCB: 1023 { 1024 d->medianFilterPassesSpinBox->setValue(settings.dcbIterations); 1025 d->refineInterpolationBox->setChecked(settings.dcbEnhanceFl); 1026 break; 1027 } 1028 1029 default: 1030 { 1031 d->medianFilterPassesSpinBox->setValue(settings.medianFilterPasses); 1032 d->refineInterpolationBox->setChecked(false); // option not used. 1033 break; 1034 } 1035 } 1036 1037 slotRAWQualityChanged(q); 1038 1039 d->inputColorSpaceComboBox->setCurrentIndex((int)settings.inputColorSpace); 1040 slotInputColorSpaceChanged((int)settings.inputColorSpace); 1041 d->outputColorSpaceComboBox->setCurrentIndex((int)settings.outputColorSpace); 1042 slotOutputColorSpaceChanged((int)settings.outputColorSpace); 1043 1044 d->noiseReductionComboBox->setCurrentIndex(settings.NRType); 1045 slotNoiseReductionChanged(settings.NRType); 1046 d->NRSpinBox1->setValue(settings.NRThreshold); 1047 1048 d->expoCorrectionBox->setChecked(settings.expoCorrection); 1049 slotExposureCorrectionToggled(settings.expoCorrection); 1050 d->expoCorrectionShiftSpinBox->setValue(d->shiftExpoFromLinearToEv(settings.expoCorrectionShift)); 1051 d->expoCorrectionHighlightSpinBox->setValue(settings.expoCorrectionHighlight); 1052 1053 d->inIccUrlEdit->setFileDlgPath(settings.inputProfile); 1054 d->outIccUrlEdit->setFileDlgPath(settings.outputProfile); 1055 } 1056 1057 DRawDecoderSettings DRawDecoderWidget::settings() const 1058 { 1059 DRawDecoderSettings prm; 1060 prm.sixteenBitsImage = d->sixteenBitsImage->isChecked(); 1061 1062 switch (d->whiteBalanceComboBox->currentIndex()) 1063 { 1064 case 1: 1065 { 1066 prm.whiteBalance = DRawDecoderSettings::CAMERA; 1067 break; 1068 } 1069 1070 case 2: 1071 { 1072 prm.whiteBalance = DRawDecoderSettings::AUTO; 1073 break; 1074 } 1075 1076 case 3: 1077 { 1078 prm.whiteBalance = DRawDecoderSettings::CUSTOM; 1079 break; 1080 } 1081 1082 default: 1083 { 1084 prm.whiteBalance = DRawDecoderSettings::NONE; 1085 break; 1086 } 1087 } 1088 1089 prm.customWhiteBalance = d->customWhiteBalanceSpinBox->value(); 1090 prm.customWhiteBalanceGreen = d->customWhiteBalanceGreenSpinBox->value(); 1091 prm.RGBInterpolate4Colors = d->fourColorCheckBox->isChecked(); 1092 prm.autoBrightness = d->autoBrightnessBox->isChecked(); 1093 prm.fixColorsHighlights = d->fixColorsHighlightsBox->isChecked(); 1094 1095 switch (d->unclipColorComboBox->currentIndex()) 1096 { 1097 case 0: 1098 { 1099 prm.unclipColors = 0; 1100 break; 1101 } 1102 1103 case 1: 1104 { 1105 prm.unclipColors = 1; 1106 break; 1107 } 1108 1109 case 2: 1110 { 1111 prm.unclipColors = 2; 1112 break; 1113 } 1114 1115 default: // Reconstruct Highlight method 1116 { 1117 prm.unclipColors = d->reconstructSpinBox->value()+3; 1118 break; 1119 } 1120 } 1121 1122 prm.DontStretchPixels = d->dontStretchPixelsCheckBox->isChecked(); 1123 prm.brightness = d->brightnessSpinBox->value(); 1124 prm.enableBlackPoint = d->blackPointCheckBox->isChecked(); 1125 prm.blackPoint = d->blackPointSpinBox->value(); 1126 prm.enableWhitePoint = d->whitePointCheckBox->isChecked(); 1127 prm.whitePoint = d->whitePointSpinBox->value(); 1128 1129 prm.RAWQuality = (DRawDecoderSettings::DecodingQuality)d->RAWQualityComboBox->combo()->currentData().toInt(); 1130 1131 switch (prm.RAWQuality) 1132 { 1133 case DRawDecoderSettings::DCB: 1134 { 1135 prm.dcbIterations = d->medianFilterPassesSpinBox->value(); 1136 prm.dcbEnhanceFl = d->refineInterpolationBox->isChecked(); 1137 break; 1138 } 1139 1140 default: 1141 { 1142 prm.medianFilterPasses = d->medianFilterPassesSpinBox->value(); 1143 break; 1144 } 1145 } 1146 1147 prm.NRType = (DRawDecoderSettings::NoiseReduction)d->noiseReductionComboBox->currentIndex(); 1148 1149 switch (prm.NRType) 1150 { 1151 case DRawDecoderSettings::NONR: 1152 { 1153 prm.NRThreshold = 0; 1154 break; 1155 } 1156 1157 default: // WAVELETSNR and FBDDNR 1158 { 1159 prm.NRThreshold = d->NRSpinBox1->value(); 1160 break; 1161 } 1162 } 1163 1164 prm.expoCorrection = d->expoCorrectionBox->isChecked(); 1165 prm.expoCorrectionShift = d->shiftExpoFromEvToLinear(d->expoCorrectionShiftSpinBox->value()); 1166 prm.expoCorrectionHighlight = d->expoCorrectionHighlightSpinBox->value(); 1167 1168 prm.inputColorSpace = (DRawDecoderSettings::InputColorSpace)(d->inputColorSpaceComboBox->currentIndex()); 1169 prm.outputColorSpace = (DRawDecoderSettings::OutputColorSpace)(d->outputColorSpaceComboBox->currentIndex()); 1170 prm.inputProfile = d->inIccUrlEdit->fileDlgPath(); 1171 prm.outputProfile = d->outIccUrlEdit->fileDlgPath(); 1172 1173 return prm; 1174 } 1175 1176 void DRawDecoderWidget::readSettings(KConfigGroup& group) 1177 { 1178 DRawDecoderSettings prm; 1179 readSettings(prm, group); 1180 1181 setSettings(prm); 1182 DExpanderBox::readSettings(group); 1183 } 1184 1185 void DRawDecoderWidget::writeSettings(KConfigGroup& group) 1186 { 1187 DRawDecoderSettings prm = settings(); 1188 writeSettings(prm, group); 1189 1190 DExpanderBox::writeSettings(group); 1191 } 1192 1193 void DRawDecoderWidget::readSettings(DRawDecoderSettings& prm, KConfigGroup& group) 1194 { 1195 DRawDecoderSettings defaultPrm; 1196 1197 prm.fixColorsHighlights = group.readEntry(OPTIONFIXCOLORSHIGHLIGHTSENTRY, defaultPrm.fixColorsHighlights); 1198 prm.sixteenBitsImage = group.readEntry(OPTIONDECODESIXTEENBITENTRY, defaultPrm.sixteenBitsImage); 1199 prm.whiteBalance = (DRawDecoderSettings::WhiteBalance)group.readEntry(OPTIONWHITEBALANCEENTRY, (int)defaultPrm.whiteBalance); 1200 prm.customWhiteBalance = group.readEntry(OPTIONCUSTOMWHITEBALANCEENTRY, defaultPrm.customWhiteBalance); 1201 prm.customWhiteBalanceGreen = group.readEntry(OPTIONCUSTOMWBGREENENTRY, defaultPrm.customWhiteBalanceGreen); 1202 prm.RGBInterpolate4Colors = group.readEntry(OPTIONFOURCOLORRGBENTRY, defaultPrm.RGBInterpolate4Colors); 1203 prm.unclipColors = group.readEntry(OPTIONUNCLIPCOLORSENTRY, defaultPrm.unclipColors); 1204 prm.DontStretchPixels = group.readEntry(OPTIONDONTSTRETCHPIXELSSENTRY, defaultPrm.DontStretchPixels); 1205 prm.NRType = (DRawDecoderSettings::NoiseReduction)group.readEntry(OPTIONNOISEREDUCTIONTYPEENTRY, (int)defaultPrm.NRType); 1206 prm.brightness = group.readEntry(OPTIONBRIGHTNESSMULTIPLIERENTRY, defaultPrm.brightness); 1207 prm.enableBlackPoint = group.readEntry(OPTIONUSEBLACKPOINTENTRY, defaultPrm.enableBlackPoint); 1208 prm.blackPoint = group.readEntry(OPTIONBLACKPOINTENTRY, defaultPrm.blackPoint); 1209 prm.enableWhitePoint = group.readEntry(OPTIONUSEWHITEPOINTENTRY, defaultPrm.enableWhitePoint); 1210 prm.whitePoint = group.readEntry(OPTIONWHITEPOINTENTRY, defaultPrm.whitePoint); 1211 prm.medianFilterPasses = group.readEntry(OPTIONMEDIANFILTERPASSESENTRY, defaultPrm.medianFilterPasses); 1212 prm.NRThreshold = group.readEntry(OPTIONNOISEREDUCTIONTHRESHOLDENTRY, defaultPrm.NRThreshold); 1213 prm.RAWQuality = (DRawDecoderSettings::DecodingQuality)group.readEntry(OPTIONDECODINGQUALITYENTRY, (int)defaultPrm.RAWQuality); 1214 prm.outputColorSpace = (DRawDecoderSettings::OutputColorSpace)group.readEntry(OPTIONOUTPUTCOLORSPACEENTRY, (int)defaultPrm.outputColorSpace); 1215 prm.autoBrightness = group.readEntry(OPTIONAUTOBRIGHTNESSENTRY, defaultPrm.autoBrightness); 1216 1217 //-- Extended demosaicing settings ---------------------------------------------------------- 1218 1219 prm.dcbIterations = group.readEntry(OPTIONDCBITERATIONSENTRY, defaultPrm.dcbIterations); 1220 prm.dcbEnhanceFl = group.readEntry(OPTIONDCBENHANCEFLENTRY, defaultPrm.dcbEnhanceFl); 1221 prm.expoCorrection = group.readEntry(OPTIONEXPOCORRECTIONENTRY, defaultPrm.expoCorrection); 1222 prm.expoCorrectionShift = group.readEntry(OPTIONEXPOCORRECTIONSHIFTENTRY, defaultPrm.expoCorrectionShift); 1223 prm.expoCorrectionHighlight = group.readEntry(OPTIONEXPOCORRECTIONHIGHLIGHTENTRY, defaultPrm.expoCorrectionHighlight); 1224 } 1225 1226 void DRawDecoderWidget::writeSettings(const DRawDecoderSettings& prm, KConfigGroup& group) 1227 { 1228 group.writeEntry(OPTIONFIXCOLORSHIGHLIGHTSENTRY, prm.fixColorsHighlights); 1229 group.writeEntry(OPTIONDECODESIXTEENBITENTRY, prm.sixteenBitsImage); 1230 group.writeEntry(OPTIONWHITEBALANCEENTRY, (int)prm.whiteBalance); 1231 group.writeEntry(OPTIONCUSTOMWHITEBALANCEENTRY, prm.customWhiteBalance); 1232 group.writeEntry(OPTIONCUSTOMWBGREENENTRY, prm.customWhiteBalanceGreen); 1233 group.writeEntry(OPTIONFOURCOLORRGBENTRY, prm.RGBInterpolate4Colors); 1234 group.writeEntry(OPTIONUNCLIPCOLORSENTRY, prm.unclipColors); 1235 group.writeEntry(OPTIONDONTSTRETCHPIXELSSENTRY, prm.DontStretchPixels); 1236 group.writeEntry(OPTIONNOISEREDUCTIONTYPEENTRY, (int)prm.NRType); 1237 group.writeEntry(OPTIONBRIGHTNESSMULTIPLIERENTRY, prm.brightness); 1238 group.writeEntry(OPTIONUSEBLACKPOINTENTRY, prm.enableBlackPoint); 1239 group.writeEntry(OPTIONBLACKPOINTENTRY, prm.blackPoint); 1240 group.writeEntry(OPTIONUSEWHITEPOINTENTRY, prm.enableWhitePoint); 1241 group.writeEntry(OPTIONWHITEPOINTENTRY, prm.whitePoint); 1242 group.writeEntry(OPTIONMEDIANFILTERPASSESENTRY, prm.medianFilterPasses); 1243 group.writeEntry(OPTIONNOISEREDUCTIONTHRESHOLDENTRY, prm.NRThreshold); 1244 group.writeEntry(OPTIONDECODINGQUALITYENTRY, (int)prm.RAWQuality); 1245 group.writeEntry(OPTIONOUTPUTCOLORSPACEENTRY, (int)prm.outputColorSpace); 1246 group.writeEntry(OPTIONAUTOBRIGHTNESSENTRY, prm.autoBrightness); 1247 1248 //-- Extended demosaicing settings ---------------------------------------------------------- 1249 1250 group.writeEntry(OPTIONDCBITERATIONSENTRY, prm.dcbIterations); 1251 group.writeEntry(OPTIONDCBENHANCEFLENTRY, prm.dcbEnhanceFl); 1252 group.writeEntry(OPTIONEXPOCORRECTIONENTRY, prm.expoCorrection); 1253 group.writeEntry(OPTIONEXPOCORRECTIONSHIFTENTRY, prm.expoCorrectionShift); 1254 group.writeEntry(OPTIONEXPOCORRECTIONHIGHLIGHTENTRY, prm.expoCorrectionHighlight); 1255 } 1256 1257 } // NameSpace Digikam 1258 1259 #include "moc_drawdecoderwidget.cpp"