Fix narrowing conversion in album cover loader

This commit is contained in:
EmmanuelMess
2021-09-10 15:17:33 -03:00
parent 68c44daef2
commit fa3b9a2135
5 changed files with 26 additions and 26 deletions

View File

@@ -482,9 +482,9 @@ void AlbumCoverChoiceController::ShowCover(const Song &song, const QPixmap &pixm
}
qint64 AlbumCoverChoiceController::SearchCoverAutomatically(const Song &song) {
quint64 AlbumCoverChoiceController::SearchCoverAutomatically(const Song &song) {
qint64 id = cover_fetcher_->FetchAlbumCover(song.effective_albumartist(), song.album(), song.title(), true);
quint64 id = cover_fetcher_->FetchAlbumCover(song.effective_albumartist(), song.album(), song.title(), true);
cover_fetching_tasks_[id] = song;
@@ -640,12 +640,12 @@ void AlbumCoverChoiceController::SaveCoverEmbeddedAutomatic(const Song &song, co
urls.reserve(songs.count());
for (const Song &s : songs) urls << s.url();
if (result.is_jpeg()) {
qint64 id = app_->album_cover_loader()->SaveEmbeddedCoverAsync(urls, result.image_data);
quint64 id = app_->album_cover_loader()->SaveEmbeddedCoverAsync(urls, result.image_data);
QMutexLocker l(&mutex_cover_save_tasks_);
cover_save_tasks_.insert(id, song);
}
else {
qint64 id = app_->album_cover_loader()->SaveEmbeddedCoverAsync(urls, result.image);
quint64 id = app_->album_cover_loader()->SaveEmbeddedCoverAsync(urls, result.image);
QMutexLocker l(&mutex_cover_save_tasks_);
cover_save_tasks_.insert(id, song);
}
@@ -684,7 +684,7 @@ void AlbumCoverChoiceController::SaveCoverEmbeddedAutomatic(const Song &song, co
QList<QUrl> urls;
urls.reserve(songs.count());
for (const Song &s : songs) urls << s.url();
qint64 id = app_->album_cover_loader()->SaveEmbeddedCoverAsync(urls, cover_filename);
quint64 id = app_->album_cover_loader()->SaveEmbeddedCoverAsync(urls, cover_filename);
QMutexLocker l(&mutex_cover_save_tasks_);
cover_save_tasks_.insert(id, song);
});

View File

@@ -129,7 +129,7 @@ class AlbumCoverChoiceController : public QWidget {
void ShowCover(const Song &song, const QPixmap &pixmap);
// Search for covers automatically
qint64 SearchCoverAutomatically(const Song &song);
quint64 SearchCoverAutomatically(const Song &song);
// Saves the chosen cover as manual cover path of this song in collection.
void SaveArtAutomaticToSong(Song *song, const QUrl &art_automatic);
@@ -185,7 +185,7 @@ class AlbumCoverChoiceController : public QWidget {
QAction *search_cover_auto_;
QMap<quint64, Song> cover_fetching_tasks_;
QMap<qint64, Song> cover_save_tasks_;
QMap<quint64, Song> cover_save_tasks_;
QMutex mutex_cover_save_tasks_;
CollectionSettingsPage::SaveCoverType save_cover_type_;

View File

@@ -545,55 +545,55 @@ void AlbumCoverLoader::RemoteFetchFinished(QNetworkReply *reply, const QUrl &cov
}
qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, const QString &cover_filename) {
quint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, const QString &cover_filename) {
QMutexLocker l(&mutex_save_image_async_);
qint64 id = ++save_image_async_id_;
quint64 id = ++save_image_async_id_;
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QString, cover_filename));
return id;
}
qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, const QImage &image) {
quint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, const QImage &image) {
QMutexLocker l(&mutex_save_image_async_);
qint64 id = ++save_image_async_id_;
quint64 id = ++save_image_async_id_;
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QImage, image));
return id;
}
qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, const QByteArray &image_data) {
quint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, const QByteArray &image_data) {
QMutexLocker l(&mutex_save_image_async_);
qint64 id = ++save_image_async_id_;
quint64 id = ++save_image_async_id_;
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QByteArray, image_data));
return id;
}
qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QString &cover_filename) {
quint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QString &cover_filename) {
QMutexLocker l(&mutex_save_image_async_);
qint64 id = ++save_image_async_id_;
quint64 id = ++save_image_async_id_;
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QString, cover_filename));
return id;
}
qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QImage &image) {
quint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QImage &image) {
QMutexLocker l(&mutex_save_image_async_);
qint64 id = ++save_image_async_id_;
quint64 id = ++save_image_async_id_;
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QImage, image));
return id;
}
qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QByteArray &image_data) {
quint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QByteArray &image_data) {
QMutexLocker l(&mutex_save_image_async_);
qint64 id = ++save_image_async_id_;
quint64 id = ++save_image_async_id_;
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QByteArray, image_data));
return id;

View File

@@ -81,12 +81,12 @@ class AlbumCoverLoader : public QObject {
void CancelTask(const quint64 id);
void CancelTasks(const QSet<quint64> &ids);
qint64 SaveEmbeddedCoverAsync(const QString &song_filename, const QString &cover_filename);
qint64 SaveEmbeddedCoverAsync(const QString &song_filename, const QImage &image);
qint64 SaveEmbeddedCoverAsync(const QString &song_filename, const QByteArray &image_data);
qint64 SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QString &cover_filename);
qint64 SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QImage &image);
qint64 SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QByteArray &image_data);
quint64 SaveEmbeddedCoverAsync(const QString &song_filename, const QString &cover_filename);
quint64 SaveEmbeddedCoverAsync(const QString &song_filename, const QImage &image);
quint64 SaveEmbeddedCoverAsync(const QString &song_filename, const QByteArray &image_data);
quint64 SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QString &cover_filename);
quint64 SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QImage &image);
quint64 SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QByteArray &image_data);
signals:
void ExitFinished();

View File

@@ -214,7 +214,7 @@ class AlbumCoverManager : public QMainWindow {
QPushButton *abort_progress_;
int jobs_;
QMultiMap<qint64, AlbumItem*> cover_save_tasks_;
QMultiMap<quint64, AlbumItem*> cover_save_tasks_;
QList<AlbumItem*> cover_save_tasks2_;
QListWidgetItem *all_artists_;