![]() |
Home · All Namespaces · All Classes |
a view class for the status indicator widgets. More...
#include <statusindicatoranimationview.h>


Public Member Functions | |
| StatusIndicatorAnimationView (StatusIndicator *controller) | |
| Constructs a new StatusIndicatorAnimationView. | |
| virtual | ~StatusIndicatorAnimationView () |
| Destroys the StatusIndicatorAnimationView. | |
| QSizeF | sizeHint (Qt::SizeHint which, const QSizeF &constraint) const |
| REIMPLEMENTATION | |
Protected Slots | |
| virtual void | updateData (const QList< const char * > &modifications) |
| | |
| virtual void | startAnimation () |
| | |
| virtual void | stopAnimation () |
| A slot for stopping the animation. | |
| void | setAnimationFrame (int frame) |
| A slot for setting the animation frame. | |
Protected Member Functions | |
| virtual void | drawContents (QPainter *painter, const QStyleOptionGraphicsItem *option) const |
| REIMPLEMENTATION | |
| virtual void | setupModel () |
| virtual void | applyStyle () |
| void | setupAnimationTimeline () |
| | |
| void | setFirstAnimationFrame (int frame) |
| void | clearImageList () |
| void | setupImageList (const QString &iconIDs) |
Protected Attributes | |
| StatusIndicator * | controller |
| The controller for this view. | |
| QStringList | imageList |
| The list of names of the images to be shown. | |
| QVector< const QPixmap * > | images |
| A vector of images to be shown. | |
| int | animationFrame |
| The current animation frame. | |
| int | firstAnimationFrame |
| The animation frame from which the animation starts. | |
| QTimeLine * | animationTimeline |
| Timeline for the animation. | |
a view class for the status indicator widgets.
Definition at line 35 of file statusindicatoranimationview.h.
| StatusIndicatorAnimationView::StatusIndicatorAnimationView | ( | StatusIndicator * | controller | ) |
Constructs a new StatusIndicatorAnimationView.
| controller | The view's controller |
Definition at line 27 of file statusindicatoranimationview.cpp.
00027 : 00028 MWidgetView(controller), 00029 controller(controller), 00030 animationFrame(0), 00031 firstAnimationFrame(0), 00032 animationTimeline(new QTimeLine(0, this)) 00033 { 00034 animationTimeline->setCurveShape(QTimeLine::LinearCurve); 00035 animationTimeline->setLoopCount(0); 00036 connect(animationTimeline, SIGNAL(frameChanged(int)), this, SLOT(setAnimationFrame(int))); 00037 }

| StatusIndicatorAnimationView::~StatusIndicatorAnimationView | ( | ) | [virtual] |
Destroys the StatusIndicatorAnimationView.
Definition at line 39 of file statusindicatoranimationview.cpp.
00040 { 00041 clearImageList(); 00042 }

| void StatusIndicatorAnimationView::applyStyle | ( | ) | [protected, virtual] |
Reimplemented in StatusIndicatorIconView.
Definition at line 75 of file statusindicatoranimationview.cpp.
00076 { 00077 MWidgetView::applyStyle(); 00078 00079 setupAnimationTimeline(); 00080 controller->update(); 00081 }

| void StatusIndicatorAnimationView::clearImageList | ( | ) | [protected] |
Clears the images list
Definition at line 131 of file statusindicatoranimationview.cpp.
00132 { 00133 for (int i = 0; i < images.size(); i++) { 00134 delete images[i]; 00135 } 00136 00137 imageList.clear(); 00138 images.clear(); 00139 00140 animationFrame = 0; 00141 }
| void StatusIndicatorAnimationView::drawContents | ( | QPainter * | painter, | |
| const QStyleOptionGraphicsItem * | option | |||
| ) | const [protected, virtual] |
REIMPLEMENTATION
Definition at line 120 of file statusindicatoranimationview.cpp.
00121 { 00122 if (animationFrame < images.size() && size().width() > 0 && size().height() > 0) { 00123 if (images[animationFrame] != NULL) { 00124 // Paint the image 00125 QRect target(QRect(QPoint(0, 0), size().toSize())); 00126 painter->drawPixmap(target, *images[animationFrame]); 00127 } 00128 } 00129 }
| void StatusIndicatorAnimationView::setAnimationFrame | ( | int | frame | ) | [protected, slot] |
A slot for setting the animation frame.
| frame | the animation frame to show |
Definition at line 96 of file statusindicatoranimationview.cpp.
00097 { 00098 frame = qBound(0, frame, images.size() - 1); 00099 00100 animationFrame = frame; 00101 loadCurrentFrame(); 00102 resizeToCurrentFrameIfNeeded(); 00103 controller->update(); 00104 }
| void StatusIndicatorAnimationView::setFirstAnimationFrame | ( | int | frame | ) | [protected] |
Sets the first frame for the animation
| frame | the animation frame from which the animation starts |
Definition at line 90 of file statusindicatoranimationview.cpp.
00091 { 00092 firstAnimationFrame = qBound(0, frame, images.size() - 1); 00093 setupAnimationTimeline(); 00094 }

| void StatusIndicatorAnimationView::setupAnimationTimeline | ( | ) | [protected] |
Sets up the animation timeline
Definition at line 83 of file statusindicatoranimationview.cpp.
00084 { 00085 animationTimeline->setDuration(style()->animationDuration()); 00086 animationTimeline->setFrameRange(firstAnimationFrame, images.size()); 00087 animationTimeline->setUpdateInterval(style()->animationDuration() / (images.size() > 0 ? (images.size() - firstAnimationFrame) : 1)); 00088 }
| void StatusIndicatorAnimationView::setupImageList | ( | const QString & | iconIDs | ) | [protected] |
Sets up the images list from an icon ID string
| iconIDs | a list of icon IDs to create the image list from |
Definition at line 143 of file statusindicatoranimationview.cpp.
00144 { 00145 clearImageList(); 00146 00147 if (!iconIDs.isEmpty()) { 00148 // Use the "icon exists" style 00149 style().setModeIcon(); 00150 00151 // Create an icon list 00152 imageList = iconIDs.trimmed().split(QChar(' ')); 00153 images = QVector<const QPixmap *>(imageList.length(), NULL); 00154 } else { 00155 // Use the "no icon" (default) style 00156 style().setModeDefault(); 00157 } 00158 00159 // Redraw 00160 controller->updateGeometry(); 00161 controller->update(); 00162 }

| void StatusIndicatorAnimationView::setupModel | ( | ) | [protected, virtual] |
Definition at line 44 of file statusindicatoranimationview.cpp.
00045 { 00046 MWidgetView::setupModel(); 00047 00048 QList<const char *> modifications; 00049 modifications << StatusIndicatorModel::Value; 00050 modifications << StatusIndicatorModel::Animate; 00051 updateData(modifications); 00052 }

| QSizeF StatusIndicatorAnimationView::sizeHint | ( | Qt::SizeHint | which, | |
| const QSizeF & | constraint | |||
| ) | const |
REIMPLEMENTATION
Definition at line 189 of file statusindicatoranimationview.cpp.
00190 { 00191 QSizeF size; 00192 if (style()->useIconSize() && animationFrame < images.size() && images[animationFrame] != NULL) { 00193 size = images[animationFrame]->size(); 00194 } else { 00195 size = MWidgetView::sizeHint(which, constraint); 00196 } 00197 return size; 00198 }
| void StatusIndicatorAnimationView::startAnimation | ( | ) | [protected, virtual, slot] |
A slot for starting the animation
Definition at line 106 of file statusindicatoranimationview.cpp.
00107 { 00108 if (animationTimeline->state() == QTimeLine::NotRunning) { 00109 animationTimeline->start(); 00110 } 00111 }
| void StatusIndicatorAnimationView::stopAnimation | ( | ) | [protected, virtual, slot] |
A slot for stopping the animation.
Definition at line 113 of file statusindicatoranimationview.cpp.
00114 { 00115 if (animationTimeline->state() == QTimeLine::Running) { 00116 animationTimeline->stop(); 00117 } 00118 }
| void StatusIndicatorAnimationView::updateData | ( | const QList< const char * > & | modifications | ) | [protected, virtual, slot] |
REIMPLEMENTATION
Reimplemented in StatusIndicatorIconView.
Definition at line 54 of file statusindicatoranimationview.cpp.
00055 { 00056 MWidgetView::updateData(modifications); 00057 const char *member; 00058 foreach(member, modifications) { 00059 if (member == StatusIndicatorModel::Value) { 00060 if (model()->value().type() == QVariant::String) { 00061 setupImageList(model()->value().toString()); 00062 setAnimationFrame(firstAnimationFrame); 00063 setupAnimationTimeline(); 00064 } 00065 } else if (member == StatusIndicatorModel::Animate) { 00066 if (model()->animate()) { 00067 startAnimation(); 00068 } else { 00069 stopAnimation(); 00070 } 00071 } 00072 } 00073 }

int StatusIndicatorAnimationView::animationFrame [protected] |
The current animation frame.
Definition at line 120 of file statusindicatoranimationview.h.
QTimeLine* StatusIndicatorAnimationView::animationTimeline [protected] |
Timeline for the animation.
Definition at line 126 of file statusindicatoranimationview.h.
StatusIndicator* StatusIndicatorAnimationView::controller [protected] |
The controller for this view.
Definition at line 111 of file statusindicatoranimationview.h.
int StatusIndicatorAnimationView::firstAnimationFrame [protected] |
The animation frame from which the animation starts.
Definition at line 123 of file statusindicatoranimationview.h.
QStringList StatusIndicatorAnimationView::imageList [protected] |
The list of names of the images to be shown.
Definition at line 114 of file statusindicatoranimationview.h.
QVector<const QPixmap *> StatusIndicatorAnimationView::images [mutable, protected] |
A vector of images to be shown.
Definition at line 117 of file statusindicatoranimationview.h.
| Copyright © 2010 Nokia Corporation | Generated on Wed Nov 10 16:05:12 2010 Doxygen 1.6.1 |
MeeGo Touch |