The API changed for rotations, requiring another argument for positions.
[contacts_plasmoid.git] / pulser.h
blob8e65b97365bd1b9b590538ec1224eebcbe7fc0b6
1 /*********************************************************************/
2 /* */
3 /* Copyright (C) 2009 Adenilson Cavalcanti <> */
4 /* */
5 /* This program is free software; you can redistribute it and/or */
6 /* modify it under the terms of the GNU General Public License */
7 /* as published by the Free Software Foundation; either version 2 */
8 /* of the License, or (at your option) any later version. */
9 /* */
10 /* This program is distributed in the hope that it will be useful, */
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
13 /* GNU General Public License for more details. */
14 /* */
15 /* You should have received a copy of the GNU General Public License */
16 /* along with this program; if not, write to the Free Software */
17 /* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA */
18 /* 02110-1301, USA. */
19 /*********************************************************************/
21 #ifndef PULSER_H
22 #define PULSER_H
24 #include <QObject>
25 #include <QGraphicsWidget>
27 class QAbstractAnimation;
28 class QEvent;
29 class ProxyOpacitySetter;
30 class AItem;
31 class QPropertyAnimation;
33 class PulseBase: public QObject
35 Q_OBJECT
37 public:
38 PulseBase() { };
40 void updateGeometry(QRectF updated, qreal zCoordinate = 0, qreal scale = 1.5);
42 QRectF geometry();
44 ~PulseBase();
46 public Q_SLOTS:
47 void start();
48 void resetPulser();
50 protected:
52 void createAnimation(qreal _duration, qreal _scale,
53 ProxyOpacitySetter *_setter);
54 QAbstractAnimation *animation;
55 QGraphicsWidget *under;
56 QRectF *pulseGeometry;
57 qreal zvalue, mscale;
58 QPropertyAnimation *anim1, *anim2, *anim3;
61 template <typename TYPE>
62 class Pulser: public PulseBase
65 public:
67 Pulser( TYPE *target, qreal scale = 1.5, qreal duration = 500,
68 ProxyOpacitySetter *setter = 0 )
70 under = new TYPE( *target );
71 under->setParentItem( target );
72 zvalue = target->zValue();
73 --zvalue;
74 under->setOpacity( 0 );
75 under->setZValue( zvalue );
76 mscale = under->scale();
77 createAnimation(duration, scale, setter);
82 #endif