177
177
SetupICC::SetupICC(QWidget* parent, KPageDialog* dialog )
178
: QScrollArea(parent), d(new SetupICCPriv)
178
: QScrollArea(parent), d(new SetupICCPriv)
180
180
d->mainDialog = dialog;
181
181
d->tab = new KTabWidget(viewport());
183
183
setWidgetResizable(true);
185
185
d->behaviorPanel = new QWidget;
186
QVBoxLayout *mainLayout = new QVBoxLayout(d->behaviorPanel);
186
QVBoxLayout* mainLayout = new QVBoxLayout(d->behaviorPanel);
188
188
// --------------------------------------------------------
190
QWidget *colorPolicy = new QWidget;
190
QWidget* colorPolicy = new QWidget;
191
191
QGridLayout* gridHeader = new QGridLayout(colorPolicy);
193
193
d->enableColorManagement = new QCheckBox(colorPolicy);
194
194
d->enableColorManagement->setText(i18n("Enable Color Management"));
195
195
d->enableColorManagement->setWhatsThis( i18n("<ul><li>Checked: Color Management is enabled</li>"
196
"<li>Unchecked: Color Management is "
197
"disabled</li></ul>"));
196
"<li>Unchecked: Color Management is "
197
"disabled</li></ul>"));
199
KUrlLabel *lcmsLogoLabel = new KUrlLabel(colorPolicy);
199
KUrlLabel* lcmsLogoLabel = new KUrlLabel(colorPolicy);
200
200
lcmsLogoLabel->setText(QString());
201
201
lcmsLogoLabel->setUrl("http://www.littlecms.com");
202
202
lcmsLogoLabel->setPixmap( QPixmap( KStandardDirs::locate("data", "digikam/data/logo-lcms.png" ) ));
211
211
// --------------------------------------------------------
213
213
d->workspaceGB = new QGroupBox(i18n("Working Color Space"));
214
QHBoxLayout *hboxWS = new QHBoxLayout(d->workspaceGB);
214
QHBoxLayout* hboxWS = new QHBoxLayout(d->workspaceGB);
216
QLabel *workIcon = new QLabel;
216
QLabel* workIcon = new QLabel;
217
217
workIcon->setPixmap(SmallIcon("input-tablet"));
218
218
d->workProfilesKC = new IccProfilesComboBox;
219
219
d->workProfilesKC->setWhatsThis( i18n("<p>This is the color space all the images will be converted to when opened "
232
232
// --------------------------------------------------------
234
234
d->mismatchGB = new QGroupBox;//(i18n("Behavior on Profile Mismatch");
235
QVBoxLayout *vlayMismatch = new QVBoxLayout(d->mismatchGB);
235
QVBoxLayout* vlayMismatch = new QVBoxLayout(d->mismatchGB);
237
QLabel *behaviorIcon = new QLabel;
237
QLabel* behaviorIcon = new QLabel;
238
238
behaviorIcon->setPixmap(SmallIcon("image-loading", KIconLoader::SizeMedium));
239
QLabel *behaviorLabel = new QLabel(i18n("When the profile of an image does not match the working color space"));
239
QLabel* behaviorLabel = new QLabel(i18n("When the profile of an image does not match the working color space"));
240
240
behaviorLabel->setWordWrap(true);
242
QHBoxLayout *hboxBL = new QHBoxLayout;
242
QHBoxLayout* hboxBL = new QHBoxLayout;
243
243
hboxBL->addWidget(behaviorIcon);
244
244
hboxBL->addWidget(behaviorLabel, 10);
246
246
d->defaultAskMismatch = new QRadioButton(d->mismatchGB);
247
247
d->defaultAskMismatch->setText(i18n("Ask when opening the image"));
248
248
d->defaultAskMismatch->setWhatsThis(i18n("<p>If an image has an embedded color profile not matching the working "
249
"space profile, digiKam will ask if you want to convert to the working space, "
250
"keep the embedded profile or discard the embedded profile and assign "
251
"a different one.</p>"));
249
"space profile, digiKam will ask if you want to convert to the working space, "
250
"keep the embedded profile or discard the embedded profile and assign "
251
"a different one.</p>"));
253
253
d->defaultConvertMismatch = new QRadioButton(d->mismatchGB);
254
254
d->defaultConvertMismatch->setText(i18n("Convert the image to the working color space"));
255
255
d->defaultConvertMismatch->setWhatsThis(i18n("<p>If an image has an embedded color profile not matching the working "
256
"space profile, digiKam will convert the image's color information to "
257
"the working color space. This changes the pixel data, but not the "
258
"appearance of the image.</p>"));
256
"space profile, digiKam will convert the image's color information to "
257
"the working color space. This changes the pixel data, but not the "
258
"appearance of the image.</p>"));
260
260
vlayMismatch->addLayout(hboxBL);
261
261
vlayMismatch->addWidget(d->defaultAskMismatch);
264
264
// --------------------------------------------------------
266
266
d->missingGB = new QGroupBox;//(i18n("Missing Profile Behavior"));
267
QVBoxLayout *vlayMissing = new QVBoxLayout(d->missingGB);
267
QVBoxLayout* vlayMissing = new QVBoxLayout(d->missingGB);
269
QLabel *missingIcon = new QLabel;
269
QLabel* missingIcon = new QLabel;
270
270
missingIcon->setPixmap(SmallIcon("image-missing", KIconLoader::SizeMedium));
271
QLabel *missingLabel = new QLabel(i18n("When an image has no color profile information"));
271
QLabel* missingLabel = new QLabel(i18n("When an image has no color profile information"));
272
272
missingLabel->setWordWrap(true);
274
QHBoxLayout *hboxMP = new QHBoxLayout;
274
QHBoxLayout* hboxMP = new QHBoxLayout;
275
275
hboxMP->addWidget(missingIcon);
276
276
hboxMP->addWidget(missingLabel, 10);
292
292
d->defaultSRGBConvert->setChecked(true);
294
QGridLayout *gridRgb = new QGridLayout;
294
QGridLayout* gridRgb = new QGridLayout;
295
295
gridRgb->addWidget(d->defaultSRGBMissing, 0, 0, 1, 2);
296
296
gridRgb->addWidget(d->defaultSRGBConvert, 1, 1);
297
297
gridRgb->setColumnMinimumWidth(0, 10);
315
315
// --------------------------------------------------------
317
317
d->rawGB = new QGroupBox;//(i18n("Raw File Behavior"));
318
QVBoxLayout *vlayRaw = new QVBoxLayout(d->rawGB);
318
QVBoxLayout* vlayRaw = new QVBoxLayout(d->rawGB);
320
QLabel *rawBehaviorIcon = new QLabel;
320
QLabel* rawBehaviorIcon = new QLabel;
321
321
rawBehaviorIcon->setPixmap(SmallIcon("kdcraw", KIconLoader::SizeMedium));
322
QLabel *rawBehaviorLabel = new QLabel(i18n("When loading a RAW file with uncalibrated colors"));
322
QLabel* rawBehaviorLabel = new QLabel(i18n("When loading a RAW file with uncalibrated colors"));
323
323
rawBehaviorLabel->setWordWrap(true);
325
QHBoxLayout *hboxRF = new QHBoxLayout;
325
QHBoxLayout* hboxRF = new QHBoxLayout;
326
326
hboxRF->addWidget(rawBehaviorIcon);
327
327
hboxRF->addWidget(rawBehaviorLabel, 10);
359
359
// --------------------------------------------------------
361
361
d->profilesPanel = new QWidget;
362
QVBoxLayout *vboxDisplay = new QVBoxLayout(d->profilesPanel);
362
QVBoxLayout* vboxDisplay = new QVBoxLayout(d->profilesPanel);
363
363
d->viewGB = new QGroupBox(i18n("Color Managed View"));
364
364
QGridLayout* gridView = new QGridLayout(d->viewGB);
366
QLabel *monitorIcon = new QLabel;
366
QLabel* monitorIcon = new QLabel;
367
367
monitorIcon->setPixmap(SmallIcon("video-display", KIconLoader::SizeMedium));
368
QLabel *monitorProfiles = new QLabel(i18n("Monitor profile:"));
368
QLabel* monitorProfiles = new QLabel(i18n("Monitor profile:"));
370
370
d->monitorProfilesKC = new IccProfilesComboBox;
371
371
monitorProfiles->setBuddy(d->monitorProfilesKC);
374
374
d->infoMonitorProfiles = new QPushButton;
375
375
d->infoMonitorProfiles->setIcon(SmallIcon("dialog-information"));
376
376
d->infoMonitorProfiles->setWhatsThis(i18n("<p>You can use this button to get more detailed "
377
"information about the selected monitor profile.</p>"));
377
"information about the selected monitor profile.</p>"));
379
379
d->managedView = new QCheckBox;
380
380
d->managedView->setText(i18n("Use color managed view in editor"));
401
401
// --------------------------------------------------------
403
403
d->inputGB = new QGroupBox(i18n("Camera and Scanner"));
404
QGridLayout *gridIP = new QGridLayout(d->inputGB);
404
QGridLayout* gridIP = new QGridLayout(d->inputGB);
406
QLabel *inputIcon = new QLabel;
406
QLabel* inputIcon = new QLabel;
407
407
inputIcon->setPixmap(SmallIcon("input-tablet", KIconLoader::SizeMedium));
408
QLabel *inputLabel = new QLabel(i18n("Default input color profile:"));
408
QLabel* inputLabel = new QLabel(i18n("Default input color profile:"));
409
409
d->inProfilesKC = new IccProfilesComboBox;
410
410
d->inProfilesKC->setWhatsThis(i18n("<p>This is the default color profile for your input device "
411
411
"(that is your camera - or your scanner). A camera input profile "
426
426
// --------------------------------------------------------
428
428
d->proofGB = new QGroupBox(i18n("Printing and Proofing"));
429
QGridLayout *gridProof = new QGridLayout(d->proofGB);
429
QGridLayout* gridProof = new QGridLayout(d->proofGB);
431
QLabel *proofIcon = new QLabel;
431
QLabel* proofIcon = new QLabel;
432
432
proofIcon->setPixmap(SmallIcon("printer", KIconLoader::SizeMedium));
433
QLabel *proofLabel = new QLabel(i18n("Output device profile:"));
433
QLabel* proofLabel = new QLabel(i18n("Output device profile:"));
434
434
d->proofProfilesKC = new IccProfilesComboBox;
435
435
proofLabel->setBuddy(d->proofProfilesKC);
436
436
d->proofProfilesKC->setWhatsThis(i18n("<p>Select the profile for your output device "
451
451
// --------------------------------------------------------
453
453
d->iccFolderGB = new QGroupBox(i18n("Color Profiles Repository"));
454
QGridLayout *gridIccFolder = new QGridLayout(d->iccFolderGB);
454
QGridLayout* gridIccFolder = new QGridLayout(d->iccFolderGB);
456
QLabel *iccFolderIcon = new QLabel;
456
QLabel* iccFolderIcon = new QLabel;
457
457
iccFolderIcon->setPixmap(SmallIcon("folder-downloads", KIconLoader::SizeMedium));
458
458
d->iccFolderLabel = new QLabel(i18n("digiKam looks for ICC profiles in a number of <a href='default'>default locations</a>. "
459
459
"You can specify an additional folder:"));
481
481
// --------------------------------------------------------
483
483
d->advancedPanel = new QWidget;
484
QVBoxLayout *vboxAdvanced = new QVBoxLayout(d->advancedPanel);
484
QVBoxLayout* vboxAdvanced = new QVBoxLayout(d->advancedPanel);
485
485
d->advancedSettingsGB = new QGroupBox(i18n("Advanced Settings"));
486
486
QGridLayout* gridAdvanced = new QGridLayout(d->advancedSettingsGB);
492
492
"black levels of digital files and the black capabilities of various "
493
493
"digital devices.</p>"));
495
QLabel *lablel = new QLabel(d->advancedSettingsGB);
495
QLabel* lablel = new QLabel(d->advancedSettingsGB);
496
496
lablel->setText(i18n("Rendering Intents:"));
498
498
d->renderingIntentKC = new IccRenderingIntentComboBox(d->advancedSettingsGB);
580
580
settings.enableCM = d->enableColorManagement->isChecked();
582
582
if (d->defaultAskMismatch->isChecked())
583
584
settings.defaultMismatchBehavior = ICCSettingsContainer::AskUser;
584
586
else if (d->defaultConvertMismatch->isChecked())
585
588
settings.defaultMismatchBehavior = ICCSettingsContainer::EmbeddedToWorkspace;
587
591
if (d->defaultAskMissing->isChecked())
593
597
settings.defaultMissingProfileBehavior = ICCSettingsContainer::UseSRGB;
595
599
if (d->defaultSRGBConvert->isChecked())
596
601
settings.defaultMissingProfileBehavior |= ICCSettingsContainer::ConvertToWorkspace;
598
605
settings.defaultMissingProfileBehavior |= ICCSettingsContainer::KeepProfile;
600
608
else if (d->defaultWSMissing->isChecked())
609
617
if (d->defaultAskRaw->isChecked())
610
619
settings.defaultUncalibratedBehavior = ICCSettingsContainer::AskUser;
611
621
else if (d->defaultInputRaw->isChecked())
612
623
settings.defaultUncalibratedBehavior = ICCSettingsContainer::InputToWorkspace;
613
625
else if (d->defaultGuessRaw->isChecked())
614
627
settings.defaultUncalibratedBehavior = ICCSettingsContainer::AutomaticColors | ICCSettingsContainer::ConvertToWorkspace;
616
630
settings.iccFolder = d->defaultPathKU->url().toLocalFile();
617
631
settings.useBPC = d->bpcAlgorithm->isChecked();
642
660
d->managedPreviews->setChecked(settings.useManagedPreviews);
644
662
if (settings.defaultMismatchBehavior & ICCSettingsContainer::AskUser)
645
664
d->defaultAskMismatch->setChecked(true);
646
666
else if (settings.defaultMismatchBehavior & ICCSettingsContainer::ConvertToWorkspace)
647
668
d->defaultConvertMismatch->setChecked(true);
649
671
if (settings.defaultMissingProfileBehavior & ICCSettingsContainer::AskUser)
670
692
if (settings.defaultUncalibratedBehavior & ICCSettingsContainer::AskUser)
671
694
d->defaultAskRaw->setChecked(true);
672
696
else if (settings.defaultUncalibratedBehavior & ICCSettingsContainer::UseDefaultInputProfile)
673
698
d->defaultInputRaw->setChecked(true);
674
700
else if (settings.defaultUncalibratedBehavior & ICCSettingsContainer::AutomaticColors)
675
702
d->defaultGuessRaw->setChecked(true);
677
705
d->defaultPathKU->setUrl(settings.iccFolder);
678
706
fillCombos(false);
781
811
void SetupICC::slotClickedWork()
783
813
IccProfile profile = d->workProfilesKC->currentProfile();
784
815
if (!profile.isNull())
785
profileInfo(profile);
817
profileInfo(profile);
788
821
void SetupICC::slotClickedIn()
790
823
IccProfile profile = d->inProfilesKC->currentProfile();
791
825
if (!profile.isNull())
792
profileInfo(profile);
827
profileInfo(profile);
795
831
void SetupICC::slotClickedMonitor()
797
833
IccProfile profile;
798
835
if (IccSettings::instance()->monitorProfileFromSystem())
799
837
profile = IccSettings::instance()->monitorProfile();
801
841
profile = d->monitorProfilesKC->currentProfile();
802
844
if (!profile.isNull())
803
profileInfo(profile);
846
profileInfo(profile);
806
850
void SetupICC::slotClickedProof()
808
852
IccProfile profile = d->proofProfilesKC->currentProfile();
809
854
if (!profile.isNull())
810
profileInfo(profile);
856
profileInfo(profile);
813
860
void SetupICC::profileInfo(const IccProfile& profile)
835
885
QString existingPaths;
837
887
if (defaultSearchPaths.isEmpty())
838
889
existingPaths = i18nc("none of the paths", "none");
840
893
existingPaths = defaultSearchPaths.join("</li><li>");
842
896
QString text = i18n("On Linux, the default search paths include "
863
917
// If color management is disable, no need to check anymore.
864
918
if (!group.readEntry("EnableCM", false))
867
923
// can at least libkdcraw profiles be opened?
868
924
if (IccProfile::sRGB().open())
871
929
// To be valid, the ICC profiles repository must exist and be readable.
872
930
QString extraPath = group.readEntry("DefaultPath", QString());
873
931
QFileInfo info(extraPath);
874
933
if (info.isDir() && info.exists() && info.isReadable())
877
938
QStringList paths = IccProfile::defaultSearchPaths();
878
939
return !paths.isEmpty();