Connection syntax migration (#637)

This commit is contained in:
Jonas Kvinge
2021-01-26 16:48:04 +01:00
committed by GitHub
parent d57f6303f4
commit bf7c8df353
362 changed files with 2452 additions and 2434 deletions

View File

@@ -112,7 +112,7 @@ void AlbumCoverChoiceController::Init(Application *app) {
cover_searcher_ = new AlbumCoverSearcher(QIcon(":/pictures/cdcase.png"), app, this);
cover_searcher_->Init(cover_fetcher_);
connect(cover_fetcher_, SIGNAL(AlbumCoverFetched(quint64, QUrl, QImage, CoverSearchStatistics)), this, SLOT(AlbumCoverFetched(quint64, QUrl, QImage, CoverSearchStatistics)));
QObject::connect(cover_fetcher_, &AlbumCoverFetcher::AlbumCoverFetched, this, &AlbumCoverChoiceController::AlbumCoverFetched);
}

View File

@@ -38,7 +38,7 @@ AlbumCoverExport::AlbumCoverExport(QWidget *parent) : QDialog(parent), ui_(new U
ui_->setupUi(this);
connect(ui_->forceSize, SIGNAL(stateChanged(int)), SLOT(ForceSizeToggled(int)));
QObject::connect(ui_->forceSize, &QCheckBox::stateChanged, this, &AlbumCoverExport::ForceSizeToggled);
}

View File

@@ -77,4 +77,3 @@ class AlbumCoverExport : public QDialog {
};
#endif // ALBUMCOVEREXPORT_H

View File

@@ -61,8 +61,8 @@ void AlbumCoverExporter::AddJobsToPool() {
while (!requests_.isEmpty() && thread_pool_->activeThreadCount() < thread_pool_->maxThreadCount()) {
CoverExportRunnable *runnable = requests_.dequeue();
connect(runnable, SIGNAL(CoverExported()), SLOT(CoverExported()));
connect(runnable, SIGNAL(CoverSkipped()), SLOT(CoverSkipped()));
QObject::connect(runnable, &CoverExportRunnable::CoverExported, this, &AlbumCoverExporter::CoverExported);
QObject::connect(runnable, &CoverExportRunnable::CoverSkipped, this, &AlbumCoverExporter::CoverSkipped);
thread_pool_->start(runnable);
}
@@ -80,4 +80,3 @@ void AlbumCoverExporter::CoverSkipped() {
emit AlbumCoversExportUpdate(exported_, skipped_, all_);
AddJobsToPool();
}

View File

@@ -48,7 +48,7 @@ class AlbumCoverExporter : public QObject {
int request_count() { return requests_.size(); }
signals:
signals:
void AlbumCoversExportUpdate(int exported, int skipped, int all);
private slots:

View File

@@ -42,7 +42,7 @@ AlbumCoverFetcher::AlbumCoverFetcher(CoverProviders *cover_providers, QObject *p
request_starter_(new QTimer(this)) {
request_starter_->setInterval(1000);
connect(request_starter_, SIGNAL(timeout()), SLOT(StartRequests()));
QObject::connect(request_starter_, &QTimer::timeout, this, &AlbumCoverFetcher::StartRequests);
}
@@ -127,8 +127,8 @@ void AlbumCoverFetcher::StartRequests() {
AlbumCoverFetcherSearch *search = new AlbumCoverFetcherSearch(request, network_, this);
active_requests_.insert(request.id, search);
connect(search, SIGNAL(SearchFinished(quint64, CoverSearchResults)), SLOT(SingleSearchFinished(quint64, CoverSearchResults)));
connect(search, SIGNAL(AlbumCoverFetched(quint64, QUrl, QImage)), SLOT(SingleCoverFetched(quint64, QUrl, QImage)));
QObject::connect(search, &AlbumCoverFetcherSearch::SearchFinished, this, &AlbumCoverFetcher::SingleSearchFinished);
QObject::connect(search, &AlbumCoverFetcherSearch::AlbumCoverFetched, this, &AlbumCoverFetcher::SingleCoverFetched);
search->Start(cover_providers_);
}

View File

@@ -35,11 +35,12 @@
#include <QUrl>
#include <QImage>
#include "coversearchstatistics.h"
class QTimer;
class NetworkAccessManager;
class CoverProviders;
class AlbumCoverFetcherSearch;
struct CoverSearchStatistics;
// This class represents a single search-for-cover request. It identifies and describes the request.
struct CoverSearchRequest {
@@ -115,8 +116,8 @@ class AlbumCoverFetcher : public QObject {
void Clear();
signals:
void AlbumCoverFetched(const quint64 request_id, const QUrl &cover_url, const QImage &cover, const CoverSearchStatistics &statistics);
void SearchFinished(const quint64 request_id, const CoverSearchResults &results, const CoverSearchStatistics &statistics);
void AlbumCoverFetched(quint64 request_id, QUrl cover_url, QImage cover, CoverSearchStatistics statistics);
void SearchFinished(quint64 request_id, CoverSearchResults results, CoverSearchStatistics statistics);
private slots:
void SingleSearchFinished(const quint64, const CoverSearchResults results);

View File

@@ -60,7 +60,7 @@ AlbumCoverFetcherSearch::AlbumCoverFetcherSearch(const CoverSearchRequest &reque
cancel_requested_(false) {
// We will terminate the search after kSearchTimeoutMs milliseconds if we are not able to find all of the results before that point in time
QTimer::singleShot(kSearchTimeoutMs, this, SLOT(TerminateSearch()));
QTimer::singleShot(kSearchTimeoutMs, this, &AlbumCoverFetcherSearch::TerminateSearch);
}
@@ -109,8 +109,8 @@ void AlbumCoverFetcherSearch::Start(CoverProviders *cover_providers) {
continue;
}
connect(provider, SIGNAL(SearchResults(int, CoverSearchResults)), SLOT(ProviderSearchResults(int, CoverSearchResults)));
connect(provider, SIGNAL(SearchFinished(int, CoverSearchResults)), SLOT(ProviderSearchFinished(int, CoverSearchResults)));
QObject::connect(provider, &CoverProvider::SearchResults, this, QOverload<const int, const CoverSearchResults&>::of(&AlbumCoverFetcherSearch::ProviderSearchResults));
QObject::connect(provider, &CoverProvider::SearchFinished, this, &AlbumCoverFetcherSearch::ProviderSearchFinished);
const int id = cover_providers->NextId();
const bool success = provider->StartSearch(request_.artist, request_.album, request_.title, id);
@@ -286,7 +286,7 @@ void AlbumCoverFetcherSearch::FetchMoreImages() {
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *image_reply = network_->get(req);
connect(image_reply, &QNetworkReply::finished, [=] { ProviderCoverFetchFinished(image_reply); });
QObject::connect(image_reply, &QNetworkReply::finished, [this, image_reply]() { ProviderCoverFetchFinished(image_reply); });
pending_image_loads_[image_reply] = result;
image_load_timeout_->AddReply(image_reply);
@@ -305,7 +305,7 @@ void AlbumCoverFetcherSearch::FetchMoreImages() {
void AlbumCoverFetcherSearch::ProviderCoverFetchFinished(QNetworkReply *reply) {
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->deleteLater();
if (!pending_image_loads_.contains(reply)) return;
@@ -412,7 +412,7 @@ void AlbumCoverFetcherSearch::Cancel() {
}
else if (!pending_image_loads_.isEmpty()) {
for (QNetworkReply *reply : pending_image_loads_.keys()) {
disconnect(reply, &QNetworkReply::finished, this, nullptr);
QObject::disconnect(reply, &QNetworkReply::finished, this, nullptr);
reply->abort();
reply->deleteLater();
}

View File

@@ -63,19 +63,19 @@ class AlbumCoverFetcherSearch : public QObject {
signals:
// It's the end of search (when there was no fetch-me-a-cover request).
void SearchFinished(const quint64, const CoverSearchResults &results);
void SearchFinished(quint64, CoverSearchResults results);
// It's the end of search and we've fetched a cover.
void AlbumCoverFetched(const quint64, const QUrl &cover_url, const QImage &cover);
private slots:
void ProviderSearchResults(const int id, const CoverSearchResults &results);
void ProviderSearchResults(CoverProvider *provider, const CoverSearchResults &results);
void ProviderSearchFinished(const int id, const CoverSearchResults &results);
void ProviderCoverFetchFinished(QNetworkReply *reply);
void TerminateSearch();
private:
void ProviderSearchResults(CoverProvider *provider, const CoverSearchResults &results);
void AllProvidersFinished();
void FetchMoreImages();

View File

@@ -385,7 +385,7 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage(Task *task) {
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
QNetworkReply *reply = network_->get(request);
connect(reply, &QNetworkReply::finished, [=] { RemoteFetchFinished(reply, cover_url); });
QObject::connect(reply, &QNetworkReply::finished, [this, reply, cover_url]() { RemoteFetchFinished(reply, cover_url); });
remote_tasks_.insert(reply, *task);
return TryLoadResult(true, false, type, cover_url, QImage());
@@ -417,7 +417,7 @@ void AlbumCoverLoader::RemoteFetchFinished(QNetworkReply *reply, const QUrl &cov
#endif
request.setUrl(redirect.toUrl());
QNetworkReply *redirected_reply = network_->get(request);
connect(redirected_reply, &QNetworkReply::finished, [=] { RemoteFetchFinished(redirected_reply, redirect.toUrl()); });
QObject::connect(redirected_reply, &QNetworkReply::finished, [this, redirected_reply, redirect]() { RemoteFetchFinished(redirected_reply, redirect.toUrl()); });
remote_tasks_.insert(redirected_reply, task);
return;

View File

@@ -131,13 +131,13 @@ AlbumCoverManager::AlbumCoverManager(Application *app, CollectionBackend *collec
progress_bar_->hide();
abort_progress_->hide();
abort_progress_->setText(tr("Abort"));
connect(abort_progress_, SIGNAL(clicked()), this, SLOT(CancelRequests()));
QObject::connect(abort_progress_, &QPushButton::clicked, this, &AlbumCoverManager::CancelRequests);
ui_->albums->setAttribute(Qt::WA_MacShowFocusRect, false);
ui_->artists->setAttribute(Qt::WA_MacShowFocusRect, false);
QShortcut *close = new QShortcut(QKeySequence::Close, this);
connect(close, SIGNAL(activated()), SLOT(close()));
QObject::connect(close, &QShortcut::activated, this, &AlbumCoverManager::close);
EnableCoversButtons();
@@ -180,14 +180,14 @@ void AlbumCoverManager::Init() {
QList<QAction*> actions = album_cover_choice_controller_->GetAllActions();
connect(album_cover_choice_controller_->cover_from_file_action(), SIGNAL(triggered()), this, SLOT(LoadCoverFromFile()));
connect(album_cover_choice_controller_->cover_to_file_action(), SIGNAL(triggered()), this, SLOT(SaveCoverToFile()));
connect(album_cover_choice_controller_->cover_from_url_action(), SIGNAL(triggered()), this, SLOT(LoadCoverFromURL()));
connect(album_cover_choice_controller_->search_for_cover_action(), SIGNAL(triggered()), this, SLOT(SearchForCover()));
connect(album_cover_choice_controller_->unset_cover_action(), SIGNAL(triggered()), this, SLOT(UnsetCover()));
connect(album_cover_choice_controller_->show_cover_action(), SIGNAL(triggered()), this, SLOT(ShowCover()));
QObject::connect(album_cover_choice_controller_->cover_from_file_action(), &QAction::triggered, this, &AlbumCoverManager::LoadCoverFromFile);
QObject::connect(album_cover_choice_controller_->cover_to_file_action(), &QAction::triggered, this, &AlbumCoverManager::SaveCoverToFile);
QObject::connect(album_cover_choice_controller_->cover_from_url_action(), &QAction::triggered, this, &AlbumCoverManager::LoadCoverFromURL);
QObject::connect(album_cover_choice_controller_->search_for_cover_action(), &QAction::triggered, this, &AlbumCoverManager::SearchForCover);
QObject::connect(album_cover_choice_controller_->unset_cover_action(), &QAction::triggered, this, &AlbumCoverManager::UnsetCover);
QObject::connect(album_cover_choice_controller_->show_cover_action(), &QAction::triggered, this, &AlbumCoverManager::ShowCover);
connect(cover_exporter_, SIGNAL(AlbumCoversExportUpdate(int, int, int)), SLOT(UpdateExportStatus(int, int, int)));
QObject::connect(cover_exporter_, &AlbumCoverExporter::AlbumCoversExportUpdate, this, &AlbumCoverManager::UpdateExportStatus);
context_menu_->addActions(actions);
context_menu_->addSeparator();
@@ -197,17 +197,17 @@ void AlbumCoverManager::Init() {
ui_->albums->installEventFilter(this);
// Connections
connect(ui_->artists, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), SLOT(ArtistChanged(QListWidgetItem*)));
connect(ui_->filter, SIGNAL(textChanged(QString)), SLOT(UpdateFilter()));
connect(filter_group, SIGNAL(triggered(QAction*)), SLOT(UpdateFilter()));
connect(ui_->view, SIGNAL(clicked()), ui_->view, SLOT(showMenu()));
connect(ui_->button_fetch, SIGNAL(clicked()), SLOT(FetchAlbumCovers()));
connect(ui_->export_covers, SIGNAL(clicked()), SLOT(ExportCovers()));
connect(cover_fetcher_, SIGNAL(AlbumCoverFetched(quint64, QUrl, QImage, CoverSearchStatistics)), SLOT(AlbumCoverFetched(quint64, QUrl, QImage, CoverSearchStatistics)));
connect(ui_->action_fetch, SIGNAL(triggered()), SLOT(FetchSingleCover()));
connect(ui_->albums, SIGNAL(doubleClicked(QModelIndex)), SLOT(AlbumDoubleClicked(QModelIndex)));
connect(ui_->action_add_to_playlist, SIGNAL(triggered()), SLOT(AddSelectedToPlaylist()));
connect(ui_->action_load, SIGNAL(triggered()), SLOT(LoadSelectedToPlaylist()));
QObject::connect(ui_->artists, &QListWidget::currentItemChanged, this, &AlbumCoverManager::ArtistChanged);
QObject::connect(ui_->filter, &QSearchField::textChanged, this, &AlbumCoverManager::UpdateFilter);
QObject::connect(filter_group, &QActionGroup::triggered, this, &AlbumCoverManager::UpdateFilter);
QObject::connect(ui_->view, &QToolButton::clicked, ui_->view, &QToolButton::showMenu);
QObject::connect(ui_->button_fetch, &QPushButton::clicked, this, &AlbumCoverManager::FetchAlbumCovers);
QObject::connect(ui_->export_covers, &QPushButton::clicked, this, &AlbumCoverManager::ExportCovers);
QObject::connect(cover_fetcher_, &AlbumCoverFetcher::AlbumCoverFetched, this, &AlbumCoverManager::AlbumCoverFetched);
QObject::connect(ui_->action_fetch, &QAction::triggered, this, &AlbumCoverManager::FetchSingleCover);
QObject::connect(ui_->albums, &QListWidget::doubleClicked, this, &AlbumCoverManager::AlbumDoubleClicked);
QObject::connect(ui_->action_add_to_playlist, &QAction::triggered, this, &AlbumCoverManager::AddSelectedToPlaylist);
QObject::connect(ui_->action_load, &QAction::triggered, this, &AlbumCoverManager::LoadSelectedToPlaylist);
// Restore settings
QSettings s;
@@ -219,7 +219,7 @@ void AlbumCoverManager::Init() {
ui_->splitter->setSizes(QList<int>() << 200 << width() - 200);
}
connect(app_->album_cover_loader(), SIGNAL(AlbumCoverLoaded(quint64, AlbumCoverLoaderResult)), SLOT(AlbumCoverLoaded(quint64, AlbumCoverLoaderResult)));
QObject::connect(app_->album_cover_loader(), &AlbumCoverLoader::AlbumCoverLoaded, this, &AlbumCoverManager::AlbumCoverLoaded);
cover_searcher_->Init(cover_fetcher_);
@@ -541,7 +541,7 @@ void AlbumCoverManager::UpdateStatusText() {
progress_bar_->setValue(fetch_statistics_.chosen_images_ + fetch_statistics_.missing_images_);
if (cover_fetching_tasks_.isEmpty()) {
QTimer::singleShot(2000, statusBar(), SLOT(clearMessage()));
QTimer::singleShot(2000, statusBar(), &QStatusBar::clearMessage);
progress_bar_->hide();
abort_progress_->hide();
@@ -757,17 +757,17 @@ void AlbumCoverManager::UnsetCover() {
}
SongList AlbumCoverManager::GetSongsInAlbum(const QModelIndex &index) const {
SongList AlbumCoverManager::GetSongsInAlbum(const QModelIndex &idx) const {
SongList ret;
CollectionQuery q;
q.SetColumnSpec("ROWID," + Song::kColumnSpec);
q.AddWhere("album", index.data(Role_AlbumName).toString());
q.AddWhere("album", idx.data(Role_AlbumName).toString());
q.SetOrderBy("disc, track, title");
QString artist = index.data(Role_ArtistName).toString();
QString albumartist = index.data(Role_AlbumArtistName).toString();
QString artist = idx.data(Role_ArtistName).toString();
QString albumartist = idx.data(Role_AlbumArtistName).toString();
if (!albumartist.isEmpty()) {
q.AddWhere("albumartist", albumartist);
@@ -792,8 +792,8 @@ SongList AlbumCoverManager::GetSongsInAlbum(const QModelIndex &index) const {
SongList AlbumCoverManager::GetSongsInAlbums(const QModelIndexList &indexes) const {
SongList ret;
for (const QModelIndex &index : indexes) {
ret << GetSongsInAlbum(index);
for (const QModelIndex &idx : indexes) {
ret << GetSongsInAlbum(idx);
}
return ret;
@@ -904,7 +904,7 @@ void AlbumCoverManager::UpdateExportStatus(const int exported, const int skipped
// End of the current process
if (exported + skipped >= max) {
QTimer::singleShot(2000, statusBar(), SLOT(clearMessage()));
QTimer::singleShot(2000, statusBar(), &QStatusBar::clearMessage);
progress_bar_->hide();
abort_progress_->hide();

View File

@@ -79,7 +79,7 @@ class AlbumCoverManager : public QMainWindow {
void EnableCoversButtons();
void DisableCoversButtons();
SongList GetSongsInAlbum(const QModelIndex &index) const;
SongList GetSongsInAlbum(const QModelIndex &idx) const;
SongList GetSongsInAlbums(const QModelIndexList &indexes) const;
SongMimeData *GetMimeDataForAlbums(const QModelIndexList &indexes) const;

View File

@@ -57,4 +57,3 @@ class AlbumCoverManagerList : public QListWidget {
};
#endif // ALBUMCOVERMANAGERLIST_H

View File

@@ -71,15 +71,15 @@ const int SizeOverlayDelegate::kBackgroundAlpha = 175;
SizeOverlayDelegate::SizeOverlayDelegate(QObject *parent)
: QStyledItemDelegate(parent) {}
void SizeOverlayDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
void SizeOverlayDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const {
QStyledItemDelegate::paint(painter, option, index);
QStyledItemDelegate::paint(painter, option, idx);
if (!index.data(AlbumCoverSearcher::Role_ImageFetchFinished).toBool()) {
if (!idx.data(AlbumCoverSearcher::Role_ImageFetchFinished).toBool()) {
return;
}
const QSize size = index.data(AlbumCoverSearcher::Role_ImageSize).toSize();
const QSize size = idx.data(AlbumCoverSearcher::Role_ImageSize).toSize();
const QString text = Utilities::PrettySize(size);
QFont font(option.font);
@@ -136,10 +136,9 @@ AlbumCoverSearcher::AlbumCoverSearcher(const QIcon &no_cover_icon, Application *
options_.pad_thumbnail_image_ = true;
options_.thumbnail_size_ = ui_->covers->iconSize();
connect(app_->album_cover_loader(), SIGNAL(AlbumCoverLoaded(quint64, AlbumCoverLoaderResult)), SLOT(AlbumCoverLoaded(quint64, AlbumCoverLoaderResult)));
connect(ui_->search, SIGNAL(clicked()), SLOT(Search()));
connect(ui_->covers, SIGNAL(doubleClicked(QModelIndex)), SLOT(CoverDoubleClicked(QModelIndex)));
QObject::connect(app_->album_cover_loader(), &AlbumCoverLoader::AlbumCoverLoaded, this, &AlbumCoverSearcher::AlbumCoverLoaded);
QObject::connect(ui_->search, &QPushButton::clicked, this, &AlbumCoverSearcher::Search);
QObject::connect(ui_->covers, &GroupedIconView::doubleClicked, this, &AlbumCoverSearcher::CoverDoubleClicked);
new ForceScrollPerPixel(ui_->covers, this);
@@ -154,7 +153,7 @@ AlbumCoverSearcher::~AlbumCoverSearcher() {
void AlbumCoverSearcher::Init(AlbumCoverFetcher *fetcher) {
fetcher_ = fetcher;
connect(fetcher_, SIGNAL(SearchFinished(quint64, CoverSearchResults, CoverSearchStatistics)), this, SLOT(SearchFinished(quint64, CoverSearchResults)), Qt::QueuedConnection);
QObject::connect(fetcher_, &AlbumCoverFetcher::SearchFinished, this, &AlbumCoverSearcher::SearchFinished, Qt::QueuedConnection);
}
@@ -283,7 +282,7 @@ void AlbumCoverSearcher::keyPressEvent(QKeyEvent *e) {
}
void AlbumCoverSearcher::CoverDoubleClicked(const QModelIndex &index) {
if (index.isValid()) accept();
void AlbumCoverSearcher::CoverDoubleClicked(const QModelIndex &idx) {
if (idx.isValid()) accept();
}

View File

@@ -1,3 +1,4 @@
/*
* Strawberry Music Player
* This file was part of Clementine.
@@ -61,7 +62,7 @@ class SizeOverlayDelegate : public QStyledItemDelegate {
explicit SizeOverlayDelegate(QObject *parent = nullptr);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const override;
};
// This is a dialog that lets the user search for album covers
@@ -92,7 +93,7 @@ class AlbumCoverSearcher : public QDialog {
void SearchFinished(const quint64 id, const CoverSearchResults &results);
void AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderResult &result);
void CoverDoubleClicked(const QModelIndex &index);
void CoverDoubleClicked(const QModelIndex &idx);
private:
Ui_AlbumCoverSearcher *ui_;

View File

@@ -56,4 +56,3 @@ class CoverExportRunnable : public QObject, public QRunnable {
};
#endif // COVEREXPORTRUNNABLE_H

View File

@@ -73,7 +73,7 @@ void CoverFromURLDialog::accept() {
#endif
QNetworkReply *reply = network_->get(req);
connect(reply, SIGNAL(finished()), SLOT(LoadCoverFromURLFinished()));
QObject::connect(reply, &QNetworkReply::finished, this, &CoverFromURLDialog::LoadCoverFromURLFinished);
}

View File

@@ -56,4 +56,3 @@ class CoverFromURLDialog : public QDialog {
};
#endif // COVERFROMURLDIALOG_H

View File

@@ -97,7 +97,7 @@ void CoverProviders::AddProvider(CoverProvider *provider) {
{
QMutexLocker locker(&mutex_);
cover_providers_.insert(provider, provider->name());
connect(provider, SIGNAL(destroyed()), SLOT(ProviderDestroyed()));
QObject::connect(provider, &CoverProvider::destroyed, this, &CoverProviders::ProviderDestroyed);
}
provider->set_order(++NextOrderId);

View File

@@ -52,4 +52,3 @@ class CoverSearchStatisticsDialog : public QDialog {
};
#endif // COVERSEARCHSTATISTICSDIALOG_H

View File

@@ -50,8 +50,8 @@ CurrentAlbumCoverLoader::CurrentAlbumCoverLoader(Application *app, QObject *pare
options_.default_output_image_ = QImage(":/pictures/cdcase.png");
options_.default_thumbnail_image_ = options_.default_output_image_.scaledToHeight(120, Qt::SmoothTransformation);
connect(app_->album_cover_loader(), SIGNAL(AlbumCoverLoaded(quint64, AlbumCoverLoaderResult)), SLOT(TempAlbumCoverLoaded(quint64, AlbumCoverLoaderResult)));
connect(app_->playlist_manager(), SIGNAL(CurrentSongChanged(Song)), SLOT(LoadAlbumCover(Song)));
QObject::connect(app_->album_cover_loader(), &AlbumCoverLoader::AlbumCoverLoaded, this, &CurrentAlbumCoverLoader::TempAlbumCoverLoaded);
QObject::connect(app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, this, &CurrentAlbumCoverLoader::LoadAlbumCover);
}

View File

@@ -59,7 +59,7 @@ DeezerCoverProvider::~DeezerCoverProvider() {
while (!replies_.isEmpty()) {
QNetworkReply *reply = replies_.takeFirst();
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->abort();
reply->deleteLater();
}
@@ -107,7 +107,7 @@ bool DeezerCoverProvider::StartSearch(const QString &artist, const QString &albu
#endif
QNetworkReply *reply = network_->get(req);
replies_ << reply;
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, id); });
QObject::connect(reply, &QNetworkReply::finished, [this, reply, id]() { HandleSearchReply(reply, id); });
return true;
@@ -200,7 +200,7 @@ void DeezerCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id)
if (!replies_.contains(reply)) return;
replies_.removeAll(reply);
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->deleteLater();
QByteArray data = GetReplyData(reply);

View File

@@ -67,7 +67,7 @@ DiscogsCoverProvider::DiscogsCoverProvider(Application *app, QObject *parent) :
timer_flush_requests_->setInterval(kRequestsDelay);
timer_flush_requests_->setSingleShot(false);
connect(timer_flush_requests_, SIGNAL(timeout()), this, SLOT(FlushRequests()));
QObject::connect(timer_flush_requests_, &QTimer::timeout, this, &DiscogsCoverProvider::FlushRequests);
}
@@ -75,7 +75,7 @@ DiscogsCoverProvider::~DiscogsCoverProvider() {
while (!replies_.isEmpty()) {
QNetworkReply *reply = replies_.takeFirst();
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->abort();
reply->deleteLater();
}
@@ -144,7 +144,7 @@ void DiscogsCoverProvider::SendSearchRequest(std::shared_ptr<DiscogsCoverSearchC
}
QNetworkReply *reply = CreateRequest(QUrl(kUrlSearch), params);
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, search->id); });
QObject::connect(reply, &QNetworkReply::finished, [this, reply, search]() { HandleSearchReply(reply, search->id); });
}
@@ -234,7 +234,7 @@ void DiscogsCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id)
if (!replies_.contains(reply)) return;
replies_.removeAll(reply);
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->deleteLater();
if (!requests_search_.contains(id)) return;
@@ -331,7 +331,7 @@ void DiscogsCoverProvider::StartReleaseRequest(std::shared_ptr<DiscogsCoverSearc
void DiscogsCoverProvider::SendReleaseRequest(const DiscogsCoverReleaseContext release) {
QNetworkReply *reply = CreateRequest(release.url);
connect(reply, &QNetworkReply::finished, [=] { HandleReleaseReply(reply, release.search_id, release.id); });
QObject::connect(reply, &QNetworkReply::finished, [this, reply, release]() { HandleReleaseReply(reply, release.search_id, release.id); } );
}
@@ -339,7 +339,7 @@ void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const int se
if (!replies_.contains(reply)) return;
replies_.removeAll(reply);
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->deleteLater();
if (!requests_search_.contains(search_id)) return;

View File

@@ -59,7 +59,7 @@ LastFmCoverProvider::~LastFmCoverProvider() {
while (!replies_.isEmpty()) {
QNetworkReply *reply = replies_.takeFirst();
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->abort();
reply->deleteLater();
}
@@ -122,7 +122,7 @@ bool LastFmCoverProvider::StartSearch(const QString &artist, const QString &albu
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
QNetworkReply *reply = network_->post(req, url_query.toString(QUrl::FullyEncoded).toUtf8());
replies_ << reply;
connect(reply, &QNetworkReply::finished, [=] { QueryFinished(reply, id, type); });
QObject::connect(reply, &QNetworkReply::finished, [this, reply, id, type]() { QueryFinished(reply, id, type); });
return true;
@@ -132,7 +132,7 @@ void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, const int id, cons
if (!replies_.contains(reply)) return;
replies_.removeAll(reply);
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->deleteLater();
CoverSearchResults results;

View File

@@ -55,7 +55,7 @@ MusicbrainzCoverProvider::MusicbrainzCoverProvider(Application *app, QObject *pa
timer_flush_requests_->setInterval(kRequestsDelay);
timer_flush_requests_->setSingleShot(false);
connect(timer_flush_requests_, SIGNAL(timeout()), this, SLOT(FlushRequests()));
QObject::connect(timer_flush_requests_, &QTimer::timeout, this, &MusicbrainzCoverProvider::FlushRequests);
}
@@ -63,7 +63,7 @@ MusicbrainzCoverProvider::~MusicbrainzCoverProvider() {
while (!replies_.isEmpty()) {
QNetworkReply *reply = replies_.takeFirst();
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->abort();
reply->deleteLater();
}
@@ -106,7 +106,7 @@ void MusicbrainzCoverProvider::SendSearchRequest(const SearchRequest &request) {
#endif
QNetworkReply *reply = network_->get(req);
replies_ << reply;
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, request.id); });
QObject::connect(reply, &QNetworkReply::finished, [this, reply, request]() { HandleSearchReply(reply, request.id); });
}
@@ -125,7 +125,7 @@ void MusicbrainzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
if (!replies_.contains(reply)) return;
replies_.removeAll(reply);
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->deleteLater();
CoverSearchResults results;

View File

@@ -46,7 +46,7 @@ MusixmatchCoverProvider::~MusixmatchCoverProvider() {
while (!replies_.isEmpty()) {
QNetworkReply *reply = replies_.takeFirst();
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->abort();
reply->deleteLater();
}
@@ -88,7 +88,7 @@ bool MusixmatchCoverProvider::StartSearch(const QString &artist, const QString &
#endif
QNetworkReply *reply = network_->get(req);
replies_ << reply;
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, id, artist, album); });
QObject::connect(reply, &QNetworkReply::finished, [this, reply, id, artist, album]() { HandleSearchReply(reply, id, artist, album); });
//qLog(Debug) << "Musixmatch: Sending request for" << artist_stripped << album_stripped << url;
@@ -102,7 +102,7 @@ void MusixmatchCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
if (!replies_.contains(reply)) return;
replies_.removeAll(reply);
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->deleteLater();
CoverSearchResults results;

View File

@@ -60,7 +60,7 @@ QobuzCoverProvider::~QobuzCoverProvider() {
while (!replies_.isEmpty()) {
QNetworkReply *reply = replies_.takeFirst();
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->abort();
reply->deleteLater();
}
@@ -111,7 +111,7 @@ bool QobuzCoverProvider::StartSearch(const QString &artist, const QString &album
req.setRawHeader("X-User-Auth-Token", user_auth_token_.toUtf8());
QNetworkReply *reply = network_->get(req);
replies_ << reply;
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, id); });
QObject::connect(reply, &QNetworkReply::finished, [this, reply, id]() { HandleSearchReply(reply, id); });
return true;
@@ -167,7 +167,7 @@ void QobuzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
if (!replies_.contains(reply)) return;
replies_.removeAll(reply);
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->deleteLater();
CoverSearchResults results;

View File

@@ -66,7 +66,7 @@ const int SpotifyCoverProvider::kLimit = 10;
SpotifyCoverProvider::SpotifyCoverProvider(Application *app, QObject *parent) : JsonCoverProvider("Spotify", true, true, 2.5, true, true, app, parent), network_(new NetworkAccessManager(this)), server_(nullptr), expires_in_(0), login_time_(0) {
refresh_login_timer_.setSingleShot(true);
connect(&refresh_login_timer_, SIGNAL(timeout()), SLOT(RequestAccessToken()));
QObject::connect(&refresh_login_timer_, &QTimer::timeout, this, &SpotifyCoverProvider::RequestNewAccessToken);
QSettings s;
s.beginGroup(kSettingsGroup);
@@ -89,7 +89,7 @@ SpotifyCoverProvider::~SpotifyCoverProvider() {
while (!replies_.isEmpty()) {
QNetworkReply *reply = replies_.takeFirst();
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->abort();
reply->deleteLater();
}
@@ -118,7 +118,7 @@ void SpotifyCoverProvider::Authenticate() {
server_ = nullptr;
return;
}
connect(server_, SIGNAL(Finished()), this, SLOT(RedirectArrived()));
QObject::connect(server_, &LocalRedirectServer::Finished, this, &SpotifyCoverProvider::RedirectArrived);
}
code_verifier_ = Utilities::CryptographicRandomString(44);
@@ -246,8 +246,8 @@ void SpotifyCoverProvider::RequestAccessToken(const QString code, const QUrl red
QNetworkReply *reply = network_->post(req, query);
replies_ << reply;
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(HandleLoginSSLErrors(QList<QSslError>)));
connect(reply, &QNetworkReply::finished, [=] { AccessTokenRequestFinished(reply); });
QObject::connect(reply, &QNetworkReply::sslErrors, this, &SpotifyCoverProvider::HandleLoginSSLErrors);
QObject::connect(reply, &QNetworkReply::finished, [this, reply]() { AccessTokenRequestFinished(reply); });
}
@@ -263,7 +263,7 @@ void SpotifyCoverProvider::AccessTokenRequestFinished(QNetworkReply *reply) {
if (!replies_.contains(reply)) return;
replies_.removeAll(reply);
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->deleteLater();
if (reply->error() != QNetworkReply::NoError || reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200) {
@@ -402,7 +402,7 @@ bool SpotifyCoverProvider::StartSearch(const QString &artist, const QString &alb
QNetworkReply *reply = network_->get(req);
replies_ << reply;
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, id, extract); });
QObject::connect(reply, &QNetworkReply::finished, [this, reply, id, extract]() { HandleSearchReply(reply, id, extract); });
return true;
@@ -461,7 +461,7 @@ void SpotifyCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id,
if (!replies_.contains(reply)) return;
replies_.removeAll(reply);
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->deleteLater();
QByteArray data = GetReplyData(reply);

View File

@@ -58,14 +58,15 @@ class SpotifyCoverProvider : public JsonCoverProvider {
private slots:
void HandleLoginSSLErrors(QList<QSslError> ssl_errors);
void RedirectArrived();
void RequestAccessToken(const QString code = QString(), const QUrl redirect_url = QUrl());
void AccessTokenRequestFinished(QNetworkReply *reply);
void HandleSearchReply(QNetworkReply *reply, const int id, const QString &extract);
void RequestNewAccessToken() { RequestAccessToken(); }
private:
QByteArray GetReplyData(QNetworkReply *reply);
void AuthError(const QString &error = QString(), const QVariant &debug = QVariant());
void Error(const QString &error, const QVariant &debug = QVariant()) override;
void RequestAccessToken(const QString code = QString(), const QUrl redirect_url = QUrl());
private:
typedef QPair<QString, QString> Param;

View File

@@ -63,7 +63,7 @@ TidalCoverProvider::~TidalCoverProvider() {
while (!replies_.isEmpty()) {
QNetworkReply *reply = replies_.takeFirst();
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->abort();
reply->deleteLater();
}
@@ -117,7 +117,7 @@ bool TidalCoverProvider::StartSearch(const QString &artist, const QString &album
QNetworkReply *reply = network_->get(req);
replies_ << reply;
connect(reply, &QNetworkReply::finished, [=] { HandleSearchReply(reply, id); });
QObject::connect(reply, &QNetworkReply::finished, [this, reply, id]() { HandleSearchReply(reply, id); });
return true;
@@ -178,7 +178,7 @@ void TidalCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
if (!replies_.contains(reply)) return;
replies_.removeAll(reply);
disconnect(reply, nullptr, this, nullptr);
QObject::disconnect(reply, nullptr, this, nullptr);
reply->deleteLater();
QByteArray data = GetReplyData(reply);