diff --git a/CMakeLists.txt b/CMakeLists.txt index 792dbd8ff..ec601f487 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,19 +28,12 @@ if (CCACHE_EXECUTABLE) SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_EXECUTABLE}) endif () -if (UNIX AND NOT APPLE) - set(LINUX 1) -endif (UNIX AND NOT APPLE) - -find_package(Qt4 4.8.1 REQUIRED QtCore QtGui QtOpenGL QtSql QtNetwork QtXml) - -if(NOT APPLE) - find_package(Qt4 COMPONENTS QtWebKit) -endif(NOT APPLE) - -# Find Qt's lconvert binary. Try qt's binary dir first, fall back to looking in PATH -find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH) -find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt4) +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set(LINUX ON) +endif() +if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set(FREEBSD ON) +endif() if(APPLE) if(NOT QT_MAC_USE_COCOA) @@ -48,15 +41,23 @@ if(APPLE) endif(NOT QT_MAC_USE_COCOA) endif(APPLE) -find_package(OpenGL REQUIRED) +set(OpenGL_GL_PREFERENCE LEGACY) +find_package(OpenGL) +if(OPENGL_FOUND) + set(HAVE_OPENGL ON) +endif(OPENGL_FOUND) find_package(Boost REQUIRED) find_package(Gettext REQUIRED) find_package(PkgConfig REQUIRED) find_package(Protobuf REQUIRED) find_package(FFTW3) find_package(ALSA) -if(ALSA_FOUND) - set(HAVE_ALSA ON) +pkg_check_modules(DBUS dbus-1) +if (NOT APPLE) + find_package(X11) +endif() +if(X11_FOUND) + set(HAVE_X11 ON) endif() find_library(PROTOBUF_STATIC_LIBRARY libprotobuf.a libprotobuf) @@ -79,7 +80,7 @@ pkg_check_modules(LIBMYGPO_QT libmygpo-qt>=1.0.9) pkg_check_modules(LIBPULSE libpulse) pkg_check_modules(LIBXML libxml-2.0) pkg_check_modules(QJSON REQUIRED QJson) -pkg_check_modules(SPOTIFY libspotify>=12.1.45) +pkg_check_modules(LIBSPOTIFY libspotify>=12.1.45) pkg_check_modules(TAGLIB taglib) if (WIN32) @@ -93,6 +94,22 @@ find_path(LASTFM1_INCLUDE_DIRS lastfm/Track.h) find_path(SPARSEHASH_INCLUDE_DIRS google/sparsetable) +# QT +find_package(Qt4 4.8.1 REQUIRED QtCore QtGui QtSql QtNetwork QtXml) +if (DBUS_FOUND) + find_package(Qt4 REQUIRED QtDbus) +endif () +if (OPENGL_FOUND) + find_package(Qt4 REQUIRED QtOpenGL) +endif(OPENGL_FOUND) + +# We can include the Qt definitions now +include(${QT_USE_FILE}) + +# Find Qt's lconvert binary. Try qt's binary dir first, fall back to looking in PATH +find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH) +find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt4) + # Only use system taglib if it's greater than 1.11.1 # There is a bug in version 1.11.1 corrupting Ogg files, see: https://github.com/taglib/taglib/issues/864 # If you decide to use the systems taglib, make sure it has been patched with the following commit: @@ -135,13 +152,11 @@ endif() if (APPLE) find_library(SPARKLE Sparkle) - - find_library(SPOTIFY libspotify) - if (SPOTIFY) - set (SPOTIFY_FOUND ON) - set (SPOTIFY_INCLUDE_DIRS ${SPOTIFY}) - set (SPOTIFY_LIBRARIES ${SPOTIFY}) - endif (SPOTIFY) + find_library(LIBSPOTIFY libspotify) + if(LIBSPOTIFY_FOUND) + set(LIBSPOTIFY_INCLUDE_DIRS ${LIBSPOTIFY}) + set(LIBSPOTIFY_LIBRARIES ${LIBSPOTIFY}) + endif(LIBSPOTIFY_FOUND) add_subdirectory(3rdparty/SPMediaKeyTap) set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SPMediaKeyTap) @@ -161,11 +176,6 @@ link_directories(${TAGLIB_LIBRARY_DIRS}) link_directories(${QJSON_LIBRARY_DIRS}) link_directories(${GSTREAMER_LIBRARY_DIRS}) -# Don't try to use webkit if their include directories couldn't be found. -if (NOT QT_QTWEBKIT_INCLUDE_DIR) - set (QT_USE_QTWEBKIT 0) -endif (NOT QT_QTWEBKIT_INCLUDE_DIR) - include_directories(${Boost_INCLUDE_DIRS}) include_directories(${TAGLIB_INCLUDE_DIRS}) include_directories(${QJSON_INCLUDE_DIRS}) @@ -256,24 +266,33 @@ optional_component(LIBLASTFM ON "Last.fm support" ) optional_component(DBUS ON "D-Bus support" - DEPENDS "Linux" LINUX + DEPENDS "D-Bus" DBUS_FOUND ) optional_component(WIIMOTEDEV ON "Wiimote support" - DEPENDS "D-Bus support" HAVE_DBUS + DEPENDS "D-Bus support" DBUS_FOUND ) optional_component(DEVICEKIT ON "Devices: DeviceKit backend" - DEPENDS "D-Bus support" HAVE_DBUS + DEPENDS "D-Bus support" DBUS_FOUND ) optional_component(UDISKS2 ON "Devices: UDisks2 backend" - DEPENDS "D-Bus support" HAVE_DBUS + DEPENDS "D-Bus support" DBUS_FOUND +) + +if (CRYPTOPP_FOUND OR HAVE_SPOTIFY_BLOB) + set(CRYPTOPP_OR_HAVE_SPOTIFY_BLOB ON) +endif() + +optional_component(SPOTIFY ON "Spotify support" + DEPENDS "cryptopp or spotify blob" CRYPTOPP_OR_HAVE_SPOTIFY_BLOB ) optional_component(SPOTIFY_BLOB ON "Spotify support: non-GPL binary helper" + DEPENDS "spotify support" HAVE_SPOTIFY DEPENDS "protobuf" PROTOBUF_FOUND PROTOBUF_PROTOC_EXECUTABLE - DEPENDS "libspotify" SPOTIFY_FOUND + DEPENDS "libspotify" LIBSPOTIFY_FOUND ) optional_component(MOODBAR ON "Moodbar support" @@ -281,42 +300,49 @@ optional_component(MOODBAR ON "Moodbar support" ) optional_component(SPARKLE ON "Sparkle integration" - DEPENDS "Mac OS X" APPLE + DEPENDS "macOS" APPLE DEPENDS "Sparkle" SPARKLE ) +optional_component(ALSA ON "ALSA integration" + DEPENDS "ALSA" ALSA_FOUND +) + optional_component(LIBPULSE ON "Pulse audio integration" DEPENDS "libpulse" LIBPULSE_FOUND ) -optional_component(VISUALISATIONS ON "Visualisations") +optional_component(VISUALISATIONS ON "Visualisations" + DEPENDS "opengl" OPENGL_FOUND +) -if(NOT HAVE_SPOTIFY_BLOB AND NOT CRYPTOPP_FOUND) - message(FATAL_ERROR "Either crypto++ must be available or the non-GPL Spotify " - "code must be compiled in") -elseif(CRYPTOPP_FOUND) - set(HAVE_CRYPTOPP ON) - set(HAVE_SPOTIFY_DOWNLOADER ON) +optional_component(TRANSLATIONS ON "Translations" + DEPENDS "gettext" GETTEXT_XGETTEXT_EXECUTABLE + DEPENDS "lconvert" QT_LCONVERT_EXECUTABLE +) + +option(USE_BUNDLE "Bundle macos/windows dependencies" ON) +if (APPLE AND USE_BUNDLE AND NOT USE_BUNDLE_DIR) + set(USE_BUNDLE_DIR "../PlugIns") endif() -# Find DBus if it's enabled -if (HAVE_DBUS) - find_package(Qt4 REQUIRED QtDbus) -endif () - -# We can include the Qt definitions now -include(${QT_USE_FILE}) +if(CRYPTOPP_FOUND) + set(HAVE_CRYPTOPP ON) + if(HAVE_SPOTIFY) + set(HAVE_SPOTIFY_DOWNLOADER ON) + endif(HAVE_SPOTIFY) +endif(CRYPTOPP_FOUND) # Remove GLU and GL from the link line - they're not really required # and don't exist on my mingw toolchain list(REMOVE_ITEM QT_LIBRARIES "-lGLU -lGL") +option(USE_SYSTEM_PROJECTM "Don't set this option unless your system projectM library has been compiled with the Clementine patches in 3rdparty" OFF) option(BUNDLE_PROJECTM_PRESETS "Install Clementine's own copies of libprojectm presets - disable this if you want to use a system package instead" ON) -if(ENABLE_VISUALISATIONS) +if(HAVE_VISUALISATIONS) # When/if upstream accepts our patches then these options can be used to link # to system installed projectM instead. - option(USE_SYSTEM_PROJECTM "Don't set this option unless your system projectM library has been compiled with the Clementine patches in 3rdparty" OFF) if(USE_SYSTEM_PROJECTM) pkg_check_modules(LIBPROJECTM libprojectM) else(USE_SYSTEM_PROJECTM) @@ -324,7 +350,7 @@ if(ENABLE_VISUALISATIONS) set(LIBPROJECTM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/libprojectm) set(LIBPROJECTM_LIBRARIES projectM) endif(USE_SYSTEM_PROJECTM) -endif(ENABLE_VISUALISATIONS) +endif(HAVE_VISUALISATIONS) # Build our copy of QSqlLiteDriver. diff --git a/ext/libclementine-common/core/workerpool.h b/ext/libclementine-common/core/workerpool.h index 49fe099c0..ed3965e4c 100644 --- a/ext/libclementine-common/core/workerpool.h +++ b/ext/libclementine-common/core/workerpool.h @@ -229,8 +229,8 @@ void WorkerPool::DoStart() { QStringList search_path; search_path << qApp->applicationDirPath(); -#ifdef Q_OS_MAC - search_path << qApp->applicationDirPath() + "/../PlugIns"; +#if defined(Q_OS_MACOS) && defined(USE_BUNDLE) + search_path << qApp->applicationDirPath() + "/" + USE_BUNDLE_DIR; #endif for (const QString& path_prefix : search_path) { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e4cc15cc8..beac29dc0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,7 +31,6 @@ include_directories(${CMAKE_BINARY_DIR}) include_directories(${GLIB_INCLUDE_DIRS}) include_directories(${LIBXML_INCLUDE_DIRS}) include_directories(${GOBJECT_INCLUDE_DIRS}) -include_directories(${LIBPROJECTM_INCLUDE_DIRS}) include_directories(${QTSINGLEAPPLICATION_INCLUDE_DIRS}) include_directories(${QTIOCOMPRESSOR_INCLUDE_DIRS}) include_directories(${QXT_INCLUDE_DIRS}) @@ -39,8 +38,11 @@ include_directories(${SHA2_INCLUDE_DIRS}) include_directories(${CHROMAPRINT_INCLUDE_DIRS}) include_directories(${MYGPOQT_INCLUDE_DIRS}) -find_package(OpenGL) -include_directories(${OPENGL_INCLUDE_DIR}) +if (HAVE_VISUALISATIONS) + find_package(OpenGL REQUIRED) + include_directories(${OPENGL_INCLUDE_DIR}) + include_directories(${LIBPROJECTM_INCLUDE_DIRS}) +endif(HAVE_VISUALISATIONS) if(HAVE_LIBLASTFM) include_directories(${LASTFM_INCLUDE_DIRS}) @@ -55,12 +57,16 @@ include_directories(${CMAKE_SOURCE_DIR}/ext/libclementine-tagreader) include_directories(${CMAKE_BINARY_DIR}/ext/libclementine-tagreader) include_directories(${CMAKE_SOURCE_DIR}/ext/libclementine-remote) include_directories(${CMAKE_BINARY_DIR}/ext/libclementine-remote) -include_directories(${CMAKE_SOURCE_DIR}/ext/libclementine-spotifyblob) -include_directories(${CMAKE_BINARY_DIR}/ext/libclementine-spotifyblob) +if(HAVE_SPOTIFY) + include_directories(${CMAKE_SOURCE_DIR}/ext/libclementine-spotifyblob) + include_directories(${CMAKE_BINARY_DIR}/ext/libclementine-spotifyblob) +endif(HAVE_SPOTIFY) cmake_policy(SET CMP0011 NEW) include(../cmake/ParseArguments.cmake) -include(../cmake/Translations.cmake) +if(HAVE_TRANSLATIONS) + include(../cmake/Translations.cmake) +endif(HAVE_TRANSLATIONS) set(SOURCES analyzers/analyzerbase.cpp @@ -153,7 +159,6 @@ set(SOURCES globalsearch/simplesearchprovider.cpp globalsearch/somafmsearchprovider.cpp globalsearch/intergalacticfmsearchprovider.cpp - globalsearch/spotifysearchprovider.cpp globalsearch/suggestionwidget.cpp globalsearch/urlsearchprovider.cpp @@ -190,9 +195,6 @@ set(SOURCES internet/somafm/somafmurlhandler.cpp internet/intergalacticfm/intergalacticfmservice.cpp internet/intergalacticfm/intergalacticfmurlhandler.cpp - internet/spotify/spotifyserver.cpp - internet/spotify/spotifyservice.cpp - internet/spotify/spotifysettingspage.cpp internet/subsonic/subsonicservice.cpp internet/subsonic/subsonicsettingspage.cpp internet/subsonic/subsonicurlhandler.cpp @@ -464,7 +466,6 @@ set(HEADERS globalsearch/globalsearchview.h globalsearch/searchprovider.h globalsearch/simplesearchprovider.h - globalsearch/spotifysearchprovider.h globalsearch/suggestionwidget.h internet/core/cloudfileservice.h @@ -497,9 +498,6 @@ set(HEADERS internet/somafm/somafmurlhandler.h internet/intergalacticfm/intergalacticfmservice.h internet/intergalacticfm/intergalacticfmurlhandler.h - internet/spotify/spotifyserver.h - internet/spotify/spotifyservice.h - internet/spotify/spotifysettingspage.h internet/subsonic/subsonicservice.h internet/subsonic/subsonicsettingspage.h internet/subsonic/subsonicurlhandler.h @@ -516,11 +514,11 @@ set(HEADERS library/libraryviewcontainer.h library/librarywatcher.h library/savedgroupingmanager.h - + musicbrainz/acoustidclient.h musicbrainz/musicbrainzclient.h musicbrainz/tagfetcher.h - + networkremote/networkremotehelper.h networkremote/networkremote.h networkremote/incomingdataparser.h @@ -699,7 +697,6 @@ set(UI internet/magnatune/magnatunedownloaddialog.ui internet/magnatune/magnatunesettingspage.ui internet/core/searchboxwidget.ui - internet/spotify/spotifysettingspage.ui internet/subsonic/subsonicsettingspage.ui library/groupbydialog.ui @@ -787,27 +784,29 @@ set(RESOURCES set(OTHER_SOURCES) -set(LINGUAS "All" CACHE STRING "A space-seperated list of translations to compile in to Clementine, or \"None\".") -if (LINGUAS STREQUAL "All") - # build LANGUAGES from all existing .po files - file(GLOB pofiles translations/*.po) - foreach(pofile ${pofiles}) - get_filename_component(lang ${pofile} NAME_WE) - list(APPEND LANGUAGES ${lang}) - endforeach(pofile) -else (LINGUAS STREQUAL "All") - if (NOT LINGUAS OR LINGUAS STREQUAL "None") - set (LANGUAGES "") - else (NOT LINGUAS OR LINGUAS STREQUAL "None") - string(REGEX MATCHALL [a-zA-Z_@]+ +if (HAVE_TRANSLATIONS) + set(LINGUAS "All" CACHE STRING "A space-seperated list of translations to compile in to Clementine, or \"None\".") + if (LINGUAS STREQUAL "All") + # build LANGUAGES from all existing .po files + file(GLOB pofiles translations/*.po) + foreach(pofile ${pofiles}) + get_filename_component(lang ${pofile} NAME_WE) + list(APPEND LANGUAGES ${lang}) + endforeach(pofile) + else (LINGUAS STREQUAL "All") + if (NOT LINGUAS OR LINGUAS STREQUAL "None") + set (LANGUAGES "") + else (NOT LINGUAS OR LINGUAS STREQUAL "None") + string(REGEX MATCHALL [a-zA-Z_@]+ LANGUAGES ${LINGUAS}) - endif (NOT LINGUAS OR LINGUAS STREQUAL "None") -endif (LINGUAS STREQUAL "All") + endif (NOT LINGUAS OR LINGUAS STREQUAL "None") + endif (LINGUAS STREQUAL "All") +endif(HAVE_TRANSLATIONS) option(USE_INSTALL_PREFIX "Look for data in CMAKE_INSTALL_PREFIX" ON) # Visualisations -optional_source(ENABLE_VISUALISATIONS +optional_source(HAVE_VISUALISATIONS SOURCES visualisations/projectmpresetmodel.cpp visualisations/projectmvisualisation.cpp @@ -845,16 +844,33 @@ optional_source(HAVE_LIBLASTFM internet/lastfm/lastfmsettingspage.ui ) - -optional_source(HAVE_SPOTIFY_DOWNLOADER +# Spotify support +optional_source(HAVE_SPOTIFY SOURCES - internet/spotify/spotifyblobdownloader.cpp + internet/spotify/spotifyserver.cpp + internet/spotify/spotifyservice.cpp + internet/spotify/spotifysettingspage.cpp + globalsearch/spotifysearchprovider.cpp HEADERS - internet/spotify/spotifyblobdownloader.h - INCLUDE_DIRECTORIES - ${CRYPTOPP_INCLUDE_DIRS} + globalsearch/spotifysearchprovider.h + internet/spotify/spotifyserver.h + internet/spotify/spotifyservice.h + internet/spotify/spotifysettingspage.h + UI + internet/spotify/spotifysettingspage.ui ) +if(HAVE_SPOTIFY) + optional_source(HAVE_SPOTIFY_DOWNLOADER + SOURCES + internet/spotify/spotifyblobdownloader.cpp + HEADERS + internet/spotify/spotifyblobdownloader.h + INCLUDE_DIRECTORIES + ${CRYPTOPP_INCLUDE_DIRS} + ) +endif(HAVE_SPOTIFY) + # Platform specific - OS X optional_source(APPLE INCLUDE_DIRECTORIES @@ -896,10 +912,10 @@ optional_source(WIN32 ) # Platform specific - X11 -optional_source(LINUX SOURCES widgets/osd_x11.cpp) +optional_source(HAVE_X11 SOURCES widgets/osd_x11.cpp) -# DBUS and MPRIS - Linux specific -if(HAVE_DBUS) +# DBUS and MPRIS - Unix specific +if(UNIX AND HAVE_DBUS) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus) # MPRIS 2.0 DBUS interfaces @@ -1004,7 +1020,7 @@ if(HAVE_DBUS) dbus/org.wiimotedev.deviceEvents.xml dbus/wiimotedev) endif(ENABLE_WIIMOTEDEV) -endif(HAVE_DBUS) +endif(UNIX AND HAVE_DBUS) optional_source(HAVE_DBUS SOURCES @@ -1208,16 +1224,18 @@ qt4_wrap_cpp(MOC ${HEADERS} OPTIONS "-D_SYS_SYSMACROS_H_OUTER") qt4_wrap_ui(UIC ${UI}) qt4_add_resources(QRC ${RESOURCES}) -add_pot(POT - ${CMAKE_CURRENT_SOURCE_DIR}/translations/header - ${CMAKE_CURRENT_SOURCE_DIR}/translations/translations.pot - ${SOURCES} ${MOC} ${UIC} ${OTHER_SOURCES} - ../data/oauthsuccess.html -) -add_po(PO clementine_ - LANGUAGES ${LANGUAGES} - DIRECTORY translations -) +if(HAVE_TRANSLATIONS) + add_pot(POT + ${CMAKE_CURRENT_SOURCE_DIR}/translations/header + ${CMAKE_CURRENT_SOURCE_DIR}/translations/translations.pot + ${SOURCES} ${MOC} ${UIC} ${OTHER_SOURCES} + ../data/oauthsuccess.html + ) + add_po(PO clementine_ + LANGUAGES ${LANGUAGES} + DIRECTORY translations + ) +endif(HAVE_TRANSLATIONS) add_library(clementine_lib STATIC ${SOURCES} @@ -1229,11 +1247,7 @@ add_library(clementine_lib STATIC ${OTHER_UIC_SOURCES} ) -add_dependencies(clementine_lib pot) - - target_link_libraries(clementine_lib - clementine-spotifyblob-messages libclementine-common libclementine-tagreader libclementine-remote @@ -1260,9 +1274,9 @@ target_link_libraries(clementine_lib Qocoa ) -if(ENABLE_VISUALISATIONS) +if(HAVE_VISUALISATIONS) target_link_libraries(clementine_lib ${LIBPROJECTM_LIBRARIES}) -endif(ENABLE_VISUALISATIONS) +endif(HAVE_VISUALISATIONS) if(HAVE_LIBLASTFM) target_link_libraries(clementine_lib ${LASTFM_LIBRARIES}) @@ -1299,6 +1313,10 @@ if(HAVE_BREAKPAD) endif (LINUX) endif(HAVE_BREAKPAD) +if(HAVE_SPOTIFY) + target_link_libraries(clementine_lib clementine-spotifyblob-messages) +endif(HAVE_SPOTIFY) + if(HAVE_SPOTIFY_DOWNLOADER) target_link_libraries(clementine_lib ${CRYPTOPP_LIBRARIES} @@ -1354,7 +1372,7 @@ if (UNIX AND NOT APPLE) # they end up getting ignored. This appends them to the very end of the link # line, ensuring they're always used. find_package(X11) - if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + if (FREEBSD) target_link_libraries(clementine_lib ${X11_X11_LIB}) else () target_link_libraries(clementine_lib ${X11_X11_LIB} ${CMAKE_DL_LIBS}) @@ -1387,9 +1405,9 @@ add_executable(clementine main.cpp ) -if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") +if (FREEBSD) target_link_libraries(clementine execinfo) -endif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") +endif (FREEBSD) target_link_libraries(clementine clementine_lib @@ -1431,12 +1449,14 @@ if (APPLE) WORLD_READ WORLD_EXECUTE) endif (HAVE_BREAKPAD) - add_custom_command(TARGET clementine - POST_BUILD - COMMAND - ${CMAKE_CURRENT_SOURCE_DIR}/../dist/macdeploy.py ${PROJECT_BINARY_DIR}/clementine.app -f - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - ) + if (USE_BUNDLE) + add_custom_command(TARGET clementine + POST_BUILD + COMMAND + ${CMAKE_CURRENT_SOURCE_DIR}/../dist/macdeploy.py ${PROJECT_BINARY_DIR}/clementine.app -f + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) + endif(USE_BUNDLE) add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/clementine.breakpad COMMAND diff --git a/src/analyzers/analyzerbase.h b/src/analyzers/analyzerbase.h index 8074bfaef..9831575b6 100644 --- a/src/analyzers/analyzerbase.h +++ b/src/analyzers/analyzerbase.h @@ -26,6 +26,8 @@ #ifndef ANALYZERS_ANALYZERBASE_H_ #define ANALYZERS_ANALYZERBASE_H_ +#include "config.h" + #ifdef __FreeBSD__ #include #endif @@ -38,6 +40,7 @@ #include #include +#ifdef HAVE_OPENGL #include #ifdef Q_WS_MACX #include @@ -46,6 +49,7 @@ #include #include #endif +#endif class QEvent; class QPaintEvent; diff --git a/src/analyzers/rainbowanalyzer.cpp b/src/analyzers/rainbowanalyzer.cpp index 82ba7a601..7cb0b44c2 100644 --- a/src/analyzers/rainbowanalyzer.cpp +++ b/src/analyzers/rainbowanalyzer.cpp @@ -25,8 +25,10 @@ #include -#include #include +#include +#include +#include #include "core/arraysize.h" #include "core/logging.h" diff --git a/src/analyzers/rainbowanalyzer.h b/src/analyzers/rainbowanalyzer.h index ccb70b673..511ba33de 100644 --- a/src/analyzers/rainbowanalyzer.h +++ b/src/analyzers/rainbowanalyzer.h @@ -26,7 +26,9 @@ #include "analyzerbase.h" -#include +#include +#include +#include namespace Rainbow { class RainbowAnalyzer : public Analyzer::Base { diff --git a/src/config.h.in b/src/config.h.in index 4475e28dc..20427754b 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -20,13 +20,14 @@ #define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" #define CMAKE_EXECUTABLE_SUFFIX "${CMAKE_EXECUTABLE_SUFFIX}" -#cmakedefine ENABLE_VISUALISATIONS +#cmakedefine HAVE_VISUALISATIONS #cmakedefine HAVE_AMAZON_CLOUD_DRIVE #cmakedefine HAVE_AUDIOCD #cmakedefine HAVE_BOX #cmakedefine HAVE_BREAKPAD #cmakedefine HAVE_CRYPTOPP #cmakedefine HAVE_DBUS +#cmakedefine HAVE_X11 #cmakedefine HAVE_DEVICEKIT #cmakedefine HAVE_DROPBOX #cmakedefine HAVE_GIO @@ -44,9 +45,15 @@ #cmakedefine HAVE_SPOTIFY_DOWNLOADER #cmakedefine HAVE_UDISKS2 #cmakedefine HAVE_WIIMOTEDEV +#cmakedefine HAVE_OPENGL +#cmakedefine HAVE_TRANSLATIONS +#cmakedefine HAVE_SPOTIFY #cmakedefine TAGLIB_HAS_OPUS #cmakedefine USE_INSTALL_PREFIX #cmakedefine USE_SYSTEM_PROJECTM #cmakedefine USE_SYSTEM_SHA2 +#cmakedefine USE_BUNDLE + +#define USE_BUNDLE_DIR "${USE_BUNDLE_DIR}" #endif // CONFIG_H_IN diff --git a/src/core/globalshortcuts.cpp b/src/core/globalshortcuts.cpp index 0f0749443..8aa7860dc 100644 --- a/src/core/globalshortcuts.cpp +++ b/src/core/globalshortcuts.cpp @@ -19,6 +19,7 @@ along with Clementine. If not, see . */ +#include "config.h" #include "globalshortcuts.h" #include "gnomeglobalshortcutbackend.h" #include "macglobalshortcutbackend.h" @@ -31,7 +32,7 @@ #include #include -#ifdef QT_DBUS_LIB +#ifdef HAVE_DBUS #include #endif @@ -147,10 +148,10 @@ GlobalShortcuts::Shortcut GlobalShortcuts::AddShortcut( } bool GlobalShortcuts::IsGsdAvailable() const { -#ifdef QT_DBUS_LIB +#ifdef HAVE_DBUS return QDBusConnection::sessionBus().interface()->isServiceRegistered( GnomeGlobalShortcutBackend::kGsdService); -#else // QT_DBUS_LIB +#else // HAVE_DBUS return false; #endif } diff --git a/src/core/gnomeglobalshortcutbackend.cpp b/src/core/gnomeglobalshortcutbackend.cpp index 8a0f58760..a0205cc9f 100644 --- a/src/core/gnomeglobalshortcutbackend.cpp +++ b/src/core/gnomeglobalshortcutbackend.cpp @@ -17,13 +17,14 @@ along with Clementine. If not, see . */ -#include "gnomeglobalshortcutbackend.h" -#include "globalshortcuts.h" +#include "config.h" #include "core/closure.h" #include "core/logging.h" +#include "globalshortcuts.h" +#include "gnomeglobalshortcutbackend.h" -#ifdef QT_DBUS_LIB -#include "dbus/gnomesettingsdaemon.h" +#ifdef HAVE_DBUS +#include #endif #include @@ -31,7 +32,7 @@ #include #include -#ifdef QT_DBUS_LIB +#ifdef HAVE_DBUS #include #endif @@ -48,7 +49,7 @@ GnomeGlobalShortcutBackend::GnomeGlobalShortcutBackend(GlobalShortcuts* parent) is_connected_(false) {} bool GnomeGlobalShortcutBackend::DoRegister() { -#ifdef QT_DBUS_LIB +#ifdef HAVE_DBUS qLog(Debug) << "registering"; // Check if the GSD service is available if (!QDBusConnection::sessionBus().interface()->isServiceRegistered( @@ -71,7 +72,7 @@ bool GnomeGlobalShortcutBackend::DoRegister() { SLOT(RegisterFinished(QDBusPendingCallWatcher*)), watcher); return true; -#else // QT_DBUS_LIB +#else // HAVE_DBUS qLog(Warning) << "dbus not available"; return false; #endif @@ -79,7 +80,7 @@ bool GnomeGlobalShortcutBackend::DoRegister() { void GnomeGlobalShortcutBackend::RegisterFinished( QDBusPendingCallWatcher* watcher) { -#ifdef QT_DBUS_LIB +#ifdef HAVE_DBUS QDBusMessage reply = watcher->reply(); watcher->deleteLater(); @@ -94,12 +95,12 @@ void GnomeGlobalShortcutBackend::RegisterFinished( is_connected_ = true; qLog(Debug) << "registered"; -#endif // QT_DBUS_LIB +#endif // HAVE_DBUS } void GnomeGlobalShortcutBackend::DoUnregister() { qLog(Debug) << "unregister"; -#ifdef QT_DBUS_LIB +#ifdef HAVE_DBUS // Check if the GSD service is available if (!QDBusConnection::sessionBus().interface()->isServiceRegistered( kGsdService)) diff --git a/src/core/metatypes.cpp b/src/core/metatypes.cpp index 859faa308..4c5337e88 100644 --- a/src/core/metatypes.cpp +++ b/src/core/metatypes.cpp @@ -113,7 +113,6 @@ void RegisterMetaTypes() { qRegisterMetaType("QFileInfo"); #ifdef HAVE_DBUS - qDBusRegisterMetaType(); qDBusRegisterMetaType(); qDBusRegisterMetaType(); qDBusRegisterMetaType>(); @@ -123,5 +122,8 @@ void RegisterMetaTypes() { qDBusRegisterMetaType(); qDBusRegisterMetaType(); +#ifdef HAVE_X11 + qDBusRegisterMetaType(); +#endif #endif } diff --git a/src/covers/albumcoverloader.cpp b/src/covers/albumcoverloader.cpp index 8ebf51cce..fd48f044f 100644 --- a/src/covers/albumcoverloader.cpp +++ b/src/covers/albumcoverloader.cpp @@ -34,7 +34,9 @@ #include "core/tagreaderclient.h" #include "core/utilities.h" #include "internet/core/internetmodel.h" +#ifdef HAVE_SPOTIFY #include "internet/spotify/spotifyservice.h" +#endif AlbumCoverLoader::AlbumCoverLoader(QObject* parent) : QObject(parent), @@ -176,7 +178,9 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage( remote_tasks_.insert(reply, task); return TryLoadResult(true, false, QImage()); - } else if (filename.toLower().startsWith("spotify://image/")) { + } +#ifdef HAVE_SPOTIFY + else if (filename.toLower().startsWith("spotify://image/")) { // HACK: we should add generic image URL handlers SpotifyService* spotify = InternetModel::Service(); @@ -197,6 +201,7 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage( Q_ARG(QString, id)); return TryLoadResult(true, false, QImage()); } +#endif QImage image(filename); return TryLoadResult( @@ -204,6 +209,7 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage( image.isNull() ? task.options.default_output_image_ : image); } +#ifdef HAVE_SPOTIFY void AlbumCoverLoader::SpotifyImageLoaded(const QString& id, const QImage& image) { if (!remote_spotify_tasks_.contains(id)) return; @@ -213,6 +219,7 @@ void AlbumCoverLoader::SpotifyImageLoaded(const QString& id, emit ImageLoaded(task.id, scaled); emit ImageLoaded(task.id, scaled, image); } +#endif void AlbumCoverLoader::RemoteFetchFinished(QNetworkReply* reply) { reply->deleteLater(); diff --git a/src/covers/albumcoverloader.h b/src/covers/albumcoverloader.h index 4d3e4d571..c5fae6b4c 100644 --- a/src/covers/albumcoverloader.h +++ b/src/covers/albumcoverloader.h @@ -22,6 +22,7 @@ #define COVERS_ALBUMCOVERLOADER_H_ #include "albumcoverloaderoptions.h" +#include "config.h" #include "core/song.h" #include @@ -66,7 +67,9 @@ class AlbumCoverLoader : public QObject { protected slots: void ProcessTasks(); void RemoteFetchFinished(QNetworkReply* reply); +#ifdef HAVE_SPOTIFY void SpotifyImageLoaded(const QString& url, const QImage& image); +#endif protected: enum State { State_TryingManual, State_TryingAuto, }; diff --git a/src/engines/gstenginepipeline.cpp b/src/engines/gstenginepipeline.cpp index 25fdffcb3..680ad2ed0 100644 --- a/src/engines/gstenginepipeline.cpp +++ b/src/engines/gstenginepipeline.cpp @@ -15,6 +15,8 @@ along with Clementine. If not, see . */ +#include "config.h" + #include #include @@ -33,8 +35,10 @@ #include "core/signalchecker.h" #include "core/utilities.h" #include "internet/core/internetmodel.h" +#ifdef HAVE_SPOTIFY #include "internet/spotify/spotifyserver.h" #include "internet/spotify/spotifyservice.h" +#endif const int GstEnginePipeline::kGstStateTimeoutNanosecs = 10000000; const int GstEnginePipeline::kFaderFudgeMsec = 2000; @@ -151,6 +155,7 @@ bool GstEnginePipeline::ReplaceDecodeBin(GstElement* new_bin) { bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) { GstElement* new_bin = nullptr; +#ifdef HAVE_SPOTIFY if (url.scheme() == "spotify") { new_bin = gst_bin_new("spotify_bin"); @@ -181,6 +186,7 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) { spotify_server, "StartPlayback", Qt::QueuedConnection, Q_ARG(QString, url.toString()), Q_ARG(quint16, port)); } else { +#endif new_bin = engine_->CreateElement("uridecodebin"); if (!new_bin) return false; g_object_set(G_OBJECT(new_bin), "uri", url.toEncoded().constData(), @@ -190,7 +196,9 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) { CHECKED_GCONNECT(G_OBJECT(new_bin), "pad-added", &NewPadCallback, this); CHECKED_GCONNECT(G_OBJECT(new_bin), "notify::source", &SourceSetupCallback, this); +#ifdef HAVE_SPOTIFY } +#endif return ReplaceDecodeBin(new_bin); } @@ -1043,6 +1051,7 @@ GstState GstEnginePipeline::state() const { } QFuture GstEnginePipeline::SetState(GstState state) { +#ifdef HAVE_SPOTIFY if (url_.scheme() == "spotify" && !buffering_) { const GstState current_state = this->state(); @@ -1061,6 +1070,7 @@ QFuture GstEnginePipeline::SetState(GstState state) { Q_ARG(bool, false)); } } +#endif return ConcurrentRun::Run( &set_state_threadpool_, &gst_element_set_state, pipeline_, state); } diff --git a/src/internet/core/internetmodel.cpp b/src/internet/core/internetmodel.cpp index d7db2975b..756d48073 100644 --- a/src/internet/core/internetmodel.cpp +++ b/src/internet/core/internetmodel.cpp @@ -41,7 +41,6 @@ #include "internet/magnatune/magnatuneservice.h" #include "internet/podcasts/podcastservice.h" #include "internet/somafm/somafmservice.h" -#include "internet/spotify/spotifyservice.h" #include "internet/subsonic/subsonicservice.h" #include "smartplaylists/generatormimedata.h" @@ -60,6 +59,9 @@ #ifdef HAVE_SEAFILE #include "internet/seafile/seafileservice.h" #endif +#ifdef HAVE_SPOTIFY +#include "internet/spotify/spotifyservice.h" +#endif using smart_playlists::Generator; using smart_playlists::GeneratorMimeData; @@ -92,7 +94,9 @@ InternetModel::InternetModel(Application* app, QObject* parent) AddService(new RadioTunesService(app, this)); AddService(new SomaFMService(app, this)); AddService(new IntergalacticFMService(app, this)); +#ifdef HAVE_SPOTIFY AddService(new SpotifyService(app, this)); +#endif AddService(new SubsonicService(app, this)); #ifdef HAVE_BOX AddService(new BoxService(app, this)); diff --git a/src/internet/spotify/spotifyservice.cpp b/src/internet/spotify/spotifyservice.cpp index 9d9045266..ff51614d1 100644 --- a/src/internet/spotify/spotifyservice.cpp +++ b/src/internet/spotify/spotifyservice.cpp @@ -90,9 +90,9 @@ SpotifyService::SpotifyService(Application* app, InternetModel* parent) // Build the search path for the binary blob. // Look for one distributed alongside clementine first, then check in the // user's home directory for any that have been downloaded. -#ifdef Q_OS_MAC - system_blob_path_ = QCoreApplication::applicationDirPath() + - "/../PlugIns/clementine-spotifyblob"; +#if defined(Q_OS_MACOS) && defined(USE_BUNDLE) + system_blob_path_ = QCoreApplication::applicationDirPath() + "/" + + USE_BUNDLE_DIR + "/clementine-spotifyblob"; #else system_blob_path_ = QCoreApplication::applicationDirPath() + "/clementine-spotifyblob" CMAKE_EXECUTABLE_SUFFIX; diff --git a/src/main.cpp b/src/main.cpp index 4963a9863..0959c8ce1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -162,14 +162,16 @@ void SetGstreamerEnvironment() { QString registry_filename; // On windows and mac we bundle the gstreamer plugins with clementine +#ifdef USE_BUNDLE #if defined(Q_OS_DARWIN) - scanner_path = - QCoreApplication::applicationDirPath() + "/../PlugIns/gst-plugin-scanner"; - plugin_path = - QCoreApplication::applicationDirPath() + "/../PlugIns/gstreamer"; + scanner_path = QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + + "/gst-plugin-scanner"; + plugin_path = QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + + "/gstreamer"; #elif defined(Q_OS_WIN32) plugin_path = QCoreApplication::applicationDirPath() + "/gstreamer-plugins"; #endif +#endif #if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN) registry_filename = @@ -188,9 +190,9 @@ void SetGstreamerEnvironment() { SetEnv("GST_REGISTRY", registry_filename); } -#ifdef Q_OS_DARWIN - SetEnv("GIO_EXTRA_MODULES", - QCoreApplication::applicationDirPath() + "/../PlugIns/gio-modules"); +#if defined(Q_OS_DARWIN) && defined(USE_BUNDLE) + SetEnv("GIO_EXTRA_MODULES", QCoreApplication::applicationDirPath() + "/" + + USE_BUNDLE_DIR + "/gio-modules"); #endif SetEnv("PULSE_PROP_media.role", "music"); @@ -350,9 +352,13 @@ int main(int argc, char* argv[]) { .toInt()); } -#ifdef Q_OS_DARWIN - QCoreApplication::setLibraryPaths( - QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns"); +#if defined(Q_OS_DARWIN) && defined(USE_BUNDLE) + qLog(Debug) << "Looking for resources in" + + QCoreApplication::applicationDirPath() + "/" + + USE_BUNDLE_DIR; + QCoreApplication::setLibraryPaths(QStringList() + << QCoreApplication::applicationDirPath() + + "/" + USE_BUNDLE_DIR); #endif a.setQuitOnLastWindowClosed(false); @@ -394,7 +400,9 @@ int main(int argc, char* argv[]) { // Resources Q_INIT_RESOURCE(data); +#ifdef HAVE_TRANSLATIONS Q_INIT_RESOURCE(translations); +#endif // Add root CA cert for SoundCloud, whose certificate is missing on OS X. QSslSocket::addDefaultCaCertificates( diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index dfdfa1669..c8327c073 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -139,7 +140,7 @@ #include "wiimotedev/shortcuts.h" #endif -#ifdef ENABLE_VISUALISATIONS +#ifdef HAVE_VISUALISATIONS #include "visualisations/visualisationcontainer.h" #endif @@ -526,7 +527,7 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd, ui_->action_next_playlist, /* These two actions aren't associated */ ui_->action_previous_playlist /* to a button but to the main window */); -#ifdef ENABLE_VISUALISATIONS +#ifdef HAVE_VISUALISATIONS connect(ui_->action_visualisations, SIGNAL(triggered()), SLOT(ShowVisualisations())); #else @@ -2731,7 +2732,7 @@ void MainWindow::CheckFullRescanRevisions() { void MainWindow::ShowQueueManager() { queue_manager_->show(); } void MainWindow::ShowVisualisations() { -#ifdef ENABLE_VISUALISATIONS +#ifdef HAVE_VISUALISATIONS if (!visualisation_) { visualisation_.reset(new VisualisationContainer); @@ -2750,7 +2751,7 @@ void MainWindow::ShowVisualisations() { } visualisation_->show(); -#endif // ENABLE_VISUALISATIONS +#endif // HAVE_VISUALISATIONS } void MainWindow::ConnectInfoView(SongInfoBase* view) { diff --git a/src/ui/mainwindow.h b/src/ui/mainwindow.h index c007f311c..d14417f0e 100644 --- a/src/ui/mainwindow.h +++ b/src/ui/mainwindow.h @@ -339,7 +339,7 @@ signals: std::unique_ptr track_selection_dialog_; PlaylistItemList autocomplete_tag_items_; -#ifdef ENABLE_VISUALISATIONS +#ifdef HAVE_VISUALISATIONS std::unique_ptr visualisation_; #endif diff --git a/src/ui/settingsdialog.cpp b/src/ui/settingsdialog.cpp index 7549446e1..354187ade 100644 --- a/src/ui/settingsdialog.cpp +++ b/src/ui/settingsdialog.cpp @@ -34,7 +34,6 @@ #include "internet/digitally/digitallyimportedsettingspage.h" #include "internet/magnatune/magnatunesettingspage.h" #include "internet/podcasts/podcastsettingspage.h" -#include "internet/spotify/spotifysettingspage.h" #include "internet/subsonic/subsonicsettingspage.h" #include "library/librarysettingspage.h" #include "mainwindow.h" @@ -78,6 +77,10 @@ #include "internet/seafile/seafilesettingspage.h" #endif +#ifdef HAVE_SPOTIFY +#include "internet/spotify/spotifysettingspage.h" +#endif + #include #include #include @@ -174,7 +177,9 @@ SettingsDialog::SettingsDialog(Application* app, BackgroundStreams* streams, AddPage(Page_Skydrive, new SkydriveSettingsPage(this), providers); #endif +#ifdef HAVE_SPOTIFY AddPage(Page_Spotify, new SpotifySettingsPage(this), providers); +#endif #ifdef HAVE_SEAFILE AddPage(Page_Seafile, new SeafileSettingsPage(this), providers); diff --git a/src/widgets/osd.cpp b/src/widgets/osd.cpp index 2d81eb12f..96085f1e2 100644 --- a/src/widgets/osd.cpp +++ b/src/widgets/osd.cpp @@ -233,7 +233,7 @@ void OSD::ShowMessage(const QString& summary, const QString& message, } } -#ifndef HAVE_DBUS +#if !defined(HAVE_X11) && defined(HAVE_DBUS) void OSD::CallFinished(QDBusPendingCallWatcher*) {} #endif diff --git a/src/widgets/osd.h b/src/widgets/osd.h index 201481a1f..5d938e358 100644 --- a/src/widgets/osd.h +++ b/src/widgets/osd.h @@ -38,6 +38,7 @@ class QDBusPendingCallWatcher; #ifdef HAVE_DBUS #include +#include QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image); const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image); @@ -106,7 +107,9 @@ class OSD : public QObject { QString ReplaceVariable(const QString& variable, const Song& song); private slots: +#if defined(HAVE_DBUS) void CallFinished(QDBusPendingCallWatcher* watcher); +#endif void AlbumArtLoaded(const Song& song, const QString& uri, const QImage& image);