Read embedded dcp profile from raw files

raw files, usually dng files, can provide a dcp profile by providing the
related tags.

This patch will make the "Use embedded" options in the color management
panel selectable if the source raw file embeds a dcp profile.
In this case the DCP panel will be enabled like when reading an external
dcp profile.

Additional changes:

* Rename "Use embedded, if possible" to just "Use embedded" since the
option is already disabled when no embedded profile is found.
* Update the "Use embedded" options tooltip as it's now not related to
  only non raw images.
This commit is contained in:
Simone Gotti
2024-02-26 11:32:01 +01:00
parent a5df36c569
commit 3e26976403
6 changed files with 41 additions and 27 deletions

View File

@@ -705,6 +705,8 @@ void ICMPanel::updateDCP(int dcpIlluminant, Glib::ustring dcp_name)
if (dcp_name == "(cameraICC)") {
dcp = DCPStore::getInstance()->getStdProfile(camName);
} else if (dcp_name == "(embedded)") {
dcp = DCPStore::getInstance()->getProfile(filename);
} else if (ifromfile->get_active() && DCPStore::getInstance()->isValidDCPFileName(dcp_name)) {
dcp = DCPStore::getInstance()->getProfile(dcp_name);
}
@@ -806,8 +808,8 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
ConnectionBlocker wprimconn_(wprimconn);
trcExp->set_expanded(false);
if (pp->icm.inputProfile.substr(0, 5) != "file:") {
ipDialog->set_filename(" ");
if (pp->icm.inputProfile.substr(0, 5) != "file:" && !ipDialog->get_filename().empty()) {
ipDialog->set_filename(pp->icm.inputProfile);
}
if (pp->icm.inputProfile == "(none)") {
@@ -815,7 +817,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
updateDCP(pp->icm.dcpIlluminant, "");
} else if (pp->icm.inputProfile == "(embedded)" || ((pp->icm.inputProfile == "(camera)" || pp->icm.inputProfile.empty()) && icamera->get_state() == Gtk::STATE_INSENSITIVE)) {
iembedded->set_active(true);
updateDCP(pp->icm.dcpIlluminant, "");
updateDCP(pp->icm.dcpIlluminant, "(embedded)");
} else if ((pp->icm.inputProfile == "(cameraICC)") && icameraICC->get_state() != Gtk::STATE_INSENSITIVE) {
icameraICC->set_active(true);
updateDCP(pp->icm.dcpIlluminant, "(cameraICC)");
@@ -2126,8 +2128,9 @@ void ICMPanel::setRawMeta(bool raw, const rtengine::FramesData* pMeta)
iembedded->set_active(!raw);
icamera->set_sensitive(raw);
camName = pMeta->getCamera();
filename = pMeta->getFileName();
icameraICC->set_sensitive(raw && (ICCStore::getInstance()->getStdProfile(pMeta->getCamera()) != nullptr || DCPStore::getInstance()->getStdProfile(pMeta->getCamera()) != nullptr));
iembedded->set_sensitive(!raw);
iembedded->set_sensitive(!raw || DCPStore::getInstance()->getProfile(filename));
enableListener();
}