Source Selector
Being able to select 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 database
- A list of online radio stations
- Tracks on a CD
Any of these can be considered an input source. The other interesting thing they all have in common is that they can all be represented by a PlayListModel (a collection of songs).
The SourceSelector widget, shown docked on the left in Figure 25.9, permits the user to select the currently playing "source," which in this case corresponds to a PlayListModel. However, the SourceSelector manages a mapping of models to views, to make switching views easy and fast.
Figure 25.9. Source Selector view
Clicking on one of the sources in the selector tree should change the currently visible table or list view in the central widget. Figure 25.10 shows one possible way of designing the classes that provides a view and a selector of a collection of sources.
Figure 25.10. SourceSelector and related classes
Категории