Skip to content

Commit

Permalink
add unused stuff & reminders: key, bpm, cover reload, focus edit fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Jan 12, 2024
1 parent b094974 commit 3532411
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
66 changes: 66 additions & 0 deletions src/library/dlgtrackinfomulti.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ void DlgTrackInfoMulti::init() {
lineEdits.append(txtYear);
lineEdits.append(txtTrackNumber);
lineEdits.append(txtGrouping);
// lineEdits.append(txtKey);

for (auto pEditor : lineEdits) {

Check warning on line 130 in src/library/dlgtrackinfomulti.cpp

View workflow job for this annotation

GitHub Actions / clang-tidy

'auto pEditor' can be declared as 'auto *pEditor' [readability-qualified-auto]
// just to be safe
Expand Down Expand Up @@ -341,6 +342,40 @@ void DlgTrackInfoMulti::updateTrackMetadataFields() {
txtTrackNumber->setText(maybeJoinValuesAndFormatFont(txtTrackNumber, nums));
txtComment->setPlainText(maybeJoinValuesAndFormatFont(txtComment, comments));
txtBpm->setText(maybeJoinValuesAndFormatFont(txtBpm, bpms));
// displayKeyText();
// txtKey->clear();

// Non-editable fields
// txtDuration->setText(
// m_trackRecord.getMetadata().getDurationText(mixxx::Duration::Precision::SECONDS));
// QString bitrate = m_trackRecord.getMetadata().getBitrateText();
// if (bitrate.isEmpty()) {
// txtBitrate->clear();
// } else {
// txtBitrate->setText(bitrate + QChar(' ') + mixxx::audio::Bitrate::unit());
// }
// txtReplayGain->setText(
// mixxx::ReplayGain::ratioToString(
// m_trackRecord.getMetadata().getTrackInfo().getReplayGain().getRatio()));
// txtBitrate->clear();

// auto samplerate =
// m_trackRecord.getMetadata().getStreamInfo().getSignalInfo().getSampleRate();
// if (samplerate.isValid()) {
// txtSamplerate->setText(QString::number(samplerate.value()) + " Hz");
// } else {
// txtSamplerate->clear();
// }
// txtSamplerate->clear();

// Non-editable fields
// Cover art, file type and 'date added'
// txtType->setText(
// m_trackRecord.getFileType());
// txtDateAdded->setText(
// mixxx::displayLocalDateTime(
// mixxx::localDateTimeFromUtc(
// m_trackRecord.getDateAdded())));
}

void DlgTrackInfoMulti::saveTracks() {
Expand Down Expand Up @@ -401,6 +436,12 @@ void DlgTrackInfoMulti::saveTracks() {
pTrack->replaceRecord(std::move(rec));
}

// If the user is editing the bpm or key and hits enter to close DlgTrackInfo,
// the editingFinished signal will not fire in time. Invoke the connected
// handlers manually to capture any changes. If the bpm or key was unchanged
// or invalid then the change will be ignored/rejected.
// static_cast<void>(updateKeyText()); // discard result

connectTracksChanged();

// Repopulate the dialog and update the UI
Expand Down Expand Up @@ -621,3 +662,28 @@ void DlgTrackInfoMulti::slotReloadCoverArt() {
}
updateCoverArtFromTracks();
}

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

// void DlgTrackInfoMulti::displayKeyText() {
// const QString keyText = m_trackRecord.getMetadata().getTrackInfo().getKeyText();
// txtKey->setText(keyText);
// }

// void DlgTrackInfoMulti::slotKeyTextChanged() {
// if (updateKeyText() != mixxx::UpdateResult::Unchanged) {
// // Ensure that the text field always reflects the actual value
// displayKeyText();
// }
// }
7 changes: 7 additions & 0 deletions src/library/dlgtrackinfomulti.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class DlgTrackInfoMulti : public QDialog, public Ui::DlgTrackInfoMulti {

void slotTrackChanged(TrackId trackId);

// void focusField(const QString& property);

void slotColorButtonClicked();
void slotColorPicked(const mixxx::RgbColor::optional_t& newColor);

Expand All @@ -53,6 +55,7 @@ class DlgTrackInfoMulti : public QDialog, public Ui::DlgTrackInfoMulti {
void slotCoverInfoSelected(const CoverInfoRelative& coverInfo);

void slotReloadCoverArt();
// void slotKeyTextChanged();

private:
void init();
Expand All @@ -69,6 +72,8 @@ class DlgTrackInfoMulti : public QDialog, public Ui::DlgTrackInfoMulti {
void updateTrackMetadataFields();
void updateCoverArtFromTracks();
void trackColorDialogSetColorStyleButton(const mixxx::RgbColor::optional_t& color);
// mixxx::UpdateResult updateKeyText();
// void displayKeyText();

TrackPointer getTrackFromSetById(TrackId trackId) {
DEBUG_ASSERT(!m_pLoadedTracks.isEmpty());
Expand All @@ -85,6 +90,8 @@ class DlgTrackInfoMulti : public QDialog, public Ui::DlgTrackInfoMulti {
QHash<TrackId, TrackPointer> m_pLoadedTracks;
QList<mixxx::TrackRecord> m_trackRecords;

// QHash<QString, QWidget*> m_propertyWidgets;

parented_ptr<WCoverArtMenu> m_pWCoverArtMenu;
parented_ptr<WCoverArtLabel> m_pWCoverArtLabel;
parented_ptr<WStarRating> m_pWStarRating;
Expand Down

0 comments on commit 3532411

Please sign in to comment.