Improve album cover searching and cover manager, use HttpStatusCodeAttribute and QSslError for services
- Improve album cover manager - Change art_automatic and art_manual to QUrl - Refresh collection album covers when new album covers are fetched - Fix automatic album cover searching for local files outside of the collection - Make all Json services check HttpStatusCodeAttribute - Show detailed SSL errors for Subsonic, Tidal and Qobuz
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
#include "core/application.h"
|
||||
#include "covermanager/albumcoverchoicecontroller.h"
|
||||
#include "covermanager/albumcoverloader.h"
|
||||
#include "covermanager/currentartloader.h"
|
||||
#include "covermanager/currentalbumcoverloader.h"
|
||||
#include "playingwidget.h"
|
||||
|
||||
using std::unique_ptr;
|
||||
@@ -131,13 +131,12 @@ PlayingWidget::PlayingWidget(QWidget *parent)
|
||||
|
||||
PlayingWidget::~PlayingWidget() {}
|
||||
|
||||
void PlayingWidget::SetApplication(Application *app, AlbumCoverChoiceController *album_cover_choice_controller) {
|
||||
void PlayingWidget::Init(Application *app, AlbumCoverChoiceController *album_cover_choice_controller) {
|
||||
|
||||
app_ = app;
|
||||
connect(app_->current_art_loader(), SIGNAL(ArtLoaded(Song, QString, QImage)), SLOT(AlbumArtLoaded(Song, QString, QImage)));
|
||||
|
||||
album_cover_choice_controller_ = album_cover_choice_controller;
|
||||
album_cover_choice_controller_->SetApplication(app_);
|
||||
album_cover_choice_controller_->Init(app_);
|
||||
QList<QAction*> cover_actions = album_cover_choice_controller_->GetAllActions();
|
||||
cover_actions.append(album_cover_choice_controller_->search_cover_auto_action());
|
||||
menu_->addActions(cover_actions);
|
||||
@@ -152,7 +151,6 @@ void PlayingWidget::SetApplication(Application *app, AlbumCoverChoiceController
|
||||
connect(above_statusbar_action_, SIGNAL(toggled(bool)), SLOT(ShowAboveStatusBar(bool)));
|
||||
|
||||
connect(album_cover_choice_controller_, SIGNAL(AutomaticCoverSearchDone()), this, SLOT(AutomaticCoverSearchDone()));
|
||||
connect(album_cover_choice_controller_->search_cover_auto_action(), SIGNAL(triggered()), this, SLOT(SearchCoverAutomatically()));
|
||||
|
||||
}
|
||||
|
||||
@@ -270,7 +268,7 @@ void PlayingWidget::SongChanged(const Song &song) {
|
||||
song_ = song;
|
||||
}
|
||||
|
||||
void PlayingWidget::AlbumArtLoaded(const Song &song, const QString &, const QImage &image) {
|
||||
void PlayingWidget::AlbumCoverLoaded(const Song &song, const QUrl &cover_url, const QImage &image) {
|
||||
|
||||
if (!playing_ || song.id() != song_playing_.id() || song.url() != song_playing_.url() || song.effective_albumartist() != song_playing_.effective_albumartist() || song.effective_album() != song_playing_.effective_album() || song.title() != song_playing_.title()) return;
|
||||
if (timeline_fade_->state() == QTimeLine::Running && image == image_original_) return;
|
||||
@@ -279,7 +277,6 @@ void PlayingWidget::AlbumArtLoaded(const Song &song, const QString &, const QIma
|
||||
downloading_covers_ = false;
|
||||
song_ = song;
|
||||
SetImage(image);
|
||||
GetCoverAutomatically();
|
||||
|
||||
}
|
||||
|
||||
@@ -495,28 +492,15 @@ void PlayingWidget::dropEvent(QDropEvent *e) {
|
||||
|
||||
}
|
||||
|
||||
void PlayingWidget::GetCoverAutomatically() {
|
||||
void PlayingWidget::SearchCoverInProgress() {
|
||||
|
||||
// Search for cover automatically?
|
||||
bool search =
|
||||
album_cover_choice_controller_->search_cover_auto_action()->isChecked() &&
|
||||
!song_.has_manually_unset_cover() &&
|
||||
song_.art_automatic().isEmpty() &&
|
||||
song_.art_manual().isEmpty() &&
|
||||
!song_.effective_albumartist().isEmpty() &&
|
||||
!song_.effective_album().isEmpty();
|
||||
downloading_covers_ = true;
|
||||
|
||||
if (search) {
|
||||
downloading_covers_ = true;
|
||||
// This is done in mainwindow instead to avoid searching multiple times (ContextView & PlayingWidget)
|
||||
// album_cover_choice_controller_->SearchCoverAutomatically(song_);
|
||||
|
||||
// Show a spinner animation
|
||||
spinner_animation_.reset(new QMovie(":/pictures/spinner.gif", QByteArray(), this));
|
||||
connect(spinner_animation_.get(), SIGNAL(updated(const QRect&)), SLOT(update()));
|
||||
spinner_animation_->start();
|
||||
update();
|
||||
}
|
||||
// Show a spinner animation
|
||||
spinner_animation_.reset(new QMovie(":/pictures/spinner.gif", QByteArray(), this));
|
||||
connect(spinner_animation_.get(), SIGNAL(updated(const QRect&)), SLOT(update()));
|
||||
spinner_animation_->start();
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
@@ -527,7 +511,3 @@ void PlayingWidget::AutomaticCoverSearchDone() {
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
void PlayingWidget::SearchCoverAutomatically() {
|
||||
GetCoverAutomatically();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user