Added external custom profile generator option
This commit is contained in:
@@ -72,6 +72,10 @@ SaveParamsWithFile=false
|
||||
SaveParamsToCache=true
|
||||
LoadParamsFromLocation=0
|
||||
|
||||
# if this is set to a path of a custom program, it will receive the EXIFs as parameters and must generate a PP3 preset file for the given RAW/JPG
|
||||
# Parameters: <Path to RAW/JPG> <Path to default profile> <fNumber> <expose in seconds> <focal length in mm> <ISO> <Lens> <Camera>
|
||||
CustomProfileBuilder=
|
||||
|
||||
[GUI]
|
||||
WindowWidth=900
|
||||
WindowHeight=560
|
||||
|
@@ -72,6 +72,10 @@ SaveParamsWithFile=false
|
||||
SaveParamsToCache=true
|
||||
LoadParamsFromLocation=0
|
||||
|
||||
# if this is set to a path of a custom program, it will receive the EXIFs as parameters and must generate a PP3 preset file for the given RAW/JPG
|
||||
# Parameters: <Path to RAW/JPG> <Path to default profile> <fNumber> <expose in seconds> <focal length in mm> <ISO> <Lens> <Camera>
|
||||
CustomProfileBuilder=
|
||||
|
||||
[GUI]
|
||||
WindowWidth=900
|
||||
WindowHeight=560
|
||||
|
@@ -72,6 +72,11 @@ SaveParamsWithFile=false
|
||||
SaveParamsToCache=true
|
||||
LoadParamsFromLocation=0
|
||||
|
||||
# if this is set to a path of a custom program, it will receive the EXIFs as parameters and must generate a PP3 preset file for the given RAW/JPG
|
||||
# Parameters: <Path to RAW/JPG> <Path to default profile> <fNumber> <expose in seconds> <focal length in mm> <ISO> <Lens> <Camera>
|
||||
CustomProfileBuilder=
|
||||
|
||||
|
||||
[GUI]
|
||||
WindowWidth=900
|
||||
WindowHeight=560
|
||||
|
@@ -93,12 +93,13 @@ CropWindow::CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_)
|
||||
minWidth = bsw + iw + 2*sideBorderWidth;
|
||||
|
||||
setSize (100, 100);
|
||||
zoom11();
|
||||
cropHandler.newImage (ipc_);
|
||||
cropHandler.setPosition (0,0);
|
||||
cropHandler.setEnabled (true);
|
||||
cropHandler.setCropHandlerListener (this);
|
||||
|
||||
zoom11();
|
||||
|
||||
state = SNormal;
|
||||
}
|
||||
|
||||
|
@@ -340,17 +340,33 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
|
||||
|
||||
// try to load the last saved parameters from the cache or from the paramfile file
|
||||
ProcParams* ldprof = NULL;
|
||||
|
||||
Glib::ustring defProf = openThm->getType()==FT_Raw ? options.defProfRaw : options.defProfImg;
|
||||
|
||||
const CacheImageData* cfs=openThm->getCacheImageData();
|
||||
if (!options.customProfileBuilder.empty() && !openThm->hasProcParams() && cfs && cfs->exifValid) {
|
||||
std::ostringstream strm;
|
||||
strm << Glib::ustring("\"") << options.customProfileBuilder << Glib::ustring("\" \"") << openThm->getFileName() << Glib::ustring("\" \"");
|
||||
strm << options.rtdir << Glib::ustring("/") << options.profilePath << Glib::ustring("/") << defProf << Glib::ustring(".pp3");
|
||||
strm << Glib::ustring("\" ") << cfs->fnumber << Glib::ustring(" ") << cfs->shutter << Glib::ustring(" ");
|
||||
strm << cfs->focalLen << Glib::ustring(" ") << cfs->iso << Glib::ustring(" \"");
|
||||
strm << cfs->lens << Glib::ustring("\" \"") << cfs->camera << Glib::ustring("\"");
|
||||
|
||||
bool success = safe_spawn_command_line_sync (strm.str());
|
||||
|
||||
// Now they SHOULD be there, so try to load them
|
||||
if (success) openThm->loadProcParams();
|
||||
}
|
||||
|
||||
if (openThm->hasProcParams()) {
|
||||
ldprof = new ProcParams ();
|
||||
*ldprof = openThm->getProcParams ();
|
||||
}
|
||||
|
||||
rtengine::ImageSource* is=isrc->getImageSource();
|
||||
is->setProgressListener( this );
|
||||
// initialize profile
|
||||
if (openThm->getType()!=FT_Raw)
|
||||
profilep->initProfile (options.defProfImg, ldprof, NULL);
|
||||
else
|
||||
profilep->initProfile (options.defProfRaw, ldprof, NULL);
|
||||
profilep->initProfile (defProf, ldprof, NULL);
|
||||
|
||||
openThm->addThumbnailListener (this);
|
||||
info_toggled ();
|
||||
|
@@ -212,6 +212,7 @@ if (keyFile.has_group ("Profiles")) {
|
||||
if (keyFile.has_key ("Profiles", "SaveParamsWithFile")) saveParamsFile = keyFile.get_boolean ("Profiles", "SaveParamsWithFile");
|
||||
if (keyFile.has_key ("Profiles", "SaveParamsToCache")) saveParamsCache = keyFile.get_boolean ("Profiles", "SaveParamsToCache");
|
||||
if (keyFile.has_key ("Profiles", "LoadParamsFromLocation")) paramsLoadLocation = (PPLoadLocation)keyFile.get_integer ("Profiles", "LoadParamsFromLocation");
|
||||
if (keyFile.has_key ("Profiles", "CustomProfileBuilder")) customProfileBuilder = keyFile.get_string ("Profiles", "CustomProfileBuilder");
|
||||
}
|
||||
|
||||
if (keyFile.has_group ("File Browser")) {
|
||||
@@ -371,6 +372,7 @@ int Options::saveToFile (Glib::ustring fname) {
|
||||
keyFile.set_boolean ("Profiles", "SaveParamsWithFile", saveParamsFile);
|
||||
keyFile.set_boolean ("Profiles", "SaveParamsToCache", saveParamsCache);
|
||||
keyFile.set_integer ("Profiles", "LoadParamsFromLocation", paramsLoadLocation);
|
||||
keyFile.set_string ("Profiles", "CustomProfileBuilder", customProfileBuilder);
|
||||
|
||||
keyFile.set_string ("GUI", "Font", font);
|
||||
keyFile.set_integer ("GUI", "WindowWidth", windowWidth);
|
||||
|
@@ -107,6 +107,7 @@ class Options {
|
||||
Glib::ustring gimpDir;
|
||||
Glib::ustring psDir;
|
||||
Glib::ustring customEditorProg;
|
||||
Glib::ustring customProfileBuilder;
|
||||
int editorToSendTo;
|
||||
int maxThumbnailHeight;
|
||||
int maxCacheEntries;
|
||||
|
@@ -187,3 +187,24 @@ bool safe_spawn_command_line_async (const Glib::ustring& cmd_utf8)
|
||||
#endif
|
||||
return success;
|
||||
}
|
||||
|
||||
bool safe_spawn_command_line_sync (const Glib::ustring& cmd_utf8)
|
||||
{
|
||||
std::string cmd;
|
||||
std::string stdOut;
|
||||
std::string stdErr;
|
||||
|
||||
bool success = false;
|
||||
|
||||
int exitStatus=-1;
|
||||
try {
|
||||
cmd = Glib::filename_from_utf8(cmd_utf8);
|
||||
printf ("command line: |%s|\n", cmd.c_str());
|
||||
|
||||
// if it crashes here on windows, make sure you have the GTK runtime files gspawn-win32-helper*.exe files in RT directory
|
||||
Glib::spawn_command_line_sync (cmd,NULL,NULL, &exitStatus);
|
||||
} catch (Glib::Exception& ex) {
|
||||
printf ("%s\n", ex.what().c_str());
|
||||
}
|
||||
return (exitStatus==0);
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ void safe_build_file_list (Glib::RefPtr<Gio::File> &dir, std::vector<Glib::ustri
|
||||
void safe_build_subdir_list (Glib::RefPtr<Gio::File> &dir, std::vector<Glib::ustring> &subDirs, bool add_hidden);
|
||||
|
||||
bool safe_spawn_command_line_async (const Glib::ustring& cmd_utf8);
|
||||
bool safe_spawn_command_line_sync (const Glib::ustring& cmd_utf8);
|
||||
|
||||
Glib::ustring safe_locale_to_utf8 (const std::string& src); // from rtengine
|
||||
std::string safe_locale_from_utf8 (const Glib::ustring& utf8_str);
|
||||
|
Reference in New Issue
Block a user