Skip to content

Commit

Permalink
Allow to use different messages in case Musikbrainz lookup ends witho…
Browse files Browse the repository at this point in the history
…ut results.
  • Loading branch information
daschuer committed Sep 19, 2024
1 parent 414a8a5 commit 3347111
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/library/dlgtagfetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,15 +481,15 @@ void DlgTagFetcher::setPercentOfEachRecordings(int totalRecordingsFound) {

void DlgTagFetcher::fetchTagFinished(
TrackPointer pTrack,
const QList<mixxx::musicbrainz::TrackRelease>& guessedTrackReleases) {
const QList<mixxx::musicbrainz::TrackRelease>& guessedTrackReleases,
const QString& whyEmptyMessage) {
VERIFY_OR_DEBUG_ASSERT(pTrack == m_pTrack) {
return;
}
m_data.m_tags = guessedTrackReleases;
if (guessedTrackReleases.size() == 0) {
loadingProgressBar->setValue(kMaximumValueOfQProgressBar);
QString emptyMessage = tr("Could not find this track in the MusicBrainz database.");
loadingProgressBar->setFormat(emptyMessage);
loadingProgressBar->setFormat(whyEmptyMessage);
return;
} else {
btnApply->setDisabled(true);
Expand Down
3 changes: 2 additions & 1 deletion src/library/dlgtagfetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class DlgTagFetcher : public QDialog, public Ui::DlgTagFetcher {
private slots:
void fetchTagFinished(
TrackPointer pTrack,
const QList<mixxx::musicbrainz::TrackRelease>& guessedTrackReleases);
const QList<mixxx::musicbrainz::TrackRelease>& guessedTrackReleases,
const QString& whyEmptyMessage);
void tagSelected();
void showProgressOfConstantTask(const QString&);
void setPercentOfEachRecordings(int totalRecordingsFound);
Expand Down
14 changes: 11 additions & 3 deletions src/musicbrainz/tagfetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ void TagFetcher::slotFingerprintReady() {
if (fingerprint.isEmpty()) {
emit resultAvailable(
m_pTrack,
QList<mixxx::musicbrainz::TrackRelease>());
{},
tr("Reading track for fingerprinting failed."));
return;
}

Expand Down Expand Up @@ -165,7 +166,8 @@ void TagFetcher::slotAcoustIdTaskSucceeded(

emit resultAvailable(
std::move(pTrack),
QList<mixxx::musicbrainz::TrackRelease>());
{},
tr("Could not identify track through Acoustid."));
return;
}

Expand Down Expand Up @@ -299,9 +301,15 @@ void TagFetcher::slotMusicBrainzTaskSucceeded(
auto pTrack = m_pTrack;
terminate();

QString whyEmptyMessage;
if (guessedTrackReleases.empty()) {
whyEmptyMessage = tr("Could not find this track in the MusicBrainz database.");
}

emit resultAvailable(
std::move(pTrack),
std::move(guessedTrackReleases));
std::move(guessedTrackReleases),
whyEmptyMessage);
}

void TagFetcher::startFetchCoverArtLinks(
Expand Down
3 changes: 2 additions & 1 deletion src/musicbrainz/tagfetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class TagFetcher : public QObject {
signals:
void resultAvailable(
TrackPointer pTrack,
const QList<mixxx::musicbrainz::TrackRelease>& guessedTrackReleases);
const QList<mixxx::musicbrainz::TrackRelease>& guessedTrackReleases,
const QString& whyEmptyMessage); // To explain why the result is empty
void fetchProgress(
const QString& message);
void numberOfRecordingsFoundFromAcoustId(int totalNumberOfRecordings);
Expand Down

0 comments on commit 3347111

Please sign in to comment.