Commit 9d9ce380 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Add softproofing section to image properties menu.

Now, the proofing in the image can be changed.

Also fixes that ugly little square problem with the kocoloractionpopup button.

Ref T1238, T2337
parent 8d7b4418
...@@ -1597,6 +1597,12 @@ KisImageAnimationInterface* KisImage::animationInterface() const ...@@ -1597,6 +1597,12 @@ KisImageAnimationInterface* KisImage::animationInterface() const
return m_d->animationInterface; return m_d->animationInterface;
} }
void KisImage::setProofingConfiguration(KisProofingConfiguration *proofingConfig)
{
m_d->proofingConfig = proofingConfig;
emit sigProofingConfigChanged();
}
KisProofingConfiguration *KisImage::proofingConfiguration() const KisProofingConfiguration *KisImage::proofingConfiguration() const
{ {
if (!m_d->proofingConfig) { if (!m_d->proofingConfig) {
......
...@@ -563,9 +563,15 @@ public: ...@@ -563,9 +563,15 @@ public:
KisImageAnimationInterface *animationInterface() const; KisImageAnimationInterface *animationInterface() const;
/**
* @brief setProofingConfiguration, this sets the image's proofing configuration, and signals
* the proofingConfiguration has changed.
* @param proofingConfig - the kis proofing config that will be used instead.
*/
void setProofingConfiguration(KisProofingConfiguration *proofingConfig);
/** /**
* @brief proofingConfiguration * @brief proofingConfiguration
* @return * @return the proofing configuration of the image.
*/ */
KisProofingConfiguration *proofingConfiguration() const; KisProofingConfiguration *proofingConfiguration() const;
...@@ -715,6 +721,12 @@ Q_SIGNALS: ...@@ -715,6 +721,12 @@ Q_SIGNALS:
*/ */
void sigNodeCollapsedChanged(); void sigNodeCollapsedChanged();
/**
* Emitted when the proofing configuration of the image is being changed.
*
*/
void sigProofingConfigChanged();
public Q_SLOTS: public Q_SLOTS:
KisCompositeProgressProxy* compositeProgressProxy(); KisCompositeProgressProxy* compositeProgressProxy();
......
...@@ -463,9 +463,9 @@ bool KoColorSpace::proofPixelsTo(const quint8 * src, ...@@ -463,9 +463,9 @@ bool KoColorSpace::proofPixelsTo(const quint8 * src,
} }
if (!d->iccEngine) return false; if (!d->iccEngine) return false;
if (d->proofingSpace!=proofingSpace->name()+dstColorSpace->name() || d->softProofing!=conversionFlags.testFlag(KoColorConversionTransformation::SoftProofing) || d->gamutCheck!=conversionFlags.testFlag(KoColorConversionTransformation::GamutCheck)) { if (d->proofingSpace!=proofingSpace->profile()->name()+dstColorSpace->profile()->name() || d->softProofing!=conversionFlags.testFlag(KoColorConversionTransformation::SoftProofing) || d->gamutCheck!=conversionFlags.testFlag(KoColorConversionTransformation::GamutCheck)) {
d->proofingTransform = d->iccEngine->createColorProofingTransformation(this, dstColorSpace, proofingSpace, renderingIntent, conversionFlags); d->proofingTransform = d->iccEngine->createColorProofingTransformation(this, dstColorSpace, proofingSpace, renderingIntent, conversionFlags);
d->proofingSpace = proofingSpace->name()+dstColorSpace->name(); d->proofingSpace = proofingSpace->profile()->name()+dstColorSpace->profile()->name();
d->softProofing = conversionFlags.testFlag(KoColorConversionTransformation::SoftProofing); d->softProofing = conversionFlags.testFlag(KoColorConversionTransformation::SoftProofing);
d->gamutCheck = conversionFlags.testFlag(KoColorConversionTransformation::GamutCheck); d->gamutCheck = conversionFlags.testFlag(KoColorConversionTransformation::GamutCheck);
} }
......
...@@ -186,7 +186,6 @@ void KisCanvas2::setup() ...@@ -186,7 +186,6 @@ void KisCanvas2::setup()
connect(kritaShapeController, SIGNAL(currentLayerChanged(const KoShapeLayer*)), connect(kritaShapeController, SIGNAL(currentLayerChanged(const KoShapeLayer*)),
globalShapeManager()->selection(), SIGNAL(currentLayerChanged(const KoShapeLayer*))); globalShapeManager()->selection(), SIGNAL(currentLayerChanged(const KoShapeLayer*)));
connect(&m_d->updateSignalCompressor, SIGNAL(timeout()), SLOT(slotDoCanvasUpdate())); connect(&m_d->updateSignalCompressor, SIGNAL(timeout()), SLOT(slotDoCanvasUpdate()));
} }
...@@ -459,6 +458,7 @@ void KisCanvas2::initializeImage() ...@@ -459,6 +458,7 @@ void KisCanvas2::initializeImage()
connect(image, SIGNAL(sigImageUpdated(QRect)), SLOT(startUpdateCanvasProjection(QRect)), Qt::DirectConnection); connect(image, SIGNAL(sigImageUpdated(QRect)), SLOT(startUpdateCanvasProjection(QRect)), Qt::DirectConnection);
connect(this, SIGNAL(sigCanvasCacheUpdated()), SLOT(updateCanvasProjection())); connect(this, SIGNAL(sigCanvasCacheUpdated()), SLOT(updateCanvasProjection()));
connect(image, SIGNAL(sigProofingConfigChanged()), SLOT(slotChangeProofingConfig()));
connect(image, SIGNAL(sigSizeChanged(const QPointF&, const QPointF&)), SLOT(startResizingImage()), Qt::DirectConnection); connect(image, SIGNAL(sigSizeChanged(const QPointF&, const QPointF&)), SLOT(startResizingImage()), Qt::DirectConnection);
connect(this, SIGNAL(sigContinueResizeImage(qint32,qint32)), SLOT(finishResizingImage(qint32,qint32))); connect(this, SIGNAL(sigContinueResizeImage(qint32,qint32)), SLOT(finishResizingImage(qint32,qint32)));
...@@ -590,6 +590,11 @@ void KisCanvas2::slotGamutCheck(bool gamutCheck) ...@@ -590,6 +590,11 @@ void KisCanvas2::slotGamutCheck(bool gamutCheck)
setProofingOptions(m_d->softProofing, m_d->gamutCheck); setProofingOptions(m_d->softProofing, m_d->gamutCheck);
} }
void KisCanvas2::slotChangeProofingConfig()
{
setProofingOptions(m_d->softProofing, m_d->gamutCheck);
}
KisProofingConfiguration *KisCanvas2::proofingConfiguration() const KisProofingConfiguration *KisCanvas2::proofingConfiguration() const
{ {
if (!m_d->proofingConfig) { if (!m_d->proofingConfig) {
......
...@@ -200,6 +200,7 @@ public Q_SLOTS: ...@@ -200,6 +200,7 @@ public Q_SLOTS:
bool yAxisMirrored() const; bool yAxisMirrored() const;
void slotSoftProofing(bool softProofing); void slotSoftProofing(bool softProofing);
void slotGamutCheck(bool gamutCheck); void slotGamutCheck(bool gamutCheck);
void slotChangeProofingConfig();
void channelSelectionChanged(); void channelSelectionChanged();
......
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
#include <KoColorSpace.h> #include <KoColorSpace.h>
#include "KoColorProfile.h" #include "KoColorProfile.h"
#include "KoColorSpaceRegistry.h"
#include "KoColor.h" #include "KoColor.h"
#include "KoColorConversionTransformation.h"
#include "KoColorPopupAction.h" #include "KoColorPopupAction.h"
#include "kis_icon_utils.h" #include "kis_icon_utils.h"
#include "KoID.h" #include "KoID.h"
...@@ -66,9 +68,9 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent, ...@@ -66,9 +68,9 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent,
m_page->lblResolutionValue->setText(QLocale().toString(image->xRes()*72, 2)); // XXX: separate values for x & y? m_page->lblResolutionValue->setText(QLocale().toString(image->xRes()*72, 2)); // XXX: separate values for x & y?
//Set the canvas projection color:
m_defaultColorAction = new KoColorPopupAction(this); m_defaultColorAction = new KoColorPopupAction(this);
m_defaultColorAction->setCurrentColor(m_image->defaultProjectionColor()); m_defaultColorAction->setCurrentColor(m_image->defaultProjectionColor());
m_defaultColorAction->setIcon(KisIconUtils::loadIcon("format-stroke-color"));
m_defaultColorAction->setToolTip(i18n("Change the background color of the image")); m_defaultColorAction->setToolTip(i18n("Change the background color of the image"));
m_page->bnBackgroundColor->setDefaultAction(m_defaultColorAction); m_page->bnBackgroundColor->setDefaultAction(m_defaultColorAction);
...@@ -78,8 +80,32 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent, ...@@ -78,8 +80,32 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent,
connect(m_defaultColorAction, SIGNAL(colorChanged(const KoColor&)), this, SLOT(setCurrentColor())); connect(m_defaultColorAction, SIGNAL(colorChanged(const KoColor&)), this, SLOT(setCurrentColor()));
//Set the color space
m_page->colorSpaceSelector->setCurrentColorSpace(image->colorSpace()); m_page->colorSpaceSelector->setCurrentColorSpace(image->colorSpace());
//set the proofing space
m_proofingConfig = m_image->proofingConfiguration();
m_page->proofSpaceSelector->setCurrentColorSpace(KoColorSpaceRegistry::instance()->colorSpace(m_proofingConfig->proofingModel, m_proofingConfig->proofingDepth,m_proofingConfig->proofingProfile));
m_page->cmbIntent->setCurrentIndex((int)m_proofingConfig->intent);
m_page->ckbBlackPointComp->setChecked(m_proofingConfig->conversionFlags.testFlag(KoColorConversionTransformation::BlackpointCompensation));
m_gamutWarning = new KoColorPopupAction(this);
m_gamutWarning->setCurrentColor(m_proofingConfig->warningColor);
m_gamutWarning->setToolTip(i18n("Set color used for warning"));
m_page->gamutAlarm->setDefaultAction(m_gamutWarning);
KisSignalCompressor *softProofConfigCompressor = new KisSignalCompressor(500, KisSignalCompressor::POSTPONE,this);
connect(m_gamutWarning, SIGNAL(colorChanged(KoColor)), softProofConfigCompressor, SLOT(start()));
connect(m_page->proofSpaceSelector, SIGNAL(colorSpaceChanged(const KoColorSpace*)), softProofConfigCompressor, SLOT(start()));
connect(m_page->cmbIntent, SIGNAL(currentIndexChanged(int)), softProofConfigCompressor, SLOT(start()));
connect(m_page->ckbBlackPointComp, SIGNAL(stateChanged(int)), softProofConfigCompressor, SLOT(start()));
connect(softProofConfigCompressor, SIGNAL(timeout()), this, SLOT(setProofingConfig()));
//annotations
vKisAnnotationSP_it beginIt = image->beginAnnotations(); vKisAnnotationSP_it beginIt = image->beginAnnotations();
vKisAnnotationSP_it endIt = image->endAnnotations(); vKisAnnotationSP_it endIt = image->endAnnotations();
...@@ -115,6 +141,20 @@ void KisDlgImageProperties::setCurrentColor() ...@@ -115,6 +141,20 @@ void KisDlgImageProperties::setCurrentColor()
KisLayerUtils::changeImageDefaultProjectionColor(m_image, m_defaultColorAction->currentKoColor()); KisLayerUtils::changeImageDefaultProjectionColor(m_image, m_defaultColorAction->currentKoColor());
} }
void KisDlgImageProperties::setProofingConfig()
{
m_proofingConfig->conversionFlags = KoColorConversionTransformation::HighQuality;
if (m_page->ckbBlackPointComp) m_proofingConfig->conversionFlags |= KoColorConversionTransformation::BlackpointCompensation;
m_proofingConfig->intent = (KoColorConversionTransformation::Intent)m_page->cmbIntent->currentIndex();
m_proofingConfig->proofingProfile = m_page->proofSpaceSelector->currentColorSpace()->profile()->name();
m_proofingConfig->proofingModel = m_page->proofSpaceSelector->currentColorSpace()->colorModelId().id();
m_proofingConfig->proofingDepth = "U8";//default to this
m_proofingConfig->warningColor = m_gamutWarning->currentKoColor();
qDebug()<<"set proofing config in properties: "<<m_proofingConfig->proofingProfile;
m_image->setProofingConfiguration(m_proofingConfig);
}
void KisDlgImageProperties::setAnnotation(const QString &type) void KisDlgImageProperties::setAnnotation(const QString &type)
{ {
KisAnnotationSP annotation = m_image->annotation(type); KisAnnotationSP annotation = m_image->annotation(type);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#define KIS_DLG_IMAGE_PROPERTIES_H_ #define KIS_DLG_IMAGE_PROPERTIES_H_
#include <KoDialog.h> #include <KoDialog.h>
#include "KisProofingConfiguration.h"
#include <kis_types.h> #include <kis_types.h>
#include "ui_wdgimageproperties.h" #include "ui_wdgimageproperties.h"
...@@ -53,11 +53,14 @@ private Q_SLOTS: ...@@ -53,11 +53,14 @@ private Q_SLOTS:
void setAnnotation(const QString& type); void setAnnotation(const QString& type);
void setCurrentColor(); void setCurrentColor();
void setProofingConfig();
private: private:
WdgImageProperties * m_page; WdgImageProperties * m_page;
KisImageWSP m_image; KisImageWSP m_image;
KoColorPopupAction *m_defaultColorAction; KoColorPopupAction *m_defaultColorAction;
KoColorPopupAction *m_gamutWarning;
KisProofingConfiguration *m_proofingConfig;
}; };
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>448</width> <width>448</width>
<height>340</height> <height>568</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -138,31 +138,6 @@ ...@@ -138,31 +138,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QGroupBox" name="grpMode">
<property name="title">
<string>Mode</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KisColorSpaceSelector" name="colorSpaceSelector"/>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Note:&lt;/span&gt; This changes only the colorspace of the rendered image. To convert the colorspace of the layers, use Convert Image Colorspace.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QGroupBox" name="grpAnnotations"> <widget class="QGroupBox" name="grpAnnotations">
<property name="title"> <property name="title">
...@@ -219,6 +194,103 @@ ...@@ -219,6 +194,103 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="0">
<widget class="QTabWidget" name="grpColorM">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="grpMode" native="true">
<attribute name="title">
<string>Image Color Space</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KisColorSpaceSelector" name="colorSpaceSelector" native="true"/>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Note:&lt;/span&gt; This changes only the colorspace of the rendered image. To convert the colorspace of the layers, use Convert Image Colorspace.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="grpSoftProof">
<attribute name="title">
<string>Softproofing</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="2">
<widget class="QToolButton" name="gamutAlarm">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Gamut Alarm:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="ckbBlackPointComp">
<property name="text">
<string>BlackPoint Compenstation</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Rendering Intent</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="1" column="1">
<widget class="QComboBox" name="cmbIntent">
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>Perceptual</string>
</property>
</item>
<item>
<property name="text">
<string>Relative Colorimetric</string>
</property>
</item>
<item>
<property name="text">
<string>Absolute Colorimetric</string>
</property>
</item>
<item>
<property name="text">
<string>Saturation</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="KisColorSpaceSelector" name="proofSpaceSelector" native="true"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment