Skip to content

Commit

Permalink
Revert "Synchronize also with "Add to AutoDJ" buttons in context menu"
Browse files Browse the repository at this point in the history
This reverts commit 9e1eec4.
  • Loading branch information
Bacadam committed Apr 12, 2024
1 parent d9fbb59 commit 9763555
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/library/autodj/autodjprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ class AutoDJProcessor : public QObject {
void transitionTimeChanged(int time);
void randomTrackRequested(int tracksToAdd);

public slots:
void playlistFirstTrackChanged();

private slots:
void crossfaderChanged(double value);
void playerPositionChanged(DeckAttributes* pDeck, double position);
Expand All @@ -222,6 +219,7 @@ class AutoDJProcessor : public QObject {
void playerLoadingTrack(DeckAttributes* pDeck, TrackPointer pNewTrack, TrackPointer pOldTrack);
void playerEmpty(DeckAttributes* pDeck);
void playerRateChanged(DeckAttributes* pDeck);
void playlistFirstTrackChanged();

void controlEnableChangeRequest(double value);
void controlFadeNow(double value);
Expand Down
11 changes: 7 additions & 4 deletions src/library/dao/playlistdao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1278,18 +1278,21 @@ void PlaylistDAO::addTracksToAutoDJQueue(const QList<TrackId>& trackIds, AutoDJS
return;
}

// If the first track is already loaded to the player,
// alter the playlist only below the first track
int position =
(m_pAutoDJProcessor && m_pAutoDJProcessor->nextTrackLoaded()) ? 2 : 1;

switch (loc) {
case AutoDJSendLoc::TOP:
insertTracksIntoPlaylist(trackIds, iAutoDJPlaylistId, 1);
m_pAutoDJProcessor->playlistFirstTrackChanged();
insertTracksIntoPlaylist(trackIds, iAutoDJPlaylistId, position);
break;
case AutoDJSendLoc::BOTTOM:
appendTracksToPlaylist(trackIds, iAutoDJPlaylistId);
break;
case AutoDJSendLoc::REPLACE:
if (removeTracksFromPlaylist(iAutoDJPlaylistId, 1)) {
if (removeTracksFromPlaylist(iAutoDJPlaylistId, position)) {
appendTracksToPlaylist(trackIds, iAutoDJPlaylistId);
m_pAutoDJProcessor->playlistFirstTrackChanged();
}
break;
}
Expand Down

0 comments on commit 9763555

Please sign in to comment.