Add missing const

This commit is contained in:
Jonas Kvinge
2024-08-12 18:12:26 +02:00
parent 8d9c135498
commit bdca60c0ad
69 changed files with 413 additions and 300 deletions

View File

@@ -21,6 +21,8 @@
#include "config.h"
#include <utility>
#include <QtGlobal>
#include <QGuiApplication>
#include <QtConcurrentRun>
@@ -421,7 +423,7 @@ void AlbumCoverChoiceController::ShowCover(const Song &song, const QImage &image
}
}
for (const AlbumCoverLoaderOptions::Type type : cover_types_) {
for (const AlbumCoverLoaderOptions::Type type : std::as_const(cover_types_)) {
switch (type) {
case AlbumCoverLoaderOptions::Type::Unset:{
if (song.art_unset()) {
@@ -757,7 +759,8 @@ bool AlbumCoverChoiceController::IsKnownImageExtension(const QString &suffix) {
bool AlbumCoverChoiceController::CanAcceptDrag(const QDragEnterEvent *e) {
for (const QUrl &url : e->mimeData()->urls()) {
const QList<QUrl> urls = e->mimeData()->urls();
for (const QUrl &url : urls) {
const QString suffix = QFileInfo(url.toLocalFile()).suffix().toLower();
if (IsKnownImageExtension(suffix)) return true;
}
@@ -767,7 +770,8 @@ bool AlbumCoverChoiceController::CanAcceptDrag(const QDragEnterEvent *e) {
void AlbumCoverChoiceController::SaveCover(Song *song, const QDropEvent *e) {
for (const QUrl &url : e->mimeData()->urls()) {
const QList<QUrl> urls = e->mimeData()->urls();
for (const QUrl &url : urls) {
const QString filename = url.toLocalFile();
const QString suffix = QFileInfo(filename).suffix().toLower();