BeatGraphLabel Class Reference

#include <beatgraph-label.h>

List of all members.

Public Slots

virtual void drawCursor ()
virtual void setImage (QImage I, wunsigned8 samplespercol)

Public Member Functions

 BeatGraphLabel (QWidget *parent, const char *name=0)
void activate ()
void deactivate ()
virtual ~BeatGraphLabel ()

Public Attributes

QTimer timer
unsigned8 samples_per_column_diskrate
bool cues_changed

Protected Member Functions

virtual void paintEvent (QPaintEvent *)
virtual void resizeEvent (QResizeEvent *event)
void drawCueText ()
void moveRuler (int &x1, int &x2, int &x3, int &x4)

Protected Attributes

QImage original
QImage resized
int ruler_x

Detailed Description

The port from Qt3 to Qt4 is a bit tricky here. First: the new painter system does not allow us to draw outside a paint event message, so we need to fake these. Secondly: the double buffering makes the xor operation effectively useless. Third: removing the old line with a small redraw will redraw the entire bitmap regardless. These 3 reasons forced me to redraw the content of the window myself by updating the resized QPixMap. The result is that drawCursor will always update the image in a way that only leaves 1 line on the image. Once the image is updated we either request two paint operations (if the lines are far apart), or 1 merged operation if they are close to each other.


Constructor & Destructor Documentation

BeatGraphLabel::BeatGraphLabel ( QWidget *  parent,
const char *  name = 0 
)

Creates a beatgraph label to be used in BpmPlay.

References cues_changed, drawCursor(), ruler_x, samples_per_column_diskrate, and timer.

BeatGraphLabel::~BeatGraphLabel (  )  [virtual]

References timer.


Member Function Documentation

void BeatGraphLabel::activate (  )  [inline]

Called to start the cursor movements. It will start the timer.

References timer.

void BeatGraphLabel::deactivate (  )  [inline]

Called to stop the cursor movements. It stops the timer.

References timer.

void BeatGraphLabel::drawCueText (  )  [protected]

Will draw the different cues on the resized image

References cue_metarate, cues_metarate, i, metarate_to_diskrate(), original, resized, and samples_per_column_diskrate.

void BeatGraphLabel::drawCursor (  )  [virtual, slot]

will move the ruler with moveruler() and then decide which areas must be repainted. If the old and new ruler were close to each other, one repaint event is scheduler. If not two different repaints are called for.

References moveRuler(), repaint(), and resized.

Referenced by BeatGraphLabel().

void BeatGraphLabel::moveRuler ( int &  x1,
int &  x2,
int &  x3,
int &  x4 
) [protected]

Will move the ruler and report back (through the 4 output parameters) which columns must be redrawn.

References resized, ruler_x, samples_per_column_diskrate, and x_diskrate.

Referenced by drawCursor(), and paintEvent().

void BeatGraphLabel::paintEvent ( QPaintEvent *  e  )  [protected, virtual]

If there is no image set, an empty area is drawn. If the cues changed a total redraw is required, otherwise the required areas are copied from the resized image onto the widget.

References cues_changed, moveRuler(), original, resized, samples_per_column_diskrate, and setImage().

void BeatGraphLabel::resizeEvent ( QResizeEvent *  event  )  [protected, virtual]

When a resize of the widget occur, we recalculate the resized image and redraw the cursor

References cues_changed.

virtual void BeatGraphLabel::setImage ( QImage  I,
wunsigned8  samplespercol 
) [virtual, slot]

once the QPixMap is set it remains the property of the label

Referenced by paintEvent().


Member Data Documentation

QImage BeatGraphLabel::original [protected]

The original image as produced in the beatgraph analyzer is placed here. Depending on the size of the target window, we resize it to something smaller/or larger.

Referenced by drawCueText(), and paintEvent().

QImage BeatGraphLabel::resized [protected]

The resized image which fits the width() and height() of the widget perfectly.

Referenced by drawCueText(), drawCursor(), moveRuler(), and paintEvent().

int BeatGraphLabel::ruler_x [protected]

The current ruler position; expressed in the internal image coordinates

Referenced by BeatGraphLabel(), and moveRuler().

Remembers how many audio samples are in one measure. This makes it possible to calculate the current measure based on the current songposition x

Referenced by BeatGraphLabel(), drawCueText(), moveRuler(), and paintEvent().

The timer used to update the image if necessary. This timer will be connected to the drawCursor slot.

Referenced by activate(), BeatGraphLabel(), deactivate(), and ~BeatGraphLabel().


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by  doxygen 1.6.2