diff --git a/rtdata/languages/default b/rtdata/languages/default index a1a732704..e042c9164 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -506,12 +506,15 @@ PREFERENCES_SHOWONLYRAW;Show only RAW files PREFERENCES_SHTHRESHOLD;Threshold for clipped shadows 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_STARTUPIMDIR;Image directory at startup PREFERENCES_TAB_BROWSER;File Browser PREFERENCES_TAB_COLORMGR;Color Management PREFERENCES_TAB_GENERAL;General PREFERENCES_TAB_IMPROC;Image Processing PREFERENCES_TAB_OUTPUT;Output Options +PREFERENCES_TAB_SOUND;Sounds PREFERENCES_THUMBSIZE;Thumbnail Size PREFERENCES_USESYSTEMTHEME; Use System Theme PREFERENCES_WORKFLOW;Workflow diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt index 4f66aa806..3ea6d649c 100644 --- a/rtgui/CMakeLists.txt +++ b/rtgui/CMakeLists.txt @@ -19,7 +19,7 @@ set (BASESOURCEFILES imageareapanel.cc iptcpanel.cc labcurve.cc lumadenoise.cc main.cc multilangmgr.cc mycurve.cc options.cc preferences.cc profilepanel.cc saveasdlg.cc - saveformatpanel.cc splash.cc + saveformatpanel.cc soundman.cc splash.cc thumbnail.cc tonecurve.cc toolbar.cc guiutils.cc zoompanel.cc toolpanelcoord.cc thumbbrowserentrybase.cc batchqueueentry.cc @@ -31,6 +31,7 @@ set (BASESOURCEFILES if (WIN32) set (EXTRA_SRC windirmonitor.cc myicon.o) + set (EXTRA_LIB_RTGUI winmm) include_directories ( ../rtengine ${CMAKE_CURRENT_BINARY_DIR} . ../rtexif ${EXTRA_INCDIR} ${GLIB2_INCLUDE_DIRS} ${GLIBMM_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} ${GIOMM_INCLUDE_DIRS}) link_directories (. ../rtexif ${EXTRA_LIBDIR} ${GLIB2_LIBRARY_DIRS} ${GLIBMM_LIBRARY_DIRS} @@ -51,6 +52,6 @@ set_target_properties (rth PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS}" OUTPUT_ #target_link_libraries (rth rtengine ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${TIFF_LIBRARIES} ${EXTRA_LIB} ${GOBJECT_LIBRARIES} ${GTHREAD_LIBRARIES} # ${GLIB2_LIBRARIES} ${GLIBMM_LIBRARIES} ${GTK_LIBRARIES} ${GTKMM_LIBRARIES} ${GIO_LIBRARIES} ${GIOMM_LIBRARIES} ${LCMS_LIBRARIES} ${IPTCDATA_LIBRARIES}) target_link_libraries (rth rtengine ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${TIFF_LIBRARIES} ${GOBJECT_LIBRARIES} ${GTHREAD_LIBRARIES} - ${GLIB2_LIBRARIES} ${GLIBMM_LIBRARIES} ${GTK_LIBRARIES} ${GTKMM_LIBRARIES} ${GIO_LIBRARIES} ${GIOMM_LIBRARIES} ${LCMS_LIBRARIES} ${IPTCDATA_LIBRARIES}) + ${GLIB2_LIBRARIES} ${GLIBMM_LIBRARIES} ${GTK_LIBRARIES} ${GTKMM_LIBRARIES} ${GIO_LIBRARIES} ${GIOMM_LIBRARIES} ${LCMS_LIBRARIES} ${IPTCDATA_LIBRARIES} ${EXTRA_LIB_RTGUI}) install (TARGETS rth DESTINATION ${BINDIR}) diff --git a/rtgui/batchqueuepanel.cc b/rtgui/batchqueuepanel.cc index 75c71db11..eee5f4d6a 100644 --- a/rtgui/batchqueuepanel.cc +++ b/rtgui/batchqueuepanel.cc @@ -21,7 +21,8 @@ #include #include #include -#include +#include + BatchQueuePanel::BatchQueuePanel () { @@ -260,6 +261,8 @@ void BatchQueuePanel::queueEmpty () { stopBatchProc (); fdir->set_sensitive (true); fformat->set_sensitive (true); + + SoundManager::playSoundAsync(options.sndBatchQueueDone); } bool BatchQueuePanel::canStartNext () { diff --git a/rtgui/options.cc b/rtgui/options.cc index 127c3fd7f..79966f2c9 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -296,6 +296,10 @@ if (keyFile.has_group ("Batch Processing")) { if (keyFile.has_key ("Batch Processing", "AdjusterBehavior")) baBehav = keyFile.get_integer_list ("Batch Processing", "AdjusterBehavior"); } +if (keyFile.has_group ("Sounds")) { + if (keyFile.has_key ("Sounds", "BatchQueueDone")) sndBatchQueueDone = keyFile.get_string ("Sounds", "BatchQueueDone"); +} + return 0; } @@ -424,6 +428,8 @@ int Options::saveToFile (Glib::ustring fname) { Glib::ArrayHandle bab = baBehav; keyFile.set_integer_list ("Batch Processing", "AdjusterBehavior", bab); + keyFile.set_string ("Sounds", "BatchQueueDone", sndBatchQueueDone); + FILE *f = safe_g_fopen (fname, "wt"); if (f==NULL) diff --git a/rtgui/options.h b/rtgui/options.h index 9b4d290d4..4d2da84b7 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -136,6 +136,9 @@ class Options { int multiDisplayMode; // 0=none, 1=Edit panels on other display std::vector cutOverlayBrush; // Red;Green;Blue;Alpha , all ranging 0..1 + Glib::ustring sndBatchQueueDone; + + Options (); Options* copyFrom (Options* other); diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 26ac0943a..8a45b1c84 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -1,7 +1,7 @@ /* * This file is part of RawTherapee. * - * Copyright (c) 2004-2010 Gabor Horvath + * Copyright (c) 2004-2010 Gabor Horvath , Oliver Duis * * RawTherapee is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,6 +81,7 @@ Preferences::Preferences (RTWindow *rtwindow):parent(rtwindow) { nb->append_page (*getFileBrowserPanel(), M("PREFERENCES_TAB_BROWSER")); nb->append_page (*getColorManagementPanel(),M("PREFERENCES_TAB_COLORMGR")); nb->append_page (*getBatchProcPanel(), M("PREFERENCES_BATCH_PROCESSING")); + nb->append_page (*getSoundPanel(), M("PREFERENCES_TAB_SOUND")); nb->set_current_page (0); fillPreferences (); @@ -673,6 +674,27 @@ Gtk::Widget* Preferences::getFileBrowserPanel () { return mvbfb; } +Gtk::Widget* Preferences::getSoundPanel () { + Gtk::VBox* pSnd = new Gtk::VBox (); + + Gtk::Label* lSndHelp = Gtk::manage (new Gtk::Label (M("PREFERENCES_SND_HELP"))); + pSnd->pack_start (*lSndHelp, Gtk::PACK_SHRINK, 4); + + Gtk::HBox* pBatchQueueDone = new Gtk::HBox(); + + Gtk::Label* lSndBatchQueueDone = Gtk::manage (new Gtk::Label (M("PREFERENCES_SND_BATCHQUEUEDONE") + Glib::ustring(":"))); + pBatchQueueDone->pack_start (*lSndBatchQueueDone, Gtk::PACK_SHRINK, 12); + + txtSndBatchQueueDone = Gtk::manage (new Gtk::Entry()); + pBatchQueueDone->pack_end (*txtSndBatchQueueDone, Gtk::PACK_EXPAND_WIDGET, 4); + + pSnd->pack_start (*pBatchQueueDone, Gtk::PACK_SHRINK, 4); + + pSnd->set_border_width (4); + + return pSnd; +} + void Preferences::parseDir (Glib::ustring dirname, std::vector& items, Glib::ustring ext) { // process directory @@ -787,6 +809,8 @@ void Preferences::storePreferences () { moptions.mainNBVertical = editorMode==1; moptions.overwriteOutputFile = chOverwriteOutputFile->get_active (); + + moptions.sndBatchQueueDone = txtSndBatchQueueDone->get_text (); } void Preferences::fillPreferences () { @@ -892,6 +916,8 @@ void Preferences::fillPreferences () { dfconn.block (false); chOverwriteOutputFile->set_active (moptions.overwriteOutputFile); + + txtSndBatchQueueDone->set_text (moptions.sndBatchQueueDone); } /* diff --git a/rtgui/preferences.h b/rtgui/preferences.h index f06edeb5b..37f887823 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -107,6 +107,8 @@ class Preferences : public Gtk::Dialog { Gtk::ComboBoxText* editorLayout; RTWindow* parent; + Gtk::Entry* txtSndBatchQueueDone; + Options moptions; sigc::connection tconn, fconn, usethcon, addc, setc, dfconn; Glib::ustring initialTheme; @@ -130,6 +132,7 @@ class Preferences : public Gtk::Dialog { Gtk::Widget* getFileBrowserPanel (); Gtk::Widget* getGeneralPanel (); Gtk::Widget* getBatchProcPanel (); + Gtk::Widget* getSoundPanel (); public: Preferences (RTWindow *rtwindow); diff --git a/rtgui/soundman.cc b/rtgui/soundman.cc new file mode 100644 index 000000000..f98be7977 --- /dev/null +++ b/rtgui/soundman.cc @@ -0,0 +1,50 @@ +/* +* This file is part of RawTherapee. +* +* Copyright (c) 2010 Oliver Duis +* +* RawTherapee is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* RawTherapee is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with RawTherapee. If not, see . +* +*/ + +#include + +#ifdef WIN32 +#include +#include +#endif + +// Plays a sound in async mode to not block the main thread +// param is either file name or name of the system event on Windows (e.g. "SystemAsterisk" or "SystemDefault"). +void SoundManager::playSoundAsync(const Glib::ustring &sound) +{ + if (sound.empty()) return; + +#ifdef WIN32 + DWORD sndParam=SND_ASYNC | SND_NODEFAULT; + + if (sound.find('.')!=Glib::ustring::npos) { + // contain dot, so it's a filename + sndParam|=SND_FILENAME; + } else { + // no dot, so it's a system event + sndParam|=SND_ALIAS; + } + + PlaySound(safe_filename_from_utf8(sound).c_str(), NULL, sndParam); +#else + // TODO: Add code for other OSes here + printf("Sound not supported on your OS (yet)\n"); +#endif +} \ No newline at end of file diff --git a/rtgui/soundman.h b/rtgui/soundman.h new file mode 100644 index 000000000..799753814 --- /dev/null +++ b/rtgui/soundman.h @@ -0,0 +1,31 @@ +/* +* This file is part of RawTherapee. +* +* Copyright (c) 2010 Oliver Duis +* +* RawTherapee is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* RawTherapee is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with RawTherapee. If not, see . +* +*/ + +#ifndef _SOUNDMAN_ +#define _SOUNDMAN_ + +#include + +class SoundManager { +public: + static void playSoundAsync(const Glib::ustring &sound); +}; + +#endif