@@ -173,6 +173,7 @@
|
|||||||
# include "constants/tidalsettings.h"
|
# include "constants/tidalsettings.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SPOTIFY
|
#ifdef HAVE_SPOTIFY
|
||||||
|
# include "spotify/spotifyservice.h"
|
||||||
# include "constants/spotifysettings.h"
|
# include "constants/spotifysettings.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_QOBUZ
|
#ifdef HAVE_QOBUZ
|
||||||
@@ -772,6 +773,9 @@ MainWindow::MainWindow(Application *app,
|
|||||||
QObject::connect(spotify_view_->songs_collection_view(), &StreamingCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
|
QObject::connect(spotify_view_->songs_collection_view(), &StreamingCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
|
||||||
QObject::connect(spotify_view_->search_view(), &StreamingSearchView::OpenSettingsDialog, this, &MainWindow::OpenServiceSettingsDialog);
|
QObject::connect(spotify_view_->search_view(), &StreamingSearchView::OpenSettingsDialog, this, &MainWindow::OpenServiceSettingsDialog);
|
||||||
QObject::connect(spotify_view_->search_view(), &StreamingSearchView::AddToPlaylist, this, &MainWindow::AddToPlaylist);
|
QObject::connect(spotify_view_->search_view(), &StreamingSearchView::AddToPlaylist, this, &MainWindow::AddToPlaylist);
|
||||||
|
if (SpotifyServicePtr spotifyservice = app_->streaming_services()->Service<SpotifyService>()) {
|
||||||
|
QObject::connect(&*spotifyservice, &SpotifyService::UpdateSpotifyAccessToken, &*app_->player()->engine(), &EngineBase::UpdateSpotifyAccessToken);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QObject::connect(radio_view_, &RadioViewContainer::Refresh, &*app_->radio_services(), &RadioServices::RefreshChannels);
|
QObject::connect(radio_view_, &RadioViewContainer::Refresh, &*app_->radio_services(), &RadioServices::RefreshChannels);
|
||||||
|
|||||||
@@ -256,3 +256,19 @@ bool EngineBase::ValidOutput(const QString &output) {
|
|||||||
return (true);
|
return (true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EngineBase::UpdateSpotifyAccessToken(const QString &spotify_access_token) {
|
||||||
|
|
||||||
|
#ifdef HAVE_SPOTIFY
|
||||||
|
|
||||||
|
spotify_access_token_ = spotify_access_token;
|
||||||
|
|
||||||
|
SetSpotifyAccessToken();
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
Q_UNUSED(spotify_access_token)
|
||||||
|
|
||||||
|
#endif // HAVE_SPOTIFY
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ class EngineBase : public QObject {
|
|||||||
virtual void ReloadSettings();
|
virtual void ReloadSettings();
|
||||||
void UpdateVolume(const uint volume);
|
void UpdateVolume(const uint volume);
|
||||||
void EmitAboutToFinish();
|
void EmitAboutToFinish();
|
||||||
|
void UpdateSpotifyAccessToken(const QString &spotify_access_token);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Simple accessors
|
// Simple accessors
|
||||||
@@ -175,6 +176,11 @@ class EngineBase : public QObject {
|
|||||||
|
|
||||||
void Finished();
|
void Finished();
|
||||||
|
|
||||||
|
private:
|
||||||
|
#ifdef HAVE_SPOTIFY
|
||||||
|
virtual void SetSpotifyAccessToken() {}
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool playbin3_enabled_;
|
bool playbin3_enabled_;
|
||||||
bool exclusive_mode_;
|
bool exclusive_mode_;
|
||||||
|
|||||||
@@ -517,10 +517,20 @@ bool GstEngine::ExclusiveModeSupport(const QString &output) const {
|
|||||||
|
|
||||||
void GstEngine::ReloadSettings() {
|
void GstEngine::ReloadSettings() {
|
||||||
|
|
||||||
|
#ifdef HAVE_SPOTIFY
|
||||||
|
const QString old_spotify_access_token = spotify_access_token_;
|
||||||
|
#endif
|
||||||
|
|
||||||
EngineBase::ReloadSettings();
|
EngineBase::ReloadSettings();
|
||||||
|
|
||||||
if (output_.isEmpty()) output_ = QLatin1String(kAutoSink);
|
if (output_.isEmpty()) output_ = QLatin1String(kAutoSink);
|
||||||
|
|
||||||
|
#ifdef HAVE_SPOTIFY
|
||||||
|
if (current_pipeline_ && old_spotify_access_token != spotify_access_token_) {
|
||||||
|
current_pipeline_->set_spotify_access_token(spotify_access_token_);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::ConsumeBuffer(GstBuffer *buffer, const int pipeline_id, const QString &format) {
|
void GstEngine::ConsumeBuffer(GstBuffer *buffer, const int pipeline_id, const QString &format) {
|
||||||
@@ -1199,3 +1209,13 @@ bool GstEngine::AnyExclusivePipelineActive() const {
|
|||||||
return (current_pipeline_ && current_pipeline_->exclusive_mode()) || OldExclusivePipelineActive();
|
return (current_pipeline_ && current_pipeline_->exclusive_mode()) || OldExclusivePipelineActive();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SPOTIFY
|
||||||
|
void GstEngine::SetSpotifyAccessToken() {
|
||||||
|
|
||||||
|
if (current_pipeline_) {
|
||||||
|
current_pipeline_->set_spotify_access_token(spotify_access_token_);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif // HAVE_SPOTIFY
|
||||||
|
|||||||
@@ -146,6 +146,10 @@ class GstEngine : public EngineBase, public GstBufferConsumer {
|
|||||||
bool OldExclusivePipelineActive() const;
|
bool OldExclusivePipelineActive() const;
|
||||||
bool AnyExclusivePipelineActive() const;
|
bool AnyExclusivePipelineActive() const;
|
||||||
|
|
||||||
|
#ifdef HAVE_SPOTIFY
|
||||||
|
void SetSpotifyAccessToken() override;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SharedPtr<TaskManager> task_manager_;
|
SharedPtr<TaskManager> task_manager_;
|
||||||
GstDiscoverer *discoverer_;
|
GstDiscoverer *discoverer_;
|
||||||
|
|||||||
@@ -226,14 +226,15 @@ void SpotifyService::ClearSession() {
|
|||||||
void SpotifyService::OAuthFinished(const bool success, const QString &error) {
|
void SpotifyService::OAuthFinished(const bool success, const QString &error) {
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
Q_EMIT LoginFinished(true);
|
|
||||||
Q_EMIT LoginSuccess();
|
Q_EMIT LoginSuccess();
|
||||||
|
Q_EMIT UpdateSpotifyAccessToken(oauth_->access_token());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Q_EMIT LoginFailure(error);
|
Q_EMIT LoginFailure(error);
|
||||||
Q_EMIT LoginFinished(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_EMIT LoginFinished(success);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpotifyService::GetArtists() {
|
void SpotifyService::GetArtists() {
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ class SpotifyService : public StreamingService {
|
|||||||
CollectionFilter *albums_collection_filter_model() override { return albums_collection_model_->filter(); }
|
CollectionFilter *albums_collection_filter_model() override { return albums_collection_model_->filter(); }
|
||||||
CollectionFilter *songs_collection_filter_model() override { return songs_collection_model_->filter(); }
|
CollectionFilter *songs_collection_filter_model() override { return songs_collection_model_->filter(); }
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void UpdateSpotifyAccessToken(const QString &access_token);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void Authenticate();
|
void Authenticate();
|
||||||
void ClearSession();
|
void ClearSession();
|
||||||
|
|||||||
Reference in New Issue
Block a user