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 aef9150 commit 3de22f1
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
68 changes: 68 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 @@ -375,6 +376,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 @@ -435,6 +470,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 All @@ -452,6 +493,8 @@ void DlgTrackInfoMulti::clear() {
m_pWStarRating->slotSetRating(0);
m_pWStarRating->blockSignals(false);
m_starRatingModified = false;

// Cover?
}

void DlgTrackInfoMulti::connectTracksChanged() {
Expand Down Expand Up @@ -598,3 +641,28 @@ void DlgTrackInfoMulti::slotCoverInfoSelected(const CoverInfoRelative& coverInfo
auto pFirstTrack = m_pLoadedTracks.constBegin().value();
CoverArtCache::requestCover(this, CoverInfo(coverInfo, pFirstTrack->getLocation()));
}

// 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();
// }
// }
9 changes: 9 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 @@ -51,7 +53,9 @@ class DlgTrackInfoMulti : public QDialog, public Ui::DlgTrackInfoMulti {
const CoverInfo& info,
const QPixmap& pixmap);
void slotCoverInfoSelected(const CoverInfoRelative& coverInfo);

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

private:
void init();
Expand All @@ -64,6 +68,9 @@ class DlgTrackInfoMulti : public QDialog, public Ui::DlgTrackInfoMulti {

void trackColorDialogSetColorStyleButton(const mixxx::RgbColor::optional_t& color);

// mixxx::UpdateResult updateKeyText();
// void displayKeyText();

void updateFromTracks();

void replaceTrackRecords(const QList<mixxx::TrackRecord>& trackRecords);
Expand All @@ -75,6 +82,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 3de22f1

Please sign in to comment.