|
1 /* |
|
2 * Copyright (c) 2010 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 ENGINEWRAPPER_H |
|
19 #define ENGINEWRAPPER_H |
|
20 |
|
21 #include <e32std.h> |
|
22 #include <e32base.h> |
|
23 #include <badesca.h> |
|
24 #include <engine.h> |
|
25 #include "loadgen.hrh" |
|
26 |
|
27 #include <QObject> |
|
28 |
|
29 class HbMainWindow; |
|
30 class HbAction; |
|
31 class MainView; |
|
32 class SettingsView; |
|
33 class CPULoadAttributes; |
|
34 class MemoryEatAttributes; |
|
35 class PhoneCallAttributes; |
|
36 class NetConnAttributes; |
|
37 class KeyPressAttributes; |
|
38 class PointerEventAttributes; |
|
39 class MessageAttributes; |
|
40 class ApplicationsAttributes; |
|
41 class PhotoCaptureAttributes; |
|
42 class BluetoothAttributes; |
|
43 |
|
44 /** |
|
45 * class that is used for communicating between Symbian and Qt code. |
|
46 */ |
|
47 class EngineWrapper : public QObject |
|
48 { |
|
49 Q_OBJECT |
|
50 |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Constructor |
|
55 */ |
|
56 EngineWrapper(HbMainWindow &mainWindow, MainView &mainView); |
|
57 |
|
58 /** |
|
59 * Destructor |
|
60 */ |
|
61 ~EngineWrapper(); |
|
62 |
|
63 /** |
|
64 * Initializes Engine Wrapper |
|
65 * @return true if engine was started successfully |
|
66 */ |
|
67 bool init(); |
|
68 |
|
69 public slots: |
|
70 void StopLoadYesNoDialogClosed(HbAction *action); |
|
71 void loadAddedOrEdited(TLoadGenCommandIds cmdId); |
|
72 void loadSettingsCanclled(); |
|
73 |
|
74 public: |
|
75 |
|
76 /* Functions that are called from UI: */ |
|
77 |
|
78 /** |
|
79 * Start new load |
|
80 */ |
|
81 bool startNewLoad(int commandId); |
|
82 |
|
83 /** |
|
84 * Launch Performance Monitor application. |
|
85 */ |
|
86 void launchPerfMonApp(); |
|
87 |
|
88 /** |
|
89 * Edit operation for load settings |
|
90 */ |
|
91 void loadEdit(int rowIndex); |
|
92 |
|
93 /** |
|
94 * CPU load attributes |
|
95 */ |
|
96 CPULoadAttributes getCpuLoadAttributes(); |
|
97 |
|
98 /** |
|
99 * Memory eat attributes |
|
100 */ |
|
101 MemoryEatAttributes getMemoryEatAttributes(); |
|
102 |
|
103 /** |
|
104 * Phone call attributes |
|
105 */ |
|
106 PhoneCallAttributes getPhoneCallAttributes(); |
|
107 |
|
108 /** |
|
109 * Network connection attributes |
|
110 */ |
|
111 NetConnAttributes getNetConnAttributes(); |
|
112 |
|
113 /** |
|
114 * Key presses attributes |
|
115 */ |
|
116 KeyPressAttributes getKeyPressAttributes(); |
|
117 |
|
118 /** |
|
119 * Pointer event attributes |
|
120 */ |
|
121 PointerEventAttributes getPointerEventAttributes(); |
|
122 |
|
123 /** |
|
124 * Message attributes |
|
125 */ |
|
126 MessageAttributes getMessageAttributes(); |
|
127 |
|
128 /** |
|
129 * Applications attributes |
|
130 */ |
|
131 ApplicationsAttributes getApplicationsAttributes(); |
|
132 |
|
133 /** |
|
134 * Photo capture attributes |
|
135 */ |
|
136 PhotoCaptureAttributes getPhotoCaptureAttributes(); |
|
137 |
|
138 /** |
|
139 * BT attributes |
|
140 */ |
|
141 BluetoothAttributes getBluetoothAttributes(); |
|
142 |
|
143 /** |
|
144 * Set attributes for CPU load |
|
145 */ |
|
146 void setCpuLoadAttributes(CPULoadAttributes attributes); |
|
147 |
|
148 /** |
|
149 * Set attributes for memory eat |
|
150 */ |
|
151 void setMemoryEatAttributes(MemoryEatAttributes attributes); |
|
152 |
|
153 /** |
|
154 * Set attributes for phone call |
|
155 */ |
|
156 void setPhoneCallAttributes(PhoneCallAttributes attributes); |
|
157 |
|
158 /** |
|
159 * Set attributes for network connection |
|
160 */ |
|
161 void setNetConnAttributes(NetConnAttributes attributes); |
|
162 |
|
163 /** |
|
164 * Set attributes for key presses |
|
165 */ |
|
166 void setKeyPressAttributes(KeyPressAttributes attributes); |
|
167 |
|
168 /** |
|
169 * Set pointer event for messages |
|
170 */ |
|
171 void setPointerEventAttributes(PointerEventAttributes attributes); |
|
172 |
|
173 /** |
|
174 * Set message attributes |
|
175 */ |
|
176 void setMessageAttributes(MessageAttributes attributes); |
|
177 |
|
178 /** |
|
179 * Set applications attributes |
|
180 */ |
|
181 void setApplicationsAttributes(ApplicationsAttributes attributes); |
|
182 |
|
183 /** |
|
184 * Set photo capture attributes |
|
185 */ |
|
186 void setPhotoCaptureAttributes(PhotoCaptureAttributes attributes); |
|
187 |
|
188 /** |
|
189 * Set BT attributes |
|
190 */ |
|
191 void setBluetoothAttributes(BluetoothAttributes attributes); |
|
192 |
|
193 /** |
|
194 * Stop load |
|
195 */ |
|
196 bool stopLoad(bool stopAll); |
|
197 |
|
198 /** |
|
199 * Resume all loads |
|
200 */ |
|
201 void resumeAllLoadItems(); |
|
202 |
|
203 /** |
|
204 * Suspend all loads |
|
205 */ |
|
206 void suspendAllLoadItems(); |
|
207 |
|
208 /** |
|
209 * Suspend or resume selected/highlighted item from load list. |
|
210 */ |
|
211 void suspendOrResumeSelectedOrHighlightedItems(); |
|
212 |
|
213 public: |
|
214 |
|
215 /* Functions that are called from engine: */ |
|
216 |
|
217 /** |
|
218 * uses Notifications class to show error message |
|
219 */ |
|
220 void ShowErrorMessage(const TDesC& aErrorMessage); |
|
221 |
|
222 /** |
|
223 * uses Notifications class to show user note |
|
224 */ |
|
225 void ShowNote(const TDesC& aNoteMessage); |
|
226 |
|
227 /** |
|
228 * Query item index |
|
229 * @return selected row in load list view |
|
230 */ |
|
231 TInt QueryCurrentItemIndex(); |
|
232 |
|
233 /** |
|
234 * selected indexes |
|
235 */ |
|
236 const CArrayFix<TInt>* QueryListSelectedIndexesOrCurrentItemL(); |
|
237 |
|
238 /** |
|
239 * Open settings for load. |
|
240 */ |
|
241 void OpenLoadSettings(TInt loadType, bool editExistingLoad); |
|
242 |
|
243 void ReFreshView(CDesCArray* aTextArray); |
|
244 /** |
|
245 * Clear load list selection(s) in Ui |
|
246 */ |
|
247 void ClearSelection(); |
|
248 |
|
249 /** |
|
250 * Set current index in load list |
|
251 */ |
|
252 void SetCurrentItemIndex(TInt aIndex); |
|
253 |
|
254 public: |
|
255 inline MainView& ViewReference() { return mMainView; }; |
|
256 inline HbMainWindow& WindowReference() { return mMainWindow; }; |
|
257 |
|
258 private: |
|
259 |
|
260 enum LoadTypes { |
|
261 Cpu, |
|
262 EatMemory, |
|
263 PhoneCalls, |
|
264 Messages, |
|
265 NWConnections, |
|
266 KeyPresses, |
|
267 Apps, |
|
268 Photos, |
|
269 BTAct, |
|
270 PointerEvents |
|
271 }; |
|
272 |
|
273 |
|
274 /* LoadGen engine */ |
|
275 CEngine* mEngine; |
|
276 |
|
277 MainView &mMainView; |
|
278 HbMainWindow &mMainWindow; |
|
279 bool mEditExistingLoad; |
|
280 }; |
|
281 |
|
282 #endif //ENGINEWRAPPER_H |