|
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: Declaration of the FTU default runtime. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef FTU_RUNTIMES_DEFAULTRUNTIME_H |
|
20 #define FTU_RUNTIMES_DEFAULTRUNTIME_H |
|
21 |
|
22 #include "ftutest_global.h" |
|
23 #include <QHash> |
|
24 #include <QStateMachine> |
|
25 |
|
26 FTU_TEST_CLASS(FtuDefaultRuntimeProviderTest) |
|
27 |
|
28 // Forward declarations |
|
29 class QStateMachine; |
|
30 class HbMainWindow; |
|
31 class FtuContentService; |
|
32 |
|
33 |
|
34 |
|
35 /** @ingroup group_ftudefaultruntimeprovider |
|
36 * @brief Default implementation of the ftu runtime. |
|
37 * |
|
38 * Creates an execution context (EC) and populates it with |
|
39 * runtime services. States are loaded from state provider |
|
40 * plugins. Each state is given an access to the EC. States |
|
41 * are added to a state machine. Finally, the state machine |
|
42 * is started. |
|
43 * |
|
44 * @lib ?library |
|
45 * @since S60 ?S60_version |
|
46 */ |
|
47 class FtuDefaultRuntime : public QStateMachine |
|
48 { |
|
49 Q_OBJECT |
|
50 |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Constructor. |
|
55 * @since S60 ?S60_version. |
|
56 * @param parent - address of parent QObject instance, by default none |
|
57 */ |
|
58 FtuDefaultRuntime(QObject* = 0); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 * @since S60 ?S60_version. |
|
63 */ |
|
64 ~FtuDefaultRuntime(); |
|
65 |
|
66 private: |
|
67 /** |
|
68 * Copy constructor |
|
69 */ |
|
70 Q_DISABLE_COPY(FtuDefaultRuntime) |
|
71 |
|
72 public slots: |
|
73 |
|
74 private slots: |
|
75 |
|
76 /** |
|
77 * Called after the state machine has started. |
|
78 * @since S60 ?S60_version. |
|
79 */ |
|
80 void handleStateMachineStarted(); |
|
81 |
|
82 /** |
|
83 * Called after the state machine has stopped. |
|
84 * @since S60 ?S60_version. |
|
85 */ |
|
86 void handleStateMachineStopped(); |
|
87 |
|
88 signals: |
|
89 |
|
90 /** |
|
91 * Emission of this signal initiates a transition to the final state. |
|
92 */ |
|
93 void stopStateMachine(); |
|
94 |
|
95 private: |
|
96 |
|
97 /** |
|
98 * Creates content service parts |
|
99 * @since S60 ?S60_version. |
|
100 */ |
|
101 void createContentServiceParts(); |
|
102 |
|
103 /** |
|
104 * Creates gui service parts |
|
105 * @since S60 ?S60_version. |
|
106 */ |
|
107 void createGuiServiceParts(); |
|
108 |
|
109 /** |
|
110 * Creates states |
|
111 * @since S60 ?S60_version. |
|
112 */ |
|
113 void createStates(); |
|
114 |
|
115 /** |
|
116 * Assign services to states based on value of property HS_SERVICES_REGISTRATION_KEY |
|
117 * @since S60 ?S60_version. |
|
118 */ |
|
119 void assignServices(); |
|
120 |
|
121 /** |
|
122 * Function create and initialize services shared between states |
|
123 */ |
|
124 void initializeRuntimeServices(); |
|
125 |
|
126 private: |
|
127 |
|
128 |
|
129 /** |
|
130 * Content service delivered to runtime's states. |
|
131 */ |
|
132 FtuContentService *mFtuContentService; |
|
133 |
|
134 /** |
|
135 * Window to visualize scene |
|
136 */ |
|
137 HbMainWindow *mWindow; |
|
138 |
|
139 /** |
|
140 * Contains address of runtime service. |
|
141 * Ownership transfered to application. Don't remove it. |
|
142 */ |
|
143 QHash<QString,QObject*> mServices; |
|
144 |
|
145 FTU_TEST_FRIEND_CLASS(FtuDefaultRuntimeProviderTest) |
|
146 |
|
147 }; |
|
148 |
|
149 #endif // FTU_RUNTIMES_DEFAULTRUNTIME_H |
|
150 |