diff --git a/src/library/dlgtrackinfomulti.cpp b/src/library/dlgtrackinfomulti.cpp index 80326da771e..3aa63642134 100644 --- a/src/library/dlgtrackinfomulti.cpp +++ b/src/library/dlgtrackinfomulti.cpp @@ -102,7 +102,6 @@ DlgTrackInfoMulti::DlgTrackInfoMulti(UserSettingsPointer pUserSettings) m_pUserSettings(std::move(pUserSettings)), m_pWCoverArtMenu(make_parented(this)), m_pWCoverArtLabel(make_parented(this, m_pWCoverArtMenu)), - m_pWStarRating(make_parented(this)), m_starRatingModified(false), m_newRating(0), m_colorChanged(false), @@ -223,14 +222,7 @@ void DlgTrackInfoMulti::init() { this, &DlgTrackInfoMulti::slotColorPicked); - // Insert the star rating widget - starsLayout->setAlignment(Qt::AlignRight | Qt::AlignVCenter); - starsLayout->setSpacing(0); - starsLayout->setContentsMargins(0, 0, 0, 0); - starsLayout->insertWidget(0, m_pWStarRating.get()); - // This is necessary to pass on mouseMove events to WStarRating - m_pWStarRating->setMouseTracking(true); - connect(m_pWStarRating, + connect(starRating, &WStarRating::ratingChangeRequest, this, &DlgTrackInfoMulti::slotStarRatingChanged); @@ -303,8 +295,8 @@ void DlgTrackInfoMulti::updateFromTracks() { replaceTrackRecords(trackRecords); // Collect star ratings and track colors - // If track value differs from the current value, add it to the list. - // If new and current are identical, keep only one. + // Check if all tracks have the same value for the rating (resp. color). + // If yes, show that value, if no, show a placeholder value instead. int commonRating = m_trackRecords.first().getRating(); for (const auto& rec : std::as_const(m_trackRecords)) { if (commonRating != rec.getRating()) { @@ -313,7 +305,7 @@ void DlgTrackInfoMulti::updateFromTracks() { } } // Update the star widget - m_pWStarRating->slotSetRating(commonRating); + starRating->slotSetRating(commonRating); m_starRatingModified = false; // Same procedure for the track color @@ -887,7 +879,7 @@ void DlgTrackInfoMulti::trackColorDialogSetColorStyleButton( void DlgTrackInfoMulti::slotStarRatingChanged(int rating) { if (!m_pLoadedTracks.isEmpty() && mixxx::TrackRecord::isValidRating(rating)) { m_starRatingModified = true; - m_pWStarRating->slotSetRating(rating); + starRating->slotSetRating(rating); m_newRating = rating; } } diff --git a/src/library/dlgtrackinfomulti.h b/src/library/dlgtrackinfomulti.h index 5c531127972..bbe943848ed 100644 --- a/src/library/dlgtrackinfomulti.h +++ b/src/library/dlgtrackinfomulti.h @@ -101,7 +101,6 @@ class DlgTrackInfoMulti : public QDialog, public Ui::DlgTrackInfoMulti { parented_ptr m_pWCoverArtMenu; parented_ptr m_pWCoverArtLabel; - parented_ptr m_pWStarRating; bool m_starRatingModified; int m_newRating; bool m_colorChanged; diff --git a/src/library/dlgtrackinfomulti.ui b/src/library/dlgtrackinfomulti.ui index 04b35a92cb4..1949b9a46d1 100644 --- a/src/library/dlgtrackinfomulti.ui +++ b/src/library/dlgtrackinfomulti.ui @@ -194,21 +194,22 @@ - + + + true + + + true + + + Qt::StrongFocus + 0 0 - - - 0 - - - QLayout::SetDefaultConstraint - - @@ -735,6 +736,13 @@ + + + WStarRating + QWidget +
widget/wstarrating.h
+
+
txtTitle txtArtist @@ -744,6 +752,7 @@ txtGenre txtGrouping txtComment + starRating txtYear txtKey txtTrackNumber