diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,11 +35,13 @@ set(CMAKE_AUTORCC TRUE) find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets) -if (NOT ANDROID) - find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus) -else () - find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED AndroidExtras) - find_package(Gradle REQUIRED) +if(NOT WIN32) + if (NOT ANDROID) + find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus) + else () + find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED AndroidExtras) + find_package(Gradle REQUIRED) + endif() endif() find_package(Qt5 ${REQUIRED_QT_VERSION} QUIET OPTIONAL_COMPONENTS TextToSpeech) set_package_properties(Qt5TextToSpeech PROPERTIES @@ -72,22 +74,23 @@ find_package(KF5Codecs ${KF5_DEP_VERSION} REQUIRED) find_package(KF5CoreAddons ${KF5_DEP_VERSION} REQUIRED) -find_package(Canberra) -set_package_properties(Canberra PROPERTIES DESCRIPTION "Library for generating event sounds" - PURPOSE "Needed to build audio notification support" - URL "http://0pointer.de/lennart/projects/libcanberra" - TYPE OPTIONAL) -if (Canberra_FOUND) - add_definitions(-DHAVE_CANBERRA) -elseif(NOT ANDROID) - # This is REQUIRED since you cannot tell CMake "either one of those two optional ones are required" - find_package(Phonon4Qt5 4.6.60 NO_MODULE REQUIRED) - set_package_properties(Phonon4Qt5 PROPERTIES - DESCRIPTION "Qt-based audio library" - PURPOSE "Needed to build audio notification support when Canberra isn't available") +if(NOT ANDROID AND NOT WIN32) + find_package(Canberra) + set_package_properties(Canberra PROPERTIES DESCRIPTION "Library for generating event sounds" + PURPOSE "Needed to build audio notification support" + URL "http://0pointer.de/lennart/projects/libcanberra" + TYPE OPTIONAL) + if(Canberra_FOUND) + add_definitions(-DHAVE_CANBERRA) + else() + # This is REQUIRED since you cannot tell CMake "either one of those two optional ones are required" + find_package(Phonon4Qt5 4.6.60 NO_MODULE REQUIRED) + set_package_properties(Phonon4Qt5 PROPERTIES + DESCRIPTION "Qt-based audio library" + PURPOSE "Needed to build audio notification support when Canberra isn't available") add_definitions(-DHAVE_PHONON4QT5) + endif() endif() - remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY) #add_definitions(-DQT_NO_FOREACH) if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") diff --git a/src/knotificationmanager.cpp b/src/knotificationmanager.cpp --- a/src/knotificationmanager.cpp +++ b/src/knotificationmanager.cpp @@ -40,12 +40,16 @@ #include "notifybylogfile.h" #include "notifybytaskbar.h" #include "notifybyexecute.h" -#ifndef Q_OS_ANDROID + +#ifdef Q_OS_ANDROID +#include "notifybyandroid.h" +#else +#ifndef Q_OS_WIN #include "notifybypopup.h" #include "notifybyportal.h" -#else -#include "notifybyandroid.h" #endif +#endif + #include "debug_p.h" #if defined(HAVE_CANBERRA) @@ -133,16 +137,17 @@ // We have a series of built-ins up first, and fall back to trying // to instantiate an externally supplied plugin. if (action == QLatin1String("Popup")) { -#ifndef Q_OS_ANDROID +#ifdef Q_OS_ANDROID + plugin = new NotifyByAndroid(this); +#else +#ifndef Q_OS_WIN if (d->portalDBusServiceExists) { plugin = new NotifyByPortal(this); } else { plugin = new NotifyByPopup(this); } -#else - plugin = new NotifyByAndroid(this); #endif - +#endif addPlugin(plugin); } else if (action == QLatin1String("Taskbar")) { plugin = new NotifyByTaskbar(this);