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;
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
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.
// 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++) {
if (tries == 0) {

View File

@ -31,7 +31,7 @@
bool BatchQueueEntry::iconsLoaded(false);
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),
opreview(nullptr),
origpw(prevw),
@ -43,7 +43,8 @@ BatchQueueEntry::BatchQueueEntry (rtengine::ProcessingJob* pjob, const rtengine:
outFileName(""),
sequence(0),
forceFormatOpts(false),
fast_pipeline(job->fastPipeline())
fast_pipeline(job->fastPipeline()),
overwriteFile(overwrite)
{
thumbnail = thm;

View File

@ -56,8 +56,9 @@ public:
SaveFormat saveFormat;
bool forceFormatOpts;
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;
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);
int prevh = BatchQueue::calcMaxThumbnailHeight();
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 ();
bqe->outFileName = fnameOut;
bqe->saveFormat = saveAsDialog->getFormat ();
bqe->overwriteFile = !saveAsDialog->getAutoSuffix();
bqe->forceFormatOpts = saveAsDialog->getForceFormatOpts ();
parent->addBatchQueueJob (bqe, saveAsDialog->getToHeadOfQueue ());
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
//#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);
//}
}