Configurable sound after longer editor operations; see issue #424

This commit is contained in:
Oliver Duis
2010-12-21 21:50:28 +01:00
parent 0c0ffd34d9
commit 84b7e9b6ea
7 changed files with 64 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>, Oliver Duis <www.oliverduis.de>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,6 +24,7 @@
#include <procparamchangers.h>
#include <safegtk.h>
#include <imagesource.h>
#include <soundman.h>
using namespace rtengine::procparams;
@@ -33,6 +35,8 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be
epih->destroyed = false;
epih->pending = 0;
processingStartedTime = 0;
// construct toolpanelcoordinator
tpc = new ToolPanelCoordinator ();
@@ -530,10 +534,10 @@ void EditorPanel::setProgressStr (Glib::ustring str)
g_idle_add (_setprogressStr, s);
}
void EditorPanel::refreshProcessingState (bool state) {
void EditorPanel::refreshProcessingState (bool inProcessing) {
// Set proc params of thumbnail. It saves it into the cache and updates the file browser.
if (ipc && openThm && !state && tpc->getChangedState()) {
if (ipc && openThm && !inProcessing && tpc->getChangedState()) {
rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams);
openThm->setProcParams (pparams, EDITOR, false);
@@ -546,11 +550,24 @@ void EditorPanel::refreshProcessingState (bool state) {
if (wlast)
statusBox->remove (*wlast);
}
if (state)
if (inProcessing) {
if (processingStartedTime==0) processingStartedTime = ::time(NULL);
statusBox->pack_end (*red, Gtk::PACK_SHRINK, 4);
else
} else {
if (processingStartedTime!=0) {
time_t curTime= ::time(NULL);
if (::difftime(curTime, processingStartedTime) > options.sndLngEditProcDoneSecs)
SoundManager::playSoundAsync(options.sndLngEditProcDone);
processingStartedTime = 0;
}
statusBox->pack_end (*green, Gtk::PACK_SHRINK, 4);
}
}
struct errparams {
Glib::ustring descr;