equal
deleted
inserted
replaced
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "pulseanimator.h" |
|
20 #include "../chromesnippet.h" |
|
21 #include "QTransform" |
|
22 |
|
23 PulseAnimator::PulseAnimator(ChromeSnippet* m_snippet) |
|
24 : AttentionAnimator(m_snippet) |
|
25 { |
|
26 m_timeLine = new QTimeLine(1500); //Default to 1 sec |
|
27 m_timeLine->setLoopCount(5); |
|
28 m_timeLine->setCurveShape(QTimeLine::SineCurve); |
|
29 connect(m_timeLine, SIGNAL(valueChanged(qreal)), |
|
30 this, SLOT(updateAttention(qreal))); |
|
31 |
|
32 } |
|
33 |
|
34 PulseAnimator::~PulseAnimator() |
|
35 { |
|
36 } |
|
37 |
|
38 void PulseAnimator::updateAttention(qreal step) |
|
39 { |
|
40 #ifdef Q_OS_SYMBIAN |
|
41 if(step < 0.1) step = 1.0; |
|
42 m_snippet->setOpacity(step); |
|
43 #else |
|
44 QTransform t, m, b; |
|
45 step = step/2+ 0.5; |
|
46 if(step < 0.55) step = 1.0; |
|
47 m.translate(18,18); |
|
48 t.scale(step, step); |
|
49 b.translate(-18,-18); |
|
50 m_snippet->setTransform(b*t*m); |
|
51 #endif |
|
52 } |
|