Skip to content

Commit

Permalink
Allow discarding unused return value and discard it.
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Dec 17, 2024
1 parent 6f51dc2 commit f0af653
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
10 changes: 3 additions & 7 deletions src/library/dlgtrackinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,13 +732,9 @@ void DlgTrackInfo::slotSpinBpmValueChanged(double value) {

void DlgTrackInfo::updateKeyText() {
const auto keyText = txtKey->text();
const auto updateResult =
m_trackRecord.updateGlobalKeyNormalizeText(
keyText,
mixxx::track::io::key::USER);
if (updateResult == mixxx::UpdateResult::Rejected) {
// Restore the current key text
}
m_trackRecord.updateGlobalKeyNormalizeText(
keyText,
mixxx::track::io::key::USER);
displayKeyText();
}

Expand Down
4 changes: 2 additions & 2 deletions src/library/dlgtrackinfomulti.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,9 @@ void DlgTrackInfoMulti::saveTracks() {
rec.refMetadata().refTrackInfo().setYear(year);
}
if (!key.isNull()) {
static_cast<void>(rec.updateGlobalKeyNormalizeText(
rec.updateGlobalKeyNormalizeText(
key,
mixxx::track::io::key::USER));
mixxx::track::io::key::USER);
}
if (!num.isNull()) {
rec.refMetadata().refTrackInfo().setTrackNumber(num);
Expand Down
18 changes: 9 additions & 9 deletions src/track/trackrecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ class TrackDAO;
namespace mixxx {

/// Effect of updating a property with a new value.
enum class [[nodiscard]] UpdateResult{
/// The value has been updated and changed.
Updated,
enum class UpdateResult {
/// The value has been updated and changed.
Updated,

/// The value didn't change and has not been updated.
Unchanged,
/// The value didn't change and has not been updated.
Unchanged,

/// The provided value is invalid or insonsistent with
/// any existing value(s) and has been rejected, i.e.
/// the current value didn't change either.
Rejected,
/// The provided value is invalid or insonsistent with
/// any existing value(s) and has been rejected, i.e.
/// the current value didn't change either.
Rejected,
};

// Properties of tracks that are stored in the database.
Expand Down

0 comments on commit f0af653

Please sign in to comment.