--- a/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -15,6 +15,7 @@
*
*/
#include <hbframeitem.h>
+#include <hbactivitymanager.h>
#include "cxenamespace.h"
#include "cxesettings.h"
@@ -49,13 +50,10 @@
* Constructor
*/
CxuiSceneModeView::CxuiSceneModeView(QGraphicsItem *parent) :
- HbView(parent),
- mMainWindow(NULL),
+ CxuiView(parent),
mSettingsInfo(NULL),
- mEngine(NULL),
- mDocumentLoader(NULL),
- mCaptureKeyHandler(NULL),
- mScenesBackground(NULL)
+ mScenesBackground(NULL),
+ mScenesHeading(NULL)
{
CX_DEBUG_IN_FUNCTION();
}
@@ -80,20 +78,19 @@
void CxuiSceneModeView::construct(HbMainWindow *mainwindow,
CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler *keyHandler)
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager)
{
CX_DEBUG_ENTER_FUNCTION();
+ CxuiView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager);
- mMainWindow = mainwindow;
- mDocumentLoader = documentLoader;
- mCaptureKeyHandler = keyHandler;
- mEngine = engine;
mSettingsInfo = new CxuiSettingsInfo(mEngine);
setContentFullScreen(true);
loadDefaultWidgets();
- mCameraReleaseTimer.setInterval(CXUI_SCENES_CAMERA_TIMEOUT);
- connect(&mCameraReleaseTimer, SIGNAL(timeout()), this, SLOT(releaseCameraHw()), Qt::UniqueConnection);
+ mCameraReleaseTimer.setInterval(CXUI_SCENES_CAMERA_TIMEOUT);
+ mCameraReleaseTimer.setSingleShot(true);
+ connect(&mCameraReleaseTimer, SIGNAL(timeout()), this, SLOT(releaseCamera()), Qt::UniqueConnection);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -108,21 +105,27 @@
QGraphicsWidget *widget = NULL;
- widget = mDocumentLoader->findWidget(SCENE_VIEW_CONTAINER);
+ widget = mDocumentLoader->findWidget(SCENE_MODE_VIEW_CONTAINER);
mScenesContainer = qobject_cast<HbWidget *> (widget);
+ mScenesHeading = qobject_cast<HbLabel *>(
+ mDocumentLoader->findWidget(SCENE_MODE_VIEW_HEADING_WIDGET));
+ CX_ASSERT_ALWAYS(mScenesHeading);
+
//Now let's retreive the pointer to icon widget
- widget = mDocumentLoader->findWidget(SCENE_VIEW_BG_IMAGE);
+ widget = mDocumentLoader->findWidget(SCENE_MODE_VIEW_BG_IMAGE);
mScenesBackground = qobject_cast<HbLabel *> (widget);
- widget = mDocumentLoader->findWidget(SCENE_VIEW_BG_IMAGE2);
+ widget = mDocumentLoader->findWidget(SCENE_MODE_VIEW_BG_IMAGE2);
mScenesBackground2 = qobject_cast<HbLabel *> (widget);
//Assuming that the automatic scene mode is always the default one
CX_DEBUG(("CxuiSceneModeView::loadDefaultWidgets -> Now setting default image"));
- mScenesBackground->setIcon(HbIcon(CXUI_SCENES_AUTOMATIC_IMAGE));
+ HbIcon background(CXUI_SCENES_AUTOMATIC_IMAGE);
+ background.setMirroringMode(HbIcon::LayoutDirection);
+ mScenesBackground->setIcon(background);
- widget = mDocumentLoader->findWidget(SCENE_VIEW_RADIOBUTTONS);
+ widget = mDocumentLoader->findWidget(SCENE_MODE_VIEW_RADIOBUTTONS);
mScenesList = qobject_cast<CxuiSettingRadioButtonList *> (widget);
mTransitionAnimation = new QPropertyAnimation(mScenesBackground2, "opacity");
@@ -130,6 +133,10 @@
createWidgetBackgroundGraphic(mScenesContainer, TRANSPARENT_BACKGROUND_GRAPHIC);
+ //!@todo: View flags property is missing from HbView,
+ // so can't properly hide title bar / status bar there.
+ hideControls();
+
connectSignals();
CX_DEBUG_EXIT_FUNCTION();
@@ -145,31 +152,6 @@
}
/*!
-* Function can be used to create a graphics item and setting it as a background
-* item for HbWidget. graphicName refers to system wide graphic name. Given graphic
-* can consist of one, three or nine pieces. Nine piece graphics are used by default.
-* See HbFrameDrawer documentation for graphic naming.
-*/
-void CxuiSceneModeView::createWidgetBackgroundGraphic(HbWidget *widget,
- const QString &graphicName,
- HbFrameDrawer::FrameType frameType)
-{
- if (widget) {
- HbFrameDrawer *drawer = new HbFrameDrawer(graphicName, frameType);
-
- if (drawer) {
- HbFrameItem *backgroundItem = new HbFrameItem(drawer, widget);
- if (backgroundItem) {
- // set item to fill the whole widget
- backgroundItem->setGeometry(QRectF(QPointF(0, 0), widget->size()));
- backgroundItem->setZValue(0);
- widget->setBackgroundItem(backgroundItem);
- }
- }
- }
-}
-
-/*!
* This public method assumes that the view is already properly constructed
*/
void CxuiSceneModeView::loadBackgroundImages()
@@ -184,10 +166,16 @@
mSettingPairList = data.mSettingPairList;
mScenesList->init(&data);
+ if (mScenesHeading) {
+ mScenesHeading->setPlainText(data.mHeading);
+ }
+
if (mScenesBackground) {
QString sceneId;
mEngine->settings().get(data.mSettingId, sceneId);
- mScenesBackground->setIcon(HbIcon(backgroundForScene(sceneId)));
+ HbIcon background(backgroundForScene(sceneId));
+ background.setMirroringMode(HbIcon::LayoutDirection);
+ mScenesBackground->setIcon(background);
} else {
//First time displaying a list
//Assuming that the automatic scene mode is always the default one and is on top of the list
@@ -197,6 +185,28 @@
}
/*!
+ * Save view state to activity. Scene mode view doesn't have it's own activity, just save
+ * correct pre-capture view.
+ */
+void CxuiSceneModeView::saveActivity()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QVariantMap data;
+ QVariantHash params;
+
+ //@todo: add pre-capture icon as screenshot
+ if (mEngine->mode() == Cxe::ImageMode) {
+ mActivityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY);
+ mActivityManager->addActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY, data, params);
+ } else {
+ mActivityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY);
+ mActivityManager->addActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY, data, params);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
* Handle selecting value in scene list.
*/
void CxuiSceneModeView::handleSceneRadiobuttonPress(int index)
@@ -205,7 +215,9 @@
CxUiSettings::SettingItem item = mSettingPairList.at(index);
QString sceneId = item.mValue.toString();
- mScenesBackground2->setIcon(HbIcon(backgroundForScene(sceneId)));
+ HbIcon background(backgroundForScene(sceneId));
+ background.setMirroringMode(HbIcon::LayoutDirection);
+ mScenesBackground2->setIcon(background);
startBackgroundTransition();
CX_DEBUG_EXIT_FUNCTION();
}
@@ -218,25 +230,25 @@
QString CxuiSceneModeView::backgroundForScene(const QString& sceneId)
{
//!@todo: This mapping should be added to the setting xml.
- if (sceneId == CxeSettingIds::IMAGE_SCENE_AUTO) {
+ if (sceneId == Cxe::IMAGE_SCENE_AUTO) {
return CXUI_SCENES_AUTOMATIC_IMAGE;
- } else if (sceneId == CxeSettingIds::IMAGE_SCENE_PORTRAIT) {
+ } else if (sceneId == Cxe::IMAGE_SCENE_PORTRAIT) {
return CXUI_SCENES_PORTRAIT_IMAGE;
- } else if (sceneId == CxeSettingIds::IMAGE_SCENE_SCENERY) {
+ } else if (sceneId == Cxe::IMAGE_SCENE_SCENERY) {
return CXUI_SCENES_LANDSCAPE_IMAGE;
- } else if (sceneId == CxeSettingIds::IMAGE_SCENE_MACRO) {
+ } else if (sceneId == Cxe::IMAGE_SCENE_MACRO) {
return CXUI_SCENES_CLOSEUP_IMAGE;
- } else if (sceneId == CxeSettingIds::IMAGE_SCENE_SPORTS) {
+ } else if (sceneId == Cxe::IMAGE_SCENE_SPORTS) {
return CXUI_SCENES_SPORT_IMAGE;
- } else if (sceneId == CxeSettingIds::IMAGE_SCENE_NIGHT) {
+ } else if (sceneId == Cxe::IMAGE_SCENE_NIGHT) {
return CXUI_SCENES_NIGHT_IMAGE;
- } else if (sceneId == CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT) {
+ } else if (sceneId == Cxe::IMAGE_SCENE_NIGHTPORTRAIT) {
return CXUI_SCENES_NIGHT_PORTRAIT_IMAGE;
- } else if (sceneId == CxeSettingIds::VIDEO_SCENE_AUTO) {
+ } else if (sceneId == Cxe::VIDEO_SCENE_AUTO) {
return CXUI_SCENES_AUTOMATIC_IMAGE;
- } else if (sceneId == CxeSettingIds::VIDEO_SCENE_LOWLIGHT) {
+ } else if (sceneId == Cxe::VIDEO_SCENE_LOWLIGHT) {
return CXUI_SCENES_LOW_LIGHT_IMAGE;
- } else if (sceneId == CxeSettingIds::VIDEO_SCENE_NIGHT) {
+ } else if (sceneId == Cxe::VIDEO_SCENE_NIGHT) {
return CXUI_SCENES_NIGHT_IMAGE;
} else {
return "";
@@ -302,6 +314,24 @@
}
/*!
+* Allow showing UI controls?
+* Title bar and other UI chrome is never shown in scene mode view.
+*/
+bool CxuiSceneModeView::allowShowControls() const
+{
+ return false;
+}
+
+/*!
+ * Play feedback when touching view outside of any widget?
+ * Feedback is not played in scene mode view.
+ */
+bool CxuiSceneModeView::isFeedbackEnabled() const
+{
+ return false;
+}
+
+/*!
* Slot to handle capture key full press.
*/
void CxuiSceneModeView::handleCaptureKeyPressed()
@@ -329,22 +359,10 @@
CX_DEBUG_ENTER_FUNCTION();
mScenesList->handleClose();
mScenesBackground->setIcon(HbIcon());
- // Make sure engine prepares for new image/video if necessary
- mEngine->initMode(mEngine->mode());
+ mScenesHeading = NULL;
emit viewCloseEvent();
CX_DEBUG_EXIT_FUNCTION();
}
-/*!
-* Slot to handle camera hw release timeout
-*/
-void CxuiSceneModeView::releaseCameraHw()
-{
- CX_DEBUG_ENTER_FUNCTION();
- mCameraReleaseTimer.stop();
- mEngine->cameraDeviceControl().release();
- CX_DEBUG_EXIT_FUNCTION();
-}
-
// end of file