forked from Wobbl/Wobuzz
Fixed some bugs that happened when tracks got rearranged.
This commit is contained in:
parent
b2bd8ef784
commit
519b2d0adb
10 changed files with 72 additions and 17 deletions
|
@ -50,13 +50,18 @@ class PlaylistView(QTreeWidget):
|
|||
track = track_item.track
|
||||
|
||||
track_item.index_user_sort = i
|
||||
track_item.index = i
|
||||
|
||||
track_item.setText(5, str(i + 1))
|
||||
|
||||
self.playlist.tracks[i] = track
|
||||
|
||||
track.set_occurrences()
|
||||
|
||||
i += 1
|
||||
|
||||
self.app.player.cache_next_track()
|
||||
if self.app.player.current_playlist.has_tracks():
|
||||
self.app.player.cache_next_track()
|
||||
|
||||
def dropEvent(self, event: QDropEvent):
|
||||
# receive items that were dropped and create new items from its tracks (new items bc. widgets can only have
|
||||
|
@ -105,9 +110,6 @@ class PlaylistView(QTreeWidget):
|
|||
|
||||
i += 1
|
||||
|
||||
if not self.topLevelItemCount() == 0:
|
||||
self.topLevelItem(0).setIcon(0, self.playing_mark)
|
||||
|
||||
def on_track_activation(self, item, column):
|
||||
if not self.app.player.current_playlist == self.playlist:
|
||||
self.app.player.current_playlist = self.playlist
|
||||
|
@ -117,14 +119,16 @@ class PlaylistView(QTreeWidget):
|
|||
|
||||
def on_track_change(self, previous_track, track):
|
||||
# remove playing mark from first track bc it may not be in the history
|
||||
self.topLevelItem(0).setIcon(0, QIcon(None))
|
||||
#self.topLevelItem(0).setIcon(0, QIcon(None))
|
||||
|
||||
# unmark the previous track and mark the current track as playing
|
||||
if previous_track:
|
||||
previous_track.item.setIcon(0, QIcon(None))
|
||||
for item in previous_track.items:
|
||||
item.setIcon(0, QIcon(None))
|
||||
|
||||
if track:
|
||||
track.item.setIcon(0, self.playing_mark)
|
||||
item = self.topLevelItem(self.app.player.current_playlist.current_track_index)
|
||||
item.setIcon(0, self.playing_mark)
|
||||
|
||||
def append_track(self, track):
|
||||
TrackItem(track, self.topLevelItemCount() - 1, self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue