diff options
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/librarycontrol.cpp | 44 | ||||
-rw-r--r-- | src/library/librarycontrol.h | 7 | ||||
-rw-r--r-- | src/library/libraryview.h | 31 |
3 files changed, 67 insertions, 15 deletions
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<ControlPushButton>(ConfigKey("[Library]", "track_color_prev")); + m_pTrackColorNext = std::make_unique<ControlPushButton>(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<ControlPushButton>(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(); + } +} diff --git a/src/library/librarycontrol.h b/src/library/librarycontrol.h index 47524dfa4b..3afd2909e7 100644 --- a/src/library/librarycontrol.h +++ b/src/library/librarycontrol.h @@ -65,6 +65,9 @@ class LibraryControl : public QObject { void slotMoveFocus(double); void slotGoToItem(double v); + void slotTrackColorPrev(double v); + void slotTrackColorNext(double v); + // Deprecated navigation slots void slotSelectNextTrack(double v); void slotSelectPrevTrack(double v); @@ -129,6 +132,10 @@ class LibraryControl : public QObject { std::unique_ptr<ControlEncoder> m_pSortColumnToggle; std::unique_ptr<ControlPushButton> m_pSortOrder; + // Controls to change track color + std::unique_ptr<ControlPushButton> m_pTrackColorPrev; + std::unique_ptr<ControlPushButton> m_pTrackColorNext; + // Font sizes std::unique_ptr<ControlPushButton> m_pFontSizeIncrement; std::unique_ptr<ControlPushButton> m_pFontSizeDecrement; diff --git a/src/library/libraryview.h b/src/library/libraryview.h index 293b7b1db7..378691c55a 100644 --- a/src/library/libraryview.h +++ b/src/library/libraryview.h @@ -1,8 +1,8 @@ -// libraryview.h -// Created 8/28/2009 by RJ Ryan (rryan@mit.edu) -// -// LibraryView is an abstract interface that all views to be used with the -// Library widget should support. +/// libraryview.h +/// Created 8/28/2009 by RJ Ryan (rryan@mit.edu) +/// +/// LibraryView is an abstract interface that all views to be used with the +/// Library widget should support. #ifndef LIBRARYVIEW_H #define LIBRARYVIEW_H @@ -15,27 +15,32 @@ class LibraryView { virtual void onShow() = 0; virtual bool hasFocus() const = 0; - // reimplement if LibraryView should be able to search + /// Reimplement if LibraryView should be able to search virtual void onSearch(const QString& text) {Q_UNUSED(text);} - // If applicable, requests that the LibraryView load the selected - // track. Does nothing otherwise. + /// If applicable, requests that the LibraryView load the selected + /// track. Does nothing otherwise. virtual void loadSelectedTrack() {}; virtual void slotAddToAutoDJBottom() {}; virtual void slotAddToAutoDJTop() {}; virtual void slotAddToAutoDJReplace() {}; - // If applicable, requests that the LibraryView load the selected track to - // the specified group. Does nothing otherwise. + /// If applicable, requests that the LibraryView load the selected track to + /// the specified group. Does nothing otherwise. virtual void loadSelectedTrackToGroup(QString group, bool play) { Q_UNUSED(group); Q_UNUSED(play); } - // If a selection is applicable for this view, request that the selection be - // increased or decreased by the provided delta. For example, for a value of - // 1, the view should move to the next selection in the list. + /// If a selection is applicable for this view, request that the selection be + /// increased or decreased by the provided delta. For example, for a value of + /// 1, the view should move to the next selection in the list. virtual void moveSelection(int delta) {Q_UNUSED(delta);} + + /// If applicable, requests that the LibraryView changes the track color of + /// the selected track. Does nothing otherwise. + virtual void assignPreviousTrackColor(){}; + virtual void assignNextTrackColor(){}; }; #endif /* LIBRARYVIEW_H */ |