Configurable sound after longer editor operations; see issue #424
This commit is contained in:
@@ -508,6 +508,8 @@ PREFERENCES_SINGLETAB;Single tab mode
|
||||
PREFERENCES_SINGLETABVERTAB;Single tab mode, vertical tabs
|
||||
PREFERENCES_SND_BATCHQUEUEDONE;Batch queue done
|
||||
PREFERENCES_SND_HELP;Either enter filepath or nothing (for no sound). On Windows use "SystemDefault", "SystemAsterisk" etc. for system sounds.
|
||||
PREFERENCES_SND_LNGEDITPROCDONE;Editor processing done
|
||||
PREFERENCES_SND_TRESHOLDSECS;after secs
|
||||
PREFERENCES_STARTUPIMDIR;Image directory at startup
|
||||
PREFERENCES_TAB_BROWSER;File Browser
|
||||
PREFERENCES_TAB_COLORMGR;Color Management
|
||||
|
@@ -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;
|
||||
|
@@ -102,6 +102,9 @@ class EditorPanel : public Gtk::VBox,
|
||||
bool idle_sendToGimp( ProgressConnector<rtengine::IImage16*> *pc);
|
||||
bool idle_sentToGimp(ProgressConnector<int> *pc,rtengine::IImage16* img,Glib::ustring filename);
|
||||
int err;
|
||||
|
||||
time_t processingStartedTime;
|
||||
|
||||
public:
|
||||
|
||||
EditorPanel (FilePanel* filePanel = NULL);
|
||||
@@ -120,8 +123,8 @@ class EditorPanel : public Gtk::VBox,
|
||||
void setProgressStr (Glib::ustring str);
|
||||
void setProgressState (int state);
|
||||
void error (Glib::ustring descr);
|
||||
void refreshProcessingState (bool state); // this is called by setProcessingState in the gtk thread
|
||||
void displayError (Glib::ustring descr); // this is called by error in the gtk thread
|
||||
void refreshProcessingState (bool inProcessing); // this is called by setProcessingState in the gtk thread
|
||||
|
||||
// PParamsChangeListener interface
|
||||
void procParamsChanged (rtengine::procparams::ProcParams* params, rtengine::ProcEvent ev, Glib::ustring descr, ParamsEdited* paramsEdited=NULL);
|
||||
@@ -148,8 +151,6 @@ class EditorPanel : public Gtk::VBox,
|
||||
Glib::ustring getFileName ();
|
||||
bool handleShortcutKey (GdkEventKey* event);
|
||||
|
||||
//void saveOptions ();
|
||||
|
||||
Gtk::Paned *catalogPane;
|
||||
};
|
||||
|
||||
|
@@ -127,6 +127,8 @@ void Options::setDefaults () {
|
||||
cutOverlayBrush = std::vector<double> (4);
|
||||
cutOverlayBrush[3] = 0.667;
|
||||
|
||||
sndLngEditProcDoneSecs=3.0;
|
||||
|
||||
int babehav[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0};
|
||||
baBehav = std::vector<int> (babehav, babehav+ADDSET_PARAM_NUM);
|
||||
|
||||
@@ -298,6 +300,8 @@ if (keyFile.has_group ("Batch Processing")) {
|
||||
|
||||
if (keyFile.has_group ("Sounds")) {
|
||||
if (keyFile.has_key ("Sounds", "BatchQueueDone")) sndBatchQueueDone = keyFile.get_string ("Sounds", "BatchQueueDone");
|
||||
if (keyFile.has_key ("Sounds", "LngEditProcDone")) sndLngEditProcDone = keyFile.get_string ("Sounds", "LngEditProcDone");
|
||||
if (keyFile.has_key ("Sounds", "LngEditProcDoneSecs")) sndLngEditProcDoneSecs = keyFile.get_double ("Sounds", "LngEditProcDoneSecs");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -429,6 +433,8 @@ int Options::saveToFile (Glib::ustring fname) {
|
||||
keyFile.set_integer_list ("Batch Processing", "AdjusterBehavior", bab);
|
||||
|
||||
keyFile.set_string ("Sounds", "BatchQueueDone", sndBatchQueueDone);
|
||||
keyFile.set_string ("Sounds", "LngEditProcDone", sndLngEditProcDone);
|
||||
keyFile.set_double ("Sounds", "LngEditProcDoneSecs", sndLngEditProcDoneSecs);
|
||||
|
||||
|
||||
FILE *f = safe_g_fopen (fname, "wt");
|
||||
|
@@ -137,6 +137,8 @@ class Options {
|
||||
std::vector<double> cutOverlayBrush; // Red;Green;Blue;Alpha , all ranging 0..1
|
||||
|
||||
Glib::ustring sndBatchQueueDone;
|
||||
Glib::ustring sndLngEditProcDone;
|
||||
double sndLngEditProcDoneSecs; // Minimum processing time seconds till the sound is played
|
||||
|
||||
|
||||
Options ();
|
||||
|
@@ -680,6 +680,7 @@ Gtk::Widget* Preferences::getSoundPanel () {
|
||||
Gtk::Label* lSndHelp = Gtk::manage (new Gtk::Label (M("PREFERENCES_SND_HELP")));
|
||||
pSnd->pack_start (*lSndHelp, Gtk::PACK_SHRINK, 4);
|
||||
|
||||
// BatchQueueDone
|
||||
Gtk::HBox* pBatchQueueDone = new Gtk::HBox();
|
||||
|
||||
Gtk::Label* lSndBatchQueueDone = Gtk::manage (new Gtk::Label (M("PREFERENCES_SND_BATCHQUEUEDONE") + Glib::ustring(":")));
|
||||
@@ -690,6 +691,26 @@ Gtk::Widget* Preferences::getSoundPanel () {
|
||||
|
||||
pSnd->pack_start (*pBatchQueueDone, Gtk::PACK_SHRINK, 4);
|
||||
|
||||
// LngEditProcDone
|
||||
Gtk::HBox* pSndLngEditProcDone = new Gtk::HBox();
|
||||
|
||||
Gtk::Label* lSndLngEditProcDone = Gtk::manage (new Gtk::Label (M("PREFERENCES_SND_LNGEDITPROCDONE") + Glib::ustring(":")));
|
||||
pSndLngEditProcDone->pack_start (*lSndLngEditProcDone, Gtk::PACK_SHRINK, 12);
|
||||
|
||||
txtSndLngEditProcDone = Gtk::manage (new Gtk::Entry());
|
||||
pSndLngEditProcDone->pack_start (*txtSndLngEditProcDone, Gtk::PACK_EXPAND_WIDGET, 4);
|
||||
|
||||
Gtk::Label* lSndLngEditProcDoneSecs = Gtk::manage (new Gtk::Label (M("PREFERENCES_SND_TRESHOLDSECS") + Glib::ustring(":")));
|
||||
pSndLngEditProcDone->pack_start (*lSndLngEditProcDoneSecs, Gtk::PACK_SHRINK, 12);
|
||||
|
||||
spbSndLngEditProcDoneSecs = new Gtk::SpinButton ();
|
||||
spbSndLngEditProcDoneSecs->set_digits (1);
|
||||
spbSndLngEditProcDoneSecs->set_increments (0.5, 1);
|
||||
spbSndLngEditProcDoneSecs->set_range (0, 10);
|
||||
pSndLngEditProcDone->pack_end (*spbSndLngEditProcDoneSecs, Gtk::PACK_SHRINK, 4);
|
||||
|
||||
pSnd->pack_start (*pSndLngEditProcDone, Gtk::PACK_SHRINK, 4);
|
||||
|
||||
pSnd->set_border_width (4);
|
||||
|
||||
return pSnd;
|
||||
@@ -810,7 +831,10 @@ void Preferences::storePreferences () {
|
||||
|
||||
moptions.overwriteOutputFile = chOverwriteOutputFile->get_active ();
|
||||
|
||||
// Sounds
|
||||
moptions.sndBatchQueueDone = txtSndBatchQueueDone->get_text ();
|
||||
moptions.sndLngEditProcDone = txtSndLngEditProcDone->get_text ();
|
||||
moptions.sndLngEditProcDoneSecs = spbSndLngEditProcDoneSecs->get_value ();
|
||||
}
|
||||
|
||||
void Preferences::fillPreferences () {
|
||||
@@ -917,7 +941,10 @@ void Preferences::fillPreferences () {
|
||||
|
||||
chOverwriteOutputFile->set_active (moptions.overwriteOutputFile);
|
||||
|
||||
// Sounds
|
||||
txtSndBatchQueueDone->set_text (moptions.sndBatchQueueDone);
|
||||
txtSndLngEditProcDone->set_text (moptions.sndLngEditProcDone);
|
||||
spbSndLngEditProcDoneSecs->set_value (moptions.sndLngEditProcDoneSecs);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -108,6 +108,8 @@ class Preferences : public Gtk::Dialog {
|
||||
RTWindow* parent;
|
||||
|
||||
Gtk::Entry* txtSndBatchQueueDone;
|
||||
Gtk::Entry* txtSndLngEditProcDone;
|
||||
Gtk::SpinButton* spbSndLngEditProcDoneSecs;
|
||||
|
||||
Options moptions;
|
||||
sigc::connection tconn, fconn, usethcon, addc, setc, dfconn;
|
||||
|
Reference in New Issue
Block a user