From c2a6def8b9cb5288d96cb87289df792c41710b2e Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Mon, 1 Jul 2019 01:01:30 +0200 Subject: [PATCH] Rename cache album covers to download album covers and only do it for favorite requests --- src/qobuz/qobuzrequest.cpp | 3 ++- src/qobuz/qobuzservice.cpp | 4 ++-- src/qobuz/qobuzservice.h | 4 ++-- src/settings/qobuzsettingspage.cpp | 4 ++-- src/settings/qobuzsettingspage.ui | 4 ++-- src/settings/subsonicsettingspage.cpp | 4 ++-- src/settings/subsonicsettingspage.ui | 4 ++-- src/settings/tidalsettingspage.cpp | 4 ++-- src/settings/tidalsettingspage.ui | 4 ++-- src/subsonic/subsonicbaserequest.h | 2 +- src/subsonic/subsonicrequest.cpp | 2 +- src/subsonic/subsonicservice.cpp | 4 ++-- src/subsonic/subsonicservice.h | 4 ++-- src/tidal/tidalrequest.cpp | 3 ++- src/tidal/tidalservice.cpp | 4 ++-- src/tidal/tidalservice.h | 4 ++-- 16 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/qobuz/qobuzrequest.cpp b/src/qobuz/qobuzrequest.cpp index b4eda7fae..f99b573ec 100644 --- a/src/qobuz/qobuzrequest.cpp +++ b/src/qobuz/qobuzrequest.cpp @@ -904,7 +904,8 @@ void QobuzRequest::SongsFinishCheck(const qint64 artist_id, const QString &album if (!album_songs_requests_queue_.isEmpty() && album_songs_requests_active_ < kMaxConcurrentAlbumSongsRequests) FlushAlbumSongsRequests(); if ( - service_->cache_album_covers() && + service_->download_album_covers() && + IsQuery() && songs_requests_queue_.isEmpty() && songs_requests_active_ <= 0 && album_songs_requests_queue_.isEmpty() && diff --git a/src/qobuz/qobuzservice.cpp b/src/qobuz/qobuzservice.cpp index e395cd3b7..6024e5c68 100644 --- a/src/qobuz/qobuzservice.cpp +++ b/src/qobuz/qobuzservice.cpp @@ -96,7 +96,7 @@ QobuzService::QobuzService(Application *app, QObject *parent) artistssearchlimit_(1), albumssearchlimit_(1), songssearchlimit_(1), - cache_album_covers_(true), + download_album_covers_(true), pending_search_id_(0), next_pending_search_id_(1), search_id_(0), @@ -205,7 +205,7 @@ void QobuzService::ReloadSettings() { artistssearchlimit_ = s.value("artistssearchlimit", 4).toInt(); albumssearchlimit_ = s.value("albumssearchlimit", 10).toInt(); songssearchlimit_ = s.value("songssearchlimit", 10).toInt(); - cache_album_covers_ = s.value("cachealbumcovers", true).toBool(); + download_album_covers_ = s.value("cachealbumcovers", true).toBool(); user_auth_token_ = s.value("user_auth_token").toString(); diff --git a/src/qobuz/qobuzservice.h b/src/qobuz/qobuzservice.h index 35976a8d3..ce76d3bbd 100644 --- a/src/qobuz/qobuzservice.h +++ b/src/qobuz/qobuzservice.h @@ -78,7 +78,7 @@ class QobuzService : public InternetService { int artistssearchlimit() { return artistssearchlimit_; } int albumssearchlimit() { return albumssearchlimit_; } int songssearchlimit() { return songssearchlimit_; } - bool cache_album_covers() { return cache_album_covers_; } + bool download_album_covers() { return download_album_covers_; } QString user_auth_token() { return user_auth_token_; } @@ -198,7 +198,7 @@ class QobuzService : public InternetService { int artistssearchlimit_; int albumssearchlimit_; int songssearchlimit_; - bool cache_album_covers_; + bool download_album_covers_; QString user_auth_token_; diff --git a/src/settings/qobuzsettingspage.cpp b/src/settings/qobuzsettingspage.cpp index 42cc201fa..09076b251 100644 --- a/src/settings/qobuzsettingspage.cpp +++ b/src/settings/qobuzsettingspage.cpp @@ -81,7 +81,7 @@ void QobuzSettingsPage::Load() { ui_->artistssearchlimit->setValue(s.value("artistssearchlimit", 4).toInt()); ui_->albumssearchlimit->setValue(s.value("albumssearchlimit", 10).toInt()); ui_->songssearchlimit->setValue(s.value("songssearchlimit", 10).toInt()); - ui_->checkbox_cache_album_covers->setChecked(s.value("cachealbumcovers", true).toBool()); + ui_->checkbox_download_album_covers->setChecked(s.value("downloadalbumcovers", true).toBool()); s.endGroup(); @@ -105,7 +105,7 @@ void QobuzSettingsPage::Save() { s.setValue("artistssearchlimit", ui_->artistssearchlimit->value()); s.setValue("albumssearchlimit", ui_->albumssearchlimit->value()); s.setValue("songssearchlimit", ui_->songssearchlimit->value()); - s.setValue("cachealbumcovers", ui_->checkbox_cache_album_covers->isChecked()); + s.setValue("downloadalbumcovers", ui_->checkbox_download_album_covers->isChecked()); s.endGroup(); service_->ReloadSettings(); diff --git a/src/settings/qobuzsettingspage.ui b/src/settings/qobuzsettingspage.ui index 546aeebd1..bcc5f13a3 100644 --- a/src/settings/qobuzsettingspage.ui +++ b/src/settings/qobuzsettingspage.ui @@ -217,9 +217,9 @@ - + - Cache album covers + Download album covers diff --git a/src/settings/subsonicsettingspage.cpp b/src/settings/subsonicsettingspage.cpp index 77c1e336f..449f302e5 100644 --- a/src/settings/subsonicsettingspage.cpp +++ b/src/settings/subsonicsettingspage.cpp @@ -67,7 +67,7 @@ void SubsonicSettingsPage::Load() { if (password.isEmpty()) ui_->password->clear(); else ui_->password->setText(QString::fromUtf8(QByteArray::fromBase64(password))); ui_->checkbox_verify_certificate->setChecked(s.value("verifycertificate", false).toBool()); - ui_->checkbox_cache_album_covers->setChecked(s.value("cachealbumcovers", true).toBool()); + ui_->checkbox_download_album_covers->setChecked(s.value("downloadalbumcovers", true).toBool()); s.endGroup(); } @@ -81,7 +81,7 @@ void SubsonicSettingsPage::Save() { s.setValue("username", ui_->username->text()); s.setValue("password", QString::fromUtf8(ui_->password->text().toUtf8().toBase64())); s.setValue("verifycertificate", ui_->checkbox_verify_certificate->isChecked()); - s.setValue("cachealbumcovers", ui_->checkbox_cache_album_covers->isChecked()); + s.setValue("downloadalbumcovers", ui_->checkbox_download_album_covers->isChecked()); s.endGroup(); service_->ReloadSettings(); diff --git a/src/settings/subsonicsettingspage.ui b/src/settings/subsonicsettingspage.ui index c4dfa6201..ca9f35a3d 100644 --- a/src/settings/subsonicsettingspage.ui +++ b/src/settings/subsonicsettingspage.ui @@ -128,9 +128,9 @@ - + - Cache album covers + Download album covers diff --git a/src/settings/tidalsettingspage.cpp b/src/settings/tidalsettingspage.cpp index eaf22b3e5..1a1dbf9d6 100644 --- a/src/settings/tidalsettingspage.cpp +++ b/src/settings/tidalsettingspage.cpp @@ -101,7 +101,7 @@ void TidalSettingsPage::Load() { ui_->albumssearchlimit->setValue(s.value("albumssearchlimit", 10).toInt()); ui_->songssearchlimit->setValue(s.value("songssearchlimit", 10).toInt()); ui_->checkbox_fetchalbums->setChecked(s.value("fetchalbums", false).toBool()); - ui_->checkbox_cache_album_covers->setChecked(s.value("cachealbumcovers", true).toBool()); + ui_->checkbox_download_album_covers->setChecked(s.value("downloadalbumcovers", true).toBool()); dialog()->ComboBoxLoadFromSettings(s, ui_->coversize, "coversize", "320x320"); StreamUrlMethod stream_url = static_cast(s.value("streamurl").toInt()); @@ -133,7 +133,7 @@ void TidalSettingsPage::Save() { s.setValue("albumssearchlimit", ui_->albumssearchlimit->value()); s.setValue("songssearchlimit", ui_->songssearchlimit->value()); s.setValue("fetchalbums", ui_->checkbox_fetchalbums->isChecked()); - s.setValue("cachealbumcovers", ui_->checkbox_cache_album_covers->isChecked()); + s.setValue("downloadalbumcovers", ui_->checkbox_download_album_covers->isChecked()); s.setValue("coversize", ui_->coversize->itemData(ui_->coversize->currentIndex())); s.setValue("streamurl", ui_->streamurl->itemData(ui_->streamurl->currentIndex())); s.endGroup(); diff --git a/src/settings/tidalsettingspage.ui b/src/settings/tidalsettingspage.ui index e911a1878..32024b699 100644 --- a/src/settings/tidalsettingspage.ui +++ b/src/settings/tidalsettingspage.ui @@ -224,9 +224,9 @@ - + - Cache album covers + Download album covers diff --git a/src/subsonic/subsonicbaserequest.h b/src/subsonic/subsonicbaserequest.h index a091620d9..15915aef0 100644 --- a/src/subsonic/subsonicbaserequest.h +++ b/src/subsonic/subsonicbaserequest.h @@ -72,7 +72,7 @@ class SubsonicBaseRequest : public QObject { QString username() { return service_->username(); } QString password() { return service_->password(); } bool verify_certificate() { return service_->verify_certificate(); } - bool cache_album_covers() { return service_->cache_album_covers(); } + bool download_album_covers() { return service_->download_album_covers(); } private: diff --git a/src/subsonic/subsonicrequest.cpp b/src/subsonic/subsonicrequest.cpp index dff4ba748..3d55c563c 100644 --- a/src/subsonic/subsonicrequest.cpp +++ b/src/subsonic/subsonicrequest.cpp @@ -434,7 +434,7 @@ void SubsonicRequest::SongsFinishCheck() { if (!album_songs_requests_queue_.isEmpty() && album_songs_requests_active_ < kMaxConcurrentAlbumSongsRequests) FlushAlbumSongsRequests(); if ( - cache_album_covers() && + download_album_covers() && album_songs_requests_queue_.isEmpty() && album_songs_requests_active_ <= 0 && album_cover_requests_queue_.isEmpty() && diff --git a/src/subsonic/subsonicservice.cpp b/src/subsonic/subsonicservice.cpp index d831ca3dc..8dacc9a51 100644 --- a/src/subsonic/subsonicservice.cpp +++ b/src/subsonic/subsonicservice.cpp @@ -70,7 +70,7 @@ SubsonicService::SubsonicService(Application *app, QObject *parent) collection_model_(nullptr), collection_sort_model_(new QSortFilterProxyModel(this)), verify_certificate_(false), - cache_album_covers_(true) + download_album_covers_(true) { app->player()->RegisterUrlHandler(url_handler_); @@ -112,7 +112,7 @@ void SubsonicService::ReloadSettings() { else password_ = QString::fromUtf8(QByteArray::fromBase64(password)); verify_certificate_ = s.value("verifycertificate", false).toBool(); - cache_album_covers_ = s.value("cachealbumcovers", true).toBool(); + download_album_covers_ = s.value("cachealbumcovers", true).toBool(); s.endGroup(); diff --git a/src/subsonic/subsonicservice.h b/src/subsonic/subsonicservice.h index b6b22c2da..1d7cf33b3 100644 --- a/src/subsonic/subsonicservice.h +++ b/src/subsonic/subsonicservice.h @@ -67,7 +67,7 @@ class SubsonicService : public InternetService { QString username() { return username_; } QString password() { return password_; } bool verify_certificate() { return verify_certificate_; } - bool cache_album_covers() { return cache_album_covers_; } + bool download_album_covers() { return download_album_covers_; } CollectionBackend *collection_backend() { return collection_backend_; } CollectionModel *collection_model() { return collection_model_; } @@ -120,7 +120,7 @@ class SubsonicService : public InternetService { QString username_; QString password_; bool verify_certificate_; - bool cache_album_covers_; + bool download_album_covers_; }; diff --git a/src/tidal/tidalrequest.cpp b/src/tidal/tidalrequest.cpp index cfb9058a2..e1f98a02f 100644 --- a/src/tidal/tidalrequest.cpp +++ b/src/tidal/tidalrequest.cpp @@ -862,7 +862,8 @@ void TidalRequest::SongsFinishCheck(const qint64 artist_id, const qint64 album_i if (!album_songs_requests_queue_.isEmpty() && album_songs_requests_active_ < kMaxConcurrentAlbumSongsRequests) FlushAlbumSongsRequests(); if ( - service_->cache_album_covers() && + service_->download_album_covers() && + IsQuery() && songs_requests_queue_.isEmpty() && songs_requests_active_ <= 0 && album_songs_requests_queue_.isEmpty() && diff --git a/src/tidal/tidalservice.cpp b/src/tidal/tidalservice.cpp index 6631c3b8f..20007f515 100644 --- a/src/tidal/tidalservice.cpp +++ b/src/tidal/tidalservice.cpp @@ -102,7 +102,7 @@ TidalService::TidalService(Application *app, QObject *parent) albumssearchlimit_(1), songssearchlimit_(1), fetchalbums_(true), - cache_album_covers_(true), + download_album_covers_(true), pending_search_id_(0), next_pending_search_id_(1), search_id_(0), @@ -217,7 +217,7 @@ void TidalService::ReloadSettings() { songssearchlimit_ = s.value("songssearchlimit", 10).toInt(); fetchalbums_ = s.value("fetchalbums", false).toBool(); coversize_ = s.value("coversize", "320x320").toString(); - cache_album_covers_ = s.value("cachealbumcovers", true).toBool(); + download_album_covers_ = s.value("cachealbumcovers", true).toBool(); stream_url_method_ = static_cast(s.value("streamurl").toInt()); user_id_ = s.value("user_id").toInt(); diff --git a/src/tidal/tidalservice.h b/src/tidal/tidalservice.h index 7f4ce8df8..2632d557f 100644 --- a/src/tidal/tidalservice.h +++ b/src/tidal/tidalservice.h @@ -83,7 +83,7 @@ class TidalService : public InternetService { int songssearchlimit() { return songssearchlimit_; } bool fetchalbums() { return fetchalbums_; } QString coversize() { return coversize_; } - bool cache_album_covers() { return cache_album_covers_; } + bool download_album_covers() { return download_album_covers_; } TidalSettingsPage::StreamUrlMethod stream_url_method() { return stream_url_method_; } QString access_token() { return access_token_; } @@ -218,7 +218,7 @@ class TidalService : public InternetService { int songssearchlimit_; bool fetchalbums_; QString coversize_; - bool cache_album_covers_; + bool download_album_covers_; TidalSettingsPage::StreamUrlMethod stream_url_method_; QString access_token_;