|
1 /* |
|
2 * Copyright (c) 2009 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 #ifndef HSSNAPLINE_H |
|
19 #define HSSNAPLINE_H |
|
20 |
|
21 #include <QGraphicsLineItem> |
|
22 #include <QPen> |
|
23 #include "hsutils_global.h" |
|
24 |
|
25 #include "hstest_global.h" |
|
26 HOMESCREEN_TEST_CLASS(t_hsUtils) |
|
27 |
|
28 class QLineF; |
|
29 class QPropertyAnimation; |
|
30 |
|
31 class HSUTILS_EXPORT HsSnapLine : public QObject, public QGraphicsLineItem |
|
32 { |
|
33 Q_OBJECT |
|
34 public: |
|
35 HsSnapLine(QGraphicsItem *parent = 0); |
|
36 ~HsSnapLine(); |
|
37 |
|
38 public: |
|
39 void setConfiguration(const QVariantHash &configuration); |
|
40 void hideLine(); |
|
41 void showLine(const QLineF &snapLine); |
|
42 |
|
43 private: |
|
44 Q_DISABLE_COPY(HsSnapLine) |
|
45 void startFadeInAnimation(); |
|
46 bool isFadeInAnimationRunning() const; |
|
47 void stopFadeInAnimation(); |
|
48 void actionOnFadeInAnimationStop(); |
|
49 void startFadeOutAnimation(); |
|
50 bool isFadeOutAnimationRunning() const; |
|
51 void stopFadeOutAnimation(); |
|
52 void actionOnFadeOutAnimationStop(); |
|
53 int getFadeInDuration() { return (mFadeInAnimationDuration - mFadeInAnimationDuration*mOpacity); } |
|
54 int getFadeOutDuration() { return (mFadeOutAnimationDuration*mOpacity); } |
|
55 |
|
56 private slots: |
|
57 void fadeInAnimationFinished(); |
|
58 void fadeOutAnimationFinished(); |
|
59 |
|
60 private: |
|
61 QPropertyAnimation *mFadeInAnimation; |
|
62 QPropertyAnimation *mFadeOutAnimation; |
|
63 qreal mOpacity; |
|
64 int mFadeInAnimationDuration; |
|
65 int mFadeOutAnimationDuration; |
|
66 |
|
67 HOMESCREEN_TEST_FRIEND_CLASS(t_hsUtils) |
|
68 }; |
|
69 |
|
70 #endif |