Krita Source Code Documentation
Loading...
Searching...
No Matches
KisColorSpaceConversionDialog.cpp
Go to the documentation of this file.
1/*
2 * KisColorSpaceConversionDialog.cpp - part of KimageShop^WKrayon^WKrita
3 *
4 * SPDX-FileCopyrightText: 2004 Boudewijn Rempt <boud@valdyas.org>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
10
11#include <QRadioButton>
12#include <QCheckBox>
13
14#include <klocalizedstring.h>
15#include <kis_debug.h>
16
17#include "KoColorProfile.h"
18#include "KoColorSpace.h"
19#include "KoID.h"
20
22#include <KisSqueezedComboBox.h>
23
24#include "kis_image.h"
25#include "kis_layer_utils.h"
26
28 const char * name)
29 : KoDialog(parent)
30{
33 setObjectName(name);
34 m_page = new WdgConvertColorSpace(this);
35 Q_CHECK_PTR(m_page);
36 m_page->setObjectName("colorspace_conversion");
37
38 // the warning label is hidden by default!
39 m_page->lblHeadlineWarning->setVisible(false);
40
42 resize(m_page->sizeHint());
43
48
49 connect(this, SIGNAL(okClicked()),
50 this, SLOT(okClicked()));
51
52
53 connect(m_page->colorSpaceSelector, SIGNAL(selectionChanged(bool)), this, SLOT(selectionChanged(bool)));
54 connect(m_page->colorSpaceSelector, SIGNAL(colorSpaceChanged(const KoColorSpace*)), this, SLOT(slotColorSpaceChanged(const KoColorSpace*)));
55
56}
57
58
59
64
66{
67 if (!cs) {
68 return;
69 }
70
71 if (cs->profile()->getEstimatedTRC()[0]==1.0) {
72 //this tries to automatically determine whether optimizations ought to be checked or not.
73 //if the space you're converting from is linear TRC, uncheck.
74 m_page->chkAllowLCMSOptimization->setCheckState(Qt::Unchecked);
75 } else {
76 m_page->chkAllowLCMSOptimization->setCheckState(Qt::Checked);
77 }
78 m_page->colorSpaceSelector->setCurrentColorSpace(cs);
79
80 m_image = entireImage;
81}
82
84{
85 return m_page->colorSpaceSelector->currentColorSpace();
86}
87
92
93KoColorConversionTransformation::ConversionFlags KisColorSpaceConversionDialog::conversionFlags() const
94{
95 KoColorConversionTransformation::ConversionFlags flags = KoColorConversionTransformation::HighQuality;
96
97 if (m_page->chkBlackpointCompensation->isChecked()) flags |= KoColorConversionTransformation::BlackpointCompensation;
98 if (!m_page->chkAllowLCMSOptimization->isChecked()) flags |= KoColorConversionTransformation::NoOptimization;
99
100 return flags;
101}
102
104{
105 //TODO: Figure out how to uncheck when moving TO a linear TRC.
106 Q_UNUSED(valid);
107 enableButtonOk(m_page->colorSpaceSelector->currentColorSpace());
108}
109
110// SLOTS
111
113{
114 accept();
115}
116
118{
119 if (m_image &&
120 *m_image->profile() != *cs->profile() &&
122
123 m_page->wdgWarningNotice->setVisible(true);
124 m_page->wdgWarningNotice->setText(
125 m_page->wdgWarningNotice->changeImageProfileWarningText());
126 } else {
127 m_page->wdgWarningNotice->setVisible(false);
128 }
129}
130
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void slotColorSpaceChanged(const KoColorSpace *cs)
KoColorConversionTransformation::Intent conversionIntent() const
KisColorSpaceConversionDialog(QWidget *parent=0, const char *name=0)
void setInitialColorSpace(const KoColorSpace *cs, KisImageSP entireImage)
KoColorConversionTransformation::ConversionFlags conversionFlags() const
const KoColorProfile * profile() const
virtual const KoColorProfile * profile() const =0
A dialog base class with standard buttons and predefined layouts.
Definition KoDialog.h:116
void enableButtonOk(bool state)
Definition KoDialog.cpp:615
void setMainWidget(QWidget *widget)
Definition KoDialog.cpp:354
void setButtons(ButtonCodes buttonMask)
Definition KoDialog.cpp:195
void setDefaultButton(ButtonCode id)
Definition KoDialog.cpp:302
@ Ok
Show Ok button. (this button accept()s the dialog; result set to QDialog::Accepted)
Definition KoDialog.h:127
@ Cancel
Show Cancel-button. (this button reject()s the dialog; result set to QDialog::Rejected)
Definition KoDialog.h:130
bool canChangeImageProfileInvisibly(KisImageSP image)
virtual QVector< qreal > getEstimatedTRC() const =0