Formatting

This commit is contained in:
Jonas Kvinge
2025-12-08 23:49:48 +01:00
parent 109ff90401
commit 93af866185
179 changed files with 1187 additions and 1269 deletions

View File

@@ -299,7 +299,7 @@ QString AlbumCoverChoiceController::GetInitialPathForFileDialog(const Song &song
// Art automatic is first to show user which cover the album may be using now;
// The song is using it if there's no manual path but we cannot use manual path here because it can contain cached paths
if (song.art_automatic_is_valid()) {
return song.art_automatic().toLocalFile();
return song.art_automatic().toLocalFile();
}
// If no automatic art, start in the song's folder
@@ -757,7 +757,7 @@ bool AlbumCoverChoiceController::IsKnownImageExtension(const QString &suffix) {
if (!sImageExtensions) {
sImageExtensions = new QSet<QString>();
(*sImageExtensions) << u"png"_s << u"jpg"_s << u"jpeg"_s << u"bmp"_s << u"gif"_s << u"xpm"_s << u"pbm"_s << u"pgm"_s << u"ppm"_s << u"xbm"_s;
(*sImageExtensions) << u"png"_s << u"jpg"_s << u"jpeg"_s << u"bmp"_s << u"gif"_s << u"xpm"_s << u"pbm"_s << u"pgm"_s << u"ppm"_s << u"xbm"_s;
}
return sImageExtensions->contains(suffix);
@@ -806,14 +806,14 @@ void AlbumCoverChoiceController::SaveCover(Song *song, const QDropEvent *e) {
QUrl AlbumCoverChoiceController::SaveCoverAutomatic(Song *song, const AlbumCoverImageResult &result) {
QUrl cover_url;
switch(get_save_album_cover_type()) {
case CoverOptions::CoverType::Embedded:{
switch (get_save_album_cover_type()) {
if (song->save_embedded_cover_supported()) {
SaveCoverEmbeddedToCollectionSongs(*song, result);
break;
}
}
[[fallthrough]];
[[fallthrough]];
case CoverOptions::CoverType::Cache:
case CoverOptions::CoverType::Album:{
cover_url = SaveCoverToFileAutomatic(song, result);

View File

@@ -75,4 +75,3 @@ class AlbumCoverExporter : public QObject {
};
#endif // ALBUMCOVEREXPORTER_H

View File

@@ -29,10 +29,10 @@
class AlbumCoverImageResult {
public:
explicit AlbumCoverImageResult(const QUrl &_cover_url = QUrl(), const QString &_mime_type = QString(), const QByteArray &_image_data = QByteArray(), const QImage &_image = QImage())
: cover_url(_cover_url),
mime_type(_mime_type),
image_data(_image_data),
image(_image) {}
: cover_url(_cover_url),
mime_type(_mime_type),
image_data(_image_data),
image(_image) {}
explicit AlbumCoverImageResult(const QImage &_image) : image(_image) {}
QUrl cover_url;

View File

@@ -1,21 +1,21 @@
/*
* Strawberry Music Player
* Copyright 2018-2023, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
* Strawberry Music Player
* Copyright 2018-2023, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "albumcoverloaderoptions.h"

View File

@@ -44,13 +44,13 @@ class AlbumCoverLoaderResult {
const AlbumCoverImageResult &_album_cover = AlbumCoverImageResult(),
const QImage &_image_scaled = QImage(),
const QUrl &_art_manual_updated = QUrl(),
const QUrl &_art_automatic_updated = QUrl()) :
success(_success),
type(_type),
album_cover(_album_cover),
image_scaled(_image_scaled),
art_manual_updated(_art_manual_updated),
art_automatic_updated(_art_automatic_updated) {}
const QUrl &_art_automatic_updated = QUrl())
: success(_success),
type(_type),
album_cover(_album_cover),
image_scaled(_image_scaled),
art_manual_updated(_art_manual_updated),
art_automatic_updated(_art_automatic_updated) {}
bool success;
Type type;

View File

@@ -604,10 +604,7 @@ void AlbumCoverManager::AlbumCoverFetched(const quint64 id, const AlbumCoverImag
void AlbumCoverManager::UpdateStatusText() {
QString message = tr("Got %1 covers out of %2 (%3 failed)")
.arg(fetch_statistics_.chosen_images_)
.arg(jobs_)
.arg(fetch_statistics_.missing_images_);
QString message = tr("Got %1 covers out of %2 (%3 failed)").arg(fetch_statistics_.chosen_images_).arg(jobs_).arg(fetch_statistics_.missing_images_);
if (fetch_statistics_.bytes_transferred_ > 0) {
message += ", "_L1 + tr("%1 transferred").arg(Utilities::PrettySize(fetch_statistics_.bytes_transferred_));
@@ -1083,10 +1080,7 @@ void AlbumCoverManager::UpdateExportStatus(const int exported, const int skipped
progress_bar_->setValue(exported);
QString message = tr("Exported %1 covers out of %2 (%3 skipped)")
.arg(exported)
.arg(max)
.arg(skipped);
QString message = tr("Exported %1 covers out of %2 (%3 skipped)").arg(exported).arg(max).arg(skipped);
statusBar()->showMessage(message);
// End of the current process
@@ -1131,4 +1125,3 @@ void AlbumCoverManager::SaveEmbeddedCoverFinished(TagReaderReplyPtr reply, Album
LoadAlbumCoverAsync(album_item);
}

View File

@@ -45,19 +45,18 @@ CoverSearchStatisticsDialog::CoverSearchStatisticsDialog(QWidget *parent)
details_layout_ = new QVBoxLayout(ui_->details);
details_layout_->setSpacing(0);
setStyleSheet(
u"#details {"
" background-color: palette(base);"
"}"
"#details QLabel[type=\"label\"] {"
" border: 2px solid transparent;"
" border-right: 2px solid palette(midlight);"
" margin-right: 10px;"
"}"
"#details QLabel[type=\"value\"] {"
" font-weight: bold;"
" max-width: 100px;"
"}"_s);
setStyleSheet(u"#details {"
" background-color: palette(base);"
"}"
"#details QLabel[type=\"label\"] {"
" border: 2px solid transparent;"
" border-right: 2px solid palette(midlight);"
" margin-right: 10px;"
"}"
"#details QLabel[type=\"value\"] {"
" font-weight: bold;"
" max-width: 100px;"
"}"_s);
}
CoverSearchStatisticsDialog::~CoverSearchStatisticsDialog() { delete ui_; }
@@ -67,10 +66,7 @@ void CoverSearchStatisticsDialog::Show(const CoverSearchStatistics &statistics)
QStringList providers(statistics.total_images_by_provider_.keys());
std::sort(providers.begin(), providers.end());
ui_->summary->setText(tr("Got %1 covers out of %2 (%3 failed)")
.arg(statistics.chosen_images_)
.arg(statistics.chosen_images_ + statistics.missing_images_)
.arg(statistics.missing_images_));
ui_->summary->setText(tr("Got %1 covers out of %2 (%3 failed)").arg(statistics.chosen_images_).arg(statistics.chosen_images_ + statistics.missing_images_).arg(statistics.missing_images_));
for (const QString &provider : std::as_const(providers)) {
AddLine(tr("Covers from %1").arg(provider), QString::number(statistics.chosen_images_by_provider_[provider]));

View File

@@ -59,7 +59,7 @@ bool MusixmatchCoverProvider::StartSearch(const QString &artist, const QString &
QNetworkReply *reply = CreateGetRequest(QUrl(QStringLiteral("https://www.musixmatch.com/album/%1/%2").arg(artist_stripped, album_stripped)));
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, id, artist, album]() { HandleSearchReply(reply, id, artist, album); });
//qLog(Debug) << "Musixmatch: Sending request for" << artist_stripped << album_stripped << url;
// qLog(Debug) << "Musixmatch: Sending request for" << artist_stripped << album_stripped << url;
return true;