Commit 9ebd13b4 authored by Agata Cacko's avatar Agata Cacko

Fix switching profile to default in New file dialog

Before this commit if you first selected the color model,
then color profile, then color depth, the color profile would switch to
default for this color depth no matter that the user just set it
manually. This is mostly the problem if someone is for example using
Rec2020 profile for HDR images and switches between 32 and 16 bit
color depths.

Behaviour now:
- by default color profile changes to the default one that suits
the color model and color depth
- if the user sets the profile manually, it is remembered
and if it changes color depth, the profile doesn't change
(keep in mind that "(Default)" suffix is still attached
to the default profile, so it's easy to find in case the user wants it
- if the user changes the color model, the default behaviour
(switching profile automatically) is restored until the user
sets up the profile maually again.

parent cd5450a8
......@@ -48,6 +48,8 @@ struct KisColorSpaceSelector::Private {
QString knsrcFile;
bool profileValid;
QString defaultsuffix;
bool profileSetManually;
KoID previousModel;
KisColorSpaceSelector::KisColorSpaceSelector(QWidget* parent) : QWidget(parent), m_advancedSelector(0), d(new Private)
......@@ -62,17 +64,17 @@ KisColorSpaceSelector::KisColorSpaceSelector(QWidget* parent) : QWidget(parent),
d->colorSpaceSelector->bnInstallProfile->setToolTip( i18n("Open Color Profile") );
connect(d->colorSpaceSelector->cmbColorModels, SIGNAL(activated(KoID)),
this, SLOT(fillCmbDepths(KoID)));
this, SLOT(slotModelsComboBoxActivated(KoID)));
connect(d->colorSpaceSelector->cmbColorDepth, SIGNAL(activated(KoID)),
this, SLOT(fillCmbProfiles()));
connect(d->colorSpaceSelector->cmbColorModels, SIGNAL(activated(KoID)),
this, SLOT(fillCmbProfiles()));
this, SLOT(slotDepthsComboBoxActivated()));
connect(d->colorSpaceSelector->cmbProfile, SIGNAL(activated(QString)),
this, SLOT(colorSpaceChanged()));
this, SLOT(slotProfilesComboBoxActivated()));
connect(d->colorSpaceSelector->bnInstallProfile, SIGNAL(clicked()),
this, SLOT(installProfile()));
d->defaultsuffix = " "+i18nc("This is appended to the color profile which is the default for the given colorspace and bit-depth","(Default)");
d->profileSetManually = false;
d->previousModel = d->colorSpaceSelector->cmbColorModels->currentItem();
connect(d->colorSpaceSelector->bnAdvanced, SIGNAL(clicked()), this, SLOT(slotOpenAdvancedSelector()));
......@@ -88,6 +90,8 @@ KisColorSpaceSelector::~KisColorSpaceSelector()
void KisColorSpaceSelector::fillCmbProfiles()
const QString currentProfileName = d->colorSpaceSelector->cmbProfile->itemHighlighted();
const QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(d->colorSpaceSelector->cmbColorModels->currentItem(), d->colorSpaceSelector->cmbColorDepth->currentItem());
const QString defaultProfileName = KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId);
......@@ -106,7 +110,11 @@ void KisColorSpaceSelector::fillCmbProfiles()
d->colorSpaceSelector->cmbProfile->setCurrent(defaultProfileName + d->defaultsuffix);
if (d->profileSetManually && profileNames.contains(currentProfileName)) {
} else {
d->colorSpaceSelector->cmbProfile->setCurrent(defaultProfileName + d->defaultsuffix);
......@@ -149,7 +157,9 @@ void KisColorSpaceSelector::setCurrentColorModel(const KoID& id)
void KisColorSpaceSelector::setCurrentColorDepth(const KoID& id)
if (!d->profileSetManually) {
void KisColorSpaceSelector::setCurrentProfile(const QString& name)
......@@ -235,3 +245,26 @@ void KisColorSpaceSelector::slotProfileValid(bool valid)
d->profileValid = valid;
void KisColorSpaceSelector::slotModelsComboBoxActivated(const KoID& id)
if (d->previousModel != id) {
d->previousModel = id;
d->profileSetManually = false;
void KisColorSpaceSelector::slotDepthsComboBoxActivated()
void KisColorSpaceSelector::slotProfilesComboBoxActivated()
d->profileSetManually = true;
......@@ -54,6 +54,10 @@ private Q_SLOTS:
void installProfile();
void slotOpenAdvancedSelector();
void slotProfileValid(bool valid);
void slotModelsComboBoxActivated(const KoID& id);
void slotDepthsComboBoxActivated();
void slotProfilesComboBoxActivated();
struct Private;
KisAdvancedColorSpaceSelector *m_advancedSelector;
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