diff options
author | Harshit Maurya <hmaurya999@gmail.com> | 2020-04-22 16:14:54 +0530 |
---|---|---|
committer | Harshit Maurya <hmaurya999@gmail.com> | 2020-04-22 16:14:54 +0530 |
commit | 475f9e09cf6ef3c8df86fc69c56921573a9b36b6 (patch) | |
tree | 44958f8bc41696a669280bd21c052c1656724a9a /src/widget/wtracktableview.cpp | |
parent | 22900e52cd275f6d9a29926734c1ac03d248115b (diff) |
WTrackTableView: bring back load track overrides
Diffstat (limited to 'src/widget/wtracktableview.cpp')
-rw-r--r-- | src/widget/wtracktableview.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index 651dd25c51..fec27b5557 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -736,6 +736,37 @@ void WTrackTableView::keyPressEvent(QKeyEvent* event) { } } +void WTrackTableView::loadSelectedTrack() { + auto indices = selectionModel()->selectedRows(); + if (indices.size() > 0) { + slotMouseDoubleClicked(indices.at(0)); + } +} + +void WTrackTableView::loadSelectedTrackToGroup(QString group, bool play) { + auto indices = selectionModel()->selectedRows(); + if (indices.size() > 0) { + // If the track load override is disabled, check to see if a track is + // playing before trying to load it + if (!(m_pConfig->getValueString( + ConfigKey("[Controls]", "AllowTrackLoadToPlayingDeck")) + .toInt())) { + // TODO(XXX): Check for other than just the first preview deck. + if (group != "[PreviewDeck1]" && + ControlObject::get(ConfigKey(group, "play")) > 0.0) { + return; + } + } + auto index = indices.at(0); + auto trackModel = getTrackModel(); + TrackPointer pTrack; + if (trackModel && + (pTrack = trackModel->getTrack(index))) { + emit loadTrackToPlayer(pTrack, group, play); + } + } +} + QList<TrackId> WTrackTableView::getSelectedTrackIds() const { QList<TrackId> trackIds; |