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

Part I: Introduction to C++ and Qt 4

C++ Introduction


Introduction to Qt



Inheritance and Polymorphism

Part II: Higher-Level Programming


Introduction to Design Patterns


Generics and Containers

Qt GUI Widgets


Validation and Regular Expressions

Parsing XML

Meta Objects, Properties, and Reflective Programming

More Design Patterns

Models and Views

Qt SQL Classes

Part III: C++ Language Reference

Types and Expressions

Scope and Storage Class

Statements and Control Structures

Memory Access

Chapter Summary

Inheritance in Detail

Miscellaneous Topics

Part IV: Programming Assignments

MP3 Jukebox Assignments

Part V: Appendices

MP3 Jukebox Assignments


MP3 Jukebox Assignments

An Introduction to Design Patterns in C++ with Qt 4
An Introduction to Design Patterns in C++ with Qt 4
ISBN: 0131879057
EAN: 2147483647
Year: 2004
Pages: 268 © 2008-2020.
If you may any questions please contact us: