~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to utilities/setup/setupicc.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-21 23:19:11 UTC
  • mfrom: (1.2.33 upstream) (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20101221231911-z9jip7s5aht1jqn9
Tags: 2:1.7.0-1ubuntu1
* Merge from Debian Experimental. Remaining Ubuntu changes:
  - Export .pot name and copy to plugins in debian/rules
  - Version build-depends on kipi-plugins-dev to ensure build is against the
    same version on all archs
* Drop debian/patches/kubuntu_01_linker.diff, incoporated upstream
* Remove patches directory and unused patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
{
83
83
public:
84
84
 
85
 
     SetupICCPriv() :
 
85
    SetupICCPriv() :
86
86
        iccFolderLabel(0),
87
87
        enableColorManagement(0),
88
88
        defaultSRGBConvert(0),
122
122
        workProfilesKC(0),
123
123
        proofProfilesKC(0),
124
124
        monitorProfilesKC(0)
125
 
     {
126
 
     }
 
125
    {
 
126
    }
127
127
 
128
128
    QLabel*                     iccFolderLabel;
129
129
 
175
175
};
176
176
 
177
177
SetupICC::SetupICC(QWidget* parent, KPageDialog* dialog )
178
 
        : QScrollArea(parent), d(new SetupICCPriv)
 
178
    : QScrollArea(parent), d(new SetupICCPriv)
179
179
{
180
180
    d->mainDialog = dialog;
181
181
    d->tab        = new KTabWidget(viewport());
183
183
    setWidgetResizable(true);
184
184
 
185
185
    d->behaviorPanel        = new QWidget;
186
 
    QVBoxLayout *mainLayout = new QVBoxLayout(d->behaviorPanel);
 
186
    QVBoxLayout* mainLayout = new QVBoxLayout(d->behaviorPanel);
187
187
 
188
188
    // --------------------------------------------------------
189
189
 
190
 
    QWidget *colorPolicy    = new QWidget;
 
190
    QWidget* colorPolicy    = new QWidget;
191
191
    QGridLayout* gridHeader = new QGridLayout(colorPolicy);
192
192
 
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>"));
198
198
 
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
    // --------------------------------------------------------
212
212
 
213
213
    d->workspaceGB       = new QGroupBox(i18n("Working Color Space"));
214
 
    QHBoxLayout *hboxWS  = new QHBoxLayout(d->workspaceGB);
 
214
    QHBoxLayout* hboxWS  = new QHBoxLayout(d->workspaceGB);
215
215
 
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
    // --------------------------------------------------------
233
233
 
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);
236
236
 
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);
241
241
 
242
 
    QHBoxLayout *hboxBL   = new QHBoxLayout;
 
242
    QHBoxLayout* hboxBL   = new QHBoxLayout;
243
243
    hboxBL->addWidget(behaviorIcon);
244
244
    hboxBL->addWidget(behaviorLabel, 10);
245
245
 
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>"));
252
252
 
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>"));
259
259
 
260
260
    vlayMismatch->addLayout(hboxBL);
261
261
    vlayMismatch->addWidget(d->defaultAskMismatch);
264
264
    // --------------------------------------------------------
265
265
 
266
266
    d->missingGB             = new QGroupBox;//(i18n("Missing Profile Behavior"));
267
 
    QVBoxLayout *vlayMissing = new QVBoxLayout(d->missingGB);
 
267
    QVBoxLayout* vlayMissing = new QVBoxLayout(d->missingGB);
268
268
 
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);
273
273
 
274
 
    QHBoxLayout *hboxMP  = new QHBoxLayout;
 
274
    QHBoxLayout* hboxMP  = new QHBoxLayout;
275
275
    hboxMP->addWidget(missingIcon);
276
276
    hboxMP->addWidget(missingLabel, 10);
277
277
 
291
291
     */
292
292
    d->defaultSRGBConvert->setChecked(true);
293
293
 
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
    // --------------------------------------------------------
316
316
 
317
317
    d->rawGB                 = new QGroupBox;//(i18n("Raw File Behavior"));
318
 
    QVBoxLayout *vlayRaw     = new QVBoxLayout(d->rawGB);
 
318
    QVBoxLayout* vlayRaw     = new QVBoxLayout(d->rawGB);
319
319
 
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);
324
324
 
325
 
    QHBoxLayout *hboxRF = new QHBoxLayout;
 
325
    QHBoxLayout* hboxRF = new QHBoxLayout;
326
326
    hboxRF->addWidget(rawBehaviorIcon);
327
327
    hboxRF->addWidget(rawBehaviorLabel, 10);
328
328
 
359
359
    // --------------------------------------------------------
360
360
 
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);
365
365
 
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:"));
369
369
 
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>"));
378
378
 
379
379
    d->managedView     = new QCheckBox;
380
380
    d->managedView->setText(i18n("Use color managed view in editor"));
401
401
    // --------------------------------------------------------
402
402
 
403
403
    d->inputGB           = new QGroupBox(i18n("Camera and Scanner"));
404
 
    QGridLayout *gridIP  = new QGridLayout(d->inputGB);
 
404
    QGridLayout* gridIP  = new QGridLayout(d->inputGB);
405
405
 
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
    // --------------------------------------------------------
427
427
 
428
428
    d->proofGB             = new QGroupBox(i18n("Printing and Proofing"));
429
 
    QGridLayout *gridProof = new QGridLayout(d->proofGB);
 
429
    QGridLayout* gridProof = new QGridLayout(d->proofGB);
430
430
 
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
    // --------------------------------------------------------
452
452
 
453
453
    d->iccFolderGB             = new QGroupBox(i18n("Color Profiles Repository"));
454
 
    QGridLayout *gridIccFolder = new QGridLayout(d->iccFolderGB);
 
454
    QGridLayout* gridIccFolder = new QGridLayout(d->iccFolderGB);
455
455
 
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
    // --------------------------------------------------------
482
482
 
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);
487
487
 
492
492
                                       "black levels of digital files and the black capabilities of various "
493
493
                                       "digital devices.</p>"));
494
494
 
495
 
    QLabel *lablel = new QLabel(d->advancedSettingsGB);
 
495
    QLabel* lablel = new QLabel(d->advancedSettingsGB);
496
496
    lablel->setText(i18n("Rendering Intents:"));
497
497
 
498
498
    d->renderingIntentKC = new IccRenderingIntentComboBox(d->advancedSettingsGB);
580
580
    settings.enableCM = d->enableColorManagement->isChecked();
581
581
 
582
582
    if (d->defaultAskMismatch->isChecked())
 
583
    {
583
584
        settings.defaultMismatchBehavior = ICCSettingsContainer::AskUser;
 
585
    }
584
586
    else if (d->defaultConvertMismatch->isChecked())
 
587
    {
585
588
        settings.defaultMismatchBehavior = ICCSettingsContainer::EmbeddedToWorkspace;
 
589
    }
586
590
 
587
591
    if (d->defaultAskMissing->isChecked())
588
592
    {
593
597
        settings.defaultMissingProfileBehavior = ICCSettingsContainer::UseSRGB;
594
598
 
595
599
        if (d->defaultSRGBConvert->isChecked())
 
600
        {
596
601
            settings.defaultMissingProfileBehavior |= ICCSettingsContainer::ConvertToWorkspace;
 
602
        }
597
603
        else
 
604
        {
598
605
            settings.defaultMissingProfileBehavior |= ICCSettingsContainer::KeepProfile;
 
606
        }
599
607
    }
600
608
    else if (d->defaultWSMissing->isChecked())
601
609
    {
607
615
    }
608
616
 
609
617
    if (d->defaultAskRaw->isChecked())
 
618
    {
610
619
        settings.defaultUncalibratedBehavior = ICCSettingsContainer::AskUser;
 
620
    }
611
621
    else if (d->defaultInputRaw->isChecked())
 
622
    {
612
623
        settings.defaultUncalibratedBehavior = ICCSettingsContainer::InputToWorkspace;
 
624
    }
613
625
    else if (d->defaultGuessRaw->isChecked())
 
626
    {
614
627
        settings.defaultUncalibratedBehavior = ICCSettingsContainer::AutomaticColors | ICCSettingsContainer::ConvertToWorkspace;
 
628
    }
615
629
 
616
630
    settings.iccFolder          = d->defaultPathKU->url().toLocalFile();
617
631
    settings.useBPC             = d->bpcAlgorithm->isChecked();
624
638
    settings.defaultProofProfile = d->proofProfilesKC->currentProfile().filePath();
625
639
 
626
640
    if (!IccSettings::instance()->monitorProfileFromSystem())
 
641
    {
627
642
        settings.monitorProfile = d->monitorProfilesKC->currentProfile().filePath();
 
643
    }
628
644
 
629
645
    IccSettings::instance()->setSettings(settings);
630
646
}
634
650
    ICCSettingsContainer settings = IccSettings::instance()->settings();
635
651
 
636
652
    if (!restore)
 
653
    {
637
654
        d->enableColorManagement->setChecked(settings.enableCM);
 
655
    }
638
656
 
639
657
    d->bpcAlgorithm->setChecked(settings.useBPC);
640
658
    d->renderingIntentKC->setIntent(settings.renderingIntent);
642
660
    d->managedPreviews->setChecked(settings.useManagedPreviews);
643
661
 
644
662
    if (settings.defaultMismatchBehavior & ICCSettingsContainer::AskUser)
 
663
    {
645
664
        d->defaultAskMismatch->setChecked(true);
 
665
    }
646
666
    else if (settings.defaultMismatchBehavior & ICCSettingsContainer::ConvertToWorkspace)
 
667
    {
647
668
        d->defaultConvertMismatch->setChecked(true);
 
669
    }
648
670
 
649
671
    if (settings.defaultMissingProfileBehavior & ICCSettingsContainer::AskUser)
650
672
    {
668
690
    }
669
691
 
670
692
    if (settings.defaultUncalibratedBehavior & ICCSettingsContainer::AskUser)
 
693
    {
671
694
        d->defaultAskRaw->setChecked(true);
 
695
    }
672
696
    else if (settings.defaultUncalibratedBehavior & ICCSettingsContainer::UseDefaultInputProfile)
 
697
    {
673
698
        d->defaultInputRaw->setChecked(true);
 
699
    }
674
700
    else if (settings.defaultUncalibratedBehavior & ICCSettingsContainer::AutomaticColors)
 
701
    {
675
702
        d->defaultGuessRaw->setChecked(true);
 
703
    }
676
704
 
677
705
    d->defaultPathKU->setUrl(settings.iccFolder);
678
706
    fillCombos(false);
701
729
void SetupICC::fillCombos(bool report)
702
730
{
703
731
    if (!d->enableColorManagement->isChecked())
 
732
    {
704
733
        return;
 
734
    }
705
735
 
706
736
    QList<IccProfile> profiles = IccSettings::instance()->allProfiles();
707
737
 
781
811
void SetupICC::slotClickedWork()
782
812
{
783
813
    IccProfile profile = d->workProfilesKC->currentProfile();
 
814
 
784
815
    if (!profile.isNull())
785
 
       profileInfo(profile);
 
816
    {
 
817
        profileInfo(profile);
 
818
    }
786
819
}
787
820
 
788
821
void SetupICC::slotClickedIn()
789
822
{
790
823
    IccProfile profile = d->inProfilesKC->currentProfile();
 
824
 
791
825
    if (!profile.isNull())
792
 
       profileInfo(profile);
 
826
    {
 
827
        profileInfo(profile);
 
828
    }
793
829
}
794
830
 
795
831
void SetupICC::slotClickedMonitor()
796
832
{
797
833
    IccProfile profile;
 
834
 
798
835
    if (IccSettings::instance()->monitorProfileFromSystem())
 
836
    {
799
837
        profile = IccSettings::instance()->monitorProfile();
 
838
    }
800
839
    else
 
840
    {
801
841
        profile = d->monitorProfilesKC->currentProfile();
 
842
    }
 
843
 
802
844
    if (!profile.isNull())
803
 
       profileInfo(profile);
 
845
    {
 
846
        profileInfo(profile);
 
847
    }
804
848
}
805
849
 
806
850
void SetupICC::slotClickedProof()
807
851
{
808
852
    IccProfile profile = d->proofProfilesKC->currentProfile();
 
853
 
809
854
    if (!profile.isNull())
810
 
       profileInfo(profile);
 
855
    {
 
856
        profileInfo(profile);
 
857
    }
811
858
}
812
859
 
813
860
void SetupICC::profileInfo(const IccProfile& profile)
825
872
void SetupICC::slotMissingToggled(bool on)
826
873
{
827
874
    if (!on)
 
875
    {
828
876
        return;
 
877
    }
 
878
 
829
879
    d->defaultSRGBConvert->setEnabled(d->defaultSRGBMissing->isChecked());
830
880
}
831
881
 
835
885
    QString existingPaths;
836
886
 
837
887
    if (defaultSearchPaths.isEmpty())
 
888
    {
838
889
        existingPaths = i18nc("none of the paths", "none");
 
890
    }
839
891
    else
 
892
    {
840
893
        existingPaths = defaultSearchPaths.join("</li><li>");
 
894
    }
841
895
 
842
896
    QString text = i18n("On Linux, the default search paths include "
843
897
                        "<ul>"
862
916
 
863
917
    // If color management is disable, no need to check anymore.
864
918
    if (!group.readEntry("EnableCM", false))
 
919
    {
865
920
        return true;
 
921
    }
866
922
 
867
923
    // can at least libkdcraw profiles be opened?
868
924
    if (IccProfile::sRGB().open())
 
925
    {
869
926
        return true;
 
927
    }
870
928
 
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);
 
932
 
874
933
    if (info.isDir() && info.exists() && info.isReadable())
 
934
    {
875
935
        return true;
 
936
    }
876
937
 
877
938
    QStringList paths = IccProfile::defaultSearchPaths();
878
939
    return !paths.isEmpty();