Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WTrackTableView: bring back load track overrides #2696

Merged
merged 2 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/widget/wtracktableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions src/widget/wtracktableview.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class WTrackTableView : public WLibraryTableView {
void onShow() override;
bool hasFocus() const override;
void keyPressEvent(QKeyEvent* event) override;
void loadSelectedTrack() override;
void loadSelectedTrackToGroup(QString group, bool play) override;
void assignNextTrackColor() override;
void assignPreviousTrackColor() override;
QList<TrackId> getSelectedTrackIds() const;
Expand Down