diff --git a/app/musicmuster.py b/app/musicmuster.py index 9223cf1..46a76ae 100755 --- a/app/musicmuster.py +++ b/app/musicmuster.py @@ -1083,6 +1083,16 @@ class Window(QMainWindow, Ui_MainWindow): else: destination_row = self.active_proxy_model().rowCount() + # If we move a row to immediately under the current track, make + # that moved row the next track + set_next_row: Optional[int] = None + if ( + track_sequence.current + and track_sequence.current.playlist_id == to_playlist_model.playlist_id + and destination_row == track_sequence.current.row_number + 1 + ): + set_next_row = destination_row + if ( to_playlist_model.playlist_id == self.move_source_model.source_model.playlist_id @@ -1095,6 +1105,9 @@ class Window(QMainWindow, Ui_MainWindow): self.active_tab().resize_rows() self.active_tab().clear_selection() + if set_next_row: + to_playlist_model.set_next_row(set_next_row) + def play_next(self, position: Optional[float] = None) -> None: """ Play next track, optionally from passed position. diff --git a/app/playlists.py b/app/playlists.py index 71e2335..c144917 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -296,6 +296,15 @@ class PlaylistTab(QTableView): and 0 <= max(from_rows) <= self.source_model.rowCount() and 0 <= to_model_row <= self.source_model.rowCount() ): + # If we move a row to immediately under the current track, make + # that moved row the next track + set_next_row: Optional[int] = None + if ( + track_sequence.current + and to_model_row == track_sequence.current.row_number + 1 + ): + set_next_row = to_model_row + self.source_model.move_rows(from_rows, to_model_row) # Reset drag mode to allow row selection by dragging @@ -307,6 +316,10 @@ class PlaylistTab(QTableView): # Resize rows self.resize_rows() + # Set next row if we are immediately under current row + if set_next_row: + self.source_model.set_next_row(set_next_row) + event.accept() def mouseReleaseEvent(self, event):