Cleanups and simplifications, espc. batch queue
This commit is contained in:
@@ -119,9 +119,8 @@ void BatchQueue::addEntries ( std::vector<BatchQueueEntry*> &entries, bool head)
|
|||||||
saveBatchQueue( );
|
saveBatchQueue( );
|
||||||
}
|
}
|
||||||
|
|
||||||
arrangeFiles ();
|
redraw();
|
||||||
queue_draw ();
|
notifyListener (false);
|
||||||
notifyListener ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BatchQueue::saveBatchQueue( )
|
bool BatchQueue::saveBatchQueue( )
|
||||||
@@ -206,10 +205,8 @@ void BatchQueue::loadBatchQueue( )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arrangeFiles ();
|
redraw();
|
||||||
queue_draw ();
|
notifyListener(false);
|
||||||
|
|
||||||
notifyListener();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::ustring BatchQueue::getTempFilenameForParams( const Glib::ustring filename )
|
Glib::ustring BatchQueue::getTempFilenameForParams( const Glib::ustring filename )
|
||||||
@@ -265,7 +262,7 @@ void BatchQueue::cancelItems (std::vector<ThumbBrowserEntryBase*>* items) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
redraw ();
|
redraw ();
|
||||||
notifyListener ();
|
notifyListener (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchQueue::headItems (std::vector<ThumbBrowserEntryBase*>* items) {
|
void BatchQueue::headItems (std::vector<ThumbBrowserEntryBase*>* items) {
|
||||||
@@ -369,7 +366,6 @@ void BatchQueue::startProcessing () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
||||||
GThreadLock lock;
|
|
||||||
|
|
||||||
// save image img
|
// save image img
|
||||||
Glib::ustring fname;
|
Glib::ustring fname;
|
||||||
@@ -407,16 +403,14 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
|||||||
if (processing->thumbnail) {
|
if (processing->thumbnail) {
|
||||||
processing->thumbnail->imageDeveloped ();
|
processing->thumbnail->imageDeveloped ();
|
||||||
processing->thumbnail->imageRemovedFromQueue ();
|
processing->thumbnail->imageRemovedFromQueue ();
|
||||||
if (listener)
|
|
||||||
listener->imageProcessingReady (processing->filename);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// save temporary params file name: delete as last thing
|
// save temporary params file name: delete as last thing
|
||||||
Glib::ustring processedParams = processing->savedParamsFile;
|
Glib::ustring processedParams = processing->savedParamsFile;
|
||||||
|
|
||||||
// delete from the queue
|
// delete from the queue
|
||||||
delete processing;
|
delete processing; processing = NULL;
|
||||||
processing = NULL;
|
bool queueEmptied=false;
|
||||||
{
|
{
|
||||||
// TODO: Check for Linux
|
// TODO: Check for Linux
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -427,8 +421,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
|||||||
|
|
||||||
// return next job
|
// return next job
|
||||||
if (fd.size()==0) {
|
if (fd.size()==0) {
|
||||||
if (listener)
|
queueEmptied=true;
|
||||||
listener->queueEmpty ();
|
|
||||||
}
|
}
|
||||||
else if (listener && listener->canStartNext ()) {
|
else if (listener && listener->canStartNext ()) {
|
||||||
BatchQueueEntry* next = (BatchQueueEntry*)fd[0];
|
BatchQueueEntry* next = (BatchQueueEntry*)fd[0];
|
||||||
@@ -445,7 +438,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
|||||||
// remove button set
|
// remove button set
|
||||||
next->removeButtonSet ();
|
next->removeButtonSet ();
|
||||||
}
|
}
|
||||||
if( saveBatchQueue( ) ){
|
if (saveBatchQueue( )) {
|
||||||
safe_g_remove( processedParams );
|
safe_g_remove( processedParams );
|
||||||
// Delete all files in directory \batch when finished, just to be sure to remove zombies
|
// Delete all files in directory \batch when finished, just to be sure to remove zombies
|
||||||
if( fd.size()==0 ){
|
if( fd.size()==0 ){
|
||||||
@@ -460,7 +453,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
redraw ();
|
redraw ();
|
||||||
notifyListener ();
|
notifyListener (queueEmptied);
|
||||||
|
|
||||||
return processing ? processing->job : NULL;
|
return processing ? processing->job : NULL;
|
||||||
}
|
}
|
||||||
@@ -622,21 +615,23 @@ void BatchQueue::buttonPressed (LWButton* button, int actionCode, void* actionDa
|
|||||||
struct NLParams {
|
struct NLParams {
|
||||||
BatchQueueListener* listener;
|
BatchQueueListener* listener;
|
||||||
int qsize;
|
int qsize;
|
||||||
|
bool queueEmptied;
|
||||||
};
|
};
|
||||||
|
|
||||||
int bqnotifylistenerUI (void* data) {
|
int bqnotifylistenerUI (void* data) {
|
||||||
NLParams* params = (NLParams*)data;
|
NLParams* params = (NLParams*)data;
|
||||||
params->listener->queueSizeChanged (params->qsize);
|
params->listener->queueSizeChanged (params->qsize, params->queueEmptied);
|
||||||
delete params;
|
delete params;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchQueue::notifyListener () {
|
void BatchQueue::notifyListener (bool queueEmptied) {
|
||||||
|
|
||||||
if (listener) {
|
if (listener) {
|
||||||
NLParams* params = new NLParams;
|
NLParams* params = new NLParams;
|
||||||
params->listener = listener;
|
params->listener = listener;
|
||||||
params->qsize = fd.size();
|
params->qsize = fd.size();
|
||||||
|
params->queueEmptied = queueEmptied;
|
||||||
g_idle_add (bqnotifylistenerUI, params);
|
g_idle_add (bqnotifylistenerUI, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,9 +28,7 @@
|
|||||||
class BatchQueueListener {
|
class BatchQueueListener {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void queueSizeChanged (int qsize) =0;
|
virtual void queueSizeChanged (int qsize, bool queueEmptied) =0;
|
||||||
virtual void imageProcessingReady (Glib::ustring fname) =0;
|
|
||||||
virtual void queueEmpty () =0;
|
|
||||||
virtual bool canStartNext () =0;
|
virtual bool canStartNext () =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -57,7 +55,7 @@ class BatchQueue : public ThumbBrowserBase,
|
|||||||
Glib::ustring autoCompleteFileName (const Glib::ustring& fileName, const Glib::ustring& format);
|
Glib::ustring autoCompleteFileName (const Glib::ustring& fileName, const Glib::ustring& format);
|
||||||
Glib::ustring getTempFilenameForParams( const Glib::ustring filename );
|
Glib::ustring getTempFilenameForParams( const Glib::ustring filename );
|
||||||
bool saveBatchQueue( );
|
bool saveBatchQueue( );
|
||||||
void notifyListener ();
|
void notifyListener (bool queueEmptied);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BatchQueue ();
|
BatchQueue ();
|
||||||
|
@@ -179,14 +179,17 @@ void BatchQueuePanel::updateTab (int qsize)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchQueuePanel::queueSizeChanged (int qsize)
|
void BatchQueuePanel::queueSizeChanged (int qsize, bool queueEmptied)
|
||||||
{
|
{
|
||||||
updateTab ( qsize);
|
updateTab ( qsize);
|
||||||
}
|
|
||||||
|
|
||||||
void BatchQueuePanel::imageProcessingReady (Glib::ustring fname) {
|
if (queueEmptied) {
|
||||||
|
stopBatchProc ();
|
||||||
|
fdir->set_sensitive (true);
|
||||||
|
fformat->set_sensitive (true);
|
||||||
|
|
||||||
parent->imageDeveloped (fname);
|
SoundManager::playSoundAsync(options.sndBatchQueueDone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchQueuePanel::startBatchProc () {
|
void BatchQueuePanel::startBatchProc () {
|
||||||
@@ -201,11 +204,12 @@ void BatchQueuePanel::startBatchProc () {
|
|||||||
if (batchQueue->hasJobs()) {
|
if (batchQueue->hasJobs()) {
|
||||||
fdir->set_sensitive (false);
|
fdir->set_sensitive (false);
|
||||||
fformat->set_sensitive (false);
|
fformat->set_sensitive (false);
|
||||||
saveOptions();
|
saveOptions();
|
||||||
batchQueue->startProcessing ();
|
batchQueue->startProcessing ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
stopBatchProc ();
|
stopBatchProc ();
|
||||||
|
|
||||||
updateTab (batchQueue->getEntries().size());
|
updateTab (batchQueue->getEntries().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,15 +232,6 @@ void BatchQueuePanel::addBatchQueueJobs ( std::vector<BatchQueueEntry*> &entries
|
|||||||
startBatchProc ();
|
startBatchProc ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchQueuePanel::queueEmpty () {
|
|
||||||
|
|
||||||
stopBatchProc ();
|
|
||||||
fdir->set_sensitive (true);
|
|
||||||
fformat->set_sensitive (true);
|
|
||||||
|
|
||||||
SoundManager::playSoundAsync(options.sndBatchQueueDone);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BatchQueuePanel::canStartNext () {
|
bool BatchQueuePanel::canStartNext () {
|
||||||
|
|
||||||
if (start->get_active ())
|
if (start->get_active ())
|
||||||
|
@@ -57,9 +57,7 @@ class BatchQueuePanel : public Gtk::VBox,
|
|||||||
void addBatchQueueJobs (std::vector<BatchQueueEntry*> &entries , bool head=false);
|
void addBatchQueueJobs (std::vector<BatchQueueEntry*> &entries , bool head=false);
|
||||||
|
|
||||||
// batchqueuelistener interface
|
// batchqueuelistener interface
|
||||||
void queueSizeChanged (int qsize);
|
void queueSizeChanged (int qsize, bool queueEmptied);
|
||||||
void imageProcessingReady (Glib::ustring fname);
|
|
||||||
void queueEmpty ();
|
|
||||||
bool canStartNext ();
|
bool canStartNext ();
|
||||||
|
|
||||||
void startBatchProc ();
|
void startBatchProc ();
|
||||||
|
@@ -970,7 +970,7 @@ int refreshThumbImagesUI (void* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::_thumbRearrangementNeeded () {
|
void FileBrowser::_thumbRearrangementNeeded () {
|
||||||
refreshThumbImages ();
|
refreshThumbImages (); // arrangeFiles is NOT enough
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::thumbRearrangementNeeded () {
|
void FileBrowser::thumbRearrangementNeeded () {
|
||||||
|
@@ -239,7 +239,7 @@ void FileBrowserEntry::_updateImage (rtengine::IImage8* img, double s, rtengine:
|
|||||||
if (rotated)
|
if (rotated)
|
||||||
parent->thumbRearrangementNeeded();
|
parent->thumbRearrangementNeeded();
|
||||||
else if (redrawRequests==0)
|
else if (redrawRequests==0)
|
||||||
parent->redrawNeeded (this);
|
parent->redrawNeeded (this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -641,17 +641,14 @@ void FileCatalog::previewsFinished (int dir_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileCatalog::setEnabled (bool e) {
|
void FileCatalog::setEnabled (bool e) {
|
||||||
|
|
||||||
enabled = e;
|
enabled = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileCatalog::redrawAll () {
|
void FileCatalog::redrawAll () {
|
||||||
|
|
||||||
fileBrowser->queue_draw ();
|
fileBrowser->queue_draw ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileCatalog::refreshAll () {
|
void FileCatalog::refreshThumbImages () {
|
||||||
|
|
||||||
fileBrowser->refreshThumbImages ();
|
fileBrowser->refreshThumbImages ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -177,12 +177,13 @@ class FileCatalog : public Gtk::VBox,
|
|||||||
// filterpanel interface
|
// filterpanel interface
|
||||||
void exifFilterChanged ();
|
void exifFilterChanged ();
|
||||||
|
|
||||||
Glib::ustring lastSelectedDir () { return selectedDirectory; }
|
Glib::ustring lastSelectedDir () { return selectedDirectory; }
|
||||||
void setEnabled (bool e); // if not enabled, it does not open image
|
void setEnabled (bool e); // if not enabled, it does not open image
|
||||||
void enableTabMode(bool enable); // sets progress bar
|
void enableTabMode(bool enable); // sets progress bar
|
||||||
|
|
||||||
|
// accessors for FileBrowser
|
||||||
void redrawAll ();
|
void redrawAll ();
|
||||||
void refreshAll ();
|
void refreshThumbImages ();
|
||||||
void refreshHeight ();
|
void refreshHeight ();
|
||||||
|
|
||||||
void openRequested (std::vector<Thumbnail*> tbe);
|
void openRequested (std::vector<Thumbnail*> tbe);
|
||||||
|
@@ -217,7 +217,7 @@ bool FilePanel::addBatchQueueJobs ( std::vector<BatchQueueEntry*> &entries ) {
|
|||||||
void FilePanel::optionsChanged () {
|
void FilePanel::optionsChanged () {
|
||||||
|
|
||||||
tpc->optionsChanged ();
|
tpc->optionsChanged ();
|
||||||
fileCatalog->refreshAll ();
|
fileCatalog->refreshThumbImages ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilePanel::handleShortcutKey (GdkEventKey* event) {
|
bool FilePanel::handleShortcutKey (GdkEventKey* event) {
|
||||||
|
@@ -331,11 +331,6 @@ bool RTWindow::keyPressed (GdkEventKey* event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTWindow::imageDeveloped (Glib::ustring fname) {
|
|
||||||
|
|
||||||
// fpanel->refreshThumbnail (fname);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RTWindow::addBatchQueueJob (BatchQueueEntry* bqe, bool head) {
|
void RTWindow::addBatchQueueJob (BatchQueueEntry* bqe, bool head) {
|
||||||
|
|
||||||
std::vector<BatchQueueEntry*> entries;
|
std::vector<BatchQueueEntry*> entries;
|
||||||
|
@@ -60,7 +60,6 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{
|
|||||||
bool on_window_state_event(GdkEventWindowState* event);
|
bool on_window_state_event(GdkEventWindowState* event);
|
||||||
void on_mainNB_switch_page(GtkNotebookPage* page, guint page_num);
|
void on_mainNB_switch_page(GtkNotebookPage* page, guint page_num);
|
||||||
|
|
||||||
void imageDeveloped (Glib::ustring fname); // called by the batchqueue when it finishes an image
|
|
||||||
void showPreferences ();
|
void showPreferences ();
|
||||||
void on_realize ();
|
void on_realize ();
|
||||||
void toggle_fullscreen ();
|
void toggle_fullscreen ();
|
||||||
|
@@ -60,7 +60,7 @@ void ThumbBrowserEntryBase::updateBackBuffer () {
|
|||||||
backBuffer = Gdk::Pixmap::create (w->get_window(), exp_width, exp_height);
|
backBuffer = Gdk::Pixmap::create (w->get_window(), exp_width, exp_height);
|
||||||
|
|
||||||
// If thumbnail is hidden by a filter drawing to it will crash
|
// If thumbnail is hidden by a filter drawing to it will crash
|
||||||
int backbuffer_w =0, backbuffer_h = 0;
|
int backbuffer_w=0, backbuffer_h=0;
|
||||||
backBuffer->get_size(backbuffer_w, backbuffer_h);
|
backBuffer->get_size(backbuffer_w, backbuffer_h);
|
||||||
// if either with or height is zero then return early
|
// if either with or height is zero then return early
|
||||||
if (backbuffer_w * backbuffer_h == 0) return;
|
if (backbuffer_w * backbuffer_h == 0) return;
|
||||||
@@ -338,23 +338,19 @@ void ThumbBrowserEntryBase::drawFrame (Cairo::RefPtr<Cairo::Context> cr, const G
|
|||||||
|
|
||||||
void ThumbBrowserEntryBase::draw () {
|
void ThumbBrowserEntryBase::draw () {
|
||||||
|
|
||||||
if (!drawable)
|
if (!drawable || !parent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Glib::RWLock::ReaderLock l(lockRW);
|
Glib::RWLock::ReaderLock l(lockRW); // No resizes, position moves etc. inbetween
|
||||||
|
|
||||||
int bbWidth, bbHeight;
|
int bbWidth, bbHeight;
|
||||||
if (backBuffer)
|
if (backBuffer)
|
||||||
backBuffer->get_size (bbWidth, bbHeight);
|
backBuffer->get_size (bbWidth, bbHeight);
|
||||||
|
|
||||||
|
|
||||||
if (!backBuffer || selected!=bbSelected || framed!=bbFramed || preview!=bbPreview
|
if (!backBuffer || selected!=bbSelected || framed!=bbFramed || preview!=bbPreview
|
||||||
|| exp_width!=bbWidth || exp_height!=bbHeight || getIconsOnImageArea ()!=bbIcons)
|
|| exp_width!=bbWidth || exp_height!=bbHeight || getIconsOnImageArea ()!=bbIcons)
|
||||||
updateBackBuffer ();
|
updateBackBuffer ();
|
||||||
|
|
||||||
if (!parent)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Gtk::Widget* w = parent->getDrawingArea ();
|
Gtk::Widget* w = parent->getDrawingArea ();
|
||||||
|
|
||||||
Glib::RefPtr<Gdk::GC> gc_ = Gdk::GC::create (w->get_window());
|
Glib::RefPtr<Gdk::GC> gc_ = Gdk::GC::create (w->get_window());
|
||||||
|
@@ -53,7 +53,7 @@ protected:
|
|||||||
int width; // minimal width
|
int width; // minimal width
|
||||||
int height; // minimal height
|
int height; // minimal height
|
||||||
// set by arrangeFiles() of thumbbrowser
|
// set by arrangeFiles() of thumbbrowser
|
||||||
int exp_width; // arranged width
|
int exp_width; // arranged width (backbuffer dimensions)
|
||||||
int exp_height; // arranged height
|
int exp_height; // arranged height
|
||||||
int startx; // x coord. in the widget
|
int startx; // x coord. in the widget
|
||||||
int starty; // y coord. in the widget
|
int starty; // y coord. in the widget
|
||||||
@@ -72,6 +72,7 @@ protected:
|
|||||||
void drawFrame (Cairo::RefPtr<Cairo::Context> cr, const Gdk::Color& bg, const Gdk::Color& fg);
|
void drawFrame (Cairo::RefPtr<Cairo::Context> cr, const Gdk::Color& bg, const Gdk::Color& fg);
|
||||||
void getTextSizes (int& w, int& h);
|
void getTextSizes (int& w, int& h);
|
||||||
|
|
||||||
|
// called during updateBackBuffer for custom overlays
|
||||||
virtual void customBackBufferUpdate (Cairo::RefPtr<Cairo::Context> c) {}
|
virtual void customBackBufferUpdate (Cairo::RefPtr<Cairo::Context> c) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user