-
Notifications
You must be signed in to change notification settings - Fork 9
Views
All the Babe tables have the following columns: "Track", "Tile", "Artist", "Album", "Genre", "Location", "Stars", "Babe", "Art", "Played", "Playlist"
All tables used to display the collection information are implemented as a BabeTable object which is sub-classing QTableWidget. All the methods are defined in the babetable.h file.
BabeTable provides a fast an easy way to access all the actions to perform in a track, such as: rate it, babe it, send to a phone, remove it, color it etc, and also the necessary signals: enterEvent, leaveEvent, on_tableWidget_doubleClicked, rightClicked... etc.
To populate a BabeTable there are two options:
1- populateTableView(QList<QMap<int,QString>> mapList, bool descriptiveTitle);
*QList<QMap<int,QString>> mapList:
QList<QMap<int,QString>> represents a list of tracks, representing each track as a QMap, where the key is one of the following values defined in the columns Enum: enum columns { TRACK,TITLE,ARTIST,ALBUM,GENRE,LOCATION,STARS,BABE,ART,PLAYED,PLAYLIST,columnsCOUNT }; and the value is the related string.
This is a quick graphic example:
{ {TRACK, "3"}, {TITLE, "Wet Dreams"}, {ARTIST, "J. Cole"}, {ALBUM, "2014 Forest Hill"}, {GENRE, "Hip-Hop"} }
There are also a few ways to get a track information as a QMap or several tracks info as a QList: To get the info from a single track already represented in a BabeTable the following method can be use:
QMap BabeTable::getRowData(int row)
if you need to get the track info from the DataBase you can get it as a QList with the following methods:
1- QList<QMap<int, QString>> getTrackData(QStringList urls); To use this one you must feed it with the urls of the files you want to get the info from.
2- QList<QMap<int, QString>> getTrackData(QString queryText); Use this one when you don't know the url of the file, but instead send a queryText with SQl syntax.
- bool descriptiveTitle: by default the bool descriptiveTitle is set to false, set it to true to get a tooltip in the TITLE column showing the artist name.
2- populateTableView(QString indication, bool descriptiveTitle);
- QString indication: The second way to populate a BabeTable is to use a SQL text query indication, this is useful when you don't have the tracks information represented a a QList
The tracks view displays the whole music collection ordered by default by Artist name in descending order. You can easily modify the order by clicking in the column header to sort the table as wanted.