Fixed file format changes in batch queue

see issue 890
This commit is contained in:
Oliver Duis
2011-08-05 19:28:17 +02:00
parent 20e434ecfc
commit 829ffe051d
6 changed files with 36 additions and 8 deletions

View File

@@ -364,8 +364,8 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
SaveFormat saveFormat;
if (processing->outFileName=="") { // auto file name
Glib::ustring s = calcAutoFileNameBase (processing->filename);
fname = autoCompleteFileName (s, options.saveFormat.format);
saveFormat = options.saveFormat;
saveFormat = options.saveFormatBatch;
fname = autoCompleteFileName (s, saveFormat.format);
}
else { // use the save-as filename with automatic completion for uniqueness
fname = autoCompleteFileName (removeExtension(processing->outFileName), getExtension(processing->outFileName));

View File

@@ -78,7 +78,7 @@ BatchQueuePanel::BatchQueuePanel () {
saveFormatPanel = Gtk::manage (new SaveFormatPanel ());
fformat->add (*saveFormatPanel);
saveFormatPanel->init (options.saveFormat);
saveFormatPanel->init (options.saveFormatBatch);
outdirTemplate->set_text (options.savePathTemplate);
if (safe_file_test (options.savePathFolder, Glib::FILE_TEST_IS_DIR))
outdirFolder->set_current_folder (options.savePathFolder);
@@ -264,6 +264,6 @@ void BatchQueuePanel::pathFolderChanged () {
void BatchQueuePanel::formatChanged (Glib::ustring f) {
options.saveFormat = saveFormatPanel->getFormat ();
options.saveFormatBatch = saveFormatPanel->getFormat ();
}

View File

@@ -726,7 +726,7 @@ void FileCatalog::deleteRequested (std::vector<FileBrowserEntry*> tbe, bool inc
safe_g_remove (Glib::ustring(removeExtension(fname)+".THM"));
if (inclBatchProcessed) {
Glib::ustring procfName = Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormat.format);
Glib::ustring procfName = Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormatBatch.format);
if (safe_file_test (procfName, Glib::FILE_TEST_EXISTS)) safe_g_remove (procfName);
}
}

View File

@@ -58,6 +58,15 @@ void Options::setDefaults () {
saveFormat.tiffBits = 8;
saveFormat.tiffUncompressed = true;
saveFormat.saveParams = true; // was false
saveFormatBatch.format = "jpg";
saveFormatBatch.jpegQuality = 100;
saveFormatBatch.pngCompression = 6;
saveFormatBatch.pngBits = 8;
saveFormatBatch.tiffBits = 8;
saveFormatBatch.tiffUncompressed = true;
saveFormatBatch.saveParams = true; // was false
savePathTemplate = "%p1/converted/%f";
savePathFolder = "";
saveUsePathTemplate = true;
@@ -294,6 +303,16 @@ if (keyFile.has_group ("Output")) {
if (keyFile.has_key ("Output", "TiffBps")) saveFormat.tiffBits = keyFile.get_integer ("Output", "TiffBps");
if (keyFile.has_key ("Output", "TiffUncompressed")) saveFormat.tiffUncompressed= keyFile.get_boolean ("Output", "TiffUncompressed");
if (keyFile.has_key ("Output", "SaveProcParams")) saveFormat.saveParams = keyFile.get_boolean ("Output", "SaveProcParams");
if (keyFile.has_key ("Output", "FormatBatch")) saveFormatBatch.format = keyFile.get_string ("Output", "FormatBatch");
if (keyFile.has_key ("Output", "JpegQualityBatch")) saveFormatBatch.jpegQuality = keyFile.get_integer ("Output", "JpegQualityBatch");
if (keyFile.has_key ("Output", "PngCompressionBatch")) saveFormatBatch.pngCompression = keyFile.get_integer ("Output", "PngCompressionBatch");
if (keyFile.has_key ("Output", "PngBpsBatch")) saveFormatBatch.pngBits = keyFile.get_integer ("Output", "PngBpsBatch");
if (keyFile.has_key ("Output", "TiffBpsBatch")) saveFormatBatch.tiffBits = keyFile.get_integer ("Output", "TiffBpsBatch");
if (keyFile.has_key ("Output", "TiffUncompressedBatch")) saveFormatBatch.tiffUncompressed= keyFile.get_boolean ("Output", "TiffUncompressedBatch");
if (keyFile.has_key ("Output", "SaveProcParamsBatch")) saveFormatBatch.saveParams = keyFile.get_boolean ("Output", "SaveProcParamsBatch");
if (keyFile.has_key ("Output", "Path")) savePathTemplate = keyFile.get_string ("Output", "Path");
if (keyFile.has_key ("Output", "PathTemplate")) savePathTemplate = keyFile.get_string ("Output", "PathTemplate");
if (keyFile.has_key ("Output", "PathFolder")) savePathFolder = keyFile.get_string ("Output", "PathFolder");
@@ -493,6 +512,15 @@ int Options::saveToFile (Glib::ustring fname) {
keyFile.set_integer ("Output", "TiffBps", saveFormat.tiffBits);
keyFile.set_boolean ("Output", "TiffUncompressed", saveFormat.tiffUncompressed);
keyFile.set_boolean ("Output", "SaveProcParams", saveFormat.saveParams);
keyFile.set_string ("Output", "FormatBatch", saveFormatBatch.format);
keyFile.set_integer ("Output", "JpegQualityBatch", saveFormatBatch.jpegQuality);
keyFile.set_integer ("Output", "PngCompressionBatch", saveFormatBatch.pngCompression);
keyFile.set_integer ("Output", "PngBpsBatch", saveFormatBatch.pngBits);
keyFile.set_integer ("Output", "TiffBpsBatch", saveFormatBatch.tiffBits);
keyFile.set_boolean ("Output", "TiffUncompressedBatch", saveFormatBatch.tiffUncompressed);
keyFile.set_boolean ("Output", "SaveProcParamsBatch", saveFormatBatch.saveParams);
keyFile.set_string ("Output", "PathTemplate", savePathTemplate);
keyFile.set_string ("Output", "PathFolder", savePathFolder);
keyFile.set_boolean ("Output", "AutoSuffix", autoSuffix);

View File

@@ -51,7 +51,7 @@ class Options {
public:
bool firstRun;
bool savesParamsAtExit;
SaveFormat saveFormat;
SaveFormat saveFormat,saveFormatBatch;
Glib::ustring savePathTemplate;
Glib::ustring savePathFolder;
bool saveUsePathTemplate;

View File

@@ -702,7 +702,7 @@ bool Thumbnail::openDefaultViewer(int destination) {
Glib::ustring openFName;
if (destination==1) {
openFName = Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormat.format);
openFName = Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormatBatch.format);
if (safe_file_test (openFName, Glib::FILE_TEST_EXISTS)) {
wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (openFName.c_str(), -1, NULL, NULL, NULL);
ShellExecuteW(NULL, L"open", wfilename, NULL, NULL, SW_SHOWMAXIMIZED );
@@ -713,7 +713,7 @@ bool Thumbnail::openDefaultViewer(int destination) {
}
} else {
openFName = destination == 3 ? fname
: Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormat.format);
: Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormatBatch.format);
printf("Opening %s\n", openFName.c_str());