Writing User Interfaces
Prev
Next

Chapter 3. Writing User Interfaces

Noatun is made unique by its having the user interface itself as a plugin. It was considered nearly impossible to write documentation for such a amorphous application, being that with it are four different user-interfaces. This was one of the design goals.

Writing user interfaces is a ridiculously easy process, which means that you could have your very own custom media player in just a weekend's work!

The two most important components are the NoatunStdAction, and the (church organ playing, and a mystical glow appearing) Player class. The Player class is more than just a class, but the most fantastic thing since sliced media players: it lets you control the player!

class NoatunApp provides the Qt signals hideYourself and showYourself, which ask the user interface show or hide, if applicable (this is used when clicking on Young Hickory.

In addition, libnoatuncontrols also has L33tSlider class which fixes a few problems with the slider in a "change-during-drag" situation. Use it!

The Player Class

There's not much to discuss when it comes to this class. It's just so horribly simple! Get the player with napp->player(), then connect to the signals, call the slots, and have all sorts of other fun.

Functions

An important signal is Player::timeout(). Connect to this, when it is called, you should get the current time, update your sliders and your times. This is to guarantee that all sliders are updated noatun-wide at the same time.

Player::current() is not always non-null, nor is it guaranteed to have been allocated by the current playlist.

As of Noatun 1.2, all functions return milliseconds unless otherwise stated.

Prev
Next
Home