Batch queue/preview stability enhancements; see issue #611
This commit is contained in:
@@ -52,6 +52,12 @@ void BatchQueue::rightClicked (ThumbBrowserEntryBase* entry) {
|
||||
|
||||
void BatchQueue::addEntries ( std::vector<BatchQueueEntry*> &entries, bool head)
|
||||
{
|
||||
{
|
||||
// TODO: Check for Linux
|
||||
#ifdef WIN32
|
||||
Glib::Mutex::Lock lock(entryMutex);
|
||||
#endif
|
||||
|
||||
for( std::vector<BatchQueueEntry*>::iterator entry = entries.begin(); entry != entries.end();entry++ ){
|
||||
(*entry)->setParent (this);
|
||||
(*entry)->resize (options.thumbSize);
|
||||
@@ -82,6 +88,8 @@ void BatchQueue::addEntries ( std::vector<BatchQueueEntry*> &entries, bool head)
|
||||
(*entry)->addButtonSet (bqbs);
|
||||
}
|
||||
saveBatchQueue( );
|
||||
}
|
||||
|
||||
arrangeFiles ();
|
||||
queue_draw ();
|
||||
notifyListener ();
|
||||
@@ -96,6 +104,7 @@ bool BatchQueue::saveBatchQueue( )
|
||||
if (f==NULL)
|
||||
return false;
|
||||
|
||||
// method is already running with entryLock, so no need to lock again
|
||||
for (std::vector<ThumbBrowserEntryBase*>::iterator pos=fd.begin(); pos!=fd.end(); pos++){
|
||||
BatchQueueEntry* bqe = reinterpret_cast<BatchQueueEntry*>(*pos);
|
||||
fprintf(f,"%s;%s\n", bqe->filename.c_str(),bqe->savedParamsFile.c_str() );
|
||||
@@ -106,6 +115,11 @@ bool BatchQueue::saveBatchQueue( )
|
||||
|
||||
bool BatchQueue::loadBatchQueue( )
|
||||
{
|
||||
// TODO: Check for Linux
|
||||
#ifdef WIN32
|
||||
Glib::Mutex::Lock lock(entryMutex);
|
||||
#endif
|
||||
|
||||
Glib::ustring savedQueueFile;
|
||||
savedQueueFile = options.rtdir+"/batch/queue";
|
||||
FILE *f = safe_g_fopen (savedQueueFile, "rt");
|
||||
@@ -190,6 +204,11 @@ int deleteitem (void* data)
|
||||
}
|
||||
|
||||
void BatchQueue::cancelItems (std::vector<ThumbBrowserEntryBase*>* items) {
|
||||
{
|
||||
// TODO: Check for Linux
|
||||
#ifdef WIN32
|
||||
Glib::Mutex::Lock lock(entryMutex);
|
||||
#endif
|
||||
|
||||
for (int i=0; i<items->size(); i++) {
|
||||
BatchQueueEntry* entry = (BatchQueueEntry*)(*items)[i];
|
||||
@@ -210,13 +229,17 @@ void BatchQueue::cancelItems (std::vector<ThumbBrowserEntryBase*>* items) {
|
||||
selected.clear ();
|
||||
|
||||
saveBatchQueue( );
|
||||
|
||||
}
|
||||
redraw ();
|
||||
notifyListener ();
|
||||
}
|
||||
|
||||
void BatchQueue::headItems (std::vector<ThumbBrowserEntryBase*>* items) {
|
||||
|
||||
{
|
||||
// TODO: Check for Linux
|
||||
#ifdef WIN32
|
||||
Glib::Mutex::Lock lock(entryMutex);
|
||||
#endif
|
||||
for (int i=items->size()-1; i>=0; i--) {
|
||||
BatchQueueEntry* entry = (BatchQueueEntry*)(*items)[i];
|
||||
if (entry->processing)
|
||||
@@ -233,11 +256,16 @@ void BatchQueue::headItems (std::vector<ThumbBrowserEntryBase*>* items) {
|
||||
}
|
||||
}
|
||||
saveBatchQueue( );
|
||||
}
|
||||
redraw ();
|
||||
}
|
||||
|
||||
void BatchQueue::tailItems (std::vector<ThumbBrowserEntryBase*>* items) {
|
||||
|
||||
{
|
||||
// TODO: Check for Linux
|
||||
#ifdef WIN32
|
||||
Glib::Mutex::Lock lock(entryMutex);
|
||||
#endif
|
||||
for (int i=0; i<items->size(); i++) {
|
||||
BatchQueueEntry* entry = (BatchQueueEntry*)(*items)[i];
|
||||
if (entry->processing)
|
||||
@@ -249,10 +277,15 @@ void BatchQueue::tailItems (std::vector<ThumbBrowserEntryBase*>* items) {
|
||||
}
|
||||
}
|
||||
saveBatchQueue( );
|
||||
}
|
||||
redraw ();
|
||||
}
|
||||
|
||||
void BatchQueue::selectAll () {
|
||||
// TODO: Check for Linux
|
||||
#ifdef WIN32
|
||||
Glib::Mutex::Lock lock(entryMutex);
|
||||
#endif
|
||||
|
||||
lastClicked = NULL;
|
||||
selected.clear ();
|
||||
@@ -265,7 +298,10 @@ void BatchQueue::selectAll () {
|
||||
queue_draw ();
|
||||
}
|
||||
void BatchQueue::startProcessing () {
|
||||
|
||||
// TODO: Check for Linux
|
||||
#ifdef WIN32
|
||||
entryMutex.lock();
|
||||
#endif
|
||||
if (!processing && fd.size()>0) {
|
||||
BatchQueueEntry* next = (BatchQueueEntry*)fd[0];
|
||||
// tag it as processing
|
||||
@@ -278,6 +314,12 @@ void BatchQueue::startProcessing () {
|
||||
selected.erase (pos);
|
||||
processing->selected = false;
|
||||
}
|
||||
|
||||
// TODO: Check for Linux
|
||||
#ifdef WIN32
|
||||
entryMutex.unlock();
|
||||
#endif
|
||||
|
||||
// remove button set
|
||||
next->removeButtonSet ();
|
||||
// start batch processing
|
||||
@@ -335,6 +377,12 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
||||
// delete from the queue
|
||||
delete processing;
|
||||
processing = NULL;
|
||||
{
|
||||
// TODO: Check for Linux
|
||||
#ifdef WIN32
|
||||
Glib::Mutex::Lock lock(entryMutex);
|
||||
#endif
|
||||
|
||||
fd.erase (fd.begin());
|
||||
|
||||
// return next job
|
||||
@@ -369,6 +417,8 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
||||
safe_g_remove( *iter );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
redraw ();
|
||||
notifyListener ();
|
||||
gdk_threads_leave ();
|
||||
|
Reference in New Issue
Block a user