Highlight crates/playlists that a track is in

Bug #1380467 reported by naught101 on 2014-10-13
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Mixxx
Wishlist
-MK-

Bug Description

It would be good to be able to see which playlists/crates a track is in. So, if you have a track selected in the library, all of the visible crates/playlists/hisotories that it is in have a different background colour or similar.

Zotero does a similar thing with citations - if you select a citation, and hold 'alt', the collections that contain it are highlighted.

Not sure how this should work with tracks in decks, but perhaps the playlists/crates could be highlighted if the deck is moused-over?

Max Linke (max-linke) on 2014-11-07
Changed in mixxx:
importance: Undecided → Wishlist
status: New → Confirmed
tags: added: library
-MK- (mk42) wrote :

I would like to work on this - if it isn't too complicated.
I'm new to mixxx development and have little experience with QT.

Any hints on how to implement this?

-MK- (mk42) wrote :

What I got so far:

I can use sql to get the crates a specific trackId is in:
Select crate_id from crate_tracks where track_id = [track_id]

I think highlighting itself can only be done by TreeItemModel::data.
That means the TreeItemModel needs to know the Items which need to be highlighted. The data_path of the TreeItems stores the crate_id for crates so it would be sufficient to store some "QList<QString> highlightItemsDataPath" in TreeItemModel.

What I need:
1) some signal on selection change in the library-Table-View which gives the selected crateIds as QList<QString> or sth.
2) a new member highlightItemsDataPath in TreeItemModel which is a QList<QString> and stores the data_path's of TreeItems to be highlighted
3) a condition in TreeItemModel::data for role = QBackgroundRole to change the background (or something else) for the TreeItems with data_path in highlightItemsDataPath
4) a slot in TreeItemModel to set highlightItemsDataPath
5) some way to connect the signal of selection change (1) to the slot(4)

-MK- (mk42) wrote :

Actually it would be better to also highlight playlists in which the selected track is included. So maybe that way:

1) some signal on selection change in the library-Table-View which gives the selected trackId
2) a new member highlightTrackId in TreeItemModel which stores the id of the track to be highlighted
3) a condition in TreeItemModel::data for role = QBackgroundRole to change the background (or something else) for the TreeItems whose child-models contain highlightTrackId
4) a slot in TreeItemModel to set highlightTrackId
5) some way to connect the signal of selection change (1) to the slot(4)

-MK- (mk42) wrote :

The libraryFeature has a signal trackSelected that could be used.

The TreeItem is aware of it's feature, so we could use

TreeItemModel::data for role = QBackgroundRole
to ask for the items 'highlightState' which would itself ask his feature if it should highlight. But the problem is, if I return Qt::red for role == QBackgroundRole, nothing happens. So the Background color isn't respected. I need another way to highlight those Items

-MK- (mk42) wrote :
Changed in mixxx:
assignee: nobody → -MK- (mk42)
-MK- (mk42) wrote :
Changed in mixxx:
status: Confirmed → Fix Committed
naught101 (naught101) wrote :

Thanks heaps for this MK - it's very useful.

However, at the moment (with the Latenight skin at least), crate names are just bolded, and that's not very easy to notice, unless you're really looking for it. It would be much better if the crate's background was highlighted, perhaps in a similar way to when the mouse hovers over it (maybe a different colour though). I don't know if this is a problem with the skin itself, or this fix in particular. There may be other ways - even bold-italic would be good.

Daniel Schürmann (daschuer) wrote :

Hi naught101,
would you mind to file a new bug, since this one is already "Fix Committed".
Thank you.

Changed in mixxx:
milestone: none → 2.1
Changed in mixxx:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers