Add option to diable Tidal and Deezer

This commit is contained in:
Jonas Kvinge 2018-10-17 23:49:02 +02:00
parent a9e905b301
commit b9d0b3e152
9 changed files with 104 additions and 30 deletions

View File

@ -280,16 +280,16 @@ optional_component(VLC ON "Engine: VLC backend"
DEPENDS "libvlc" LIBVLC_FOUND
)
optional_component(PHONON OFF "Engine: Phonon backend"
optional_component(PHONON OFF "Engine: Phonon backend (UNSTABLE)"
DEPENDS "phonon4qt5" PHONON_FOUND
)
if (WIN32)
optional_component(DEEZER ON "Engine: Deezer backend"
optional_component(DEEZER OFF "Engine: Deezer backend (UNSTABLE)"
DEPENDS "libdeezer" LIBDEEZER_FOUND
)
else ()
optional_component(DEEZER ON "Engine: Deezer backend"
optional_component(DEEZER OFF "Engine: Deezer backend (UNSTABLE)"
DEPENDS "Linux" LINUX
DEPENDS "libdeezer" LIBDEEZER_FOUND
DEPENDS "libpulse" LIBPULSE_FOUND
@ -345,8 +345,12 @@ optional_component(SPARKLE ON "Sparkle integration"
DEPENDS "Sparkle" SPARKLE
)
optional_component(STREAM_TIDAL ON "Streaming: Tidal support")
optional_component(STREAM_DEEZER ON "Streaming: Deezer support")
optional_component(DZMEDIA ON "DZMedia"
DEPENDS "libdzmedia" LIBDZMEDIA_FOUND
DEPENDS "Deezer support" HAVE_STREAM_DEEZER
)
#if(IMOBILEDEVICE_FOUND AND PLIST_FOUND)
@ -388,5 +392,7 @@ add_custom_target(uninstall
# Show a summary of what we have enabled
summary_show()
if(NOT HAVE_GSTREAMER AND NOT HAVE_XINE AND NOT HAVE_VLC AND NOT HAVE_PHONON AND NOT HAVE_DEEZER)
message(FATAL_ERROR "You need to enable either GStreamer, Xine, VLC, Phonon or Deezer to compile!")
message(FATAL_ERROR "You need to have either GStreamer, Xine, VLC, Phonon or Deezer to compile!")
elseif(NOT HAVE_GSTREAMER)
message(WARNING "GStreamer is the only engine that is fully implemented. Using other engines is possible but not recommended.")
endif()

View File

@ -217,8 +217,6 @@ set(SOURCES
settings/shortcutssettingspage.cpp
settings/appearancesettingspage.cpp
settings/notificationssettingspage.cpp
settings/tidalsettingspage.cpp
settings/deezersettingspage.cpp
dialogs/about.cpp
dialogs/console.cpp
@ -271,11 +269,6 @@ set(SOURCES
internet/internetsearchitemdelegate.cpp
internet/localredirectserver.cpp
tidal/tidalservice.cpp
tidal/tidalurlhandler.cpp
deezer/deezerservice.cpp
deezer/deezerurlhandler.cpp
)
set(HEADERS
@ -388,8 +381,6 @@ set(HEADERS
settings/shortcutssettingspage.h
settings/appearancesettingspage.h
settings/notificationssettingspage.h
settings/tidalsettingspage.h
settings/deezersettingspage.h
dialogs/about.h
dialogs/errordialog.h
@ -438,11 +429,6 @@ set(HEADERS
internet/internetsearchmodel.h
internet/localredirectserver.h
tidal/tidalservice.h
tidal/tidalurlhandler.h
deezer/deezerservice.h
deezer/deezerurlhandler.h
)
set(UI
@ -478,8 +464,6 @@ set(UI
settings/shortcutssettingspage.ui
settings/appearancesettingspage.ui
settings/notificationssettingspage.ui
settings/tidalsettingspage.ui
settings/deezersettingspage.ui
equalizer/equalizer.ui
equalizer/equalizerslider.ui
@ -869,6 +853,32 @@ optional_source(WIN32
widgets/osd_win.cpp
)
optional_source(HAVE_STREAM_TIDAL
SOURCES
tidal/tidalservice.cpp
tidal/tidalurlhandler.cpp
settings/tidalsettingspage.cpp
HEADERS
tidal/tidalservice.h
tidal/tidalurlhandler.h
settings/tidalsettingspage.h
UI
settings/tidalsettingspage.ui
)
optional_source(HAVE_STREAM_DEEZER
SOURCES
deezer/deezerservice.cpp
deezer/deezerurlhandler.cpp
settings/deezersettingspage.cpp
HEADERS
deezer/deezerservice.h
deezer/deezerurlhandler.h
settings/deezersettingspage.h
UI
settings/deezersettingspage.ui
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)

View File

@ -52,5 +52,8 @@
#cmakedefine HAVE_PHONON
#cmakedefine HAVE_DEEZER
#cmakedefine HAVE_STREAM_TIDAL
#cmakedefine HAVE_STREAM_DEEZER
#endif // CONFIG_H_IN

View File

@ -26,6 +26,7 @@
#include <QObject>
#include <QThread>
#include <QVariant>
#include <QString>
#include "core/closure.h"
@ -116,8 +117,13 @@ class ApplicationImpl {
return lyrics_providers;
}),
internet_model_([=]() { return new InternetModel(app, app); }),
#ifdef HAVE_STREAM_TIDAL
tidal_search_([=]() { return new InternetSearch(app, Song::Source_Tidal, app); }),
deezer_search_([=]() { return new InternetSearch(app, Song::Source_Deezer, app); })
#endif
#ifdef HAVE_STREAM_DEEZER
deezer_search_([=]() { return new InternetSearch(app, Song::Source_Deezer, app); }),
#endif
dummy_([=]() { return new QVariant; })
{}
Lazy<TagReaderClient> tag_reader_client_;
@ -137,8 +143,13 @@ class ApplicationImpl {
Lazy<CurrentArtLoader> current_art_loader_;
Lazy<LyricsProviders> lyrics_providers_;
Lazy<InternetModel> internet_model_;
#ifdef HAVE_STREAM_TIDAL
Lazy<InternetSearch> tidal_search_;
#endif
#ifdef HAVE_STREAM_DEEZER
Lazy<InternetSearch> deezer_search_;
#endif
Lazy<QVariant> dummy_;
};
@ -206,5 +217,9 @@ LyricsProviders *Application::lyrics_providers() const { return p_->lyrics_provi
PlaylistBackend *Application::playlist_backend() const { return p_->playlist_backend_.get(); }
PlaylistManager *Application::playlist_manager() const { return p_->playlist_manager_.get(); }
InternetModel *Application::internet_model() const { return p_->internet_model_.get(); }
#ifdef HAVE_STREAM_TIDAL
InternetSearch *Application::tidal_search() const { return p_->tidal_search_.get(); }
#endif
#ifdef HAVE_STREAM_DEEZER
InternetSearch *Application::deezer_search() const { return p_->deezer_search_.get(); }
#endif

View File

@ -88,8 +88,12 @@ class Application : public QObject {
LyricsProviders *lyrics_providers() const;
InternetModel *internet_model() const;
#ifdef HAVE_STREAM_TIDAL
InternetSearch *tidal_search() const;
#endif
#ifdef HAVE_STREAM_DEEZER
InternetSearch *deezer_search() const;
#endif
void MoveToNewThread(QObject *object);
void MoveToThread(QObject *object, QThread *thread);

View File

@ -133,8 +133,12 @@
#include "settings/behavioursettingspage.h"
#include "settings/playbacksettingspage.h"
#include "settings/playlistsettingspage.h"
#include "settings/tidalsettingspage.h"
#include "settings/deezersettingspage.h"
#ifdef HAVE_STREAM_TIDAL
# include "settings/tidalsettingspage.h"
#endif
#ifdef HAVE_STREAM_DEEZER
# include "settings/deezersettingspage.h"
#endif
#include "internet/internetmodel.h"
#include "internet/internetservice.h"
@ -203,8 +207,12 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
manager->SetPlaylistManager(app->playlist_manager());
return manager;
}),
#ifdef HAVE_STREAM_TIDAL
tidal_search_view_(new InternetSearchView(app_, app_->tidal_search(), TidalSettingsPage::kSettingsGroup, SettingsDialog::Page_Tidal, this)),
#endif
#ifdef HAVE_STREAM_DEEZER
deezer_search_view_(new InternetSearchView(app_, app_->deezer_search(), DeezerSettingsPage::kSettingsGroup, SettingsDialog::Page_Deezer, this)),
#endif
playlist_menu_(new QMenu(this)),
playlist_add_to_another_(nullptr),
playlistitem_actions_separator_(nullptr),
@ -259,8 +267,12 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
#ifndef Q_OS_WIN
ui_->tabs->addTab(device_view_, IconLoader::Load("device"), tr("Devices"));
#endif
#ifdef HAVE_STREAM_TIDAL
ui_->tabs->addTab(tidal_search_view_, IconLoader::Load("tidal"), tr("Tidal", "Tidal"));
#endif
#ifdef HAVE_STREAM_DEEZER
ui_->tabs->addTab(deezer_search_view_, IconLoader::Load("deezer"), tr("Deezer", "Deezer"));
#endif
//ui_->tabs->AddSpacer();
// Add the playing widget to the fancy tab widget
@ -519,10 +531,12 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
collection_view_->filter()->AddMenuAction(separator);
collection_view_->filter()->AddMenuAction(collection_config_action);
// Tidal
#ifdef HAVE_STREAM_TIDAL
connect(tidal_search_view_, SIGNAL(AddToPlaylist(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
// Deezer
#endif
#ifdef HAVE_STREAM_DEEZER
connect(deezer_search_view_, SIGNAL(AddToPlaylist(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
#endif
// Playlist menu
playlist_play_pause_ = playlist_menu_->addAction(tr("Play"), this, SLOT(PlaylistPlay()));
@ -810,8 +824,12 @@ void MainWindow::ReloadAllSettings() {
osd_->ReloadSettings();
collection_view_->ReloadSettings();
ui_->playlist->view()->ReloadSettings();
#ifdef HAVE_STREAM_TIDAL
tidal_search_view_->ReloadSettings();
#endif
#ifdef HAVE_STREAM_DEEZER
deezer_search_view_->ReloadSettings();
#endif
}

View File

@ -233,7 +233,7 @@ void DeezerService::FetchAccessTokenFinished(QNetworkReply *reply) {
}
if (reply->atEnd()) break;
}
QSettings s;
s.beginGroup(DeezerSettingsPage::kSettingsGroup);
s.setValue("access_token", access_token_);

View File

@ -30,8 +30,12 @@
#include "core/logging.h"
#include "internetmodel.h"
#include "internetservice.h"
#include "tidal/tidalservice.h"
#include "deezer/deezerservice.h"
#ifdef HAVE_STREAM_TIDAL
# include "tidal/tidalservice.h"
#endif
#ifdef HAVE_STREAM_DEEZER
# include "deezer/deezerservice.h"
#endif
QMap<Song::Source, InternetService*>* InternetModel::sServices = nullptr;
@ -41,8 +45,12 @@ InternetModel::InternetModel(Application *app, QObject *parent)
if (!sServices) sServices = new QMap<Song::Source, InternetService*>;
Q_ASSERT(sServices->isEmpty());
#ifdef HAVE_STREAM_TIDAL
AddService(new TidalService(app, this));
#endif
#ifdef HAVE_STREAM_DEEZER
AddService(new DeezerService(app, this));
#endif
}

View File

@ -62,8 +62,12 @@
#include "playlistsettingspage.h"
#include "shortcutssettingspage.h"
#include "transcodersettingspage.h"
#include "tidalsettingspage.h"
#include "deezersettingspage.h"
#ifdef HAVE_STREAM_TIDAL
# include "tidalsettingspage.h"
#endif
#ifdef HAVE_STREAM_DEEZER
# include "deezersettingspage.h"
#endif
#include "ui_settingsdialog.h"
@ -125,9 +129,15 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent)
AddPage(Page_Transcoding, new TranscoderSettingsPage(this), general);
#endif
#if defined(HAVE_STREAM_TIDAL) || defined(HAVE_STREAM_DEEZER)
QTreeWidgetItem *internet = AddCategory(tr("Internet"));
#endif
#ifdef HAVE_STREAM_TIDAL
AddPage(Page_Tidal, new TidalSettingsPage(this), internet);
#endif
#ifdef HAVE_STREAM_DEEZER
AddPage(Page_Deezer, new DeezerSettingsPage(this), internet);
#endif
// User interface
QTreeWidgetItem *iface = AddCategory(tr("User interface"));