Added playing mark to tabs of currently playing playlist.

This commit is contained in:
The Wobbler 2025-01-27 14:30:45 +01:00
parent f77bba0818
commit 042c253d2f

View file

@ -121,8 +121,17 @@ class PlaylistView(QTreeWidget):
self.app.player.play_track_in_playlist(index)
def on_track_change(self, previous_track, track):
# unmark the previous track and mark the current track as playing
# unmark the previous track and playlist and mark the current track and playlist as playing
playlist_tabs = self.parent().parent()
index = playlist_tabs.indexOf(self) # tab index of this playlist
if previous_track:
# unmark all playlists by looping through the tabs
for i in range(playlist_tabs.count()):
playlist_tabs.setTabIcon(i, QIcon(None))
# unmark the previous track in all playlists
for item in previous_track.items:
item.setIcon(0, QIcon(None))
item.setFont(1, self.normal_font)
@ -130,6 +139,9 @@ class PlaylistView(QTreeWidget):
item.setFont(3, self.normal_font)
if track:
playlist_tabs.setTabIcon(index, self.playing_mark) # mark this playlist
# mark the current track in this playlist
item = self.topLevelItem(self.app.player.current_playlist.current_track_index)
item.setIcon(0, self.playing_mark)
item.setFont(1, self.bold_font)