From 1b85b9c0d65c3eb0a4271234f0421ca89ef45714 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Fri, 4 Apr 2014 10:55:08 +0200 Subject: [PATCH] qt5 support for snore --- CMakeLists.txt | 8 +++-- CMakeModules/FindLibsnore.cmake | 34 ------------------- .../generic/snorenotify/SnoreNotifyPlugin.cpp | 12 +++++++ 3 files changed, 18 insertions(+), 36 deletions(-) delete mode 100644 CMakeModules/FindLibsnore.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 18e2cf624..b45934a64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -298,8 +298,12 @@ if( WIN32 ) 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 "" "") +if( TOMAHAWK_QT5 ) + macro_optional_find_package(LibsnoreQt5 QUIET) +else() + macro_optional_find_package(Libsnore QUIET) +endif() + macro_log_feature(LIBSNORE_FOUND "Libsnore" "Library for notifications" "https://github.com/TheOneRing/Snorenotify" FALSE "" "") endif() #TODO: support external qxt diff --git a/CMakeModules/FindLibsnore.cmake b/CMakeModules/FindLibsnore.cmake deleted file mode 100644 index 4dc0b9e0b..000000000 --- a/CMakeModules/FindLibsnore.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# - 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_INCLUDE_DIRS - The includes needed to use LIBSNORE -# LIBSNORE_PLUGIN_PATH - Path of the plugins -# Copyright 2013 Patrick von Reth - -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/snorenotify/SnoreNotifyPlugin.cpp b/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp index 603d608d8..fdc876b73 100644 --- a/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp +++ b/src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp @@ -33,8 +33,20 @@ #include #include + + +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) +namespace Qt +{ +inline QString escape( const QString &x ) +{ + x.toHtmlEscaped(); + } + } +#else // QTextDocument provides Qt::escape() #include +#endif namespace Tomahawk {