Make the Spotify downloader optional again on Windows and Mac

This commit is contained in:
David Sansome 2013-09-18 01:09:56 +10:00
parent b20c473ae0
commit 4e8dba16d4
6 changed files with 45 additions and 13 deletions

View File

@ -76,7 +76,7 @@ pkg_check_modules(LIBGPOD libgpod-1.0>=0.7.92)
pkg_check_modules(LIBMTP libmtp>=1.0)
pkg_check_modules(LIBMYGPO_QT libmygpo-qt>=1.0.7)
pkg_check_modules(LIBXML libxml-2.0)
pkg_check_modules(QCA REQUIRED qca2)
pkg_check_modules(QCA qca2)
pkg_check_modules(QJSON REQUIRED QJson)
pkg_check_modules(SPOTIFY libspotify>=12.1.45)
pkg_check_modules(TAGLIB REQUIRED taglib>=1.6)
@ -270,6 +270,12 @@ optional_component(SPARKLE ON "Sparkle integration"
optional_component(VISUALISATIONS ON "Visualisations")
if(NOT HAVE_SPOTIFY_BLOB AND NOT QCA_FOUND)
message(FATAL_ERROR "Either QCA must be available or the non-GPL Spotify "
"code must be compiled in")
elif(QCA_FOUND)
set(HAVE_SPOTIFY_DOWNLOADER ON)
endif()
# Find DBus if it's enabled
if (HAVE_DBUS)

View File

@ -10,8 +10,6 @@ if(BUILD_WERROR)
endif (LINUX)
endif(BUILD_WERROR)
link_directories(${QCA_LIBRARY_DIRS})
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(../3rdparty/gmock/gtest/include)
if(WIN32)
@ -40,7 +38,6 @@ include_directories(${ECHONEST_INCLUDE_DIRS})
include_directories(${SHA2_INCLUDE_DIRS})
include_directories(${CHROMAPRINT_INCLUDE_DIRS})
include_directories(${MYGPOQT_INCLUDE_DIRS})
include_directories(${QCA_INCLUDE_DIRS})
find_package(OpenGL)
include_directories(${OPENGL_INCLUDE_DIR})
@ -198,7 +195,6 @@ set(SOURCES
internet/somafmservice.cpp
internet/somafmurlhandler.cpp
internet/soundcloudservice.cpp
internet/spotifyblobdownloader.cpp
internet/spotifyserver.cpp
internet/spotifyservice.cpp
internet/spotifysettingspage.cpp
@ -396,7 +392,6 @@ set(SOURCES
widgets/tracksliderpopup.cpp
widgets/tracksliderslider.cpp
widgets/widgetfadehelper.cpp
)
set(HEADERS
@ -498,7 +493,6 @@ set(HEADERS
internet/somafmservice.h
internet/somafmurlhandler.h
internet/soundcloudservice.h
internet/spotifyblobdownloader.h
internet/spotifyserver.h
internet/spotifyservice.h
internet/spotifysettingspage.h
@ -839,6 +833,16 @@ optional_source(HAVE_LIBLASTFM
internet/lastfmstationdialog.ui
)
optional_source(HAVE_SPOTIFY_DOWNLOADER
SOURCES
internet/spotifyblobdownloader.cpp
HEADERS
internet/spotifyblobdownloader.h
INCLUDE_DIRECTORIES
${QCA_INCLUDE_DIRS}
)
# Platform specific - OS X
optional_source(APPLE
INCLUDE_DIRECTORIES
@ -1186,7 +1190,6 @@ target_link_libraries(clementine_lib
${QTSINGLECOREAPPLICATION_LIBRARIES}
${QTIOCOMPRESSOR_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${QCA_LIBRARIES}
z
Qocoa
)
@ -1235,6 +1238,13 @@ if(HAVE_BREAKPAD)
endif (LINUX)
endif(HAVE_BREAKPAD)
if(HAVE_SPOTIFY_DOWNLOADER)
target_link_libraries(clementine_lib
${QCA_LIBRARIES}
)
link_directories(${QCA_LIBRARY_DIRS})
endif(HAVE_SPOTIFY_DOWNLOADER)
if (APPLE)
target_link_libraries(clementine_lib
${GROWL}

View File

@ -39,6 +39,7 @@
#cmakedefine HAVE_QCA
#cmakedefine HAVE_SKYDRIVE
#cmakedefine HAVE_SPARKLE
#cmakedefine HAVE_SPOTIFY_DOWNLOADER
#cmakedefine HAVE_STATIC_SQLITE
#cmakedefine HAVE_UBUNTU_ONE
#cmakedefine HAVE_WIIMOTEDEV

View File

@ -2,7 +2,6 @@
#include "config.h"
#include "internetmodel.h"
#include "searchboxwidget.h"
#include "spotifyblobdownloader.h"
#include "spotifyserver.h"
#include "spotifyservice.h"
#include "core/application.h"
@ -31,6 +30,9 @@
#include <QSettings>
#include <QVariant>
#ifdef HAVE_SPOTIFY_DOWNLOADER
#include "spotifyblobdownloader.h"
#endif
Q_DECLARE_METATYPE(QStandardItem*);
@ -290,9 +292,11 @@ void SpotifyService::StartBlobProcess() {
app_->task_manager()->SetTaskFinished(login_task_id_);
}
if (SpotifyBlobDownloader::Prompt()) {
InstallBlob();
}
#ifdef HAVE_SPOTIFY_DOWNLOADER
if (SpotifyBlobDownloader::Prompt()) {
InstallBlob();
}
#endif
return;
}
@ -317,12 +321,14 @@ bool SpotifyService::IsBlobInstalled() const {
}
void SpotifyService::InstallBlob() {
#ifdef HAVE_SPOTIFY_DOWNLOADER
// The downloader deletes itself when it finishes
SpotifyBlobDownloader* downloader = new SpotifyBlobDownloader(
local_blob_version_, QFileInfo(local_blob_path_).path(), this);
connect(downloader, SIGNAL(Finished()), SLOT(BlobDownloadFinished()));
connect(downloader, SIGNAL(Finished()), SIGNAL(BlobStateChanged()));
downloader->Start();
#endif // HAVE_SPOTIFY_DOWNLOADER
}
void SpotifyService::BlobDownloadFinished() {

View File

@ -73,7 +73,12 @@ void SpotifySettingsPage::BlobStateChanged() {
ui_->account_group->setEnabled(installed);
ui_->blob_status->setText(installed ? tr("Installed") : tr("Not installed"));
#ifdef HAVE_SPOTIFY_DOWNLOADER
ui_->download_blob->setEnabled(!installed);
#else
ui_->download_blob->hide();
#endif
}
void SpotifySettingsPage::DownloadBlob() {

View File

@ -63,7 +63,6 @@
#include <QTextCodec>
#include <QTranslator>
#include <QtConcurrentRun>
#include <QtCrypto>
#include <QtDebug>
#include <glib-object.h>
@ -75,6 +74,9 @@ using boost::scoped_ptr;
#include <echonest/Config.h>
#ifdef HAVE_SPOTIFY_DOWNLOADER
#include <QtCrypto>
#endif
#ifdef Q_OS_DARWIN
#include <sys/resource.h>
@ -356,7 +358,9 @@ int main(int argc, char *argv[]) {
}
#endif
#ifdef HAVE_SPOTIFY_DOWNLOADER
QCA::Initializer qca_initializer;
#endif
// Resources
Q_INIT_RESOURCE(data);