Skip to content

Commit

Permalink
Fix building without MusicBrainz
Browse files Browse the repository at this point in the history
  • Loading branch information
reflectronic committed Dec 1, 2024
1 parent 2e0e68a commit 2b7484a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions libthebeat/musicbrainzclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ bool MusicBrainzClient::supported() {
}

QString MusicBrainzClient::selectedReleaseId() {
#ifdef HAVE_MUSICBRAINZ
return d->currentReleaseId;
#else
return "";
#endif
}

QCoro::Task<> MusicBrainzClient::loadMusicbrainzData() {
Expand Down Expand Up @@ -199,10 +203,16 @@ QCoro::Task<> MusicBrainzClient::selectMusicbrainzRelease(QString release) {

int MusicBrainzClient::rowCount(const QModelIndex& parent) const {
if (parent.isValid()) return 0;

#ifdef HAVE_MUSICBRAINZ
return d->releases.Count();
#else
return 0;
#endif
}

QVariant MusicBrainzClient::data(const QModelIndex& index, int role) const {
#ifdef HAVE_MUSICBRAINZ
if (index.parent().isValid()) return {};

auto release = d->releases.Item(index.row());
Expand All @@ -220,6 +230,7 @@ QVariant MusicBrainzClient::data(const QModelIndex& index, int role) const {
case ReleaseId:
return QString::fromStdString(release->ID());
}
#endif

return {};
}
Expand Down

0 comments on commit 2b7484a

Please sign in to comment.