Add ability to export to an external editor within the same folder as the original file - issue 6195 (#6232)
* import and change the art code -thanks to Alberto * Possible fixed for white space in folder * Added verbose when white-space * Replace WS only if windows and Gimp * Fixed Windows and Gimp bug for external editor - thanks to Lawrence37 * Fix LGTM alert for reused variable name Co-authored-by: Thanatomanic <6567747+Thanatomanic@users.noreply.github.com>
This commit is contained in:
@@ -1972,6 +1972,9 @@ void EditorPanel::sendToGimpPressed ()
|
||||
// develop image
|
||||
rtengine::procparams::ProcParams pparams;
|
||||
ipc->getParams (&pparams);
|
||||
if (options.editor_bypass_output_profile) {
|
||||
pparams.icm.outputProfile = rtengine::procparams::ColorManagementParams::NoProfileString;
|
||||
}
|
||||
rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams);
|
||||
ProgressConnector<rtengine::IImagefloat*> *ld = new ProgressConnector<rtengine::IImagefloat*>();
|
||||
ld->startFunc (sigc::bind (sigc::ptr_fun (&rtengine::processImage), job, err, parent->getProgressListener(), false ),
|
||||
@@ -2045,24 +2048,40 @@ bool EditorPanel::idle_sendToGimp ( ProgressConnector<rtengine::IImagefloat*> *p
|
||||
|
||||
if (img) {
|
||||
// get file name base
|
||||
const Glib::ustring shortname = removeExtension (Glib::path_get_basename (fname));
|
||||
const Glib::ustring dirname = Glib::get_tmp_dir ();
|
||||
const Glib::ustring lfname = Glib::build_filename (dirname, shortname);
|
||||
Glib::ustring shortname = removeExtension(Glib::path_get_basename(fname));
|
||||
Glib::ustring dirname;
|
||||
switch (options.editor_out_dir) {
|
||||
case Options::EDITOR_OUT_DIR_CURRENT:
|
||||
dirname = Glib::path_get_dirname(fname);
|
||||
break;
|
||||
case Options::EDITOR_OUT_DIR_CUSTOM:
|
||||
dirname = options.editor_custom_out_dir;
|
||||
break;
|
||||
default: // Options::EDITOR_OUT_DIR_TEMP
|
||||
dirname = Glib::get_tmp_dir();
|
||||
break;
|
||||
}
|
||||
Glib::ustring fullFileName = Glib::build_filename(dirname, shortname);
|
||||
|
||||
SaveFormat sf;
|
||||
sf.format = "tif";
|
||||
sf.tiffBits = 16;
|
||||
sf.tiffFloat = false;
|
||||
if (options.editor_float32) {
|
||||
sf.tiffBits = 32;
|
||||
sf.tiffFloat = true;
|
||||
} else {
|
||||
sf.tiffBits = 16;
|
||||
sf.tiffFloat = false;
|
||||
}
|
||||
|
||||
sf.tiffUncompressed = true;
|
||||
sf.saveParams = true;
|
||||
|
||||
Glib::ustring fileName = Glib::ustring::compose ("%1.%2", lfname, sf.format);
|
||||
Glib::ustring fileName = Glib::ustring::compose ("%1.%2", fullFileName, sf.format);
|
||||
|
||||
// TODO: Just list all file with a suitable name instead of brute force...
|
||||
int tries = 1;
|
||||
|
||||
while (Glib::file_test (fileName, Glib::FILE_TEST_EXISTS) && tries < 1000) {
|
||||
fileName = Glib::ustring::compose ("%1-%2.%3", lfname, tries, sf.format);
|
||||
fileName = Glib::ustring::compose ("%1-%2.%3", fullFileName, tries, sf.format);
|
||||
tries++;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user