MP3 Jukebox Assignments

In the assignments in this chapter, we will write, in stages, a program that serves as an MP3 playlist generator and database manager. It will generate and play selections of MP3 songs based on what it can find on our file system and it will permit filter-queries based on data stored in ID3v2 (meta) tag information.

25.1

Data Model: Mp3File

553

25.2

Visitor: Generating Playlists

555

25.3

Preference: An Enumerated Type

556

25.4

Reusing id3lib

559

25.5

PlayListModel Serialization

560

25.6

Testing Mp3File Related Classes

561

25.7

Simple Queries and Filters

561

25.8

Mp3PlayerView

563

25.9

Models and Views: PlayList

565

25.10

Source Selector

566

25.11

Persistent Settings

567

25.12

Edit Form View for FileTagger

568

25.13

Database View

569


The features we will implement are inspired by open-source programs such as amaroK and Juk (and commercial programs such as iTunes and MusicMatch Jukebox). These programs all provide similar features and similar styles of user interface.

The code that does the actual file-tagging is taken from an open-source library, id3lib[1] version 3.8.3. This is the same library that is used by MusicMatch Jukebox.

[1] http://sourceforge.net/projects/id3lib

The media player shown in Figure 25.1 has three major components.

1.

A player view that shows the user what is currently playing and provides some controls for changing volume or position of the song

2.

A selector that permits the user to choose (and create new) playlists for manipulating or playback

3.

A song list view, for displaying a list of songs in a tabular form

Figure 25.1. Example screenshot


Each of these major components has a view for displaying the data and a model for storing the data.

  • The model for a Mp3PlayerView consists of Mp3Player plus a FileTagger.
  • The model for a source selector is a tree, and you can use either QtreeWidgetItem or QAbstractItemModel as the base class for this.
  • To start with, the model for a song list view will be a simple PlayList. Later in the chapter, we will implement another model based on QSqlRelationalTableModel.

Figure 25.2 shows a high-level UML diagram of the major components of this project. We can see that the Controller class, derived from QApplication, owns all other objects.

Figure 25.2. The Controller and its managed objects




Part I: Introduction to C++ and Qt 4

C++ Introduction

Classes

Introduction to Qt

Lists

Functions

Inheritance and Polymorphism

Part II: Higher-Level Programming

Libraries

Introduction to Design Patterns

QObject

Generics and Containers

Qt GUI Widgets

Concurrency

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

Bibliography

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

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net