|
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 |
|
21 #ifndef STATEHANDLER_H |
|
22 #define STATEHANDLER_H |
|
23 |
|
24 #include <QObject> |
|
25 #include <QList> |
|
26 #include <glxbasestate.h> |
|
27 |
|
28 class GlxState; |
|
29 class GlxViewManager; |
|
30 class GlxMediaModel; |
|
31 class GlxAlbumModel; |
|
32 class QAbstractItemModel; |
|
33 class GlxActionHandler; |
|
34 |
|
35 #ifdef BUILD_STATEMANAGER |
|
36 #define GLX_STATEMANAGER_EXPORT Q_DECL_EXPORT |
|
37 #else |
|
38 #define GLX_STATEMANAGER_EXPORT Q_DECL_IMPORT |
|
39 #endif |
|
40 |
|
41 class GLX_STATEMANAGER_EXPORT GlxStateManager : public QObject |
|
42 { |
|
43 Q_OBJECT |
|
44 friend class TestGlxStateManager; |
|
45 |
|
46 public : |
|
47 GlxStateManager(); |
|
48 virtual ~GlxStateManager(); |
|
49 void launchFromExternal(); |
|
50 void cleanupExternal(); |
|
51 |
|
52 //internal exposed function |
|
53 void enterMarkingMode(); |
|
54 void exitMarkingMode(); |
|
55 bool executeCommand(qint32 commandId); |
|
56 |
|
57 signals : |
|
58 void externalCommand(int cmdId); |
|
59 void setupItemsSignal(); |
|
60 |
|
61 public slots: |
|
62 void launchApplication(); |
|
63 void actionTriggered(qint32 id); |
|
64 void setupItems(); |
|
65 |
|
66 public : |
|
67 /* |
|
68 * It will create a new state and replace the current state with new state in the stack. |
|
69 * It will use in the case of state switching. |
|
70 * use -1 if state does not have internal state |
|
71 */ |
|
72 void changeState(qint32 newStateId, int internalState ); |
|
73 /* |
|
74 * Go back to previous state |
|
75 */ |
|
76 void previousState(); |
|
77 |
|
78 /* |
|
79 * Go back to a state in hierarchy and pop all the state upto that level. |
|
80 * if state is not found, then all the state from the hierachy is removed and create a new state on level 0 |
|
81 * This function will be use in the case when more then one back is required in single event. |
|
82 */ |
|
83 void goBack(qint32 stateId, int internalState); |
|
84 |
|
85 /* |
|
86 * Create a new state and current state should be pushed into stack. |
|
87 * use -1 if state does not have internal state |
|
88 */ |
|
89 void nextState(qint32 newStateId, int internalState ); |
|
90 |
|
91 /* |
|
92 * It will delete the current model |
|
93 */ |
|
94 void removeCurrentModel(); |
|
95 |
|
96 |
|
97 private: |
|
98 /* |
|
99 * Factory function to create the state. |
|
100 */ |
|
101 GlxState * createState(qint32 state); |
|
102 /* |
|
103 * Factory function to create the model. |
|
104 */ |
|
105 void createModel(qint32 stateId, NavigationDir dir = NO_DIR); |
|
106 /* |
|
107 * Factory function to create the grid model. |
|
108 */ |
|
109 void createGridModel(int internalState, NavigationDir dir = NO_DIR); |
|
110 void eventHandler(qint32 &id); |
|
111 /* |
|
112 * A function to care the exit for application, in the case when application launch from internal and external |
|
113 */ |
|
114 void exitApplication(); |
|
115 |
|
116 private: |
|
117 GlxViewManager *mViewManager; |
|
118 GlxMediaModel *mAllMediaModel; // for all grid |
|
119 GlxMediaModel *mAlbumGridMediaModel; // for album grid |
|
120 GlxAlbumModel *mAlbumMediaModel; // for album list |
|
121 GlxMediaModel *mImageviewerMediaModel;// for image viewer |
|
122 QAbstractItemModel *mCurrentModel; // no owner ship |
|
123 GlxState *mCurrentState; |
|
124 GlxActionHandler *mActionHandler; |
|
125 int mCollectionId; |
|
126 }; |
|
127 |
|
128 |
|
129 #endif /* STATEHANDLER_H_ */ |