diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a353e191..18e2cf624 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,6 +297,11 @@ if( WIN32 ) macro_log_feature(QTSPARKLE_FOUND "qtsparkle" "Library for creating auto updaters written in Qt" "https://github.com/davidsansome/qtsparkle" FALSE "" "") endif( WIN32 ) +if( WIN32 OR APPLE ) + macro_optional_find_package(Libsnore) + macro_log_feature(LIBSNORE_FOUND "SnoreNotify" "Library for notifications" "https://github.com/TheOneRing/Snorenotify" FALSE "" "") +endif() + #TODO: support external qxt set(QXTWEB_FOUND TRUE) set(QXTWEB_LIBRARIES qxtweb-standalone) diff --git a/CMakeModules/FindLibsnore.cmake b/CMakeModules/FindLibsnore.cmake new file mode 100644 index 000000000..9c46d16fe --- /dev/null +++ b/CMakeModules/FindLibsnore.cmake @@ -0,0 +1,48 @@ +######################################################################################## +# Copyright (c) 2010 Patrick von Reth # +# # +# This program 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 2 of the License, or (at your option) any later # +# version. # +# # +# This program 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 # +# this program. If not, see . # +######################################################################################## + +# - Try to find the libsnore library +# Once done this will define +# +# LIBSNORE_FOUND - system has the LIBSNORE library +# LIBSNORE_LIBRARIES - The libraries needed to use LIBSNORE +# LIBSNORE_PLUGIN_PATH - Path of the plugins + +find_path(LIBSNORE_INCLUDE_DIR + NAMES snore/core/snore.h + PATHS ${KDE4_INCLUDE_DIR} +) + +find_library(LIBSNORE_LIBRARY + NAMES + libsnore + snore + PATHS ${KDE4_LIB_DIR} +) + +find_path(LIBSNORE_PLUGIN_PATH snoreplugins) + +if(LIBSNORE_LIBRARY AND LIBSNORE_PLUGIN_PATH) + set(LIBSNORE_PLUGIN_PATH ${LIBSNORE_PLUGIN_PATH}/snoreplugins) +endif() + +set(LIBSNORE_LIBRARIES ${LIBSNORE_LIBRARY}) +set(LIBSNORE_INCLUDE_DIRS ${LIBSNORE_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LIBSNORE DEFAULT_MSG LIBSNORE_LIBRARIES LIBSNORE_INCLUDE_DIRS) + +mark_as_advanced(LIBSNORE_LIBRARIES LIBSNORE_INCLUDE_DIRS) diff --git a/src/infoplugins/generic/CMakeLists.txt b/src/infoplugins/generic/CMakeLists.txt index 94ea682bd..d863fabc4 100644 --- a/src/infoplugins/generic/CMakeLists.txt +++ b/src/infoplugins/generic/CMakeLists.txt @@ -3,7 +3,6 @@ include_directories( ${Boost_INCLUDE_DIR} ) if(WIN32 OR APPLE) -find_package(Libsnore) if(BUILD_GUI AND LIBSNORE_FOUND) SET(snore_srcs snorenotify/SnoreNotifyPlugin.cpp diff --git a/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp b/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp index acb013e0a..cc8521f95 100644 --- a/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp +++ b/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp @@ -72,10 +72,19 @@ SnoreNotifyPlugin::SnoreNotifyPlugin() m_snore = new Snore::SnoreCore(); m_snore->loadPlugins( Snore::PluginContainer::BACKEND ); QString backend = qgetenv( "SNORE_BACKEND" ).constData(); - backend.isEmpty()?m_snore->setPrimaryNotificationBackend():m_snore->setPrimaryNotificationBackend( backend ); - tDebug( LOGVERBOSE ) << Q_FUNC_INFO << m_snore->primaryNotificationBackend(); - m_application = new Snore::Application( qApp->applicationName(), m_defaultIcon ); + if( backend.isEmpty() ) + { + m_snore->setPrimaryNotificationBackend(); + } + else + { + m_snore->setPrimaryNotificationBackend( backend ); + } + + tDebug( LOGVERBOSE ) << Q_FUNC_INFO << m_snore->primaryNotificationBackend(); + + m_application = new Snore::Application( qApp->applicationName(), m_defaultIcon ); m_snore->addApplication( m_application ); m_snore->applicationIsInitialized( m_application ); @@ -86,8 +95,6 @@ SnoreNotifyPlugin::SnoreNotifyPlugin() addAlert( InfoInboxReceived, tr( "You recived a Song recomondation" ) ); connect( m_snore, SIGNAL( actionInvoked( Snore::Notification ) ), this, SLOT( slotActionInvoked( Snore::Notification ) ) ); - - } @@ -113,28 +120,28 @@ SnoreNotifyPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData ) switch ( pushData.type ) { - case Tomahawk::InfoSystem::InfoTrackUnresolved: - notifyUser( Tomahawk::InfoSystem::InfoTrackUnresolved,"The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." ); - return; + case Tomahawk::InfoSystem::InfoTrackUnresolved: + notifyUser( Tomahawk::InfoSystem::InfoTrackUnresolved,"The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." ); + return; - case Tomahawk::InfoSystem::InfoNotifyUser: - notifyUser( Tomahawk::InfoSystem::InfoNotifyUser,pushData.infoPair.second.toString() ); - return; + case Tomahawk::InfoSystem::InfoNotifyUser: + notifyUser( Tomahawk::InfoSystem::InfoNotifyUser,pushData.infoPair.second.toString() ); + return; - case Tomahawk::InfoSystem::InfoNowStopped: - notifyUser( Tomahawk::InfoSystem::InfoNowStopped, "Tomahawk stopped playback." ); - return; + case Tomahawk::InfoSystem::InfoNowStopped: + notifyUser( Tomahawk::InfoSystem::InfoNowStopped, "Tomahawk stopped playback." ); + return; - case Tomahawk::InfoSystem::InfoNowPlaying: - nowPlaying( pushData.infoPair.second ); - return; + case Tomahawk::InfoSystem::InfoNowPlaying: + nowPlaying( pushData.infoPair.second ); + return; - case Tomahawk::InfoSystem::InfoInboxReceived: - inboxReceived( pushData.infoPair.second ); - return; + case Tomahawk::InfoSystem::InfoInboxReceived: + inboxReceived( pushData.infoPair.second ); + return; - default: - return; + default: + return; } }