#include <itissnowing.h>
Signals | |
void | sigUpdateGraphics () |
signaled when thread has finished calculation of new locations of snow flakes. | |
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 snowflake items to new locations in graphics scene. | |
Private Attributes | |
QPixmap * | iSnowFlakePixmap |
Holds pixmap for snowflake. | |
QGraphicsPixmapItem * | iSnowFlake [SNOW_AMMOUNT] |
Array of graphics items for snowflakes created from QPixmap* ItIsSnowing::iSnowFlakePixmap. | |
float | iSnowflakeXOffsets [SNOW_AMMOUNT] |
Array of x-offsets for snowflakes (How far from the left edge of the window the snowflake is falling). | |
float | iSnowflakeFallSpeeds [SNOW_AMMOUNT] |
Array of falling speeds for snowflakes. Is selected by random at the beginning of animation for each snow flake. | |
float | iSnowflakeYLocations [SNOW_AMMOUNT] |
Current y-location of each snow flake. | |
float | iSnowflakeXLocations [SNOW_AMMOUNT] |
Current x-location of each snow flake. | |
QGraphicsScene * | iTargetScene |
Holds pointer to scene to which to draw the snow flakes. | |
QMutex | iRunningMux |
Animation will stop if unlocked. Used by void ItIsSnowing::stopAndCleanUp(). | |
QMutex | iSnowflakeLocationMux |
Mutex to protect float ItIsSnowing::iSnowflakeXLocations and float ItIsSnowing::iSnowflakeYLocations. |
QString ItIsSnowing::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 ItIsSnowing::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 ItIsSnowing::run | ( | ) | [protected] |
main event loop of the animation thread.
Calculates new locations for snowflakes and emits sigUpdateGraphics() when done about once every 150 ms.
void ItIsSnowing::sigUpdateGraphics | ( | ) | [signal] |
signaled when thread has finished calculation of new locations of snow flakes.
Signal indicating that snowflakes have been moved. Emitted by main event loop of animation thread implemented in run(). Connected to updateGraphics()
void ItIsSnowing::startAnimation | ( | QGraphicsScene * | targetGraphicsScene | ) | [virtual] |
Start playing animation.
Initiate and start snowing animation
Implements AnimationEngineAPI.
void ItIsSnowing::startAnimationPreview | ( | QGraphicsScene * | targetGraphicsScene | ) | [virtual] |
Start playing animation in preview mode.
Initiate and start snowing animation in preview mode
Reimplemented from AnimationEngineAPI.
void ItIsSnowing::stopAndCleanUp | ( | ) | [virtual] |
Stop the animation and do clean up.
Remove snowFlakes from graphics scene, delete pixmaps and stop thread
Implements AnimationEngineAPI.
void ItIsSnowing::updateGraphics | ( | ) | [private, slot] |
Moves snowflake items to new locations in graphics scene.
Moves snowflakes stored in iSnowFlake[] vector to locations pointed by iSnowflakeYLocations and iSnowflakeXLocations. Initiated by signal sigUpdateGraphics().