floatingClouds Class Reference

Implements floating clouds background animation. More...

#include <floatingclouds.h>

Inheritance diagram for floatingClouds:

AnimationEngineAPI

List of all members.

Signals

void sigUpdateGraphics ()
 signaled when thread has finished calculation of new locations of clouds.

Public Member Functions

void startAnimation (QGraphicsScene *targetGraphicsScene)
 Start playing animation.
void startAnimationPreview (QGraphicsScene *targetGraphicsScene)
 Start playing animation in preview mode.
void stopAndCleanUp ()
 Stop the animation and do clean up.
QString getAnimationName ()
 Get name of the animation.
QString getAnimationBg ()
 Get full path to animations own background picture (QString::null if there isn't any).

Protected Member Functions

void run ()
 main event loop of the animation thread.

Private Slots

void updateGraphics ()
 Moves cloud items to new locations in graphics scene.

Private Attributes

QPixmap * iCloudPixmap
 Pixmap of cloud.
QGraphicsPixmapItem * iCloud [CLOUD_AMMOUNT]
 Pixmap items used in animation.
float iCloudXLocation [CLOUD_AMMOUNT]
 Array for storing current cloud locations.
float iCloudSpeed [CLOUD_AMMOUNT]
 Array for storing cloud speeds.
QGraphicsScene * iTargetScene
 Holds pointer to scene to which to draw the clouds.
QMutex iRunningMux
 Animation will stop if unlocked. Used by void floatingClouds::stopAndCleanUp().
QMutex iCloudLocationMux
 Mutex to protect iCloudXLocation[CLOUD_AMMOUNT].


Detailed Description

Implements floating clouds background animation.

Member Function Documentation

QString floatingClouds::getAnimationBg (  )  [virtual]

Get full path to animations own background picture (QString::null if there isn't any).

Implement to return the full path and file name of picture that should be used as a background for the animation. If there is no background picture, return QString::null and the animation will use the picture that is set as background by user from background picture dialog.

Returns:
Full path and filename of background picture of the animation. QString::null if there isn't any.

Implements AnimationEngineAPI.

QString floatingClouds::getAnimationName (  )  [virtual]

Get name of the animation.

Implement to return the name of the animation that can be used in the list of animations. This is the name the user will see when selecting background animation from the background animations dialog.

Returns:
Name of animation

Implements AnimationEngineAPI.

void floatingClouds::run (  )  [protected]

main event loop of the animation thread.

Calculates new locations for clouds and emits sigUpdateGraphics() when done about once every 50 ms.

void floatingClouds::sigUpdateGraphics (  )  [signal]

signaled when thread has finished calculation of new locations of clouds.

Signal indicating that clouds have been moved. Emitted by main event loop of animation thread implemented in run(). Connected to updateGraphics()

void floatingClouds::startAnimation ( QGraphicsScene *  targetGraphicsScene  )  [virtual]

Start playing animation.

Initiate and start floating clouds animation

  • Load cloud picture, create pixmap and add some clouds to targetGraphicsScene.
  • Choose speeds and initial locations of clouds by random
  • Call QThread::Start() to start the animation.

Implements AnimationEngineAPI.

void floatingClouds::startAnimationPreview ( QGraphicsScene *  targetGraphicsScene  )  [virtual]

Start playing animation in preview mode.

Initiate and start floatting clouds animation in preview mode

  • Load cloud picture, create pixmap and add some small clouds to targetGraphicsScene.
  • Call QThread::Start() to start the animation.

Reimplemented from AnimationEngineAPI.

void floatingClouds::stopAndCleanUp (  )  [virtual]

Stop the animation and do clean up.

Remove clouds from graphics scene, delete pixmaps and stop thread

Implements AnimationEngineAPI.

void floatingClouds::updateGraphics (  )  [private, slot]

Moves cloud items to new locations in graphics scene.

Moves clouds stored in iCloud[CLOUD_AMMOUNT] vector to locations pointed by iCloudXLocation[CLOUD_AMMOUNT]. Initiated by signal sigUpdateGraphics().


The documentation for this class was generated from the following files:

Generated on Thu Mar 3 17:42:04 2011 for Xiaoning's Diary by  doxygen 1.5.9