13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 #include <hbframeitem.h> |
17 #include <hbframeitem.h> |
|
18 #include <hbactivitymanager.h> |
18 |
19 |
19 #include "cxenamespace.h" |
20 #include "cxenamespace.h" |
20 #include "cxesettings.h" |
21 #include "cxesettings.h" |
21 #include "cxuiscenemodeview.h" |
22 #include "cxuiscenemodeview.h" |
22 #include "cxuienums.h" |
23 #include "cxuienums.h" |
75 * @param keyHandler |
76 * @param keyHandler |
76 */ |
77 */ |
77 void CxuiSceneModeView::construct(HbMainWindow *mainwindow, |
78 void CxuiSceneModeView::construct(HbMainWindow *mainwindow, |
78 CxeEngine *engine, |
79 CxeEngine *engine, |
79 CxuiDocumentLoader *documentLoader, |
80 CxuiDocumentLoader *documentLoader, |
80 CxuiCaptureKeyHandler *keyHandler) |
81 CxuiCaptureKeyHandler *keyHandler, |
81 { |
82 HbActivityManager *activityManager) |
82 CX_DEBUG_ENTER_FUNCTION(); |
83 { |
83 CxuiView::construct(mainwindow, engine, documentLoader, keyHandler); |
84 CX_DEBUG_ENTER_FUNCTION(); |
|
85 CxuiView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager); |
84 |
86 |
85 mSettingsInfo = new CxuiSettingsInfo(mEngine); |
87 mSettingsInfo = new CxuiSettingsInfo(mEngine); |
86 setContentFullScreen(true); |
88 setContentFullScreen(true); |
87 loadDefaultWidgets(); |
89 loadDefaultWidgets(); |
88 |
90 |
117 widget = mDocumentLoader->findWidget(SCENE_VIEW_BG_IMAGE2); |
119 widget = mDocumentLoader->findWidget(SCENE_VIEW_BG_IMAGE2); |
118 mScenesBackground2 = qobject_cast<HbLabel *> (widget); |
120 mScenesBackground2 = qobject_cast<HbLabel *> (widget); |
119 |
121 |
120 //Assuming that the automatic scene mode is always the default one |
122 //Assuming that the automatic scene mode is always the default one |
121 CX_DEBUG(("CxuiSceneModeView::loadDefaultWidgets -> Now setting default image")); |
123 CX_DEBUG(("CxuiSceneModeView::loadDefaultWidgets -> Now setting default image")); |
122 mScenesBackground->setIcon(HbIcon(CXUI_SCENES_AUTOMATIC_IMAGE)); |
124 HbIcon background(CXUI_SCENES_AUTOMATIC_IMAGE); |
|
125 background.setMirroringMode(HbIcon::LayoutDirection); |
|
126 mScenesBackground->setIcon(background); |
123 |
127 |
124 widget = mDocumentLoader->findWidget(SCENE_VIEW_RADIOBUTTONS); |
128 widget = mDocumentLoader->findWidget(SCENE_VIEW_RADIOBUTTONS); |
125 mScenesList = qobject_cast<CxuiSettingRadioButtonList *> (widget); |
129 mScenesList = qobject_cast<CxuiSettingRadioButtonList *> (widget); |
126 |
130 |
127 mTransitionAnimation = new QPropertyAnimation(mScenesBackground2, "opacity"); |
131 mTransitionAnimation = new QPropertyAnimation(mScenesBackground2, "opacity"); |
167 } |
171 } |
168 |
172 |
169 if (mScenesBackground) { |
173 if (mScenesBackground) { |
170 QString sceneId; |
174 QString sceneId; |
171 mEngine->settings().get(data.mSettingId, sceneId); |
175 mEngine->settings().get(data.mSettingId, sceneId); |
172 mScenesBackground->setIcon(HbIcon(backgroundForScene(sceneId))); |
176 HbIcon background(backgroundForScene(sceneId)); |
|
177 background.setMirroringMode(HbIcon::LayoutDirection); |
|
178 mScenesBackground->setIcon(background); |
173 } else { |
179 } else { |
174 //First time displaying a list |
180 //First time displaying a list |
175 //Assuming that the automatic scene mode is always the default one and is on top of the list |
181 //Assuming that the automatic scene mode is always the default one and is on top of the list |
176 mScenesList->setSelected(0); |
182 mScenesList->setSelected(0); |
177 } |
183 } |
178 CX_DEBUG_EXIT_FUNCTION(); |
184 CX_DEBUG_EXIT_FUNCTION(); |
179 } |
185 } |
180 |
186 |
181 /*! |
187 /*! |
|
188 * Save view state to activity. Scene mode view doesn't have it's own activity, just save |
|
189 * correct pre-capture view. |
|
190 */ |
|
191 void CxuiSceneModeView::saveActivity() |
|
192 { |
|
193 CX_DEBUG_ENTER_FUNCTION(); |
|
194 QVariantMap data; |
|
195 QVariantHash params; |
|
196 |
|
197 //@todo: add pre-capture icon as screenshot |
|
198 if (mEngine->mode() == Cxe::ImageMode) { |
|
199 mActivityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY); |
|
200 mActivityManager->addActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY, data, params); |
|
201 } else { |
|
202 mActivityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY); |
|
203 mActivityManager->addActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY, data, params); |
|
204 } |
|
205 |
|
206 CX_DEBUG_EXIT_FUNCTION(); |
|
207 } |
|
208 |
|
209 /*! |
182 * Handle selecting value in scene list. |
210 * Handle selecting value in scene list. |
183 */ |
211 */ |
184 void CxuiSceneModeView::handleSceneRadiobuttonPress(int index) |
212 void CxuiSceneModeView::handleSceneRadiobuttonPress(int index) |
185 { |
213 { |
186 CX_DEBUG_ENTER_FUNCTION(); |
214 CX_DEBUG_ENTER_FUNCTION(); |
187 |
215 |
188 CxUiSettings::SettingItem item = mSettingPairList.at(index); |
216 CxUiSettings::SettingItem item = mSettingPairList.at(index); |
189 QString sceneId = item.mValue.toString(); |
217 QString sceneId = item.mValue.toString(); |
190 mScenesBackground2->setIcon(HbIcon(backgroundForScene(sceneId))); |
218 HbIcon background(backgroundForScene(sceneId)); |
|
219 background.setMirroringMode(HbIcon::LayoutDirection); |
|
220 mScenesBackground2->setIcon(background); |
191 startBackgroundTransition(); |
221 startBackgroundTransition(); |
192 CX_DEBUG_EXIT_FUNCTION(); |
222 CX_DEBUG_EXIT_FUNCTION(); |
193 } |
223 } |
194 |
224 |
195 |
225 |
198 * for each of the scenes. |
228 * for each of the scenes. |
199 */ |
229 */ |
200 QString CxuiSceneModeView::backgroundForScene(const QString& sceneId) |
230 QString CxuiSceneModeView::backgroundForScene(const QString& sceneId) |
201 { |
231 { |
202 //!@todo: This mapping should be added to the setting xml. |
232 //!@todo: This mapping should be added to the setting xml. |
203 if (sceneId == CxeSettingIds::IMAGE_SCENE_AUTO) { |
233 if (sceneId == Cxe::IMAGE_SCENE_AUTO) { |
204 return CXUI_SCENES_AUTOMATIC_IMAGE; |
234 return CXUI_SCENES_AUTOMATIC_IMAGE; |
205 } else if (sceneId == CxeSettingIds::IMAGE_SCENE_PORTRAIT) { |
235 } else if (sceneId == Cxe::IMAGE_SCENE_PORTRAIT) { |
206 return CXUI_SCENES_PORTRAIT_IMAGE; |
236 return CXUI_SCENES_PORTRAIT_IMAGE; |
207 } else if (sceneId == CxeSettingIds::IMAGE_SCENE_SCENERY) { |
237 } else if (sceneId == Cxe::IMAGE_SCENE_SCENERY) { |
208 return CXUI_SCENES_LANDSCAPE_IMAGE; |
238 return CXUI_SCENES_LANDSCAPE_IMAGE; |
209 } else if (sceneId == CxeSettingIds::IMAGE_SCENE_MACRO) { |
239 } else if (sceneId == Cxe::IMAGE_SCENE_MACRO) { |
210 return CXUI_SCENES_CLOSEUP_IMAGE; |
240 return CXUI_SCENES_CLOSEUP_IMAGE; |
211 } else if (sceneId == CxeSettingIds::IMAGE_SCENE_SPORTS) { |
241 } else if (sceneId == Cxe::IMAGE_SCENE_SPORTS) { |
212 return CXUI_SCENES_SPORT_IMAGE; |
242 return CXUI_SCENES_SPORT_IMAGE; |
213 } else if (sceneId == CxeSettingIds::IMAGE_SCENE_NIGHT) { |
243 } else if (sceneId == Cxe::IMAGE_SCENE_NIGHT) { |
214 return CXUI_SCENES_NIGHT_IMAGE; |
244 return CXUI_SCENES_NIGHT_IMAGE; |
215 } else if (sceneId == CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT) { |
245 } else if (sceneId == Cxe::IMAGE_SCENE_NIGHTPORTRAIT) { |
216 return CXUI_SCENES_NIGHT_PORTRAIT_IMAGE; |
246 return CXUI_SCENES_NIGHT_PORTRAIT_IMAGE; |
217 } else if (sceneId == CxeSettingIds::VIDEO_SCENE_AUTO) { |
247 } else if (sceneId == Cxe::VIDEO_SCENE_AUTO) { |
218 return CXUI_SCENES_AUTOMATIC_IMAGE; |
248 return CXUI_SCENES_AUTOMATIC_IMAGE; |
219 } else if (sceneId == CxeSettingIds::VIDEO_SCENE_LOWLIGHT) { |
249 } else if (sceneId == Cxe::VIDEO_SCENE_LOWLIGHT) { |
220 return CXUI_SCENES_LOW_LIGHT_IMAGE; |
250 return CXUI_SCENES_LOW_LIGHT_IMAGE; |
221 } else if (sceneId == CxeSettingIds::VIDEO_SCENE_NIGHT) { |
251 } else if (sceneId == Cxe::VIDEO_SCENE_NIGHT) { |
222 return CXUI_SCENES_NIGHT_IMAGE; |
252 return CXUI_SCENES_NIGHT_IMAGE; |
223 } else { |
253 } else { |
224 return ""; |
254 return ""; |
225 } |
255 } |
226 |
256 |
319 { |
358 { |
320 CX_DEBUG_ENTER_FUNCTION(); |
359 CX_DEBUG_ENTER_FUNCTION(); |
321 mScenesList->handleClose(); |
360 mScenesList->handleClose(); |
322 mScenesBackground->setIcon(HbIcon()); |
361 mScenesBackground->setIcon(HbIcon()); |
323 mScenesHeading = NULL; |
362 mScenesHeading = NULL; |
324 // Make sure engine prepares for new image/video if necessary |
|
325 mEngine->initMode(mEngine->mode()); |
|
326 emit viewCloseEvent(); |
363 emit viewCloseEvent(); |
327 CX_DEBUG_EXIT_FUNCTION(); |
364 CX_DEBUG_EXIT_FUNCTION(); |
328 } |
365 } |
329 |
366 |
330 // end of file |
367 // end of file |