fixed bugs in loading dynamic profiles

This commit is contained in:
Alberto Griggio 2017-03-03 10:00:19 +01:00
parent 6ae57cd556
commit eeb2da2613
4 changed files with 20 additions and 7 deletions

View File

@ -18,6 +18,7 @@
*/
#include "dynamicprofile.h"
#include "profilestore.h"
#include <stdlib.h>
#include <glibmm/regex.h>
@ -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();
}
}
}

View File

@ -19,6 +19,7 @@
#include "dynamicprofilepanel.h"
#include "multilangmgr.h"
#include "profilestore.h"
#include <sstream>
#include <iomanip>
@ -377,7 +378,12 @@ void DynamicProfilePanel::render_profilepath(
auto row = *iter;
Gtk::CellRendererText *ct = static_cast<Gtk::CellRendererText *>(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;
}
}

View File

@ -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) );

View File

@ -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;