#include <floatingclouds.h>
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]. |
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.
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.
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
Implements AnimationEngineAPI.
void floatingClouds::startAnimationPreview | ( | QGraphicsScene * | targetGraphicsScene | ) | [virtual] |
Start playing animation in preview mode.
Initiate and start floatting clouds animation in preview mode
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().