Added external custom profile generator option

This commit is contained in:
Oliver Duis
2010-11-06 12:31:51 +01:00
parent 602a15e5ea
commit 87d1f3ae46
9 changed files with 60 additions and 5 deletions

View File

@@ -72,6 +72,10 @@ SaveParamsWithFile=false
SaveParamsToCache=true SaveParamsToCache=true
LoadParamsFromLocation=0 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] [GUI]
WindowWidth=900 WindowWidth=900
WindowHeight=560 WindowHeight=560

View File

@@ -72,6 +72,10 @@ SaveParamsWithFile=false
SaveParamsToCache=true SaveParamsToCache=true
LoadParamsFromLocation=0 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] [GUI]
WindowWidth=900 WindowWidth=900
WindowHeight=560 WindowHeight=560

View File

@@ -72,6 +72,11 @@ SaveParamsWithFile=false
SaveParamsToCache=true SaveParamsToCache=true
LoadParamsFromLocation=0 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] [GUI]
WindowWidth=900 WindowWidth=900
WindowHeight=560 WindowHeight=560

View File

@@ -93,12 +93,13 @@ CropWindow::CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_)
minWidth = bsw + iw + 2*sideBorderWidth; minWidth = bsw + iw + 2*sideBorderWidth;
setSize (100, 100); setSize (100, 100);
zoom11();
cropHandler.newImage (ipc_); cropHandler.newImage (ipc_);
cropHandler.setPosition (0,0); cropHandler.setPosition (0,0);
cropHandler.setEnabled (true); cropHandler.setEnabled (true);
cropHandler.setCropHandlerListener (this); cropHandler.setCropHandlerListener (this);
zoom11();
state = SNormal; state = SNormal;
} }

View File

@@ -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 // try to load the last saved parameters from the cache or from the paramfile file
ProcParams* ldprof = NULL; 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()) { if (openThm->hasProcParams()) {
ldprof = new ProcParams (); ldprof = new ProcParams ();
*ldprof = openThm->getProcParams (); *ldprof = openThm->getProcParams ();
} }
rtengine::ImageSource* is=isrc->getImageSource(); rtengine::ImageSource* is=isrc->getImageSource();
is->setProgressListener( this ); is->setProgressListener( this );
// initialize profile // initialize profile
if (openThm->getType()!=FT_Raw) profilep->initProfile (defProf, ldprof, NULL);
profilep->initProfile (options.defProfImg, ldprof, NULL);
else
profilep->initProfile (options.defProfRaw, ldprof, NULL);
openThm->addThumbnailListener (this); openThm->addThumbnailListener (this);
info_toggled (); info_toggled ();

View File

@@ -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", "SaveParamsWithFile")) saveParamsFile = keyFile.get_boolean ("Profiles", "SaveParamsWithFile");
if (keyFile.has_key ("Profiles", "SaveParamsToCache")) saveParamsCache = keyFile.get_boolean ("Profiles", "SaveParamsToCache"); 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", "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")) { 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", "SaveParamsWithFile", saveParamsFile);
keyFile.set_boolean ("Profiles", "SaveParamsToCache", saveParamsCache); keyFile.set_boolean ("Profiles", "SaveParamsToCache", saveParamsCache);
keyFile.set_integer ("Profiles", "LoadParamsFromLocation", paramsLoadLocation); keyFile.set_integer ("Profiles", "LoadParamsFromLocation", paramsLoadLocation);
keyFile.set_string ("Profiles", "CustomProfileBuilder", customProfileBuilder);
keyFile.set_string ("GUI", "Font", font); keyFile.set_string ("GUI", "Font", font);
keyFile.set_integer ("GUI", "WindowWidth", windowWidth); keyFile.set_integer ("GUI", "WindowWidth", windowWidth);

View File

@@ -107,6 +107,7 @@ class Options {
Glib::ustring gimpDir; Glib::ustring gimpDir;
Glib::ustring psDir; Glib::ustring psDir;
Glib::ustring customEditorProg; Glib::ustring customEditorProg;
Glib::ustring customProfileBuilder;
int editorToSendTo; int editorToSendTo;
int maxThumbnailHeight; int maxThumbnailHeight;
int maxCacheEntries; int maxCacheEntries;

View File

@@ -187,3 +187,24 @@ bool safe_spawn_command_line_async (const Glib::ustring& cmd_utf8)
#endif #endif
return success; 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);
}

View File

@@ -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); 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_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 Glib::ustring safe_locale_to_utf8 (const std::string& src); // from rtengine
std::string safe_locale_from_utf8 (const Glib::ustring& utf8_str); std::string safe_locale_from_utf8 (const Glib::ustring& utf8_str);