|
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 HSIDLESTATE_H |
|
19 #define HSIDLESTATE_H |
|
20 |
|
21 #include <QState> |
|
22 #include <QTimer> |
|
23 #include <QPointF> |
|
24 |
|
25 #include "hstest_global.h" |
|
26 HOMESCREEN_TEST_CLASS(HomeScreenStatePluginTest) |
|
27 |
|
28 class QGraphicsItem; |
|
29 class QGraphicsSceneMouseEvent; |
|
30 class HbView; |
|
31 class HbAction; |
|
32 class HsIdleWidget; |
|
33 |
|
34 class HsIdleState : public QState |
|
35 { |
|
36 Q_OBJECT |
|
37 |
|
38 public: |
|
39 HsIdleState(QState *parent = 0); |
|
40 ~HsIdleState(); |
|
41 |
|
42 signals: |
|
43 void event_applicationLibrary(); |
|
44 void event_waitInput(); |
|
45 void event_widgetInteraction(); |
|
46 void event_sceneInteraction(); |
|
47 void event_moveWidget(); |
|
48 void event_moveScene(); |
|
49 void event_sceneMenu(); |
|
50 void event_selectSceneWallpaper(); |
|
51 void event_addPage(); |
|
52 void event_removePage(); |
|
53 void event_toggleConnection(); |
|
54 |
|
55 private: |
|
56 void setupStates(); |
|
57 qreal pageLayerXPos(int pageIndex) const; |
|
58 void startPageChangeAnimation(int targetPageIndex, int duration); |
|
59 bool isInPageChangeZone(); |
|
60 bool isInLeftPageChangeZone(); |
|
61 bool isInRightPageChangeZone(); |
|
62 void addPageToScene(int pageIndex); |
|
63 qreal parallaxFactor() const; |
|
64 |
|
65 private slots: |
|
66 void action_disableUserInteraction(); |
|
67 void action_enableUserInteraction(); |
|
68 void action_idle_setupView(); |
|
69 void action_idle_layoutNewWidgets(); |
|
70 void action_idle_showActivePage(); |
|
71 void action_idle_connectOrientationChangeEventHandler(); |
|
72 void action_idle_cleanupView(); |
|
73 void action_idle_disconnectOrientationChangeEventHandler(); |
|
74 void action_waitInput_updateOptionsMenu(); |
|
75 void action_waitInput_connectMouseEventHandlers(); |
|
76 void action_waitInput_disconnectMouseEventHandlers(); |
|
77 void action_widgetInteraction_connectMouseEventHandlers(); |
|
78 void action_widgetInteraction_connectGestureTimers(); |
|
79 void action_widgetInteraction_disconnectMouseEventHandlers(); |
|
80 void action_widgetInteraction_disconnectGestureTimers(); |
|
81 void action_sceneInteraction_connectMouseEventHandlers(); |
|
82 void action_sceneInteraction_connectGestureTimers(); |
|
83 void action_sceneInteraction_disconnectMouseEventHandlers(); |
|
84 void action_sceneInteraction_disconnectGestureTimers(); |
|
85 void action_moveWidget_reparentToControlLayer(); |
|
86 void action_moveWidget_startWidgetDragAnimation(); |
|
87 void action_moveWidget_connectMouseEventHandlers(); |
|
88 void action_moveWidget_connectGestureTimers(); |
|
89 void action_moveWidget_reparentToPage(); |
|
90 void action_moveWidget_startWidgetDropAnimation(); |
|
91 void action_moveWidget_disconnectMouseEventHandlers(); |
|
92 void action_moveWidget_disconnectGestureTimers(); |
|
93 void action_moveScene_connectMouseEventHandlers(); |
|
94 void action_moveScene_disconnectMouseEventHandlers(); |
|
95 void action_sceneMenu_showMenu(); |
|
96 void action_addPage_addPage(); |
|
97 void action_removePage_removePage(); |
|
98 void action_toggleConnection_toggleConnection(); |
|
99 |
|
100 void waitInput_onMousePressed( |
|
101 QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered); |
|
102 void widgetInteraction_onMouseMoved( |
|
103 QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered); |
|
104 void widgetInteraction_onMouseReleased( |
|
105 QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered); |
|
106 void sceneInteraction_onMouseMoved( |
|
107 QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered); |
|
108 void sceneInteraction_onMouseReleased( |
|
109 QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered); |
|
110 void moveWidget_onMouseMoved( |
|
111 QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered); |
|
112 void moveWidget_onMouseReleased( |
|
113 QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered); |
|
114 void moveScene_onMouseMoved( |
|
115 QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered); |
|
116 void moveScene_onMouseReleased( |
|
117 QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered); |
|
118 |
|
119 void onOrientationChanged(Qt::Orientation orientation); |
|
120 |
|
121 void widgetInteraction_onTapAndHoldTimeout(); |
|
122 void sceneInteraction_onTapAndHoldTimeout(); |
|
123 void moveWidget_onHoldTimeout(); |
|
124 |
|
125 #ifndef Q_OS_SYMBIAN |
|
126 void switchLanguage(); |
|
127 void translateUi(); |
|
128 #endif |
|
129 |
|
130 private: |
|
131 HbView *mView; |
|
132 HbAction *mSoftKeyAction; |
|
133 HsIdleWidget *mUiWidget; |
|
134 |
|
135 QTimer mTimer; |
|
136 qreal mTapAndHoldDistance; |
|
137 qreal mPageChangeZoneWidth; |
|
138 |
|
139 QPointF mSceneMenuPos; |
|
140 |
|
141 HOMESCREEN_TEST_FRIEND_CLASS(HomeScreenStatePluginTest) |
|
142 }; |
|
143 |
|
144 #endif // HSIDLESTATE_H |