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 "attentionanimator.h" |
|
20 #include <QTimeLine> |
|
21 // NB: These go away when plugins are implemented |
|
22 #include "animations/bounceanimator.h" |
|
23 #include "animations/pulseanimator.h" |
|
24 |
|
25 AttentionAnimator::~AttentionAnimator(){ |
|
26 delete m_timeLine; |
|
27 } |
|
28 |
|
29 //NB: Replace implementation with hash table populated by plugin discovery |
|
30 |
|
31 AttentionAnimator * AttentionAnimator:: create(const QString & name, ChromeSnippet* snippet){ |
|
32 if(name.compare("G_ATTENTION_BOUNCE_ANIMATOR") == 0){ |
|
33 return new BounceAnimator(snippet); |
|
34 } |
|
35 if(name.compare("G_ATTENTION_PULSE_ANIMATOR") == 0){ |
|
36 return new PulseAnimator(snippet); |
|
37 } |
|
38 return 0; |
|
39 } |
|
40 |
|
41 |
|
42 void AttentionAnimator::toggleActive(){ |
|
43 if(!m_timeLine) { |
|
44 m_timeLine = new QTimeLine(1000); //Default to 1 sec |
|
45 m_timeLine->setLoopCount(3); |
|
46 m_timeLine->setCurveShape(QTimeLine::SineCurve); |
|
47 connect(m_timeLine, SIGNAL(valueChanged(qreal)), |
|
48 this, SLOT(updateAttention(qreal))); |
|
49 } |
|
50 |
|
51 m_timeLine->start(); |
|
52 /* |
|
53 if(m_active) { |
|
54 m_active = false; |
|
55 m_timeLine->stop(); |
|
56 } |
|
57 else { |
|
58 m_active = true; |
|
59 m_timeLine->start(); |
|
60 }*/ |
|
61 } |
|