|
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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef GLXVIEWMANAGER_H |
|
21 #define GLXVIEWMANAGER_H |
|
22 |
|
23 #include <QObject> |
|
24 #include <QList> |
|
25 #include <hbeffect.h> |
|
26 #include "glxuistd.h" |
|
27 #include <QModelIndex> |
|
28 |
|
29 class GlxView; |
|
30 class HbMainWindow; |
|
31 class QAbstractItemModel; |
|
32 class HbAction; |
|
33 class GlxMenuManager; |
|
34 class HbToolBar; |
|
35 class HbAction; |
|
36 class QItemSelectionModel; |
|
37 class HbMenu; |
|
38 class GlxEffectEngine; |
|
39 class HbProgressDialog; |
|
40 class GlxMainWindowEventFilter; |
|
41 |
|
42 #ifdef BUILD_VIEWMANAGER |
|
43 #define GLX_VIEWMANAGER_EXPORT Q_DECL_EXPORT |
|
44 #else |
|
45 #define GLX_VIEWMANAGER_EXPORT Q_DECL_IMPORT |
|
46 #endif |
|
47 |
|
48 typedef enum |
|
49 { |
|
50 NO_ACTION_ID = 0x00, |
|
51 GLX_ALL_ACTION_ID = 0x01, |
|
52 GLX_ALBUM_ACTION_ID = 0x02, |
|
53 GLX_CAMERA_ACTION_ID = 0x04, |
|
54 GLX_OVI_ACTION_ID = 0x08, |
|
55 GLX_ALL_ID = 0xFF |
|
56 } glxToolBarActionIds; |
|
57 |
|
58 /** |
|
59 * view manager class |
|
60 */ |
|
61 class GLX_VIEWMANAGER_EXPORT GlxViewManager : public QObject |
|
62 { |
|
63 Q_OBJECT |
|
64 |
|
65 public : |
|
66 /** |
|
67 * Constructor |
|
68 */ |
|
69 GlxViewManager(); |
|
70 /** |
|
71 * Destructor |
|
72 */ |
|
73 ~GlxViewManager(); |
|
74 |
|
75 void setupItems( ); |
|
76 |
|
77 /** |
|
78 * launch application |
|
79 * @param id viewId |
|
80 * @param model model to be used for the view |
|
81 */ |
|
82 void launchApplication(qint32 id, QAbstractItemModel *model); |
|
83 |
|
84 /** |
|
85 * add back key action |
|
86 */ |
|
87 void addBackSoftKeyAction(); |
|
88 |
|
89 /** |
|
90 * This will return the orientation of main window |
|
91 */ |
|
92 Qt::Orientation orientation() const; |
|
93 |
|
94 /** |
|
95 * This will deactivate the current function |
|
96 * to be used only in cases where External launch was done |
|
97 */ |
|
98 void deactivateCurrentView(); |
|
99 |
|
100 /** |
|
101 * To update the tool bar enable and disable icon |
|
102 * id = This should be selected toolbar tab id |
|
103 */ |
|
104 void updateToolBarIcon(int id); |
|
105 |
|
106 /** |
|
107 * Enable the marking mode of the view to select multiple item |
|
108 */ |
|
109 void enterMarkingMode(qint32 viewId); |
|
110 |
|
111 /** |
|
112 * Enable the normal mode of the view |
|
113 */ |
|
114 void exitMarkingMode(qint32 viewId); |
|
115 |
|
116 /** |
|
117 * Pass the user action to the view |
|
118 */ |
|
119 void handleUserAction(qint32 viewId, qint32 commandId); |
|
120 |
|
121 /** |
|
122 * Return the selection model to the user |
|
123 */ |
|
124 QItemSelectionModel * getSelectionModel(qint32 viewId); |
|
125 |
|
126 /** |
|
127 * To set the model of current view |
|
128 */ |
|
129 void setModel( QAbstractItemModel *model ); |
|
130 |
|
131 signals : |
|
132 /** |
|
133 * emit the user action |
|
134 */ |
|
135 void actionTriggered(qint32 id); |
|
136 void externalCommand(int cmdId); |
|
137 |
|
138 public slots: |
|
139 /** |
|
140 * This public slot is used to launch the view |
|
141 */ |
|
142 void launchView (qint32 id, QAbstractItemModel *model); |
|
143 |
|
144 /** |
|
145 * It is over load slot and used to run the animation for view transition and launch the view |
|
146 */ |
|
147 void launchView (qint32 id, QAbstractItemModel *model, GlxEffect effect, GlxViewEffect viewEffect); |
|
148 |
|
149 void launchProgressDialog( int maxValue ); |
|
150 void updateProgressDialog( int currentValue); |
|
151 |
|
152 /** |
|
153 * It will removed and deleted the view. |
|
154 * Currently It is not used so may be in future, It will be removed. |
|
155 */ |
|
156 void destroyView (qint32 id); |
|
157 |
|
158 /** |
|
159 * It will pass the user action to the state manager |
|
160 */ |
|
161 void actionProcess(qint32 id); |
|
162 |
|
163 /** |
|
164 * It will pass the user selected menu action to state manager |
|
165 * check for depricated with actionProcess api |
|
166 */ |
|
167 void handleMenuAction(qint32 commandId); |
|
168 |
|
169 /** |
|
170 * It will pass the user action ( tool bar + back ) to state manager |
|
171 */ |
|
172 void handleAction(); |
|
173 void cancelTimer(); |
|
174 |
|
175 /** |
|
176 * This is slot used for the animation finished call back |
|
177 */ |
|
178 void effectFinished( ); |
|
179 |
|
180 /** |
|
181 * This will open the item specifc Menu |
|
182 */ |
|
183 void itemSpecificMenuTriggered(qint32,QPointF ); |
|
184 |
|
185 void handleReadyView(); |
|
186 |
|
187 private slots: |
|
188 |
|
189 void checkMarked(); |
|
190 void hideProgressDialog(); |
|
191 |
|
192 private: |
|
193 /** |
|
194 * It will create and return the view |
|
195 */ |
|
196 GlxView * resolveView (qint32 id); |
|
197 |
|
198 /** |
|
199 * It will find a view from the view list and return it |
|
200 */ |
|
201 GlxView * findView (qint32 id); |
|
202 |
|
203 /** |
|
204 * It will deativate the current view |
|
205 */ |
|
206 void deActivateView(); |
|
207 |
|
208 /** |
|
209 * It will activate and show the view |
|
210 */ |
|
211 void activateView(); |
|
212 |
|
213 /** |
|
214 * It will create the grid and list view tool bar action |
|
215 */ |
|
216 void createActions(); |
|
217 |
|
218 /** |
|
219 * It will create the marking mode toll bar action |
|
220 */ |
|
221 void createMarkingModeActions(); |
|
222 |
|
223 /** |
|
224 * It will create the grid and list view tool bar |
|
225 */ |
|
226 void createToolBar(); |
|
227 |
|
228 /** |
|
229 * It will create the marking mode tool bar |
|
230 */ |
|
231 void createMarkingModeToolBar(); |
|
232 |
|
233 /** |
|
234 * It will add all the view manager related connection |
|
235 */ |
|
236 void addConnection(); |
|
237 |
|
238 /** |
|
239 * It will remove all the view manager releted connection |
|
240 */ |
|
241 void removeConnection(); |
|
242 |
|
243 /** |
|
244 * |
|
245 */ |
|
246 int getSubState(); |
|
247 |
|
248 private: |
|
249 QList<GlxView *> mViewList; //It contains all the view created by it self. |
|
250 HbMainWindow *mMainWindow; //main window pointer, It have ownership only if |
|
251 HbAction *mBackAction; // For back soft key |
|
252 GlxMenuManager *mMenuManager; //Pointer of menu manger to add the menu in the view |
|
253 GlxEffectEngine *mEffectEngine; //To run the animation in between view transition |
|
254 QList<HbAction *> mActionList; //Tool bar action list |
|
255 QList<HbAction *> mMarkingActionList; //marking mode tool bar action list |
|
256 HbToolBar *mViewToolBar; //view tool bar |
|
257 HbToolBar *mMarkingToolBar; //marking mode tool bar |
|
258 GlxView *mView; |
|
259 QAbstractItemModel *mModel; //no ownership |
|
260 QItemSelectionModel * mSelectionModel; |
|
261 HbProgressDialog *mProgressDialog; |
|
262 GlxMainWindowEventFilter* mWindowEventFilter; |
|
263 |
|
264 }; |
|
265 |
|
266 |
|
267 #endif /* GLXVIEWMANAGER_H_ */ |