[ fromfile: homework/sourceselector.xml id: sourceselector ]
Selecting from a variety of different "sources" is what makes a player very powerful and useful. A source could be any of the following:
A playlist
A library of mp3s, stored in a database
A list of online radio stations
Tracks on a CD
A folder of tracks
A subset of the library, filtered on genre, artist or album.
One interesting thing they all have in common is that each can be viewed with a QAbstractItemView.
The SourceSelector
widget, shown docked on the left in Figure
23.3, permits the user to select the currently viewed "source", which in this case, corresponds to a
list of songs.
At any given time, if the user clicks on another "source" in that widget, then the "current playlist" should switch to the chosen one, and the MP3 player should start playing songs from this new playlist next.
By clicking on a source in the selector model, the application should change the currently visible table or list view in the central widget. Figure 23.4 shows one possible way to design the classes that provide a view and a selector of a collection of sources.
At any given time, the user can perform an action, Show Now Playing, that changes the central widget so that it is showing what is currently playing, instead of what was last selected by the user in the source selector.
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |