From 0cf2f6c74c09d8bd51bdc466d15060ab09e6e574 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Sun, 23 Apr 2023 22:14:20 +0200 Subject: [PATCH] DlgTrackInfo, track color: separate UI logic / track record color Co-authored-by: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com> --- src/library/dlgtrackinfo.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/library/dlgtrackinfo.cpp b/src/library/dlgtrackinfo.cpp index 719daf996e1c..2c8948a9b839 100644 --- a/src/library/dlgtrackinfo.cpp +++ b/src/library/dlgtrackinfo.cpp @@ -264,7 +264,10 @@ void DlgTrackInfo::init() { connect(m_pColorPicker.get(), &WColorPickerAction::colorPicked, this, - &DlgTrackInfo::slotColorPicked); + [this](const mixxx::RgbColor::optional_t& newColor) { + trackColorDialogSetColor(newColor); + m_trackRecord.setColor(newColor); + }); } void DlgTrackInfo::slotApply() { @@ -332,7 +335,7 @@ void DlgTrackInfo::updateFromTrack(const Track& track) { track.getLocation()); // paint the color selector and check the respective color picker button - slotColorPicked(track.getColor()); + trackColorDialogSetColor(track.getColor()); txtLocation->setText(QDir::toNativeSeparators(track.getLocation())); @@ -524,12 +527,10 @@ void DlgTrackInfo::slotColorButtonClicked() { btnColorPicker->showMenu(); } -void DlgTrackInfo::slotColorPicked(const mixxx::RgbColor::optional_t& newColor) { +void DlgTrackInfo::trackColorDialogSetColor(const mixxx::RgbColor::optional_t& newColor) { m_pColorPicker->setSelectedColor(newColor); btnColorPicker->menu()->close(); - - m_trackRecord.setColor(newColor); - + if (newColor) { btnColorPicker->setText(""); const QColor ccolor = mixxx::RgbColor::toQColor(newColor);