|
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 |
|
19 #ifndef SETTINGSVIEW_H |
|
20 #define SETTINGSVIEW_H |
|
21 |
|
22 #include <hbmainwindow.h> |
|
23 #include <hbview.h> |
|
24 #include "loadgen.hrh" |
|
25 |
|
26 class EngineWrapper; |
|
27 class HbDataFormModelItem; |
|
28 class HbDataFormModel; |
|
29 class HbDataForm; |
|
30 class HbDataFormViewItem; |
|
31 class HbRadioButtonList; |
|
32 |
|
33 class CPULoadAttributes |
|
34 { |
|
35 public: |
|
36 uint mId; |
|
37 uint mPriority; |
|
38 uint mMode; |
|
39 uint mType; |
|
40 uint mLength; |
|
41 uint mIdle; |
|
42 uint mRandomVariance; |
|
43 int mCpu; |
|
44 uint mCpuCount; |
|
45 }; |
|
46 |
|
47 class MemoryEatAttributes |
|
48 { |
|
49 public: |
|
50 uint mId; |
|
51 uint mPriority; |
|
52 uint mSource; |
|
53 uint mType; |
|
54 uint mBuffer; |
|
55 uint mIdle; |
|
56 qint64 mAmount; |
|
57 qint64 mRandomMin; |
|
58 qint64 mRandomMax; |
|
59 QString mAmountDes; |
|
60 QString mRandomMinDes; |
|
61 QString mRandomMaxDes; |
|
62 uint mRandomVariance; |
|
63 }; |
|
64 |
|
65 class PhoneCallAttributes |
|
66 { |
|
67 public: |
|
68 uint mId; |
|
69 uint mPriority; |
|
70 QString mDestination; |
|
71 uint mLength; |
|
72 uint mIdle; |
|
73 uint mRandomVariance; |
|
74 }; |
|
75 |
|
76 class NetConnAttributes |
|
77 { |
|
78 public: |
|
79 uint mId; |
|
80 uint mPriority; |
|
81 QString mDestination; |
|
82 uint mIdle; |
|
83 uint mRandomVariance; |
|
84 }; |
|
85 |
|
86 class KeyPressAttributes |
|
87 { |
|
88 public: |
|
89 uint mId; |
|
90 uint mPriority; |
|
91 uint mHeartBeat; |
|
92 uint mRandomVariance; |
|
93 }; |
|
94 |
|
95 class PointerEventAttributes |
|
96 { |
|
97 public: |
|
98 uint mId; |
|
99 uint mPriority; |
|
100 uint mHeartBeat; |
|
101 uint mRandomVariance; |
|
102 }; |
|
103 |
|
104 class MessageAttributes |
|
105 { |
|
106 public: |
|
107 uint mId; |
|
108 int mMessageType; |
|
109 QString mDestination; |
|
110 uint mPriority; |
|
111 uint mAmount; |
|
112 int mLength; |
|
113 uint mIdle; |
|
114 uint mRandomVariance; |
|
115 }; |
|
116 |
|
117 class ApplicationsAttributes |
|
118 { |
|
119 public: |
|
120 uint mId; |
|
121 uint mPriority; |
|
122 uint mLaunchingInterval; |
|
123 uint mKeyPressType; |
|
124 uint mMaxOpen; |
|
125 uint mHeartBeat; |
|
126 uint mRandomVariance; |
|
127 QStringList mAppsArray; |
|
128 |
|
129 }; |
|
130 |
|
131 |
|
132 class PhotoCaptureAttributes |
|
133 { |
|
134 public: |
|
135 uint mId; |
|
136 int mPriority; |
|
137 int mCameraCount; |
|
138 int mCamera; |
|
139 uint mIdle; |
|
140 uint mRandomVariance; |
|
141 }; |
|
142 |
|
143 class BluetoothAttributes |
|
144 { |
|
145 public: |
|
146 uint mId; |
|
147 int mPriority; |
|
148 uint mIdle; |
|
149 uint mRandomVariance; |
|
150 bool mBluetoothSupported; |
|
151 }; |
|
152 |
|
153 |
|
154 class SettingsView : public HbView |
|
155 { |
|
156 Q_OBJECT |
|
157 |
|
158 public: |
|
159 SettingsView(HbView &mainView, HbMainWindow &parent, EngineWrapper &engine); |
|
160 ~SettingsView(); |
|
161 void open(const QString &settingsName, TLoadGenCommandIds cmdId); |
|
162 |
|
163 signals: |
|
164 void loadCompleted(TLoadGenCommandIds cmdId); |
|
165 void loadCanclled(); |
|
166 |
|
167 private slots: |
|
168 void backButtonPressed(); |
|
169 void okExit(); |
|
170 void cancelled(); |
|
171 void selectionChanged(int index); |
|
172 void dataItemDisplayed(const QModelIndex &index); |
|
173 |
|
174 private: |
|
175 void createItems(HbDataFormModel *model, HbDataFormModelItem *parent); |
|
176 void createCpuLoadItems(HbDataFormModel *model, HbDataFormModelItem *parent); |
|
177 void createEatMemoryItems(HbDataFormModel *model, HbDataFormModelItem *parent); |
|
178 void createPhoneCallItems(HbDataFormModel *model, HbDataFormModelItem *parent); |
|
179 void createNetConnItems(HbDataFormModel *model, HbDataFormModelItem *parent); |
|
180 void createKeyOrPointerItems(HbDataFormModel *model, HbDataFormModelItem *parent); |
|
181 void createMessageItems(HbDataFormModel *model, HbDataFormModelItem *parent); |
|
182 void createAppsItems(HbDataFormModel *model, HbDataFormModelItem *parent); |
|
183 void createPhotoItems(HbDataFormModel *model, HbDataFormModelItem *parent); |
|
184 void createBtItems(HbDataFormModel *model, HbDataFormModelItem *parent); |
|
185 void loadAttributes(); |
|
186 void saveSettings(); |
|
187 void saveCpuLoadSettings(); |
|
188 void saveEatMemorySettings(); |
|
189 void savePhoneCallSettings(); |
|
190 void saveNetConnSettings(); |
|
191 void saveKeyPressSettings(); |
|
192 void saveMessageSettings(); |
|
193 void savePointerEventSettings(); |
|
194 void saveApplicationsSettings(); |
|
195 void savePhotoSettings(); |
|
196 void saveBtSettings(); |
|
197 void exit(); |
|
198 void setDefaultSettings(); |
|
199 void setLoadAttributes(); |
|
200 |
|
201 private: |
|
202 HbMainWindow &mMainWindow; |
|
203 HbView &mMainView; |
|
204 EngineWrapper &mEngineWrapper; |
|
205 TLoadGenCommandIds mCmdId; |
|
206 |
|
207 /* Setting form */ |
|
208 HbDataForm *mSettingForm; |
|
209 |
|
210 /* Model for Setting form */ |
|
211 HbDataFormModel *mModel; |
|
212 |
|
213 /* Components for the model: */ |
|
214 |
|
215 /* grouped load settings */ |
|
216 HbDataFormModelItem *mLoadSettings; |
|
217 |
|
218 HbDataFormModelItem *mPriority; |
|
219 HbDataFormModelItem *mLoadMode; |
|
220 HbDataFormModelItem *mSource; |
|
221 HbDataFormModelItem *mType; |
|
222 HbDataFormModelItem *mAmount; |
|
223 HbDataFormModelItem *mMinAmountToBeLeft; |
|
224 HbDataFormModelItem *mMaxAmountToBeLeft; |
|
225 HbDataFormModelItem *mBuffer; |
|
226 HbDataFormModelItem *mLength; |
|
227 HbDataFormModelItem *mDestination; |
|
228 HbDataFormModelItem *mIdle; |
|
229 HbDataFormModelItem *mHeartBeat; |
|
230 HbDataFormModelItem *mRandomVar; |
|
231 HbDataFormModelItem *mMaxParallelApps; |
|
232 HbDataFormModelItem *mLaunchingInterval; |
|
233 HbDataFormModelItem *mKeyPressType; |
|
234 HbDataFormModelItem *mCamera; |
|
235 HbDataFormModelItem *mCpu; |
|
236 |
|
237 HbRadioButtonList *mModes; |
|
238 HbRadioButtonList *mTypes; |
|
239 |
|
240 /* load attributes for each load type*/ |
|
241 CPULoadAttributes mCPULoadAttributes; |
|
242 MemoryEatAttributes mMemoryEatAttributes; |
|
243 PhoneCallAttributes mPhoneCallAttributes; |
|
244 NetConnAttributes mNetConnAttributes; |
|
245 KeyPressAttributes mKeyPressAttributes; |
|
246 PointerEventAttributes mPointerEventAttributes; |
|
247 MessageAttributes mMessageAttributes; |
|
248 ApplicationsAttributes mApplicationsAttributes; |
|
249 PhotoCaptureAttributes mPhotoCaptureAttributes; |
|
250 BluetoothAttributes mBluetoothAttributes; |
|
251 }; |
|
252 |
|
253 #endif // SETTINGSVIEW_H |