Adding Sound notifications for Linux (see issue 469)
This commit is contained in:
@@ -42,9 +42,9 @@ if (WIN32)
|
||||
#set_target_properties (rth PROPERTIES LINK_FLAGS "-mwindows")
|
||||
else (WIN32)
|
||||
include_directories (${EXTRA_INCDIR} ${GLIB2_INCLUDE_DIRS} ${GLIBMM_INCLUDE_DIRS}
|
||||
${GTK_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} ${GIOMM_INCLUDE_DIRS} ${IPTCDATA_INCLUDE_DIRS} ${LCMS_INCLUDE_DIRS} ${EXPAT_INCLUDE_DIRS} ${FFTW3F_LIBRARY_DIRS} ${GTHREAD_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS} )
|
||||
${GTK_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} ${GIOMM_INCLUDE_DIRS} ${IPTCDATA_INCLUDE_DIRS} ${LCMS_INCLUDE_DIRS} ${EXPAT_INCLUDE_DIRS} ${FFTW3F_LIBRARY_DIRS} ${GTHREAD_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS} ${CANBERRA-GTK_INCLUDE_DIRS})
|
||||
link_directories (${EXTRA_LIBDIR} ${GLIB2_LIBRARY_DIRS} ${GLIBMM_LIBRARY_DIRS}
|
||||
${GTK_LIBRARY_DIRS} ${GTKMM_LIBRARY_DIRS} ${GIO_LIBRARY_DIRS} ${GIOMM_LIBRARY_DIRS} ${IPTCDATA_LIBRARY_DIRS} ${LCMS_LIBRARY_DIRS} ${EXPAT_LIBRARY_DIRS} ${FFTW3F_LIBRARY_DIRS} ${GTHREAD_LIBRARY_DIRS} ${GOBJECT_LIBRARY_DIRS})
|
||||
${GTK_LIBRARY_DIRS} ${GTKMM_LIBRARY_DIRS} ${GIO_LIBRARY_DIRS} ${GIOMM_LIBRARY_DIRS} ${IPTCDATA_LIBRARY_DIRS} ${LCMS_LIBRARY_DIRS} ${EXPAT_LIBRARY_DIRS} ${FFTW3F_LIBRARY_DIRS} ${GTHREAD_LIBRARY_DIRS} ${GOBJECT_LIBRARY_DIRS} ${CANBERRA-GTK_LIBRARY_DIRS})
|
||||
endif (WIN32)
|
||||
# create config.h which defines where data are stored
|
||||
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h")
|
||||
@@ -55,6 +55,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} ${EXPAT_LIBRARIES} ${FFTW3F_LIBRARIES} ${IPTCDATA_LIBRARIES} ${EXTRA_LIB_RTGUI})
|
||||
${GLIB2_LIBRARIES} ${GLIBMM_LIBRARIES} ${GTK_LIBRARIES} ${GTKMM_LIBRARIES} ${GIO_LIBRARIES} ${GIOMM_LIBRARIES} ${LCMS_LIBRARIES} ${EXPAT_LIBRARIES} ${FFTW3F_LIBRARIES} ${IPTCDATA_LIBRARIES} ${CANBERRA-GTK_LIBRARIES} ${EXTRA_LIB_RTGUI})
|
||||
install (TARGETS rth DESTINATION ${BINDIR})
|
||||
|
||||
|
@@ -348,7 +348,11 @@ void Options::setDefaults () {
|
||||
cutOverlayBrush = std::vector<double> (4);
|
||||
cutOverlayBrush[3] = 0.667; // :-p
|
||||
|
||||
#if defined(__linux__) || defined(WIN32)
|
||||
sndEnable=true;
|
||||
#else
|
||||
sndEnable=false;
|
||||
#endif
|
||||
sndLngEditProcDoneSecs=3.0;
|
||||
|
||||
// Reminder: 0 = SET mode, 1 = ADD mode
|
||||
|
@@ -1280,6 +1280,10 @@ void Preferences::fillPreferences () {
|
||||
ckbSndEnable->set_active (moptions.sndEnable);
|
||||
txtSndBatchQueueDone->set_text (moptions.sndBatchQueueDone);
|
||||
txtSndLngEditProcDone->set_text (moptions.sndLngEditProcDone);
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
txtSndBatchQueueDone->set_sensitive (false);
|
||||
txtSndLngEditProcDone->set_sensitive (false);
|
||||
#endif
|
||||
spbSndLngEditProcDoneSecs->set_value (moptions.sndLngEditProcDoneSecs);
|
||||
}
|
||||
|
||||
@@ -1307,9 +1311,12 @@ void Preferences::autocielabToggled () {
|
||||
}
|
||||
*/
|
||||
void Preferences::sndEnableToggled () {
|
||||
#ifdef WIN32
|
||||
txtSndBatchQueueDone->set_sensitive(ckbSndEnable->get_active());
|
||||
txtSndLngEditProcDone->set_sensitive(ckbSndEnable->get_active());
|
||||
#elif defined(__linux__) || defined(WIN32)
|
||||
spbSndLngEditProcDoneSecs->set_sensitive(ckbSndEnable->get_active());
|
||||
#endif
|
||||
}
|
||||
|
||||
void Preferences::langAutoDetectToggled () {
|
||||
|
@@ -26,6 +26,10 @@
|
||||
#include <mmsystem.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include <canberra-gtk.h>
|
||||
#endif
|
||||
|
||||
|
||||
void SoundManager::init()
|
||||
{
|
||||
@@ -45,9 +49,10 @@ void SoundManager::init()
|
||||
// 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() || !options.sndEnable) return;
|
||||
if (!options.sndEnable) return;
|
||||
|
||||
#ifdef WIN32
|
||||
if (sound.empty()) return;
|
||||
DWORD sndParam=SND_ASYNC | SND_NODEFAULT;
|
||||
|
||||
if (sound.find('.')!=Glib::ustring::npos) {
|
||||
@@ -61,8 +66,7 @@ void SoundManager::playSoundAsync(const Glib::ustring &sound)
|
||||
wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (sound.c_str(), -1, NULL, NULL, NULL);
|
||||
PlaySoundW(wfilename, NULL, sndParam);
|
||||
g_free( wfilename );
|
||||
#else
|
||||
// TODO: Add code for other OSes here
|
||||
printf("Sound not supported on your OS (yet)\n");
|
||||
#elif defined(__linux__)
|
||||
ca_context_play(ca_gtk_context_get(), 0, CA_PROP_EVENT_ID, "complete", NULL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user