Fixed file overwite from queued items

This commit is contained in:
Oleg Koncevoy 2019-03-21 19:32:31 +02:00
parent d059caa7de
commit d2e6a3a44a
5 changed files with 10 additions and 7 deletions

View File

@ -345,7 +345,7 @@ bool BatchQueue::loadBatchQueue ()
auto prevw = prevh; auto prevw = prevh;
thumb->getThumbnailSize (prevw, prevh, &pparams); thumb->getThumbnailSize (prevw, prevh, &pparams);
auto entry = new BatchQueueEntry (job, pparams, source, prevw, prevh, thumb); auto entry = new BatchQueueEntry (job, pparams, source, prevw, prevh, thumb, options.overwriteOutputFile);
thumb->decreaseRef (); // Removing the refCount acquired by cacheMgr->getEntry thumb->decreaseRef (); // Removing the refCount acquired by cacheMgr->getEntry
entry->setParent (this); entry->setParent (this);
@ -942,7 +942,7 @@ Glib::ustring BatchQueue::autoCompleteFileName (const Glib::ustring& fileName, c
// In overwrite mode we TRY to delete the old file first. // In overwrite mode we TRY to delete the old file first.
// if that's not possible (e.g. locked by viewer, R/O), we revert to the standard naming scheme // if that's not possible (e.g. locked by viewer, R/O), we revert to the standard naming scheme
bool inOverwriteMode = options.overwriteOutputFile; bool inOverwriteMode = processing->overwriteFile;
for (int tries = 0; tries < 100; tries++) { for (int tries = 0; tries < 100; tries++) {
if (tries == 0) { if (tries == 0) {

View File

@ -31,7 +31,7 @@
bool BatchQueueEntry::iconsLoaded(false); bool BatchQueueEntry::iconsLoaded(false);
Glib::RefPtr<Gdk::Pixbuf> BatchQueueEntry::savedAsIcon; Glib::RefPtr<Gdk::Pixbuf> BatchQueueEntry::savedAsIcon;
BatchQueueEntry::BatchQueueEntry (rtengine::ProcessingJob* pjob, const rtengine::procparams::ProcParams& pparams, Glib::ustring fname, int prevw, int prevh, Thumbnail* thm) : BatchQueueEntry::BatchQueueEntry (rtengine::ProcessingJob* pjob, const rtengine::procparams::ProcParams& pparams, Glib::ustring fname, int prevw, int prevh, Thumbnail* thm, bool overwrite) :
ThumbBrowserEntryBase(fname), ThumbBrowserEntryBase(fname),
opreview(nullptr), opreview(nullptr),
origpw(prevw), origpw(prevw),
@ -43,7 +43,8 @@ BatchQueueEntry::BatchQueueEntry (rtengine::ProcessingJob* pjob, const rtengine:
outFileName(""), outFileName(""),
sequence(0), sequence(0),
forceFormatOpts(false), forceFormatOpts(false),
fast_pipeline(job->fastPipeline()) fast_pipeline(job->fastPipeline()),
overwriteFile(overwrite)
{ {
thumbnail = thm; thumbnail = thm;

View File

@ -56,8 +56,9 @@ public:
SaveFormat saveFormat; SaveFormat saveFormat;
bool forceFormatOpts; bool forceFormatOpts;
bool fast_pipeline; bool fast_pipeline;
bool overwriteFile;
BatchQueueEntry (rtengine::ProcessingJob* job, const rtengine::procparams::ProcParams& pparams, Glib::ustring fname, int prevw, int prevh, Thumbnail* thm = nullptr); BatchQueueEntry (rtengine::ProcessingJob* job, const rtengine::procparams::ProcParams& pparams, Glib::ustring fname, int prevw, int prevh, Thumbnail* thm = nullptr, bool overwrite = false);
~BatchQueueEntry () override; ~BatchQueueEntry () override;
void refreshThumbnailImage () override; void refreshThumbnailImage () override;

View File

@ -1835,7 +1835,7 @@ BatchQueueEntry* EditorPanel::createBatchQueueEntry ()
isrc->getImageSource()->getFullSize (fullW, fullH, pparams.coarse.rotate == 90 || pparams.coarse.rotate == 270 ? TR_R90 : TR_NONE); isrc->getImageSource()->getFullSize (fullW, fullH, pparams.coarse.rotate == 90 || pparams.coarse.rotate == 270 ? TR_R90 : TR_NONE);
int prevh = BatchQueue::calcMaxThumbnailHeight(); int prevh = BatchQueue::calcMaxThumbnailHeight();
int prevw = int ((size_t)fullW * (size_t)prevh / (size_t)fullH); int prevw = int ((size_t)fullW * (size_t)prevh / (size_t)fullH);
return new BatchQueueEntry (job, pparams, openThm->getFileName(), prevw, prevh, openThm); return new BatchQueueEntry (job, pparams, openThm->getFileName(), prevw, prevh, openThm, options.overwriteOutputFile);
} }
@ -1928,6 +1928,7 @@ void EditorPanel::saveAsPressed ()
BatchQueueEntry* bqe = createBatchQueueEntry (); BatchQueueEntry* bqe = createBatchQueueEntry ();
bqe->outFileName = fnameOut; bqe->outFileName = fnameOut;
bqe->saveFormat = saveAsDialog->getFormat (); bqe->saveFormat = saveAsDialog->getFormat ();
bqe->overwriteFile = !saveAsDialog->getAutoSuffix();
bqe->forceFormatOpts = saveAsDialog->getForceFormatOpts (); bqe->forceFormatOpts = saveAsDialog->getForceFormatOpts ();
parent->addBatchQueueJob (bqe, saveAsDialog->getToHeadOfQueue ()); parent->addBatchQueueJob (bqe, saveAsDialog->getToHeadOfQueue ());
fnameOK = true; fnameOK = true;

View File

@ -1216,7 +1216,7 @@ void FileCatalog::developRequested(const std::vector<FileBrowserEntry*>& tbe, bo
// processThumbImage is the processing intensive part, but adding to queue must be ordered // processThumbImage is the processing intensive part, but adding to queue must be ordered
//#pragma omp ordered //#pragma omp ordered
//{ //{
BatchQueueEntry* bqh = new BatchQueueEntry (pjob, params, fbe->filename, pw, ph, th); BatchQueueEntry* bqh = new BatchQueueEntry (pjob, params, fbe->filename, pw, ph, th, options.overwriteOutputFile);
entries.push_back(bqh); entries.push_back(bqh);
//} //}
} }