From 3eca24b4b5d51e7486184b52c40f7610dfb0b39c Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sun, 8 Mar 2020 15:24:24 +0100 Subject: Add support for cycling through track colors via COs --- src/library/librarycontrol.cpp | 44 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'src/library/librarycontrol.cpp') diff --git a/src/library/librarycontrol.cpp b/src/library/librarycontrol.cpp index aed741c1ce..feacf2baa0 100644 --- a/src/library/librarycontrol.cpp +++ b/src/library/librarycontrol.cpp @@ -190,6 +190,18 @@ LibraryControl::LibraryControl(Library* pLibrary) this, &LibraryControl::slotIncrementFontSize); + // Track Color controls + m_pTrackColorPrev = std::make_unique(ConfigKey("[Library]", "track_color_prev")); + m_pTrackColorNext = std::make_unique(ConfigKey("[Library]", "track_color_next")); + connect(m_pTrackColorPrev.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotTrackColorPrev); + connect(m_pTrackColorNext.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotTrackColorNext); + /// Deprecated controls m_pSelectNextTrack = std::make_unique(ConfigKey("[Playlist]", "SelectNextTrack")); connect(m_pSelectNextTrack.get(), @@ -563,8 +575,8 @@ void LibraryControl::slotGoToItem(double v) { slotToggleSelectedSidebarItem(v); } } - // TODO(xxx) instead of remote control the widgets individual, we should - // translate this into Alt+Return and handle it at each library widget + // TODO(xxx) instead of remote control the widgets individual, we should + // translate this into Alt+Return and handle it at each library widget // individual https://bugs.launchpad.net/mixxx/+bug/1758618 //emitKeyEvent(QKeyEvent{QEvent::KeyPress, Qt::Key_Return, Qt::AltModifier}); } @@ -603,3 +615,31 @@ void LibraryControl::slotDecrementFontSize(double v) { slotFontSize(-1); } } + +void LibraryControl::slotTrackColorPrev(double v) { + if (!m_pLibraryWidget) { + return; + } + + if (v > 0) { + LibraryView* activeView = m_pLibraryWidget->getActiveView(); + if (!activeView) { + return; + } + activeView->assignPreviousTrackColor(); + } +} + +void LibraryControl::slotTrackColorNext(double v) { + if (!m_pLibraryWidget) { + return; + } + + if (v > 0) { + LibraryView* activeView = m_pLibraryWidget->getActiveView(); + if (!activeView) { + return; + } + activeView->assignNextTrackColor(); + } +} -- cgit v1.2.3