|
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 |
|
28 class GlxView; |
|
29 class HbMainWindow; |
|
30 class QAbstractItemModel; |
|
31 class HbAction; |
|
32 class GlxMenuManager; |
|
33 class HbToolBar; |
|
34 class HbAction; |
|
35 class QItemSelectionModel; |
|
36 class HbMenu; |
|
37 class GlxSlideShowEffectEngine; |
|
38 |
|
39 #ifdef BUILD_VIEWMANAGER |
|
40 #define GLX_VIEWMANAGER_EXPORT Q_DECL_EXPORT |
|
41 #else |
|
42 #define GLX_VIEWMANAGER_EXPORT Q_DECL_IMPORT |
|
43 #endif |
|
44 |
|
45 typedef enum |
|
46 { |
|
47 NO_ACTION_ID = 0x00, |
|
48 GLX_ALL_ACTION_ID = 0x01, |
|
49 GLX_ALBUM_ACTION_ID = 0x02, |
|
50 GLX_CAMERA_ACTION_ID = 0x04, |
|
51 GLX_OVI_ACTION_ID = 0x08, |
|
52 GLX_ALL_ID = 0xFF |
|
53 } glxToolBarActionIds; |
|
54 |
|
55 class GLX_VIEWMANAGER_EXPORT GlxViewManager : public QObject |
|
56 { |
|
57 Q_OBJECT |
|
58 |
|
59 public : |
|
60 GlxViewManager(); |
|
61 ~GlxViewManager(); |
|
62 void setupItems(int subState = -1); |
|
63 void launchApplication(qint32 id, QAbstractItemModel *model); |
|
64 void addBackSoftKeyAction(); |
|
65 /* |
|
66 * This will return the orientation of main window |
|
67 */ |
|
68 Qt::Orientation orientation() const; |
|
69 /* |
|
70 * This will deactivate the current function |
|
71 * to be used only in cases where External launch was done |
|
72 */ |
|
73 void deactivateCurrentView(); |
|
74 /* |
|
75 * To update the tool bar enable and disable icon |
|
76 * id = This should be selected toolbar tab id |
|
77 */ |
|
78 void updateToolBarIcon(int id); |
|
79 /* |
|
80 * Enable the marking mode of the view to select multiple item |
|
81 */ |
|
82 void enterMarkingMode(qint32 viewId); |
|
83 /* |
|
84 * Enable the normal mode of the view |
|
85 */ |
|
86 void exitMarkingMode(qint32 viewId); |
|
87 /* |
|
88 * Pass the user action to the view |
|
89 */ |
|
90 void handleUserAction(qint32 viewId, qint32 commandId); |
|
91 /* |
|
92 * Return the selection model to the user |
|
93 */ |
|
94 QItemSelectionModel * getSelectionModel(qint32 viewId); |
|
95 |
|
96 signals : |
|
97 /* |
|
98 * emit the user action |
|
99 */ |
|
100 void actionTriggered(qint32 id); |
|
101 void externalCommand(int cmdId); |
|
102 |
|
103 public slots: |
|
104 /* |
|
105 * This public slot is used to launch the view |
|
106 */ |
|
107 void launchView (qint32 id, QAbstractItemModel *model); |
|
108 /* |
|
109 * It is over load slot and used to run the animation for view transition and launch the view |
|
110 */ |
|
111 void launchView (qint32 id, QAbstractItemModel *model, GlxEffect effect, GlxViewEffect viewEffect); |
|
112 /* |
|
113 * It will removed and deleted the view. |
|
114 * Currently It is not used so may be in future, It will be removed. |
|
115 */ |
|
116 void destroyView (qint32 id); |
|
117 /* |
|
118 * It will pass the user action to the state manager |
|
119 */ |
|
120 void actionProcess(qint32 id); |
|
121 /* |
|
122 * It will pass the user selected menu action to state manager |
|
123 * check for depricated with actionProcess api |
|
124 */ |
|
125 void handleMenuAction(qint32 commandId); |
|
126 /* |
|
127 * It will pass the user action ( tool bar + back ) to state manager |
|
128 */ |
|
129 void handleAction(); |
|
130 void cancelTimer(); |
|
131 /* |
|
132 * This is slot used for the animation finished call back |
|
133 */ |
|
134 void effectFinished( ); |
|
135 /* |
|
136 * This will open the item specifc Menu |
|
137 */ |
|
138 void itemSpecificMenuTriggered(qint32,QPointF ); |
|
139 |
|
140 protected: |
|
141 |
|
142 private slots: |
|
143 |
|
144 private: |
|
145 /* |
|
146 * It will create and return the view |
|
147 */ |
|
148 GlxView * resolveView (qint32 id); |
|
149 /* |
|
150 * It will find a view from the view list and return it |
|
151 */ |
|
152 GlxView * findView (qint32 id); |
|
153 /* |
|
154 * It will deativate the current view |
|
155 */ |
|
156 void deActivateView(); |
|
157 /* |
|
158 * It will activate and show the view |
|
159 */ |
|
160 void activateView(); |
|
161 /* |
|
162 * It will create the grid and list view tool bar action |
|
163 */ |
|
164 void createActions(); |
|
165 /* |
|
166 * It will create the marking mode toll bar action |
|
167 */ |
|
168 void createMarkingModeActions(); |
|
169 /* |
|
170 * It will create the grid and list view tool bar |
|
171 */ |
|
172 void createToolBar(); |
|
173 /* |
|
174 * It will create the marking mode tool bar |
|
175 */ |
|
176 void createMarkingModeToolBar(); |
|
177 /* |
|
178 * It will add all the view manager related connection |
|
179 */ |
|
180 void addConnection(); |
|
181 /* |
|
182 * It will remove all the view manager releted connection |
|
183 */ |
|
184 void removeConnection(); |
|
185 |
|
186 private: |
|
187 QList<GlxView *> mViewList; //It contains all the view created by it self. |
|
188 HbMainWindow *mMainWindow; //main window pointer, It have ownership only if |
|
189 HbAction *mBackAction; // For back soft key |
|
190 GlxMenuManager *mMenuManager; //Pointer of menu manger to add the menu in the view |
|
191 GlxSlideShowEffectEngine *mEffectEngine; //To run the animation in between view transition |
|
192 QList<HbAction *> mActionList; //Tool bar action list |
|
193 QList<HbAction *> mMarkingActionList; //marking mode tool bar action list |
|
194 HbToolBar *mViewToolBar; //view tool bar |
|
195 HbToolBar *mMarkingToolBar; //marking mode tool bar |
|
196 QList<QString > mSelIconPathList; //enable tool bar button icon path list |
|
197 QList<QString > mDefaultIconPathList; //disalbe tool bar button icon path list |
|
198 HbMenu *mMenu; |
|
199 GlxView *mView; |
|
200 QAbstractItemModel *mModel; //no ownership |
|
201 }; |
|
202 |
|
203 |
|
204 #endif /* GLXVIEWMANAGER_H_ */ |