Add Qobuz support (#181)
This commit is contained in:
@@ -71,6 +71,10 @@
|
||||
# include "covermanager/tidalcoverprovider.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_QOBUZ
|
||||
# include "qobuz/qobuzservice.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SUBSONIC
|
||||
# include "subsonic/subsonicservice.h"
|
||||
#endif
|
||||
@@ -140,6 +144,9 @@ class ApplicationImpl {
|
||||
#ifdef HAVE_TIDAL
|
||||
internet_services->AddService(new TidalService(app, internet_services));
|
||||
#endif
|
||||
#ifdef HAVE_QOBUZ
|
||||
internet_services->AddService(new QobuzService(app, internet_services));
|
||||
#endif
|
||||
#ifdef HAVE_SUBSONIC
|
||||
internet_services->AddService(new SubsonicService(app, internet_services));
|
||||
#endif
|
||||
@@ -147,6 +154,9 @@ class ApplicationImpl {
|
||||
}),
|
||||
#ifdef HAVE_TIDAL
|
||||
tidal_search_([=]() { return new InternetSearch(app, Song::Source_Tidal, app); }),
|
||||
#endif
|
||||
#ifdef HAVE_QOBUZ
|
||||
qobuz_search_([=]() { return new InternetSearch(app, Song::Source_Qobuz, app); }),
|
||||
#endif
|
||||
scrobbler_([=]() { return new AudioScrobbler(app, app); }),
|
||||
|
||||
@@ -177,6 +187,9 @@ class ApplicationImpl {
|
||||
Lazy<InternetServices> internet_services_;
|
||||
#ifdef HAVE_TIDAL
|
||||
Lazy<InternetSearch> tidal_search_;
|
||||
#endif
|
||||
#ifdef HAVE_QOBUZ
|
||||
Lazy<InternetSearch> qobuz_search_;
|
||||
#endif
|
||||
Lazy<AudioScrobbler> scrobbler_;
|
||||
#ifdef HAVE_MOODBAR
|
||||
@@ -254,6 +267,9 @@ InternetServices *Application::internet_services() const { return p_->internet_s
|
||||
#ifdef HAVE_TIDAL
|
||||
InternetSearch *Application::tidal_search() const { return p_->tidal_search_.get(); }
|
||||
#endif
|
||||
#ifdef HAVE_QOBUZ
|
||||
InternetSearch *Application::qobuz_search() const { return p_->qobuz_search_.get(); }
|
||||
#endif
|
||||
AudioScrobbler *Application::scrobbler() const { return p_->scrobbler_.get(); }
|
||||
#ifdef HAVE_MOODBAR
|
||||
MoodbarController *Application::moodbar_controller() const { return p_->moodbar_controller_.get(); }
|
||||
|
||||
@@ -102,6 +102,9 @@ class Application : public QObject {
|
||||
#ifdef HAVE_TIDAL
|
||||
InternetSearch *tidal_search() const;
|
||||
#endif
|
||||
#ifdef HAVE_QOBUZ
|
||||
InternetSearch *qobuz_search() const;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MOODBAR
|
||||
MoodbarController *moodbar_controller() const;
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
#include "scopedtransaction.h"
|
||||
|
||||
const char *Database::kDatabaseFilename = "strawberry.db";
|
||||
const int Database::kSchemaVersion = 6;
|
||||
const int Database::kSchemaVersion = 7;
|
||||
const char *Database::kMagicAllSongsTables = "%allsongstables";
|
||||
|
||||
int Database::sNextConnectionId = 1;
|
||||
|
||||
@@ -138,6 +138,10 @@
|
||||
# include "tidal/tidalservice.h"
|
||||
# include "settings/tidalsettingspage.h"
|
||||
#endif
|
||||
#ifdef HAVE_QOBUZ
|
||||
# include "qobuz/qobuzservice.h"
|
||||
# include "settings/qobuzsettingspage.h"
|
||||
#endif
|
||||
#ifdef HAVE_SUBSONIC
|
||||
# include "subsonic/subsonicservice.h"
|
||||
# include "settings/subsonicsettingspage.h"
|
||||
@@ -216,6 +220,9 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
||||
#ifdef HAVE_TIDAL
|
||||
tidal_view_(new InternetTabsView(app_, app->internet_services()->ServiceBySource(Song::Source_Tidal), app_->tidal_search(), TidalSettingsPage::kSettingsGroup, SettingsDialog::Page_Tidal, this)),
|
||||
#endif
|
||||
#ifdef HAVE_QOBUZ
|
||||
qobuz_view_(new InternetTabsView(app_, app->internet_services()->ServiceBySource(Song::Source_Qobuz), app_->qobuz_search(), QobuzSettingsPage::kSettingsGroup, SettingsDialog::Page_Qobuz, this)),
|
||||
#endif
|
||||
#ifdef HAVE_SUBSONIC
|
||||
subsonic_view_(new InternetSongsView(app_, app->internet_services()->ServiceBySource(Song::Source_Subsonic), SubsonicSettingsPage::kSettingsGroup, SettingsDialog::Page_Subsonic, this)),
|
||||
#endif
|
||||
@@ -273,6 +280,9 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
||||
#ifdef HAVE_TIDAL
|
||||
ui_->tabs->AddTab(tidal_view_, "tidal", IconLoader::Load("tidal"), tr("Tidal"));
|
||||
#endif
|
||||
#ifdef HAVE_QOBUZ
|
||||
ui_->tabs->AddTab(qobuz_view_, "qobuz", IconLoader::Load("qobuz"), tr("Qobuz"));
|
||||
#endif
|
||||
#ifdef HAVE_SUBSONIC
|
||||
ui_->tabs->AddTab(subsonic_view_, "subsonic", IconLoader::Load("subsonic"), tr("Subsonic"));
|
||||
#endif
|
||||
@@ -566,7 +576,13 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
||||
TidalService *tidalservice = qobject_cast<TidalService*> (app_->internet_services()->ServiceBySource(Song::Source_Tidal));
|
||||
if (tidalservice)
|
||||
connect(this, SIGNAL(AuthorisationUrlReceived(const QUrl&)), tidalservice, SLOT(AuthorisationUrlReceived(const QUrl&)));
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_QOBUZ
|
||||
connect(qobuz_view_->artists_collection_view(), SIGNAL(AddToPlaylistSignal(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
|
||||
connect(qobuz_view_->albums_collection_view(), SIGNAL(AddToPlaylistSignal(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
|
||||
connect(qobuz_view_->songs_collection_view(), SIGNAL(AddToPlaylistSignal(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
|
||||
connect(qobuz_view_->search_view(), SIGNAL(AddToPlaylist(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SUBSONIC
|
||||
@@ -889,6 +905,16 @@ void MainWindow::ReloadSettings() {
|
||||
ui_->tabs->DisableTab(tidal_view_);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_QOBUZ
|
||||
settings.beginGroup(QobuzSettingsPage::kSettingsGroup);
|
||||
bool enable_qobuz = settings.value("enabled", false).toBool();
|
||||
settings.endGroup();
|
||||
if (enable_qobuz)
|
||||
ui_->tabs->EnableTab(qobuz_view_);
|
||||
else
|
||||
ui_->tabs->DisableTab(qobuz_view_);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SUBSONIC
|
||||
settings.beginGroup(SubsonicSettingsPage::kSettingsGroup);
|
||||
bool enable_subsonic = settings.value("enabled", false).toBool();
|
||||
@@ -917,6 +943,9 @@ void MainWindow::ReloadAllSettings() {
|
||||
#ifdef HAVE_TIDAL
|
||||
tidal_view_->ReloadSettings();
|
||||
#endif
|
||||
#ifdef HAVE_QOBUZ
|
||||
qobuz_view_->ReloadSettings();
|
||||
#endif
|
||||
#ifdef HAVE_SUBSONIC
|
||||
subsonic_view_->ReloadSettings();
|
||||
#endif
|
||||
|
||||
@@ -314,6 +314,7 @@ signals:
|
||||
#endif
|
||||
|
||||
InternetTabsView *tidal_view_;
|
||||
InternetTabsView *qobuz_view_;
|
||||
InternetSongsView *subsonic_view_;
|
||||
|
||||
QAction *collection_show_all_;
|
||||
|
||||
@@ -333,7 +333,7 @@ bool Song::has_cue() const { return !d->cue_path_.isEmpty(); }
|
||||
|
||||
bool Song::is_collection_song() const { return !is_cdda() && !is_stream() && id() != -1; }
|
||||
bool Song::is_metadata_good() const { return !d->title_.isEmpty() && !d->album_.isEmpty() && !d->artist_.isEmpty() && !d->url_.isEmpty() && d->end_ > 0; }
|
||||
bool Song::is_stream() const { return d->source_ == Source_Stream || d->source_ == Source_Tidal || d->source_ == Source_Subsonic; }
|
||||
bool Song::is_stream() const { return d->source_ == Source_Stream || d->source_ == Source_Tidal || d->source_ == Source_Subsonic || d->source_ == Source_Qobuz; }
|
||||
bool Song::is_cdda() const { return d->source_ == Source_CDDA; }
|
||||
|
||||
const QString &Song::error() const { return d->error_; }
|
||||
@@ -411,6 +411,7 @@ Song::Source Song::SourceFromURL(const QUrl &url) {
|
||||
else if (url.scheme() == "cdda") return Source_CDDA;
|
||||
else if (url.scheme() == "tidal") return Source_Tidal;
|
||||
else if (url.scheme() == "subsonic") return Source_Subsonic;
|
||||
else if (url.scheme() == "qobuz") return Source_Qobuz;
|
||||
else if (url.scheme() == "http" || url.scheme() == "https" || url.scheme() == "rtsp") return Source_Stream;
|
||||
else return Source_Unknown;
|
||||
|
||||
@@ -426,6 +427,7 @@ QString Song::TextForSource(Source source) {
|
||||
case Song::Source_Stream: return QObject::tr("Stream");
|
||||
case Song::Source_Tidal: return QObject::tr("Tidal");
|
||||
case Song::Source_Subsonic: return QObject::tr("subsonic");
|
||||
case Song::Source_Qobuz: return QObject::tr("qobuz");
|
||||
case Song::Source_Unknown: return QObject::tr("Unknown");
|
||||
}
|
||||
return QObject::tr("Unknown");
|
||||
@@ -442,6 +444,7 @@ QIcon Song::IconForSource(Source source) {
|
||||
case Song::Source_Stream: return IconLoader::Load("applications-internet");
|
||||
case Song::Source_Tidal: return IconLoader::Load("tidal");
|
||||
case Song::Source_Subsonic: return IconLoader::Load("subsonic");
|
||||
case Song::Source_Qobuz: return IconLoader::Load("qobuz");
|
||||
case Song::Source_Unknown: return IconLoader::Load("edit-delete");
|
||||
}
|
||||
return IconLoader::Load("edit-delete");
|
||||
|
||||
@@ -75,6 +75,7 @@ class Song {
|
||||
Source_Stream = 5,
|
||||
Source_Tidal = 6,
|
||||
Source_Subsonic = 7,
|
||||
Source_Qobuz = 8,
|
||||
};
|
||||
|
||||
// Don't change these values - they're stored in the database, and defined in the tag reader protobuf.
|
||||
|
||||
Reference in New Issue
Block a user