From eeb2da2613fab4798ac8df7762c32726d4545fed Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 3 Mar 2017 10:00:19 +0100 Subject: [PATCH] fixed bugs in loading dynamic profiles --- rtgui/dynamicprofile.cc | 9 +++++---- rtgui/dynamicprofilepanel.cc | 8 +++++++- rtgui/preferences.cc | 2 ++ rtgui/thumbnail.cc | 8 ++++++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/rtgui/dynamicprofile.cc b/rtgui/dynamicprofile.cc index c15799fc1..0f09e8a5f 100644 --- a/rtgui/dynamicprofile.cc +++ b/rtgui/dynamicprofile.cc @@ -18,6 +18,7 @@ */ #include "dynamicprofile.h" +#include "profilestore.h" #include #include @@ -235,13 +236,13 @@ PartialProfile *loadDynamicProfile(const ImageMetaData *im) if (entry.matches(im)) { printf("found matching profile %s\n", entry.profilepath.c_str()); - PartialProfile p(true, true); - if (!p.load(options.findProfilePath(entry.profilepath))) { - p.applyTo(ret->pparams); + const PartialProfile *p = + profileStore.getProfile(entry.profilepath); + if (p != nullptr) { + p->applyTo(ret->pparams); } else { printf("ERROR loading matching profile\n"); } - p.deleteInstance(); } } } diff --git a/rtgui/dynamicprofilepanel.cc b/rtgui/dynamicprofilepanel.cc index 3307cbcf3..61614b90c 100644 --- a/rtgui/dynamicprofilepanel.cc +++ b/rtgui/dynamicprofilepanel.cc @@ -19,6 +19,7 @@ #include "dynamicprofilepanel.h" #include "multilangmgr.h" +#include "profilestore.h" #include #include @@ -377,7 +378,12 @@ void DynamicProfilePanel::render_profilepath( auto row = *iter; Gtk::CellRendererText *ct = static_cast(cell); auto value = row[columns_.profilepath]; - ct->property_text() = value; + auto pse = profileStore.findEntryFromFullPath(value); + if (pse != nullptr) { + ct->property_text() = pse->label; + } else { + ct->property_text() = value; + } } diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index e43138473..ed613c61f 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -438,11 +438,13 @@ Gtk::Widget* Preferences::getProcParamsPanel () Gtk::VBox* vbpp = Gtk::manage (new Gtk::VBox ()); Gtk::Label* drlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_FORRAW") + ":", Gtk::ALIGN_START)); rprofiles = Gtk::manage (new ProfileStoreComboBox ()); + rprofiles->addRow(profileStore.getInternalDynamicPSE()); setExpandAlignProperties(rprofiles, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); rprofiles->set_size_request(50, -1); rpconn = rprofiles->signal_changed().connect( sigc::mem_fun(*this, &Preferences::forRAWComboChanged) ); Gtk::Label* drimg = Gtk::manage (new Gtk::Label (M("PREFERENCES_FORIMAGE") + ":", Gtk::ALIGN_START)); iprofiles = Gtk::manage (new ProfileStoreComboBox ()); + iprofiles->addRow(profileStore.getInternalDynamicPSE()); iprofiles->set_size_request(50, -1); setExpandAlignProperties(iprofiles, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); ipconn = iprofiles->signal_changed().connect( sigc::mem_fun(*this, &Preferences::forImageComboChanged) ); diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index b560c5f7b..60da23d01 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -227,13 +227,17 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu imageMetaData = rtengine::ImageMetaData::fromFile (fname, nullptr); } PartialProfile *pp = loadDynamicProfile(imageMetaData); + int err = 0; if (options.paramsLoadLocation == PLL_Input) { - pp->pparams->save(fname + paramFileExtension); + err = pp->pparams->save(fname + paramFileExtension); } else { - pp->pparams->save(getCacheFileName ("profiles", paramFileExtension)); + err = pp->pparams->save(getCacheFileName ("profiles", paramFileExtension)); } pp->deleteInstance(); delete pp; + if (!err) { + loadProcParams(); + } } else if (defProf != DEFPROFILE_DYNAMIC && !options.CPBPath.empty() && !defaultPparamsPath.empty() && (!hasProcParams() || forceCPB) && cfs && cfs->exifValid) { // First generate the communication file, with general values and EXIF metadata rtengine::ImageMetaData* imageMetaData;