Commit 519f9c1f authored by Wolthera van Hövell's avatar Wolthera van Hövell 🐛

Add option to set default Proofing Options.

These will work for images with no proofing options, so, old loaded images
and new images. With this it is feature complete, and people can start testing.

Ref T2337
Ref T1238
parent 062db74d
......@@ -1606,7 +1606,8 @@ void KisImage::setProofingConfiguration(KisProofingConfiguration *proofingConfig
KisProofingConfiguration *KisImage::proofingConfiguration() const
{
if (!m_d->proofingConfig) {
m_d->proofingConfig = new KisProofingConfiguration();
KisImageConfig cfg;
m_d->proofingConfig = cfg.defaultProofingconfiguration();
}
return m_d->proofingConfig;
}
......@@ -21,6 +21,8 @@
#include <ksharedconfig.h>
#include <KoConfig.h>
#include <KoColorProfile.h>
#include <KoColorConversionTransformation.h>
#include "kis_debug.h"
......@@ -394,3 +396,35 @@ void KisImageConfig::setShowAdditionalOnionSkinsSettings(bool value)
{
m_config.writeEntry("showAdditionalOnionSkinsSettings", value);
}
KisProofingConfiguration *KisImageConfig::defaultProofingconfiguration()
{
KisProofingConfiguration *proofingConfig= new KisProofingConfiguration();
proofingConfig->proofingProfile = m_config.readEntry("defaultProofingProfileName", "Chemical proof");
proofingConfig->proofingModel = m_config.readEntry("defaultProofingProfileModel", "CMYKA");
proofingConfig->proofingDepth = m_config.readEntry("defaultProofingProfileDepth", "U8");
proofingConfig->intent = (KoColorConversionTransformation::Intent)m_config.readEntry("defaultProofingProfileIntent", 4);
if (m_config.readEntry("defaultProofingBlackpointCompensation", true)) {
proofingConfig->conversionFlags |= KoColorConversionTransformation::ConversionFlag::BlackpointCompensation;
} else {
proofingConfig->conversionFlags = proofingConfig->conversionFlags & ~KoColorConversionTransformation::ConversionFlag::BlackpointCompensation;
}
QColor def;
def = m_config.readEntry("defaultProofingGamutwarning", QColor(Qt::gray));
KoColor col;
col.fromQColor(def);
proofingConfig->warningColor = col;
return proofingConfig;
}
void KisImageConfig::setDefaultProofingConfig(const KoColorSpace *proofingSpace, int proofingIntent, bool blackPointCompensation, KoColor warningColor)
{
m_config.writeEntry("defaultProofingProfileName", proofingSpace->profile()->name());
m_config.writeEntry("defaultProofingProfileModel", proofingSpace->colorModelId().id());
m_config.writeEntry("defaultProofingProfileDepth", proofingSpace->colorDepthId().id());
m_config.writeEntry("defaultProofingProfileIntent", proofingIntent);
m_config.writeEntry("defaultProofingBlackpointCompensation", blackPointCompensation);
QColor c;
warningColor.toQColor(&c);
m_config.writeEntry("defaultProofingGamutwarning", c);
}
......@@ -21,6 +21,7 @@
#include <kconfiggroup.h>
#include "kritaimage_export.h"
#include "KisProofingConfiguration.h"
class KRITAIMAGE_EXPORT KisImageConfig
......@@ -101,6 +102,10 @@ public:
bool showAdditionalOnionSkinsSettings(bool requestDefault = false) const;
void setShowAdditionalOnionSkinsSettings(bool value);
KisProofingConfiguration *defaultProofingconfiguration();
void setDefaultProofingConfig(const KoColorSpace *proofingSpace, int proofingIntent, bool blackPointCompensation, KoColor warningColor);
private:
Q_DISABLE_COPY(KisImageConfig)
......
......@@ -556,7 +556,8 @@ void KisCanvas2::setProofingOptions(bool softProof, bool gamutCheck)
m_d->proofingConfig = this->image()->proofingConfiguration();
if (!m_d->proofingConfig) {
qDebug()<<"Canvas: No proofing config found, generating one.";
m_d->proofingConfig = new KisProofingConfiguration();
KisImageConfig cfg;
m_d->proofingConfig = cfg.defaultProofingconfiguration();
}
KoColorConversionTransformation::ConversionFlags conversionFlags = m_d->proofingConfig->conversionFlags;
......@@ -610,7 +611,8 @@ KisProofingConfiguration *KisCanvas2::proofingConfiguration() const
m_d->proofingConfig = this->image()->proofingConfiguration();
if (!m_d->proofingConfig) {
qDebug()<<"Canvas: No proofing config found, generating one.";
m_d->proofingConfig = new KisProofingConfiguration();
KisImageConfig cfg;
m_d->proofingConfig = cfg.defaultProofingconfiguration();
}
}
return m_d->proofingConfig;
......
......@@ -64,11 +64,14 @@
#include "widgets/kis_cmb_idlist.h"
#include "KoColorSpace.h"
#include "KoColorSpaceRegistry.h"
#include "KoColorConversionTransformation.h"
#include "kis_cursor.h"
#include "kis_config.h"
#include "kis_canvas_resource_provider.h"
#include "kis_preference_set_registry.h"
#include "kis_color_manager.h"
#include "KisProofingConfiguration.h"
#include "kis_image_config.h"
#include "slider_and_spin_box_sync.h"
......@@ -309,18 +312,10 @@ ColorSettingsTab::ColorSettingsTab(QWidget *parent, const char *name)
m_page->cmbWorkingColorSpace->setIDList(KoColorSpaceRegistry::instance()->listKeys());
m_page->cmbWorkingColorSpace->setCurrent(cfg.workingColorSpace());
m_page->cmbPrintingColorSpace->setIDList(KoColorSpaceRegistry::instance()->listKeys());
m_page->cmbPrintingColorSpace->setCurrent(cfg.printerColorSpace());
m_page->bnAddColorProfile->setIcon(KisIconUtils::loadIcon("document-open"));
m_page->bnAddColorProfile->setToolTip( i18n("Open Color Profile") );
connect(m_page->bnAddColorProfile, SIGNAL(clicked()), SLOT(installProfile()));
refillPrintProfiles(KoID(cfg.printerColorSpace(), ""));
//hide printing settings
m_page->groupBox2->hide();
QGridLayout *monitorProfileGrid = new QGridLayout(m_page->monitorprofileholder);
for(int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
QLabel *lbl = new QLabel(i18nc("The number of the screen", "Screen %1:", i + 1));
......@@ -339,12 +334,23 @@ ColorSettingsTab::ColorSettingsTab(QWidget *parent, const char *name)
}
}
if (m_page->cmbPrintProfile->contains(cfg.printerProfile()))
m_page->cmbPrintProfile->setCurrentIndex(m_page->cmbPrintProfile->findText(cfg.printerProfile()));
m_page->chkBlackpoint->setChecked(cfg.useBlackPointCompensation());
m_page->chkAllowLCMSOptimization->setChecked(cfg.allowLCMSOptimization());
KisImageConfig cfgImage;
KisProofingConfiguration *proofingConfig = cfgImage.defaultProofingconfiguration();
m_gamutWarning = new KoColorPopupAction(this);
m_gamutWarning->setToolTip(i18n("Set default color used for out of Gamut Warning"));
m_gamutWarning->setCurrentColor(proofingConfig->warningColor);
m_page->gamutAlarm->setDefaultAction(m_gamutWarning);
const KoColorSpace *proofingSpace = KoColorSpaceRegistry::instance()->colorSpace(proofingConfig->proofingModel,proofingConfig->proofingDepth,proofingConfig->proofingProfile);
m_page->proofingSpaceSelector->setCurrentColorSpace(proofingSpace);
m_page->cmbProofingIntent->setCurrentIndex((int)proofingConfig->intent);
m_page->ckbProofBlackPoint->setChecked(proofingConfig->conversionFlags.testFlag(KoColorConversionTransformation::BlackpointCompensation));
m_pasteBehaviourGroup.addButton(m_page->radioPasteWeb, PASTE_ASSUME_WEB);
m_pasteBehaviourGroup.addButton(m_page->radioPasteMonitor, PASTE_ASSUME_MONITOR);
m_pasteBehaviourGroup.addButton(m_page->radioPasteAsk, PASTE_ASK);
......@@ -360,8 +366,6 @@ ColorSettingsTab::ColorSettingsTab(QWidget *parent, const char *name)
toggleAllowMonitorProfileSelection(cfg.useSystemMonitorProfile());
connect(m_page->cmbPrintingColorSpace, SIGNAL(activated(const KoID &)),
this, SLOT(refillPrintProfiles(const KoID &)));
}
void ColorSettingsTab::installProfile()
......@@ -389,7 +393,6 @@ void ColorSettingsTab::installProfile()
KisConfig cfg;
refillMonitorProfiles(KoID("RGBA", ""));
refillPrintProfiles(KoID(cfg.printerColorSpace(), ""));
for(int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
if (m_monitorProfileWidgets[i]->contains(cfg.monitorProfile(i))) {
......@@ -397,10 +400,6 @@ void ColorSettingsTab::installProfile()
}
}
if (m_page->cmbPrintProfile->contains(cfg.printerProfile()))
m_page->cmbPrintProfile->setCurrentIndex(m_page->cmbPrintProfile->findText(cfg.printerProfile()));
}
void ColorSettingsTab::toggleAllowMonitorProfileSelection(bool useSystemProfile)
......@@ -438,12 +437,17 @@ void ColorSettingsTab::setDefault()
{
m_page->cmbWorkingColorSpace->setCurrent("RGBA");
m_page->cmbPrintingColorSpace->setCurrent("CMYK");
refillPrintProfiles(KoID("CMYK", ""));
refillMonitorProfiles(KoID("RGBA", ""));
KisConfig cfg;
KisImageConfig cfgImage;
KisProofingConfiguration *proofingConfig = cfgImage.defaultProofingconfiguration();
const KoColorSpace *proofingSpace = KoColorSpaceRegistry::instance()->colorSpace(proofingConfig->proofingModel,proofingConfig->proofingDepth,proofingConfig->proofingProfile);
m_page->proofingSpaceSelector->setCurrentColorSpace(proofingSpace);
m_page->cmbProofingIntent->setCurrentIndex((int)proofingConfig->intent);
m_page->ckbProofBlackPoint->setChecked(proofingConfig->conversionFlags.testFlag(KoColorConversionTransformation::BlackpointCompensation));
m_gamutWarning->setCurrentColor(proofingConfig->warningColor);
m_page->chkBlackpoint->setChecked(cfg.useBlackPointCompensation(true));
m_page->chkAllowLCMSOptimization->setChecked(cfg.allowLCMSOptimization(true));
......@@ -485,24 +489,6 @@ void ColorSettingsTab::refillMonitorProfiles(const KoID & s)
}
}
void ColorSettingsTab::refillPrintProfiles(const KoID & s)
{
const KoColorSpaceFactory * csf = KoColorSpaceRegistry::instance()->colorSpaceFactory(s.id());
m_page->cmbPrintProfile->clear();
if (!csf)
return;
QList<const KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor(csf);
Q_FOREACH (const KoColorProfile *profile, profileList) {
if (profile->isSuitableForPrinting())
m_page->cmbPrintProfile->addSqueezedItem(profile->name());
}
m_page->cmbPrintProfile->setCurrent(csf->defaultProfile());
}
//---------------------------------------------------------------------------------------------------
......@@ -532,7 +518,6 @@ TabletSettingsTab::TabletSettingsTab(QWidget* parent, const char* name): QWidget
//---------------------------------------------------------------------------------------------------
#include "kis_image_config.h"
#include "kis_acyclic_signal_connector.h"
int getTotalRAM() {
......@@ -714,7 +699,6 @@ DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
c.fromQColor(cfg.selectionOverlayMaskColor());
m_selectionOverlayColorAction = new KoColorPopupAction(this);
m_selectionOverlayColorAction->setCurrentColor(c);
m_selectionOverlayColorAction->setIcon(KisIconUtils::loadIcon("format-stroke-color"));
m_selectionOverlayColorAction->setToolTip(i18n("Change the background color of the image"));
btnSelectionOverlayColor->setDefaultAction(m_selectionOverlayColorAction);
......@@ -1004,9 +988,9 @@ bool KisDlgPreferences::editPreferences()
}
}
cfg.setWorkingColorSpace(dialog->m_colorSettings->m_page->cmbWorkingColorSpace->currentItem().id());
cfg.setPrinterColorSpace(dialog->m_colorSettings->m_page->cmbPrintingColorSpace->currentItem().id());
cfg.setPrinterProfile(dialog->m_colorSettings->m_page->cmbPrintProfile->itemHighlighted());
KisImageConfig cfgImage;
cfgImage.setDefaultProofingConfig(dialog->m_colorSettings->m_page->proofingSpaceSelector->currentColorSpace(), dialog->m_colorSettings->m_page->cmbProofingIntent->currentIndex(), dialog->m_colorSettings->m_page->ckbProofBlackPoint->isChecked(), dialog->m_colorSettings->m_gamutWarning->currentKoColor());
cfg.setUseBlackPointCompensation(dialog->m_colorSettings->m_page->chkBlackpoint->isChecked());
cfg.setAllowLCMSOptimization(dialog->m_colorSettings->m_page->chkAllowLCMSOptimization->isChecked());
cfg.setPasteBehaviour(dialog->m_colorSettings->m_pasteBehaviourGroup.checkedId());
......
......@@ -25,6 +25,7 @@
#include <QWidget>
#include <kpagedialog.h>
#include "KoColorPopupAction.h"
#include "kis_global.h"
......@@ -149,13 +150,13 @@ public:
private Q_SLOTS:
void refillMonitorProfiles(const KoID & s);
void refillPrintProfiles(const KoID & s);
void installProfile();
void toggleAllowMonitorProfileSelection(bool useSystemProfile);
public:
void setDefault();
WdgColorSettings *m_page;
KoColorPopupAction *m_gamutWarning;
QButtonGroup m_pasteBehaviourGroup;
QList<QLabel*> m_monitorProfileLabels;
QList<SqueezedComboBox*> m_monitorProfileWidgets;
......
......@@ -16,7 +16,16 @@
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
......@@ -65,17 +74,35 @@
</item>
<item>
<layout class="QHBoxLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="monitorprofileholder"/>
<widget class="QWidget" name="monitorprofileholder" native="true"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
......@@ -154,56 +181,68 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox2">
<widget class="QGroupBox" name="grpProofingOptions">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Printing</string>
<string>Soft Proof Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="lbldefaultprinterspace">
<property name="text">
<string>Default printer color model:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="2">
<widget class="QToolButton" name="gamutAlarm">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="cmbProofingIntent">
<item>
<property name="text">
<string>Perceptual</string>
</property>
</item>
<item row="1" column="0">
<widget class="QLabel" name="textLabel4">
<property name="toolTip">
<string>The icm profile for your calibrated printer</string>
</property>
<property name="text">
<string>Default &amp;printer profile:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>cmbPrintProfile</cstring>
</property>
</widget>
<item>
<property name="text">
<string>Relative Colorimetric</string>
</property>
</item>
<item row="0" column="1">
<widget class="KisCmbIDList" name="cmbPrintingColorSpace">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<item>
<property name="text">
<string>Absolute Colorimetric</string>
</property>
</item>
<item row="1" column="1">
<widget class="SqueezedComboBox" name="cmbPrintProfile"/>
<item>
<property name="text">
<string>Saturation</string>
</property>
</item>
</layout>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label">
<property name="text">
<string>Gamut Warning</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="KisColorSpaceSelector" name="proofingSpaceSelector" native="true"/>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="ckbProofBlackPoint">
<property name="text">
<string>Back Point Compensation</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Proofing Rendering Intent:</string>
</property>
</widget>
</item>
</layout>
</widget>
......@@ -250,7 +289,16 @@
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
......@@ -294,20 +342,26 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KisColorSpaceSelector</class>
<extends>QWidget</extends>
<header>widgets/kis_color_space_selector.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>SqueezedComboBox</class>
<class>KisCmbIDList</class>
<extends>QComboBox</extends>
<header>widgets/squeezedcombobox.h</header>
<header>widgets/kis_cmb_idlist.h</header>
</customwidget>
<customwidget>
<class>KisCmbIDList</class>
<class>SqueezedComboBox</class>
<extends>QComboBox</extends>
<header>widgets/kis_cmb_idlist.h</header>
<header>widgets/squeezedcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -197,9 +197,9 @@
<item row="1" column="0">
<widget class="QTabWidget" name="grpColorM">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="grpMode" native="true">
<widget class="QWidget" name="grpMode">
<attribute name="title">
<string>Image Color Space</string>
</attribute>
......@@ -237,14 +237,14 @@
<item row="2" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Gamut Alarm:</string>
<string>Gamut Warning:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="ckbBlackPointComp">
<property name="text">
<string>BlackPoint Compenstation</string>
<string>Black Point Compenstation</string>
</property>
</widget>
</item>
......@@ -257,7 +257,7 @@
<item row="1" column="1">
<widget class="QComboBox" name="cmbIntent">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<item>
<property name="text">
......@@ -271,12 +271,12 @@
</item>
<item>
<property name="text">
<string>Absolute Colorimetric</string>
<string>Saturation</string>
</property>
</item>
<item>
<property name="text">
<string>Saturation</string>
<string>Absolute Colorimetric</string>
</property>
</item>
</widget>
......
......@@ -33,6 +33,7 @@
#include <KisDocument.h>
#include <KoColor.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorModelStandardIds.h>
#include <KoColorProfile.h>
......
......@@ -479,7 +479,6 @@ public:
QString customFFMpegPath(bool defaultValue = false) const;
void setCustomFFMpegPath(const QString &value) const;
template<class T>
void writeEntry(const QString& name, const T& value) {
m_cfg.writeEntry(name, value);
......
......@@ -76,6 +76,7 @@
#include "kis_time_range.h"
#include "kis_grid_config.h"
#include "kis_guides_config.h"
#include "kis_image_config.h"
#include "KisProofingConfiguration.h"
/*
......@@ -265,7 +266,8 @@ KisImageWSP KisKraLoader::loadXML(const KoXmlElement& element)
return KisImageWSP(0);
}
}
KisProofingConfiguration *proofingConfig = new KisProofingConfiguration();
KisImageConfig cfgImage;
KisProofingConfiguration *proofingConfig = cfgImage.defaultProofingconfiguration();
if (!(attr = element.attribute(PROOFINGPROFILENAME)).isNull()) {
proofingConfig->proofingProfile = attr;
}
......
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